summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2013-09-28 10:04:41 -0700
committerPaul Berry <[email protected]>2013-10-10 14:27:22 -0700
commit24b9bba19b6d1d48fd40ce6af537da806e45d53f (patch)
tree0ae1c37ee8700e6765514aa9d603863d199c670e /src/glsl
parent3699ff4dd19c6102f39edc5d87bd772b380aa168 (diff)
glsl: Add an ir_variable::reinit_interface_type() function.
This will be used by future patches to change an ir_variable's interface type when the gl_PerVertex built-in interface block is redeclared. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 0f8e9a15d96..aac8cbb7dbe 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -420,6 +420,31 @@ public:
this->interface_type = type;
}
+ /**
+ * Change this->interface_type on a variable that previously had a
+ * different, and incompatible, interface_type. This is used during
+ * compilation to handle redeclaration of the built-in gl_PerVertex
+ * interface block.
+ */
+ void reinit_interface_type(const struct glsl_type *type)
+ {
+ if (this->max_ifc_array_access != NULL) {
+#ifndef _NDEBUG
+ /* Redeclaring gl_PerVertex is only allowed if none of the built-ins
+ * it defines have been accessed yet; so it's safe to throw away the
+ * old max_ifc_array_access pointer, since all of its values are
+ * zero.
+ */
+ for (unsigned i = 0; i < this->interface_type->length; i++)
+ assert(this->max_ifc_array_access[i] == 0);
+#endif
+ ralloc_free(this->max_ifc_array_access);
+ this->max_ifc_array_access = NULL;
+ }
+ this->interface_type = NULL;
+ init_interface_type(type);
+ }
+
const glsl_type *get_interface_type() const
{
return this->interface_type;