From 8080082ad7823dc6baa43f0fb4935ae02e6f09e0 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 15 May 2017 12:55:05 +0200 Subject: mesa: unify _mesa_uniform() for image uniforms Signed-off-by: Samuel Pitoiset Reviewed-by: Elie Tournier Reviewed-by: Timothy Arceri --- src/mesa/main/uniform_query.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 979bd0dc461..16e3fe3d527 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -1018,13 +1018,15 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values, */ if (uni->type->is_image()) { for (int i = 0; i < MESA_SHADER_STAGES; i++) { - if (uni->opaque[i].active) { - struct gl_linked_shader *sh = shProg->_LinkedShaders[i]; + struct gl_linked_shader *sh = shProg->_LinkedShaders[i]; - for (int j = 0; j < count; j++) - sh->Program->sh.ImageUnits[uni->opaque[i].index + offset + j] = - ((GLint *) values)[j]; - } + /* If the shader stage doesn't use the image uniform, skip this. */ + if (!uni->opaque[i].active) + continue; + + for (int j = 0; j < count; j++) + sh->Program->sh.ImageUnits[uni->opaque[i].index + offset + j] = + ((GLint *) values)[j]; } ctx->NewDriverState |= ctx->DriverFlags.NewImageUnits; -- cgit v1.2.3