[Piglit] [PATCH 1/2] util: Add piglit_winsys_fbo so tests can restore the default FBO
Ian Romanick
idr at freedesktop.org
Thu Jan 19 18:35:50 PST 2012
From: Ian Romanick <ian.d.romanick at intel.com>
When running framework tests with the -fbo option, this is set to the
default non-window FBO. Otherwise it is set to zero.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
Bulwinkle Moose says, "This time for sure!"
tests/util/piglit-framework.c | 28 +++++++++++++++++++---------
tests/util/piglit-framework.h | 2 ++
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/tests/util/piglit-framework.c b/tests/util/piglit-framework.c
index 262d1e8..9f20906 100644
--- a/tests/util/piglit-framework.c
+++ b/tests/util/piglit-framework.c
@@ -40,7 +40,7 @@
int piglit_automatic = 0;
bool piglit_use_fbo = false;
-GLuint piglit_fbo;
+unsigned piglit_winsys_fbo = 0;
static int piglit_window;
static enum piglit_result result;
#ifdef USE_GLX
@@ -144,6 +144,16 @@ piglit_framework_fbo_glx_destroy()
#endif
}
+static void
+piglit_framework_fbo_destroy()
+{
+#ifdef USE_OPENGL
+ glDeleteFramebuffers(1, &piglit_winsys_fbo);
+#endif
+ piglit_winsys_fbo = 0;
+ piglit_framework_fbo_glx_destroy();
+}
+
static bool
piglit_framework_fbo_init()
{
@@ -160,8 +170,8 @@ piglit_framework_fbo_init()
return false;
#endif
- glGenFramebuffers(1, &piglit_fbo);
- glBindFramebuffer(GL_FRAMEBUFFER, piglit_fbo);
+ glGenFramebuffers(1, &piglit_winsys_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
@@ -207,6 +217,12 @@ piglit_framework_fbo_init()
fprintf(stderr,
"-fbo resulted in incomplete FBO, falling back\n");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
+
+ glDeleteTextures(1, &depth);
+ glDeleteTextures(1, &tex);
+
+ piglit_framework_fbo_destroy();
+
return false;
}
@@ -217,12 +233,6 @@ piglit_framework_fbo_init()
}
static void
-piglit_framework_fbo_destroy()
-{
- piglit_framework_fbo_glx_destroy();
-}
-
-static void
delete_arg(char *argv[], int argc, int arg)
{
int i;
diff --git a/tests/util/piglit-framework.h b/tests/util/piglit-framework.h
index 41565be..b7f5d57 100644
--- a/tests/util/piglit-framework.h
+++ b/tests/util/piglit-framework.h
@@ -28,7 +28,9 @@ extern int piglit_automatic;
extern int piglit_window_mode;
extern int piglit_width;
extern int piglit_height;
+extern unsigned int piglit_winsys_fbo;
extern enum piglit_result piglit_display(void);
extern void piglit_init(int argc, char **argv);
extern void piglit_present_results();
+extern void piglit_set_default_fbo(unsigned int target);
--
1.7.6.4
More information about the Piglit
mailing list