aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2013-03-18 17:49:43 -0600
committerBrian Paul <brianp@vmware.com>2013-03-19 08:08:10 -0600
commit24ebf10de386ec871a0afe99cd77cb796360d05c (patch)
treed2ec380601693ef1e35e03a162bd5c3949382339
parentec3222adb587dd3f1be1d02e91063a30ceec7f88 (diff)
downloadpiglit-24ebf10de386ec871a0afe99cd77cb796360d05c.tar.gz
texunits: clean-up GL error checking code
Use piglit_check_gl_error(). Reviewed-by: José Fonseca <jfonseca@vmware.com>
-rw-r--r--tests/general/texunits.c46
1 files changed, 14 insertions, 32 deletions
diff --git a/tests/general/texunits.c b/tests/general/texunits.c
index e419bded..6eca7b58 100644
--- a/tests/general/texunits.c
+++ b/tests/general/texunits.c
@@ -106,7 +106,6 @@ clear_errors()
static GLboolean
test_rasterpos(void)
{
- GLenum err;
int i;
clear_errors();
@@ -143,9 +142,8 @@ test_rasterpos(void)
}
/* there should be no errors at this point */
- err = glGetError();
- if (err != GL_NO_ERROR) {
- printf("Unexpected GL error in %s(): 0x%x\n", __FUNCTION__, err);
+ if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ return GL_FALSE;
}
/* this should generate an error */
@@ -154,17 +152,14 @@ test_rasterpos(void)
glActiveTexture(GL_TEXTURE0 + MaxTextureCoordUnits);
if (MaxTextureCoordUnits == MaxTextureCombinedUnits) {
/* INVALID_ENUM is expected */
- err = glGetError();
- if (err != GL_INVALID_ENUM) {
- printf("GL failed to raise GL_INVALID_ENUM setting texture unit\n");
+ if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
return GL_FALSE;
}
}
else {
/* INVALID_OPERATION is expected */
glGetFloatv(GL_CURRENT_RASTER_TEXTURE_COORDS, v);
- if (glGetError() != GL_INVALID_OPERATION) {
- printf("GL failed to raise GL_INVALID_OPERATION quering invalid raster tex coords\n");
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
return GL_FALSE;
}
}
@@ -177,7 +172,6 @@ test_rasterpos(void)
static GLboolean
test_texture_matrix(void)
{
- GLenum err;
int i;
clear_errors();
@@ -201,9 +195,8 @@ test_texture_matrix(void)
}
/* there should be no errors at this point */
- err = glGetError();
- if (err != GL_NO_ERROR) {
- printf("Unexpected GL error in %s(): 0x%x\n", __FUNCTION__, err);
+ if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ return GL_FALSE;
}
/* this should generate an error */
@@ -212,17 +205,14 @@ test_texture_matrix(void)
glActiveTexture(GL_TEXTURE0 + MaxTextureCoordUnits);
if (MaxTextureCoordUnits == MaxTextureCombinedUnits) {
/* INVALID_ENUM is expected */
- err = glGetError();
- if (err != GL_INVALID_ENUM) {
- printf("GL failed to raise GL_INVALID_ENUM setting texture unit\n");
+ if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
return GL_FALSE;
}
}
else {
/* INVALID_OPERATION is expected */
glGetFloatv(GL_TEXTURE_MATRIX, m);
- if (glGetError() != GL_INVALID_OPERATION) {
- printf("GL failed to raise GL_INVALID_OPERATION querying invalid texture matrix\n");
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
return GL_FALSE;
}
}
@@ -236,7 +226,6 @@ static GLboolean
test_texture_params(void)
{
GLuint tex[MAX_UNITS];
- GLenum err;
int i;
int maxUnit;
@@ -266,9 +255,8 @@ test_texture_params(void)
}
/* there should be no errors at this point */
- err = glGetError();
- if (err != GL_NO_ERROR) {
- printf("Unexpected GL error in %s(): 0x%x\n", __FUNCTION__, err);
+ if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ return GL_FALSE;
}
maxUnit = MAX2(MaxTextureCombinedUnits, MaxTextureCoordUnits);
@@ -276,9 +264,7 @@ test_texture_params(void)
/* this should generate an error */
glActiveTexture(GL_TEXTURE0 + maxUnit);
/* INVALID_ENUM is expected */
- err = glGetError();
- if (err != GL_INVALID_ENUM) {
- printf("GL failed to raise GL_INVALID_ENUM setting texture unit\n");
+ if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
return GL_FALSE;
}
@@ -290,7 +276,6 @@ static GLboolean
test_texture_env(void)
{
/* Texture Environment state is fixed-function; not used by shaders */
- GLenum err;
int i;
clear_errors();
@@ -299,9 +284,7 @@ test_texture_env(void)
for (i = 0; i < MaxTextureCombinedUnits; i++) {
glActiveTexture(GL_TEXTURE0 + i);
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, Random[i]);
- err = glGetError();
- if (err) {
- fprintf(stderr, "unit %d glTexEnvfv error: 0x%x\n", i, err);
+ if (!piglit_check_gl_error(GL_NO_ERROR)) {
return GL_FALSE;
}
}
@@ -319,9 +302,8 @@ test_texture_env(void)
}
/* there should be no errors at this point */
- err = glGetError();
- if (err != GL_NO_ERROR) {
- printf("Unexpected GL error in %s(): 0x%x\n", __FUNCTION__, err);
+ if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ return GL_FALSE;
}
return GL_TRUE;