[Piglit] [PATCH] gles-es-1.00: add linker test to check default precision qualifier redeclaration
Timothy Arceri
timothy.arceri at collabora.com
Fri Oct 21 03:55:17 UTC 2016
On Thu, 2016-10-20 at 12:37 +0200, Samuel Iglesias Gonsálvez wrote:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97804
> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
> ---
> ...t-precision-qualifier-redeclaration.shader_test | 34
> ++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
> create mode 100644 tests/spec/glsl-es-1.00/linker/glsl-default-
> precision-qualifier-redeclaration.shader_test
>
> diff --git a/tests/spec/glsl-es-1.00/linker/glsl-default-precision-
> qualifier-redeclaration.shader_test b/tests/spec/glsl-es-
> 1.00/linker/glsl-default-precision-qualifier-
> redeclaration.shader_test
> new file mode 100644
> index 0000000..510ba20
> --- /dev/null
> +++ b/tests/spec/glsl-es-1.00/linker/glsl-default-precision-
> qualifier-redeclaration.shader_test
> @@ -0,0 +1,34 @@
> +#
> +# Test that vertex shader defaults to highp (only fragment shader
> +# needs to specify float precision) and that later fragment shader
> +# highp precision declaration overrides earlier mediump declaration.
> +#
> +[require]
> +GL ES >= 2.0
> +GLSL ES >= 1.00
> +
> +[vertex shader]
> +
> +uniform float a;
> +
> +void main(void)
> +{
> + gl_Position = vec4(a);
> +}
> +
> +[fragment shader]
> +#ifdef GL_ES
> +precision mediump float;
> +#endif
> +#ifdef GL_ES
> +precision highp float;
> +#endif
The test is fine but I believe we need more tests for the scoping
rules.
"The precision statement has the same scoping rules as variable
declarations. If it is declared inside a compound statement, its effect
stops at the end of the innermost
statement it was declared in. Precision statements in nested scopes
override precision statements in outer
scopes. Multiple precision statements for the same basic type can
appear inside the same scope, with later
statements overriding earlier statements within that scope"
This test only tests the last rule.
> +
> +uniform float a;
> +
> +void main(void)
> +{
> + gl_FragColor = vec4(a);
> +}
> +[test]
> +link success
More information about the Piglit
mailing list