ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / arb_separate_shader_objects / rendezvous_by_location-invalid.c
blob7fd7af86d9d37bbd2358cf8b488f4d748220c29e
1 /*
2 * Copyright © 2013, 2019 Intel Corporation
3 * Copyright © 2015 Advanced Micro Devices, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
25 /**
26 * This test uses separable program objects with 2 shaders (VS, GS)
27 * and tests that the same interface matching rules by location apply
28 * in between the VS -> GS interface as if it would not be separable.
31 #include "piglit-util-gl.h"
33 PIGLIT_GL_TEST_CONFIG_BEGIN
35 config.supports_gl_compat_version = 0;
36 config.supports_gl_core_version = 32;
37 config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
39 PIGLIT_GL_TEST_CONFIG_END
41 static const char *vs_code =
42 "#version 150\n"
43 "#extension GL_ARB_separate_shader_objects: require\n"
44 "#extension GL_ARB_explicit_attrib_location: require\n"
45 "\n"
46 "layout(location = 0) in vec4 piglit_vertex;\n"
47 "\n"
48 "layout(location = 2) out vec3 a;\n"
49 "\n"
50 "void main()\n"
51 "{\n"
52 " gl_Position = piglit_vertex;\n"
53 " a = vec3(0.5, 0, 0.3);\n"
54 "}\n"
57 static const char *gs_code =
58 "#version 150\n"
59 "#extension GL_ARB_separate_shader_objects: require\n"
60 "#extension GL_ARB_explicit_attrib_location: require\n"
61 "\n"
62 "layout(triangles) in;\n"
63 "layout(triangle_strip, max_vertices = 3) out;\n"
64 "\n"
65 "layout(location = 1) in vec3 va[];\n"
66 "\n"
67 "layout(location = 3) out vec3 ga;\n"
68 "\n"
69 "void main()\n"
70 "{\n"
71 " for (int i = 0; i < 3; i++) {"
72 " gl_Position = gl_in[i].gl_Position;\n"
73 " ga = va[i] * 1.35;\n"
74 " EmitVertex();\n"
75 " }\n"
76 "}\n"
79 enum piglit_result
80 piglit_display(void)
82 /* UNREACHED */
83 return PIGLIT_FAIL;
86 void piglit_init(int argc, char **argv)
88 GLuint prog;
89 bool pass;
91 piglit_require_extension("GL_ARB_separate_shader_objects");
92 piglit_require_extension("GL_ARB_explicit_attrib_location");
94 prog = piglit_build_simple_program_unlinked_multiple_shaders(
95 GL_VERTEX_SHADER, vs_code,
96 GL_GEOMETRY_SHADER, gs_code,
97 0);
99 glProgramParameteri(prog, GL_PROGRAM_SEPARABLE, GL_TRUE);
100 piglit_check_gl_error(GL_NO_ERROR);
102 glLinkProgram(prog);
103 pass = !piglit_link_check_status_quiet(prog);
105 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);