fbo-mrt-alphatest: Actually require MRTs to be available.
[piglit.git] / tests / spec / arb_es3_compatibility / es3-drawarrays-primrestart-fixedindex.c
blobe96767676c668f911966ec7d392d1a51107619b3
1 /*
2 * Copyright © 2014 Advanced Micro Devices, Inc.
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 /**
25 * Test if primitive restart is disabled for glDrawArrays while both
26 * PRIMITIVE_RESTART and PRIMITIVE_RESTART_FIXED_INDEX are enabled.
29 #include "piglit-util-gl.h"
31 PIGLIT_GL_TEST_CONFIG_BEGIN
32 config.supports_gl_compat_version = 33;
33 config.supports_gl_core_version = 33;
34 config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
35 PIGLIT_GL_TEST_CONFIG_END
37 static const GLchar *vstext =
38 "#version 330\n"
39 "attribute vec2 piglit_vertex;\n"
40 "attribute int piglit_texcoord;\n"
41 "out vec4 color;\n"
42 "void main()\n"
43 "{\n"
44 " gl_Position = vec4(piglit_vertex, 0.0, 1.0);\n"
45 " color = vec4(0.0, 1.0, 0.0, 1.0);\n"
46 "} \n";
48 static const char *fstext =
49 "#version 330\n"
50 "in vec4 color;\n"
51 "void main() {\n"
52 " gl_FragColor = color;\n"
53 "}\n";
55 static GLint prog;
57 enum piglit_result
58 piglit_display(void)
60 static const float green[] = {0, 1, 0, 1};
61 enum piglit_result result;
63 glClear(GL_COLOR_BUFFER_BIT);
64 glDrawArrays(GL_TRIANGLES, 0, 7);
66 result = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
67 green)
68 ? PIGLIT_PASS : PIGLIT_FAIL;
70 piglit_present_results();
71 return result;
74 void
75 piglit_init(int argc, char **argv)
77 static const float pos[] = {
78 -1, -1,
79 -1, 1,
80 1, -1,
81 1, 1,
82 1, -1,
83 -1, 1,
84 -1, 1 /* should be dropped */
86 GLuint vao, buf;
88 piglit_require_gl_version(33);
89 piglit_require_extension("GL_ARB_ES3_compatibility");
90 prog = piglit_build_simple_program(vstext, fstext);
91 glUseProgram(prog);
93 glGenVertexArrays(1, &vao);
94 glBindVertexArray(vao);
96 glGenBuffers(1, &buf);
97 glBindBuffer(GL_ARRAY_BUFFER, buf);
98 glBufferData(GL_ARRAY_BUFFER, sizeof(pos), pos, GL_STATIC_DRAW);
100 glEnableVertexAttribArray(PIGLIT_ATTRIB_POS);
101 glVertexAttribPointer(PIGLIT_ATTRIB_POS, 2, GL_FLOAT, 0, 0, NULL);
103 glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
104 glEnable(GL_PRIMITIVE_RESTART);
105 glPrimitiveRestartIndex(3);