[Piglit] [PATCH 14/16] Always bind piglit_winsys_fbo instead of 0

Marek Olšák maraeo at gmail.com
Sun Nov 24 15:52:33 PST 2013


From: Marek Olšák <marek.olsak at amd.com>

---
 tests/fbo/fbo-1d.c                                         |  2 +-
 tests/fbo/fbo-3d.c                                         |  2 +-
 tests/fbo/fbo-alpha.c                                      |  2 +-
 tests/fbo/fbo-alphatest-nocolor-ff.c                       |  2 +-
 tests/fbo/fbo-alphatest-nocolor.c                          |  2 +-
 tests/fbo/fbo-array.c                                      |  2 +-
 tests/fbo/fbo-blit-d24s8.c                                 | 14 +++++++-------
 tests/fbo/fbo-blit-stretch.cpp                             |  2 +-
 tests/fbo/fbo-blit.c                                       | 14 +++++++-------
 tests/fbo/fbo-clearmipmap.c                                |  2 +-
 tests/fbo/fbo-copypix.c                                    | 12 ++++++------
 tests/fbo/fbo-copyteximage-simple.c                        |  2 +-
 tests/fbo/fbo-copyteximage.c                               |  2 +-
 tests/fbo/fbo-cubemap.c                                    |  2 +-
 tests/fbo/fbo-depth-array.c                                |  2 +-
 tests/fbo/fbo-depth-sample-compare.c                       | 10 +++++-----
 tests/fbo/fbo-depthstencil.c                               |  2 +-
 tests/fbo/fbo-depthtex.c                                   |  4 ++--
 tests/fbo/fbo-deriv.c                                      |  6 +++---
 tests/fbo/fbo-drawbuffers-arbfp.c                          |  2 +-
 tests/fbo/fbo-drawbuffers-blend-add.c                      |  2 +-
 tests/fbo/fbo-drawbuffers-fragcolor.c                      |  2 +-
 tests/fbo/fbo-drawbuffers-maxtargets.c                     |  2 +-
 tests/fbo/fbo-drawbuffers.c                                |  2 +-
 tests/fbo/fbo-drawbuffers2-blend.c                         |  2 +-
 tests/fbo/fbo-drawbuffers2-colormask.c                     |  2 +-
 tests/fbo/fbo-flushing-2.c                                 |  2 +-
 tests/fbo/fbo-flushing.c                                   |  4 ++--
 tests/fbo/fbo-fragcoord.c                                  |  2 +-
 tests/fbo/fbo-fragcoord2.c                                 |  2 +-
 tests/fbo/fbo-generatemipmap-array.c                       |  4 ++--
 tests/fbo/fbo-generatemipmap-filtering.c                   |  2 +-
 tests/fbo/fbo-generatemipmap-nonsquare.c                   |  2 +-
 tests/fbo/fbo-generatemipmap-npot.c                        |  2 +-
 tests/fbo/fbo-generatemipmap-scissor.c                     |  2 +-
 tests/fbo/fbo-generatemipmap-viewport.c                    |  4 ++--
 tests/fbo/fbo-generatemipmap.c                             |  2 +-
 tests/fbo/fbo-gl_pointcoord.c                              |  2 +-
 tests/fbo/fbo-incomplete-invalid-texture.c                 |  4 ++--
 tests/fbo/fbo-incomplete.cpp                               |  4 ++--
 tests/fbo/fbo-luminance-alpha.c                            |  2 +-
 tests/fbo/fbo-maxsize.c                                    |  2 +-
 tests/fbo/fbo-mrt-alphatest.c                              |  2 +-
 tests/fbo/fbo-nodepth-test.c                               |  2 +-
 tests/fbo/fbo-nostencil-test.c                             |  2 +-
 tests/fbo/fbo-pbo-readpixels-small.c                       |  2 +-
 tests/fbo/fbo-readdrawpix.c                                | 12 ++++++------
 tests/fbo/fbo-readpixels.c                                 |  2 +-
 tests/fbo/fbo-scissor-bitmap.c                             |  2 +-
 tests/fbo/fbo-scissor-blit.c                               |  2 +-
 tests/fbo/fbo-srgb-blit.c                                  |  2 +-
 tests/fbo/fbo-srgb.c                                       |  6 +++---
 tests/fbo/fbo-viewport.c                                   |  4 ++--
 tests/general/framebuffer-srgb.c                           |  8 ++++----
 tests/general/triangle-rasterization.cpp                   |  4 ++--
 tests/hiz/hiz-util.c                                       | 14 +++++++-------
 tests/security/initialized-fbo.c                           |  4 ++--
 tests/shaders/glsl-bug-22603.c                             |  2 +-
 .../amd_vertex_shader_layer/layered-2d-texture-render.c    |  2 +-
 .../arb_es2_compatibility/fbo-missing-attachment-blit.c    |  4 ++--
 .../occlusion_query_meta_no_fragments.c                    |  6 +++---
 tests/spec/arb_sampler_objects/framebufferblit.c           |  4 ++--
 tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c  |  2 +-
 tests/spec/arb_texture_multisample/sample-position.c       |  2 +-
 tests/spec/ati_draw_buffers/arbfp-no-index.c               |  2 +-
 tests/spec/ati_draw_buffers/arbfp-no-option.c              |  2 +-
 tests/spec/ati_draw_buffers/arbfp.c                        |  2 +-
 tests/spec/ext_framebuffer_multisample/enable-flag.cpp     |  8 ++++----
 tests/spec/ext_framebuffer_multisample/turn-on-off.cpp     |  2 +-
 tests/spec/ext_texture_integer/fbo-blending.c              |  2 +-
 tests/spec/gl-3.2/layered-rendering/blit.c                 | 10 +++++-----
 tests/spec/gl-3.2/layered-rendering/clear-color.c          |  6 +++---
 .../gl-3.2/layered-rendering/framebuffer-layer-complete.c  |  2 +-
 tests/spec/nv_conditional_render/blitframebuffer.c         |  2 +-
 tests/spec/nv_texture_barrier/blending-in-shader.c         |  2 +-
 tests/texturing/depthstencil-render-miplevels.cpp          |  2 +-
 tests/texturing/tex-miplevel-selection.c                   |  2 +-
 tests/util/piglit-util-gl.c                                |  2 +-
 78 files changed, 139 insertions(+), 139 deletions(-)

diff --git a/tests/fbo/fbo-1d.c b/tests/fbo/fbo-1d.c
index 62aa418..0b3c84f 100644
--- a/tests/fbo/fbo-1d.c
+++ b/tests/fbo/fbo-1d.c
@@ -98,7 +98,7 @@ draw_fbo_1d(int x, int y)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_1D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-3d.c b/tests/fbo/fbo-3d.c
index ef032d9..4cd117b 100644
--- a/tests/fbo/fbo-3d.c
+++ b/tests/fbo/fbo-3d.c
@@ -124,7 +124,7 @@ draw_depth(int x, int y, int depth)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_3D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-alpha.c b/tests/fbo/fbo-alpha.c
index d314bd5..1ac65d0 100644
--- a/tests/fbo/fbo-alpha.c
+++ b/tests/fbo/fbo-alpha.c
@@ -116,7 +116,7 @@ piglit_display(void)
 	pass = piglit_probe_pixel_rgba(fbo_width * 7 / 8, 0, fbo_gray) && pass;
 
 	/* Draw the two textures to halves of the window. */
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glViewport(0, 0, piglit_width, piglit_height);
 
 	glEnable(GL_TEXTURE_2D);
