d3d8: Get rid of IDirect3DIndexBuffer8Impl.
This commit is contained in:
parent
9b085a9260
commit
27ca37dbe0
|
@ -316,9 +316,9 @@ IDirect3DVertexBuffer8Impl *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVer
|
|||
return impl_from_IDirect3DVertexBuffer8(iface);
|
||||
}
|
||||
|
||||
static inline IDirect3DIndexBuffer8Impl *impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface)
|
||||
static inline struct d3d8_indexbuffer *impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IDirect3DIndexBuffer8Impl, IDirect3DIndexBuffer8_iface);
|
||||
return CONTAINING_RECORD(iface, struct d3d8_indexbuffer, IDirect3DIndexBuffer8_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3d8_indexbuffer_QueryInterface(IDirect3DIndexBuffer8 *iface, REFIID riid, void **object)
|
||||
|
@ -342,16 +342,16 @@ static HRESULT WINAPI d3d8_indexbuffer_QueryInterface(IDirect3DIndexBuffer8 *ifa
|
|||
|
||||
static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
ULONG refcount = InterlockedIncrement(&buffer->ref);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
ULONG refcount = InterlockedIncrement(&buffer->refcount);
|
||||
|
||||
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
if (refcount == 1)
|
||||
{
|
||||
IDirect3DDevice8_AddRef(buffer->parentDevice);
|
||||
IDirect3DDevice8_AddRef(buffer->parent_device);
|
||||
wined3d_mutex_lock();
|
||||
wined3d_buffer_incref(buffer->wineD3DIndexBuffer);
|
||||
wined3d_buffer_incref(buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
|
@ -360,17 +360,17 @@ static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface)
|
|||
|
||||
static ULONG WINAPI d3d8_indexbuffer_Release(IDirect3DIndexBuffer8 *iface)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
ULONG refcount = InterlockedDecrement(&buffer->ref);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
ULONG refcount = InterlockedDecrement(&buffer->refcount);
|
||||
|
||||
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
IDirect3DDevice8 *device = buffer->parentDevice;
|
||||
IDirect3DDevice8 *device = buffer->parent_device;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_buffer_decref(buffer->wineD3DIndexBuffer);
|
||||
wined3d_buffer_decref(buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
|
@ -383,11 +383,11 @@ static ULONG WINAPI d3d8_indexbuffer_Release(IDirect3DIndexBuffer8 *iface)
|
|||
static HRESULT WINAPI d3d8_indexbuffer_GetDevice(IDirect3DIndexBuffer8 *iface,
|
||||
IDirect3DDevice8 **device)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
|
||||
TRACE("iface %p, device %p.\n", iface, device);
|
||||
|
||||
*device = buffer->parentDevice;
|
||||
*device = buffer->parent_device;
|
||||
IDirect3DDevice8_AddRef(*device);
|
||||
|
||||
TRACE("Returning device %p.\n", *device);
|
||||
|
@ -398,7 +398,7 @@ static HRESULT WINAPI d3d8_indexbuffer_GetDevice(IDirect3DIndexBuffer8 *iface,
|
|||
static HRESULT WINAPI d3d8_indexbuffer_SetPrivateData(IDirect3DIndexBuffer8 *iface,
|
||||
REFGUID guid, const void *data, DWORD data_size, DWORD flags)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct wined3d_resource *resource;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -406,7 +406,7 @@ static HRESULT WINAPI d3d8_indexbuffer_SetPrivateData(IDirect3DIndexBuffer8 *ifa
|
|||
iface, debugstr_guid(guid), data, data_size, flags);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
resource = wined3d_buffer_get_resource(buffer->wineD3DIndexBuffer);
|
||||
resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
|
||||
hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -416,7 +416,7 @@ static HRESULT WINAPI d3d8_indexbuffer_SetPrivateData(IDirect3DIndexBuffer8 *ifa
|
|||
static HRESULT WINAPI d3d8_indexbuffer_GetPrivateData(IDirect3DIndexBuffer8 *iface,
|
||||
REFGUID guid, void *data, DWORD *data_size)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct wined3d_resource *resource;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -424,7 +424,7 @@ static HRESULT WINAPI d3d8_indexbuffer_GetPrivateData(IDirect3DIndexBuffer8 *ifa
|
|||
iface, debugstr_guid(guid), data, data_size);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
resource = wined3d_buffer_get_resource(buffer->wineD3DIndexBuffer);
|
||||
resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
|
||||
hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -433,14 +433,14 @@ static HRESULT WINAPI d3d8_indexbuffer_GetPrivateData(IDirect3DIndexBuffer8 *ifa
|
|||
|
||||
static HRESULT WINAPI d3d8_indexbuffer_FreePrivateData(IDirect3DIndexBuffer8 *iface, REFGUID guid)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct wined3d_resource *resource;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
|
||||
|
||||
wined3d_mutex_lock();
|
||||
resource = wined3d_buffer_get_resource(buffer->wineD3DIndexBuffer);
|
||||
resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
|
||||
hr = wined3d_resource_free_private_data(resource, guid);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -449,13 +449,13 @@ static HRESULT WINAPI d3d8_indexbuffer_FreePrivateData(IDirect3DIndexBuffer8 *if
|
|||
|
||||
static DWORD WINAPI d3d8_indexbuffer_SetPriority(IDirect3DIndexBuffer8 *iface, DWORD priority)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
DWORD previous;
|
||||
|
||||
TRACE("iface %p, priority %u.\n", iface, priority);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
previous = wined3d_buffer_set_priority(buffer->wineD3DIndexBuffer, priority);
|
||||
previous = wined3d_buffer_set_priority(buffer->wined3d_buffer, priority);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return previous;
|
||||
|
@ -463,13 +463,13 @@ static DWORD WINAPI d3d8_indexbuffer_SetPriority(IDirect3DIndexBuffer8 *iface, D
|
|||
|
||||
static DWORD WINAPI d3d8_indexbuffer_GetPriority(IDirect3DIndexBuffer8 *iface)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
DWORD priority;
|
||||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
priority = wined3d_buffer_get_priority(buffer->wineD3DIndexBuffer);
|
||||
priority = wined3d_buffer_get_priority(buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return priority;
|
||||
|
@ -477,12 +477,12 @@ static DWORD WINAPI d3d8_indexbuffer_GetPriority(IDirect3DIndexBuffer8 *iface)
|
|||
|
||||
static void WINAPI d3d8_indexbuffer_PreLoad(IDirect3DIndexBuffer8 *iface)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_buffer_preload(buffer->wineD3DIndexBuffer);
|
||||
wined3d_buffer_preload(buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
|
@ -496,14 +496,14 @@ static D3DRESOURCETYPE WINAPI d3d8_indexbuffer_GetType(IDirect3DIndexBuffer8 *if
|
|||
static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface, UINT offset, UINT size,
|
||||
BYTE **data, DWORD flags)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, offset %u, size %u, data %p, flags %#x.\n",
|
||||
iface, offset, size, data, flags);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_buffer_map(buffer->wineD3DIndexBuffer, offset, size, data, flags);
|
||||
hr = wined3d_buffer_map(buffer->wined3d_buffer, offset, size, data, flags);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
@ -511,12 +511,12 @@ static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface, UINT o
|
|||
|
||||
static HRESULT WINAPI d3d8_indexbuffer_Unlock(IDirect3DIndexBuffer8 *iface)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_buffer_unmap(buffer->wineD3DIndexBuffer);
|
||||
wined3d_buffer_unmap(buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return D3D_OK;
|
||||
|
@ -525,14 +525,14 @@ static HRESULT WINAPI d3d8_indexbuffer_Unlock(IDirect3DIndexBuffer8 *iface)
|
|||
static HRESULT WINAPI d3d8_indexbuffer_GetDesc(IDirect3DIndexBuffer8 *iface,
|
||||
D3DINDEXBUFFER_DESC *desc)
|
||||
{
|
||||
IDirect3DIndexBuffer8Impl *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
|
||||
struct wined3d_resource_desc wined3d_desc;
|
||||
struct wined3d_resource *wined3d_resource;
|
||||
|
||||
TRACE("iface %p, desc %p.\n", iface, desc);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DIndexBuffer);
|
||||
wined3d_resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
|
||||
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -576,18 +576,18 @@ static const struct wined3d_parent_ops d3d8_indexbuffer_wined3d_parent_ops =
|
|||
d3d8_indexbuffer_wined3d_object_destroyed,
|
||||
};
|
||||
|
||||
HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, struct d3d8_device *device,
|
||||
HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *device,
|
||||
UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
buffer->IDirect3DIndexBuffer8_iface.lpVtbl = &d3d8_indexbuffer_vtbl;
|
||||
buffer->ref = 1;
|
||||
buffer->refcount = 1;
|
||||
buffer->format = wined3dformat_from_d3dformat(format);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_buffer_create_ib(device->wined3d_device, size, usage & WINED3DUSAGE_MASK,
|
||||
(enum wined3d_pool)pool, buffer, &d3d8_indexbuffer_wined3d_parent_ops, &buffer->wineD3DIndexBuffer);
|
||||
(enum wined3d_pool)pool, buffer, &d3d8_indexbuffer_wined3d_parent_ops, &buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -595,13 +595,13 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, struct d3d8_device *
|
|||
return hr;
|
||||
}
|
||||
|
||||
buffer->parentDevice = &device->IDirect3DDevice8_iface;
|
||||
IUnknown_AddRef(buffer->parentDevice);
|
||||
buffer->parent_device = &device->IDirect3DDevice8_iface;
|
||||
IUnknown_AddRef(buffer->parent_device);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
IDirect3DIndexBuffer8Impl *unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface)
|
||||
struct d3d8_indexbuffer *unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface)
|
||||
{
|
||||
if (!iface)
|
||||
return NULL;
|
||||
|
|
|
@ -100,7 +100,6 @@
|
|||
|
||||
void fixup_caps(WINED3DCAPS *pWineCaps) DECLSPEC_HIDDEN;
|
||||
|
||||
typedef struct IDirect3DIndexBuffer8Impl IDirect3DIndexBuffer8Impl;
|
||||
typedef struct IDirect3DSurface8Impl IDirect3DSurface8Impl;
|
||||
typedef struct IDirect3DSwapChain8Impl IDirect3DSwapChain8Impl;
|
||||
typedef struct IDirect3DVolume8Impl IDirect3DVolume8Impl;
|
||||
|
@ -256,25 +255,18 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, struct d3d8_device
|
|||
UINT size, DWORD usage, DWORD fvf, D3DPOOL pool) DECLSPEC_HIDDEN;
|
||||
IDirect3DVertexBuffer8Impl *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/* --------------------- */
|
||||
/* IDirect3DIndexBuffer8 */
|
||||
/* --------------------- */
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirect3DIndexBuffer8 implementation structure
|
||||
*/
|
||||
struct IDirect3DIndexBuffer8Impl
|
||||
struct d3d8_indexbuffer
|
||||
{
|
||||
IDirect3DIndexBuffer8 IDirect3DIndexBuffer8_iface;
|
||||
LONG ref;
|
||||
struct wined3d_buffer *wineD3DIndexBuffer;
|
||||
IDirect3DDevice8 *parentDevice;
|
||||
LONG refcount;
|
||||
struct wined3d_buffer *wined3d_buffer;
|
||||
IDirect3DDevice8 *parent_device;
|
||||
enum wined3d_format_id format;
|
||||
};
|
||||
|
||||
HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, struct d3d8_device *device,
|
||||
HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *device,
|
||||
UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
|
||||
IDirect3DIndexBuffer8Impl *unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface) DECLSPEC_HIDDEN;
|
||||
struct d3d8_indexbuffer *unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
struct d3d8_texture
|
||||
{
|
||||
|
|
|
@ -804,7 +804,7 @@ static HRESULT WINAPI d3d8_device_CreateIndexBuffer(IDirect3DDevice8 *iface, UIN
|
|||
DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DIndexBuffer8 **buffer)
|
||||
{
|
||||
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
|
||||
IDirect3DIndexBuffer8Impl *object;
|
||||
struct d3d8_indexbuffer *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, size %u, usage %#x, format %#x, pool %#x, buffer %p.\n",
|
||||
|
@ -2325,7 +2325,7 @@ static HRESULT WINAPI d3d8_device_SetIndices(IDirect3DDevice8 *iface,
|
|||
IDirect3DIndexBuffer8 *buffer, UINT base_vertex_idx)
|
||||
{
|
||||
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
|
||||
IDirect3DIndexBuffer8Impl *ib = unsafe_impl_from_IDirect3DIndexBuffer8(buffer);
|
||||
struct d3d8_indexbuffer *ib = unsafe_impl_from_IDirect3DIndexBuffer8(buffer);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, buffer %p, base_vertex_idx %u.\n", iface, buffer, base_vertex_idx);
|
||||
|
@ -2339,7 +2339,7 @@ static HRESULT WINAPI d3d8_device_SetIndices(IDirect3DDevice8 *iface,
|
|||
wined3d_mutex_lock();
|
||||
wined3d_device_set_base_vertex_index(device->wined3d_device, base_vertex_idx);
|
||||
hr = wined3d_device_set_index_buffer(device->wined3d_device,
|
||||
ib ? ib->wineD3DIndexBuffer : NULL,
|
||||
ib ? ib->wined3d_buffer : NULL,
|
||||
ib ? ib->format : WINED3DFMT_UNKNOWN);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -2351,7 +2351,7 @@ static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface,
|
|||
{
|
||||
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
|
||||
struct wined3d_buffer *wined3d_buffer = NULL;
|
||||
IDirect3DIndexBuffer8Impl *buffer_impl;
|
||||
struct d3d8_indexbuffer *buffer_impl;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, buffer, base_vertex_index);
|
||||
|
|
Loading…
Reference in New Issue