ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / arb_vertex_program / getlocal4-errors.c
blobb2fc3d9ca61b04414c04e1a2f8eb157bd288f619
1 /*
2 * Copyright © 2013 Intel Corporation
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 /** @file getlocal4-errors.c
26 * Tests that the specced errors are generated for
27 * glGetProgramLocalParameter*ARB().
29 * From the GL_ARB_vertex_program spec:
31 * "The error INVALID_ENUM is generated if <target> specifies a
32 * nonexistent program target or a program target that does not
33 * support program local parameters. The error INVALID_VALUE is
34 * generated if <index> is greater than or equal to the
35 * implementation-dependent number of supported program local
36 * parameters for the program target."
39 #include "piglit-util-gl.h"
41 PIGLIT_GL_TEST_CONFIG_BEGIN
43 config.supports_gl_compat_version = 10;
45 config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
47 PIGLIT_GL_TEST_CONFIG_END
49 void
50 piglit_init(int argc, char **argv)
52 const char *source =
53 "!!ARBvp1.0\n"
54 "OPTION ARB_position_invariant;\n"
55 "MOV result.color, program.local[3];\n"
56 "END\n";
57 GLuint prog;
58 GLint max_local;
59 float fvalues[4];
60 double dvalues[4];
62 piglit_require_extension("GL_ARB_vertex_program");
64 prog = piglit_compile_program(GL_VERTEX_PROGRAM_ARB, source);
65 glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog);
67 glGetProgramivARB(GL_VERTEX_PROGRAM_ARB,
68 GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, &max_local);
70 /* Check that an error is generated for going beyond max. */
71 glGetProgramLocalParameterfvARB(GL_VERTEX_PROGRAM_ARB, max_local,
72 fvalues);
73 piglit_check_gl_error(GL_INVALID_VALUE);
75 glGetProgramLocalParameterdvARB(GL_VERTEX_PROGRAM_ARB, max_local,
76 dvalues);
77 piglit_check_gl_error(GL_INVALID_VALUE);
79 /* Test bad program target */
80 glGetProgramLocalParameterfvARB(0xd0d0d0d0, max_local, fvalues);
81 piglit_check_gl_error(GL_INVALID_ENUM);
83 glGetProgramLocalParameterdvARB(0xd0d0d0d0, max_local, dvalues);
84 piglit_check_gl_error(GL_INVALID_ENUM);
86 piglit_report_result(PIGLIT_PASS);
89 enum piglit_result
90 piglit_display(void)
92 return PIGLIT_FAIL;