diff options
author | Iago Toral Quiroga <itoral@igalia.com> | 2015-05-18 15:47:18 +0200 |
---|---|---|
committer | Samuel Iglesias Gonsalvez <siglesias@igalia.com> | 2015-07-14 07:04:03 +0200 |
commit | 6b09598d63b8b6069b230fbe8283c75cf86f711a (patch) | |
tree | 9a46888f7b9727126faeab1d536add09bb1bcce2 | |
parent | 1146696f75ea0f2b49e6379c2a62602dfeb51190 (diff) |
nir: add nir_var_shader_storage
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
-rw-r--r-- | src/glsl/nir/glsl_to_nir.cpp | 4 | ||||
-rw-r--r-- | src/glsl/nir/nir.h | 1 | ||||
-rw-r--r-- | src/glsl/nir/nir_lower_atomics.c | 3 | ||||
-rw-r--r-- | src/glsl/nir/nir_lower_io.c | 9 | ||||
-rw-r--r-- | src/glsl/nir/nir_print.c | 5 | ||||
-rw-r--r-- | src/glsl/nir/nir_validate.c | 6 |
6 files changed, 20 insertions, 8 deletions
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp index 95531bbcd8..66430f3999 100644 --- a/src/glsl/nir/glsl_to_nir.cpp +++ b/src/glsl/nir/glsl_to_nir.cpp @@ -280,6 +280,9 @@ nir_visitor::visit(ir_variable *ir) var->data.mode = nir_var_uniform; break; + case ir_var_shader_storage: + var->data.mode = nir_var_shader_storage; + break; case ir_var_system_value: var->data.mode = nir_var_system_value; @@ -371,6 +374,7 @@ nir_visitor::visit(ir_variable *ir) break; case nir_var_uniform: + case nir_var_shader_storage: exec_list_push_tail(&shader->uniforms, &var->node); break; diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 9e2a281919..e9a506c597 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -87,6 +87,7 @@ typedef enum { nir_var_global, nir_var_local, nir_var_uniform, + nir_var_shader_storage, nir_var_system_value } nir_variable_mode; diff --git a/src/glsl/nir/nir_lower_atomics.c b/src/glsl/nir/nir_lower_atomics.c index 0457de60d9..ce3615a3aa 100644 --- a/src/glsl/nir/nir_lower_atomics.c +++ b/src/glsl/nir/nir_lower_atomics.c @@ -55,7 +55,8 @@ lower_instr(nir_intrinsic_instr *instr, nir_function_impl *impl) return; } - if (instr->variables[0]->var->data.mode != nir_var_uniform) + if (instr->variables[0]->var->data.mode != nir_var_uniform && + instr->variables[0]->var->data.mode != nir_var_shader_storage) return; /* atomics passed as function arguments can't be lowered */ void *mem_ctx = ralloc_parent(instr); diff --git a/src/glsl/nir/nir_lower_io.c b/src/glsl/nir/nir_lower_io.c index 6761d5bad3..a9dd77691b 100644 --- a/src/glsl/nir/nir_lower_io.c +++ b/src/glsl/nir/nir_lower_io.c @@ -86,7 +86,8 @@ nir_assign_var_locations_scalar(struct exec_list *var_list, unsigned *size) * UBO's have their own address spaces, so don't count them towards the * number of global uniforms */ - if (var->data.mode == nir_var_uniform && var->interface_type != NULL) + if ((var->data.mode == nir_var_uniform || var->data.mode == nir_var_shader_storage) && + var->interface_type != NULL) continue; var->data.driver_location = location; @@ -153,7 +154,8 @@ nir_assign_var_locations_scalar_direct_first(nir_shader *shader, unsigned location = 0; foreach_list_typed(nir_variable, var, node, var_list) { - if (var->data.mode == nir_var_uniform && var->interface_type != NULL) + if ((var->data.mode == nir_var_uniform || var->data.mode == nir_var_shader_storage) && + var->interface_type != NULL) continue; if (_mesa_set_search(indirect_set, var)) @@ -166,7 +168,8 @@ nir_assign_var_locations_scalar_direct_first(nir_shader *shader, *direct_size = location; foreach_list_typed(nir_variable, var, node, var_list) { - if (var->data.mode == nir_var_uniform && var->interface_type != NULL) + if ((var->data.mode == nir_var_uniform || var->data.mode == nir_var_shader_storage) && + var->interface_type != NULL) continue; if (!_mesa_set_search(indirect_set, var)) diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c index eb4045cec8..f591c4b5f8 100644 --- a/src/glsl/nir/nir_print.c +++ b/src/glsl/nir/nir_print.c @@ -214,7 +214,7 @@ print_var_decl(nir_variable *var, print_var_state *state, FILE *fp) const char *const samp = (var->data.sample) ? "sample " : ""; const char *const inv = (var->data.invariant) ? "invariant " : ""; const char *const mode[] = { "shader_in ", "shader_out ", "", "", - "uniform ", "system " }; + "uniform ", "shader_storage", "system " }; const char *const interp[] = { "", "smooth", "flat", "noperspective" }; fprintf(fp, "%s%s%s%s%s ", @@ -239,7 +239,8 @@ print_var_decl(nir_variable *var, print_var_state *state, FILE *fp) if (var->data.mode == nir_var_shader_in || var->data.mode == nir_var_shader_out || - var->data.mode == nir_var_uniform) { + var->data.mode == nir_var_uniform || + var->data.mode == nir_var_shader_storage) { fprintf(fp, " (%u, %u)", var->data.location, var->data.driver_location); } diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c index da92ed9047..dc799414d2 100644 --- a/src/glsl/nir/nir_validate.c +++ b/src/glsl/nir/nir_validate.c @@ -400,11 +400,13 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state) break; case nir_intrinsic_store_var: assert(instr->variables[0]->var->data.mode != nir_var_shader_in && - instr->variables[0]->var->data.mode != nir_var_uniform); + instr->variables[0]->var->data.mode != nir_var_uniform && + instr->variables[0]->var->data.mode != nir_var_shader_storage); break; case nir_intrinsic_copy_var: assert(instr->variables[0]->var->data.mode != nir_var_shader_in && - instr->variables[0]->var->data.mode != nir_var_uniform); + instr->variables[0]->var->data.mode != nir_var_uniform && + instr->variables[0]->var->data.mode != nir_var_shader_storage); assert(instr->variables[1]->var->data.mode != nir_var_shader_out); break; default: |