[Mesa-dev] [PATCH 07/74] glsl: lower SSBO reads to ir_binop_ssbo_load expressions

Iago Toral Quiroga itoral at igalia.com
Thu May 14 07:06:10 PDT 2015


From: Kristian Høgsberg <krh at bitplanet.net>

The same we do for UBO loads with ir_binop_ubo_load.
---
 src/glsl/lower_ubo_reference.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp
index 4ea4ccb..fb8a890 100644
--- a/src/glsl/lower_ubo_reference.cpp
+++ b/src/glsl/lower_ubo_reference.cpp
@@ -149,6 +149,7 @@ public:
    struct gl_shader *shader;
    struct gl_uniform_buffer_variable *ubo_var;
    ir_rvalue *uniform_block;
+   enum ir_expression_operation opcode;
    bool progress;
 };
 
@@ -252,6 +253,11 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue)
             this->uniform_block = index;
          }
 
+         if (shader->UniformBlocks[i].IsBuffer)
+            this->opcode = ir_binop_ssbo_load;
+         else
+            this->opcode = ir_binop_ubo_load;
+
          struct gl_uniform_block *block = &shader->UniformBlocks[i];
 
          this->ubo_var = var->is_interface_instance()
@@ -413,7 +419,7 @@ lower_ubo_reference_visitor::ubo_load(const glsl_type *type,
 {
    ir_rvalue *block_ref = this->uniform_block->clone(mem_ctx, NULL);
    return new(mem_ctx)
-      ir_expression(ir_binop_ubo_load,
+      ir_expression(this->opcode,
                     type,
                     block_ref,
                     offset);
-- 
1.9.1



More information about the mesa-dev mailing list