Module: wine Branch: master Commit: 8a5b4252c8b9241b82caeb89d238b3257ed889e5 URL: https://gitlab.winehq.org/wine/wine/-/commit/8a5b4252c8b9241b82caeb89d238b32...
Author: Zebediah Figura zfigura@codeweavers.com Date: Mon Apr 10 17:52:53 2023 -0500
d3d9: Move surface allocation to d3d9_surface_create().
Renamed from d3d9_surface_init() accordingly.
---
dlls/d3d9/d3d9_private.h | 4 ++-- dlls/d3d9/device.c | 4 +--- dlls/d3d9/surface.c | 9 ++++++++- 3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 7dc32e6c12f..dd9fd2a0039 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -179,11 +179,11 @@ struct d3d9_surface };
struct wined3d_rendertarget_view *d3d9_surface_acquire_rendertarget_view(struct d3d9_surface *surface) DECLSPEC_HIDDEN; +struct d3d9_surface *d3d9_surface_create(struct wined3d_texture *wined3d_texture, + unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; struct d3d9_device *d3d9_surface_get_device(const struct d3d9_surface *surface) DECLSPEC_HIDDEN; void d3d9_surface_release_rendertarget_view(struct d3d9_surface *surface, struct wined3d_rendertarget_view *rtv) DECLSPEC_HIDDEN; -void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_texture, - unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface) DECLSPEC_HIDDEN;
struct d3d9_vertexbuffer diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index c6083d351e3..75861032c3a 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -4502,12 +4502,10 @@ static HRESULT CDECL device_parent_texture_sub_resource_created(struct wined3d_d { struct d3d9_surface *d3d_surface;
- if (!(d3d_surface = heap_alloc_zero(sizeof(*d3d_surface)))) + if (!(d3d_surface = d3d9_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/d3d9/surface.c b/dlls/d3d9/surface.c index 810e4e00fb4..146cb8ce35c 100644 --- a/dlls/d3d9/surface.c +++ b/dlls/d3d9/surface.c @@ -347,10 +347,14 @@ static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops = surface_wined3d_object_destroyed, };
-void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_texture, +struct d3d9_surface *d3d9_surface_create(struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops) { IDirect3DBaseTexture9 *texture; + struct d3d9_surface *surface; + + if (!(surface = heap_alloc_zero(sizeof(*surface)))) + return NULL;
surface->IDirect3DSurface9_iface.lpVtbl = &d3d9_surface_vtbl; d3d9_resource_init(&surface->resource); @@ -368,6 +372,9 @@ void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_ }
*parent_ops = &d3d9_surface_wined3d_parent_ops; + + TRACE("Created surface %p.\n", surface); + return surface; }
static void STDMETHODCALLTYPE view_wined3d_object_destroyed(void *parent)