1. It doesn't use sampler2DRect, so don't require ARB_texture_rectangle 2. Remove pointless glFinish() before piglit_present_results() 3. Use Piglit utility functions for compiling/linking shaders. 4. Print the description of what you're seeing in *non*-automatic mode.
Signed-off-by: Kenneth Graunke <[email protected]> --- tests/texturing/depth-tex-modes-glsl.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) I was originally considering extending this test to do EXT_texture_swizzle rather than writing a new one. So I started by cleaning it up a bit. In the end I decided to write a new test anyway (already reviewed on the list), but figured the cleanups are worthwhile anyway. diff --git a/tests/texturing/depth-tex-modes-glsl.c b/tests/texturing/depth-tex-modes-glsl.c index b1ecc89..24ef989 100644 --- a/tests/texturing/depth-tex-modes-glsl.c +++ b/tests/texturing/depth-tex-modes-glsl.c @@ -84,14 +84,13 @@ piglit_init(int argc, char **argv) { piglit_require_gl_version(20); - if (piglit_automatic) + if (!piglit_automatic) printf(" Left to Right: LUMINANCE, INTENSITY, ALPHA\n" "Lower row: Combined with color\n" "Upper row: combined with alpha\n"); loadTex(); - piglit_require_extension("GL_ARB_texture_rectangle"); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); @@ -110,30 +109,11 @@ piglit_init(int argc, char **argv) static void compileLinkProg(void) { - GLint stat; - - vs = glCreateShader(GL_VERTEX_SHADER); - fs = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(vs, 1, (const GLchar **) &vertShaderText, NULL); - glShaderSource(fs, 1, (const GLchar **) &fragShaderText, NULL); - glCompileShader(vs); - glGetShaderiv(vs, GL_COMPILE_STATUS, &stat); - if (!stat) { - printf("error compiling vertex shader!\n"); - exit(1); - } - glCompileShader(fs); - glGetShaderiv(fs, GL_COMPILE_STATUS, &stat); - if (!stat) { - printf("error compiling fragment shader!\n"); - exit(1); - } + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vertShaderText); + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fragShaderText); - prog = glCreateProgram(); - glAttachShader(prog, vs); - glAttachShader(prog, fs); + prog = piglit_link_simple_program(vs, fs); glBindAttribLocation(prog, 1, "textureCoords"); - glLinkProgram(prog); glUseProgram(prog); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3*sizeof(GLfloat), @@ -304,7 +284,6 @@ piglit_display(void) } - glFinish(); piglit_present_results(); return pass ? PIGLIT_PASS : PIGLIT_FAIL; -- 1.7.11.4 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
