summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2013-01-04 10:43:01 -0800
committerPaul Berry <[email protected]>2013-01-24 16:30:49 -0800
commitc6a50ddfcb736e8a33b65fe8a72f2b6b9f70073b (patch)
tree337a82ef58729546cfbb3baeba99b62432bc1d41 /src
parentcd53457ffad322813ddf2f78f43e9fc1a154a004 (diff)
glsl: Allow varying structs in GLSL ES 3.00 and GLSL 1.50.
Previously I thought that varying structs had been added to GLSL ES 3.00 by mistake, because chapter 11 of the GLSL ES 3.00 spec ("Counting of Inputs and Outputs") failed to mention how structs should be handled. Khronos has clarified (https://cvs.khronos.org/bugzilla/show_bug.cgi?id=9828) that varying structs are indeed required, and that chapter 11 will be modified to indicate that the minimal reference packing algorithm flattens varying structs to their individual components. Mesa doesn't flatten varying structs to their individual components, but this is ok, since it packs varyings of all kinds with no wasted space at all (except where this is impossible due to differing interpolation modes), so it will outperform the minimal reference packing algorithm in all but the most pathological cases. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ast_to_hir.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 3c2ce15389a..33e20a8208d 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2031,10 +2031,8 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
* Similar text exists in the section on vertex shader outputs.
*
* Similar text exists in the GLSL ES 3.00 spec, except that the GLSL ES
- * 3.00 spec claims to allow structs as well. However, this is likely
- * an error, since section 11 of the spec ("Counting of Inputs and
- * Outputs") enumerates all possible types of interstage linkage
- * variables, and it does not mention structs.
+ * 3.00 spec allows structs as well. Varying structs are also allowed
+ * in GLSL 1.50.
*/
switch (var->type->get_scalar_type()->base_type) {
case GLSL_TYPE_FLOAT:
@@ -2049,6 +2047,8 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
state->get_version_string());
break;
case GLSL_TYPE_STRUCT:
+ if (state->is_version(150, 300))
+ break;
_mesa_glsl_error(loc, state,
"varying variables may not be of type struct");
break;