summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/builtin_variables.cpp5
-rw-r--r--src/glsl/glsl_symbol_table.cpp16
-rw-r--r--src/glsl/ir.cpp3
-rw-r--r--src/glsl/ir.h5
-rw-r--r--src/glsl/ir_function.cpp1
-rw-r--r--src/glsl/ir_print_visitor.cpp3
-rw-r--r--src/glsl/ir_reader.cpp2
-rw-r--r--src/glsl/loop_unroll.cpp1
-rw-r--r--src/glsl/lower_named_interface_blocks.cpp5
-rw-r--r--src/glsl/lower_variable_index_to_cond_assign.cpp1
-rw-r--r--src/glsl/opt_structure_splitting.cpp5
11 files changed, 34 insertions, 13 deletions
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index a765d35fde0..aba1750c09d 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -436,11 +436,12 @@ builtin_variable_generator::add_variable(const char *name,
var->data.read_only = true;
break;
case ir_var_shader_out:
+ case ir_var_shader_storage:
break;
default:
/* The only variables that are added using this function should be
- * uniforms, shader inputs, and shader outputs, constants (which use
- * ir_var_auto), and system values.
+ * uniforms, shader storage, shader inputs, and shader outputs, constants
+ * (which use ir_var_auto), and system values.
*/
assert(0);
break;
diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp
index 2294dda42c8..536f0a3a8c2 100644
--- a/src/glsl/glsl_symbol_table.cpp
+++ b/src/glsl/glsl_symbol_table.cpp
@@ -36,6 +36,9 @@ public:
case ir_var_uniform:
dest = &ibu;
break;
+ case ir_var_shader_storage:
+ dest = &iss;
+ break;
case ir_var_shader_in:
dest = &ibi;
break;
@@ -60,6 +63,8 @@ public:
switch (mode) {
case ir_var_uniform:
return ibu;
+ case ir_var_shader_storage:
+ return iss;
case ir_var_shader_in:
return ibi;
case ir_var_shader_out:
@@ -71,24 +76,25 @@ public:
}
symbol_table_entry(ir_variable *v) :
- v(v), f(0), t(0), ibu(0), ibi(0), ibo(0), a(0) {}
+ v(v), f(0), t(0), ibu(0), iss(0), ibi(0), ibo(0), a(0) {}
symbol_table_entry(ir_function *f) :
- v(0), f(f), t(0), ibu(0), ibi(0), ibo(0), a(0) {}
+ v(0), f(f), t(0), ibu(0), iss(0), ibi(0), ibo(0), a(0) {}
symbol_table_entry(const glsl_type *t) :
- v(0), f(0), t(t), ibu(0), ibi(0), ibo(0), a(0) {}
+ v(0), f(0), t(t), ibu(0), iss(0), ibi(0), ibo(0), a(0) {}
symbol_table_entry(const glsl_type *t, enum ir_variable_mode mode) :
- v(0), f(0), t(0), ibu(0), ibi(0), ibo(0), a(0)
+ v(0), f(0), t(0), ibu(0), iss(0), ibi(0), ibo(0), a(0)
{
assert(t->is_interface());
add_interface(t, mode);
}
symbol_table_entry(const class ast_type_specifier *a):
- v(0), f(0), t(0), ibu(0), ibi(0), ibo(0), a(a) {}
+ v(0), f(0), t(0), ibu(0), iss(0), ibi(0), ibo(0), a(a) {}
ir_variable *v;
ir_function *f;
const glsl_type *t;
const glsl_type *ibu;
+ const glsl_type *iss;
const glsl_type *ibi;
const glsl_type *ibo;
const class ast_type_specifier *a;
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index dbd064feecc..9a25bf413f4 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1975,6 +1975,9 @@ mode_string(const ir_variable *var)
case ir_var_uniform:
return "uniform";
+ case ir_var_shader_storage:
+ return "buffer";
+
case ir_var_shader_in:
return "shader input";
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index f9045553501..2b9533a6437 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -324,6 +324,7 @@ protected:
enum ir_variable_mode {
ir_var_auto = 0, /**< Function local variables and globals. */
ir_var_uniform, /**< Variable declared as a uniform. */
+ ir_var_shader_storage, /**< Variable declared as an ssbo. */
ir_var_shader_in,
ir_var_shader_out,
ir_var_function_in,
@@ -445,7 +446,9 @@ public:
*/
inline bool is_in_uniform_block() const
{
- return this->data.mode == ir_var_uniform && this->interface_type != NULL;
+ return (this->data.mode == ir_var_uniform ||
+ this->data.mode == ir_var_shader_storage) &&
+ this->interface_type != NULL;
}
/**
diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp
index 13194439003..93034bedb5a 100644
--- a/src/glsl/ir_function.cpp
+++ b/src/glsl/ir_function.cpp
@@ -72,6 +72,7 @@ parameter_lists_match(_mesa_glsl_parse_state *state,
switch ((enum ir_variable_mode)(param->data.mode)) {
case ir_var_auto:
case ir_var_uniform:
+ case ir_var_shader_storage:
case ir_var_temporary:
/* These are all error conditions. It is invalid for a parameter to
* a function to be declared as auto (not in, out, or inout) or
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index 4cbcad4ec61..922f98b6b8c 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -168,7 +168,8 @@ void ir_print_visitor::visit(ir_variable *ir)
const char *const cent = (ir->data.centroid) ? "centroid " : "";
const char *const samp = (ir->data.sample) ? "sample " : "";
const char *const inv = (ir->data.invariant) ? "invariant " : "";
- const char *const mode[] = { "", "uniform ", "shader_in ", "shader_out ",
+ const char *const mode[] = { "", "uniform ", "shader_storage",
+ "shader_in ", "shader_out ",
"in ", "out ", "inout ",
"const_in ", "sys ", "temporary " };
STATIC_ASSERT(ARRAY_SIZE(mode) == ir_var_mode_count);
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index 4eae4131c57..d3ece19b22c 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -421,6 +421,8 @@ ir_reader::read_declaration(s_expression *expr)
var->data.invariant = 1;
} else if (strcmp(qualifier->value(), "uniform") == 0) {
var->data.mode = ir_var_uniform;
+ } else if (strcmp(qualifier->value(), "shader_storage") == 0) {
+ var->data.mode = ir_var_shader_storage;
} else if (strcmp(qualifier->value(), "auto") == 0) {
var->data.mode = ir_var_auto;
} else if (strcmp(qualifier->value(), "in") == 0) {
diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp
index 7a00fb8fea8..b9ea3507782 100644
--- a/src/glsl/loop_unroll.cpp
+++ b/src/glsl/loop_unroll.cpp
@@ -145,6 +145,7 @@ public:
unsupported_variable_indexing = true;
break;
case ir_var_uniform:
+ case ir_var_shader_storage:
if (options->EmitNoIndirectUniform)
unsupported_variable_indexing = true;
break;
diff --git a/src/glsl/lower_named_interface_blocks.cpp b/src/glsl/lower_named_interface_blocks.cpp
index 7304c51399a..28d7987d3c3 100644
--- a/src/glsl/lower_named_interface_blocks.cpp
+++ b/src/glsl/lower_named_interface_blocks.cpp
@@ -108,7 +108,8 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
* but, this will require changes to the other uniform block
* support code.
*/
- if (var->data.mode == ir_var_uniform)
+ if (var->data.mode == ir_var_uniform ||
+ var->data.mode == ir_var_shader_storage)
continue;
const glsl_type * iface_t = var->type;
@@ -212,7 +213,7 @@ flatten_named_interface_blocks_declarations::handle_rvalue(ir_rvalue **rvalue)
* but, this will require changes to the other uniform block
* support code.
*/
- if (var->data.mode == ir_var_uniform)
+ if (var->data.mode == ir_var_uniform || var->data.mode == ir_var_shader_storage)
return;
if (var->get_interface_type() != NULL) {
diff --git a/src/glsl/lower_variable_index_to_cond_assign.cpp b/src/glsl/lower_variable_index_to_cond_assign.cpp
index d878cb07811..4a6a76c4eba 100644
--- a/src/glsl/lower_variable_index_to_cond_assign.cpp
+++ b/src/glsl/lower_variable_index_to_cond_assign.cpp
@@ -370,6 +370,7 @@ public:
case ir_var_temporary:
return this->lower_temps;
case ir_var_uniform:
+ case ir_var_shader_storage:
return this->lower_uniforms;
case ir_var_function_in:
case ir_var_const_in:
diff --git a/src/glsl/opt_structure_splitting.cpp b/src/glsl/opt_structure_splitting.cpp
index 5e82fe93aa7..abf4310feb3 100644
--- a/src/glsl/opt_structure_splitting.cpp
+++ b/src/glsl/opt_structure_splitting.cpp
@@ -103,8 +103,9 @@ ir_structure_reference_visitor::get_variable_entry(ir_variable *var)
{
assert(var);
- if (!var->type->is_record() || var->data.mode == ir_var_uniform
- || var->data.mode == ir_var_shader_in || var->data.mode == ir_var_shader_out)
+ if (!var->type->is_record() ||
+ var->data.mode == ir_var_uniform || var->data.mode == ir_var_shader_storage ||
+ var->data.mode == ir_var_shader_in || var->data.mode == ir_var_shader_out)
return NULL;
foreach_in_list(variable_entry, entry, &this->variable_list) {