[Mesa-dev] [PATCH 3/3] nir: Put nir_variable's memory qualifiers in its own struct
Eduardo Lima Mitev
elima at igalia.com
Thu May 5 11:52:39 UTC 2016
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.
---
src/compiler/nir/glsl_to_nir.cpp | 10 +++++-----
src/compiler/nir/nir.h | 7 ++++++-
src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 2 +-
3 files changed, 12 insertions(+), 7 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 98451c6..b2645a3 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/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 4d14fda..13a4751 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
More information about the mesa-dev
mailing list