ovr_multiview: add some basic glsl tests
[piglit.git] / tests / spec / arb_compute_shader / render-and-compute.c
blob13699218326bf33783b0919d483c2e698411ec83
1 /*
2 * Copyright (c) 2014 Intel Corporation
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
21 * DEALINGS IN THE SOFTWARE.
24 #include "cs-ids-common.h"
26 static struct piglit_gl_test_config *piglit_config;
28 PIGLIT_GL_TEST_CONFIG_BEGIN
29 piglit_config = &config;
30 config.supports_gl_compat_version = 33;
31 config.supports_gl_core_version = 33;
32 config.khr_no_error_support = PIGLIT_NO_ERRORS;
33 PIGLIT_GL_TEST_CONFIG_END
36 const char passthrough_vs_src[] =
37 "#version 330\n"
38 "\n"
39 "in vec4 piglit_vertex;\n"
40 "\n"
41 "void main() {\n"
42 " gl_Position = piglit_vertex;\n"
43 "}\n"
47 static const char *green_fs_src =
48 "#version 330\n"
49 "\n"
50 "void main()\n"
51 "{\n"
52 " gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
53 "}\n";
55 enum piglit_result
56 piglit_display(void)
58 return PIGLIT_FAIL;
62 void
63 piglit_init(int argc, char **argv)
65 enum piglit_result result;
66 GLuint render_program;
67 int i;
68 float green[4] = { 0.0, 1.0, 0.0, 1.0 };
70 cs_ids_common_init();
71 cs_ids_set_local_id_test();
72 cs_ids_set_local_size(4, 4, 4);
73 cs_ids_set_global_size(4, 4, 4);
75 render_program =
76 piglit_build_simple_program(passthrough_vs_src,
77 green_fs_src);
78 glClearColor(0.0, 0.0, 0.0, 0.0);
80 for (i = 0; i < 2; i++) {
81 result = cs_ids_run_test();
82 if (result != PIGLIT_PASS)
83 piglit_report_result(result);
85 glUseProgram(render_program);
86 glClear(GL_COLOR_BUFFER_BIT);
87 piglit_draw_rect(-1, -1, 2, 2);
88 result = piglit_probe_rect_rgba(0, 0, piglit_width,
89 piglit_height, green)
90 ? PIGLIT_PASS : PIGLIT_FAIL;
93 cs_ids_common_destroy();
95 piglit_report_result(result);