[Piglit] [PATCH 2/2] arb_shader_subroutine: Call a subroutine by the type name instead of by uniform name

Ian Romanick idr at freedesktop.org
Thu Jan 14 16:43:07 PST 2016


On 01/14/2016 04:32 PM, Ilia Mirkin wrote:
> On Thu, Jan 14, 2016 at 7:23 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> This should be a compilation error because it shouldn't be able to find
>> a function prototype.  At least that's my understanding of the spec.
>>
>> This was accidentally discovered while trying to reproduce bug #93722.
>>
>> NOTE: This test fails on Mesa.
>>
>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>> Cc: Dave Airlie <airlied at redhat.com>
>> ---
>>  .../compiler/call-subroutine-type-name.frag        | 30 ++++++++++++++++++++++
>>  1 file changed, 30 insertions(+)
>>  create mode 100644 tests/spec/arb_shader_subroutine/compiler/call-subroutine-type-name.frag
>>
>> diff --git a/tests/spec/arb_shader_subroutine/compiler/call-subroutine-type-name.frag b/tests/spec/arb_shader_subroutine/compiler/call-subroutine-type-name.frag
>> new file mode 100644
>> index 0000000..2cfc908
>> --- /dev/null
>> +++ b/tests/spec/arb_shader_subroutine/compiler/call-subroutine-type-name.frag
>> @@ -0,0 +1,30 @@
>> +// [config]
>> +// expect_result: fail
>> +// glsl_version: 1.50
>> +// require_extensions: GL_ARB_shader_subroutine
>> +// [end config]
>> +
>> +#version 150
>> +#extension GL_ARB_shader_subroutine: require
>> +
>> +uniform vec4 u;
>> +out vec4 piglit_fragcolor;
>> +subroutine vec4 func_type(vec4 color);
>> +
>> +subroutine uniform func_type f;
>> +
>> +subroutine(func_type) float R(vec4 p)

Gak... I'll have to make another test.  Notice that the type of R does
not match func_type. :(

>> +{
>> +    return p.r;
>> +}
>> +
>> +subroutine(func_type) float G(vec4 p)
>> +{
>> +    return p.g;
>> +}
>> +
>> +void main()
>> +{
>> +    // This should be f(u).  You can't call subroutine type name.
>> +    piglit_fragcolor = func_type(u);
> 
> As in the previous test, this should also be vec4. Or change
> piglit_fragcolor to float.

Interestingly enough... fixing this by using "vec4(func_type(u))" causes
it to not compile, but it gives a very obtuse error:

Failed to compile fragment shader
tests/spec/arb_shader_subroutine/compiler/call-subroutine-type-name.frag: 0:29(21):
error: cannot construct `vec4' from a non-numeric data type

>> +}
>> --
>> 2.5.0
>>
>> _______________________________________________
>> Piglit mailing list
>> Piglit at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/piglit



More information about the Piglit mailing list