Commit be13e91c authored by Elizabeth Figura's avatar Elizabeth Figura Committed by Alexandre Julliard

d3d8: Store the texture's parent device as a d3d8_device pointer.

parent 9b48143c
......@@ -243,7 +243,7 @@ struct d3d8_texture
IDirect3DBaseTexture8 IDirect3DBaseTexture8_iface;
struct d3d8_resource resource;
struct wined3d_texture *wined3d_texture, *draw_texture;
IDirect3DDevice8 *parent_device;
struct d3d8_device *parent_device;
struct list rtv_list;
};
......
......@@ -372,7 +372,7 @@ static const struct wined3d_parent_ops d3d8_view_wined3d_parent_ops =
struct d3d8_device *d3d8_surface_get_device(const struct d3d8_surface *surface)
{
IDirect3DDevice8 *device;
device = surface->texture ? surface->texture->parent_device : surface->parent_device;
device = surface->texture ? &surface->texture->parent_device->IDirect3DDevice8_iface : surface->parent_device;
return impl_from_IDirect3DDevice8(device);
}
......
......@@ -30,7 +30,7 @@ static ULONG d3d8_texture_incref(struct d3d8_texture *texture)
{
struct d3d8_surface *surface;
IDirect3DDevice8_AddRef(texture->parent_device);
IDirect3DDevice8_AddRef(&texture->parent_device->IDirect3DDevice8_iface);
wined3d_mutex_lock();
LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d8_surface, rtv_entry)
{
......@@ -51,7 +51,7 @@ static ULONG d3d8_texture_decref(struct d3d8_texture *texture)
if (!ref)
{
IDirect3DDevice8 *parent_device = texture->parent_device;
IDirect3DDevice8 *parent_device = &texture->parent_device->IDirect3DDevice8_iface;
struct d3d8_surface *surface;
wined3d_mutex_lock();
......@@ -70,11 +70,10 @@ static ULONG d3d8_texture_decref(struct d3d8_texture *texture)
static void d3d8_texture_preload(struct d3d8_texture *texture)
{
struct d3d8_device *device = impl_from_IDirect3DDevice8(texture->parent_device);
wined3d_mutex_lock();
if (texture->draw_texture)
wined3d_device_update_texture(device->wined3d_device, texture->wined3d_texture, texture->draw_texture);
wined3d_device_update_texture(texture->parent_device->wined3d_device,
texture->wined3d_texture, texture->draw_texture);
else
wined3d_resource_preload(wined3d_texture_get_resource(texture->wined3d_texture));
wined3d_mutex_unlock();
......@@ -135,7 +134,7 @@ static HRESULT WINAPI d3d8_texture_2d_GetDevice(IDirect3DTexture8 *iface, IDirec
TRACE("iface %p, device %p.\n", iface, device);
*device = texture->parent_device;
*device = &texture->parent_device->IDirect3DDevice8_iface;
IDirect3DDevice8_AddRef(*device);
TRACE("Returning device %p.\n", *device);
......@@ -436,7 +435,7 @@ static HRESULT WINAPI d3d8_texture_cube_GetDevice(IDirect3DCubeTexture8 *iface,
TRACE("iface %p, device %p.\n", iface, device);
*device = texture->parent_device;
*device = &texture->parent_device->IDirect3DDevice8_iface;
IDirect3DDevice8_AddRef(*device);
TRACE("Returning device %p.\n", *device);
......@@ -760,7 +759,7 @@ static HRESULT WINAPI d3d8_texture_3d_GetDevice(IDirect3DVolumeTexture8 *iface,
TRACE("iface %p, device %p.\n", iface, device);
*device = texture->parent_device;
*device = &texture->parent_device->IDirect3DDevice8_iface;
IDirect3DDevice8_AddRef(*device);
TRACE("Returning device %p.\n", *device);
......@@ -1103,8 +1102,8 @@ static HRESULT d3d8_texture_init(struct d3d8_texture *texture, struct d3d8_devic
}
wined3d_mutex_unlock();
texture->parent_device = &device->IDirect3DDevice8_iface;
IDirect3DDevice8_AddRef(texture->parent_device);
texture->parent_device = device;
IDirect3DDevice8_AddRef(&texture->parent_device->IDirect3DDevice8_iface);
return D3D_OK;
}
......
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