It looks like nvidia just doesn't like redeclarations anywhere other than global scope.
On Tue, Jun 3, 2014 at 7:55 PM, Jordan Justen <jljus...@gmail.com> wrote: > On Fri, May 2, 2014 at 12:35 PM, Anuj Phogat <anuj.pho...@gmail.com> wrote: >> On Sat, Apr 26, 2014 at 9:04 PM, Chris Forbes <chr...@ijw.co.nz> wrote: >>> Signed-off-by: Chris Forbes <chr...@ijw.co.nz> >>> --- >>> .../compiler/precise-qualifier/precise-01.vert | 12 +++++++++++ >>> .../compiler/precise-qualifier/precise-02.vert | 12 +++++++++++ >>> .../compiler/precise-qualifier/precise-03.vert | 14 +++++++++++++ >>> .../compiler/precise-qualifier/precise-04.vert | 14 +++++++++++++ >>> .../compiler/precise-qualifier/precise-05.vert | 12 +++++++++++ >>> .../compiler/precise-qualifier/precise-06.vert | 14 +++++++++++++ >>> .../compiler/precise-qualifier/precise-07.vert | 16 +++++++++++++++ >>> .../compiler/precise-qualifier/precise-08.vert | 14 +++++++++++++ >>> .../compiler/precise-qualifier/precise-09.vert | 15 ++++++++++++++ >>> .../compiler/precise-qualifier/precise-10.vert | 14 +++++++++++++ >>> .../compiler/precise-qualifier/precise-11.vert | 15 ++++++++++++++ >>> .../compiler/precise-qualifier/precise-12.vert | 23 >>> ++++++++++++++++++++++ >>> .../compiler/precise-qualifier/precise-13.vert | 16 +++++++++++++++ >>> 13 files changed, 191 insertions(+) >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-01.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-02.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-03.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-04.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-05.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-06.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-07.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-08.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-09.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-10.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-11.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-12.vert >>> create mode 100644 >>> tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-13.vert >>> >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-01.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-01.vert >>> new file mode 100644 >>> index 0000000..9ff573e >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-01.vert >>> @@ -0,0 +1,12 @@ >>> +// [config] >>> +// expect_result: pass >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that `precise` is allowed on globals. >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +precise vec4 x; >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-02.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-02.vert >>> new file mode 100644 >>> index 0000000..3c4b7aa >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-02.vert >>> @@ -0,0 +1,12 @@ >>> +// [config] >>> +// expect_result: pass >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that `precise` is allowed on shader outputs. >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +precise out vec4 x; >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-03.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-03.vert >>> new file mode 100644 >>> index 0000000..966cb77 >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-03.vert >>> @@ -0,0 +1,14 @@ >>> +// [config] >>> +// expect_result: pass >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that `precise` is allowed on local variables. >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +void foo() { >>> + precise float x; >>> +} >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-04.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-04.vert >>> new file mode 100644 >>> index 0000000..199f2e4 >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-04.vert >>> @@ -0,0 +1,14 @@ >>> +// [config] >>> +// expect_result: pass >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that `precise` is allowed as a parameter qualifier. >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +void foo(precise out float x) { >>> + x = 1; >>> +} >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-05.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-05.vert >>> new file mode 100644 >>> index 0000000..a4d933c >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-05.vert >>> @@ -0,0 +1,12 @@ >>> +// [config] >>> +// expect_result: pass >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that a redeclaration of a built-in variable at global scope is >>> allowed. >> It might also be useful to test multiple redeclarations with precise keyword. >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +precise gl_Position; >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-06.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-06.vert >>> new file mode 100644 >>> index 0000000..8947242 >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-06.vert >>> @@ -0,0 +1,14 @@ >>> +// [config] >>> +// expect_result: pass >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that a straightforward redeclaration of a user-defined variable >>> +// at global scope is allowed. >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +vec4 x; >>> +precise x; >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-07.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-07.vert >>> new file mode 100644 >>> index 0000000..4f34e50 >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-07.vert >>> @@ -0,0 +1,16 @@ >>> +// [config] >>> +// expect_result: pass >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// notable departure from the `invariant` qualifier rules: it seems >>> reasonable >>> +// to have local precise redeclarations be allowed. >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +void foo() { >>> + vec4 x; >>> + precise x; >>> +} >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-08.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-08.vert >>> new file mode 100644 >>> index 0000000..5961bfc >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-08.vert >>> @@ -0,0 +1,14 @@ >>> +// [config] >>> +// expect_result: pass >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that `precise inout` is allowed on a function parameter >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +void foo(precise inout float x) { >>> + x += 1; >>> +} >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-09.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-09.vert >>> new file mode 100644 >>> index 0000000..9968aab >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-09.vert >>> @@ -0,0 +1,15 @@ >>> +// [config] >>> +// expect_result: pass >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that precise redeclarations of function parameters are allowed. >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +void foo(out float x) { >>> + precise x; >>> + x = 1; >>> +} >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-10.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-10.vert >>> new file mode 100644 >>> index 0000000..41c5eb6 >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-10.vert >>> @@ -0,0 +1,14 @@ >>> +// [config] >>> +// expect_result: fail >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that precise redeclaration after the first use of a variable is >>> not allowed. >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +float x; >>> +x = 1; >>> +precise x; /* redeclaration after use */ >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-11.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-11.vert >>> new file mode 100644 >>> index 0000000..5f329be >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-11.vert >>> @@ -0,0 +1,15 @@ >>> +// [config] >>> +// expect_result: fail >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that a precise redeclaration of a parameter after use is not >>> allowed. >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +void foo(out x) { >>> + x = 1; >>> + precise x; /* redeclaration after use */ >>> +} >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-12.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-12.vert >>> new file mode 100644 >>> index 0000000..065c8cb >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-12.vert >>> @@ -0,0 +1,23 @@ >>> +// [config] >>> +// expect_result: fail >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that a precise redeclaration of a variable from an enclosing scope >>> is not >>> +// allowed. this seems unreasonable. >>> + >>> +// if we were to support this, it seems there would be two options for the >>> semantics >>> +// to impose: >>> +// - have `precise` only apply to uses of x within the function. >>> +// - have x globally marked precise from this point on, and apply the >>> usual >>> +// no-redeclaration-after-first-use rules, in program order. >>> + >> Would be nice to find out what NVIDIA does in this case. >> >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +float x; >>> + >>> +void foo() { >>> + precise x; /* seems unreasonable */ >>> +} >>> diff --git >>> a/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-13.vert >>> b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-13.vert >>> new file mode 100644 >>> index 0000000..9198dc5 >>> --- /dev/null >>> +++ b/tests/spec/arb_gpu_shader5/compiler/precise-qualifier/precise-13.vert >>> @@ -0,0 +1,16 @@ >>> +// [config] >>> +// expect_result: fail >>> +// glsl_version: 1.50 >>> +// require_extensions: GL_ARB_gpu_shader5 >>> +// [end config] >>> + >>> +// test that the precise qualifier must appear first with multiple >>> qualifications, >>> +// without ARB_shading_language_420pack. >>> + >>> +// the spec says the order of qualification must be: >>> +// precise-qualifier invariant-qualifier interpolation-qualifier ... >>> + >>> +#version 150 >>> +#extension GL_ARB_gpu_shader5: require >>> + >>> +invariant precise vec4 x; >>> -- >> If you find a matching behavior on NVIDIA for precise-12.vert: >> Patch is Reviewed-by: Anuj Phogat <anuj.pho...@gmail.com> > > precise-12 passed on NVidia, but 5 others failed. (piglit output attached) > > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-11.vert: pass > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-08.vert: pass > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-07.vert: fail > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-04.vert: pass > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-10.vert: pass > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-13.vert: fail > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-09.vert: fail > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-03.vert: pass > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-05.vert: fail > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-12.vert: pass > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-06.vert: fail > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-01.vert: pass > spec/ARB_gpu_shader5/compiler/precise-qualifier/precise-02.vert: pass > summary: > pass: 8 > fail: 5 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit