[Piglit] [PATCH] glsl-1.50: add linker test for unused in out blocks
Józef Kucia
joseph.kucia at gmail.com
Wed May 31 20:23:59 UTC 2017
On Wed, May 31, 2017 at 9:42 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 05/30/2017 07:23 AM, Józef Kucia wrote:
>> This test exposes a Mesa GLSL linker bug. The test fails with the
>
> Is there a bugzilla for this issue? Was this encountered in a app or ... ?
I filed a bug report for this issue today. It's bug 101247 [1].
>> following error message:
>>
>> error: Input block `blk' is not an output of the previous stage
>>
>> Section 4.3.4 (Inputs) of the GLSL 1.50 spec says:
>>
>> "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."
>
> There are some additional rules for separate shader objects programs,
> and it sounds like we may be applying them too broadly.
>
>> ---
>> .../interstage-multiple-shader-objects.shader_test | 38 ++++++++++++++++++++++
>> 1 file changed, 38 insertions(+)
>> create mode 100644 tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test
>>
>> diff --git a/tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test b/tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test
>> new file mode 100644
>> index 0000000..66a46d5
>> --- /dev/null
>> +++ b/tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test
>> @@ -0,0 +1,38 @@
>> +# Exercises a Mesa GLSL linker bug.
>> +#
>> +# Note that the output block is not used and it is not declared in the main
>> +# shader object.
>> +
>> +[require]
>> +GLSL >= 1.50
>> +
>> +[vertex shader]
>> +out blk {
>> + vec4 foo;
>> +} inst;
>> +
>> +void set_output(vec4 v)
>> +{
>> + gl_Position = v;
>> +}
>> +
>> +[vertex shader]
>
> Are there supposed to be two vertex shaders? Is that necessary to
> reproduce the link failure?
Two vertex shaders are necessary to reproduce the link failure. My
understanding of the issue is that when an output block is declared in
a shader object other than the one with the main() function, and the
output block is unused then there won't be any trace of the original
block declaration in the linked shader produced by
link_intrastage_shaders(). The linker fails while trying to find the
matching output block in the linked shader.
However, a stronger test case is probably also a valid GLSL program.
My understanding of the GL spec suggests that a similar GLSL program
should link even if the matching output block is not declared in a
vertex shader at all, because there is no static use of the input
block in the fragment shader.
[1] - https://bugs.freedesktop.org/show_bug.cgi?id=101247
More information about the Piglit
mailing list