glsl/linker: Allow unused in blocks which are not declated on previous stage
>From Section 4.3.4 (Inputs) of the GLSL 1.50 spec: "Only the input variables that are actually read need to be written by the previous stage; it is allowed to have superfluous declarations of input variables." Fixes: * interstage-multiple-shader-objects.shader_test v2: Update comment in ir.h since the usage of "used" field has been extended. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101247 Signed-off-by: Vadym Shovkoplias <vadym.shovkoplias@globallogic.com> Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:

committed by
Alejandro Piñeiro

parent
07a227f543
commit
4a8444d5bc
@@ -667,8 +667,8 @@ public:
|
|||||||
* variable has been used. For example, it is an error to redeclare a
|
* variable has been used. For example, it is an error to redeclare a
|
||||||
* variable as invariant after it has been used.
|
* variable as invariant after it has been used.
|
||||||
*
|
*
|
||||||
* This is only maintained in the ast_to_hir.cpp path, not in
|
* This is maintained in the ast_to_hir.cpp path and during linking,
|
||||||
* Mesa's fixed function or ARB program paths.
|
* but not in Mesa's fixed function or ARB program paths.
|
||||||
*/
|
*/
|
||||||
unsigned used:1;
|
unsigned used:1;
|
||||||
|
|
||||||
|
@@ -417,9 +417,15 @@ validate_interstage_inout_blocks(struct gl_shader_program *prog,
|
|||||||
* write to any of the pre-defined outputs (e.g. if the vertex shader
|
* write to any of the pre-defined outputs (e.g. if the vertex shader
|
||||||
* does not write to gl_Position, etc), which is allowed and results in
|
* does not write to gl_Position, etc), which is allowed and results in
|
||||||
* undefined behavior.
|
* undefined behavior.
|
||||||
|
*
|
||||||
|
* From Section 4.3.4 (Inputs) of the GLSL 1.50 spec:
|
||||||
|
*
|
||||||
|
* "Only the input variables that are actually read need to be written
|
||||||
|
* by the previous stage; it is allowed to have superfluous
|
||||||
|
* declarations of input variables."
|
||||||
*/
|
*/
|
||||||
if (producer_def == NULL &&
|
if (producer_def == NULL &&
|
||||||
!is_builtin_gl_in_block(var, consumer->Stage)) {
|
!is_builtin_gl_in_block(var, consumer->Stage) && var->data.used) {
|
||||||
linker_error(prog, "Input block `%s' is not an output of "
|
linker_error(prog, "Input block `%s' is not an output of "
|
||||||
"the previous stage\n", var->get_interface_type()->name);
|
"the previous stage\n", var->get_interface_type()->name);
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user