[Mesa-dev] [PATCH 4/5] glsl: by default, any ast_layout_expression variable value must match its previous appearances
Andres Gomez
agomez at igalia.com
Thu Oct 6 22:52:07 UTC 2016
Recently, we added code to check that any appearance of the
"max_vertices" layout-qualifier-name in a program holds the same
value.
Now, we make this the default behavior for any layout-qualifier-name
represented as a ast_layout_expression since, as it happens, the same
constraint applies to all the current ones; "max_vertices",
"invocations", "vertices", "local_size_[x|y|z]" and "xfb_stride".
>From page 44 (page 50 of the PDF) of the GLSL 4.00 spec:
" If an invocation count is declared, all such declarations must
specify the same count."
>From page 47 (page 53 of the PDF) of the GLSL 4.00 spec:
" All tessellation control shader layout declarations in a program
must specify the same output patch vertex count."
>From page 60 (page 66 of the PDF) of the GLSL 4.30 spec:
" Also, if such a layout qualifier is declared more than once in the
same shader, all those declarations must set the same set of local
work-group sizes and set them to the same values; otherwise a
compile-time error results. If multiple compute shaders attached
to a single program object declare local work-group size, the
declarations must be identical; otherwise a link-time error
results."
>From page 73 (page 79 of the PDF) of the GLSL 4.40 spec:
" While xfb_stride can be declared multiple times for the same
buffer, it is a compile-time or link-time error to have different
values specified for the stride for the same buffer."
Fixes GL44-CTS.enhanced_layouts.xfb_duplicated_stride
Signed-off-by: Andres Gomez <agomez at igalia.com>
---
src/compiler/glsl/ast.h | 2 +-
src/compiler/glsl/glsl_parser_extras.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index c1453a2..804111f 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -378,7 +378,7 @@ public:
bool process_qualifier_constant(struct _mesa_glsl_parse_state *state,
const char *qual_indentifier,
unsigned *value, bool can_be_zero,
- bool must_match = false);
+ bool must_match = true);
void merge_qualifier(ast_layout_expression *l_expr)
{
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index 5f3474e..bcbcb24 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -1738,7 +1738,7 @@ set_shader_inout_layout(struct gl_shader *shader,
unsigned qual_max_vertices;
if (state->out_qualifier->max_vertices->
process_qualifier_constant(state, "max_vertices",
- &qual_max_vertices, true, true)) {
+ &qual_max_vertices, true)) {
if (qual_max_vertices > state->Const.MaxGeometryOutputVertices) {
YYLTYPE loc = state->out_qualifier->max_vertices->get_location();
--
2.9.3
More information about the mesa-dev
mailing list