ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / ext_framebuffer_multisample / negative-max-samples.c
blob280cc61b137ad4954d4b86d2a2aae4dc534d43f0
1 /*
2 * Copyright © 2011 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 #include "piglit-util-gl.h"
26 /**
27 * @file negative-max-samples.c
29 * Tests that asking for more that GL_MAX_SAMPLES fails.
31 * From the EXT_framebuffer_multisample spec:
33 * "If either <width> or <height> is greater than
34 * MAX_RENDERBUFFER_SIZE_EXT, or if <samples> is greater than
35 * MAX_SAMPLES_EXT, then the error INVALID_VALUE is generated."
37 * Skips if ARB_texture_multisample or ARB_internalformat_query are
38 * supported. ARB_texture_multisample changes the error which should
39 * be generated; ARB_internalformat_query allows the limit for particular
40 * internalformats to be >MAX_SAMPLES.
43 PIGLIT_GL_TEST_CONFIG_BEGIN
45 config.supports_gl_compat_version = 10;
47 config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
48 config.khr_no_error_support = PIGLIT_HAS_ERRORS;
50 PIGLIT_GL_TEST_CONFIG_END
52 enum piglit_result
53 piglit_display(void)
55 /* UNREACHED */
56 return PIGLIT_FAIL;
59 void
60 piglit_init(int argc, char **argv)
62 GLint max_samples;
63 GLuint rb;
65 piglit_require_extension("GL_EXT_framebuffer_multisample");
67 if (piglit_is_extension_supported("GL_ARB_internalformat_query")) {
68 printf("ARB_internalformat_query is supported and "
69 "redefines this behavior; skipping\n");
70 piglit_report_result(PIGLIT_SKIP);
72 if (piglit_is_extension_supported("GL_ARB_texture_multisample")) {
73 printf("ARB_texture_multisample is supposed and "
74 "redefines this behavior; skipping\n");
75 piglit_report_result(PIGLIT_SKIP);
78 glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
80 glGenRenderbuffersEXT(1, &rb);
81 glBindRenderbufferEXT(GL_RENDERBUFFER, rb);
83 glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER,
84 max_samples + 1,
85 GL_RGBA,
86 1, 1);
87 if (!piglit_check_gl_error(GL_INVALID_VALUE))
88 piglit_report_result(PIGLIT_FAIL);
90 glDeleteRenderbuffersEXT(1, &rb);
92 piglit_report_result(PIGLIT_PASS);