[Mesa-dev] [PATCH] glsl: geom shader max_vertices layout must match.
Alejandro PiƱeiro
apinheiro at igalia.com
Fri Jun 3 17:39:22 UTC 2016
On 03/06/16 02:46, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> "all geometry shader output vertex count declarations in a
> program must declare the same count."
This spec quote lacks context. As far as I see it comes from GLSL 4.5
spec, "4.4.2.3 Geometry Outputs".
>
> Fixes:
> GL45-CTS.geometry_shader.output.conflicted_output_vertices_max
The patch looks good. But testing on Skylake and Broadwell, current
master is passing this test without this patch. Did you mean a different
test, or you made the test with a different hw?
>
> Cc: "11.2 12.0" <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/compiler/glsl/ast.h | 3 ++-
> src/compiler/glsl/ast_type.cpp | 17 ++++++++++-------
> src/compiler/glsl/glsl_parser_extras.cpp | 2 +-
> 3 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
> index ca98ed2..06c7b03 100644
> --- a/src/compiler/glsl/ast.h
> +++ b/src/compiler/glsl/ast.h
> @@ -368,7 +368,8 @@ public:
>
> bool process_qualifier_constant(struct _mesa_glsl_parse_state *state,
> const char *qual_indentifier,
> - unsigned *value, bool can_be_zero);
> + unsigned *value, bool can_be_zero,
> + bool must_match = false);
>
> void merge_qualifier(ast_layout_expression *l_expr)
> {
> diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
> index 54e9dad..1372ff7 100644
> --- a/src/compiler/glsl/ast_type.cpp
> +++ b/src/compiler/glsl/ast_type.cpp
> @@ -678,7 +678,8 @@ bool
> ast_layout_expression::process_qualifier_constant(struct _mesa_glsl_parse_state *state,
> const char *qual_indentifier,
> unsigned *value,
> - bool can_be_zero)
> + bool can_be_zero,
> + bool must_match)
> {
> int min_value = 0;
> bool first_pass = true;
> @@ -716,12 +717,14 @@ ast_layout_expression::process_qualifier_constant(struct _mesa_glsl_parse_state
> * in a single declaration, the last occurrence overrides the
> * former occurrence(s)."
> */
> - if (!state->has_420pack() && !first_pass && *value != const_int->value.u[0]) {
> - YYLTYPE loc = const_expression->get_location();
> - _mesa_glsl_error(&loc, state, "%s layout qualifier does not "
> - "match previous declaration (%d vs %d)",
> - qual_indentifier, *value, const_int->value.i[0]);
> - return false;
> + if (!first_pass) {
> + if ((must_match || !state->has_420pack()) && *value != const_int->value.u[0]) {
> + YYLTYPE loc = const_expression->get_location();
> + _mesa_glsl_error(&loc, state, "%s layout qualifier does not "
> + "match previous declaration (%d vs %d)",
> + qual_indentifier, *value, const_int->value.i[0]);
> + return false;
> + }
> } else {
> first_pass = false;
> *value = const_int->value.u[0];
> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
> index c9654ac..ba658ae 100644
> --- a/src/compiler/glsl/glsl_parser_extras.cpp
> +++ b/src/compiler/glsl/glsl_parser_extras.cpp
> @@ -1692,7 +1692,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)) {
> + &qual_max_vertices, true, true)) {
>
> if (qual_max_vertices > state->Const.MaxGeometryOutputVertices) {
> YYLTYPE loc = state->out_qualifier->max_vertices->get_location();
More information about the mesa-dev
mailing list