wined3d: Only create back-buffer views for swapchains with WINED3DUSAGE_RENDERTARGET set.

Since without it the view wouldn't be usable.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-03-27 15:36:50 +04:30 committed by Alexandre Julliard
parent 7d16575df6
commit 1567329f91
1 changed files with 3 additions and 3 deletions

View File

@ -1077,7 +1077,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
goto err_out;
}
if (swapchain_desc->backbuffer_count)
if (swapchain_desc->backbuffer_count && swapchain_desc->backbuffer_usage & WINED3DUSAGE_RENDERTARGET)
{
struct wined3d_resource *back_buffer = &swapchain->back_buffers[0]->resource;
struct wined3d_view_desc view_desc;
@ -1113,7 +1113,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
TRACE("All defaults now set up.\n");
/* Clear the screen */
if (swapchain->back_buffers && swapchain->back_buffers[0])
if (device->back_buffer_view)
clear_flags |= WINED3DCLEAR_TARGET;
if (swapchain_desc->enable_auto_depth_stencil)
clear_flags |= WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL;
@ -4893,7 +4893,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_rendertarget_view_decref(device->back_buffer_view);
device->back_buffer_view = NULL;
}
if (swapchain->desc.backbuffer_count)
if (swapchain->desc.backbuffer_count && swapchain->desc.backbuffer_usage & WINED3DUSAGE_RENDERTARGET)
{
struct wined3d_resource *back_buffer = &swapchain->back_buffers[0]->resource;