[Piglit] [PATCH 6/6] glslparsertest: Add tests for bit logic ops in GLSL 1.30
Chad Versace
chad at chad-versace.us
Tue Oct 12 17:53:48 PDT 2010
From: Chad Versace <chad.versace at intel.com>
---
tests/glslparser.tests | 10 ++++
tests/glslparsertest/glsl2/bit-logic-01.frag | 16 ++++++
tests/glslparsertest/glsl2/bit-logic-02.frag | 15 ++++++
tests/glslparsertest/glsl2/bit-logic-03.frag | 23 ++++++++
tests/glslparsertest/glsl2/bit-logic-04.frag | 23 ++++++++
tests/glslparsertest/glsl2/bit-logic-05.frag | 11 ++++
tests/glslparsertest/glsl2/bit-logic-06.frag | 11 ++++
tests/glslparsertest/glsl2/bit-logic-07.frag | 11 ++++
tests/glslparsertest/glsl2/bit-logic-08.frag | 11 ++++
tests/glslparsertest/glsl2/bit-logic-09.frag | 12 ++++
tests/glslparsertest/glsl2/bit-logic-10.frag | 70 ++++++++++++++++++++++++++
11 files changed, 213 insertions(+), 0 deletions(-)
create mode 100644 tests/glslparsertest/glsl2/bit-logic-01.frag
create mode 100644 tests/glslparsertest/glsl2/bit-logic-02.frag
create mode 100644 tests/glslparsertest/glsl2/bit-logic-03.frag
create mode 100644 tests/glslparsertest/glsl2/bit-logic-04.frag
create mode 100644 tests/glslparsertest/glsl2/bit-logic-05.frag
create mode 100644 tests/glslparsertest/glsl2/bit-logic-06.frag
create mode 100644 tests/glslparsertest/glsl2/bit-logic-07.frag
create mode 100644 tests/glslparsertest/glsl2/bit-logic-08.frag
create mode 100644 tests/glslparsertest/glsl2/bit-logic-09.frag
create mode 100644 tests/glslparsertest/glsl2/bit-logic-10.frag
diff --git a/tests/glslparser.tests b/tests/glslparser.tests
index e005be8..7671b85 100644
--- a/tests/glslparser.tests
+++ b/tests/glslparser.tests
@@ -221,6 +221,16 @@ add_otherglslparsertest('glsl2/attribute-08.vert', 'fail')
add_otherglslparsertest('glsl2/attribute-09.vert', 'fail')
add_otherglslparsertest('glsl2/attribute-10.vert', 'fail', '1.20')
add_otherglslparsertest('glsl2/attribute-11.vert', 'fail', '1.30')
+add_otherglslparsertest('glsl2/bit-logic-01.frag', 'pass', '1.30')
+add_otherglslparsertest('glsl2/bit-logic-02.frag', 'pass', '1.30')
+add_otherglslparsertest('glsl2/bit-logic-03.frag', 'pass', '1.30')
+add_otherglslparsertest('glsl2/bit-logic-04.frag', 'pass', '1.30')
+add_otherglslparsertest('glsl2/bit-logic-05.frag', 'fail', '1.30')
+add_otherglslparsertest('glsl2/bit-logic-06.frag', 'fail', '1.30')
+add_otherglslparsertest('glsl2/bit-logic-07.frag', 'fail', '1.30')
+add_otherglslparsertest('glsl2/bit-logic-08.frag', 'fail', '1.30')
+add_otherglslparsertest('glsl2/bit-logic-09.frag', 'fail', '1.30')
+add_otherglslparsertest('glsl2/bit-logic-10.frag', 'pass', '1.30')
add_otherglslparsertest('glsl2/bit-not-01.frag', 'fail')
add_otherglslparsertest('glsl2/bit-not-02.frag', 'fail', '1.20')
add_otherglslparsertest('glsl2/bit-not-03.frag', 'pass', '1.30')
diff --git a/tests/glslparsertest/glsl2/bit-logic-01.frag b/tests/glslparsertest/glsl2/bit-logic-01.frag
new file mode 100644
index 0000000..0390263
--- /dev/null
+++ b/tests/glslparsertest/glsl2/bit-logic-01.frag
@@ -0,0 +1,16 @@
+// Expected: PASS, glsl == 1.30
+//
+// Description: bit-logic ops with argument type (int, int)
+//
+// From page 50 (page 56 of PDF) of the GLSL 1.30 spec:
+// "The operands must be of type signed or unsigned integers or integer
+// vectors."
+
+#version 130
+void main() {
+ int x0 = 0 & 1;
+ int x1 = 0 | 1;
+ int x2 = 0 ^ 1;
+}
+
+
diff --git a/tests/glslparsertest/glsl2/bit-logic-02.frag b/tests/glslparsertest/glsl2/bit-logic-02.frag
new file mode 100644
index 0000000..1ae8779
--- /dev/null
+++ b/tests/glslparsertest/glsl2/bit-logic-02.frag
@@ -0,0 +1,15 @@
+// Expected: PASS, glsl == 1.30
+//
+// Description: bit-logic ops with argument type (uint, uint)
+//
+// From page 50 (page 56 of PDF) of the GLSL 1.30 spec:
+// "The operands must be of type signed or unsigned integers or integer
+// vectors."
+
+#version 130
+void main() {
+ uint x0 = uint(0) & uint(1);
+ uint x1 = uint(0) | uint(1);
+ uint x2 = uint(0) ^ uint(1);
+}
+
diff --git a/tests/glslparsertest/glsl2/bit-logic-03.frag b/tests/glslparsertest/glsl2/bit-logic-03.frag
new file mode 100644
index 0000000..8a8eb85
--- /dev/null
+++ b/tests/glslparsertest/glsl2/bit-logic-03.frag
@@ -0,0 +1,23 @@
+// Expected: PASS, glsl == 1.30
+//
+// Description: bit-logic ops with argument type (ivecN, ivecN)
+//
+// From page 50 (page 56 of PDF) of the GLSL 1.30 spec:
+// "The operands must be of type signed or unsigned integers or integer
+// vectors."
+
+#version 130
+void main() {
+ // ivec2
+ ivec2 v00 = ivec2(0, 1) & ivec2(0, 1);
+ ivec2 v01 = ivec2(0, 1) & ivec2(0, 1);
+
+ // ivec3
+ ivec3 v02 = ivec3(0, 1, 2) | ivec3(0, 1, 2);
+ ivec3 v03 = ivec3(0, 1, 2) | ivec3(0, 1, 2);
+
+ // ivec4
+ ivec4 v04 = ivec4(0, 1, 2, 3) ^ ivec4(0, 1, 2, 3);
+ ivec4 v05 = ivec4(0, 1, 2, 3) ^ ivec4(0, 1, 2, 3);
+}
+
diff --git a/tests/glslparsertest/glsl2/bit-logic-04.frag b/tests/glslparsertest/glsl2/bit-logic-04.frag
new file mode 100644
index 0000000..5e5fc80
--- /dev/null
+++ b/tests/glslparsertest/glsl2/bit-logic-04.frag
@@ -0,0 +1,23 @@
+// Expected: PASS, glsl == 1.30
+//
+// Description: bit-logic ops with argument type (uvecN, uvecN)
+//
+// From page 50 (page 56 of PDF) of the GLSL 1.30 spec:
+// "The operands must be of type signed or unsigned integers or integer
+// vectors."
+
+#version 130
+void main() {
+ // uvec2
+ uvec2 v00 = uvec2(0, 1) & uvec2(0, 1);
+ uvec2 v01 = uvec2(0, 1) & uvec2(0, 1);
+
+ // uvec3
+ uvec3 v02 = uvec3(0, 1, 2) | uvec3(0, 1, 2);
+ uvec3 v03 = uvec3(0, 1, 2) | uvec3(0, 1, 2);
+
+ // uvec4
+ uvec4 v04 = uvec4(0, 1, 2, 3) ^ uvec4(0, 1, 2, 3);
+ uvec4 v05 = uvec4(0, 1, 2, 3) ^ uvec4(0, 1, 2, 3);
+}
+
diff --git a/tests/glslparsertest/glsl2/bit-logic-05.frag b/tests/glslparsertest/glsl2/bit-logic-05.frag
new file mode 100644
index 0000000..838bdf8
--- /dev/null
+++ b/tests/glslparsertest/glsl2/bit-logic-05.frag
@@ -0,0 +1,11 @@
+// Expected: FAIL, glsl == 1.30
+//
+// Description: bit-and with argument type (int, uint)
+//
+// From page 50 (page 56 of PDF) of the GLSL 1.30 spec:
+// "The fundamental types of the operands (signed or unsigned) must match"
+
+#version 130
+void main() {
+ int x = int(7) & uint(1);
+}
diff --git a/tests/glslparsertest/glsl2/bit-logic-06.frag b/tests/glslparsertest/glsl2/bit-logic-06.frag
new file mode 100644
index 0000000..2373986
--- /dev/null
+++ b/tests/glslparsertest/glsl2/bit-logic-06.frag
@@ -0,0 +1,11 @@
+// Expected: FAIL, glsl == 1.30
+//
+// Description: bit-and with argument type (vec2, uvec2)
+//
+// From page 50 (page 56 of PDF) of the GLSL 1.30 spec:
+// "The fundamental types of the operands (signed or unsigned) must match"
+
+#version 130
+void main() {
+ ivec2 v = ivec2(1, 2) & uvec2(1, 2);
+}
diff --git a/tests/glslparsertest/glsl2/bit-logic-07.frag b/tests/glslparsertest/glsl2/bit-logic-07.frag
new file mode 100644
index 0000000..569c8d9
--- /dev/null
+++ b/tests/glslparsertest/glsl2/bit-logic-07.frag
@@ -0,0 +1,11 @@
+// Expected: FAIL, glsl == 1.30
+//
+// Description: bit-and with argument type (vec2, uvec2)
+//
+// From page 50 (page 56 of PDF) of the GLSL 1.30 spec:
+// "The operands cannot be vectors of differing size."
+
+#version 130
+void main() {
+ ivec2 v = ivec2(1, 2) & ivec3(1, 2, 3);
+}
diff --git a/tests/glslparsertest/glsl2/bit-logic-08.frag b/tests/glslparsertest/glsl2/bit-logic-08.frag
new file mode 100644
index 0000000..35bba46
--- /dev/null
+++ b/tests/glslparsertest/glsl2/bit-logic-08.frag
@@ -0,0 +1,11 @@
+// Expected: FAIL, glsl == 1.30
+//
+// Description: bit-and with argument type (uint, vec2)
+//
+// From page 50 (page 56 of PDF) of the GLSL 1.30 spec:
+// "The fundamental types of the operands (signed or unsigned) must match"
+
+#version 130
+void main() {
+ ivec4 v = uint(7) & vec2(1, 2);
+}
diff --git a/tests/glslparsertest/glsl2/bit-logic-09.frag b/tests/glslparsertest/glsl2/bit-logic-09.frag
new file mode 100644
index 0000000..1884d19
--- /dev/null
+++ b/tests/glslparsertest/glsl2/bit-logic-09.frag
@@ -0,0 +1,12 @@
+// Expected: FAIL, glsl == 1.30
+//
+// Description: bit-logic ops with argument type (bool, bool)
+//
+// From page 50 (page 56 of PDF) of the GLSL 1.30 spec:
+// "The operands must be of type signed or unsigned integers or integer
+// vectors."
+
+#version 130
+void main() {
+ bool b = true & false;
+}
diff --git a/tests/glslparsertest/glsl2/bit-logic-10.frag b/tests/glslparsertest/glsl2/bit-logic-10.frag
new file mode 100644
index 0000000..16c0b2b
--- /dev/null
+++ b/tests/glslparsertest/glsl2/bit-logic-10.frag
@@ -0,0 +1,70 @@
+// Expected: PASS, glsl == 1.30
+//
+// Description: bit-logic ops with argument types:
+// - (ivecN, int)
+// - (uvecN, uint)
+// - (int, ivecN)
+// - (uint, uvecN)
+//
+// From page 50 (page 56 of PDF) of the GLSL 1.30 spec:
+// "If one operand is a scalar and the other a vector, the scalar is applied
+// component-wise to the vector, resulting in the same type as the vector."
+
+#version 130
+void main() {
+ // (ivecN, int) --------------------------
+
+ // (ivec2, int)
+ ivec2 v00 = ivec2(0, 1) & int(7);
+ ivec2 v01 = ivec2(0, 1) | int(7);
+
+ // (ivec3, int)
+ ivec3 v02 = ivec3(0, 1, 2) & int(7);
+ ivec3 v03 = ivec3(0, 1, 2) | int(7);
+
+ // (ivec4, int)
+ ivec4 v04 = ivec4(0, 1, 2, 3) & int(7);
+ ivec4 v05 = ivec4(0, 1, 2, 3) | int(7);
+
+ // (uvecN, uint) --------------------------
+
+ // (uvec2, uint)
+ uvec2 v10 = uvec2(0, 1) & uint(7);
+ uvec2 v11 = uvec2(0, 1) | uint(7);
+
+ // (uve13, uint)
+ uvec3 v12 = uvec3(0, 1, 2) & uint(7);
+ uvec3 v13 = uvec3(0, 1, 2) | uint(7);
+
+ // (uve14, uint)
+ uvec4 v14 = uvec4(0, 1, 2, 3) & uint(7);
+ uvec4 v15 = uvec4(0, 1, 2, 3) | uint(7);
+
+ // (int, ivecN) --------------------------
+
+ // (int, ivec2)
+ ivec2 v20 = int(7) & ivec2(0, 1);
+ ivec2 v21 = int(7) | ivec2(0, 1);
+
+ // (int2 ivec3)
+ ivec3 v22 = int(7) & ivec3(0, 1, 2);
+ ivec3 v23 = int(7) | ivec3(0, 1, 2);
+
+ // (int2 ivec4)
+ ivec4 v24 =int(7) & ivec4(0, 1, 2, 3);
+ ivec4 v25 = int(7) | ivec4(0, 1, 2, 3);
+
+ // (int, uvecN) --------------------------
+
+ // (uint, uvec2)
+ uvec2 v30 = uint(7) & uvec2(0, 1);
+ uvec2 v31 = uint(7) | uvec2(0, 1);
+
+ // (uin32 uvec3)
+ uvec3 v32 = uint(7) & uvec3(0, 1, 2);
+ uvec3 v33 = uint(7) | uvec3(0, 1, 2);
+
+ // (uin32 uvec4)
+ uvec4 v34 =uint(7) & uvec4(0, 1, 2, 3);
+ uvec4 v35 = uint(7) | uvec4(0, 1, 2, 3);
+}
--
1.7.1
More information about the Piglit
mailing list