[Mesa-dev] [PATCH v2 56/82] nir: implement ir_binop_ssbo_load

Iago Toral Quiroga itoral at igalia.com
Wed Jun 3 00:01:46 PDT 2015


---
 src/glsl/nir/glsl_to_nir.cpp            | 7 +++++--
 src/glsl/nir/nir_intrinsics.h           | 2 +-
 src/glsl/nir/nir_lower_phis_to_scalar.c | 2 ++
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index 647aa34..2fb4303 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -1003,14 +1003,17 @@ nir_visitor::visit(ir_expression *ir)
 {
    /* Some special cases */
    switch (ir->operation) {
+   case ir_binop_ssbo_load:
    case ir_binop_ubo_load: {
       ir_constant *const_index = ir->operands[1]->as_constant();
 
       nir_intrinsic_op op;
       if (const_index) {
-         op = nir_intrinsic_load_ubo;
+         op = ir->operation == ir_binop_ubo_load ?
+            nir_intrinsic_load_ubo : nir_intrinsic_load_ssbo;
       } else {
-         op = nir_intrinsic_load_ubo_indirect;
+         op = ir->operation == ir_binop_ubo_load ?
+            nir_intrinsic_load_ubo_indirect : nir_intrinsic_load_ssbo_indirect;
       }
       nir_intrinsic_instr *load = nir_intrinsic_instr_create(this->shader, op);
       load->num_components = ir->type->vector_elements;
diff --git a/src/glsl/nir/nir_intrinsics.h b/src/glsl/nir/nir_intrinsics.h
index 82f59d7..72199e5 100644
--- a/src/glsl/nir/nir_intrinsics.h
+++ b/src/glsl/nir/nir_intrinsics.h
@@ -167,7 +167,7 @@ SYSTEM_VALUE(invocation_id, 1)
 LOAD(uniform, 0, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
 LOAD(ubo, 1, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
 LOAD(input, 0, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
-/* LOAD(ssbo, 1, 0) */
+LOAD(ssbo, 1, 0)
 
 /*
  * Stores work the same way as loads, except now the first register input is
diff --git a/src/glsl/nir/nir_lower_phis_to_scalar.c b/src/glsl/nir/nir_lower_phis_to_scalar.c
index a57d253..68ff363 100644
--- a/src/glsl/nir/nir_lower_phis_to_scalar.c
+++ b/src/glsl/nir/nir_lower_phis_to_scalar.c
@@ -93,6 +93,8 @@ is_phi_src_scalarizable(nir_phi_src *src,
       case nir_intrinsic_load_uniform_indirect:
       case nir_intrinsic_load_ubo:
       case nir_intrinsic_load_ubo_indirect:
+      case nir_intrinsic_load_ssbo:
+      case nir_intrinsic_load_ssbo_indirect:
       case nir_intrinsic_load_input:
       case nir_intrinsic_load_input_indirect:
          return true;
-- 
1.9.1



More information about the mesa-dev mailing list