glsl: test loop unroll with uint overflow
[piglit.git] / tests / spec / ext_framebuffer_multisample / blit-mismatched-sizes.cpp
blob76f0224382cb32a9e0f757d759d4b0bc66ad8f4c
1 /*
2 * Copyright © 2012 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 /**
25 * @file blit-mismatched-sizes.cpp
27 * This test verifies if glBlitFramebuffer() throws GL_INVALID_OPERATION with
28 * non-matching rectangle sizes for multisample framebuffer objects.
30 * We initialize two FBOs with minimum supported sample count, do blitting
31 * operation between non-matching rectangle sizes and then query the gl error.
33 * Author: Anuj Phogat <anuj.phogat@gmail.com>
36 #include "piglit-test-pattern.h"
37 #include "piglit-fbo.h"
38 using namespace piglit_util_fbo;
39 using namespace piglit_util_test_pattern;
41 PIGLIT_GL_TEST_CONFIG_BEGIN
43 config.supports_gl_compat_version = 10;
45 config.window_width = 256;
46 config.window_height = 256;
47 config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
48 config.khr_no_error_support = PIGLIT_HAS_ERRORS;
50 PIGLIT_GL_TEST_CONFIG_END
52 const int pattern_width = 256; const int pattern_height = 256;
53 Fbo src_fbo, dst_fbo;
55 enum piglit_result
56 piglit_display()
58 bool pass = true;
60 /* Blit multisample-to-multisample with non-matching rectangle sizes */
61 glBindFramebuffer(GL_READ_FRAMEBUFFER, src_fbo.handle);
62 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fbo.handle);
63 glBlitFramebuffer(0, 0, pattern_width, pattern_height,
64 0, 0, pattern_width / 2, pattern_height,
65 GL_COLOR_BUFFER_BIT, GL_NEAREST);
67 /* Scaling blits are not allowed for multisample frambuffers. Here
68 * GL_INVALID_OPERATION is an expected gl error
70 pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
72 return (pass ? PIGLIT_PASS : PIGLIT_FAIL);
75 void
76 piglit_init(int argc, char **argv)
78 piglit_require_gl_version(21);
79 piglit_require_extension("GL_ARB_framebuffer_object");
80 piglit_require_extension("GL_ARB_vertex_array_object");
82 /* Passing sample count = 1 will create the FBOs with minimum supported
83 * sample count.
85 src_fbo.setup(FboConfig(1 /* sample count */,
86 pattern_width,
87 pattern_height));
89 dst_fbo.setup(FboConfig(1 /* sample count */,
90 pattern_width,
91 pattern_height));
93 if (!piglit_check_gl_error(GL_NO_ERROR)) {
94 printf("Error setting up frame buffer objects\n");
95 piglit_report_result(PIGLIT_FAIL);