diff --git a/tests/fbo/fbo-alphatest-nocolor-ff.c b/tests/fbo/fbo-alphatest-nocolor-ff.c
index 384b693..0d137d7 100644
--- a/tests/fbo/fbo-alphatest-nocolor-ff.c
+++ b/tests/fbo/fbo-alphatest-nocolor-ff.c
@@ -114,7 +114,7 @@ enum piglit_result piglit_display(void)
 	glBindTexture(GL_TEXTURE_2D, tex);
 	glViewport(0, 0, piglit_width, piglit_height);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-alphatest-nocolor.c b/tests/fbo/fbo-alphatest-nocolor.c
index f0fe943..86c7f4d 100644
--- a/tests/fbo/fbo-alphatest-nocolor.c
+++ b/tests/fbo/fbo-alphatest-nocolor.c
@@ -131,7 +131,7 @@ enum piglit_result piglit_display(void)
 	glBindTexture(GL_TEXTURE_2D, tex);
 	glViewport(0, 0, piglit_width, piglit_height);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-array.c b/tests/fbo/fbo-array.c
index 0079217..a424c30 100644
--- a/tests/fbo/fbo-array.c
+++ b/tests/fbo/fbo-array.c
@@ -151,7 +151,7 @@ draw_layer(int x, int y, int depth)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 	glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
diff --git a/tests/fbo/fbo-blit-d24s8.c b/tests/fbo/fbo-blit-d24s8.c
index 946528a..37e8470 100644
--- a/tests/fbo/fbo-blit-d24s8.c
+++ b/tests/fbo/fbo-blit-d24s8.c
@@ -179,7 +179,7 @@ run_test(void)
 	fbo = make_fbo(fbo_width, fbo_height);
 
 	/* query depth/stencil sizes */
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glGetIntegerv(GL_DEPTH_BITS, &win_depth_bits);
 	glGetIntegerv(GL_STENCIL_BITS, &win_stencil_bits);
 
@@ -196,7 +196,7 @@ run_test(void)
 	}
 
 	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo);
-	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glViewport(0, 0, fbo_width, fbo_height);
 	piglit_ortho_projection(fbo_width, fbo_height, GL_FALSE);
 	glClearDepth(0.54321);
@@ -211,7 +211,7 @@ run_test(void)
 	 * Also blit with stencil to exercise this path.
 	 * Not that we need it for this test.
 	 */
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo);
 	copy(x0, y0, x0 + SIZE, y0 + SIZE,
 	     x0, y1, x0 + SIZE, y1 + SIZE,
@@ -222,19 +222,19 @@ run_test(void)
 
 	/* WIN(bottom) -> FBO(middle) */
 	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo);
-	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	copy(x0, y0, x0 + SIZE, y0 + SIZE,
 	     x0, y1, x0 + SIZE, y1 + SIZE,
 	     GL_DEPTH_BUFFER_BIT);
 
 	/* FBO(middle) -> WIN(top) back to verify WIN -> FBO */
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo);
 	copy(x0, y1, x0 + SIZE, y1 + SIZE,
 	     x0, y2, x0 + SIZE, y2 + SIZE,
 	     GL_DEPTH_BUFFER_BIT);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	assert(glGetError() == 0);
 
 	printf("Verify 1\n");
@@ -248,7 +248,7 @@ run_test(void)
 	pass = verify_depth_rect(PAD, y0, SIZE, SIZE) && pass;
 	printf("Verify 5 (FBO)\n");
 	pass = verify_depth_rect(PAD, y1, SIZE, SIZE) && pass;
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	assert(glGetError() == 0);
 
 	piglit_present_results();
diff --git a/tests/fbo/fbo-blit-stretch.cpp b/tests/fbo/fbo-blit-stretch.cpp
index b809a5b..319899c 100644
--- a/tests/fbo/fbo-blit-stretch.cpp
+++ b/tests/fbo/fbo-blit-stretch.cpp
@@ -363,7 +363,7 @@ run_test(const TestCase &test)
 		piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
 		glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 
 		blit(test);
 
diff --git a/tests/fbo/fbo-blit.c b/tests/fbo/fbo-blit.c
index efa0661..8c6dad8 100644
--- a/tests/fbo/fbo-blit.c
+++ b/tests/fbo/fbo-blit.c
@@ -163,7 +163,7 @@ run_test(void)
 	fbo = make_fbo(fbo_width, fbo_height);
 
 	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo);
-	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glViewport(0, 0, fbo_width, fbo_height);
 	piglit_ortho_projection(fbo_width, fbo_height, GL_FALSE);
 	glClearColor(1.0, 0.0, 1.0, 0.0);
@@ -175,25 +175,25 @@ run_test(void)
 	/* Now that we have correct samples, blit things around.
 	 * FBO(bottom) -> WIN(middle)
 	 */
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo);
  	copy(x0, y0, x0 + SIZE, y0 + SIZE,
  	     x0, y1, x0 + SIZE, y1 + SIZE);
 
 	/* WIN(bottom) -> FBO(middle) */
 	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo);
-	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, piglit_winsys_fbo);
  	copy(x0, y0, x0 + SIZE, y0 + SIZE,
  	     x0, y1, x0 + SIZE, y1 + SIZE);
 
 	/* FBO(middle) -> WIN(top) back to verify WIN -> FBO */
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo);
  	copy(x0, y1, x0 + SIZE, y1 + SIZE,
  	     x0, y2, x0 + SIZE, y2 + SIZE);
 
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	pass = verify_color_rect(PAD, y0, SIZE, SIZE) && pass;
 	pass = verify_color_rect(PAD, y1, SIZE, SIZE) && pass;
@@ -201,7 +201,7 @@ run_test(void)
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
 	pass = verify_color_rect(PAD, y0, SIZE, SIZE) && pass;
 	pass = verify_color_rect(PAD, y1, SIZE, SIZE) && pass;
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	piglit_present_results();
 
diff --git a/tests/fbo/fbo-clearmipmap.c b/tests/fbo/fbo-clearmipmap.c
index 80031d7..086a454 100644
--- a/tests/fbo/fbo-clearmipmap.c
+++ b/tests/fbo/fbo-clearmipmap.c
@@ -118,7 +118,7 @@ draw_mipmap(int x, int y, int dim)
 
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-copypix.c b/tests/fbo/fbo-copypix.c
index 9b83890..e6e841d 100644
--- a/tests/fbo/fbo-copypix.c
+++ b/tests/fbo/fbo-copypix.c
@@ -162,7 +162,7 @@ run_test(void)
 	fbo = make_fbo(fbo_width, fbo_height);
 
 	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo);
-	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glViewport(0, 0, fbo_width, fbo_height);
 	piglit_ortho_projection(fbo_width, fbo_height, GL_FALSE);
 	glClearColor(1.0, 0.0, 1.0, 0.0);
@@ -174,25 +174,25 @@ run_test(void)
 	/* Now that we have correct samples, blit things around.
 	 * FBO(bottom) -> WIN(middle)
 	 */
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo);
  	copy(x0, y0, x0 + SIZE, y0 + SIZE,
  	     x0, y1, x0 + SIZE, y1 + SIZE);
 
 	/* WIN(bottom) -> FBO(middle) */
 	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo);
-	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, piglit_winsys_fbo);
  	copy(x0, y0, x0 + SIZE, y0 + SIZE,
  	     x0, y1, x0 + SIZE, y1 + SIZE);
 
 	/* FBO(middle) -> WIN(top) back to verify WIN -> FBO */
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo);
  	copy(x0, y1, x0 + SIZE, y1 + SIZE,
  	     x0, y2, x0 + SIZE, y2 + SIZE);
 
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	pass = verify_color_rect(PAD, y0, SIZE, SIZE) && pass;
 	pass = verify_color_rect(PAD, y1, SIZE, SIZE) && pass;
