d3d8: Get rid of IDirect3DVertexBuffer8Impl.
This commit is contained in:
parent
e3ecfa5974
commit
1993727ee7
|
@ -21,9 +21,9 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||
|
||||
static inline IDirect3DVertexBuffer8Impl *impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface)
|
||||
static inline struct d3d8_vertexbuffer *impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IDirect3DVertexBuffer8Impl, IDirect3DVertexBuffer8_iface);
|
||||
return CONTAINING_RECORD(iface, struct d3d8_vertexbuffer, IDirect3DVertexBuffer8_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3d8_vertexbuffer_QueryInterface(IDirect3DVertexBuffer8 *iface, REFIID riid, void **object)
|
||||
|
@ -47,16 +47,16 @@ static HRESULT WINAPI d3d8_vertexbuffer_QueryInterface(IDirect3DVertexBuffer8 *i
|
|||
|
||||
static ULONG WINAPI d3d8_vertexbuffer_AddRef(IDirect3DVertexBuffer8 *iface)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
ULONG refcount = InterlockedIncrement(&buffer->ref);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(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->wineD3DVertexBuffer);
|
||||
wined3d_buffer_incref(buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
|
@ -65,17 +65,17 @@ static ULONG WINAPI d3d8_vertexbuffer_AddRef(IDirect3DVertexBuffer8 *iface)
|
|||
|
||||
static ULONG WINAPI d3d8_vertexbuffer_Release(IDirect3DVertexBuffer8 *iface)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
ULONG refcount = InterlockedDecrement(&buffer->ref);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(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->wineD3DVertexBuffer);
|
||||
wined3d_buffer_decref(buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
/* Release the device last, as it may cause the device to be destroyed. */
|
||||
|
@ -88,11 +88,11 @@ static ULONG WINAPI d3d8_vertexbuffer_Release(IDirect3DVertexBuffer8 *iface)
|
|||
static HRESULT WINAPI d3d8_vertexbuffer_GetDevice(IDirect3DVertexBuffer8 *iface,
|
||||
IDirect3DDevice8 **device)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(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);
|
||||
|
@ -103,7 +103,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetDevice(IDirect3DVertexBuffer8 *iface,
|
|||
static HRESULT WINAPI d3d8_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer8 *iface,
|
||||
REFGUID guid, const void *data, DWORD data_size, DWORD flags)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct wined3d_resource *resource;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -111,7 +111,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer8 *i
|
|||
iface, debugstr_guid(guid), data, data_size, flags);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer);
|
||||
resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
|
||||
hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -121,7 +121,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer8 *i
|
|||
static HRESULT WINAPI d3d8_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer8 *iface,
|
||||
REFGUID guid, void *data, DWORD *data_size)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct wined3d_resource *resource;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -129,7 +129,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer8 *i
|
|||
iface, debugstr_guid(guid), data, data_size);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer);
|
||||
resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
|
||||
hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -138,14 +138,14 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer8 *i
|
|||
|
||||
static HRESULT WINAPI d3d8_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer8 *iface, REFGUID guid)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(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->wineD3DVertexBuffer);
|
||||
resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
|
||||
hr = wined3d_resource_free_private_data(resource, guid);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -154,13 +154,13 @@ static HRESULT WINAPI d3d8_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer8 *
|
|||
|
||||
static DWORD WINAPI d3d8_vertexbuffer_SetPriority(IDirect3DVertexBuffer8 *iface, DWORD priority)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
DWORD previous;
|
||||
|
||||
TRACE("iface %p, priority %u.\n", iface, priority);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
previous = wined3d_buffer_set_priority(buffer->wineD3DVertexBuffer, priority);
|
||||
previous = wined3d_buffer_set_priority(buffer->wined3d_buffer, priority);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return previous;
|
||||
|
@ -168,13 +168,13 @@ static DWORD WINAPI d3d8_vertexbuffer_SetPriority(IDirect3DVertexBuffer8 *iface,
|
|||
|
||||
static DWORD WINAPI d3d8_vertexbuffer_GetPriority(IDirect3DVertexBuffer8 *iface)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
DWORD priority;
|
||||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
priority = wined3d_buffer_get_priority(buffer->wineD3DVertexBuffer);
|
||||
priority = wined3d_buffer_get_priority(buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return priority;
|
||||
|
@ -182,12 +182,12 @@ static DWORD WINAPI d3d8_vertexbuffer_GetPriority(IDirect3DVertexBuffer8 *iface)
|
|||
|
||||
static void WINAPI d3d8_vertexbuffer_PreLoad(IDirect3DVertexBuffer8 *iface)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_buffer_preload(buffer->wineD3DVertexBuffer);
|
||||
wined3d_buffer_preload(buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
|
@ -201,14 +201,14 @@ static D3DRESOURCETYPE WINAPI d3d8_vertexbuffer_GetType(IDirect3DVertexBuffer8 *
|
|||
static HRESULT WINAPI d3d8_vertexbuffer_Lock(IDirect3DVertexBuffer8 *iface, UINT offset, UINT size,
|
||||
BYTE **data, DWORD flags)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(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->wineD3DVertexBuffer, offset, size, data, flags);
|
||||
hr = wined3d_buffer_map(buffer->wined3d_buffer, offset, size, data, flags);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
@ -216,12 +216,12 @@ static HRESULT WINAPI d3d8_vertexbuffer_Lock(IDirect3DVertexBuffer8 *iface, UINT
|
|||
|
||||
static HRESULT WINAPI d3d8_vertexbuffer_Unlock(IDirect3DVertexBuffer8 *iface)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_buffer_unmap(buffer->wineD3DVertexBuffer);
|
||||
wined3d_buffer_unmap(buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return D3D_OK;
|
||||
|
@ -230,14 +230,14 @@ static HRESULT WINAPI d3d8_vertexbuffer_Unlock(IDirect3DVertexBuffer8 *iface)
|
|||
static HRESULT WINAPI d3d8_vertexbuffer_GetDesc(IDirect3DVertexBuffer8 *iface,
|
||||
D3DVERTEXBUFFER_DESC *desc)
|
||||
{
|
||||
IDirect3DVertexBuffer8Impl *buffer = impl_from_IDirect3DVertexBuffer8(iface);
|
||||
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(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->wineD3DVertexBuffer);
|
||||
wined3d_resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
|
||||
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
@ -282,18 +282,18 @@ static const struct wined3d_parent_ops d3d8_vertexbuffer_wined3d_parent_ops =
|
|||
d3d8_vertexbuffer_wined3d_object_destroyed,
|
||||
};
|
||||
|
||||
HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, struct d3d8_device *device,
|
||||
HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device *device,
|
||||
UINT size, DWORD usage, DWORD fvf, D3DPOOL pool)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
buffer->IDirect3DVertexBuffer8_iface.lpVtbl = &Direct3DVertexBuffer8_Vtbl;
|
||||
buffer->ref = 1;
|
||||
buffer->refcount = 1;
|
||||
buffer->fvf = fvf;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_buffer_create_vb(device->wined3d_device, size, usage & WINED3DUSAGE_MASK,
|
||||
(enum wined3d_pool)pool, buffer, &d3d8_vertexbuffer_wined3d_parent_ops, &buffer->wineD3DVertexBuffer);
|
||||
(enum wined3d_pool)pool, buffer, &d3d8_vertexbuffer_wined3d_parent_ops, &buffer->wined3d_buffer);
|
||||
wined3d_mutex_unlock();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -301,13 +301,13 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *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;
|
||||
}
|
||||
|
||||
IDirect3DVertexBuffer8Impl *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface)
|
||||
struct d3d8_vertexbuffer *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface)
|
||||
{
|
||||
if (!iface)
|
||||
return NULL;
|
||||
|
|
|
@ -103,7 +103,6 @@ void fixup_caps(WINED3DCAPS *pWineCaps) DECLSPEC_HIDDEN;
|
|||
typedef struct IDirect3DSurface8Impl IDirect3DSurface8Impl;
|
||||
typedef struct IDirect3DSwapChain8Impl IDirect3DSwapChain8Impl;
|
||||
typedef struct IDirect3DVolume8Impl IDirect3DVolume8Impl;
|
||||
typedef struct IDirect3DVertexBuffer8Impl IDirect3DVertexBuffer8Impl;
|
||||
|
||||
struct d3d8
|
||||
{
|
||||
|
@ -235,25 +234,18 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, struct d3d8_device *device,
|
|||
DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN;
|
||||
IDirect3DSurface8Impl *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/* ---------------------- */
|
||||
/* IDirect3DVertexBuffer8 */
|
||||
/* ---------------------- */
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirect3DVertexBuffer8 implementation structure
|
||||
*/
|
||||
struct IDirect3DVertexBuffer8Impl
|
||||
struct d3d8_vertexbuffer
|
||||
{
|
||||
IDirect3DVertexBuffer8 IDirect3DVertexBuffer8_iface;
|
||||
LONG ref;
|
||||
struct wined3d_buffer *wineD3DVertexBuffer;
|
||||
IDirect3DDevice8 *parentDevice;
|
||||
LONG refcount;
|
||||
struct wined3d_buffer *wined3d_buffer;
|
||||
IDirect3DDevice8 *parent_device;
|
||||
DWORD fvf;
|
||||
};
|
||||
|
||||
HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, struct d3d8_device *device,
|
||||
HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device *device,
|
||||
UINT size, DWORD usage, DWORD fvf, D3DPOOL pool) DECLSPEC_HIDDEN;
|
||||
IDirect3DVertexBuffer8Impl *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface) DECLSPEC_HIDDEN;
|
||||
struct d3d8_vertexbuffer *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
struct d3d8_indexbuffer
|
||||
{
|
||||
|
|
|
@ -773,7 +773,7 @@ static HRESULT WINAPI d3d8_device_CreateVertexBuffer(IDirect3DDevice8 *iface, UI
|
|||
DWORD usage, DWORD fvf, D3DPOOL pool, IDirect3DVertexBuffer8 **buffer)
|
||||
{
|
||||
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
|
||||
IDirect3DVertexBuffer8Impl *object;
|
||||
struct d3d8_vertexbuffer *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, size %u, usage %#x, fvf %#x, pool %#x, buffer %p.\n",
|
||||
|
@ -1964,7 +1964,7 @@ static HRESULT WINAPI d3d8_device_ProcessVertices(IDirect3DDevice8 *iface, UINT
|
|||
UINT dst_idx, UINT vertex_count, IDirect3DVertexBuffer8 *dst_buffer, DWORD flags)
|
||||
{
|
||||
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
|
||||
IDirect3DVertexBuffer8Impl *dst = unsafe_impl_from_IDirect3DVertexBuffer8(dst_buffer);
|
||||
struct d3d8_vertexbuffer *dst = unsafe_impl_from_IDirect3DVertexBuffer8(dst_buffer);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, flags %#x.\n",
|
||||
|
@ -1972,7 +1972,7 @@ static HRESULT WINAPI d3d8_device_ProcessVertices(IDirect3DDevice8 *iface, UINT
|
|||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_process_vertices(device->wined3d_device, src_start_idx, dst_idx,
|
||||
vertex_count, dst->wineD3DVertexBuffer, NULL, flags, dst->fvf);
|
||||
vertex_count, dst->wined3d_buffer, NULL, flags, dst->fvf);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
@ -2632,7 +2632,7 @@ static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface,
|
|||
UINT stream_idx, IDirect3DVertexBuffer8 *buffer, UINT stride)
|
||||
{
|
||||
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
|
||||
IDirect3DVertexBuffer8Impl *buffer_impl = unsafe_impl_from_IDirect3DVertexBuffer8(buffer);
|
||||
struct d3d8_vertexbuffer *buffer_impl = unsafe_impl_from_IDirect3DVertexBuffer8(buffer);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, stream_idx %u, buffer %p, stride %u.\n",
|
||||
|
@ -2640,7 +2640,7 @@ static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface,
|
|||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_device_set_stream_source(device->wined3d_device, stream_idx,
|
||||
buffer_impl ? buffer_impl->wineD3DVertexBuffer : NULL, 0, stride);
|
||||
buffer_impl ? buffer_impl->wined3d_buffer : NULL, 0, stride);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
@ -2650,7 +2650,7 @@ static HRESULT WINAPI d3d8_device_GetStreamSource(IDirect3DDevice8 *iface,
|
|||
UINT stream_idx, IDirect3DVertexBuffer8 **buffer, UINT *stride)
|
||||
{
|
||||
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
|
||||
IDirect3DVertexBuffer8Impl *buffer_impl;
|
||||
struct d3d8_vertexbuffer *buffer_impl;
|
||||
struct wined3d_buffer *wined3d_buffer = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
|
|
Loading…
Reference in New Issue