[Piglit] [PATCH] gles-es-1.00: add linker test to check default precision qualifier redeclaration

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon Oct 24 11:15:00 UTC 2016



On 21/10/16 05:55, Timothy Arceri wrote:
> 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.

I verified these are already tested in:

tests/spec/glsl-es-1.00/compiler/precision-qualifiers/default-precision-nested-scope-0X.frag

with X from 1 to 4.

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.
> 

Right.

So I think I can push this patch. Do you agree?

Sam

>> +
>> +uniform float a;
>> +
>> +void main(void)
>> +{
>> +    gl_FragColor = vec4(a);
>> +}
>> +[test]
>> +link success
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20161024/f3f48a94/attachment.sig>


More information about the Piglit mailing list