ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / gles-2.0 / multiple-shader-objects.c
blobdd5116ea41f9e1e413a1befbb88337147aad7aa4
1 /* Copyright © 2013 Intel Corporation
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice (including the next
11 * paragraph) shall be included in all copies or substantial portions of the
12 * Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 * IN THE SOFTWARE.
23 /**
24 * \file
26 * From the OpenGL ES 2.0 spec, Section 2.10.3 Program Objects:
28 * Multiple shader objects of the same type may not be attached to
29 * a single program object. [...] The error INVALID_OPERATION is
30 * generated if [...] another shader object of the same type as shader is
31 * already attached to program.
33 * This test checks that GL_INVALID_OPERATION is generated.
36 #include "piglit-util-gl.h"
38 PIGLIT_GL_TEST_CONFIG_BEGIN
40 config.supports_gl_es_version = 20;
42 PIGLIT_GL_TEST_CONFIG_END
44 enum piglit_result
45 piglit_display(void)
47 return PIGLIT_FAIL;
50 void
51 piglit_init(int argc, char **argv)
53 bool pass = true;
55 GLuint vs1 = glCreateShader(GL_VERTEX_SHADER);
56 GLuint vs2 = glCreateShader(GL_VERTEX_SHADER);
58 GLuint fs1 = glCreateShader(GL_FRAGMENT_SHADER);
59 GLuint fs2 = glCreateShader(GL_FRAGMENT_SHADER);
61 GLuint prog1 = glCreateProgram();
62 GLuint prog2 = glCreateProgram();
64 if (!piglit_check_gl_error(GL_NO_ERROR))
65 piglit_report_result(PIGLIT_FAIL);
67 /* It's illegal to attach two vertex shaders. */
68 glAttachShader(prog1, vs1);
69 pass &= piglit_check_gl_error(GL_NO_ERROR);
71 glAttachShader(prog1, vs2);
72 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
74 /* It's illegal to attach two fragment shaders. */
75 glAttachShader(prog2, fs1);
76 pass &= piglit_check_gl_error(GL_NO_ERROR);
78 glAttachShader(prog2, fs2);
79 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
81 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);