1 /* Copyright © 2012 Red Hat.
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice (including the next
11 * paragraph) shall be included in all copies or substantial portions of the
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27 * Test additions to blending API from ARB_blend_func_extended
29 #include "piglit-util-gl.h"
31 PIGLIT_GL_TEST_CONFIG_BEGIN
33 #ifdef PIGLIT_USE_OPENGL
34 config
.supports_gl_compat_version
= 10;
35 #else // PIGLIT_USE_OPENGL_ES2
36 config
.supports_gl_es_version
= 20;
38 config
.window_visual
= PIGLIT_GL_VISUAL_RGB
| PIGLIT_GL_VISUAL_DOUBLE
;
39 config
.khr_no_error_support
= PIGLIT_NO_ERRORS
;
41 PIGLIT_GL_TEST_CONFIG_END
49 void piglit_init(int argc
, char **argv
)
51 GLint max_dual_source
;
53 #ifdef PIGLIT_USE_OPENGL
54 piglit_require_gl_version(30);
55 piglit_require_extension("GL_ARB_blend_func_extended");
56 #else // PIGLIT_USE_OPENGL_ES2
57 piglit_require_extension("GL_EXT_blend_func_extended");
60 /* This test needs some number of draw buffers, so make sure the
61 * implementation isn't broken. This enables the test to generate a
62 * useful failure message.
64 glGetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS
, &max_dual_source
);
65 if (max_dual_source
< 1) {
67 "ARB_blend_func_extended requires GL_MAX_DUAL_SOURCE_DRAW_BUFFERS >= 1. "
70 piglit_report_result(PIGLIT_FAIL
);
73 printf("Querying blend mode (SRC1_COLOR, 0).\n");
74 /* try all new blending modes */
75 glBlendFunc(GL_SRC1_COLOR
, GL_ZERO
);
76 if (!piglit_check_gl_error(GL_NO_ERROR
))
77 piglit_report_result(PIGLIT_FAIL
);
79 printf("Querying blend mode (SRC1_ALPHA, 0)\n");
80 glBlendFunc(GL_SRC1_ALPHA
, GL_ZERO
);
81 if (!piglit_check_gl_error(GL_NO_ERROR
))
82 piglit_report_result(PIGLIT_FAIL
);
84 printf("Querying blend mode (1-SRC1_COLOR, 0)\n");
85 glBlendFunc(GL_ONE_MINUS_SRC1_COLOR
, GL_ZERO
);
86 if (!piglit_check_gl_error(GL_NO_ERROR
))
87 piglit_report_result(PIGLIT_FAIL
);
89 printf("Querying blend mode (1-SRC1_ALPHA, 0)\n");
90 glBlendFunc(GL_ONE_MINUS_SRC1_ALPHA
, GL_ZERO
);
91 if (!piglit_check_gl_error(GL_NO_ERROR
))
92 piglit_report_result(PIGLIT_FAIL
);
94 printf("Querying blend mode (0, SRC1_COLOR)\n");
95 glBlendFunc(GL_ZERO
, GL_SRC1_COLOR
);
96 if (!piglit_check_gl_error(GL_NO_ERROR
))
97 piglit_report_result(PIGLIT_FAIL
);
99 printf("Querying blend mode (0, SRC1_ALPHA)\n");
100 glBlendFunc(GL_ZERO
, GL_SRC1_ALPHA
);
101 if (!piglit_check_gl_error(GL_NO_ERROR
))
102 piglit_report_result(PIGLIT_FAIL
);
104 printf("Querying blend mode (0, 1-SRC1_COLOR)\n");
105 glBlendFunc(GL_ZERO
, GL_ONE_MINUS_SRC1_COLOR
);
106 if (!piglit_check_gl_error(GL_NO_ERROR
))
107 piglit_report_result(PIGLIT_FAIL
);
109 printf("Querying blend mode (0, 1-SRC1_ALPHA)\n");
110 glBlendFunc(GL_ZERO
, GL_ONE_MINUS_SRC1_ALPHA
);
111 if (!piglit_check_gl_error(GL_NO_ERROR
))
112 piglit_report_result(PIGLIT_FAIL
);
114 /* GL_SRC_ALPHA_SATURATE is now handled as a DST attrib */
115 printf("Querying blend mode (0, SRC_ALPHA_SATURATE)\n");
116 glBlendFunc(GL_ZERO
, GL_SRC_ALPHA_SATURATE
);
117 if (!piglit_check_gl_error(GL_NO_ERROR
))
118 piglit_report_result(PIGLIT_FAIL
);
120 piglit_report_result(PIGLIT_PASS
);