Commit c7d8a1b4 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Directly call wined3d_texture_create() to create swapchain textures.

Get rid of the create_swapchain_texture callback.
parent fd3d4d0a
......@@ -6893,26 +6893,12 @@ static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_d
return S_OK;
}
static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_device_parent *device_parent,
void *container_parent, const struct wined3d_resource_desc *wined3d_desc, DWORD texture_flags,
struct wined3d_texture **wined3d_texture)
{
struct d3d_device *device = device_from_wined3d_device_parent(device_parent);
TRACE("device_parent %p, container_parent %p, wined3d_desc %p, texture_flags %#lx, wined3d_texture %p.\n",
device_parent, container_parent, wined3d_desc, texture_flags, wined3d_texture);
return wined3d_texture_create(device->wined3d_device, wined3d_desc, 1, 1,
texture_flags, NULL, NULL, &d3d_null_wined3d_parent_ops, wined3d_texture);
}
static const struct wined3d_device_parent_ops d3d_wined3d_device_parent_ops =
{
device_parent_wined3d_device_created,
device_parent_mode_changed,
device_parent_activate,
device_parent_texture_sub_resource_created,
device_parent_create_swapchain_texture,
};
static int d3d_sampler_state_compare(const void *key, const struct wine_rb_entry *entry)
......
......@@ -3624,33 +3624,12 @@ static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_d
return D3D_OK;
}
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 d3d8_device *device = device_from_device_parent(device_parent);
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 (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1, 1, texture_flags,
NULL, NULL, &d3d8_null_wined3d_parent_ops, texture)))
{
WARN("Failed to create texture, hr %#lx.\n", hr);
return hr;
}
return hr;
}
static const struct wined3d_device_parent_ops d3d8_wined3d_device_parent_ops =
{
device_parent_wined3d_device_created,
device_parent_mode_changed,
device_parent_activate,
device_parent_texture_sub_resource_created,
device_parent_create_swapchain_texture,
};
static void setup_fpu(void)
......
......@@ -4555,33 +4555,12 @@ static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_d
return D3D_OK;
}
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 d3d9_device *device = device_from_device_parent(device_parent);
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 (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1, 1,
texture_flags, NULL, NULL, &d3d9_null_wined3d_parent_ops, texture)))
{
WARN("Failed to create texture, hr %#lx.\n", hr);
return hr;
}
return hr;
}
static const struct wined3d_device_parent_ops d3d9_wined3d_device_parent_ops =
{
device_parent_wined3d_device_created,
device_parent_mode_changed,
device_parent_activate,
device_parent_texture_sub_resource_created,
device_parent_create_swapchain_texture,
};
static void setup_fpu(void)
......
......@@ -5042,33 +5042,12 @@ static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_d
return DD_OK;
}
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);
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 (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, desc, 1, 1,
texture_flags, NULL, ddraw, &ddraw_null_wined3d_parent_ops, texture)))
{
WARN("Failed to create texture, hr %#lx.\n", hr);
return hr;
}
return hr;
}
static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops =
{
device_parent_wined3d_device_created,
device_parent_mode_changed,
device_parent_activate,
device_parent_texture_sub_resource_created,
device_parent_create_swapchain_texture,
};
HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type device_type)
......
......@@ -5993,8 +5993,8 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
texture_desc.depth = 1;
texture_desc.size = 0;
if (FAILED(hr = device->device_parent->ops->create_swapchain_texture(device->device_parent,
device->device_parent, &texture_desc, 0, &texture)))
if (FAILED(hr = wined3d_texture_create(device, &texture_desc, 1, 1, 0,
NULL, NULL, &wined3d_null_parent_ops, &texture)))
{
ERR("Failed to create the auto depth/stencil surface, hr %#lx.\n", hr);
return WINED3DERR_INVALIDCALL;
......
......@@ -1541,8 +1541,8 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
if (swapchain->state.desc.flags & WINED3D_SWAPCHAIN_GDI_COMPATIBLE)
texture_flags |= WINED3D_TEXTURE_CREATE_GET_DC;
if (FAILED(hr = device->device_parent->ops->create_swapchain_texture(device->device_parent,
parent, &texture_desc, texture_flags, &swapchain->front_buffer)))
if (FAILED(hr = wined3d_texture_create(device, &texture_desc, 1, 1, texture_flags,
NULL, NULL, &wined3d_null_parent_ops, &swapchain->front_buffer)))
{
WARN("Failed to create front buffer, hr %#lx.\n", hr);
goto err;
......@@ -1587,8 +1587,8 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
for (i = 0; i < swapchain->state.desc.backbuffer_count; ++i)
{
TRACE("Creating back buffer %u.\n", i);
if (FAILED(hr = device->device_parent->ops->create_swapchain_texture(device->device_parent,
parent, &texture_desc, texture_flags, &swapchain->back_buffers[i])))
if (FAILED(hr = wined3d_texture_create(device, &texture_desc, 1, 1, texture_flags,
NULL, NULL, &wined3d_null_parent_ops, &swapchain->back_buffers[i])))
{
WARN("Failed to create back buffer %u, hr %#lx.\n", i, hr);
swapchain->state.desc.backbuffer_count = i;
......@@ -1615,8 +1615,8 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
else
texture_desc.access = WINED3D_RESOURCE_ACCESS_GPU;
if (FAILED(hr = device->device_parent->ops->create_swapchain_texture(device->device_parent,
device->device_parent, &texture_desc, 0, &ds)))
if (FAILED(hr = wined3d_texture_create(device, &texture_desc, 1, 1, 0,
NULL, NULL, &wined3d_null_parent_ops, &ds)))
{
WARN("Failed to create the auto depth/stencil surface, hr %#lx.\n", hr);
goto err;
......
......@@ -2241,8 +2241,6 @@ struct wined3d_device_parent_ops
HRESULT (__cdecl *texture_sub_resource_created)(struct wined3d_device_parent *device_parent,
enum wined3d_resource_type type, struct wined3d_texture *texture, unsigned int sub_resource_idx,
void **parent, const struct wined3d_parent_ops **parent_ops);
HRESULT (__cdecl *create_swapchain_texture)(struct wined3d_device_parent *device_parent, void *parent,
const struct wined3d_resource_desc *desc, DWORD texture_flags, struct wined3d_texture **texture);
};
struct wined3d_swapchain_state_parent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment