diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 10435436f71..16015a4cc92 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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, wined3d_device_reset_cb callback, BOOL reset_state) { + struct wined3d_rendertarget_view_desc view_desc; struct wined3d_resource *resource, *cursor; struct wined3d_swapchain *swapchain; 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_texture *texture; - struct wined3d_rendertarget_view_desc view_desc; 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); device->back_buffer_view = NULL; } - if (swapchain->desc.backbuffer_count && FAILED(hr = wined3d_rendertarget_view_create_from_surface( - surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)), - NULL, &wined3d_null_parent_ops, &device->back_buffer_view))) + if (swapchain->desc.backbuffer_count) { - ERR("Failed to create rendertarget view, hr %#x.\n", hr); - return hr; + view_desc.format_id = swapchain_desc->backbuffer_format; + 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);