ARB_shader_storage_buffer_object allows for memory qualifiers defined for ARB_shader_image_load_store, to be applied to SSBOs using the same semantics. So, for clarity, we might want to take these qualifiers out into its own category, rather than putting them inside the 'image' specific struct.
I agree that this renaming barely improves anything other than making nir_variable data struct pedantically stricter, so I would be ok dropping this patch if people think it is not worth it. Also, glsl data structs still use 'image' namespace for all memory qualifiers, so we might want to rename things there too. v2: Added a missing patch chunk that updated nir_print. --- src/compiler/nir/glsl_to_nir.cpp | 10 +++++----- src/compiler/nir/nir.h | 7 ++++++- src/compiler/nir/nir_print.c | 10 +++++----- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 2 +- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/compiler/nir/glsl_to_nir.cpp b/src/compiler/nir/glsl_to_nir.cpp index c8954ce..75760f4 100644 --- a/src/compiler/nir/glsl_to_nir.cpp +++ b/src/compiler/nir/glsl_to_nir.cpp @@ -414,11 +414,11 @@ nir_visitor::visit(ir_variable *ir) var->data.index = ir->data.index; var->data.binding = ir->data.binding; var->data.offset = ir->data.offset; - var->data.image.read_only = ir->data.image_read_only; - var->data.image.write_only = ir->data.image_write_only; - var->data.image.coherent = ir->data.image_coherent; - var->data.image._volatile = ir->data.image_volatile; - var->data.image.restrict_flag = ir->data.image_restrict; + var->data.memory.read_only = ir->data.image_read_only; + var->data.memory.write_only = ir->data.image_write_only; + var->data.memory.coherent = ir->data.image_coherent; + var->data.memory._volatile = ir->data.image_volatile; + var->data.memory.restrict_flag = ir->data.image_restrict; var->data.image.format = ir->data.image_format; var->data.max_array_access = ir->data.max_array_access; diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 8a616d4..57158d1 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -283,7 +283,7 @@ typedef struct nir_variable { unsigned offset; /** - * ARB_shader_image_load_store qualifiers. + * Memory qualifiers. */ struct { bool read_only; /**< "readonly" qualifier. */ @@ -291,7 +291,12 @@ typedef struct nir_variable { bool coherent; bool _volatile; bool restrict_flag; + } memory; + /** + * ARB_shader_image_load_store. + */ + struct { /** Image internal format if specified explicitly, otherwise GL_NONE. */ GLenum format; } image; diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index a36561e..1aa1ef4 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -354,11 +354,11 @@ print_var_decl(nir_variable *var, print_state *state) cent, samp, patch, inv, get_variable_mode_str(var->data.mode), glsl_interp_qualifier_name(var->data.interpolation)); - const char *const coher = (var->data.image.coherent) ? "coherent " : ""; - const char *const volat = (var->data.image._volatile) ? "volatile " : ""; - const char *const restr = (var->data.image.restrict_flag) ? "restrict " : ""; - const char *const ronly = (var->data.image.read_only) ? "readonly " : ""; - const char *const wonly = (var->data.image.write_only) ? "writeonly " : ""; + const char *const coher = (var->data.memory.coherent) ? "coherent " : ""; + const char *const volat = (var->data.memory._volatile) ? "volatile " : ""; + const char *const restr = (var->data.memory.restrict_flag) ? "restrict " : ""; + const char *const ronly = (var->data.memory.read_only) ? "readonly " : ""; + const char *const wonly = (var->data.memory.write_only) ? "writeonly " : ""; fprintf(fp, "%s%s%s%s%s", coher, volat, restr, ronly, wonly); glsl_print_type(var->type, fp); diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 905f5c1..c9015a4 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -2935,7 +2935,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr else if (instr->intrinsic == nir_intrinsic_image_store) emit_image_store(bld, image, addr, src0, surf_dims, arr_dims, - var->data.image.write_only ? GL_NONE : format); + var->data.memory.write_only ? GL_NONE : format); else tmp = emit_image_atomic(bld, image, addr, src0, src1, -- 2.7.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev