Commit 83c8ef80 authored by Paul Berry's avatar Paul Berry
Browse files

Modify piglit_check_gl_error() to return a boolean.



Previously piglit_check_gl_error() would terminate the test if an
error occurred.  However, there are many cases when we would prefer to
simply report the error, and continue testing.

Where it was convenient, I've replaced calls of the form

piglit_check_gl_error(..., PIGLIT_FAIL);

with

pass = piglit_check_gl_error(...) && pass;

So that the test can continue executing.

In other cases, I replaced it with

if (!piglit_check_gl_error(...))
        piglit_report_result(PIGLIT_FAIL);

Which is equivalent to the old functionality.
Reviewed-by: default avatarIan Romanick <ian.d.romanick@intel.com>
parent ee2d32a3
......@@ -85,11 +85,11 @@ piglit_init(int argc, char **argv)
pass = test(2.2, 2) && pass;
pass = test(2.8, 3) && pass;
pass = test(-0.1, 0) && pass;
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
printf("Setting row length -0.9, and expecting error\n");
glPixelStoref(GL_UNPACK_ROW_LENGTH, -0.9);
piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
......
......@@ -95,7 +95,8 @@ hiz_make_fbo(const struct hiz_fbo_options *options)
GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER,
color_rb);
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
}
/* Bind depth attachment. */
......@@ -109,7 +110,8 @@ hiz_make_fbo(const struct hiz_fbo_options *options)
GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER,
depth_rb);
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
}
/* Bind stencil attachment. */
......@@ -123,7 +125,8 @@ hiz_make_fbo(const struct hiz_fbo_options *options)
GL_STENCIL_ATTACHMENT,
GL_RENDERBUFFER,
stencil_rb);
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
}
/* Bind depth/stencil attachment. */
......@@ -137,7 +140,8 @@ hiz_make_fbo(const struct hiz_fbo_options *options)
GL_DEPTH_STENCIL_ATTACHMENT,
GL_RENDERBUFFER,
depth_stencil_rb);
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
}
fb_status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
......@@ -177,7 +181,8 @@ hiz_delete_fbo(GLuint fbo)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
}
/* ------------------------------------------------------------------------ */
......@@ -436,7 +441,8 @@ hiz_run_test_stencil_test_common()
piglit_draw_rect(1 * dx, 1 * dy, /* x, y */
2 * dx, 2 * dy); /* w, h */
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
return false;
return hiz_probe_color_buffer(expected_colors);
}
......@@ -548,7 +554,8 @@ hiz_run_test_stencil_read_common()
piglit_draw_rect(1 * dx, 1 * dy, /* x, y */
2 * dx, 2 * dy); /* w, h */
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
return false;
if (!hiz_probe_color_buffer(expected_colors))
return false;
......@@ -691,9 +698,9 @@ hiz_run_test_depth_stencil_test_fbo(const struct hiz_fbo_options *fbo_options)
piglit_draw_rect(1 * dx, 1 * dy, /* x, y */
2 * dx, 2 * dy); /* w, h */
piglit_check_gl_error(0, PIGLIT_FAIL);
pass = piglit_check_gl_error(0);
pass = hiz_probe_color_buffer(expected_colors);
pass = hiz_probe_color_buffer(expected_colors) && pass;
if (!piglit_automatic) {
/* Blit the FBO to the window FB so we can see the results. */
......
......@@ -58,7 +58,8 @@ void piglit_init(int argc, char **argv)
* without a shader at all. Only a program object is necessary.
*/
prog = glCreateProgram();
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
/* Page 236 (page 252 of the PDF) of the OpenGL 3.0 spec says:
*
......@@ -70,11 +71,13 @@ void piglit_init(int argc, char **argv)
*/
printf("Trying location = -1...\n");
glBindFragDataLocationIndexed(prog, -1, 0, "foo");
piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
printf("Trying location = GL_MAX_DRAW_BUFFERS...\n");
glBindFragDataLocationIndexed(prog, max_draw_buffers, 0, "foo");
piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
/* ARB_blend_func_extended says,
......@@ -85,11 +88,13 @@ void piglit_init(int argc, char **argv)
*/
printf("Trying index > 1...\n");
glBindFragDataLocationIndexed(prog, 0, 2, "foo");
piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
printf("Trying location = GL_MAX_DUAL_SOURCE_DRAW_BUFFERS with index 1...\n");
glBindFragDataLocationIndexed(prog, max_dual_source, 1, "foo");
piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
/* Page 236 (page 252 of the PDF) of the OpenGL 3.0 spec says:
*
......@@ -107,15 +112,18 @@ void piglit_init(int argc, char **argv)
*/
printf("Trying name = `gl_FragColor'...\n");
glBindFragDataLocationIndexed(prog, 0, 0, "gl_FragColor");
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
printf("Trying name = `gl_FragDepth'...\n");
glBindFragDataLocationIndexed(prog, 0, 0, "gl_FragDepth");
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
printf("Trying name = `gl_'...\n");
glBindFragDataLocationIndexed(prog, 0, 0, "gl_");
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
piglit_report_result(PIGLIT_PASS);
}
......@@ -60,40 +60,49 @@ void piglit_init(int argc, char **argv)
printf("Querying blend mode (SRC1_COLOR, 0).\n");
/* try all new blending modes */
glBlendFunc(GL_SRC1_COLOR, GL_ZERO);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
printf("Querying blend mode (SRC1_ALPHA, 0)\n");
glBlendFunc(GL_SRC1_ALPHA, GL_ZERO);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
printf("Querying blend mode (1-SRC1_COLOR, 0)\n");
glBlendFunc(GL_ONE_MINUS_SRC1_COLOR, GL_ZERO);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
printf("Querying blend mode (1-SRC1_ALPHA, 0)\n");
glBlendFunc(GL_ONE_MINUS_SRC1_ALPHA, GL_ZERO);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
printf("Querying blend mode (0, SRC1_COLOR)\n");
glBlendFunc(GL_ZERO, GL_SRC1_COLOR);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
printf("Querying blend mode (0, SRC1_ALPHA)\n");
glBlendFunc(GL_ZERO, GL_SRC1_ALPHA);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
printf("Querying blend mode (0, 1-SRC1_COLOR)\n");
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC1_COLOR);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
printf("Querying blend mode (0, 1-SRC1_ALPHA)\n");
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC1_ALPHA);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
/* GL_SRC_ALPHA_SATURATE is now handled as a DST attrib */
printf("Querying blend mode (0, SRC_ALPHA_SATURATE)\n");
glBlendFunc(GL_ZERO, GL_SRC_ALPHA_SATURATE);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
piglit_report_result(PIGLIT_PASS);
}
......@@ -91,7 +91,8 @@ void piglit_init(int argc, char **argv)
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text);
glAttachShader(prog, vs);
glAttachShader(prog, fs);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
/* Page 237 (page 253 of the PDF) of the OpenGL 3.0 spec says:
*
......@@ -101,7 +102,8 @@ void piglit_init(int argc, char **argv)
*/
printf("Querying index before linking...\n");
idx = glGetFragDataIndex(prog, "v");
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
if (idx != -1) {
fprintf(stderr, "Expected index = -1, got %d\n", idx);
......@@ -109,7 +111,8 @@ void piglit_init(int argc, char **argv)
}
glLinkProgram(prog);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
if (!piglit_link_check_status(prog)) {
piglit_report_result(PIGLIT_FAIL);
......@@ -117,7 +120,8 @@ void piglit_init(int argc, char **argv)
printf("Querying index of nonexistent variable...\n");
idx = glGetFragDataIndex(prog, "waldo");
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
if (idx != -1) {
fprintf(stderr, "Expected index = -1, got %d\n", idx);
......
......@@ -82,7 +82,8 @@ piglit_display(void)
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
GL_TEXTURE_2D, tex[1], 0);
check_fbo_status();
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) {
GLint buffer, expected_buffer;
......@@ -115,7 +116,8 @@ piglit_display(void)
}
}
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
return PIGLIT_PASS;
}
......
......@@ -118,13 +118,13 @@ void piglit_init(int argc, char **argv)
GL_RENDERBUFFER,
rb);
piglit_check_gl_error(0, PIGLIT_FAIL);
pass = piglit_check_gl_error(0) && pass;
pass = check_attachment(GL_DEPTH_ATTACHMENT, rb) && pass;
pass = check_attachment(GL_STENCIL_ATTACHMENT, rb) && pass;
pass = check_attachment(GL_DEPTH_STENCIL_ATTACHMENT, rb) && pass;
piglit_check_gl_error(0, PIGLIT_FAIL);
pass = piglit_check_gl_error(0) && pass;
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
......@@ -126,13 +126,13 @@ void piglit_init(int argc, char **argv)
tex,
0); /*level*/
piglit_check_gl_error(0, PIGLIT_FAIL);
pass = piglit_check_gl_error(0) && pass;
pass = check_attachment(GL_DEPTH_ATTACHMENT, tex) && pass;
pass = check_attachment(GL_STENCIL_ATTACHMENT, tex) && pass;
pass = check_attachment(GL_DEPTH_STENCIL_ATTACHMENT, tex) && pass;
piglit_check_gl_error(0, PIGLIT_FAIL);
pass = piglit_check_gl_error(0) && pass;
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
......@@ -68,19 +68,23 @@ piglit_init(int argc, char *argv[])
/* offset < 0 */
glMapBufferRange(target, -1, 1, access);
piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
/* length < 0 */
glMapBufferRange(target, 0, -1, access);
piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
/* offset + lenght > GL_BUFFER_SIZE */
glMapBufferRange(target, 1, GL_BUFFER_SIZE, access);
piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
/* undefined access bits */
glMapBufferRange(target, 0, 10, 0xffffffff);
piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
/*
......@@ -102,30 +106,36 @@ piglit_init(int argc, char *argv[])
/* (a) map again */
glMapBufferRange(target, 0, 10, access);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
glUnmapBuffer(target);
/* for (b) case */
glMapBufferRange(target, 0, 10, 0);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
/* for (c) case */
glMapBufferRange(target, 0, 10, GL_MAP_READ_BIT |
GL_MAP_INVALIDATE_RANGE_BIT);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
glMapBufferRange(target, 0, 10, GL_MAP_READ_BIT |
GL_MAP_INVALIDATE_BUFFER_BIT);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
glMapBufferRange(target, 0, 10, GL_MAP_READ_BIT |
GL_MAP_UNSYNCHRONIZED_BIT);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
/* for (d) case */
glMapBufferRange(target, 0, 10, GL_MAP_FLUSH_EXPLICIT_BIT |
GL_MAP_READ_BIT);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
piglit_report_result(PIGLIT_PASS);
......
......@@ -77,7 +77,8 @@ piglit_display(void)
* deletion but not deleted.
*/
piglit_GetProgramiv(prog, GL_DELETE_STATUS, &status);
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
if (status != GL_TRUE) {
fprintf(stderr,
"GL_DELETE_STATUS when deleted reported non-true %d\n",
......@@ -102,7 +103,8 @@ piglit_display(void)
/* The program should still report being deleted. */
piglit_GetProgramiv(prog, GL_DELETE_STATUS, &status);
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
if (status != GL_TRUE) {
fprintf(stderr,
"GL_DELETE_STATUS after a clear reported non-true %d\n",
......@@ -114,7 +116,7 @@ piglit_display(void)
piglit_UseProgram(0);
piglit_GetProgramiv(prog, GL_DELETE_STATUS, &status);
piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
piglit_present_results();
......
......@@ -82,7 +82,8 @@ piglit_display(void)
/* The program should still report being deleted. */
piglit_GetProgramiv(prog, GL_DELETE_STATUS, &status);
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
if (status != GL_TRUE) {
fprintf(stderr,
"GL_DELETE_STATUS after a clear reported non-true %d\n",
......@@ -94,7 +95,7 @@ piglit_display(void)
piglit_UseProgram(0);
piglit_GetProgramiv(prog, GL_DELETE_STATUS, &status);
piglit_check_gl_error(GL_INVALID_VALUE, PIGLIT_FAIL);
pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
piglit_present_results();
......
......@@ -66,7 +66,7 @@ piglit_display(void)
{
static const int black[4] = {0, 0, 0, 0};
static const float green[4] = {0, 1, 0, 0};
bool pass;
bool pass = GL_TRUE;
/* We don't have to do an integer FBO for this test, because
* no error is specified in the non-integer FBO case:
......@@ -79,7 +79,7 @@ piglit_display(void)
glClear(GL_COLOR_BUFFER_BIT);
glDrawPixels(1, 1, GL_RGBA_INTEGER_EXT, GL_UNSIGNED_INT, black);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
/* The text in GL 3.0 specification banning
* glDrawPixels(integer format) precedes the restriction from
......@@ -93,10 +93,10 @@ piglit_display(void)
* Based on this, we test for GL_INVALID_OPERATION even for FLOAT.
*/
glDrawPixels(1, 1, GL_RGBA_INTEGER_EXT, GL_FLOAT, black);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
/* Make sure that we really didn't render anything. */
pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green) && pass;
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
......
......@@ -49,11 +49,13 @@ piglit_init(int argc, char **argv)
/* Is GL_INVALID_ENUM generated by glReadPixels? */
glReadPixels(0, 0, 4, 4, GL_RGBA_INTEGER, GL_FLOAT, buf);
piglit_check_gl_error(GL_INVALID_ENUM, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_ENUM))
piglit_report_result(PIGLIT_FAIL);
/* Is GL_INVALID_OPERATION generated by glReadPixels? */
glReadPixels(0, 0, 4, 4, GL_RGBA_INTEGER, GL_UNSIGNED_INT, buf);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
piglit_report_result(PIGLIT_PASS);
}
......@@ -49,19 +49,22 @@ piglit_display(void)
/* Check that GL_FLOAT type is not accepted with integer formats */
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16UI_EXT, 1, 1, 0,
GL_RGBA_INTEGER, GL_FLOAT, black);
piglit_check_gl_error(GL_INVALID_ENUM, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_ENUM))
piglit_report_result(PIGLIT_FAIL);
/* Check that GL_INVALID_OPERATION is generated by trying to mix
* integer/float formats/types.
*/
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0,
GL_RGBA_INTEGER, GL_SHORT, NULL);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
glTexSubImage2D(GL_TEXTURE_2D, 0,
0, 0, 4, 4,
GL_RGBA_INTEGER, GL_FLOAT, NULL);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
/* Check for GL_INVALID_OPERATION when trying to copy framebuffer pixels
* to an integer texture when the framebuffer is not an integer format.
......@@ -72,7 +75,8 @@ piglit_display(void)
glCopyTexSubImage2D(GL_TEXTURE_2D, 0,
0, 0, 0, 0, 4, 4);
piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
piglit_report_result(PIGLIT_FAIL);
glDeleteTextures(1, &tex);
......
......@@ -136,7 +136,8 @@ void piglit_init(int argc, char **argv)
if (!piglit_link_check_status(prog))
piglit_report_result(PIGLIT_FAIL);
glGenBuffers(1, &xfb_buf);
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
}
enum piglit_result piglit_display(void)
......@@ -154,7 +155,7 @@ enum piglit_result piglit_display(void)
glVertexAttribIPointer(input_index, 1, GL_UNSIGNED_INT,
sizeof(GLuint), &verts);
glEnableVertexAttribArray(input_index);
piglit_check_gl_error(0, PIGLIT_FAIL);
pass = piglit_check_gl_error(0) && pass;
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, xfb_buf);
memset(buffer, 0xffffffff, sizeof(buffer));
......@@ -166,10 +167,10 @@ enum piglit_result piglit_display(void)
piglit_BeginTransformFeedback(GL_POINTS);
glDrawArrays(GL_POINTS, 0, 4);
piglit_EndTransformFeedback();
piglit_check_gl_error(0, PIGLIT_FAIL);
pass = piglit_check_gl_error(0) && pass;
readback = glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, GL_READ_ONLY);
piglit_check_gl_error(0, PIGLIT_FAIL);
pass = piglit_check_gl_error(0) && pass;
/* Figure out expected output */
memset(expected, 0xffffffff, sizeof(expected));
......
......@@ -61,7 +61,8 @@ piglit_init(int argc, char **argv)
glGetIntegerv(GL_RASTERIZER_DISCARD, &enabled);
if (!enabled)
piglit_report_result(PIGLIT_FAIL);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
glDisable(GL_RASTERIZER_DISCARD);
if (glIsEnabled(GL_RASTERIZER_DISCARD))
......@@ -69,7 +70,8 @@ piglit_init(int argc, char **argv)
glGetIntegerv(GL_RASTERIZER_DISCARD, &enabled);
if (enabled)
piglit_report_result(PIGLIT_FAIL);
piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
piglit_report_result(PIGLIT_PASS);
}
......@@ -152,7 +152,8 @@ initialize_shader_and_xfb()
3*NUM_POINTS*sizeof(unsigned), NULL, GL_STREAM_READ);
piglit_BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, xfb_buf);
piglit_UseProgram(prog);
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
}
static void
......@@ -176,7 +177,8 @@ initialize_vertex_shader_inputs()
glVertexAttribIPointer(starting_x_index, 1, GL_UNSIGNED_INT, sizeof(unsigned),
verts);
glEnableVertexAttribArray(starting_x_index);
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
}
/**
......@@ -227,7 +229,8 @@ draw()
glDrawArrays(draw_mode, 0, NUM_POINTS);
}
piglit_EndTransformFeedback();
piglit_check_gl_error(0, PIGLIT_FAIL);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);