glsl: Validate qualifiers on VS color outputs with FS color inputs
The vertex shader color outputs (gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, and gl_BackSecondaryColor) don't have the same names as the matching fragment shader color inputs (gl_Color and gl_SecondaryColor). As a result, the qualifiers on them were not being properly cross validated. Full spec compliance required ir_variable::used and ir_variable::assigned be set properly. Without the preceeding patch, which fixes the ::clone method to copy them, this will not be the case. Fixes all of the previously failing piglit spec/glsl-1.30/linker/interpolation-qualifiers tests. v2: Update callers of cross_validate_types_and_qualifiers and cross_validate_front_and_back_color. The function signature changed in v2 of a previous patch. Suggested by Paul. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Paul Berry <stereotype441@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47755
This commit is contained in:
@@ -132,6 +132,26 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate front and back color outputs against single color input
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
cross_validate_front_and_back_color(struct gl_shader_program *prog,
|
||||||
|
const ir_variable *input,
|
||||||
|
const ir_variable *front_color,
|
||||||
|
const ir_variable *back_color,
|
||||||
|
GLenum consumer_type,
|
||||||
|
GLenum producer_type)
|
||||||
|
{
|
||||||
|
if (front_color != NULL && front_color->assigned)
|
||||||
|
cross_validate_types_and_qualifiers(prog, input, front_color,
|
||||||
|
consumer_type, producer_type);
|
||||||
|
|
||||||
|
if (back_color != NULL && back_color->assigned)
|
||||||
|
cross_validate_types_and_qualifiers(prog, input, back_color,
|
||||||
|
consumer_type, producer_type);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate that outputs from one stage match inputs of another
|
* Validate that outputs from one stage match inputs of another
|
||||||
*/
|
*/
|
||||||
@@ -167,12 +187,34 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
|
|||||||
if ((input == NULL) || (input->mode != ir_var_shader_in))
|
if ((input == NULL) || (input->mode != ir_var_shader_in))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (strcmp(input->name, "gl_Color") == 0 && input->used) {
|
||||||
|
const ir_variable *const front_color =
|
||||||
|
parameters.get_variable("gl_FrontColor");
|
||||||
|
|
||||||
|
const ir_variable *const back_color =
|
||||||
|
parameters.get_variable("gl_BackColor");
|
||||||
|
|
||||||
|
cross_validate_front_and_back_color(prog, input,
|
||||||
|
front_color, back_color,
|
||||||
|
consumer->Type, producer->Type);
|
||||||
|
} else if (strcmp(input->name, "gl_SecondaryColor") == 0 && input->used) {
|
||||||
|
const ir_variable *const front_color =
|
||||||
|
parameters.get_variable("gl_FrontSecondaryColor");
|
||||||
|
|
||||||
|
const ir_variable *const back_color =
|
||||||
|
parameters.get_variable("gl_BackSecondaryColor");
|
||||||
|
|
||||||
|
cross_validate_front_and_back_color(prog, input,
|
||||||
|
front_color, back_color,
|
||||||
|
consumer->Type, producer->Type);
|
||||||
|
} else {
|
||||||
ir_variable *const output = parameters.get_variable(input->name);
|
ir_variable *const output = parameters.get_variable(input->name);
|
||||||
if (output != NULL) {
|
if (output != NULL) {
|
||||||
cross_validate_types_and_qualifiers(prog, input, output,
|
cross_validate_types_and_qualifiers(prog, input, output,
|
||||||
consumer->Type, producer->Type);
|
consumer->Type, producer->Type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user