Commit 7bb17f49 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d8: Get rid of IDirect3DTexture8Impl.

parent e0390da6
...@@ -104,7 +104,6 @@ typedef struct IDirect3DBaseTexture8Impl IDirect3DBaseTexture8Impl; ...@@ -104,7 +104,6 @@ typedef struct IDirect3DBaseTexture8Impl IDirect3DBaseTexture8Impl;
typedef struct IDirect3DVolumeTexture8Impl IDirect3DVolumeTexture8Impl; typedef struct IDirect3DVolumeTexture8Impl IDirect3DVolumeTexture8Impl;
typedef struct IDirect3D8Impl IDirect3D8Impl; typedef struct IDirect3D8Impl IDirect3D8Impl;
typedef struct IDirect3DDevice8Impl IDirect3DDevice8Impl; typedef struct IDirect3DDevice8Impl IDirect3DDevice8Impl;
typedef struct IDirect3DTexture8Impl IDirect3DTexture8Impl;
typedef struct IDirect3DCubeTexture8Impl IDirect3DCubeTexture8Impl; typedef struct IDirect3DCubeTexture8Impl IDirect3DCubeTexture8Impl;
typedef struct IDirect3DIndexBuffer8Impl IDirect3DIndexBuffer8Impl; typedef struct IDirect3DIndexBuffer8Impl IDirect3DIndexBuffer8Impl;
typedef struct IDirect3DSurface8Impl IDirect3DSurface8Impl; typedef struct IDirect3DSurface8Impl IDirect3DSurface8Impl;
...@@ -311,6 +310,14 @@ struct IDirect3DBaseTexture8Impl ...@@ -311,6 +310,14 @@ struct IDirect3DBaseTexture8Impl
struct wined3d_texture *wined3d_texture; struct wined3d_texture *wined3d_texture;
}; };
struct d3d8_texture
{
IDirect3DTexture8 IDirect3DTexture8_iface;
LONG refcount;
struct wined3d_texture *wined3d_texture;
IDirect3DDevice8 *parent_device;
};
/* --------------------- */ /* --------------------- */
/* IDirect3DCubeTexture8 */ /* IDirect3DCubeTexture8 */
/* --------------------- */ /* --------------------- */
...@@ -329,22 +336,7 @@ struct IDirect3DCubeTexture8Impl ...@@ -329,22 +336,7 @@ struct IDirect3DCubeTexture8Impl
HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Impl *device, HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Impl *device,
UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN; UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
/* ----------------- */ HRESULT texture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
/* IDirect3DTexture8 */
/* ----------------- */
/*****************************************************************************
* IDirect3DTexture8 implementation structure
*/
struct IDirect3DTexture8Impl
{
IDirect3DTexture8 IDirect3DTexture8_iface;
LONG ref;
struct wined3d_texture *wined3d_texture;
IDirect3DDevice8 *parentDevice;
};
HRESULT texture_init(IDirect3DTexture8Impl *texture, IDirect3DDevice8Impl *device,
UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN; UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
/* ----------------------- */ /* ----------------------- */
......
...@@ -685,7 +685,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(IDirect3DDevice8 *iface ...@@ -685,7 +685,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(IDirect3DDevice8 *iface
D3DPOOL pool, IDirect3DTexture8 **texture) D3DPOOL pool, IDirect3DTexture8 **texture)
{ {
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IDirect3DTexture8Impl *object; struct d3d8_texture *object;
HRESULT hr; HRESULT hr;
TRACE("iface %p, width %u, height %u, levels %u, usage %#x, format %#x, pool %#x, texture %p.\n", TRACE("iface %p, width %u, height %u, levels %u, usage %#x, format %#x, pool %#x, texture %p.\n",
......
...@@ -23,16 +23,14 @@ ...@@ -23,16 +23,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d8); WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
/* IDirect3DTexture8 IUnknown parts follow: */ static inline struct d3d8_texture *impl_from_IDirect3DTexture8(IDirect3DTexture8 *iface)
static inline IDirect3DTexture8Impl *impl_from_IDirect3DTexture8(IDirect3DTexture8 *iface)
{ {
return CONTAINING_RECORD(iface, IDirect3DTexture8Impl, IDirect3DTexture8_iface); return CONTAINING_RECORD(iface, struct d3d8_texture, IDirect3DTexture8_iface);
} }
static HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(IDirect3DTexture8 *iface, REFIID riid, static HRESULT WINAPI d3d8_texture_2d_QueryInterface(IDirect3DTexture8 *iface, REFIID riid, void **out)
void **ppobj)
{ {
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
if (IsEqualGUID(riid, &IID_IDirect3DTexture8) if (IsEqualGUID(riid, &IID_IDirect3DTexture8)
|| IsEqualGUID(riid, &IID_IDirect3DBaseTexture8) || IsEqualGUID(riid, &IID_IDirect3DBaseTexture8)
...@@ -40,63 +38,62 @@ static HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(IDirect3DTexture8 *if ...@@ -40,63 +38,62 @@ static HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(IDirect3DTexture8 *if
|| IsEqualGUID(riid, &IID_IUnknown)) || IsEqualGUID(riid, &IID_IUnknown))
{ {
IUnknown_AddRef(iface); IUnknown_AddRef(iface);
*ppobj = iface; *out = iface;
return S_OK; return S_OK;
} }
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
*ppobj = NULL; *out = NULL;
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI IDirect3DTexture8Impl_AddRef(IDirect3DTexture8 *iface) static ULONG WINAPI d3d8_texture_2d_AddRef(IDirect3DTexture8 *iface)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&texture->refcount);
TRACE("%p increasing refcount to %u.\n", iface, ref); TRACE("%p increasing refcount to %u.\n", iface, ref);
if (ref == 1) if (ref == 1)
{ {
IDirect3DDevice8_AddRef(This->parentDevice); IDirect3DDevice8_AddRef(texture->parent_device);
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_texture_incref(This->wined3d_texture); wined3d_texture_incref(texture->wined3d_texture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
} }
return ref; return ref;
} }
static ULONG WINAPI IDirect3DTexture8Impl_Release(IDirect3DTexture8 *iface) static ULONG WINAPI d3d8_texture_2d_Release(IDirect3DTexture8 *iface)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&texture->refcount);
TRACE("%p decreasing refcount to %u.\n", iface, ref); TRACE("%p decreasing refcount to %u.\n", iface, ref);
if (ref == 0) { if (!ref)
IDirect3DDevice8 *parentDevice = This->parentDevice; {
IDirect3DDevice8 *parent_device = texture->parent_device;
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_texture_decref(This->wined3d_texture); wined3d_texture_decref(texture->wined3d_texture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */ /* Release the device last, as it may cause the device to be destroyed. */
IDirect3DDevice8_Release(parentDevice); IDirect3DDevice8_Release(parent_device);
} }
return ref; return ref;
} }
/* IDirect3DTexture8 IDirect3DResource8 Interface follow: */ static HRESULT WINAPI d3d8_texture_2d_GetDevice(IDirect3DTexture8 *iface, IDirect3DDevice8 **device)
static HRESULT WINAPI IDirect3DTexture8Impl_GetDevice(IDirect3DTexture8 *iface,
IDirect3DDevice8 **device)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
TRACE("iface %p, device %p.\n", iface, device); TRACE("iface %p, device %p.\n", iface, device);
*device = This->parentDevice; *device = texture->parent_device;
IDirect3DDevice8_AddRef(*device); IDirect3DDevice8_AddRef(*device);
TRACE("Returning device %p.\n", *device); TRACE("Returning device %p.\n", *device);
...@@ -104,152 +101,149 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetDevice(IDirect3DTexture8 *iface, ...@@ -104,152 +101,149 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetDevice(IDirect3DTexture8 *iface,
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_SetPrivateData(IDirect3DTexture8 *iface, static HRESULT WINAPI d3d8_texture_2d_SetPrivateData(IDirect3DTexture8 *iface,
REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) REFGUID guid, const void *data, DWORD data_size, DWORD flags)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
struct wined3d_resource *resource; struct wined3d_resource *resource;
HRESULT hr; HRESULT hr;
TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
iface, debugstr_guid(refguid), pData, SizeOfData, Flags); iface, debugstr_guid(guid), data, data_size, flags);
wined3d_mutex_lock(); wined3d_mutex_lock();
resource = wined3d_texture_get_resource(This->wined3d_texture); resource = wined3d_texture_get_resource(texture->wined3d_texture);
hr = wined3d_resource_set_private_data(resource, refguid, pData, SizeOfData, Flags); hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_GetPrivateData(IDirect3DTexture8 *iface, static HRESULT WINAPI d3d8_texture_2d_GetPrivateData(IDirect3DTexture8 *iface,
REFGUID refguid, void *pData, DWORD *pSizeOfData) REFGUID guid, void *data, DWORD *data_size)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
struct wined3d_resource *resource; struct wined3d_resource *resource;
HRESULT hr; HRESULT hr;
TRACE("iface %p, guid %s, data %p, data_size %p.\n", TRACE("iface %p, guid %s, data %p, data_size %p.\n",
iface, debugstr_guid(refguid), pData, pSizeOfData); iface, debugstr_guid(guid), data, data_size);
wined3d_mutex_lock(); wined3d_mutex_lock();
resource = wined3d_texture_get_resource(This->wined3d_texture); resource = wined3d_texture_get_resource(texture->wined3d_texture);
hr = wined3d_resource_get_private_data(resource, refguid, pData, pSizeOfData); hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_FreePrivateData(IDirect3DTexture8 *iface, static HRESULT WINAPI d3d8_texture_2d_FreePrivateData(IDirect3DTexture8 *iface, REFGUID guid)
REFGUID refguid)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
struct wined3d_resource *resource; struct wined3d_resource *resource;
HRESULT hr; HRESULT hr;
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid)); TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
wined3d_mutex_lock(); wined3d_mutex_lock();
resource = wined3d_texture_get_resource(This->wined3d_texture); resource = wined3d_texture_get_resource(texture->wined3d_texture);
hr = wined3d_resource_free_private_data(resource, refguid); hr = wined3d_resource_free_private_data(resource, guid);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
} }
static DWORD WINAPI IDirect3DTexture8Impl_SetPriority(IDirect3DTexture8 *iface, DWORD PriorityNew) static DWORD WINAPI d3d8_texture_2d_SetPriority(IDirect3DTexture8 *iface, DWORD priority)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
DWORD ret; DWORD ret;
TRACE("iface %p, priority %u.\n", iface, PriorityNew); TRACE("iface %p, priority %u.\n", iface, priority);
wined3d_mutex_lock(); wined3d_mutex_lock();
ret = wined3d_texture_set_priority(This->wined3d_texture, PriorityNew); ret = wined3d_texture_set_priority(texture->wined3d_texture, priority);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return ret; return ret;
} }
static DWORD WINAPI IDirect3DTexture8Impl_GetPriority(IDirect3DTexture8 *iface) static DWORD WINAPI d3d8_texture_2d_GetPriority(IDirect3DTexture8 *iface)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
DWORD ret; DWORD ret;
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); wined3d_mutex_lock();
ret = wined3d_texture_get_priority(This->wined3d_texture); ret = wined3d_texture_get_priority(texture->wined3d_texture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return ret; return ret;
} }
static void WINAPI IDirect3DTexture8Impl_PreLoad(IDirect3DTexture8 *iface) static void WINAPI d3d8_texture_2d_PreLoad(IDirect3DTexture8 *iface)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_texture_preload(This->wined3d_texture); wined3d_texture_preload(texture->wined3d_texture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
} }
static D3DRESOURCETYPE WINAPI IDirect3DTexture8Impl_GetType(IDirect3DTexture8 *iface) static D3DRESOURCETYPE WINAPI d3d8_texture_2d_GetType(IDirect3DTexture8 *iface)
{ {
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
return D3DRTYPE_TEXTURE; return D3DRTYPE_TEXTURE;
} }
/* IDirect3DTexture8 IDirect3DBaseTexture8 Interface follow: */ static DWORD WINAPI d3d8_texture_2d_SetLOD(IDirect3DTexture8 *iface, DWORD lod)
static DWORD WINAPI IDirect3DTexture8Impl_SetLOD(IDirect3DTexture8 *iface, DWORD LODNew)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
DWORD ret; DWORD ret;
TRACE("iface %p, lod %u.\n", iface, LODNew); TRACE("iface %p, lod %u.\n", iface, lod);
wined3d_mutex_lock(); wined3d_mutex_lock();
ret = wined3d_texture_set_lod(This->wined3d_texture, LODNew); ret = wined3d_texture_set_lod(texture->wined3d_texture, lod);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return ret; return ret;
} }
static DWORD WINAPI IDirect3DTexture8Impl_GetLOD(IDirect3DTexture8 *iface) static DWORD WINAPI d3d8_texture_2d_GetLOD(IDirect3DTexture8 *iface)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
DWORD ret; DWORD ret;
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); wined3d_mutex_lock();
ret = wined3d_texture_get_lod(This->wined3d_texture); ret = wined3d_texture_get_lod(texture->wined3d_texture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return ret; return ret;
} }
static DWORD WINAPI IDirect3DTexture8Impl_GetLevelCount(IDirect3DTexture8 *iface) static DWORD WINAPI d3d8_texture_2d_GetLevelCount(IDirect3DTexture8 *iface)
{ {
IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
DWORD ret; DWORD ret;
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); wined3d_mutex_lock();
ret = wined3d_texture_get_level_count(This->wined3d_texture); ret = wined3d_texture_get_level_count(texture->wined3d_texture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return ret; return ret;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(IDirect3DTexture8 *iface, static HRESULT WINAPI d3d8_texture_2d_GetLevelDesc(IDirect3DTexture8 *iface, UINT level, D3DSURFACE_DESC *desc)
UINT level, D3DSURFACE_DESC *desc)
{ {
IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
struct wined3d_resource *sub_resource; struct wined3d_resource *sub_resource;
HRESULT hr = D3D_OK; HRESULT hr = D3D_OK;
...@@ -277,10 +271,10 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(IDirect3DTexture8 *ifac ...@@ -277,10 +271,10 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(IDirect3DTexture8 *ifac
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_GetSurfaceLevel(IDirect3DTexture8 *iface, static HRESULT WINAPI d3d8_texture_2d_GetSurfaceLevel(IDirect3DTexture8 *iface,
UINT level, IDirect3DSurface8 **surface) UINT level, IDirect3DSurface8 **surface)
{ {
IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
struct wined3d_resource *sub_resource; struct wined3d_resource *sub_resource;
TRACE("iface %p, level %u, surface %p.\n", iface, level, surface); TRACE("iface %p, level %u, surface %p.\n", iface, level, surface);
...@@ -299,10 +293,10 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetSurfaceLevel(IDirect3DTexture8 *i ...@@ -299,10 +293,10 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetSurfaceLevel(IDirect3DTexture8 *i
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_LockRect(IDirect3DTexture8 *iface, UINT level, static HRESULT WINAPI d3d8_texture_2d_LockRect(IDirect3DTexture8 *iface, UINT level,
D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags) D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
{ {
IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
struct wined3d_resource *sub_resource; struct wined3d_resource *sub_resource;
HRESULT hr; HRESULT hr;
...@@ -320,9 +314,9 @@ static HRESULT WINAPI IDirect3DTexture8Impl_LockRect(IDirect3DTexture8 *iface, U ...@@ -320,9 +314,9 @@ static HRESULT WINAPI IDirect3DTexture8Impl_LockRect(IDirect3DTexture8 *iface, U
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_UnlockRect(IDirect3DTexture8 *iface, UINT level) static HRESULT WINAPI d3d8_texture_2d_UnlockRect(IDirect3DTexture8 *iface, UINT level)
{ {
IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
struct wined3d_resource *sub_resource; struct wined3d_resource *sub_resource;
HRESULT hr; HRESULT hr;
...@@ -338,9 +332,9 @@ static HRESULT WINAPI IDirect3DTexture8Impl_UnlockRect(IDirect3DTexture8 *iface, ...@@ -338,9 +332,9 @@ static HRESULT WINAPI IDirect3DTexture8Impl_UnlockRect(IDirect3DTexture8 *iface,
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_AddDirtyRect(IDirect3DTexture8 *iface, const RECT *dirty_rect) static HRESULT WINAPI d3d8_texture_2d_AddDirtyRect(IDirect3DTexture8 *iface, const RECT *dirty_rect)
{ {
IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
HRESULT hr; HRESULT hr;
TRACE("iface %p, dirty_rect %s.\n", TRACE("iface %p, dirty_rect %s.\n",
...@@ -369,28 +363,28 @@ static HRESULT WINAPI IDirect3DTexture8Impl_AddDirtyRect(IDirect3DTexture8 *ifac ...@@ -369,28 +363,28 @@ static HRESULT WINAPI IDirect3DTexture8Impl_AddDirtyRect(IDirect3DTexture8 *ifac
static const IDirect3DTexture8Vtbl Direct3DTexture8_Vtbl = static const IDirect3DTexture8Vtbl Direct3DTexture8_Vtbl =
{ {
/* IUnknown */ /* IUnknown */
IDirect3DTexture8Impl_QueryInterface, d3d8_texture_2d_QueryInterface,
IDirect3DTexture8Impl_AddRef, d3d8_texture_2d_AddRef,
IDirect3DTexture8Impl_Release, d3d8_texture_2d_Release,
/* IDirect3DResource8 */ /* IDirect3DResource8 */
IDirect3DTexture8Impl_GetDevice, d3d8_texture_2d_GetDevice,
IDirect3DTexture8Impl_SetPrivateData, d3d8_texture_2d_SetPrivateData,
IDirect3DTexture8Impl_GetPrivateData, d3d8_texture_2d_GetPrivateData,
IDirect3DTexture8Impl_FreePrivateData, d3d8_texture_2d_FreePrivateData,
IDirect3DTexture8Impl_SetPriority, d3d8_texture_2d_SetPriority,
IDirect3DTexture8Impl_GetPriority, d3d8_texture_2d_GetPriority,
IDirect3DTexture8Impl_PreLoad, d3d8_texture_2d_PreLoad,
IDirect3DTexture8Impl_GetType, d3d8_texture_2d_GetType,
/* IDirect3dBaseTexture8 */ /* IDirect3dBaseTexture8 */
IDirect3DTexture8Impl_SetLOD, d3d8_texture_2d_SetLOD,
IDirect3DTexture8Impl_GetLOD, d3d8_texture_2d_GetLOD,
IDirect3DTexture8Impl_GetLevelCount, d3d8_texture_2d_GetLevelCount,
/* IDirect3DTexture8 */ /* IDirect3DTexture8 */
IDirect3DTexture8Impl_GetLevelDesc, d3d8_texture_2d_GetLevelDesc,
IDirect3DTexture8Impl_GetSurfaceLevel, d3d8_texture_2d_GetSurfaceLevel,
IDirect3DTexture8Impl_LockRect, d3d8_texture_2d_LockRect,
IDirect3DTexture8Impl_UnlockRect, d3d8_texture_2d_UnlockRect,
IDirect3DTexture8Impl_AddDirtyRect d3d8_texture_2d_AddDirtyRect,
}; };
static void STDMETHODCALLTYPE d3d8_texture_wined3d_object_destroyed(void *parent) static void STDMETHODCALLTYPE d3d8_texture_wined3d_object_destroyed(void *parent)
...@@ -403,13 +397,13 @@ static const struct wined3d_parent_ops d3d8_texture_wined3d_parent_ops = ...@@ -403,13 +397,13 @@ static const struct wined3d_parent_ops d3d8_texture_wined3d_parent_ops =
d3d8_texture_wined3d_object_destroyed, d3d8_texture_wined3d_object_destroyed,
}; };
HRESULT texture_init(IDirect3DTexture8Impl *texture, IDirect3DDevice8Impl *device, HRESULT texture_init(struct d3d8_texture *texture, IDirect3DDevice8Impl *device,
UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
{ {
HRESULT hr; HRESULT hr;
texture->IDirect3DTexture8_iface.lpVtbl = &Direct3DTexture8_Vtbl; texture->IDirect3DTexture8_iface.lpVtbl = &Direct3DTexture8_Vtbl;
texture->ref = 1; texture->refcount = 1;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_texture_create_2d(device->wined3d_device, width, height, levels, hr = wined3d_texture_create_2d(device->wined3d_device, width, height, levels,
...@@ -422,8 +416,8 @@ HRESULT texture_init(IDirect3DTexture8Impl *texture, IDirect3DDevice8Impl *devic ...@@ -422,8 +416,8 @@ HRESULT texture_init(IDirect3DTexture8Impl *texture, IDirect3DDevice8Impl *devic
return hr; return hr;
} }
texture->parentDevice = &device->IDirect3DDevice8_iface; texture->parent_device = &device->IDirect3DDevice8_iface;
IDirect3DDevice8_AddRef(texture->parentDevice); IDirect3DDevice8_AddRef(texture->parent_device);
return D3D_OK; 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