[Piglit] [PATCH 2/2] Test that shaders are not allowed to declare non-uniform samplers.
Chad Versace
chad at chad-versace.us
Wed Jul 13 17:05:37 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/13/2011 03:28 PM, Paul Berry wrote:
I've made a correction in compilers/samplers/return.frag.
With that applied, this is
Reviwed-by: Chad Versace <chad at chad-versace.us>
[snip]
> diff --git a/tests/spec/glsl-1.10/compiler/samplers/return-struct.frag b/tests/spec/glsl-1.10/compiler/samplers/return-struct.frag
> new file mode 100644
> index 0000000..16d92aa
> --- /dev/null
> +++ b/tests/spec/glsl-1.10/compiler/samplers/return-struct.frag
> @@ -0,0 +1,24 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.10
> + * [end config]
> + *
> + * From page 19 (page 25 of the PDF) of the GLSL 1.10 spec:
> + *
> + * "[Samplers] can only be declared as function parameters or uniforms
> + * (see Section 4.3.5 "Uniform")."
> + */
> +uniform struct foo {
> + float x;
> + sampler2D tex;
> +} u;
To increase the likelihood that the cause of compilation failure is the cause
you intend, I would change the above to:
struct foo {
float x;
sampler2D tex;
};
uniform foo u;
I would prefer to see this change, but the patch is still rb'd if you object.
> +
> +foo f()
> +{
> + return u;
> +}
> +
> +void main()
> +{
> + gl_FragColor = vec4(1.0);
> +}
> diff --git a/tests/spec/glsl-1.10/compiler/samplers/return.frag b/tests/spec/glsl-1.10/compiler/samplers/return.frag
> new file mode 100644
> index 0000000..4c25fbc
> --- /dev/null
> +++ b/tests/spec/glsl-1.10/compiler/samplers/return.frag
> @@ -0,0 +1,21 @@
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 1.10
> + * [end config]
> + *
> + * From page 19 (page 25 of the PDF) of the GLSL 1.10 spec:
> + *
> + * "[Samplers] can only be declared as function parameters or uniforms
> + * (see Section 4.3.5 "Uniform")."
> + */
> +sampler2D u;
^^^^^^^^^^^^^^^
This declaration should be corrected to `uniform sampler2D u`.
The test purports to test that samplers cannot be return values, but may also fail
because u is not uniform.
> +
> +sampler2D f()
> +{
> + return u;
> +}
> +
> +void main()
> +{
> + gl_FragColor = vec4(1.0);
> +}
> diff --git a/tests/spec/glsl-1.10/execution/samplers/in-parameter-struct.shader_test b/tests/spec/glsl-1.10/execution/samplers/in-parameter-struct.shader_test
> new file mode 100644
> index 0000000..23b352c
> --- /dev/null
> +++ b/tests/spec/glsl-1.10/execution/samplers/in-parameter-struct.shader_test
> @@ -0,0 +1,38 @@
> +[require]
> +GLSL >= 1.10
> +
> +[vertex shader]
> +varying vec4 texcoords;
> +
> +void main()
> +{
> + gl_Position = gl_Vertex;
> + texcoords = (gl_Vertex + 1.0) / 2.0;
> +}
> +
> +[fragment shader]
> +varying vec4 texcoords;
> +uniform struct S {
> + float f;
> + sampler2D tex;
> +} s;
Same comment as in compilers/samplers/return-struct.shader_test.
- --
Chad Versace
chad at chad-versace.us
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJOHjLRAAoJEAIvNt057x8iTXMQAIz2W3s1O64385UiJ6ydvEg+
3I8VdBNK/0hVpOsousmCU/eyTb8wM2VqwOc+qSbR7jsIYQGYBevTj9kBdRoiwGJt
YjCCJYY+J6Q8P2FUVmIxhiBoWw9rq4DcgMoYovep1DgQeT27zza9JNDusjrKDzxi
VfAWy/1tisXQlEnMVMeCYQnRkBoqPU16dn+Dec10g9jY5mM/GZ6jMJwdE8TYCHtQ
aSlYhxq5yIUsmWAsXF5z+QlXKmjFDPLtE7cwzzlWWGFt1Cp/y9UXTkKmRMvIjv6R
gnwZFZuQdWi1moBASSYuediZzVDRFF39JooM8fFDJ/2hdq/uoftCK3Fc4BL+nuMQ
OAQF6OAnQyr/qOpIh9WlUBz8cZc8YzoY9O9yWk+p0BsiOed/j+XR13JASo36fnoF
VtiV0As+Ls/UHr9N7c6BcXqk2uz+I4iYI0BX9EJ/ofLtZDWHIQOsvhBv2D6NiI6M
LP3ePB9oDp+/Smzrb1ZSb6e52CxYh5TaBW4A71kxvOfrHPNrop0t6E3DnHdDSv+7
kwP6uNuG0t0CTbVzx3QkfCel6UB7eW/hyOnB2INhFxR86A3HxbCU0e1gbZJF9n9Q
YPtYVHVRg8o0e59DPe2aw+UUX+7Uu2h0kqxUqZJOfnHpxInENb3Ov0S1w7bL537H
GmPDRYwVsY1NJUUs4uP6
=s5Pn
-----END PGP SIGNATURE-----
More information about the Piglit
mailing list