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
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
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
50 piglit_init(int argc
, char **argv
)
54 "OPTION ARB_position_invariant;\n"
55 "MOV result.color, program.local[3];\n"
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
,
73 piglit_check_gl_error(GL_INVALID_VALUE
);
75 glGetProgramLocalParameterdvARB(GL_VERTEX_PROGRAM_ARB
, max_local
,
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
);