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

d3d9: Pass the container to d3d9_surface_create().

parent 7b719533
......@@ -180,7 +180,7 @@ 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) DECLSPEC_HIDDEN;
unsigned int sub_resource_idx, IUnknown *container) 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;
......
......@@ -1148,7 +1148,8 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
struct wined3d_resource *resource = wined3d_rendertarget_view_get_resource(rtv);
struct d3d9_surface *surface;
if ((surface = d3d9_surface_create(wined3d_texture_from_resource(resource), 0)))
if ((surface = d3d9_surface_create(wined3d_texture_from_resource(resource), 0,
(IUnknown *)&device->IDirect3DDevice9Ex_iface)))
surface->parent_device = &device->IDirect3DDevice9Ex_iface;
}
}
......@@ -1353,7 +1354,7 @@ static HRESULT WINAPI d3d9_device_CreateTexture(IDirect3DDevice9Ex *iface,
levels = wined3d_texture_get_level_count(object->wined3d_texture);
for (i = 0; i < levels; ++i)
{
if (!d3d9_surface_create(object->wined3d_texture, i))
if (!d3d9_surface_create(object->wined3d_texture, i, (IUnknown *)&object->IDirect3DBaseTexture9_iface))
{
IDirect3DTexture9_Release(&object->IDirect3DBaseTexture9_iface);
return E_OUTOFMEMORY;
......@@ -1456,7 +1457,7 @@ static HRESULT WINAPI d3d9_device_CreateCubeTexture(IDirect3DDevice9Ex *iface,
levels = wined3d_texture_get_level_count(object->wined3d_texture);
for (i = 0; i < levels * 6; ++i)
{
if (!d3d9_surface_create(object->wined3d_texture, i))
if (!d3d9_surface_create(object->wined3d_texture, i, (IUnknown *)&object->IDirect3DBaseTexture9_iface))
{
IDirect3DTexture9_Release(&object->IDirect3DBaseTexture9_iface);
return E_OUTOFMEMORY;
......@@ -1599,7 +1600,7 @@ static HRESULT d3d9_device_create_surface(struct d3d9_device *device, unsigned i
return hr;
}
if (!(surface_impl = d3d9_surface_create(texture, 0)))
if (!(surface_impl = d3d9_surface_create(texture, 0, NULL)))
{
wined3d_texture_decref(texture);
wined3d_mutex_unlock();
......@@ -4564,11 +4565,8 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic
TRACE("device_parent %p, container_parent %p, desc %p, texture flags %#lx, texture %p.\n",
device_parent, container_parent, desc, texture_flags, texture);
if (container_parent == device_parent)
container_parent = &device->IDirect3DDevice9Ex_iface;
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1, 1,
texture_flags, NULL, container_parent, &d3d9_null_wined3d_parent_ops, texture)))
texture_flags, NULL, NULL, &d3d9_null_wined3d_parent_ops, texture)))
{
WARN("Failed to create texture, hr %#lx.\n", hr);
return hr;
......
......@@ -347,7 +347,8 @@ static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops =
surface_wined3d_object_destroyed,
};
struct d3d9_surface *d3d9_surface_create(struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx)
struct d3d9_surface *d3d9_surface_create(struct wined3d_texture *wined3d_texture,
unsigned int sub_resource_idx, IUnknown *container)
{
IDirect3DBaseTexture9 *texture;
struct d3d9_surface *surface;
......@@ -359,7 +360,7 @@ struct d3d9_surface *d3d9_surface_create(struct wined3d_texture *wined3d_texture
d3d9_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;
......
......@@ -411,7 +411,8 @@ HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapcha
for (i = 0; i < desc->backbuffer_count; ++i)
{
if (!(surface = d3d9_surface_create(wined3d_swapchain_get_back_buffer(object->wined3d_swapchain, i), 0)))
if (!(surface = d3d9_surface_create(wined3d_swapchain_get_back_buffer(object->wined3d_swapchain, i), 0,
(IUnknown *)&object->IDirect3DSwapChain9Ex_iface)))
{
IDirect3DSwapChain9Ex_Release(&object->IDirect3DSwapChain9Ex_iface);
return E_OUTOFMEMORY;
......@@ -424,7 +425,8 @@ HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapcha
{
struct wined3d_resource *resource = wined3d_rendertarget_view_get_resource(wined3d_dsv);
if (!(surface = d3d9_surface_create(wined3d_texture_from_resource(resource), 0)))
if (!(surface = d3d9_surface_create(wined3d_texture_from_resource(resource), 0,
(IUnknown *)&device->IDirect3DDevice9Ex_iface)))
{
IDirect3DSwapChain9Ex_Release(&object->IDirect3DSwapChain9Ex_iface);
return E_OUTOFMEMORY;
......
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