From: Nicolai Hähnle <nicolai.haeh...@amd.com> The only-{exponent,mantissa} tests hit a bug in Mesa's st/glsl_to_tgsi. --- .../fs-frexp-dvec4-only-exponent.shader_test | 37 +++++++++++++ .../fs-frexp-dvec4-only-mantissa.shader_test | 38 +++++++++++++ .../fs-frexp-dvec4-variable-index.shader_test | 64 ++++++++++++++++++++++ 3 files changed, 139 insertions(+) create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-mantissa.shader_test create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-variable-index.shader_test
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test new file mode 100644 index 000000000..d7dc64032 --- /dev/null +++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-exponent.shader_test @@ -0,0 +1,37 @@ +[require] +GLSL >= 1.40 +GL_ARB_gpu_shader_fp64 + +[vertex shader passthrough] + +[fragment shader] +#extension GL_ARB_gpu_shader_fp64 : enable + +uniform dvec4 u_in; +uniform ivec4 u_exponent; + +out vec4 outcolor; + +void main() +{ + outcolor = vec4(0, 1, 0, 1); + + ivec4 exponent; + frexp(u_in, exponent); + + for (int i = 0; i < 4; ++i) { + if (exponent[i] != u_exponent[i]) + outcolor = vec4(1.0, float(i) / 255, + float(exponent[i] + 127) / 255, float(u_exponent[i] + 127) / 255); + } +} + +[test] +clear color 0 0 0 1 +clear + +uniform dvec4 u_in 2 3 4 9 +uniform ivec4 u_exponent 1 1 2 3 + +draw rect -1 -1 2 2 +probe all rgba 0 1 0 1 diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-mantissa.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-mantissa.shader_test new file mode 100644 index 000000000..3d7a3f2dc --- /dev/null +++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-only-mantissa.shader_test @@ -0,0 +1,38 @@ +[require] +GLSL >= 1.40 +GL_ARB_gpu_shader_fp64 + +[vertex shader passthrough] + +[fragment shader] +#extension GL_ARB_gpu_shader_fp64 : enable + +uniform dvec4 u_in; +uniform dvec4 u_mantissa; + +out vec4 outcolor; + +void main() +{ + outcolor = vec4(0, 1, 0, 1); + + ivec4 exponent; + dvec4 mantissa; + mantissa = frexp(u_in, exponent); + + for (int i = 0; i < 4; ++i) { + if (mantissa[i] != u_mantissa[i]) + outcolor = vec4(1.0, float(i) / 255, + float(mantissa[i]), float(u_mantissa[i])); + } +} + +[test] +clear color 0 0 0 1 +clear + +uniform dvec4 u_in 2 3 4 5 +uniform dvec4 u_mantissa 0.5 0.75 0.5 0.625 + +draw rect -1 -1 2 2 +probe all rgba 0 1 0 1 diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-variable-index.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-variable-index.shader_test new file mode 100644 index 000000000..c3912bf9d --- /dev/null +++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-frexp-dvec4-variable-index.shader_test @@ -0,0 +1,64 @@ +[require] +GLSL >= 1.40 +GL_ARB_gpu_shader_fp64 + +[vertex shader passthrough] + +[fragment shader] +#extension GL_ARB_gpu_shader_fp64 : enable + +uniform dvec4 u_in[2]; +uniform dvec4 u_mantissa[2]; +uniform ivec4 u_exponent[2]; +uniform int u_xor_mantissa; +uniform int u_xor_exponent; + +out vec4 outcolor; + +void main() +{ + outcolor = vec4(0, 1, 0, 1); + + ivec4 exponent[2]; + dvec4 mantissa[2]; + + for (int i = 0; i < 2; ++i) + mantissa[i ^ u_xor_mantissa] = frexp(u_in[i], exponent[i ^ u_xor_exponent]); + + for (int i = 0; i < 2; ++i) { + for (int j = 0; j < 4; ++j) { + if (mantissa[i][j] != u_mantissa[i][j] || + exponent[i][j] != u_exponent[i][j]) + outcolor = vec4(1.0, float(i * 4 + j) / 255, + float(exponent[i][j] + 127) / 255, float(mantissa[i][j])); + } + } +} + +[test] +clear color 0 0 0 1 +clear + +uniform dvec4 u_in[0] 1 2 3 4 +uniform dvec4 u_in[1] 5 6 7 8 +uniform int u_xor_mantissa 0 +uniform int u_xor_exponent 0 +uniform dvec4 u_mantissa[0] 0.5 0.5 0.75 0.5 +uniform dvec4 u_mantissa[1] 0.625 0.75 0.875 0.5 +uniform ivec4 u_exponent[0] 1 2 2 3 +uniform ivec4 u_exponent[1] 3 3 3 4 + +draw rect -1 -1 2 2 +probe all rgba 0 1 0 1 + +uniform dvec4 u_in[0] 12 16 24 32 +uniform dvec4 u_in[1] 40 64 80 128 +uniform int u_xor_mantissa 0 +uniform int u_xor_exponent 1 +uniform dvec4 u_mantissa[0] 0.75 0.5 0.75 0.5 +uniform dvec4 u_mantissa[1] 0.625 0.5 0.625 0.5 +uniform ivec4 u_exponent[1] 4 5 5 6 +uniform ivec4 u_exponent[0] 6 7 7 8 + +draw rect -1 -1 2 2 +probe all rgba 0 1 0 1 -- 2.15.1 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit