perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.10 / execution / uniform-matrix-transposed.c
blob42cdd6250e3907f752071ac05b1ce10012289488
1 /*
2 * Copyright © 2017 Fabian Bieler
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
24 /**
25 * @file uniform-matrix-transposed.c: Test transposed matrix loading
28 #include "piglit-util-gl.h"
30 PIGLIT_GL_TEST_CONFIG_BEGIN
32 config.supports_gl_compat_version = 20;
33 config.window_visual = PIGLIT_GL_VISUAL_RGBA;
34 config.khr_no_error_support = PIGLIT_NO_ERRORS;
36 PIGLIT_GL_TEST_CONFIG_END
38 static const char *fs_text =
39 "uniform mat4 uniformMat4t;\n"
40 "void main()\n"
41 "{\n"
42 " gl_FragColor = uniformMat4t[2];\n"
43 "}\n";
45 enum piglit_result
46 piglit_display(void)
48 glClear(GL_COLOR_BUFFER_BIT);
50 piglit_draw_rect(-1, -1, 2, 2);
52 const float expected_color[] = {0.2, 0.0, 1.0, 0.8};
53 const bool pass = piglit_probe_pixel_rgba(piglit_width / 2,
54 piglit_height / 2,
55 expected_color);
57 return pass ? PIGLIT_PASS : PIGLIT_FAIL;
60 void
61 piglit_init(int argc, char **argv)
63 const int program = piglit_build_simple_program(NULL, fs_text);
64 glUseProgram(program);
66 static const float uniformMatrix[16] = {
67 1.0, 0.1, 0.2, 0.3,
68 0.0, 1.0, 0.0, 0.4,
69 0.0, 1.0, 1.0, 0.5,
70 0.6, 0.7, 0.8, 1.0
72 const int umat4t = glGetUniformLocation(program, "uniformMat4t");
73 glUniformMatrix4fv(umat4t, 1, GL_TRUE, uniformMatrix);