[Mesa-dev] [PATCH 09/37] glsl: add xfb_* qualifiers to glsl_struct_field
Timothy Arceri
timothy.arceri at collabora.com
Tue Mar 15 12:56:59 UTC 2016
These will be used to hold qualifier values for interface and
struct members.
Support is added to the struct/interface constructors to copy these
fields upon creation.
We also update record_compare() to ensure we don't reuse a glsl_type
with the wrong xfb_* qualifier values.
---
src/compiler/glsl/builtin_variables.cpp | 2 ++
src/compiler/glsl_types.cpp | 10 ++++++++++
src/compiler/glsl_types.h | 16 ++++++++++++++--
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index c39ae50..24e0b1a 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -334,6 +334,8 @@ per_vertex_accumulator::add_field(int slot, const glsl_type *type,
this->fields[this->num_fields].image_coherent = 0;
this->fields[this->num_fields].image_volatile = 0;
this->fields[this->num_fields].image_restrict = 0;
+ this->fields[this->num_fields].xfb_buffer = -1;
+ this->fields[this->num_fields].xfb_stride = -1;
this->num_fields++;
}
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index 2421bd6..3b77b5e 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -132,6 +132,8 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
this->fields.structure[i].image_volatile = fields[i].image_volatile;
this->fields.structure[i].image_restrict = fields[i].image_restrict;
this->fields.structure[i].precision = fields[i].precision;
+ this->fields.structure[i].xfb_buffer = fields[i].xfb_buffer;
+ this->fields.structure[i].xfb_stride = fields[i].xfb_stride;
}
mtx_unlock(&glsl_type::mutex);
@@ -172,6 +174,8 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
this->fields.structure[i].image_volatile = fields[i].image_volatile;
this->fields.structure[i].image_restrict = fields[i].image_restrict;
this->fields.structure[i].precision = fields[i].precision;
+ this->fields.structure[i].xfb_buffer = fields[i].xfb_buffer;
+ this->fields.structure[i].xfb_stride = fields[i].xfb_stride;
}
mtx_unlock(&glsl_type::mutex);
@@ -915,6 +919,12 @@ glsl_type::record_compare(const glsl_type *b) const
if (this->fields.structure[i].precision
!= b->fields.structure[i].precision)
return false;
+ if (this->fields.structure[i].xfb_buffer
+ != b->fields.structure[i].xfb_buffer)
+ return false;
+ if (this->fields.structure[i].xfb_stride
+ != b->fields.structure[i].xfb_stride)
+ return false;
}
return true;
diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
index b0e6f3f..9b5f8b1 100644
--- a/src/compiler/glsl_types.h
+++ b/src/compiler/glsl_types.h
@@ -839,13 +839,25 @@ struct glsl_struct_field {
/**
* For interface blocks, members may have an explicit byte offset
- * specified; -1 otherwise.
+ * specified; -1 otherwise. Also used for xfb_offset layout qualifier.
*
- * Ignored for structs.
+ * Unless used for xfb_offset this field is ignored for structs.
*/
int offset;
/**
+ * For interface blocks, members may define a transform feedback buffer;
+ * -1 otherwise.
+ */
+ int xfb_buffer;
+
+ /**
+ * For interface blocks, members may define a transform feedback stride;
+ * -1 otherwise.
+ */
+ int xfb_stride;
+
+ /**
* For interface blocks, the interpolation mode (as in
* ir_variable::interpolation). 0 otherwise.
*/
--
2.5.0
More information about the mesa-dev
mailing list