diff --git a/tests/fbo/fbo-copyteximage-simple.c b/tests/fbo/fbo-copyteximage-simple.c
index 8be54ac..90dab40 100644
--- a/tests/fbo/fbo-copyteximage-simple.c
+++ b/tests/fbo/fbo-copyteximage-simple.c
@@ -123,7 +123,7 @@ piglit_display(void)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-copyteximage.c b/tests/fbo/fbo-copyteximage.c
index e748c2b..abd8057 100644
--- a/tests/fbo/fbo-copyteximage.c
+++ b/tests/fbo/fbo-copyteximage.c
@@ -125,7 +125,7 @@ piglit_display(void)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-cubemap.c b/tests/fbo/fbo-cubemap.c
index 157b6fb..3bb7549 100644
--- a/tests/fbo/fbo-cubemap.c
+++ b/tests/fbo/fbo-cubemap.c
@@ -131,7 +131,7 @@ draw_face(int x, int y, int dim, int face)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_CUBE_MAP);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-depth-array.c b/tests/fbo/fbo-depth-array.c
index 492ae56..f89e6e5 100644
--- a/tests/fbo/fbo-depth-array.c
+++ b/tests/fbo/fbo-depth-array.c
@@ -174,7 +174,7 @@ draw_layer(int x, int y, int depth)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 	glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
diff --git a/tests/fbo/fbo-depth-sample-compare.c b/tests/fbo/fbo-depth-sample-compare.c
index 1e925bb..b9ec27f 100644
--- a/tests/fbo/fbo-depth-sample-compare.c
+++ b/tests/fbo/fbo-depth-sample-compare.c
@@ -259,7 +259,7 @@ render_to_fbo(void)
 
    glDisable(GL_DEPTH_TEST);
 
-   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 }
 
 
@@ -298,7 +298,7 @@ show_depth_fbo(void)
    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBO);
    zf = read_float_z_image(0, 0);
 
-   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
    glWindowPos2i(SIZE, 0);
    glDrawPixels(SIZE, SIZE, GL_LUMINANCE, GL_FLOAT, zf);
@@ -317,7 +317,7 @@ show_depth_fbo(void)
 
       glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBO);
       zi = read_uint_z_image(0, 0);
-      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
       find_uint_min_max_center(zi, SIZE * SIZE, &min, &max, &center);
       printf("depth fbo min 0x%x  max 0x%x  center 0x%x\n", min, max, center);
@@ -343,7 +343,7 @@ draw_quad_with_depth_texture(void)
       t1 = SIZE;
    }
 
-   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 
@@ -382,7 +382,7 @@ draw_quad_with_depth_texture(void)
 static void
 draw_sphere_with_fragment_shader_compare(void)
 {
-   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
    glViewport(0 * SIZE, 0, SIZE, SIZE);
 
diff --git a/tests/fbo/fbo-depthstencil.c b/tests/fbo/fbo-depthstencil.c
index e4a8e00..ae91186 100644
--- a/tests/fbo/fbo-depthstencil.c
+++ b/tests/fbo/fbo-depthstencil.c
@@ -123,7 +123,7 @@ static enum piglit_result test_clear(void)
 
 	/* Display the colorbuffer. */
 	if (!piglit_automatic && f.iformat) {
-		glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+		glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 		glBlitFramebufferEXT(0, 0, BUF_SIZE, BUF_SIZE, 0, 0, BUF_SIZE, BUF_SIZE,
 				     GL_COLOR_BUFFER_BIT, GL_NEAREST);
 	}
diff --git a/tests/fbo/fbo-depthtex.c b/tests/fbo/fbo-depthtex.c
index 1596055..69aa4b3 100644
--- a/tests/fbo/fbo-depthtex.c
+++ b/tests/fbo/fbo-depthtex.c
@@ -113,7 +113,7 @@ enum piglit_result piglit_display(void)
 
 	/* Draw with the texture to make sure a sampler view is created for
 	 * it before it's used as depth buffer by the FBO. */
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glBindTexture(GL_TEXTURE_2D, db_tex);
 	glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, frag);
 	glEnable(GL_FRAGMENT_PROGRAM_ARB);
@@ -140,7 +140,7 @@ enum piglit_result piglit_display(void)
 	glEnd();
 
 	/* Draw the depth texture as greyscale to the backbuffer. */
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glEnable(GL_FRAGMENT_PROGRAM_ARB);
 	glEnable(GL_TEXTURE_2D);
 	piglit_draw_rect_tex(-1.0f, -1.0f, 2.0f, 2.0f,
diff --git a/tests/fbo/fbo-deriv.c b/tests/fbo/fbo-deriv.c
index 7b923a7..3a5d239 100644
--- a/tests/fbo/fbo-deriv.c
+++ b/tests/fbo/fbo-deriv.c
@@ -129,7 +129,7 @@ piglit_display(void)
 	glUseProgram(prog);
 
 	/* Draw a square to the left half of the window */
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_draw_rect(-1, -1, 1, 2);
 
@@ -140,13 +140,13 @@ piglit_display(void)
 
 	/* Blit the square from the FBO to the right half of the window */
 	glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glBlitFramebuffer(0, 0, fbo_width, fbo_height,
 			  piglit_width/2, 0, piglit_width, piglit_height,
 			  GL_COLOR_BUFFER_BIT, GL_NEAREST);
 
 	/* Check that both squares have the correct color */
-	glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
 	pass = piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height,
 				     expected) && pass;
 
diff --git a/tests/fbo/fbo-drawbuffers-arbfp.c b/tests/fbo/fbo-drawbuffers-arbfp.c
index fc55160..12bb895 100644
--- a/tests/fbo/fbo-drawbuffers-arbfp.c
+++ b/tests/fbo/fbo-drawbuffers-arbfp.c
@@ -114,7 +114,7 @@ piglit_display(void)
 	piglit_draw_rect(0, 0, piglit_width, piglit_height);
         glDisable(GL_FRAGMENT_PROGRAM_ARB);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	/* Draw the two green textures to halves of the window. */
 	glEnable(GL_TEXTURE_2D);
diff --git a/tests/fbo/fbo-drawbuffers-blend-add.c b/tests/fbo/fbo-drawbuffers-blend-add.c
index e7b61c1..16313ab 100644
--- a/tests/fbo/fbo-drawbuffers-blend-add.c
+++ b/tests/fbo/fbo-drawbuffers-blend-add.c
@@ -171,7 +171,7 @@ generate_and_display_drawbuffers(int count)
 	
 	/* OK, now draw each of these textures to the winsys framebuffer. */
 	glUseProgram(0);
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 	glEnable(GL_TEXTURE_2D);
diff --git a/tests/fbo/fbo-drawbuffers-fragcolor.c b/tests/fbo/fbo-drawbuffers-fragcolor.c
index e8c3857..1d79bee 100644
--- a/tests/fbo/fbo-drawbuffers-fragcolor.c
+++ b/tests/fbo/fbo-drawbuffers-fragcolor.c
@@ -126,7 +126,7 @@ generate_and_display_drawbuffers(int count)
 
 	/* OK, now draw each of these textures to the winsys framebuffer. */
 	glUseProgram(0);
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 	glEnable(GL_TEXTURE_2D);
diff --git a/tests/fbo/fbo-drawbuffers-maxtargets.c b/tests/fbo/fbo-drawbuffers-maxtargets.c
index 3c38809..de12330 100644
--- a/tests/fbo/fbo-drawbuffers-maxtargets.c
+++ b/tests/fbo/fbo-drawbuffers-maxtargets.c
@@ -161,7 +161,7 @@ generate_and_display_drawbuffers(int count)
 
 	/* OK, now draw each of these textures to the winsys framebuffer. */
 	glUseProgram(0);
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 	glEnable(GL_TEXTURE_2D);
diff --git a/tests/fbo/fbo-drawbuffers.c b/tests/fbo/fbo-drawbuffers.c
index 21ea894..d092b4a 100644
--- a/tests/fbo/fbo-drawbuffers.c
+++ b/tests/fbo/fbo-drawbuffers.c
@@ -121,7 +121,7 @@ piglit_display(void)
 		expected = green;
 	}
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	/* Draw the two green textures to halves of the window. */
 	glEnable(GL_TEXTURE_2D);
