[Piglit] [PATCH 6/8] fbo: Use renderbuffers instead of textures
Ian Romanick
idr at freedesktop.org
Wed May 31 05:33:44 UTC 2017
From: Ian Romanick <ian.d.romanick at intel.com>
This allows fbo-blit-stretch to run on platforms that support
ARB_framebuffer_object but not ARB_texture_non_power_of_two.
Coneptually similar to 7b3f6d5.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
tests/fbo/fbo-blit-stretch.cpp | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/tests/fbo/fbo-blit-stretch.cpp b/tests/fbo/fbo-blit-stretch.cpp
index 935d0d4..da85335 100644
--- a/tests/fbo/fbo-blit-stretch.cpp
+++ b/tests/fbo/fbo-blit-stretch.cpp
@@ -321,22 +321,22 @@ run_test(const TestCase &test)
GLboolean pass;
- GLuint tex;
+ GLuint rbo;
GLuint fbo;
GLenum status;
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
- tex = piglit_rgbw_texture(GL_RGBA, test.srcW, test.srcH, GL_FALSE, GL_TRUE, GL_UNSIGNED_NORMALIZED);
+ glGenRenderbuffers(1, &rbo);
+ glBindRenderbuffer(GL_RENDERBUFFER, rbo);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, test.srcW, test.srcH);
+ glBindRenderbuffer(GL_RENDERBUFFER, 0);
- glBindTexture(GL_TEXTURE_2D, tex);
-
- glFramebufferTexture2D(GL_FRAMEBUFFER,
- GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D,
- tex,
- 0);
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER,
+ GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER,
+ rbo);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
@@ -344,6 +344,12 @@ run_test(const TestCase &test)
if (status != GL_FRAMEBUFFER_COMPLETE) {
pass = GL_TRUE;
} else {
+ GLubyte *image = piglit_rgbw_image_ubyte(test.srcW, test.srcH,
+ GL_TRUE);
+ glDrawPixels(test.srcW, test.srcH, GL_RGBA, GL_UNSIGNED_BYTE,
+ image);
+ free(image);
+
glViewport(0, 0, piglit_width, piglit_height);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
@@ -364,7 +370,7 @@ run_test(const TestCase &test)
glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
glDeleteFramebuffers(1, &fbo);
- glDeleteTextures(1, &tex);
+ glDeleteRenderbuffers(1, &rbo);
return pass;
}
--
2.9.4
More information about the Piglit
mailing list