[Mesa-dev] [PATCH 1/2] glsl: use is_image() anywhere it's possible

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Feb 24 13:40:20 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/compiler/glsl/link_uniform_initializers.cpp | 2 +-
 src/compiler/glsl_types.cpp                     | 3 +--
 src/mesa/main/uniform_query.cpp                 | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp
index fe0841f472..7e5b80d5c7 100644
--- a/src/compiler/glsl/link_uniform_initializers.cpp
+++ b/src/compiler/glsl/link_uniform_initializers.cpp
@@ -140,7 +140,7 @@ set_opaque_binding(void *mem_ctx, gl_shader_program *prog,
                      storage->storage[i].i;
                }
 
-            } else if (storage->type->base_type == GLSL_TYPE_IMAGE &&
+            } else if (storage->type->is_image() &&
                     storage->opaque[sh].active) {
                for (unsigned i = 0; i < elements; i++) {
                   const unsigned index = storage->opaque[sh].index + i;
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index a431edcdd3..7cbb21112f 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -2032,8 +2032,7 @@ glsl_type::coordinate_components() const
     * cubemap faces.
     */
    if (sampler_array &&
-       !(base_type == GLSL_TYPE_IMAGE &&
-         sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE))
+       !(is_image() && sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE))
       size += 1;
 
    return size;
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index cb1c51fae3..010a7b24b1 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -356,7 +356,7 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
 	      (uni->type->base_type == GLSL_TYPE_INT
 	       || uni->type->base_type == GLSL_TYPE_UINT
                || uni->type->base_type == GLSL_TYPE_SAMPLER
-               || uni->type->base_type == GLSL_TYPE_IMAGE))
+               || uni->type->is_image()))
           || ((returnType == GLSL_TYPE_UINT64 ||
                returnType == GLSL_TYPE_INT64 ) &&
               (uni->type->base_type == GLSL_TYPE_UINT64 ||
-- 
2.11.1



More information about the mesa-dev mailing list