wined3d: Mark the draw buffer as dirty in context_create().

Currently callers of this function are responsible for setting the draw buffer
correctly, but they don't do a very good job:
  - swapchain_init() sets the draw buffer to GL_BACK if there's a back buffer,
    even though the context's target is always the front buffer.
  - swapchain_create_context_for_thread() depends on (eventually) being called
    by FindContext().
  - create_primary_opengl_context() and
    IWineD3DSwapChainImpl_SetDestWindowOverride() don't bother setting a draw
    buffer at all.
Just marking the draw buffer dirty lets the context management sort it all
out, and is much simpler.
This commit is contained in:
Henri Verbeet 2009-12-15 17:51:37 +01:00 committed by Alexandre Julliard
parent a215d326a5
commit cd623036fc
2 changed files with 2 additions and 21 deletions

View File

@ -1349,6 +1349,7 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
ret->surface = (IWineD3DSurface *) target;
ret->current_rt = (IWineD3DSurface *)target;
ret->render_offscreen = surface_is_offscreen((IWineD3DSurface *) target);
ret->draw_buffer_dirty = TRUE;
ret->tid = GetCurrentThreadId();
if(This->shader_backend->shader_dirtifyable_constants((IWineD3DDevice *) This)) {
/* Create the dirty constants array and initialize them to dirty */

View File

@ -809,6 +809,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
hr = WINED3DERR_NOTAVAILABLE;
goto err;
}
context_release(swapchain->context[0]);
}
else
{
@ -841,29 +842,8 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
IWineD3DSurface_SetContainer(swapchain->backBuffer[i], (IWineD3DBase *)swapchain);
((IWineD3DSurfaceImpl *)swapchain->backBuffer[i])->Flags |= SFLAG_SWAPCHAIN;
if (surface_type == SURFACE_OPENGL)
{
ENTER_GL();
glDrawBuffer(GL_BACK);
checkGLcall("glDrawBuffer(GL_BACK)");
LEAVE_GL();
}
}
}
else
{
/* Single buffering - draw to front buffer */
if (surface_type == SURFACE_OPENGL)
{
ENTER_GL();
glDrawBuffer(GL_FRONT);
checkGLcall("glDrawBuffer(GL_FRONT)");
LEAVE_GL();
}
}
if (swapchain->context[0]) context_release(swapchain->context[0]);
/* Swapchains share the depth/stencil buffer, so only create a single depthstencil surface. */
if (present_parameters->EnableAutoDepthStencil && surface_type == SURFACE_OPENGL)