wined3d: Use wined3d_rendertarget_view_create() in wined3d_device_reset().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-02-02 19:23:33 +01:00 committed by Alexandre Julliard
parent f1898abd9c
commit 1ac6cfcac4
1 changed files with 12 additions and 6 deletions

View File

@ -4606,6 +4606,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode, const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode,
wined3d_device_reset_cb callback, BOOL reset_state) wined3d_device_reset_cb callback, BOOL reset_state)
{ {
struct wined3d_rendertarget_view_desc view_desc;
struct wined3d_resource *resource, *cursor; struct wined3d_resource *resource, *cursor;
struct wined3d_swapchain *swapchain; struct wined3d_swapchain *swapchain;
struct wined3d_display_mode m; struct wined3d_display_mode m;
@ -4798,7 +4799,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
{ {
struct wined3d_resource_desc texture_desc; struct wined3d_resource_desc texture_desc;
struct wined3d_texture *texture; struct wined3d_texture *texture;
struct wined3d_rendertarget_view_desc view_desc;
TRACE("Creating the depth stencil buffer\n"); TRACE("Creating the depth stencil buffer\n");
@ -4841,12 +4841,18 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_rendertarget_view_decref(device->back_buffer_view); wined3d_rendertarget_view_decref(device->back_buffer_view);
device->back_buffer_view = NULL; device->back_buffer_view = NULL;
} }
if (swapchain->desc.backbuffer_count && FAILED(hr = wined3d_rendertarget_view_create_from_surface( if (swapchain->desc.backbuffer_count)
surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)),
NULL, &wined3d_null_parent_ops, &device->back_buffer_view)))
{ {
ERR("Failed to create rendertarget view, hr %#x.\n", hr); view_desc.format_id = swapchain_desc->backbuffer_format;
return hr; view_desc.u.texture.level_idx = 0;
view_desc.u.texture.layer_idx = 0;
view_desc.u.texture.layer_count = 1;
if (FAILED(hr = wined3d_rendertarget_view_create(&view_desc, &swapchain->back_buffers[0]->resource,
NULL, &wined3d_null_parent_ops, &device->back_buffer_view)))
{
ERR("Failed to create rendertarget view, hr %#x.\n", hr);
return hr;
}
} }
wine_rb_clear(&device->samplers, device_free_sampler, NULL); wine_rb_clear(&device->samplers, device_free_sampler, NULL);