diff options
author | Marek Olšák <maraeo@gmail.com> | 2010-09-29 02:04:21 +0200 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2010-09-30 19:12:37 +0200 |
commit | 6c67f31b147380698ad8bbd76de66aa654c61cda (patch) | |
tree | 076174c7306f7698215b360d2b6463312b97dae7 | |
parent | b19fbb79f2264ea464f7cc85d788fec457563375 (diff) |
fbo tests: use piglit_probe_rect_* when appropriate
Some tests are almost instantly finished now. Before, one test took several
seconds (r300g).
-rw-r--r-- | tests/fbo/fbo-3d.c | 12 | ||||
-rw-r--r-- | tests/fbo/fbo-blit-d24s8.c | 30 | ||||
-rw-r--r-- | tests/fbo/fbo-blit.c | 29 | ||||
-rw-r--r-- | tests/fbo/fbo-clearmipmap.c | 13 | ||||
-rw-r--r-- | tests/fbo/fbo-copypix.c | 29 | ||||
-rw-r--r-- | tests/fbo/fbo-cubemap.c | 11 | ||||
-rw-r--r-- | tests/fbo/fbo-drawbuffers.c | 8 | ||||
-rw-r--r-- | tests/fbo/fbo-drawbuffers2-blend.c | 16 | ||||
-rw-r--r-- | tests/fbo/fbo-drawbuffers2-colormask.c | 16 | ||||
-rw-r--r-- | tests/fbo/fbo-flushing.c | 10 | ||||
-rw-r--r-- | tests/fbo/fbo-generatemipmap-nonsquare.c | 29 | ||||
-rw-r--r-- | tests/fbo/fbo-generatemipmap-scissor.c | 29 | ||||
-rw-r--r-- | tests/fbo/fbo-generatemipmap-viewport.c | 29 | ||||
-rw-r--r-- | tests/fbo/fbo-generatemipmap.c | 28 | ||||
-rw-r--r-- | tests/fbo/fbo-nodepth-test.c | 7 | ||||
-rw-r--r-- | tests/fbo/fbo-nostencil-test.c | 7 | ||||
-rw-r--r-- | tests/fbo/fbo-readdrawpix.c | 29 |
17 files changed, 89 insertions, 243 deletions
diff --git a/tests/fbo/fbo-3d.c b/tests/fbo/fbo-3d.c index fbd4d3a6..4762f0a9 100644 --- a/tests/fbo/fbo-3d.c +++ b/tests/fbo/fbo-3d.c @@ -146,16 +146,8 @@ draw_depth(int x, int y, int depth) static GLboolean test_depth_drawing(int start_x, int start_y, float *expected) { - GLboolean pass = GL_TRUE; - int x, y; - - for (y = start_y; y < start_y + BUF_HEIGHT; y++) { - for (x = start_x; x < start_x + BUF_WIDTH; x++) { - pass &= piglit_probe_pixel_rgb(x, y, expected); - } - } - - return pass; + return piglit_probe_rect_rgb(start_x, start_y, BUF_WIDTH, BUF_HEIGHT, + expected); } enum piglit_result diff --git a/tests/fbo/fbo-blit-d24s8.c b/tests/fbo/fbo-blit-d24s8.c index dca668fe..d450b7dc 100644 --- a/tests/fbo/fbo-blit-d24s8.c +++ b/tests/fbo/fbo-blit-d24s8.c @@ -117,27 +117,15 @@ verify_depth_rect(int start_x, int start_y, int w, int h) float darkgrey = 0.3; float grey = 0.6; float one = 1; - int x, y; - - for (y = 0; y < h; y++) { - for (x = 0; x < w; x++) { - float expected; - - if ((y < h / 2) && (x < w / 2)) - expected = zero; - else if (y < h / 2) - expected = darkgrey; - else if (x < w / 2) - expected = grey; - else - expected = one; - - if (!piglit_probe_pixel_depth(start_x + x, start_y + y, - expected)) - return GL_FALSE; - //fprintf(stderr, "Match: %f\n", expected); - } - } + + if (!piglit_probe_rect_depth(start_x, start_y, w / 2, h / 2, zero)) + return GL_FALSE; + if (!piglit_probe_rect_depth(start_x + w/2, start_y, w/2, h/2, darkgrey)) + return GL_FALSE; + if (!piglit_probe_rect_depth(start_x, start_y + h/2, w/2, h/2, grey)) + return GL_FALSE; + if (!piglit_probe_rect_depth(start_x + w/2, start_y + h/2, w/2, h/2, one)) + return GL_FALSE; return GL_TRUE; } diff --git a/tests/fbo/fbo-blit.c b/tests/fbo/fbo-blit.c index 989566e2..81442515 100644 --- a/tests/fbo/fbo-blit.c +++ b/tests/fbo/fbo-blit.c @@ -106,26 +106,15 @@ verify_color_rect(int start_x, int start_y, int w, int h) float green[] = {0, 1, 0, 0}; float blue[] = {0, 0, 1, 0}; float white[] = {1, 1, 1, 0}; - int x, y; - - for (y = 0; y < h; y++) { - for (x = 0; x < w; x++) { - float *expected; - - if ((y < h / 2) && (x < w / 2)) - expected = red; - else if (y < h / 2) - expected = green; - else if (x < w / 2) - expected = blue; - else - expected = white; - - if (!piglit_probe_pixel_rgb(start_x + x, start_y + y, - expected)) - return GL_FALSE; - } - } + + if (!piglit_probe_rect_rgb(start_x, start_y, w / 2, h / 2, red)) + return GL_FALSE; + if (!piglit_probe_rect_rgb(start_x + w/2, start_y, w/2, h/2, green)) + return GL_FALSE; + if (!piglit_probe_rect_rgb(start_x, start_y + h/2, w/2, h/2, blue)) + return GL_FALSE; + if (!piglit_probe_rect_rgb(start_x + w/2, start_y + h/2, w/2, h/2, white)) + return GL_FALSE; return GL_TRUE; } diff --git a/tests/fbo/fbo-clearmipmap.c b/tests/fbo/fbo-clearmipmap.c index 9edb5c7a..15bf776e 100644 --- a/tests/fbo/fbo-clearmipmap.c +++ b/tests/fbo/fbo-clearmipmap.c @@ -139,18 +139,7 @@ draw_mipmap(int x, int y, int dim) static GLboolean test_mipmap_drawing(int start_x, int start_y, int dim, const float *expected) { - GLboolean pass = GL_TRUE; - int x, y; - - for (y = 0; y < dim; y++) { - for (x = 0; x < dim; x++) { - pass = pass && piglit_probe_pixel_rgb(start_x + x, - start_y + y, - expected); - } - } - - return pass; + return piglit_probe_rect_rgb(start_x, start_y, dim, dim, expected); } enum piglit_result diff --git a/tests/fbo/fbo-copypix.c b/tests/fbo/fbo-copypix.c index 362459bc..73162e06 100644 --- a/tests/fbo/fbo-copypix.c +++ b/tests/fbo/fbo-copypix.c @@ -103,26 +103,15 @@ verify_color_rect(int start_x, int start_y, int w, int h) float green[] = {0, 1, 0, 0}; float blue[] = {0, 0, 1, 0}; float white[] = {1, 1, 1, 0}; - int x, y; - - for (y = 0; y < h; y++) { - for (x = 0; x < w; x++) { - float *expected; - - if ((y < h / 2) && (x < w / 2)) - expected = red; - else if (y < h / 2) - expected = green; - else if (x < w / 2) - expected = blue; - else - expected = white; - - if (!piglit_probe_pixel_rgb(start_x + x, start_y + y, - expected)) - return GL_FALSE; - } - } + + if (!piglit_probe_rect_rgb(start_x, start_y, w / 2, h / 2, red)) + return GL_FALSE; + if (!piglit_probe_rect_rgb(start_x + w/2, start_y, w/2, h/2, green)) + return GL_FALSE; + if (!piglit_probe_rect_rgb(start_x, start_y + h/2, w/2, h/2, blue)) + return GL_FALSE; + if (!piglit_probe_rect_rgb(start_x + w/2, start_y + h/2, w/2, h/2, white)) + return GL_FALSE; return GL_TRUE; } diff --git a/tests/fbo/fbo-cubemap.c b/tests/fbo/fbo-cubemap.c index 62c3c2e9..de011932 100644 --- a/tests/fbo/fbo-cubemap.c +++ b/tests/fbo/fbo-cubemap.c @@ -153,16 +153,7 @@ draw_face(int x, int y, int dim, int face) static GLboolean test_face_drawing(int start_x, int start_y, int dim, float *expected) { - GLboolean pass = GL_TRUE; - int x, y; - - for (y = start_y; y < start_y + dim; y++) { - for (x = start_x; x < start_x + dim; x++) { - pass &= piglit_probe_pixel_rgb(x, y, expected); - } - } - - return pass; + return piglit_probe_rect_rgb(start_x, start_y, dim, dim, expected); } enum piglit_result diff --git a/tests/fbo/fbo-drawbuffers.c b/tests/fbo/fbo-drawbuffers.c index 0c474a7e..cf4376c7 100644 --- a/tests/fbo/fbo-drawbuffers.c +++ b/tests/fbo/fbo-drawbuffers.c @@ -67,7 +67,6 @@ piglit_display(void) GLboolean pass = GL_TRUE; GLuint tex0, tex1, fb; GLenum status; - int x, y; float green[] = {0, 1, 0, 0}; const GLenum attachments[] = { GL_COLOR_ATTACHMENT0_EXT, @@ -115,11 +114,8 @@ piglit_display(void) glDeleteTextures(1, &tex1); glDeleteFramebuffersEXT(1, &fb); - for (y = 0; y < piglit_height; y++) { - for (x = 0; x < piglit_width; x++) { - pass = pass && piglit_probe_pixel_rgb(x, y, green); - } - } + pass = pass && piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, + green); glutSwapBuffers(); diff --git a/tests/fbo/fbo-drawbuffers2-blend.c b/tests/fbo/fbo-drawbuffers2-blend.c index eaa5aeb8..151d6209 100644 --- a/tests/fbo/fbo-drawbuffers2-blend.c +++ b/tests/fbo/fbo-drawbuffers2-blend.c @@ -67,7 +67,6 @@ piglit_display(void) GLboolean pass = GL_TRUE; GLuint tex0, tex1, fb; GLenum status; - int x, y; float green[] = {0, 1, 0, 0}; float blue[] = {0, 0, 1, 0}; const GLenum attachments[] = { @@ -124,17 +123,10 @@ piglit_display(void) glDeleteTextures(1, &tex1); glDeleteFramebuffersEXT(1, &fb); - for (y = 0; y < piglit_height; y++) { - for (x = 0; x < piglit_width; x++) { - float *expected; - if (x < piglit_width / 2) - expected = green; - else - expected = blue; - - pass = pass && piglit_probe_pixel_rgb(x, y, expected); - } - } + pass = pass && piglit_probe_rect_rgb(0, 0, piglit_width/2, + piglit_height, green); + pass = pass && piglit_probe_rect_rgb(piglit_width/2, 0, piglit_width/2, + piglit_height, blue); glutSwapBuffers(); diff --git a/tests/fbo/fbo-drawbuffers2-colormask.c b/tests/fbo/fbo-drawbuffers2-colormask.c index 918e6115..76fb1fa4 100644 --- a/tests/fbo/fbo-drawbuffers2-colormask.c +++ b/tests/fbo/fbo-drawbuffers2-colormask.c @@ -67,7 +67,6 @@ piglit_display(void) GLboolean pass = GL_TRUE; GLuint tex0, tex1, fb; GLenum status; - int x, y; float white[] = {1, 1, 1, 1}; float green[] = {0, 1, 0, 0}; float blue[] = {0, 0, 1, 0}; @@ -122,17 +121,10 @@ piglit_display(void) glDeleteTextures(1, &tex1); glDeleteFramebuffersEXT(1, &fb); - for (y = 0; y < piglit_height; y++) { - for (x = 0; x < piglit_width; x++) { - float *expected; - if (x < piglit_width / 2) - expected = green; - else - expected = blue; - - pass = pass && piglit_probe_pixel_rgb(x, y, expected); - } - } + pass = pass && piglit_probe_rect_rgb(0, 0, piglit_width/2, + piglit_height, green); + pass = pass && piglit_probe_rect_rgb(piglit_width/2, 0, piglit_width/2, + piglit_height, blue); glutSwapBuffers(); diff --git a/tests/fbo/fbo-flushing.c b/tests/fbo/fbo-flushing.c index 21d8206f..1979488c 100644 --- a/tests/fbo/fbo-flushing.c +++ b/tests/fbo/fbo-flushing.c @@ -49,7 +49,7 @@ enum piglit_result piglit_display(void) { GLboolean pass = GL_TRUE; - int y, probe_x, probe_y, size; + int y, size; GLuint tex, fb; const float red[] = {1, 0, 0, 0}; const float green[] = {0, 1, 0, 0}; @@ -117,13 +117,7 @@ piglit_display(void) y = 0; for (size = TEX_WIDTH; size > 0; size /= 2) { - for (probe_y = 0; probe_y < size; probe_y++) { - for (probe_x = 0; probe_x < size; probe_x++) { - pass = pass && piglit_probe_pixel_rgb(probe_x, - probe_y, - green); - } - } + pass = pass && piglit_probe_rect_rgb(0, y, size, size, green); y += size + 5; } diff --git a/tests/fbo/fbo-generatemipmap-nonsquare.c b/tests/fbo/fbo-generatemipmap-nonsquare.c index ba389d8b..454cd6fd 100644 --- a/tests/fbo/fbo-generatemipmap-nonsquare.c +++ b/tests/fbo/fbo-generatemipmap-nonsquare.c @@ -122,26 +122,15 @@ static GLboolean test_mipmap_drawing(int start_x, int start_y, int dim) { GLboolean pass = GL_TRUE; - int x, y; - - for (y = 0; y < dim; y++) { - for (x = 0; x < dim; x++) { - const float *expected; - - if (x < dim / 2 && y < dim / 2) - expected = red; - else if (y < dim / 2) - expected = green; - else if (x < dim / 2) - expected = blue; - else - expected = white; - - pass = pass && piglit_probe_pixel_rgb(start_x + x, - start_y + y, - expected); - } - } + + pass = pass && piglit_probe_rect_rgb( + start_x, start_y, dim/2, dim/2, red); + pass = pass && piglit_probe_rect_rgb( + start_x + dim/2, start_y, dim/2, dim/2, green); + pass = pass && piglit_probe_rect_rgb( + start_x, start_y + dim/2, dim/2, dim/2, blue); + pass = pass && piglit_probe_rect_rgb( + start_x + dim/2, start_y + dim/2, dim/2, dim/2, white); return pass; } diff --git a/tests/fbo/fbo-generatemipmap-scissor.c b/tests/fbo/fbo-generatemipmap-scissor.c index 1174570b..5fb5733a 100644 --- a/tests/fbo/fbo-generatemipmap-scissor.c +++ b/tests/fbo/fbo-generatemipmap-scissor.c @@ -122,26 +122,15 @@ static GLboolean test_mipmap_drawing(int start_x, int start_y, int dim) { GLboolean pass = GL_TRUE; - int x, y; - - for (y = 0; y < dim; y++) { - for (x = 0; x < dim; x++) { - const float *expected; - - if (x < dim / 2 && y < dim / 2) - expected = red; - else if (y < dim / 2) - expected = green; - else if (x < dim / 2) - expected = blue; - else - expected = white; - - pass = pass && piglit_probe_pixel_rgb(start_x + x, - start_y + y, - expected); - } - } + + pass = pass && piglit_probe_rect_rgb( + start_x, start_y, dim/2, dim/2, red); + pass = pass && piglit_probe_rect_rgb( + start_x + dim/2, start_y, dim/2, dim/2, green); + pass = pass && piglit_probe_rect_rgb( + start_x, start_y + dim/2, dim/2, dim/2, blue); + pass = pass && piglit_probe_rect_rgb( + start_x + dim/2, start_y + dim/2, dim/2, dim/2, white); return pass; } diff --git a/tests/fbo/fbo-generatemipmap-viewport.c b/tests/fbo/fbo-generatemipmap-viewport.c index c0512cde..db8ae74e 100644 --- a/tests/fbo/fbo-generatemipmap-viewport.c +++ b/tests/fbo/fbo-generatemipmap-viewport.c @@ -123,26 +123,15 @@ static GLboolean test_mipmap_drawing(int start_x, int start_y, int dim) { GLboolean pass = GL_TRUE; - int x, y; - - for (y = 0; y < dim; y++) { - for (x = 0; x < dim; x++) { - const float *expected; - - if (x < dim / 2 && y < dim / 2) - expected = red; - else if (y < dim / 2) - expected = green; - else if (x < dim / 2) - expected = blue; - else - expected = white; - - pass = pass && piglit_probe_pixel_rgb(start_x + x, - start_y + y, - expected); - } - } + + pass = pass && piglit_probe_rect_rgb( + start_x, start_y, dim/2, dim/2, red); + pass = pass && piglit_probe_rect_rgb( + start_x + dim/2, start_y, dim/2, dim/2, green); + pass = pass && piglit_probe_rect_rgb( + start_x, start_y + dim/2, dim/2, dim/2, blue); + pass = pass && piglit_probe_rect_rgb( + start_x + dim/2, start_y + dim/2, dim/2, dim/2, white); return pass; } diff --git a/tests/fbo/fbo-generatemipmap.c b/tests/fbo/fbo-generatemipmap.c index 6b9b8a7c..6682a31a 100644 --- a/tests/fbo/fbo-generatemipmap.c +++ b/tests/fbo/fbo-generatemipmap.c @@ -116,26 +116,14 @@ static GLboolean test_mipmap_drawing(int start_x, int start_y, int dim) { GLboolean pass = GL_TRUE; - int x, y; - - for (y = 0; y < dim; y++) { - for (x = 0; x < dim; x++) { - const float *expected; - - if (x < dim / 2 && y < dim / 2) - expected = red; - else if (y < dim / 2) - expected = green; - else if (x < dim / 2) - expected = blue; - else - expected = white; - - pass = pass && piglit_probe_pixel_rgb(start_x + x, - start_y + y, - expected); - } - } + pass = pass && piglit_probe_rect_rgb( + start_x, start_y, dim/2, dim/2, red); + pass = pass && piglit_probe_rect_rgb( + start_x + dim/2, start_y, dim/2, dim/2, green); + pass = pass && piglit_probe_rect_rgb( + start_x, start_y + dim/2, dim/2, dim/2, blue); + pass = pass && piglit_probe_rect_rgb( + start_x + dim/2, start_y + dim/2, dim/2, dim/2, white); return pass; } diff --git a/tests/fbo/fbo-nodepth-test.c b/tests/fbo/fbo-nodepth-test.c index 6ffe21fb..5242494f 100644 --- a/tests/fbo/fbo-nodepth-test.c +++ b/tests/fbo/fbo-nodepth-test.c @@ -43,7 +43,6 @@ piglit_display(void) GLboolean pass = GL_TRUE; GLuint tex, fb; GLenum status; - int x, y; float green[] = {0, 1, 0, 0}; glGenTextures(1, &tex); @@ -77,11 +76,7 @@ piglit_display(void) glColor4fv(green); piglit_draw_rect(0, 0, piglit_width, piglit_height); - for (y = 0; y < piglit_height; y++) { - for (x = 0; x < piglit_width; x++) { - pass = pass && piglit_probe_pixel_rgb(x, y, green); - } - } + pass = pass && piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, green); glDisable(GL_DEPTH_TEST); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); diff --git a/tests/fbo/fbo-nostencil-test.c b/tests/fbo/fbo-nostencil-test.c index a5488972..b5e0cfa7 100644 --- a/tests/fbo/fbo-nostencil-test.c +++ b/tests/fbo/fbo-nostencil-test.c @@ -43,7 +43,6 @@ piglit_display(void) GLboolean pass = GL_TRUE; GLuint tex, fb; GLenum status; - int x, y; float green[] = {0, 1, 0, 0}; glGenTextures(1, &tex); @@ -77,11 +76,7 @@ piglit_display(void) glColor4fv(green); piglit_draw_rect(0, 0, piglit_width, piglit_height); - for (y = 0; y < piglit_height; y++) { - for (x = 0; x < piglit_width; x++) { - pass = pass && piglit_probe_pixel_rgb(x, y, green); - } - } + pass = pass && piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, green); glDisable(GL_STENCIL_TEST); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); diff --git a/tests/fbo/fbo-readdrawpix.c b/tests/fbo/fbo-readdrawpix.c index 15d85212..0787646e 100644 --- a/tests/fbo/fbo-readdrawpix.c +++ b/tests/fbo/fbo-readdrawpix.c @@ -103,26 +103,15 @@ verify_color_rect(int start_x, int start_y, int w, int h) float green[] = {0, 1, 0, 0}; float blue[] = {0, 0, 1, 0}; float white[] = {1, 1, 1, 0}; - int x, y; - - for (y = 0; y < h; y++) { - for (x = 0; x < w; x++) { - float *expected; - - if ((y < h / 2) && (x < w / 2)) - expected = red; - else if (y < h / 2) - expected = green; - else if (x < w / 2) - expected = blue; - else - expected = white; - - if (!piglit_probe_pixel_rgb(start_x + x, start_y + y, - expected)) - return GL_FALSE; - } - } + + if (!piglit_probe_rect_rgb(start_x, start_y, w / 2, h / 2, red)) + return GL_FALSE; + if (!piglit_probe_rect_rgb(start_x + w/2, start_y, w/2, h/2, green)) + return GL_FALSE; + if (!piglit_probe_rect_rgb(start_x, start_y + h/2, w/2, h/2, blue)) + return GL_FALSE; + if (!piglit_probe_rect_rgb(start_x + w/2, start_y + h/2, w/2, h/2, white)) + return GL_FALSE; return GL_TRUE; } |