ddraw: Retrieve the frontbuffer directly from wined3d.

This commit is contained in:
Zebediah Figura 2022-12-27 12:28:45 -06:00 committed by Alexandre Julliard
parent 83518a6810
commit f74de8e0ab
3 changed files with 3 additions and 24 deletions

View file

@ -938,7 +938,7 @@ static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window,
}
rtv = wined3d_device_context_get_rendertarget_view(ddraw->immediate_context, 0);
/* Rendering to ddraw->wined3d_frontbuffer. */
/* Rendering to the wined3d frontbuffer. */
if (rtv && !wined3d_rendertarget_view_get_sub_resource_parent(rtv))
rtv = NULL;
else if (rtv)
@ -5042,43 +5042,23 @@ static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_d
return DD_OK;
}
static void STDMETHODCALLTYPE ddraw_frontbuffer_destroyed(void *parent)
{
struct ddraw *ddraw = parent;
ddraw->wined3d_frontbuffer = NULL;
}
static const struct wined3d_parent_ops ddraw_frontbuffer_parent_ops =
{
ddraw_frontbuffer_destroyed,
};
static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_device_parent *device_parent,
void *container_parent, const struct wined3d_resource_desc *desc, DWORD texture_flags,
struct wined3d_texture **texture)
{
struct ddraw *ddraw = ddraw_from_device_parent(device_parent);
const struct wined3d_parent_ops *parent_ops;
HRESULT hr;
TRACE("device_parent %p, container_parent %p, desc %p, texture flags %#lx, texture %p.\n",
device_parent, container_parent, desc, texture_flags, texture);
if (!ddraw->wined3d_frontbuffer)
parent_ops = &ddraw_frontbuffer_parent_ops;
else
parent_ops = &ddraw_null_wined3d_parent_ops;
if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, desc, 1, 1,
texture_flags, NULL, ddraw, parent_ops, texture)))
texture_flags, NULL, ddraw, &ddraw_null_wined3d_parent_ops, texture)))
{
WARN("Failed to create texture, hr %#lx.\n", hr);
return hr;
}
if (!ddraw->wined3d_frontbuffer)
ddraw->wined3d_frontbuffer = *texture;
return hr;
}

View file

@ -103,7 +103,6 @@ struct ddraw
struct ddraw_surface *primary;
RECT primary_lock;
struct wined3d_texture *wined3d_frontbuffer;
struct wined3d_texture *gdi_surface;
struct wined3d_swapchain *wined3d_swapchain;
struct wined3d_swapchain_state_parent state_parent;

View file

@ -133,7 +133,7 @@ HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface,
if (swap_interval)
dst_texture = wined3d_swapchain_get_back_buffer(ddraw->wined3d_swapchain, 0);
else
dst_texture = ddraw->wined3d_frontbuffer;
dst_texture = wined3d_swapchain_get_front_buffer(ddraw->wined3d_swapchain);
if (SUCCEEDED(hr = wined3d_device_context_blt(ddraw->immediate_context, dst_texture, 0, rect,
ddraw_surface_get_any_texture(surface, DDRAW_SURFACE_READ), surface->sub_resource_idx, rect, 0,