[Mesa-dev] [PATCH 13/19] glsl: support uniform sampler AoA lookup

Timothy Arceri t_arceri at yahoo.com.au
Sat Jun 20 05:33:10 PDT 2015


To do this we make sure to only append the array subscript
to structs.
---
 src/mesa/program/sampler.cpp | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp
index ea3024d..34eee6d 100644
--- a/src/mesa/program/sampler.cpp
+++ b/src/mesa/program/sampler.cpp
@@ -38,14 +38,12 @@
 class get_sampler_name : public ir_hierarchical_visitor
 {
 public:
-   get_sampler_name(ir_dereference *last,
-		    struct gl_shader_program *shader_program)
+   get_sampler_name(struct gl_shader_program *shader_program)
    {
       this->mem_ctx = ralloc_context(NULL);
       this->shader_program = shader_program;
       this->name = NULL;
       this->offset = 0;
-      this->last = last;
    }
 
    ~get_sampler_name()
@@ -86,7 +84,7 @@ public:
 		       "and is unlikely to be supported for 1.10 in Mesa.\n");
 	 i = 0;
       }
-      if (ir != last) {
+      if (ir->type->without_array()->is_record()) {
 	 this->name = ralloc_asprintf(mem_ctx, "%s[%d]", name, i);
       } else {
 	 offset = i;
@@ -98,7 +96,6 @@ public:
    const char *name;
    void *mem_ctx;
    int offset;
-   ir_dereference *last;
 };
 
 
@@ -107,7 +104,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
 				struct gl_shader_program *shader_program,
 				const struct gl_program *prog)
 {
-   get_sampler_name getname(sampler, shader_program);
+   get_sampler_name getname(shader_program);
 
    GLuint shader = _mesa_program_enum_to_shader_stage(prog->Target);
 
-- 
2.1.0



More information about the mesa-dev mailing list