mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
fix bogus fb/drawable information
the framebuffer objects attached to drawables can have invalidate state associated with them, since for the window framebuffer this is per-context state and not per-fbo state. Since drivers rely on that information (otherwise would need to check if currently the window-framebuffer is bound in a lot of places) fix it up in _mesa_make_current (ugly). (Brought over from i915tex_privbuffers, where it fixes xdemos/wincopy when switching to front buffer rendering.)
This commit is contained in:
parent
fb3b9060d4
commit
cbfe29cdee
1 changed files with 11 additions and 0 deletions
|
|
@ -1495,9 +1495,20 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
|
||||||
*/
|
*/
|
||||||
if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
|
if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
|
||||||
_mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
|
_mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
|
||||||
|
/* fix up the fb fields - these will end up wrong otherwise
|
||||||
|
if the DRIdrawable changes, and someone may rely on them.
|
||||||
|
*/
|
||||||
|
/* What a mess!?! */
|
||||||
|
int i;
|
||||||
|
GLenum buffers[MAX_DRAW_BUFFERS];
|
||||||
|
for(i = 0; i < newCtx->Const.MaxDrawBuffers; i++) {
|
||||||
|
buffers[i] = newCtx->Color.DrawBuffer[i];
|
||||||
|
}
|
||||||
|
_mesa_drawbuffers(newCtx, newCtx->Const.MaxDrawBuffers, buffers, NULL);
|
||||||
}
|
}
|
||||||
if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) {
|
if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) {
|
||||||
_mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer);
|
_mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer);
|
||||||
|
_mesa_ReadBuffer(newCtx->Pixel.ReadBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
newCtx->NewState |= _NEW_BUFFERS;
|
newCtx->NewState |= _NEW_BUFFERS;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue