[Piglit] [PATCH 08/11] mesa_shader_integer_functions: Clone arb_gpu_shader5 implicit conversions compiler tests

Ian Romanick idr at freedesktop.org
Wed Jun 29 21:23:08 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

    cd tests/spec/mesa_shader_integer_functions/compiler
    cp ../../arb_gpu_shader5/compiler/implicit-conversions-*.vert
    for i in implicit-conversions-*.vert; do
        sed --in-place -e 's/1[.]50/1.30/g;s/150/130/g' \
            -e 's/ARB_gpu_shader5/MESA_shader_integer_functions/g' \
            $i
    done

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 .../compiler/implicit-conversions-01.vert          | 51 ++++++++++++++++++
 .../compiler/implicit-conversions-02.vert          | 63 ++++++++++++++++++++++
 2 files changed, 114 insertions(+)
 create mode 100644 tests/spec/mesa_shader_integer_functions/compiler/implicit-conversions-01.vert
 create mode 100644 tests/spec/mesa_shader_integer_functions/compiler/implicit-conversions-02.vert

diff --git a/tests/spec/mesa_shader_integer_functions/compiler/implicit-conversions-01.vert b/tests/spec/mesa_shader_integer_functions/compiler/implicit-conversions-01.vert
new file mode 100644
index 0000000..86ab2e2
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/compiler/implicit-conversions-01.vert
@@ -0,0 +1,51 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// require_extensions: GL_MESA_shader_integer_functions
+// [end config]
+
+// Test that implicit conversions are allowed as specified in MESA_shader_integer_functions.
+
+
+#version 130
+#extension GL_MESA_shader_integer_functions : enable
+
+int _int = 0;
+ivec2 _ivec2 = ivec2(0);
+ivec3 _ivec3 = ivec3(0);
+ivec4 _ivec4 = ivec4(0);
+
+uint _uint = 0u;
+uvec2 _uvec2 = uvec2(0u);
+uvec3 _uvec3 = uvec3(0u);
+uvec4 _uvec4 = uvec4(0u);
+
+float _float = 0.0f;
+vec2 _vec2 = vec2(0.0f);
+vec3 _vec3 = vec3(0.0f);
+vec4 _vec4 = vec4(0.0f);
+
+void test() {
+
+	/* int can be converted to uint and to float (and for vectors of same) */
+	_uint = _int;
+	_float = _int;
+
+	_uvec2 = _ivec2;
+	_vec2 = _ivec2;
+
+	_uvec3 = _ivec3;
+	_vec3 = _ivec3;
+
+	_uvec4 = _ivec4;
+	_vec4 = _ivec4;
+
+	/* uint can be converted to float (and for vectors of same) */
+	_float = _uint;
+
+	_vec2 = _uvec2;
+
+	_vec3 = _uvec3;
+
+	_vec4 = _uvec4;
+}
diff --git a/tests/spec/mesa_shader_integer_functions/compiler/implicit-conversions-02.vert b/tests/spec/mesa_shader_integer_functions/compiler/implicit-conversions-02.vert
new file mode 100644
index 0000000..64a4bf8
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/compiler/implicit-conversions-02.vert
@@ -0,0 +1,63 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// require_extensions: GL_MESA_shader_integer_functions
+// [end config]
+
+// Test implicit conversions from MESA_shader_integer_functions in function parameter handling.
+
+
+#version 130
+#extension GL_MESA_shader_integer_functions : enable
+
+int _int = 0;
+ivec2 _ivec2 = ivec2(0);
+ivec3 _ivec3 = ivec3(0);
+ivec4 _ivec4 = ivec4(0);
+
+uint _uint = 0u;
+uvec2 _uvec2 = uvec2(0u);
+uvec3 _uvec3 = uvec3(0u);
+uvec4 _uvec4 = uvec4(0u);
+
+float _float = 0.0f;
+vec2 _vec2 = vec2(0.0f);
+vec3 _vec3 = vec3(0.0f);
+vec4 _vec4 = vec4(0.0f);
+
+
+void f_uint(uint x) {}
+void f_uvec2(uvec2 x) {}
+void f_uvec3(uvec3 x) {}
+void f_uvec4(uvec4 x) {}
+
+void f_float(float x) {}
+void f_vec2(vec2 x) {}
+void f_vec3(vec3 x) {}
+void f_vec4(vec4 x) {}
+
+
+void test() {
+
+	/* int can be converted to uint and to float (and for vectors of same) */
+	f_uint(_int);
+	f_float(_int);
+
+	f_uvec2(_ivec2);
+	f_vec2(_ivec2);
+
+	f_uvec3(_ivec3);
+	f_vec3(_ivec3);
+
+	f_uvec4(_ivec4);
+	f_vec4(_ivec4);
+
+	/* uint can be converted to float (and for vectors of same) */
+	f_float(_uint);
+
+	f_vec2(_uvec2);
+
+	f_vec3(_uvec3);
+
+	f_vec4(_uvec4);
+}
-- 
2.5.5



More information about the Piglit mailing list