diff options
author | Marek Olšák <maraeo@gmail.com> | 2011-08-18 22:47:14 +0200 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2011-08-21 22:12:48 +0200 |
commit | 3f04023393902b2d29a9e91f9e2f38caa53d520e (patch) | |
tree | 5ced685df53bdf31a535fe4542e3de3c14216e82 | |
parent | 702c6c9f72387d6059c765bdb174f382c4a36eed (diff) |
fbo-depthstencil: also test the default framebuffer
Not really a FBO test, but it may help uncover some bugs.
-rw-r--r-- | tests/all.tests | 27 | ||||
-rw-r--r-- | tests/fbo/fbo-depthstencil.c | 86 |
2 files changed, 64 insertions, 49 deletions
diff --git a/tests/all.tests b/tests/all.tests index b38db53bc..a75a728f0 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -34,6 +34,21 @@ try: except SystemExit: pass +def add_fbo_depthstencil_tests(group, format): + if format == 'default_fb': + prefix = '' + else: + prefix = 'fbo-' + group[prefix + 'depthstencil-' + format + '-clear'] = PlainExecTest(['fbo-depthstencil', '-auto', 'clear', format]) + group[prefix + 'depthstencil-' + format + '-readpixels-FLOAT-and-USHORT'] = PlainExecTest(['fbo-depthstencil', '-auto', 'readpixels', format, 'FLOAT-and-USHORT']) + group[prefix + 'depthstencil-' + format + '-readpixels-24_8'] = PlainExecTest(['fbo-depthstencil', '-auto', 'readpixels', format, '24_8']) + group[prefix + 'depthstencil-' + format + '-readpixels-32F_24_8_REV'] = PlainExecTest(['fbo-depthstencil', '-auto', 'readpixels', format, '32F_24_8_REV']) + group[prefix + 'depthstencil-' + format + '-drawpixels-FLOAT-and-USHORT'] = PlainExecTest(['fbo-depthstencil', '-auto', 'drawpixels', format, 'FLOAT-and-USHORT']) + group[prefix + 'depthstencil-' + format + '-drawpixels-24_8'] = PlainExecTest(['fbo-depthstencil', '-auto', 'drawpixels', format, '24_8']) + group[prefix + 'depthstencil-' + format + '-drawpixels-32F_24_8_REV'] = PlainExecTest(['fbo-depthstencil', '-auto', 'drawpixels', format, '32F_24_8_REV']) + group[prefix + 'depthstencil-' + format + '-copypixels'] = PlainExecTest(['fbo-depthstencil', '-auto', 'copypixels', format]) + group[prefix + 'depthstencil-' + format + '-blit'] = PlainExecTest(['fbo-depthstencil', '-auto', 'blit', format]) + glean = Group() glean['basic'] = GleanTest('basic') glean['api2'] = GleanTest('api2') @@ -274,6 +289,7 @@ add_plain_test(general, 'vbo-map-remap') add_plain_test(general, 'vbo-subdata-sync') add_plain_test(general, 'vbo-subdata-zero') add_plain_test(general, 'windowoverlap') +add_fbo_depthstencil_tests(general, 'default_fb') shaders = Group() @@ -653,17 +669,6 @@ def add_fbo_stencil_tests(group, format): group['fbo-stencil-' + format + '-copypixels'] = PlainExecTest(['fbo-stencil', '-auto', 'copypixels', format]) group['fbo-stencil-' + format + '-blit'] = PlainExecTest(['fbo-stencil', '-auto', 'blit', format]) -def add_fbo_depthstencil_tests(group, format): - group['fbo-depthstencil-' + format + '-clear'] = PlainExecTest(['fbo-depthstencil', '-auto', 'clear', format]) - group['fbo-depthstencil-' + format + '-readpixels-FLOAT-and-USHORT'] = PlainExecTest(['fbo-depthstencil', '-auto', 'readpixels', format, 'FLOAT-and-USHORT']) - group['fbo-depthstencil-' + format + '-readpixels-24_8'] = PlainExecTest(['fbo-depthstencil', '-auto', 'readpixels', format, '24_8']) - group['fbo-depthstencil-' + format + '-readpixels-32F_24_8_REV'] = PlainExecTest(['fbo-depthstencil', '-auto', 'readpixels', format, '32F_24_8_REV']) - group['fbo-depthstencil-' + format + '-drawpixels-FLOAT-and-USHORT'] = PlainExecTest(['fbo-depthstencil', '-auto', 'drawpixels', format, 'FLOAT-and-USHORT']) - group['fbo-depthstencil-' + format + '-drawpixels-24_8'] = PlainExecTest(['fbo-depthstencil', '-auto', 'drawpixels', format, '24_8']) - group['fbo-depthstencil-' + format + '-drawpixels-32F_24_8_REV'] = PlainExecTest(['fbo-depthstencil', '-auto', 'drawpixels', format, '32F_24_8_REV']) - group['fbo-depthstencil-' + format + '-copypixels'] = PlainExecTest(['fbo-depthstencil', '-auto', 'copypixels', format]) - group['fbo-depthstencil-' + format + '-blit'] = PlainExecTest(['fbo-depthstencil', '-auto', 'blit', format]) - spec = Group() gl11 = Group() diff --git a/tests/fbo/fbo-depthstencil.c b/tests/fbo/fbo-depthstencil.c index 637c6cace..094e5ea41 100644 --- a/tests/fbo/fbo-depthstencil.c +++ b/tests/fbo/fbo-depthstencil.c @@ -33,7 +33,7 @@ #define BUF_SIZE 123 int piglit_width = BUF_SIZE; int piglit_height = BUF_SIZE; -int piglit_window_mode = GLUT_DOUBLE; +int piglit_window_mode = GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL; enum { CLEAR, READPIXELS, @@ -50,6 +50,7 @@ struct format { GLenum iformat; const char *extension; } formats[] = { + {"default_fb", 0, NULL}, {F(GL_DEPTH24_STENCIL8), "GL_EXT_packed_depth_stencil"}, {F(GL_DEPTH32F_STENCIL8), "GL_ARB_depth_buffer_float"} }; @@ -76,20 +77,22 @@ static enum piglit_result test_clear(void) enum piglit_result res; /* Add a colorbuffer. */ - glGenRenderbuffersEXT(1, &cb); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, cb); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, BUF_SIZE, BUF_SIZE); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); - - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER_EXT, cb); - - glDrawBuffer(GL_COLOR_ATTACHMENT0); - glReadBuffer(GL_COLOR_ATTACHMENT0); - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - printf("FBO incomplete status 0x%X\n", status); - piglit_report_result(PIGLIT_FAIL); /* RGBA8 must succeed. */ + if (f.iformat) { + glGenRenderbuffersEXT(1, &cb); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, cb); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, BUF_SIZE, BUF_SIZE); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); + + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER_EXT, cb); + + glDrawBuffer(GL_COLOR_ATTACHMENT0); + glReadBuffer(GL_COLOR_ATTACHMENT0); + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + printf("FBO incomplete status 0x%X\n", status); + piglit_report_result(PIGLIT_FAIL); /* RGBA8 must succeed. */ + } } glClearDepth(0.75); @@ -111,13 +114,14 @@ static enum piglit_result test_clear(void) res = piglit_probe_rect_rgb(0, 0, BUF_SIZE, BUF_SIZE, green) ? PIGLIT_PASS : PIGLIT_FAIL; /* Display the colorbuffer. */ - if (!piglit_automatic) { + if (!piglit_automatic && f.iformat) { glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); glBlitFramebufferEXT(0, 0, BUF_SIZE, BUF_SIZE, 0, 0, BUF_SIZE, BUF_SIZE, GL_COLOR_BUFFER_BIT, GL_NEAREST); } - glDeleteRenderbuffersEXT(1, &cb); + if (f.iformat) + glDeleteRenderbuffersEXT(1, &cb); return res; } @@ -387,25 +391,29 @@ enum piglit_result piglit_display(void) glClear(GL_COLOR_BUFFER_BIT); /* Create the FBO. */ - glGenRenderbuffersEXT(1, &rb); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, f.iformat, BUF_SIZE, BUF_SIZE); - glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_STENCIL_SIZE_EXT, &stencil_size); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); - - glGenFramebuffersEXT(1, &fb); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER_EXT, rb); - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT, - GL_RENDERBUFFER_EXT, rb); - glViewport(0, 0, BUF_SIZE, BUF_SIZE); - glDrawBuffer(GL_NONE); - glReadBuffer(GL_NONE); - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - printf("FBO incomplete status 0x%X\n", status); - piglit_report_result(PIGLIT_SKIP); + if (f.iformat) { + glGenRenderbuffersEXT(1, &rb); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, f.iformat, BUF_SIZE, BUF_SIZE); + glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_STENCIL_SIZE_EXT, &stencil_size); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); + + glGenFramebuffersEXT(1, &fb); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER_EXT, rb); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER_EXT, rb); + glViewport(0, 0, BUF_SIZE, BUF_SIZE); + glDrawBuffer(GL_NONE); + glReadBuffer(GL_NONE); + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + printf("FBO incomplete status 0x%X\n", status); + piglit_report_result(PIGLIT_SKIP); + } + } else { + stencil_size = 8; } stencilmask = (1 << stencil_size) - 1; @@ -455,8 +463,10 @@ enum piglit_result piglit_display(void) } /* Cleanup. */ - glDeleteFramebuffersEXT(1, &fb); - glDeleteRenderbuffersEXT(1, &rb); + if (f.iformat) { + glDeleteFramebuffersEXT(1, &fb); + glDeleteRenderbuffersEXT(1, &rb); + } glutSwapBuffers(); |