[Piglit] [PATCH 2/2] arb_gpu_shader_fp64: Explicit conversion from double to float
Andres Gomez
agomez at igalia.com
Sat Feb 20 11:38:07 UTC 2016
Double and float derived types also need explicit
conversions.
Signed-off-by: Andres Gomez <agomez at igalia.com>
---
.../gen_constant_array_size_tests_fp64.py | 2 +-
.../compiler/double-loop-iterator.vert | 4 +--
.../compiler/implicit-conversion-bad.vert | 30 ----------------------
.../compiler/implicit-conversion-double-float.vert | 20 +++++++++++++++
.../compiler/implicit-conversion-dvec2-vec2.vert | 20 +++++++++++++++
.../compiler/implicit-conversion-dvec3-vec3.vert | 20 +++++++++++++++
.../compiler/implicit-conversion-dvec4-vec4.vert | 20 +++++++++++++++
.../execution/check-explicit-location.c | 2 +-
8 files changed, 84 insertions(+), 34 deletions(-)
delete mode 100644 tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-bad.vert
create mode 100644 tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-double-float.vert
create mode 100644 tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec2-vec2.vert
create mode 100644 tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec3-vec3.vert
create mode 100644 tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec4-vec4.vert
diff --git a/generated_tests/gen_constant_array_size_tests_fp64.py b/generated_tests/gen_constant_array_size_tests_fp64.py
index fb9d801..72407c6 100644
--- a/generated_tests/gen_constant_array_size_tests_fp64.py
+++ b/generated_tests/gen_constant_array_size_tests_fp64.py
@@ -165,7 +165,7 @@ class ParserTest(object):
shader += ' double[{0} ? 1 : -1] array{1};\n'.format(
self.make_condition(test_vector), i)
lengths.append('array{0}.length()'.format(i))
- shader += ' {0} = dvec4({1});\n'.format(
+ shader += ' {0} = vec4({1});\n'.format(
self.output_var(), ' + '.join(lengths))
shader += '}\n'
return shader
diff --git a/tests/spec/arb_gpu_shader_fp64/compiler/double-loop-iterator.vert b/tests/spec/arb_gpu_shader_fp64/compiler/double-loop-iterator.vert
index 7756c8b..9c691f0 100644
--- a/tests/spec/arb_gpu_shader_fp64/compiler/double-loop-iterator.vert
+++ b/tests/spec/arb_gpu_shader_fp64/compiler/double-loop-iterator.vert
@@ -12,11 +12,11 @@
void test() {
double k;
- vec4 vertex;
+ dvec4 vertex;
for (k = 0.0lf; k < 1.0lf; k += 0.1lf) {
vertex.x += k;
}
- gl_Position = vertex;
+ gl_Position = vec4(vertex);
}
diff --git a/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-bad.vert b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-bad.vert
deleted file mode 100644
index 95b85c8..0000000
--- a/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-bad.vert
+++ /dev/null
@@ -1,30 +0,0 @@
-// [config]
-// expect_result: fail
-// glsl_version: 1.50
-// require_extensions: GL_ARB_gpu_shader_fp64
-// [end config]
-//
-// Test double -> float implicit conversion doesn't happen
-// this tests a bug in mesa
-
-#version 150
-#extension GL_ARB_gpu_shader_fp64 : enable
-
-float _float = 0.0f;
-vec2 _vec2 = vec2(0.0f);
-vec3 _vec3 = vec3(0.0f);
-vec4 _vec4 = vec4(0.0f);
-
-double _double = 0.0lf;
-dvec2 _dvec2 = dvec2(0.0lf);
-dvec3 _dvec3 = dvec3(0.0lf);
-dvec4 _dvec4 = dvec4(0.0lf);
-
-void test() {
-
- /* int can be converted to double (and for vectors of same) */
- _float = _double;
- _vec2 = _dvec2;
- _vec3 = _dvec3;
- _vec4 = _dvec4;
-}
diff --git a/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-double-float.vert b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-double-float.vert
new file mode 100644
index 0000000..3e2b15a
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-double-float.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader_fp64
+// [end config]
+//
+// Test double -> float implicit conversion doesn't happen
+
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : enable
+
+float _float = 0.0f;
+
+double _double = 0.0lf;
+
+void test() {
+
+ /* double cannot be converted to float (and for vectors of same) */
+ _float = _double;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec2-vec2.vert b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec2-vec2.vert
new file mode 100644
index 0000000..225636d
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec2-vec2.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader_fp64
+// [end config]
+//
+// Test double -> float implicit conversion doesn't happen
+
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : enable
+
+vec2 _vec2 = vec2(0.0f);
+
+dvec2 _dvec2 = dvec2(0.0lf);
+
+void test() {
+
+ /* double cannot be converted to float (and for vectors of same) */
+ _vec2 = _dvec2;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec3-vec3.vert b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec3-vec3.vert
new file mode 100644
index 0000000..cf8583e
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec3-vec3.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader_fp64
+// [end config]
+//
+// Test double -> float implicit conversion doesn't happen
+
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : enable
+
+vec3 _vec3 = vec3(0.0f);
+
+dvec3 _dvec3 = dvec3(0.0lf);
+
+void test() {
+
+ /* double cannot be converted to float (and for vectors of same) */
+ _vec3 = _dvec3;
+}
diff --git a/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec4-vec4.vert b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec4-vec4.vert
new file mode 100644
index 0000000..dd394e5
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/compiler/implicit-conversion-dvec4-vec4.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader_fp64
+// [end config]
+//
+// Test double -> float implicit conversion doesn't happen
+
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : enable
+
+vec4 _vec4 = vec4(0.0f);
+
+dvec4 _dvec4 = dvec4(0.0lf);
+
+void test() {
+
+ /* double cannot be converted to float (and for vectors of same) */
+ _vec4 = _dvec4;
+}
diff --git a/tests/spec/arb_vertex_attrib_64bit/execution/check-explicit-location.c b/tests/spec/arb_vertex_attrib_64bit/execution/check-explicit-location.c
index 599ac8a..509f60b 100644
--- a/tests/spec/arb_vertex_attrib_64bit/execution/check-explicit-location.c
+++ b/tests/spec/arb_vertex_attrib_64bit/execution/check-explicit-location.c
@@ -50,7 +50,7 @@ const char *vs_text =
"flat out dvec4 fscolor;\n"
"void main()\n"
"{\n"
- "gl_Position = vertex;\n"
+ "gl_Position = vec4(vertex);\n"
"fscolor = vcolor;\n"
"}\n";
--
2.1.0
More information about the Piglit
mailing list