ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / ati_fragment_shader / error08-secondary.c
blob7e9d5c6fc4b0b7f8b70dbb68b0cd51b9e45cedbb
1 /*
2 * Copyright © 2017 Miklós Máté
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 DEALINGS
21 * IN THE SOFTWARE.
24 /** Paragraph 8 of the Errors section:
26 * The error INVALID_OPERATION is generated by ColorFragmentOp[1..3]ATI
27 * if <argN> is SECONDARY_INTERPOLATOR_ATI and <argNRep> is ALPHA, or
28 * by AlphaFragmentOp[1..3]ATI if <argN> is SECONDARY_INTERPOLATOR_ATI
29 * and <argNRep> is ALPHA or NONE, or by ColorFragmentOp2ATI if <op> is
30 * DOT4_ATI and <argN> is SECONDARY_INTERPOLATOR_ATI and <argNRep> is
31 * ALPHA or NONE.
34 #include "piglit-util-gl.h"
36 PIGLIT_GL_TEST_CONFIG_BEGIN
38 config.supports_gl_compat_version = 10;
39 config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
41 PIGLIT_GL_TEST_CONFIG_END
43 enum piglit_result
44 piglit_display(void)
46 /* UNREACHED */
47 return PIGLIT_FAIL;
50 void
51 piglit_init(int argc, char **argv)
53 bool pass = true;
55 piglit_require_extension("GL_ATI_fragment_shader");
57 /* In all shaders all instructions are invalid, so the shader should
58 * be empty, which is invalid
60 glBeginFragmentShaderATI();
61 pass &= piglit_check_gl_error(GL_NO_ERROR);
62 glColorFragmentOp1ATI(GL_MOV_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE,
63 GL_SECONDARY_INTERPOLATOR_ATI, GL_ALPHA, GL_NONE);
64 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
65 glEndFragmentShaderATI();
66 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
69 glBeginFragmentShaderATI();
70 pass &= piglit_check_gl_error(GL_NO_ERROR);
71 glAlphaFragmentOp1ATI(GL_MOV_ATI, GL_REG_0_ATI, GL_NONE,
72 GL_SECONDARY_INTERPOLATOR_ATI, GL_ALPHA, GL_NONE);
73 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
74 glEndFragmentShaderATI();
75 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
77 glBeginFragmentShaderATI();
78 pass &= piglit_check_gl_error(GL_NO_ERROR);
79 glAlphaFragmentOp1ATI(GL_MOV_ATI, GL_REG_0_ATI, GL_NONE,
80 GL_SECONDARY_INTERPOLATOR_ATI, GL_NONE, GL_NONE);
81 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
82 glEndFragmentShaderATI();
83 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
85 /* DOT4 */
87 glBeginFragmentShaderATI();
88 pass &= piglit_check_gl_error(GL_NO_ERROR);
89 glColorFragmentOp2ATI(GL_DOT4_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE,
90 GL_SECONDARY_INTERPOLATOR_ATI, GL_ALPHA, GL_NONE,
91 GL_REG_0_ATI, GL_NONE, GL_NONE);
92 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
93 glEndFragmentShaderATI();
94 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
96 glBeginFragmentShaderATI();
97 pass &= piglit_check_gl_error(GL_NO_ERROR);
98 glColorFragmentOp2ATI(GL_DOT4_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE,
99 GL_SECONDARY_INTERPOLATOR_ATI, GL_NONE, GL_NONE,
100 GL_REG_0_ATI, GL_NONE, GL_NONE);
101 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
102 glEndFragmentShaderATI();
103 pass &= piglit_check_gl_error(GL_INVALID_OPERATION);
105 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);