summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2007-07-17 17:29:55 +0200
committerRoland Scheidegger <[email protected]>2007-07-17 17:29:55 +0200
commitd9499a151df85fef6bb6f31b58657e44cadba50a (patch)
tree3e8f88219f15959c350f9a460f0bb63c2b5b5810 /src
parent04d49ff24d0f9c7c3a99c45b50f62aa32b0a28ed (diff)
fix mesa fb binding
Make sure that we bind the right buffer (draw or read) when rebinding the window framebuffer (the api doesn't allow binding different draw and read buffers at the same time, but the default window framebuffer is basically 2 fb objects, one for read, one for write, which can be different). Pass both of these two down the driver api (no driver uses this right now).
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_fbo.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_buffers.c7
-rw-r--r--src/mesa/main/dd.h2
-rw-r--r--src/mesa/main/fbobject.c8
4 files changed, 12 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c
index afee07c6898..b0c243ebe02 100644
--- a/src/mesa/drivers/dri/i915tex/intel_fbo.c
+++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c
@@ -513,7 +513,7 @@ intel_new_renderbuffer(GLcontext * ctx, GLuint name)
*/
static void
intel_bind_framebuffer(GLcontext * ctx, GLenum target,
- struct gl_framebuffer *fb)
+ struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
{
if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
intel_draw_buffer(ctx, fb);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
index 857cd30584c..6a2c2013e34 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
@@ -395,9 +395,12 @@ nouveauNewRenderbuffer(GLcontext *ctx, GLuint name)
}
static void
-nouveauBindFramebuffer(GLcontext *ctx, GLenum target, struct gl_framebuffer *fb)
+nouveauBindFramebuffer(GLcontext *ctx, GLenum target,
+ struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
{
- nouveau_build_framebuffer(ctx, fb);
+ if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
+ nouveau_build_framebuffer(ctx, fb);
+ }
}
static void
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 88f33943b31..caa50dd6826 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -782,7 +782,7 @@ struct dd_function_table {
struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name);
struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name);
void (*BindFramebuffer)(GLcontext *ctx, GLenum target,
- struct gl_framebuffer *fb);
+ struct gl_framebuffer *fb, struct gl_framebuffer *fbread);
void (*FramebufferRenderbuffer)(GLcontext *ctx,
struct gl_framebuffer *fb,
GLenum attachment,
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index e3bada5ae89..5345310ca1f 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -924,7 +924,7 @@ check_end_texture_render(GLcontext *ctx, struct gl_framebuffer *fb)
void GLAPIENTRY
_mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
{
- struct gl_framebuffer *newFb;
+ struct gl_framebuffer *newFb, *newFbread;
GLboolean bindReadBuf, bindDrawBuf;
GET_CURRENT_CONTEXT(ctx);
@@ -984,12 +984,14 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
}
_mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newFb);
}
+ newFbread = newFb;
}
else {
/* Binding the window system framebuffer (which was originally set
* with MakeCurrent).
*/
newFb = ctx->WinSysDrawBuffer;
+ newFbread = ctx->WinSysReadBuffer;
}
ASSERT(newFb);
@@ -1000,7 +1002,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
*/
if (bindReadBuf) {
- _mesa_reference_framebuffer(&ctx->ReadBuffer, newFb);
+ _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread);
}
if (bindDrawBuf) {
@@ -1015,7 +1017,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
}
if (ctx->Driver.BindFramebuffer) {
- ctx->Driver.BindFramebuffer(ctx, target, newFb);
+ ctx->Driver.BindFramebuffer(ctx, target, newFb, newFbread);
}
}