2 * Copyright (c) The Piglit project 2007
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 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the 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 NON-INFRINGEMENT. IN NO EVENT SHALL
18 * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * According to the ARB_fragment_program spec, section 3.11.6,
26 * sampling an incomplete texture image yields (0,0,0,1).
29 #include "piglit-util-gl.h"
31 PIGLIT_GL_TEST_CONFIG_BEGIN
33 config
.supports_gl_compat_version
= 10;
35 config
.window_visual
= PIGLIT_GL_VISUAL_RGBA
| PIGLIT_GL_VISUAL_DOUBLE
| PIGLIT_GL_VISUAL_DEPTH
;
37 PIGLIT_GL_TEST_CONFIG_END
39 #define NUM_PROGRAMS 5
41 static GLuint FragProg
[NUM_PROGRAMS
];
43 static const char* const ProgramText
[NUM_PROGRAMS
] = {
45 "TEX result.color, fragment.color, texture[0], 2D;\n"
49 "TEX result.color, fragment.color, texture[0], 3D;\n"
53 "TEX result.color, fragment.color, texture[0], 1D;\n"
57 "TEX result.color, fragment.color, texture[0], CUBE;\n"
61 "TEX result.color, fragment.color, texture[0], RECT;\n"
65 static void DoFrame(void)
69 glClearColor(0.3, 0.3, 0.3, 0.3);
70 glClear(GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
72 glEnable(GL_FRAGMENT_PROGRAM_ARB
);
74 for(i
= 0; i
< NUM_PROGRAMS
; ++i
) {
75 glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB
, FragProg
[i
]);
78 glTranslatef(i
/2, i
%2, 0);
134 static bool DoTest( void )
139 while(Probes
[idx
].name
) {
140 pass
= piglit_probe_pixel_rgba(
141 (int)(Probes
[idx
].x
* piglit_width
/ 3),
142 (int)(Probes
[idx
].y
* piglit_height
/ 2),
143 Probes
[idx
].expected
) && pass
;
158 piglit_present_results();
160 return pass
? PIGLIT_PASS
: PIGLIT_FAIL
;
164 piglit_init(int argc
, char **argv
)
168 printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER
));
170 piglit_require_fragment_program();
172 for(i
= 0; i
< NUM_PROGRAMS
; ++i
)
173 FragProg
[i
] = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB
, ProgramText
[i
]);
175 piglit_gen_ortho_projection(0.0, 3.0, 0.0, 2.0, -2.0, 6.0, GL_FALSE
);