<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - glBufferSubData doesn't update the buffer"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=90734">90734</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>glBufferSubData doesn't update the buffer
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/DRI/i965
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>idr@freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kaillasse91@hotmail.fr
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The behaviour of my application is very different with mesa and a Sandy bridge
HD2000 gpu.

Using INTEL_DEBUG=perf I see a lot of
'Using a blit copy to avoid stalling on glBufferSubData(6336, 6408) (0kb) to a
busy (0-72000) buffer object.'
with whatever the range I was updating is.

Getting the buffer back with glGetBufferSubData shows that the buffer is
sometimes not/impartially (?) updated.

Updating the whole buffer or forcing a sync with glFinish corrects the errors.

For info. :

void ShapeCollectionGl::updateBufferRange(int startIdx, int endIdx)
{
    glBindVertexArray(vao_);

    glBindBuffer(GL_ARRAY_BUFFER, vbo_);

    int offPos = shapesGl_[startIdx].offPos;
    int sizeData = shapesGl_[endIdx].offPos + shapesGl_[endIdx].pos.size() -
offPos;

    // glFinish() here solves the problem

    glBufferSubData(GL_ARRAY_BUFFER,
                    offPos * sizeof(VertexData),
                    sizeData * sizeof(VertexData),
                    &bufData_[offPos]);

    // reading the buffer back here with glGetBufferSubData shows the
difference

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo_);

    int offIdx = shapesGl_[startIdx].offIdx;
    int sizeIdx = shapesGl_[endIdx].offIdx + shapesGl_[endIdx].idx.size() -
offIdx;

    glBufferSubData(GL_ELEMENT_ARRAY_BUFFER,
                    offIdx * sizeof(GLuint),
                    sizeIdx * sizeof(GLuint),
                    &bufIdx_[offIdx]);

    glBindVertexArray(0);
}

00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core
Processor Family Integrated Graphics Controller [8086:0102] (rev 09) (prog-if
00 [VGA controller])

OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.7.0-devel
(git-10aacf5 2015-05-28 trusty-oibaf-ppa)

Linux 4.0.4-040004-generic #201505171336 SMP Sun May 17 17:37:22 UTC 2015
x86_64 x86_64 x86_64 GNU/Linux</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>