From: Samuel Pitoiset Date: Mon, 15 May 2017 10:55:05 +0000 (+0200) Subject: mesa: unify _mesa_uniform() for image uniforms X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8080082ad7823dc6baa43f0fb4935ae02e6f09e0;p=mesa.git mesa: unify _mesa_uniform() for image uniforms Signed-off-by: Samuel Pitoiset Reviewed-by: Elie Tournier Reviewed-by: Timothy Arceri --- 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;