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
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.
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
=
39 "attribute vec2 piglit_vertex;\n"
40 "attribute int piglit_texcoord;\n"
44 " gl_Position = vec4(piglit_vertex, 0.0, 1.0);\n"
45 " color = vec4(0.0, 1.0, 0.0, 1.0);\n"
48 static const char *fstext
=
52 " gl_FragColor = color;\n"
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
,
68 ? PIGLIT_PASS
: PIGLIT_FAIL
;
70 piglit_present_results();
75 piglit_init(int argc
, char **argv
)
77 static const float pos
[] = {
84 -1, 1 /* should be dropped */
88 piglit_require_gl_version(33);
89 piglit_require_extension("GL_ARB_ES3_compatibility");
90 prog
= piglit_build_simple_program(vstext
, fstext
);
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);