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);
        }
-- 
2.7.4

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

Reply via email to