[Mesa-dev] [PATCH 3/4] mesa: unify _mesa_uniform() for image uniforms

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon May 15 10:55:05 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 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 586b92d2eb..6aba8ace0e 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -1009,13 +1009,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;
-- 
2.13.0



More information about the mesa-dev mailing list