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

d3d8: Pass the container to d3d8_surface_create().

parent 9a6d889b
...@@ -203,7 +203,7 @@ struct d3d8_surface ...@@ -203,7 +203,7 @@ struct d3d8_surface
struct wined3d_rendertarget_view *d3d8_surface_acquire_rendertarget_view(struct d3d8_surface *surface) DECLSPEC_HIDDEN; 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, 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; struct d3d8_device *d3d8_surface_get_device(const struct d3d8_surface *surface) DECLSPEC_HIDDEN;
void d3d8_surface_release_rendertarget_view(struct d3d8_surface *surface, void d3d8_surface_release_rendertarget_view(struct d3d8_surface *surface,
struct wined3d_rendertarget_view *rtv) DECLSPEC_HIDDEN; struct wined3d_rendertarget_view *rtv) DECLSPEC_HIDDEN;
......
...@@ -989,7 +989,8 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, ...@@ -989,7 +989,8 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
struct wined3d_resource *resource = wined3d_rendertarget_view_get_resource(rtv); struct wined3d_resource *resource = wined3d_rendertarget_view_get_resource(rtv);
struct d3d8_surface *surface; 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; surface->parent_device = &device->IDirect3DDevice8_iface;
} }
...@@ -1121,7 +1122,7 @@ static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface, ...@@ -1121,7 +1122,7 @@ static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface,
levels = wined3d_texture_get_level_count(object->wined3d_texture); levels = wined3d_texture_get_level_count(object->wined3d_texture);
for (i = 0; i < levels; ++i) 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); IDirect3DTexture8_Release(&object->IDirect3DBaseTexture8_iface);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1195,7 +1196,7 @@ static HRESULT WINAPI d3d8_device_CreateCubeTexture(IDirect3DDevice8 *iface, UIN ...@@ -1195,7 +1196,7 @@ static HRESULT WINAPI d3d8_device_CreateCubeTexture(IDirect3DDevice8 *iface, UIN
levels = wined3d_texture_get_level_count(object->wined3d_texture); levels = wined3d_texture_get_level_count(object->wined3d_texture);
for (i = 0; i < levels * 6; ++i) 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); IDirect3DTexture8_Release(&object->IDirect3DBaseTexture8_iface);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1297,7 +1298,7 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, enum wined ...@@ -1297,7 +1298,7 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, enum wined
return hr; return hr;
} }
if (!(surface_impl = d3d8_surface_create(texture, 0))) if (!(surface_impl = d3d8_surface_create(texture, 0, NULL)))
{ {
wined3d_texture_decref(texture); wined3d_texture_decref(texture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
...@@ -3634,7 +3635,7 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic ...@@ -3634,7 +3635,7 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic
device_parent, container_parent, desc, texture_flags, texture); device_parent, container_parent, desc, texture_flags, texture);
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1, 1, texture_flags, 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); WARN("Failed to create texture, hr %#lx.\n", hr);
return hr; return hr;
......
...@@ -309,7 +309,8 @@ static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops = ...@@ -309,7 +309,8 @@ static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops =
surface_wined3d_object_destroyed, 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; IDirect3DBaseTexture8 *texture;
struct d3d8_surface *surface; struct d3d8_surface *surface;
...@@ -321,7 +322,7 @@ struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture ...@@ -321,7 +322,7 @@ struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture
d3d8_resource_init(&surface->resource); d3d8_resource_init(&surface->resource);
surface->resource.refcount = 0; surface->resource.refcount = 0;
list_init(&surface->rtv_entry); list_init(&surface->rtv_entry);
surface->container = wined3d_texture_get_parent(wined3d_texture); surface->container = container;
surface->wined3d_texture = wined3d_texture; surface->wined3d_texture = wined3d_texture;
surface->sub_resource_idx = sub_resource_idx; surface->sub_resource_idx = sub_resource_idx;
......
...@@ -211,7 +211,8 @@ HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapcha ...@@ -211,7 +211,8 @@ HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapcha
for (i = 0; i < desc->backbuffer_count; ++i) 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); IDirect3DSwapChain8_Release(&object->IDirect3DSwapChain8_iface);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -224,7 +225,8 @@ HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapcha ...@@ -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); 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); IDirect3DSwapChain8_Release(&object->IDirect3DSwapChain8_iface);
return E_OUTOFMEMORY; 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