[Piglit] [PATCH 1/3] glx/glx-multithread-texture: Avoid uploading stale data to texture

Thomas Hellstrom thellstrom at vmware.com
Wed Jun 21 12:25:22 UTC 2017


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 <fjhenigman at google.com>
Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
---
 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



More information about the Piglit mailing list