summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-05-06 16:55:46 +0200
committerSamuel Pitoiset <[email protected]>2017-05-08 16:04:05 +0200
commit8a6ecde9c1601b77b6d1e637fbe55f6b75a4b21e (patch)
tree3229928fac4c6eff2cf48e06fac83e1cebe7b86b
parent14187e1e9e12151e11ca167ce501c671c98d69c6 (diff)
glsl: store the image format in glsl_struct_field
ARB_bindless_texture allows to declare image types inside structures, which means we need to keep track of the format. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/compiler/glsl/builtin_variables.cpp1
-rw-r--r--src/compiler/glsl_types.cpp3
-rw-r--r--src/compiler/glsl_types.h8
3 files changed, 11 insertions, 1 deletions
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index a45c9d62c71..ce4dd43730c 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -341,6 +341,7 @@ per_vertex_accumulator::add_field(int slot, const glsl_type *type,
this->fields[this->num_fields].memory_coherent = 0;
this->fields[this->num_fields].memory_volatile = 0;
this->fields[this->num_fields].memory_restrict = 0;
+ this->fields[this->num_fields].image_format = 0;
this->fields[this->num_fields].explicit_xfb_buffer = 0;
this->fields[this->num_fields].xfb_buffer = -1;
this->fields[this->num_fields].xfb_stride = -1;
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index 3930029180d..43c0188e47f 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -965,6 +965,9 @@ glsl_type::record_compare(const glsl_type *b, bool match_locations) const
if (this->fields.structure[i].memory_restrict
!= b->fields.structure[i].memory_restrict)
return false;
+ if (this->fields.structure[i].image_format
+ != b->fields.structure[i].image_format)
+ return false;
if (this->fields.structure[i].precision
!= b->fields.structure[i].precision)
return false;
diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
index 04490872385..67c152119f8 100644
--- a/src/compiler/glsl_types.h
+++ b/src/compiler/glsl_types.h
@@ -978,6 +978,11 @@ struct glsl_struct_field {
unsigned memory_restrict:1;
/**
+ * Layout format, applicable to image variables only.
+ */
+ unsigned image_format:16;
+
+ /**
* Any of the xfb_* qualifiers trigger the shader to be in transform
* feedback mode so we need to keep track of whether the buffer was
* explicitly set or if its just been assigned the default global value.
@@ -992,7 +997,8 @@ struct glsl_struct_field {
sample(0), matrix_layout(GLSL_MATRIX_LAYOUT_INHERITED), patch(0),
precision(GLSL_PRECISION_NONE), memory_read_only(0),
memory_write_only(0), memory_coherent(0), memory_volatile(0),
- memory_restrict(0), explicit_xfb_buffer(0), implicit_sized_array(0)
+ memory_restrict(0), image_format(0), explicit_xfb_buffer(0),
+ implicit_sized_array(0)
{
/* empty */
}