[Mesa-dev] [PATCH 06/74] glsl: Add ir_binop_ssbo_load expression operation.
Iago Toral Quiroga
itoral at igalia.com
Thu May 14 07:06:09 PDT 2015
From: Kristian Høgsberg <krh at bitplanet.net>
This will be used to load the value of a buffer variable from an SSBO,
like ir_binop_ubo_load for UBOs.
---
src/glsl/ir.cpp | 1 +
src/glsl/ir.h | 8 ++++++++
src/glsl/ir_validate.cpp | 5 +++++
src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp | 1 +
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 6 ++++++
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 4 ++++
src/mesa/program/ir_to_mesa.cpp | 1 +
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 4 ++++
8 files changed, 30 insertions(+)
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index b86a868..4cb55a1 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -600,6 +600,7 @@ static const char *const operator_strs[] = {
"packHalf2x16_split",
"bfm",
"ubo_load",
+ "ssbo_load",
"ldexp",
"vector_extract",
"interpolate_at_offset",
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 88eb002..093d9ad 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -1495,6 +1495,14 @@ enum ir_expression_operation {
ir_binop_ubo_load,
/**
+ * Load a value the size of a given GLSL type from a buffer block.
+ *
+ * operand0 is the ir_constant buffer block index in the linked shader.
+ * operand1 is a byte offset within the uniform block.
+ */
+ ir_binop_ssbo_load,
+
+ /**
* \name Multiplies a number by two to a power, part of ARB_gpu_shader5.
*/
/*@{*/
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index cfe0df3..b292ce4 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -573,6 +573,11 @@ ir_validate::visit_leave(ir_expression *ir)
assert(ir->operands[1]->type == glsl_type::uint_type);
break;
+ case ir_binop_ssbo_load:
+ assert(ir->operands[0]->type == glsl_type::uint_type);
+ assert(ir->operands[1]->type == glsl_type::uint_type);
+ break;
+
case ir_binop_ldexp:
assert(ir->operands[0]->type == ir->type);
assert(ir->operands[0]->type->is_float() ||
diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
index d0f6122..b8ed6b6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
@@ -378,6 +378,7 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
}
case ir_binop_ubo_load:
+ case ir_binop_ssbo_load:
unreachable("not yet supported");
case ir_triop_fma:
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index f185c07..a7c27d9 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1191,6 +1191,12 @@ fs_visitor::visit(ir_expression *ir)
case ir_binop_pack_half_2x16_split:
emit(FS_OPCODE_PACK_HALF_2x16_SPLIT, this->result, op[0], op[1]);
break;
+
+ case ir_binop_ssbo_load:
+ assert(brw->gen >= 7);
+ assert(!"Not implemented");
+ break;
+
case ir_binop_ubo_load: {
/* This IR node takes a constant uniform block and a constant or
* variable byte offset within the block and loads a vector from that.
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 0ba3155..1298152 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1810,6 +1810,10 @@ vec4_visitor::visit(ir_expression *ir)
emit(BFI1(result_dst, op[0], op[1]));
break;
+ case ir_binop_ssbo_load:
+ assert(!"Not implemented");
+ break;
+
case ir_binop_ubo_load: {
ir_constant *const_uniform_block = ir->operands[0]->as_constant();
ir_constant *const_offset_ir = ir->operands[1]->as_constant();
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 3dcb537..b86718c 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1341,6 +1341,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
case ir_unop_dFdx_fine:
case ir_unop_dFdy_coarse:
case ir_unop_dFdy_fine:
+ case ir_binop_ssbo_load:
assert(!"not supported");
break;
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index f0f2a77..9c1089e 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2022,6 +2022,10 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
assert(!"GLSL 1.30 features unsupported");
break;
+ case ir_binop_ssbo_load:
+ assert(!"Not implemented");
+ break;
+
case ir_binop_ubo_load: {
ir_constant *const_uniform_block = ir->operands[0]->as_constant();
ir_constant *const_offset_ir = ir->operands[1]->as_constant();
--
1.9.1
More information about the mesa-dev
mailing list