WineD3D: Frontbuffers are always onscreen
hverbeet at gmail.com
Fri Dec 11 04:33:12 CST 2009
2009/12/11 Stefan Dösinger <stefandoesinger at gmx.at>:
>> - Setting "render_offscreen" is really the responsibility of the
>> context_create() call, similar to create_primary_opengl_context().
> context_create() doesn't take a swapchain as parameter, only a window. This is correct, because GL contexts are linked to the drawable, not the swapchain. Thus context_create doesn't have the needed information to set the offscreen flag. (I could just pass in a TRUE or FALSE parameter, but there's something else)
It has a "target" parameter that can be either an onscreen or
offscreen surface. This parameter is also used to set the initial
"current_rt" field. "similar to create_primary_opengl_context()" was
perhaps badly worded, what I meant is that context_create() should be
setting "render_offscreen", not its callers.
> As a sidenode, maybe create_primary_opengl_context is named badly. It's not part of the context management, its a device helper function that happens to use the context management to set up a GL context, among other things. Maybe device_restart_opengl or something similar is better.
>> - The line is actually wrong, the relevant context has been setup to
>> render to the front buffer, so "render_offscreen" should always be
>> FALSE, even if there is a back buffer.
> Well, this code is in the backbuffer path. Render_offscreen is false if we don't set it due to the alloc HEAP_ZERO_MEMORY. The point of the line is to set it to true if we render to an FBO. We never set a swapchain to render to the front buffer at creation time if there is a back buffer.
"context_create(device, (IWineD3DSurfaceImpl *)swapchain->frontBuffer,
window, FALSE /* pbuffer */, present_parameters);"
The draw buffer handling in swapchain_init() is also broken in the
sense that it always sets GL_BACK if there's a back buffer, regardless
of what the context thinks it should be, but that's a separate issue,
I'm working on some patches to fix draw buffer handling in the general
More information about the wine-devel