[Piglit] [PATCH 03/18] shader_runner: Take advantage of texture binding book-keeping in image binding command.

Francisco Jerez currojerez at riseup.net
Tue Oct 18 23:36:29 UTC 2016


No need to do the glActiveTexture + glGetIntegerv dance to find out
which texture object is bound to a texture unit.
---
 tests/shaders/shader_runner.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 50025b8..2a37b56 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -3023,12 +3023,8 @@ piglit_display(void)
 				  "image texture %d %31s",
 				  &tex, s) == 2) {
 			const GLenum img_fmt = piglit_get_gl_enum_from_name(s);
-			GLint tex_num;
-
-			glActiveTexture(GL_TEXTURE0 + tex);
-			glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex_num);
-			glBindImageTexture(tex, tex_num, 0, GL_FALSE, 0,
-					   GL_READ_WRITE, img_fmt);
+			glBindImageTexture(tex, get_texture_binding(tex)->obj, 0,
+					   GL_FALSE, 0, GL_READ_WRITE, img_fmt);
 		} else if (sscanf(line, "memory barrier %s", s) == 1) {
 			glMemoryBarrier(piglit_get_gl_memory_barrier_enum_from_name(s));
 		} else if (sscanf(line, "ortho %f %f %f %f",
-- 
2.9.0



More information about the Piglit mailing list