[Piglit] [PATCH] arb_gpu_shader_fp64: verify function parameter overloads

Ilia Mirkin imirkin at alum.mit.edu
Mon Jun 22 09:47:54 PDT 2015


On Mon, Jun 22, 2015 at 12:34 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 06/22/2015 09:25 AM, Ilia Mirkin wrote:
>> On Mon, Jun 22, 2015 at 12:22 PM, Ian Romanick <idr at freedesktop.org> wrote:
>>> On 06/17/2015 12:43 PM, Ilia Mirkin wrote:
>>>> fp64 adds variants of all sorts of functions. make sure that we're still
>>>> able to resolve otherwise-ambiguous calls in the presence of gs5.
>>>>
>>>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>>>> ---
>>>>  .../compiler/implicit-conversions-func.vert        | 22 ++++++++++++++++++++++
>>>>  1 file changed, 22 insertions(+)
>>>>  create mode 100644 tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversions-func.vert
>>>>
>>>> diff --git a/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversions-func.vert b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversions-func.vert
>>>> new file mode 100644
>>>> index 0000000..224aecb
>>>> --- /dev/null
>>>> +++ b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversions-func.vert
>>>> @@ -0,0 +1,22 @@
>>>> +// [config]
>>>> +// expect_result: pass
>>>> +// glsl_version: 1.50
>>>> +// require_extensions: GL_ARB_gpu_shader_fp64 GL_ARB_gpu_shader5
>>>> +// [end config]
>>>> +
>>>> +// Test that overloaded function selection still works in the presence
>>>> +// of new double variants. ARB_gpu_shader5 provides the overload
>>>> +// selection rules that allow the implementatino to pick one of the
>>>                                      implementation
>>>
>>>> +// candidates.
>>>> +
>>>> +#version 150
>>>> +#extension GL_ARB_gpu_shader_fp64: enable
>>>> +#extension GL_ARB_gpu_shader5: enable
>>>> +
>>>> +void foo(double a);
>>>> +void foo(float a);
>>>> +
>>>> +void test() {
>>>> +  mod(5, 6);
>>>> +  foo(5);
>>>> +}
>>>>
>>>
>>> Which overload does the spec say is supposed to be used for foo(5)?  We
>>> should provide an implementation for that overload, and make this a
>>> linker test.
>>
>> The float one, I think. From ARB_gpu_shader5, see point #3:
>
> That was going to be my guess... mostly since that means the selected
> overload wouldn't "change" with the addition of ARB_gpu_shader_fp64.
> You can imagine a shader like:
>
> #version 150
> #extension GL_ARB_gpu_shader_fp64: enable
> #extension GL_ARB_gpu_shader5: enable
>
> #ifdef GL_ARB_gpu_shader_fp64
> void foo(double a)
> {
>     ...
> }
> #endif
>
> void foo(float a)
> {
>     ...
> }
>
> void main()
> {
>    foo(5);
> }
>
> It should be the same whether ARB_gpu_shader_fp64 is supported or not.

Yeah, although the fun thing is that without the gs5 enable, it goes
from "working" (because GLSL <some low ver> says that you can always
implicitly convert an int to a float) without doubles to "compile
failure" with doubles because it can't resolve which overload to pick
between the float and double one. I'm not 100% sure if that's the
spec'd behaviour, but it's definitely mesa's.

  -ilia


More information about the Piglit mailing list