"matrix column check" tests 1 and 2 were not ported in this commit since they got superceded by glsl-1.10-built-in-matrix-state. --- tests/all.py | 1 + tests/spec/glsl-1.10/execution/CMakeLists.gl.txt | 1 + .../matrix-vector-multiply-lhs.shader_test | 21 ++++++ .../matrix-vector-multiply-rhs.shader_test | 21 ++++++ .../matrix-vector-multiply-scale.shader_test | 16 +++++ .../execution/uniform-matrix-transposed.c | 74 ++++++++++++++++++++++ .../glsl-1.10/execution/uniform-matrix.shader_test | 15 +++++ 7 files changed, 149 insertions(+) create mode 100644 tests/spec/glsl-1.10/execution/matrix-vector-multiply-lhs.shader_test create mode 100644 tests/spec/glsl-1.10/execution/matrix-vector-multiply-rhs.shader_test create mode 100644 tests/spec/glsl-1.10/execution/matrix-vector-multiply-scale.shader_test create mode 100644 tests/spec/glsl-1.10/execution/uniform-matrix-transposed.c create mode 100644 tests/spec/glsl-1.10/execution/uniform-matrix.shader_test
diff --git a/tests/all.py b/tests/all.py index e0f327e..db7619c 100644 --- a/tests/all.py +++ b/tests/all.py @@ -1423,6 +1423,7 @@ with profile.test_list.group_manager( g(['glsl-1.10-built-in-uniform-state']) g(['glsl-1.10-fragdepth']) g(['glsl-1.10-linear-fog']) + g(['glsl-1.10-uniform-matrix-transposed']) with profile.test_list.group_manager( PiglitGLTest, diff --git a/tests/spec/glsl-1.10/execution/CMakeLists.gl.txt b/tests/spec/glsl-1.10/execution/CMakeLists.gl.txt index 18c98f9..fcf7437 100644 --- a/tests/spec/glsl-1.10/execution/CMakeLists.gl.txt +++ b/tests/spec/glsl-1.10/execution/CMakeLists.gl.txt @@ -15,3 +15,4 @@ piglit_add_executable (glsl-1.10-built-in-matrix-state built-in-matrix-state.c) piglit_add_executable (glsl-1.10-built-in-uniform-state built-in-uniform-state.c) piglit_add_executable (glsl-1.10-fragdepth fragdepth.c) piglit_add_executable (glsl-1.10-linear-fog linear-fog.c) +piglit_add_executable (glsl-1.10-uniform-matrix-transposed uniform-matrix-transposed.c) diff --git a/tests/spec/glsl-1.10/execution/matrix-vector-multiply-lhs.shader_test b/tests/spec/glsl-1.10/execution/matrix-vector-multiply-lhs.shader_test new file mode 100644 index 0000000..45bcbc9 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/matrix-vector-multiply-lhs.shader_test @@ -0,0 +1,21 @@ +[require] +GLSL >= 1.10 + +[fragment shader] +void main() +{ + mat4 m = mat4( + 1.0, 0.5, 0.6, 0.0, // col 0 + 0.0, 1.0, 0.0, 0.7, // col 1 + 0.0, 0.0, 1.0, 0.8, // col 2 + 0.1, 0.2, 0.3, 1.0 // col 3 + ); + vec4 color = gl_Color * m; + gl_FragColor = color; +} + + +[test] +color 0.25 0.75 0.5 0.25 +draw rect -1 -1 2 2 +relative probe rgba (0.5, 0.5) (0.925, 0.925, 0.6999, 0.575) diff --git a/tests/spec/glsl-1.10/execution/matrix-vector-multiply-rhs.shader_test b/tests/spec/glsl-1.10/execution/matrix-vector-multiply-rhs.shader_test new file mode 100644 index 0000000..ab75cb7 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/matrix-vector-multiply-rhs.shader_test @@ -0,0 +1,21 @@ +[require] +GLSL >= 1.10 + +[fragment shader] +void main() +{ + mat4 m = mat4( + 1.0, 0.5, 0.6, 0.0, // col 0 + 0.0, 1.0, 0.0, 0.7, // col 1 + 0.0, 0.0, 1.0, 0.8, // col 2 + 0.1, 0.2, 0.3, 1.0 // col 3 + ); + vec4 color = m * gl_Color; + gl_FragColor = color; +} + + +[test] +color 0.25 0.75 0.5 0.25 +draw rect -1 -1 2 2 +relative probe rgba (0.5, 0.5) (0.2745, 0.9255, 0.7294, 1.0) diff --git a/tests/spec/glsl-1.10/execution/matrix-vector-multiply-scale.shader_test b/tests/spec/glsl-1.10/execution/matrix-vector-multiply-scale.shader_test new file mode 100644 index 0000000..0dc3e69 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/matrix-vector-multiply-scale.shader_test @@ -0,0 +1,16 @@ +[require] +GLSL >= 1.10 + +[fragment shader] +void main() +{ + mat4 m = mat4(0.5); // scale by 0.5 + vec4 color = gl_Color * m; + gl_FragColor = color; +} + + +[test] +color 0.25 0.75 0.5 0.25 +draw rect -1 -1 2 2 +relative probe rgba (0.5, 0.5) (0.125, 0.375, 0.25, 0.125) diff --git a/tests/spec/glsl-1.10/execution/uniform-matrix-transposed.c b/tests/spec/glsl-1.10/execution/uniform-matrix-transposed.c new file mode 100644 index 0000000..bc4e45c --- /dev/null +++ b/tests/spec/glsl-1.10/execution/uniform-matrix-transposed.c @@ -0,0 +1,74 @@ +/* + * Copyright © 2017 Fabian Bieler + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** + * @file uniform-matrix-transposed.c: Test transposed matrix loading + */ + +#include "piglit-util-gl.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 20; + config.window_visual = (PIGLIT_GL_VISUAL_RGBA); + config.khr_no_error_support = PIGLIT_NO_ERRORS; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *fs_text = + "uniform mat4 uniformMat4t;\n" + "void main()\n" + "{\n" + " gl_FragColor = uniformMat4t[2];\n" + "}\n"; + +enum piglit_result +piglit_display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + piglit_draw_rect(-1, -1, 2, 2); + + const float expected_color[] = {0.2, 0.0, 1.0, 0.8}; + const bool pass = piglit_probe_pixel_rgba(piglit_width / 2, + piglit_height / 2, + expected_color); + + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + const int program = piglit_build_simple_program(NULL, fs_text); + glUseProgram(program); + + static const float uniformMatrix[16] = { + 1.0, 0.1, 0.2, 0.3, + 0.0, 1.0, 0.0, 0.4, + 0.0, 1.0, 1.0, 0.5, + 0.6, 0.7, 0.8, 1.0 + }; + const int umat4t = glGetUniformLocation(program, "uniformMat4t"); + glUniformMatrix4fv(umat4t, 1, GL_TRUE, uniformMatrix); +} diff --git a/tests/spec/glsl-1.10/execution/uniform-matrix.shader_test b/tests/spec/glsl-1.10/execution/uniform-matrix.shader_test new file mode 100644 index 0000000..c1ee91f --- /dev/null +++ b/tests/spec/glsl-1.10/execution/uniform-matrix.shader_test @@ -0,0 +1,15 @@ +[require] +GLSL >= 1.10 + +[fragment shader] +uniform mat4 uniformMat4; +void main() +{ + gl_FragColor = uniformMat4[3]; +} + + +[test] +uniform mat4 uniformMat4 1.0 0.1 0.2 0.3 0.0 1.0 0.0 0.4 0.0 1.0 1.0 0.5 0.6 0.7 0.8 1.0 +draw rect -1 -1 2 2 +relative probe rgba (0.5, 0.5) (0.6, 0.7, 0.8, 1.0) -- 2.7.4 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit