mirror of
git://source.winehq.org/git/wine.git
synced 2024-08-31 23:43:37 +00:00
wined3d: Introduce a function to update a swapchain's render_to_fbo field.
This commit is contained in:
parent
7b19efd9d5
commit
9de5372036
|
@ -5879,31 +5879,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
|
|||
|
||||
stateblock_init_default_state(device->stateBlock);
|
||||
|
||||
if(wined3d_settings.offscreen_rendering_mode == ORM_FBO)
|
||||
{
|
||||
RECT client_rect;
|
||||
GetClientRect(swapchain->win_handle, &client_rect);
|
||||
|
||||
if(!swapchain->presentParms.BackBufferCount)
|
||||
{
|
||||
TRACE("Single buffered rendering\n");
|
||||
swapchain->render_to_fbo = FALSE;
|
||||
}
|
||||
else if(swapchain->presentParms.BackBufferWidth != client_rect.right ||
|
||||
swapchain->presentParms.BackBufferHeight != client_rect.bottom )
|
||||
{
|
||||
TRACE("Rendering to FBO. Backbuffer %ux%u, window %ux%u\n",
|
||||
swapchain->presentParms.BackBufferWidth,
|
||||
swapchain->presentParms.BackBufferHeight,
|
||||
client_rect.right, client_rect.bottom);
|
||||
swapchain->render_to_fbo = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Rendering directly to GL_BACK\n");
|
||||
swapchain->render_to_fbo = FALSE;
|
||||
}
|
||||
}
|
||||
swapchain_update_render_to_fbo(swapchain);
|
||||
|
||||
hr = create_primary_opengl_context(device, swapchain);
|
||||
wined3d_swapchain_decref(swapchain);
|
||||
|
|
|
@ -803,6 +803,39 @@ static const struct wined3d_swapchain_ops swapchain_gdi_ops =
|
|||
swapchain_gdi_present,
|
||||
};
|
||||
|
||||
void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
|
||||
{
|
||||
RECT client_rect;
|
||||
|
||||
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO)
|
||||
return;
|
||||
|
||||
if (!swapchain->presentParms.BackBufferCount)
|
||||
{
|
||||
TRACE("Single buffered rendering.\n");
|
||||
swapchain->render_to_fbo = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
GetClientRect(swapchain->win_handle, &client_rect);
|
||||
|
||||
TRACE("Backbuffer %ux%u, window %ux%u.\n",
|
||||
swapchain->presentParms.BackBufferWidth,
|
||||
swapchain->presentParms.BackBufferHeight,
|
||||
client_rect.right, client_rect.bottom);
|
||||
|
||||
if (swapchain->presentParms.BackBufferWidth == client_rect.right
|
||||
&& swapchain->presentParms.BackBufferHeight == client_rect.bottom)
|
||||
{
|
||||
TRACE("Backbuffer dimensions match window dimensions, rendering onscreen.\n");
|
||||
swapchain->render_to_fbo = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
TRACE("Rendering to FBO.\n");
|
||||
swapchain->render_to_fbo = TRUE;
|
||||
}
|
||||
|
||||
/* Do not call while under the GL lock. */
|
||||
static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTYPE surface_type,
|
||||
struct wined3d_device *device, WINED3DPRESENT_PARAMETERS *present_parameters,
|
||||
|
@ -885,18 +918,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
|
|||
}
|
||||
}
|
||||
swapchain->presentParms = *present_parameters;
|
||||
|
||||
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
|
||||
&& present_parameters->BackBufferCount
|
||||
&& (present_parameters->BackBufferWidth != client_rect.right
|
||||
|| present_parameters->BackBufferHeight != client_rect.bottom))
|
||||
{
|
||||
TRACE("Rendering to FBO. Backbuffer %ux%u, window %ux%u.\n",
|
||||
present_parameters->BackBufferWidth,
|
||||
present_parameters->BackBufferHeight,
|
||||
client_rect.right, client_rect.bottom);
|
||||
swapchain->render_to_fbo = TRUE;
|
||||
}
|
||||
swapchain_update_render_to_fbo(swapchain);
|
||||
|
||||
TRACE("Creating front buffer.\n");
|
||||
hr = device->device_parent->ops->create_rendertarget(device->device_parent, parent,
|
||||
|
|
|
@ -2441,6 +2441,7 @@ void x11_copy_to_screen(const struct wined3d_swapchain *swapchain, const RECT *r
|
|||
struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
|
||||
#define DEFAULT_REFRESH_RATE 0
|
||||
|
||||
|
|
Loading…
Reference in a new issue