Revert "glsl: geom shader max_vertices layout must match."
This reverts commit 4c86399378
.
The commit was erroneous because the ast_layout_expression class was
created to hold a list of values for a layout-qualifier-name which is
allowed to appear in more than one expression in the same
shader/program but not to hold different values.
In other words, the list is used for an after check that all the
declared values for a layout-qualifier-name are consistent.
Therefore, the values stored must match always, not just for
"max_vertices" or any other eventual layout-qualifier-name.
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
This commit is contained in:
@@ -377,8 +377,7 @@ public:
|
|||||||
|
|
||||||
bool process_qualifier_constant(struct _mesa_glsl_parse_state *state,
|
bool process_qualifier_constant(struct _mesa_glsl_parse_state *state,
|
||||||
const char *qual_indentifier,
|
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)
|
void merge_qualifier(ast_layout_expression *l_expr)
|
||||||
{
|
{
|
||||||
|
@@ -769,8 +769,7 @@ bool
|
|||||||
ast_layout_expression::process_qualifier_constant(struct _mesa_glsl_parse_state *state,
|
ast_layout_expression::process_qualifier_constant(struct _mesa_glsl_parse_state *state,
|
||||||
const char *qual_indentifier,
|
const char *qual_indentifier,
|
||||||
unsigned *value,
|
unsigned *value,
|
||||||
bool can_be_zero,
|
bool can_be_zero)
|
||||||
bool must_match)
|
|
||||||
{
|
{
|
||||||
int min_value = 0;
|
int min_value = 0;
|
||||||
bool first_pass = true;
|
bool first_pass = true;
|
||||||
@@ -808,14 +807,12 @@ ast_layout_expression::process_qualifier_constant(struct _mesa_glsl_parse_state
|
|||||||
* in a single declaration, the last occurrence overrides the
|
* in a single declaration, the last occurrence overrides the
|
||||||
* former occurrence(s)."
|
* former occurrence(s)."
|
||||||
*/
|
*/
|
||||||
if (!first_pass) {
|
if (!state->has_420pack() && !first_pass && *value != const_int->value.u[0]) {
|
||||||
if ((must_match || !state->has_420pack()) && *value != const_int->value.u[0]) {
|
YYLTYPE loc = const_expression->get_location();
|
||||||
YYLTYPE loc = const_expression->get_location();
|
_mesa_glsl_error(&loc, state, "%s layout qualifier does not "
|
||||||
_mesa_glsl_error(&loc, state, "%s layout qualifier does not "
|
"match previous declaration (%d vs %d)",
|
||||||
"match previous declaration (%d vs %d)",
|
qual_indentifier, *value, const_int->value.i[0]);
|
||||||
qual_indentifier, *value, const_int->value.i[0]);
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
first_pass = false;
|
first_pass = false;
|
||||||
*value = const_int->value.u[0];
|
*value = const_int->value.u[0];
|
||||||
|
@@ -1744,7 +1744,7 @@ set_shader_inout_layout(struct gl_shader *shader,
|
|||||||
unsigned qual_max_vertices;
|
unsigned qual_max_vertices;
|
||||||
if (state->out_qualifier->max_vertices->
|
if (state->out_qualifier->max_vertices->
|
||||||
process_qualifier_constant(state, "max_vertices",
|
process_qualifier_constant(state, "max_vertices",
|
||||||
&qual_max_vertices, true, true)) {
|
&qual_max_vertices, true)) {
|
||||||
|
|
||||||
if (qual_max_vertices > state->Const.MaxGeometryOutputVertices) {
|
if (qual_max_vertices > state->Const.MaxGeometryOutputVertices) {
|
||||||
YYLTYPE loc = state->out_qualifier->max_vertices->get_location();
|
YYLTYPE loc = state->out_qualifier->max_vertices->get_location();
|
||||||
|
Reference in New Issue
Block a user