[Piglit] [PATCH] glsl-1.10: Add some tests for over-riding built-in functions

Chad Versace chad at chad-versace.us
Thu Jul 7 13:28:30 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here is a 5th test that should be included. It is equivalent to the 4th except in that the prototype occurs *after* main. Thus main should use builtin abs.

diff --git a/tests/spec/glsl-1.10/linker/override-builtin-04.shader_test b/tests/spec/glsl-1.10/linker/override-builtin-05.shader_test
new file mode 100644
index 0000000..ed85b50
- --- /dev/null
+++ b/tests/spec/glsl-1.10/linker/override-builtin-05.shader_test
@@ -0,0 +1,30 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }
+
+[fragment shader]
+/* From page 38 (page 44 of the PDF) of the GLSL 1.10 spec:
+ *
+ *     "A shader can redefine built-in functions. If a built-in function is
+ *     redeclared in a shader (i.e. a prototype is visible) before a call to
+ *     it, then the linker will only attempt to resolve that call within the
+ *     set shaders that are linked with it."
+ */
+
+void main()
+{
+  gl_FragColor = abs(vec4(1.0, 0.0, 0.0, 1.0));
+}
+
+vec4 abs(vec4 unused);
+
+[fragment shader]
+vec4 abs(vec4 unused)
+{
+  return vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgb 1.0 0.0 0.0


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

iQIcBAEBAgAGBQJOFhbuAAoJEAIvNt057x8iu20P/irO902Ktvs5IBvKOGyvRMVF
gpxvgEz9skjvfSTu2C7BbSGSOSEtxj4DxFihTMed9JNNlLD27TUi/18/IYoPG/wl
DE4OYlWv3gke8mSYBbPJceDn+fEv2WCPxc95POvtezTS3Vqf7A4/2LEcKATCixMH
Ahe/MIZK3zNlxuBK1QZfKZDjYLVLnzaGUrtUp3ZtRx+33dec3TXdDJna5Wgklvtc
0FPFbKeHMABh05c7YaTOZL6D0266E1C3mTJVYLSit9mZ8yt40psxxjBSQj8CdB1o
0GXUyk5FyB0yeTTEd0J4cL37yi13bah4ivWRGEhYL0FcFP5CWy0wYNVbhYBveL1E
m95jz/0BxUbbKdW9NujS9gdGuYIaJ4mSq3FM6OPnF+pRqx6oTfiqmKqI3B5lDgVg
h8BedxwOBB3oJpQVzbAERi73RVHCeTXifqTJNTiozhjbx9tlmznIfF4aNBQGDOns
UdGtFHxsT2c9c0ytZOs4mMTc/oP4LMQFFnkde2fewMUQPDskLpqdvTt2k8PY8gZo
cMlxal3G3bvSkDZO/rv4KO1nyZexIEArJDM1xO7O4Z6W+HUuWfbpUMhlxdhwTAfu
2kOVkd44et6BavDDORCu/yG42oNhU4ce6OcBP9eJm/ErLlp7i59KGDmObNbaNWZE
Vd5PVcYrh/aab7+hyb8d
=dtqD
-----END PGP SIGNATURE-----


More information about the Piglit mailing list