[Piglit] [PATCH] Add tests for GLSL ES 1.00 mismatched uniform precision
Ilia Mirkin
imirkin at alum.mit.edu
Mon Nov 6 19:56:54 UTC 2017
On Mon, Nov 6, 2017 at 2:52 PM, Dylan Baker <dylan at pnwbakers.com> wrote:
> Quoting Ilia Mirkin (2017-11-06 11:49:05)
>> On Mon, Nov 6, 2017 at 2:45 PM, Dylan Baker <dylan at pnwbakers.com> wrote:
>> > For ES 1.00 a number of real world android apps depend on uniforms with
>> > mismatched precision linking as long as those uniforms are used in 1 or
>> > 0 shader stages. This patch adds a test for both the 0 or 1 test that is
>> > expected to pass (bug currently fails), and a test for the > 1 case that
>> > is expected to fail (and does).
>> >
>> > Because GLSL ES 3.00 is more specific (declared uniforms precision must
>> > match) this also adds similar tests for ES 3.00 that test for failure in
>> > both cases.
>> >
>> > bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97532
>> > Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
>> > ---
>> > ...mismatched-uniform-percision-unused.shader_test | 50 +++++++++++++++++++++
>> > ...l-mismatched-uniform-percision-used.shader_test | 50 +++++++++++++++++++++
>> > ...mismatched-uniform-percision-unused.shader_test | 52 ++++++++++++++++++++++
>> > ...l-mismatched-uniform-percision-used.shader_test | 52 ++++++++++++++++++++++
>> > 4 files changed, 204 insertions(+)
>> > create mode 100644 tests/spec/glsl-es-1.00/linker/glsl-mismatched-uniform-percision-unused.shader_test
>> > create mode 100644 tests/spec/glsl-es-1.00/linker/glsl-mismatched-uniform-percision-used.shader_test
>> > create mode 100644 tests/spec/glsl-es-3.00/linker/glsl-mismatched-uniform-percision-unused.shader_test
>> > create mode 100644 tests/spec/glsl-es-3.00/linker/glsl-mismatched-uniform-percision-used.shader_test
>> >
>> > diff --git a/tests/spec/glsl-es-3.00/linker/glsl-mismatched-uniform-percision-unused.shader_test b/tests/spec/glsl-es-3.00/linker/glsl-mismatched-uniform-percision-unused.shader_test
>> > new file mode 100644
>> > index 000000000..2440e50d8
>> > --- /dev/null
>> > +++ b/tests/spec/glsl-es-3.00/linker/glsl-mismatched-uniform-percision-unused.shader_test
>> > @@ -0,0 +1,52 @@
>> > +# Copyright © 2017 Intel Corporation
>> > +
>> > +# Permission is hereby granted, free of charge, to any person obtaining a copy
>> > +# of this software and associated documentation files (the "Software"), to deal
>> > +# in the Software without restriction, including without limitation the rights
>> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
>> > +# copies of the Software, and to permit persons to whom the Software is
>> > +# furnished to do so, subject to the following conditions:
>> > +
>> > +# The above copyright notice and this permission notice shall be included in
>> > +# all copies or substantial portions of the Software.
>> > +
>> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
>> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>> > +# SOFTWARE.
>> > +
>> > +# Test for https://bugs.freedesktop.org/show_bug.cgi?id=97532
>> > +#
>> > +# for GLSL ES 1.00 a number of apps depend on having different precision in
>> > +# uniforms in different shader stages, but this is only valid uniforms that are
>> > +# used in one shader or are unused. ES 3.0 is much more specific that declared
>> > +# uniforms must match, so this should fail.
>> > +
>> > +[require]
>> > +GL ES >= 3.0
>> > +GLSL ES >= 3.00
>> > +
>> > +[vertex shader]
>> > +precision highp float;
>> > +uniform float f;
>> > +uniform mat4 M;
>> > +
>> > +void main(void) {
>> > + gl_Position = vec4(1.0);
>> > +}
>> > +
>> > +[fragment shader]
>> > +precision mediump float;
>> > +uniform float f;
>> > +uniform mat4 M;
>> > +out vec4 fragcolor;
>> > +
>> > +void main(void) {
>> > + fragcolor = vec4(f);
>> > +}
>> > +
>> > +[test]
>> > +link error
>>
>> This test should pass, when written as-is. I think you meant to add
>> "#version 300 es" at the top? Or is this really meant to be based on
>> the context? If so, can't you get a ES 3.0 context when requesting an
>> ES 2.0 one?
>>
>> -ilia
>
> I thought that shader_runner added the appropriate #version based on the
> [require] section, is that incorrect?
Oh. It might. That sounds familiar.
More information about the Piglit
mailing list