On 06/21/2017 05:16 PM, Brian Paul wrote:
On 06/21/2017 06:25 AM, Thomas Hellstrom wrote:
the (tex->color != color) test, if false may cause uploading of stale
tex_data to the texture and cause a comparison failure. Also add a flush
after uploading so that texture data actually becomes visible for the draw
thread.

Cc: Frank Henigman <[email protected]>
Signed-off-by: Thomas Hellstrom <[email protected]>
---
  tests/glx/glx-multithread-texture.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/glx/glx-multithread-texture.c b/tests/glx/glx-multithread-texture.c
index 94ca1bc..c838fb7 100644
--- a/tests/glx/glx-multithread-texture.c
+++ b/tests/glx/glx-multithread-texture.c
@@ -113,10 +113,12 @@ load_func(void *arg)
          if (tex->color != color) {
              memset(tex_data, color, tex_bytes);
              tex->color = color;
+            glBindTexture(GL_TEXTURE_2D, tex->id);
+            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex_width,
+                     tex_height, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+                     tex_data);
+            glFlush();
          }
-        glBindTexture(GL_TEXTURE_2D, tex->id);
-        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex_width, tex_height,
-                 0, GL_RGBA, GL_UNSIGNED_BYTE, tex_data);

          tex = advance(&count, LOAD);
      }


I'm surprised that wasn't found sooner.

Reviewed-by: Brian Paul <[email protected]>



Actually, the (tex->color != color) test was, due to the number of textures, typically only false when the thread was spinning waiting for a new texture to become available, and then it had already initialized tex_data with the current color.

The fact that the flush wasn't needed before was due to the fact that on each spin waiting for a new texture, the code repeated the texture upload with the same data and eventually filled the command buffer, causing a flush....


/Thomas


_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to