Mesa (master): mesa: unify _mesa_uniform() for image uniforms

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Tue May 16 07:33:47 UTC 2017


Module: Mesa
Branch: master
Commit: 8080082ad7823dc6baa43f0fb4935ae02e6f09e0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8080082ad7823dc6baa43f0fb4935ae02e6f09e0

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Mon May 15 12:55:05 2017 +0200

mesa: unify _mesa_uniform() for image uniforms

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Elie Tournier <elie.tournier at collabora.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.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 979bd0dc46..16e3fe3d52 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;




More information about the mesa-commit mailing list