title: glTexSubImage2D extremely slow on Intel video card
body: <p>My video card is Mobile Intel 4 Series. I'm updating a texture with changing data every frame, here's my main loop:</p>
  
  <pre><code>for(;;) {
      Timer timer;
  
      glBindTexture(GL_TEXTURE2D, tex);
      glBegin(GL_QUADS); ... /* draw textured quad */ ... glEnd();
      glTexSubImage2D(GL_TEXTURE2D, 0, 0, 0, 512, 512,
          GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
      swapBuffers();
  
      cout &lt;&lt; timer.Elapsed();
  }
  </code></pre>
  
  <p>Every iteration takes 120ms. However, inserting glFlush before glTexSubImage2D brings the iteration time to 2ms.</p>
  
  <p><strong>The issue is not in the pixel format.</strong> I've tried the pixel formats BGRA, RGBA and ABGR_EXT together with the pixel types UNSIGNED_BYTE, BYTE, UNSIGNED_INT_8_8_8_8 and UNSIGNED_INT_8_8_8_8_EXT. The texture's internal pixel format is RGBA.</p>
  
  <p><strong>The order of calls matters.</strong> Moving the texture upload before the quad drawing, for example, fixes the slowness.</p>
  
  <p>I also tried this on an GeForce GT 420M card, and it works fast there. My real app does have performance problems on non-Intel cards that are fixed by glFlush calls, but I haven't distilled those to a test case yet.</p>
  
  <p>Any ideas on how to debug this?</p>