diff options
author | Brian Paul <[email protected]> | 2006-03-20 15:20:57 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-03-20 15:20:57 +0000 |
commit | f1038f81e40fe7cd7eddfd64d1c4f3dc0a1a074b (patch) | |
tree | 4975453142d9f12db4479ab79474eb1543fb2600 | |
parent | c27c382acc77e012c98f3dd994f4a58ed596cd60 (diff) |
fix some buffer binding tests in _mesa_make_current()
-rw-r--r-- | src/mesa/main/context.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index fadfcc52140..bbefc32804b 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1582,14 +1582,14 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, /* Check that the context's and framebuffer's visuals are compatible. */ - if (newCtx && drawBuffer && newCtx->DrawBuffer != drawBuffer) { + if (newCtx && drawBuffer && newCtx->WinSysDrawBuffer != drawBuffer) { if (!check_compatible(newCtx, drawBuffer)) { _mesa_warning(newCtx, "MakeCurrent: incompatible visuals for context and drawbuffer"); return; } } - if (newCtx && readBuffer && newCtx->ReadBuffer != readBuffer) { + if (newCtx && readBuffer && newCtx->WinSysReadBuffer != readBuffer) { if (!check_compatible(newCtx, readBuffer)) { _mesa_warning(newCtx, "MakeCurrent: incompatible visuals for context and readbuffer"); @@ -1614,9 +1614,15 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, ASSERT(readBuffer->Name == 0); newCtx->WinSysDrawBuffer = drawBuffer; newCtx->WinSysReadBuffer = readBuffer; - /* don't replace user-buffer bindings with window system buffer */ + + /* + * Only set the context's Draw/ReadBuffer fields if they're NULL + * or not bound to a user-created FBO. + */ if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) { newCtx->DrawBuffer = drawBuffer; + } + if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) { newCtx->ReadBuffer = readBuffer; } |