From: Zebediah Figura zfigura@codeweavers.com
Renamed from d3d8_surface_init() accordingly. --- dlls/d3d8/d3d8_private.h | 4 ++-- dlls/d3d8/device.c | 4 +--- dlls/d3d8/surface.c | 9 ++++++++- 3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 1471ef97708..c1d43b2dfce 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -202,11 +202,11 @@ struct d3d8_surface };
struct wined3d_rendertarget_view *d3d8_surface_acquire_rendertarget_view(struct d3d8_surface *surface) DECLSPEC_HIDDEN; +struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, + const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; struct d3d8_device *d3d8_surface_get_device(const struct d3d8_surface *surface) DECLSPEC_HIDDEN; void d3d8_surface_release_rendertarget_view(struct d3d8_surface *surface, struct wined3d_rendertarget_view *rtv) DECLSPEC_HIDDEN; -void surface_init(struct d3d8_surface *surface, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, - const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN;
struct d3d8_vertexbuffer diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 539dd7a89b9..5d96d1b625b 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -3568,12 +3568,10 @@ static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_d { struct d3d8_surface *d3d_surface;
- if (!(d3d_surface = heap_alloc_zero(sizeof(*d3d_surface)))) + if (!(d3d_surface = d3d8_surface_create(wined3d_texture, sub_resource_idx, parent_ops))) return E_OUTOFMEMORY;
- surface_init(d3d_surface, wined3d_texture, sub_resource_idx, parent_ops); *parent = d3d_surface; - TRACE("Created surface %p.\n", d3d_surface); } else if (type == WINED3D_RTYPE_TEXTURE_3D) { diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index bd07a077d08..a0281bff230 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -309,10 +309,14 @@ static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops = surface_wined3d_object_destroyed, };
-void surface_init(struct d3d8_surface *surface, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, +struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops) { IDirect3DBaseTexture8 *texture; + struct d3d8_surface *surface; + + if (!(surface = heap_alloc_zero(sizeof(*surface)))) + return NULL;
surface->IDirect3DSurface8_iface.lpVtbl = &d3d8_surface_vtbl; d3d8_resource_init(&surface->resource); @@ -330,6 +334,9 @@ void surface_init(struct d3d8_surface *surface, struct wined3d_texture *wined3d_ }
*parent_ops = &d3d8_surface_wined3d_parent_ops; + + TRACE("Created surface %p.\n", surface); + return surface; }
static void STDMETHODCALLTYPE view_wined3d_object_destroyed(void *parent)
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/d3d8/d3d8_private.h | 4 +-- dlls/d3d8/device.c | 60 ++++++++++++++++++++++++++++------------ dlls/d3d8/surface.c | 6 ++-- dlls/d3d8/swapchain.c | 26 +++++++++++++++++ 4 files changed, 74 insertions(+), 22 deletions(-)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index c1d43b2dfce..3f4e15229db 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -202,8 +202,8 @@ struct d3d8_surface };
struct wined3d_rendertarget_view *d3d8_surface_acquire_rendertarget_view(struct d3d8_surface *surface) DECLSPEC_HIDDEN; -struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, - const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; +struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture, + unsigned int sub_resource_idx) DECLSPEC_HIDDEN; struct d3d8_device *d3d8_surface_get_device(const struct d3d8_surface *surface) DECLSPEC_HIDDEN; void d3d8_surface_release_rendertarget_view(struct d3d8_surface *surface, struct wined3d_rendertarget_view *rtv) DECLSPEC_HIDDEN; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 5d96d1b625b..981bd76cee9 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -930,7 +930,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource) }
surface = wined3d_texture_get_sub_resource_parent(wined3d_texture_from_resource(resource), 0); - if (!surface->resource.refcount) + if (!surface || !surface->resource.refcount) return D3D_OK;
WARN("Surface %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface); @@ -973,6 +973,8 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, NULL, reset_enum_callback, TRUE))) { + struct wined3d_rendertarget_view *rtv; + present_parameters->BackBufferCount = swapchain_desc.backbuffer_count; implicit_swapchain = wined3d_swapchain_get_parent(device->implicit_swapchain); implicit_swapchain->swap_interval @@ -981,6 +983,16 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, wined3d_stateblock_set_render_state(device->state, WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil); device_reset_viewport_state(device); + + if ((rtv = wined3d_device_context_get_depth_stencil_view(device->immediate_context))) + { + struct wined3d_resource *resource = wined3d_rendertarget_view_get_resource(rtv); + struct d3d8_surface *surface; + + if ((surface = d3d8_surface_create(wined3d_texture_from_resource(resource), 0))) + surface->parent_device = &device->IDirect3DDevice8_iface; + } + device->device_state = D3D8_DEVICE_STATE_OK; } else @@ -1085,6 +1097,7 @@ static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface, { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_texture *object; + unsigned int i; HRESULT hr;
TRACE("iface %p, width %u, height %u, levels %u, usage %#lx, format %#x, pool %#x, texture %p.\n", @@ -1105,6 +1118,16 @@ static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface, return hr; }
+ levels = wined3d_texture_get_level_count(object->wined3d_texture); + for (i = 0; i < levels; ++i) + { + if (!d3d8_surface_create(object->wined3d_texture, i)) + { + IDirect3DTexture8_Release(&object->IDirect3DBaseTexture8_iface); + return E_OUTOFMEMORY; + } + } + TRACE("Created texture %p.\n", object); *texture = (IDirect3DTexture8 *)&object->IDirect3DBaseTexture8_iface;
@@ -1148,6 +1171,7 @@ static HRESULT WINAPI d3d8_device_CreateCubeTexture(IDirect3DDevice8 *iface, UIN { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_texture *object; + unsigned int i; HRESULT hr;
TRACE("iface %p, edge_length %u, levels %u, usage %#lx, format %#x, pool %#x, texture %p.\n", @@ -1168,6 +1192,16 @@ static HRESULT WINAPI d3d8_device_CreateCubeTexture(IDirect3DDevice8 *iface, UIN return hr; }
+ levels = wined3d_texture_get_level_count(object->wined3d_texture); + for (i = 0; i < levels * 6; ++i) + { + if (!d3d8_surface_create(object->wined3d_texture, i)) + { + IDirect3DTexture8_Release(&object->IDirect3DBaseTexture8_iface); + return E_OUTOFMEMORY; + } + } + TRACE("Created cube texture %p.\n", object); *texture = (IDirect3DCubeTexture8 *)&object->IDirect3DBaseTexture8_iface;
@@ -1263,7 +1297,12 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, enum wined return hr; }
- surface_impl = wined3d_texture_get_sub_resource_parent(texture, 0); + if (!(surface_impl = d3d8_surface_create(texture, 0))) + { + wined3d_texture_decref(texture); + wined3d_mutex_unlock(); + return E_OUTOFMEMORY; + } surface_impl->parent_device = &device->IDirect3DDevice8_iface; *surface = &surface_impl->IDirect3DSurface8_iface; IDirect3DSurface8_AddRef(*surface); @@ -3564,16 +3603,7 @@ static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_d TRACE("device_parent %p, type %#x, wined3d_texture %p, sub_resource_idx %u, parent %p, parent_ops %p.\n", device_parent, type, wined3d_texture, sub_resource_idx, parent, parent_ops);
- if (type == WINED3D_RTYPE_TEXTURE_2D) - { - struct d3d8_surface *d3d_surface; - - if (!(d3d_surface = d3d8_surface_create(wined3d_texture, sub_resource_idx, parent_ops))) - return E_OUTOFMEMORY; - - *parent = d3d_surface; - } - else if (type == WINED3D_RTYPE_TEXTURE_3D) + if (type == WINED3D_RTYPE_TEXTURE_3D) { struct d3d8_volume *d3d_volume;
@@ -3584,7 +3614,7 @@ static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_d *parent = d3d_volume; TRACE("Created volume %p.\n", d3d_volume); } - else + else if (type != WINED3D_RTYPE_TEXTURE_2D) { ERR("Unhandled resource type %#x.\n", type); return E_FAIL; @@ -3598,7 +3628,6 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic struct wined3d_texture **texture) { struct d3d8_device *device = device_from_device_parent(device_parent); - struct d3d8_surface *d3d_surface; HRESULT hr;
TRACE("device_parent %p, container_parent %p, desc %p, texture flags %#lx, texture %p.\n", @@ -3611,9 +3640,6 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic return hr; }
- d3d_surface = wined3d_texture_get_sub_resource_parent(*texture, 0); - d3d_surface->parent_device = &device->IDirect3DDevice8_iface; - return hr; }
diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index a0281bff230..795ff1f9ce5 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -309,8 +309,7 @@ static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops = surface_wined3d_object_destroyed, };
-struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, - const struct wined3d_parent_ops **parent_ops) +struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx) { IDirect3DBaseTexture8 *texture; struct d3d8_surface *surface; @@ -333,7 +332,8 @@ struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture IDirect3DBaseTexture8_Release(texture); }
- *parent_ops = &d3d8_surface_wined3d_parent_ops; + wined3d_texture_set_sub_resource_parent(wined3d_texture, sub_resource_idx, + surface, &d3d8_surface_wined3d_parent_ops);
TRACE("Created surface %p.\n", surface); return surface; diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c index 476846d7e89..37b55b8fc3a 100644 --- a/dlls/d3d8/swapchain.c +++ b/dlls/d3d8/swapchain.c @@ -193,7 +193,10 @@ static HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_devi HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapchain_desc *desc, unsigned int swap_interval, struct d3d8_swapchain **swapchain) { + struct wined3d_rendertarget_view *wined3d_dsv; struct d3d8_swapchain *object; + struct d3d8_surface *surface; + unsigned int i; HRESULT hr;
if (!(object = heap_alloc_zero(sizeof(*object)))) @@ -206,6 +209,29 @@ HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapcha return hr; }
+ for (i = 0; i < desc->backbuffer_count; ++i) + { + if (!(surface = d3d8_surface_create(wined3d_swapchain_get_back_buffer(object->wined3d_swapchain, i), 0))) + { + IDirect3DSwapChain8_Release(&object->IDirect3DSwapChain8_iface); + return E_OUTOFMEMORY; + } + surface->parent_device = &device->IDirect3DDevice8_iface; + } + + if ((desc->flags & WINED3D_SWAPCHAIN_IMPLICIT) + && (wined3d_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context))) + { + struct wined3d_resource *resource = wined3d_rendertarget_view_get_resource(wined3d_dsv); + + if (!(surface = d3d8_surface_create(wined3d_texture_from_resource(resource), 0))) + { + IDirect3DSwapChain8_Release(&object->IDirect3DSwapChain8_iface); + return E_OUTOFMEMORY; + } + surface->parent_device = &device->IDirect3DDevice8_iface; + } + TRACE("Created swapchain %p.\n", object); *swapchain = object;
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/d3d8/d3d8_private.h | 2 +- dlls/d3d8/device.c | 11 ++++++----- dlls/d3d8/surface.c | 5 +++-- dlls/d3d8/swapchain.c | 6 ++++-- 4 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 3f4e15229db..69e16a50c3a 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -203,7 +203,7 @@ struct d3d8_surface
struct wined3d_rendertarget_view *d3d8_surface_acquire_rendertarget_view(struct d3d8_surface *surface) DECLSPEC_HIDDEN; struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture, - unsigned int sub_resource_idx) DECLSPEC_HIDDEN; + unsigned int sub_resource_idx, IUnknown *container) DECLSPEC_HIDDEN; struct d3d8_device *d3d8_surface_get_device(const struct d3d8_surface *surface) DECLSPEC_HIDDEN; void d3d8_surface_release_rendertarget_view(struct d3d8_surface *surface, struct wined3d_rendertarget_view *rtv) DECLSPEC_HIDDEN; diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 981bd76cee9..8ae6b5ce7b9 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -989,7 +989,8 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, struct wined3d_resource *resource = wined3d_rendertarget_view_get_resource(rtv); struct d3d8_surface *surface;
- if ((surface = d3d8_surface_create(wined3d_texture_from_resource(resource), 0))) + if ((surface = d3d8_surface_create(wined3d_texture_from_resource(resource), 0, + (IUnknown *)&device->IDirect3DDevice8_iface))) surface->parent_device = &device->IDirect3DDevice8_iface; }
@@ -1121,7 +1122,7 @@ static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface, levels = wined3d_texture_get_level_count(object->wined3d_texture); for (i = 0; i < levels; ++i) { - if (!d3d8_surface_create(object->wined3d_texture, i)) + if (!d3d8_surface_create(object->wined3d_texture, i, (IUnknown *)&object->IDirect3DBaseTexture8_iface)) { IDirect3DTexture8_Release(&object->IDirect3DBaseTexture8_iface); return E_OUTOFMEMORY; @@ -1195,7 +1196,7 @@ static HRESULT WINAPI d3d8_device_CreateCubeTexture(IDirect3DDevice8 *iface, UIN levels = wined3d_texture_get_level_count(object->wined3d_texture); for (i = 0; i < levels * 6; ++i) { - if (!d3d8_surface_create(object->wined3d_texture, i)) + if (!d3d8_surface_create(object->wined3d_texture, i, (IUnknown *)&object->IDirect3DBaseTexture8_iface)) { IDirect3DTexture8_Release(&object->IDirect3DBaseTexture8_iface); return E_OUTOFMEMORY; @@ -1297,7 +1298,7 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, enum wined return hr; }
- if (!(surface_impl = d3d8_surface_create(texture, 0))) + if (!(surface_impl = d3d8_surface_create(texture, 0, NULL))) { wined3d_texture_decref(texture); wined3d_mutex_unlock(); @@ -3634,7 +3635,7 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic device_parent, container_parent, desc, texture_flags, texture);
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1, 1, texture_flags, - NULL, &device->IDirect3DDevice8_iface, &d3d8_null_wined3d_parent_ops, texture))) + NULL, NULL, &d3d8_null_wined3d_parent_ops, texture))) { WARN("Failed to create texture, hr %#lx.\n", hr); return hr; diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index 795ff1f9ce5..b4545ca3657 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -309,7 +309,8 @@ static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops = surface_wined3d_object_destroyed, };
-struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx) +struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture, + unsigned int sub_resource_idx, IUnknown *container) { IDirect3DBaseTexture8 *texture; struct d3d8_surface *surface; @@ -321,7 +322,7 @@ struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture d3d8_resource_init(&surface->resource); surface->resource.refcount = 0; list_init(&surface->rtv_entry); - surface->container = wined3d_texture_get_parent(wined3d_texture); + surface->container = container; surface->wined3d_texture = wined3d_texture; surface->sub_resource_idx = sub_resource_idx;
diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c index 37b55b8fc3a..1f4387a3406 100644 --- a/dlls/d3d8/swapchain.c +++ b/dlls/d3d8/swapchain.c @@ -211,7 +211,8 @@ HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapcha
for (i = 0; i < desc->backbuffer_count; ++i) { - if (!(surface = d3d8_surface_create(wined3d_swapchain_get_back_buffer(object->wined3d_swapchain, i), 0))) + if (!(surface = d3d8_surface_create(wined3d_swapchain_get_back_buffer(object->wined3d_swapchain, i), 0, + (IUnknown *)&device->IDirect3DDevice8_iface))) { IDirect3DSwapChain8_Release(&object->IDirect3DSwapChain8_iface); return E_OUTOFMEMORY; @@ -224,7 +225,8 @@ HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapcha { struct wined3d_resource *resource = wined3d_rendertarget_view_get_resource(wined3d_dsv);
- if (!(surface = d3d8_surface_create(wined3d_texture_from_resource(resource), 0))) + if (!(surface = d3d8_surface_create(wined3d_texture_from_resource(resource), 0, + (IUnknown *)&device->IDirect3DDevice8_iface))) { IDirect3DSwapChain8_Release(&object->IDirect3DSwapChain8_iface); return E_OUTOFMEMORY;
From: Zebediah Figura zfigura@codeweavers.com
Get rid of the create_swapchain_texture callback. --- dlls/d3d11/device.c | 14 -------------- dlls/d3d8/device.c | 21 --------------------- dlls/d3d9/device.c | 21 --------------------- dlls/ddraw/ddraw.c | 21 --------------------- dlls/wined3d/device.c | 4 ++-- dlls/wined3d/swapchain.c | 12 ++++++------ include/wine/wined3d.h | 2 -- 7 files changed, 8 insertions(+), 87 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 4cf066ef945..ca231af9652 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -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) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 8ae6b5ce7b9..3727ad3e4eb 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -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) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index b5a16177e37..35ba241c23a 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -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) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index c56226fb71d..baa3219ae47 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -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) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 1603329a59f..df186d9ffa2 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index b31c3393767..e6938ea14dc 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -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; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 32a1a70b040..71a5d92c301 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -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
This merge request was approved by Jan Sikorski.