diff --git a/tests/fbo/fbo-drawbuffers2-blend.c b/tests/fbo/fbo-drawbuffers2-blend.c
index 724e7c8..acd4b2e 100644
--- a/tests/fbo/fbo-drawbuffers2-blend.c
+++ b/tests/fbo/fbo-drawbuffers2-blend.c
@@ -110,7 +110,7 @@ piglit_display(void)
 	glColor4fv(green);
 	piglit_draw_rect(0, 0, piglit_width, piglit_height);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glDisable(GL_BLEND);
 
 	/* Draw the two textures to halves of the window. */
diff --git a/tests/fbo/fbo-drawbuffers2-colormask.c b/tests/fbo/fbo-drawbuffers2-colormask.c
index f56cfd7..f0eb67f 100644
--- a/tests/fbo/fbo-drawbuffers2-colormask.c
+++ b/tests/fbo/fbo-drawbuffers2-colormask.c
@@ -115,7 +115,7 @@ piglit_display(void)
 		piglit_draw_rect(0, 0, piglit_width, piglit_height);
 	}
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
 
 	/* Draw the two textures to halves of the window. */
diff --git a/tests/fbo/fbo-flushing-2.c b/tests/fbo/fbo-flushing-2.c
index 83f601f..c3ec5c9 100644
--- a/tests/fbo/fbo-flushing-2.c
+++ b/tests/fbo/fbo-flushing-2.c
@@ -95,7 +95,7 @@ piglit_display(void)
 			glColor4fv(draw_colors[draw_green]);
 			piglit_draw_rect(-1, -1, 2, 2);
 
-			glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+			glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 			glEnable(GL_TEXTURE_2D);
 			piglit_draw_rect_tex(x_screen, y_screen,
 					     w_screen, h_screen,
diff --git a/tests/fbo/fbo-flushing.c b/tests/fbo/fbo-flushing.c
index db2cd66..cc20153 100644
--- a/tests/fbo/fbo-flushing.c
+++ b/tests/fbo/fbo-flushing.c
@@ -97,7 +97,7 @@ piglit_display(void)
 		piglit_ortho_projection(TEX_WIDTH, TEX_HEIGHT, GL_FALSE);
 		piglit_draw_rect(0, y, size, size);
 
-		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 		glEnable(GL_TEXTURE_2D);
 		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
  		piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
@@ -109,7 +109,7 @@ piglit_display(void)
 		piglit_ortho_projection(TEX_WIDTH, TEX_HEIGHT, GL_FALSE);
 		piglit_draw_rect(0, y, size, size);
 
-		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 		glEnable(GL_TEXTURE_2D);
 		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
  		piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
diff --git a/tests/fbo/fbo-fragcoord.c b/tests/fbo/fbo-fragcoord.c
index 79cfef8..71c13a6 100644
--- a/tests/fbo/fbo-fragcoord.c
+++ b/tests/fbo/fbo-fragcoord.c
@@ -104,7 +104,7 @@ piglit_display(void)
 	piglit_draw_rect(-1, -1, 2, 2);
 
 	/* Draw the FBO to the screen. */
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glViewport(0, 0, piglit_width, piglit_height);
 
 	glClearColor(0.0, 0.0, 1.0, 0.0);
diff --git a/tests/fbo/fbo-fragcoord2.c b/tests/fbo/fbo-fragcoord2.c
index b583f62..21f1413 100644
--- a/tests/fbo/fbo-fragcoord2.c
+++ b/tests/fbo/fbo-fragcoord2.c
@@ -166,7 +166,7 @@ test(void)
       buf = malloc(piglit_width * piglit_height * 4);
       glReadPixels(0, 0, piglit_width, piglit_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
 
-      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
       glDrawBuffer(GL_BACK);
       glClear(GL_COLOR_BUFFER_BIT);
       glDrawPixels(piglit_width, piglit_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
diff --git a/tests/fbo/fbo-generatemipmap-array.c b/tests/fbo/fbo-generatemipmap-array.c
index d907d48..837523c 100644
--- a/tests/fbo/fbo-generatemipmap-array.c
+++ b/tests/fbo/fbo-generatemipmap-array.c
@@ -262,7 +262,7 @@ draw_mipmap_2d(int x, int y, int dim, int layer)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
 	glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -284,7 +284,7 @@ draw_mipmap_1d(int x, int y, int dim, int layer)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glTexParameteri(GL_TEXTURE_1D_ARRAY_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
 	glTexParameteri(GL_TEXTURE_1D_ARRAY_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
diff --git a/tests/fbo/fbo-generatemipmap-filtering.c b/tests/fbo/fbo-generatemipmap-filtering.c
index af4a41a..33f3237 100644
--- a/tests/fbo/fbo-generatemipmap-filtering.c
+++ b/tests/fbo/fbo-generatemipmap-filtering.c
@@ -89,7 +89,7 @@ draw_mipmap(int x, int y, int dim)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-generatemipmap-nonsquare.c b/tests/fbo/fbo-generatemipmap-nonsquare.c
index e703149..5b00001 100644
--- a/tests/fbo/fbo-generatemipmap-nonsquare.c
+++ b/tests/fbo/fbo-generatemipmap-nonsquare.c
@@ -114,7 +114,7 @@ draw_mipmap(int x, int y, int dim)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-generatemipmap-npot.c b/tests/fbo/fbo-generatemipmap-npot.c
index 5fa85e7..07b0d2f 100644
--- a/tests/fbo/fbo-generatemipmap-npot.c
+++ b/tests/fbo/fbo-generatemipmap-npot.c
@@ -108,7 +108,7 @@ draw_mipmap(int x, int y, int dim)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-generatemipmap-scissor.c b/tests/fbo/fbo-generatemipmap-scissor.c
index d5822f9..8d78c1f 100644
--- a/tests/fbo/fbo-generatemipmap-scissor.c
+++ b/tests/fbo/fbo-generatemipmap-scissor.c
@@ -114,7 +114,7 @@ draw_mipmap(int x, int y, int dim)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-generatemipmap-viewport.c b/tests/fbo/fbo-generatemipmap-viewport.c
index ea7d334..d46f6c9 100644
--- a/tests/fbo/fbo-generatemipmap-viewport.c
+++ b/tests/fbo/fbo-generatemipmap-viewport.c
@@ -98,7 +98,7 @@ create_fbo(void)
 	piglit_draw_rect(TEX_WIDTH / 2, TEX_HEIGHT / 2, TEX_WIDTH, TEX_HEIGHT);
 
 	/* Bind back to the (small) window to trigger the bug */
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glGenerateMipmapEXT(GL_TEXTURE_2D);
 done:
@@ -113,7 +113,7 @@ draw_mipmap(int x, int y, int dim)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-generatemipmap.c b/tests/fbo/fbo-generatemipmap.c
index c1bc456..df5ae98 100644
--- a/tests/fbo/fbo-generatemipmap.c
+++ b/tests/fbo/fbo-generatemipmap.c
@@ -108,7 +108,7 @@ draw_mipmap(int x, int y, int dim)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-gl_pointcoord.c b/tests/fbo/fbo-gl_pointcoord.c
index e5392d1..09b5b88 100644
--- a/tests/fbo/fbo-gl_pointcoord.c
+++ b/tests/fbo/fbo-gl_pointcoord.c
@@ -89,7 +89,7 @@ piglit_display(void)
 
 	/* Draw the point out if want to have a look. */
 	if (!piglit_automatic){
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 		glClear(GL_COLOR_BUFFER_BIT);
 		glBlitFramebuffer(0, 0, rb_size, rb_size,
 				  0, 0, rb_size, rb_size,
diff --git a/tests/fbo/fbo-incomplete-invalid-texture.c b/tests/fbo/fbo-incomplete-invalid-texture.c
index 017f90b..5c63fac 100644
--- a/tests/fbo/fbo-incomplete-invalid-texture.c
+++ b/tests/fbo/fbo-incomplete-invalid-texture.c
@@ -87,7 +87,7 @@ piglit_init(int argc, char **argv)
 	/* Unbind and rebind the FBO.  At one point on Mesa this triggered a
 	 * segfault down inside the glBindFramebuffer code.
 	 */
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
 
 	status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
@@ -104,7 +104,7 @@ piglit_init(int argc, char **argv)
 
 cleanup:
 	glBindTexture(GL_TEXTURE_2D, 0);
-	glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
 
 	glDeleteTextures(1, &tex);
 	glDeleteFramebuffers(1, &fbo);
diff --git a/tests/fbo/fbo-incomplete.cpp b/tests/fbo/fbo-incomplete.cpp
index d4f4f9d..292139c 100644
--- a/tests/fbo/fbo-incomplete.cpp
+++ b/tests/fbo/fbo-incomplete.cpp
@@ -67,8 +67,8 @@ public:
 		else
 			glBindTexture(target, 0);
 
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
-		glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
+		glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
 
 		glDeleteTextures(1, &tex);
 		glDeleteRenderbuffers(1, &rb);
diff --git a/tests/fbo/fbo-luminance-alpha.c b/tests/fbo/fbo-luminance-alpha.c
index 619b57a..dd6ee0a 100644
--- a/tests/fbo/fbo-luminance-alpha.c
+++ b/tests/fbo/fbo-luminance-alpha.c
@@ -126,7 +126,7 @@ piglit_display(void)
 	pass = piglit_probe_pixel_rgba(fbo_width * 7 / 8, 0, fbo_blend2) && pass;
 
 	/* Draw the two textures to halves of the window. */
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glViewport(0, 0, piglit_width, piglit_height);
 
 	glColor4f(1, 1, 1, 1);
diff --git a/tests/fbo/fbo-maxsize.c b/tests/fbo/fbo-maxsize.c
index bda242c..8bab9c8 100644
--- a/tests/fbo/fbo-maxsize.c
+++ b/tests/fbo/fbo-maxsize.c
@@ -207,7 +207,7 @@ piglit_display(void)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/fbo/fbo-mrt-alphatest.c b/tests/fbo/fbo-mrt-alphatest.c
index 78a4f7d..3c703c3 100644
--- a/tests/fbo/fbo-mrt-alphatest.c
+++ b/tests/fbo/fbo-mrt-alphatest.c
@@ -120,7 +120,7 @@ piglit_display(void)
 
 	/* visualize it */
 	glUseProgram(0);
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	glViewport(0, 0, 128, 64);
 	glClearColor(0,0,0.5,0);
 	glClear(GL_COLOR_BUFFER_BIT);
diff --git a/tests/fbo/fbo-nodepth-test.c b/tests/fbo/fbo-nodepth-test.c
index 6c92132..f46f755 100644
--- a/tests/fbo/fbo-nodepth-test.c
+++ b/tests/fbo/fbo-nodepth-test.c
@@ -85,7 +85,7 @@ piglit_display(void)
 	pass = pass && piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, green);
 
 	glDisable(GL_DEPTH_TEST);
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 	piglit_draw_rect_tex(0, 0, piglit_width, piglit_height,
diff --git a/tests/fbo/fbo-nostencil-test.c b/tests/fbo/fbo-nostencil-test.c
index ad13b3c..b470768 100644
--- a/tests/fbo/fbo-nostencil-test.c
+++ b/tests/fbo/fbo-nostencil-test.c
@@ -85,7 +85,7 @@ piglit_display(void)
 	pass = pass && piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, green);
 
 	glDisable(GL_STENCIL_TEST);
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 	piglit_draw_rect_tex(0, 0, piglit_width, piglit_height,
diff --git a/tests/fbo/fbo-pbo-readpixels-small.c b/tests/fbo/fbo-pbo-readpixels-small.c
index 8c0ebb0..1f47443 100644
--- a/tests/fbo/fbo-pbo-readpixels-small.c
+++ b/tests/fbo/fbo-pbo-readpixels-small.c
@@ -143,7 +143,7 @@ piglit_display(void)
 
 	glDeleteBuffersARB(1, &pbo);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
diff --git a/tests/fbo/fbo-readdrawpix.c b/tests/fbo/fbo-readdrawpix.c
index 8c86cc6..6263161 100644
--- a/tests/fbo/fbo-readdrawpix.c
+++ b/tests/fbo/fbo-readdrawpix.c
@@ -165,7 +165,7 @@ run_test(void)
 	fbo = make_fbo(fbo_width, fbo_height);
 
 	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo);
-	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glViewport(0, 0, fbo_width, fbo_height);
 	piglit_ortho_projection(fbo_width, fbo_height, GL_FALSE);
 	glClearColor(1.0, 0.0, 1.0, 0.0);
@@ -177,25 +177,25 @@ run_test(void)
 	/* Now that we have correct samples, blit things around.
 	 * FBO(bottom) -> WIN(middle)
 	 */
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo);
  	copy(x0, y0, x0 + SIZE, y0 + SIZE,
  	     x0, y1, x0 + SIZE, y1 + SIZE);
 
 	/* WIN(bottom) -> FBO(middle) */
 	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo);
-	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, piglit_winsys_fbo);
  	copy(x0, y0, x0 + SIZE, y0 + SIZE,
  	     x0, y1, x0 + SIZE, y1 + SIZE);
 
 	/* FBO(middle) -> WIN(top) back to verify WIN -> FBO */
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo);
  	copy(x0, y1, x0 + SIZE, y1 + SIZE,
  	     x0, y2, x0 + SIZE, y2 + SIZE);
 
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	pass = verify_color_rect(PAD, y0, SIZE, SIZE) && pass;
 	pass = verify_color_rect(PAD, y1, SIZE, SIZE) && pass;
diff --git a/tests/fbo/fbo-readpixels.c b/tests/fbo/fbo-readpixels.c
index b75d1c4..25c39ef 100644
--- a/tests/fbo/fbo-readpixels.c
+++ b/tests/fbo/fbo-readpixels.c
@@ -167,7 +167,7 @@ test_with_format(GLenum internal_format, GLenum format,
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 
diff --git a/tests/fbo/fbo-scissor-bitmap.c b/tests/fbo/fbo-scissor-bitmap.c
index 8fa4c8a..b6e2e9e 100644
--- a/tests/fbo/fbo-scissor-bitmap.c
+++ b/tests/fbo/fbo-scissor-bitmap.c
@@ -370,7 +370,7 @@ piglit_display()
 
 	pass &= draw_and_test("FBO", fbo_width, fbo_height);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	display_texture_to_window(texture);
 
diff --git a/tests/fbo/fbo-scissor-blit.c b/tests/fbo/fbo-scissor-blit.c
index f1de2b3..844e062 100644
--- a/tests/fbo/fbo-scissor-blit.c
+++ b/tests/fbo/fbo-scissor-blit.c
@@ -181,7 +181,7 @@ piglit_display(void)
 	if (dst_fbo != 0) {
 		/* Show the contents of dst_fbo in the window */
 		glBindFramebuffer(GL_READ_FRAMEBUFFER, dst_fbo);
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 		glBlitFramebuffer(0, 0, width, height,
 				  0, 0, width, height,
 				  GL_COLOR_BUFFER_BIT, GL_NEAREST);
diff --git a/tests/fbo/fbo-srgb-blit.c b/tests/fbo/fbo-srgb-blit.c
index efc0d44..105a82e 100644
--- a/tests/fbo/fbo-srgb-blit.c
+++ b/tests/fbo/fbo-srgb-blit.c
@@ -76,7 +76,7 @@ static void blit_rect(GLenum src_format, GLenum dst_format, float x, float y, fl
 		glBlitFramebufferEXT(8, 0, 16, 16, 8, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_LINEAR);
 	}
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glBindTexture(GL_TEXTURE_2D, dst_tex);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
diff --git a/tests/fbo/fbo-srgb.c b/tests/fbo/fbo-srgb.c
index 3ab2200..bd2741e 100644
--- a/tests/fbo/fbo-srgb.c
+++ b/tests/fbo/fbo-srgb.c
@@ -92,7 +92,7 @@ draw_fbo(int x, int y)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
@@ -159,8 +159,8 @@ framebuffer_srgb_fbo(int srgb_format)
 	if (!piglit_probe_rect_rgb(20, 0, 20, 20, expected_blend))
 		pass = GL_FALSE;
 
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
-	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
+	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	
 	draw_fbo(0, 0);
 
diff --git a/tests/fbo/fbo-viewport.c b/tests/fbo/fbo-viewport.c
index 8a0812f..89ee71e 100644
--- a/tests/fbo/fbo-viewport.c
+++ b/tests/fbo/fbo-viewport.c
@@ -133,7 +133,7 @@ piglit_display(void)
 			 GL_FRAMEBUFFER_COMPLETE_EXT);
 
 	/* draw reference image in the window */
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	draw_test_image();
 	glReadPixels(0, 0, piglit_width, piglit_height,
 		     GL_RGB, GL_UNSIGNED_BYTE, win_image);
@@ -162,7 +162,7 @@ piglit_display(void)
 		printf("Image comparison passed.\n");
 	}
 
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 
 #if 0	/* for debug/compare (alternate diplaying Window vs. FBO image) */
 	{
diff --git a/tests/general/framebuffer-srgb.c b/tests/general/framebuffer-srgb.c
index a140dda..39bb1b0 100644
--- a/tests/general/framebuffer-srgb.c
+++ b/tests/general/framebuffer-srgb.c
@@ -263,7 +263,7 @@ draw_fbo(int x, int y)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
@@ -296,9 +296,9 @@ framebuffer_srgb_fbo(void)
 
 	pass = test_srgb();
 
-	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
-	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, piglit_winsys_fbo);
+	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, piglit_winsys_fbo);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	draw_fbo(0, 0);
 	piglit_present_results();
diff --git a/tests/general/triangle-rasterization.cpp b/tests/general/triangle-rasterization.cpp
index 98fa959..d006188 100644
--- a/tests/general/triangle-rasterization.cpp
+++ b/tests/general/triangle-rasterization.cpp
@@ -594,7 +594,7 @@ piglit_display(void)
 
 		/* If using FBO, draw the fbo to screen */
 		if (use_fbo) {
-			glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+			glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 			glViewport(0, 0, piglit_width, piglit_height);
 			piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
@@ -618,7 +618,7 @@ piglit_display(void)
 	if (use_fbo) {
 		glDeleteTextures(1, &tex);
 		glDeleteFramebuffersEXT(1, &fb);
-		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	}
 
 	assert(glGetError() == 0);
diff --git a/tests/hiz/hiz-util.c b/tests/hiz/hiz-util.c
index 6c6404e..83bb671 100644
--- a/tests/hiz/hiz-util.c
+++ b/tests/hiz/hiz-util.c
@@ -178,8 +178,8 @@ hiz_delete_fbo(GLuint fbo)
 
 	glDeleteFramebuffers(1, &fbo);
 
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
-	glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
+	glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
 
  	if (!piglit_check_gl_error(0))
 		piglit_report_result(PIGLIT_FAIL);
@@ -254,7 +254,7 @@ hiz_run_test_depth_test_fbo(const struct hiz_fbo_options *fbo_options)
 
 	if (!piglit_automatic) {
 		/* Blit the FBO to the window FB so we can see the results. */
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 		glBlitFramebuffer(0, 0, piglit_width, piglit_height,
 			          0, 0, piglit_width, piglit_height,
 			          GL_COLOR_BUFFER_BIT, GL_NEAREST);
@@ -358,7 +358,7 @@ hiz_run_test_depth_read_fbo(const struct hiz_fbo_options *fbo_options)
 
 	if (!piglit_automatic) {
 		/* Blit the FBO to the window FB so we can see the results. */
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 		glBlitFramebuffer(0, 0, piglit_width, piglit_height,
 			          0, 0, piglit_width, piglit_height,
 			          GL_COLOR_BUFFER_BIT, GL_NEAREST);
@@ -465,7 +465,7 @@ hiz_run_test_stencil_test_fbo(const struct hiz_fbo_options *fbo_options)
 
 	if (!piglit_automatic) {
 		/* Blit the FBO to the window FB so we can see the results. */
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 		glBlitFramebuffer(0, 0, piglit_width, piglit_height,
 			          0, 0, piglit_width, piglit_height,
 			          GL_COLOR_BUFFER_BIT, GL_NEAREST);
@@ -580,7 +580,7 @@ hiz_run_test_stencil_read_fbo(const struct hiz_fbo_options *fbo_options)
 
 	if (!piglit_automatic) {
 		/* Blit the FBO to the window FB so we can see the results. */
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 		glBlitFramebuffer(0, 0, piglit_width, piglit_height,
 			          0, 0, piglit_width, piglit_height,
 			          GL_COLOR_BUFFER_BIT, GL_NEAREST);
@@ -704,7 +704,7 @@ hiz_run_test_depth_stencil_test_fbo(const struct hiz_fbo_options *fbo_options)
 
 	if (!piglit_automatic) {
 		/* Blit the FBO to the window FB so we can see the results. */
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 		glBlitFramebuffer(0, 0, piglit_width, piglit_height,
 			          0, 0, piglit_width, piglit_height,
 			          GL_COLOR_BUFFER_BIT, GL_NEAREST);
diff --git a/tests/security/initialized-fbo.c b/tests/security/initialized-fbo.c
index d8503aa..91c7fa0 100644
--- a/tests/security/initialized-fbo.c
+++ b/tests/security/initialized-fbo.c
@@ -59,7 +59,7 @@ piglit_display(void)
 	/* read from fbo, draw to window */
 	glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
 	glReadBuffer(GL_COLOR_ATTACHMENT0);
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glDrawBuffer(GL_BACK);
 
         /* init color buffer to red */
@@ -70,7 +70,7 @@ piglit_display(void)
 	glWindowPos2i(0, 0);
 	glCopyPixels(0, 0, piglit_width, piglit_height, GL_COLOR);
 
-	glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
 	glReadBuffer(GL_BACK);
 
 	glReadPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, firstPixel);
diff --git a/tests/shaders/glsl-bug-22603.c b/tests/shaders/glsl-bug-22603.c
index 9a68610..dabfb01 100644
--- a/tests/shaders/glsl-bug-22603.c
+++ b/tests/shaders/glsl-bug-22603.c
@@ -124,7 +124,7 @@ piglit_display(void)
 	glEnd();
 
 	/* bind back the backbuffer and display the depthmap */
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glViewport(0, 0, 600, 600);
 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
diff --git a/tests/spec/amd_vertex_shader_layer/layered-2d-texture-render.c b/tests/spec/amd_vertex_shader_layer/layered-2d-texture-render.c
index 7c48295..2cd5d68 100644
--- a/tests/spec/amd_vertex_shader_layer/layered-2d-texture-render.c
+++ b/tests/spec/amd_vertex_shader_layer/layered-2d-texture-render.c
@@ -176,7 +176,7 @@ render_tex_layers(GLuint tex)
 		color_index += LAYERS;
 	}
 	glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0);
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	glDisableVertexAttribArray(vertex_loc);
 
 	return true;
diff --git a/tests/spec/arb_es2_compatibility/fbo-missing-attachment-blit.c b/tests/spec/arb_es2_compatibility/fbo-missing-attachment-blit.c
index dd95d9e..ad65fc5 100644
--- a/tests/spec/arb_es2_compatibility/fbo-missing-attachment-blit.c
+++ b/tests/spec/arb_es2_compatibility/fbo-missing-attachment-blit.c
@@ -183,8 +183,8 @@ do_blit_test(bool use_es2, bool from_missing_to_complete)
 				       0.0)
 		&& pass;
 
-	glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glDeleteFramebuffers(ARRAY_SIZE(fb), fb);
 	glDeleteRenderbuffers(ARRAY_SIZE(rb), rb);
 
diff --git a/tests/spec/arb_occlusion_query/occlusion_query_meta_no_fragments.c b/tests/spec/arb_occlusion_query/occlusion_query_meta_no_fragments.c
index 33da98d..dca54a6 100644
--- a/tests/spec/arb_occlusion_query/occlusion_query_meta_no_fragments.c
+++ b/tests/spec/arb_occlusion_query/occlusion_query_meta_no_fragments.c
@@ -133,11 +133,11 @@ piglit_display(void)
 					  0);
 
 		glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 		glBlitFramebuffer(0, 0, 2, 2,
 				  2, 2, 20, 20,
 				  GL_COLOR_BUFFER_BIT, GL_NEAREST);
-		glBindFramebuffer(GL_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	}
 	glEndQuery(GL_SAMPLES_PASSED);
 	test_pass &= verify_no_fragments(query, "glBlitFramebuffer");
@@ -169,7 +169,7 @@ piglit_display(void)
 		glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
 		glCopyTexSubImage2D(GL_TEXTURE_2D, 0,
 				    1, 1, 0, 0, 1, 1);
-		glBindFramebuffer(GL_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	}
 	glEndQuery(GL_SAMPLES_PASSED);
 	test_pass &= verify_no_fragments(query, "glCopyTexImage2D");
diff --git a/tests/spec/arb_sampler_objects/framebufferblit.c b/tests/spec/arb_sampler_objects/framebufferblit.c
index 7814982..f8dd51b 100644
--- a/tests/spec/arb_sampler_objects/framebufferblit.c
+++ b/tests/spec/arb_sampler_objects/framebufferblit.c
@@ -79,12 +79,12 @@ piglit_display(void)
 	glBindSampler(0, sampler);
 
 	glBindFramebuffer(GL_READ_FRAMEBUFFER, fb);
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glBlitFramebuffer(0, 0, 1, 1,
 			  0, 0, piglit_width, piglit_height,
 			  GL_COLOR_BUFFER_BIT, GL_NEAREST);
 
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
 	piglit_present_results();
 
diff --git a/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c b/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c
index 9371a46..d7996c3 100644
--- a/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c
+++ b/tests/spec/arb_texture_cube_map_array/fbo-cubemap-array.c
@@ -168,7 +168,7 @@ draw_layer(int x, int y, int layerface)
 	glViewport(0, 0, piglit_width, piglit_height);
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 	glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
diff --git a/tests/spec/arb_texture_multisample/sample-position.c b/tests/spec/arb_texture_multisample/sample-position.c
index 48e82c7..d9119d7 100644
--- a/tests/spec/arb_texture_multisample/sample-position.c
+++ b/tests/spec/arb_texture_multisample/sample-position.c
@@ -84,7 +84,7 @@ read_samples(int step, int axis)
 {
 	int index = step + axis * NUM_STEPS;
 
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 
 	glUseProgram(prog_rd);
 
diff --git a/tests/spec/ati_draw_buffers/arbfp-no-index.c b/tests/spec/ati_draw_buffers/arbfp-no-index.c
index fa8218a..6db7115 100644
--- a/tests/spec/ati_draw_buffers/arbfp-no-index.c
+++ b/tests/spec/ati_draw_buffers/arbfp-no-index.c
@@ -123,7 +123,7 @@ piglit_display(void)
 	piglit_draw_rect(0, 0, piglit_width, piglit_height);
         glDisable(GL_FRAGMENT_PROGRAM_ARB);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	/* Draw the two green textures to halves of the window. */
 	glEnable(GL_TEXTURE_2D);
diff --git a/tests/spec/ati_draw_buffers/arbfp-no-option.c b/tests/spec/ati_draw_buffers/arbfp-no-option.c
index 5e3e108..8b6414f 100644
--- a/tests/spec/ati_draw_buffers/arbfp-no-option.c
+++ b/tests/spec/ati_draw_buffers/arbfp-no-option.c
@@ -113,7 +113,7 @@ piglit_display(void)
 	piglit_draw_rect(-1, -1, 2, 2);
         glDisable(GL_FRAGMENT_PROGRAM_ARB);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	/* Draw the two green textures to top/bottom halves of the window. */
 	glEnable(GL_TEXTURE_2D);
diff --git a/tests/spec/ati_draw_buffers/arbfp.c b/tests/spec/ati_draw_buffers/arbfp.c
index 44e68be..3599508 100644
--- a/tests/spec/ati_draw_buffers/arbfp.c
+++ b/tests/spec/ati_draw_buffers/arbfp.c
@@ -115,7 +115,7 @@ piglit_display(void)
 	piglit_draw_rect(0, 0, piglit_width, piglit_height);
         glDisable(GL_FRAGMENT_PROGRAM_ARB);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	/* Draw the two green textures to halves of the window. */
 	glEnable(GL_TEXTURE_2D);
diff --git a/tests/spec/ext_framebuffer_multisample/enable-flag.cpp b/tests/spec/ext_framebuffer_multisample/enable-flag.cpp
index d08054d..92b6c91 100644
--- a/tests/spec/ext_framebuffer_multisample/enable-flag.cpp
+++ b/tests/spec/ext_framebuffer_multisample/enable-flag.cpp
@@ -106,7 +106,7 @@ piglit_display()
 {
 	bool pass = true;
 
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glViewport(0, 0, piglit_width, piglit_height);
 	glClear(GL_COLOR_BUFFER_BIT);
 
@@ -128,7 +128,7 @@ piglit_display()
 	 * (which is not multisampled) to resolve it.
 	 */
 	glBindFramebuffer(GL_READ_FRAMEBUFFER, multisampled_fbo.handle);
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glBlitFramebuffer(0, 0, pattern_width, pattern_height,
 			  0, 0, pattern_width, pattern_height,
 			  GL_COLOR_BUFFER_BIT, GL_NEAREST);
@@ -140,7 +140,7 @@ piglit_display()
 
 	/* Blit this image to the right half of the piglit window. */
 	glBindFramebuffer(GL_READ_FRAMEBUFFER, singlesampled_fbo.handle);
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glBlitFramebuffer(0, 0, pattern_width, pattern_height,
 			  pattern_width, 0, 2*pattern_width, pattern_height,
 			  GL_COLOR_BUFFER_BIT, GL_NEAREST);
@@ -149,7 +149,7 @@ piglit_display()
 	 * they don't, then presumably the disabling of GL_MULTISAMPLE
 	 * failed to take effect.
 	 */
-	glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
 	pass = piglit_probe_rect_halves_equal_rgba(0, 0, 2*pattern_width,
 						   pattern_height) && pass;
 
diff --git a/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp b/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp
index 44211be..4c9c504 100644
--- a/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp
+++ b/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp
@@ -71,7 +71,7 @@ piglit_display(void)
 	test->draw_to_default_framebuffer();
 
 	/* Read color buffer */
-	glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
 	color_buffer = (GLfloat *) malloc(w * h * 4 * sizeof(float));
 	glReadPixels(0, 0, w, h, GL_RGBA, GL_FLOAT, color_buffer);
 
diff --git a/tests/spec/ext_texture_integer/fbo-blending.c b/tests/spec/ext_texture_integer/fbo-blending.c
index f0c8665..832bbcb 100644
--- a/tests/spec/ext_texture_integer/fbo-blending.c
+++ b/tests/spec/ext_texture_integer/fbo-blending.c
@@ -317,7 +317,7 @@ piglit_init(int argc, char **argv)
 	for (f = 0; f < num_test_formats; f++)
 		piglit_merge_result(&result, test_format(&test_formats[f]));
 
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	glDeleteFramebuffers(1, &fbo);
 
 	piglit_report_result(result);
diff --git a/tests/spec/gl-3.2/layered-rendering/blit.c b/tests/spec/gl-3.2/layered-rendering/blit.c
index 5cab5d3..162eee8 100644
--- a/tests/spec/gl-3.2/layered-rendering/blit.c
+++ b/tests/spec/gl-3.2/layered-rendering/blit.c
@@ -104,7 +104,7 @@ display_texture(int x, int y, int w, int h,
 				       GL_TEXTURE_2D, tex, 0);
 
 		/* Blit layer to screen */
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 		glBindFramebuffer(GL_READ_FRAMEBUFFER, tempFBO);
 		glBlitFramebuffer(0, 0, texWidth, texHeight,
 				  dx1, dy1, dx2, dy2,
@@ -129,7 +129,7 @@ display_texture(int x, int y, int w, int h,
 			}
 
 			/* Blit layer to screen */
-			glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+			glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 			glBindFramebuffer(GL_READ_FRAMEBUFFER, tempFBO);
 			glBlitFramebuffer(0, 0, texWidth, texHeight,
 					  dx1, dy1, dx2, dy2,
@@ -138,7 +138,7 @@ display_texture(int x, int y, int w, int h,
 	}
 
 	/* Cleanup temp fbo */
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	glDeleteFramebuffers(1, &tempFBO);
 
 	return piglit_check_gl_error(GL_NO_ERROR);
@@ -293,7 +293,7 @@ testFramebufferBlitLayered(int x, int y, int w, int h,
 	}
 
 	/* Clean up */
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	glDeleteFramebuffers(1, &srcFBO);
 	glDeleteFramebuffers(1, &dstFBO);
 	glDeleteTextures(1, &srcTex);
@@ -321,7 +321,7 @@ piglit_display(void)
 	int hw = piglit_width/2;
 	int hh = piglit_height/2;
 
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	glClearColor(1,1,1,1);
 	glClear(GL_COLOR_BUFFER_BIT);
 
diff --git a/tests/spec/gl-3.2/layered-rendering/clear-color.c b/tests/spec/gl-3.2/layered-rendering/clear-color.c
index 6d15f11..74a420a 100644
--- a/tests/spec/gl-3.2/layered-rendering/clear-color.c
+++ b/tests/spec/gl-3.2/layered-rendering/clear-color.c
@@ -90,7 +90,7 @@ display_layered_texture(int x, int y, int w, int h, int texWidth, int texHeight,
 			return false;
 		}
 
-		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 		glBindFramebuffer(GL_READ_FRAMEBUFFER, tempFBO);
 		glBlitFramebuffer(0, 0, texWidth, texHeight,
 				  dx1, dy1, dx2, dy2, GL_COLOR_BUFFER_BIT,
@@ -98,7 +98,7 @@ display_layered_texture(int x, int y, int w, int h, int texWidth, int texHeight,
 	}
 
 	/* Cleanup temp fbo */
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	glDeleteFramebuffers(1, &tempFBO);
 
 	return piglit_check_gl_error(GL_NO_ERROR);
@@ -166,7 +166,7 @@ piglit_display(void)
 	const float clearColor[3] = { 1, 1, 0 };
 
 	/* Clear Defualt Framebuffer */
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	glClearColor(1,1,0,1);
 	glClear(GL_COLOR_BUFFER_BIT);
 
diff --git a/tests/spec/gl-3.2/layered-rendering/framebuffer-layer-complete.c b/tests/spec/gl-3.2/layered-rendering/framebuffer-layer-complete.c
index 3825d88..742250b 100644
--- a/tests/spec/gl-3.2/layered-rendering/framebuffer-layer-complete.c
+++ b/tests/spec/gl-3.2/layered-rendering/framebuffer-layer-complete.c
@@ -164,7 +164,7 @@ test_fbo_attachment_targets(GLenum texOneType, GLenum texTwoType,
 	pass = CheckFramebufferStatus(expectedFbStatus) && pass;
 
 	/* Clean up */
-	glBindFramebuffer(GL_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
 	glDeleteFramebuffers(1, &fbo);
 	glDeleteTextures(2, texture);
 
diff --git a/tests/spec/nv_conditional_render/blitframebuffer.c b/tests/spec/nv_conditional_render/blitframebuffer.c
index 0e61e8a..6d83316 100644
--- a/tests/spec/nv_conditional_render/blitframebuffer.c
+++ b/tests/spec/nv_conditional_render/blitframebuffer.c
@@ -73,7 +73,7 @@ static void blit_window_to_tex(GLuint tex, int w, int h)
 
 	glBlitFramebufferEXT(0, 0, w, h, 0, 0, w, h, GL_COLOR_BUFFER_BIT, GL_LINEAR);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glDeleteFramebuffersEXT(1, &fb);
 }
 
diff --git a/tests/spec/nv_texture_barrier/blending-in-shader.c b/tests/spec/nv_texture_barrier/blending-in-shader.c
index 7bc8a1b..9238b89 100644
--- a/tests/spec/nv_texture_barrier/blending-in-shader.c
+++ b/tests/spec/nv_texture_barrier/blending-in-shader.c
@@ -73,7 +73,7 @@ enum piglit_result piglit_display(void)
 	pass = piglit_probe_image_rgba(0, 0, 16, 16, res_data);
 
 	glUseProgram(0);
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 	glViewport(0, 0, piglit_width, piglit_height);
 
 	piglit_draw_rect_tex(-1, -1, 2, 2, 0, 0, 1, 1);
diff --git a/tests/texturing/depthstencil-render-miplevels.cpp b/tests/texturing/depthstencil-render-miplevels.cpp
index 9c157b8..6a5b95f 100644
--- a/tests/texturing/depthstencil-render-miplevels.cpp
+++ b/tests/texturing/depthstencil-render-miplevels.cpp
@@ -487,7 +487,7 @@ render_results_to_screen()
 				MAX2(piglit_height, 2 * miplevel0_size),
 				false);
 
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glClearColor(0.5, 0.5, 0.5, 0.0);
 	glClear(GL_COLOR_BUFFER_BIT);
 
diff --git a/tests/texturing/tex-miplevel-selection.c b/tests/texturing/tex-miplevel-selection.c
index 571bbc3..2ae0744 100644
--- a/tests/texturing/tex-miplevel-selection.c
+++ b/tests/texturing/tex-miplevel-selection.c
@@ -149,7 +149,7 @@ piglit_init(int argc, char **argv)
 
 	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
 
 	glEnable(GL_TEXTURE_2D);
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 587c290..ec63a36 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1371,7 +1371,7 @@ piglit_visualize_image(float *img, GLenum base_internal_format,
 			visualization[(y * image_width + x) * 3 + 2] = b;
 		}
 	}
-	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glUseProgram(0);
 
 	/* To simultaneously display multiple images on window system
-- 
1.8.3.2



More information about the Piglit mailing list