Commit a27ee75e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Remove COM from the buffer implementation.

parent b7c427b4
......@@ -53,7 +53,8 @@ static ULONG STDMETHODCALLTYPE d3d10_buffer_AddRef(ID3D10Buffer *iface)
TRACE("%p increasing refcount to %u\n", This, refcount);
if (refcount == 1) IWineD3DBuffer_AddRef(This->wined3d_buffer);
if (refcount == 1)
wined3d_buffer_incref(This->wined3d_buffer);
return refcount;
}
......@@ -67,7 +68,7 @@ static ULONG STDMETHODCALLTYPE d3d10_buffer_Release(ID3D10Buffer *iface)
if (!refcount)
{
IWineD3DBuffer_Release(This->wined3d_buffer);
wined3d_buffer_decref(This->wined3d_buffer);
}
return refcount;
......@@ -140,14 +141,14 @@ static HRESULT STDMETHODCALLTYPE d3d10_buffer_Map(ID3D10Buffer *iface, D3D10_MAP
if (map_flags)
FIXME("Ignoring map_flags %#x.\n", map_flags);
return IWineD3DBuffer_Map(buffer->wined3d_buffer, 0, 0, (BYTE **)data, 0);
return wined3d_buffer_map(buffer->wined3d_buffer, 0, 0, (BYTE **)data, 0);
}
static void STDMETHODCALLTYPE d3d10_buffer_Unmap(ID3D10Buffer *iface)
{
TRACE("iface %p.\n", iface);
IWineD3DBuffer_Unmap(((struct d3d10_buffer *)iface)->wined3d_buffer);
wined3d_buffer_unmap(((struct d3d10_buffer *)iface)->wined3d_buffer);
}
static void STDMETHODCALLTYPE d3d10_buffer_GetDesc(ID3D10Buffer *iface, D3D10_BUFFER_DESC *desc)
......
......@@ -113,7 +113,7 @@ struct d3d10_buffer
const struct ID3D10BufferVtbl *vtbl;
LONG refcount;
IWineD3DBuffer *wined3d_buffer;
struct wined3d_buffer *wined3d_buffer;
};
HRESULT d3d10_buffer_init(struct d3d10_buffer *buffer, struct d3d10_device *device,
......
......@@ -34,7 +34,7 @@ static struct wined3d_resource *wined3d_resource_from_resource(ID3D10Resource *r
switch(dimension)
{
case D3D10_RESOURCE_DIMENSION_BUFFER:
return IWineD3DBuffer_GetResource(((struct d3d10_buffer *)resource)->wined3d_buffer);
return wined3d_buffer_get_resource(((struct d3d10_buffer *)resource)->wined3d_buffer);
case D3D10_RESOURCE_DIMENSION_TEXTURE2D:
return IWineD3DSurface_GetResource(((struct d3d10_texture2d *)resource)->wined3d_surface);
......
......@@ -51,7 +51,7 @@ static ULONG WINAPI d3d8_vertexbuffer_AddRef(IDirect3DVertexBuffer8 *iface)
{
IDirect3DDevice8_AddRef(buffer->parentDevice);
wined3d_mutex_lock();
IWineD3DBuffer_AddRef(buffer->wineD3DVertexBuffer);
wined3d_buffer_incref(buffer->wineD3DVertexBuffer);
wined3d_mutex_unlock();
}
......@@ -70,7 +70,7 @@ static ULONG WINAPI d3d8_vertexbuffer_Release(IDirect3DVertexBuffer8 *iface)
IDirect3DDevice8 *device = buffer->parentDevice;
wined3d_mutex_lock();
IWineD3DBuffer_Release(buffer->wineD3DVertexBuffer);
wined3d_buffer_decref(buffer->wineD3DVertexBuffer);
wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */
......@@ -101,7 +101,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer8 *i
iface, debugstr_guid(guid), data, data_size, flags);
wined3d_mutex_lock();
hr = IWineD3DBuffer_SetPrivateData(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer,
hr = wined3d_buffer_set_private_data(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer,
guid, data, data_size, flags);
wined3d_mutex_unlock();
......@@ -117,7 +117,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer8 *i
iface, debugstr_guid(guid), data, data_size);
wined3d_mutex_lock();
hr = IWineD3DBuffer_GetPrivateData(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer,
hr = wined3d_buffer_get_private_data(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer,
guid, data, data_size);
wined3d_mutex_unlock();
......@@ -131,7 +131,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer8 *
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
wined3d_mutex_lock();
hr = IWineD3DBuffer_FreePrivateData(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, guid);
hr = wined3d_buffer_free_private_data(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, guid);
wined3d_mutex_unlock();
return hr;
......@@ -144,7 +144,7 @@ static DWORD WINAPI d3d8_vertexbuffer_SetPriority(IDirect3DVertexBuffer8 *iface,
TRACE("iface %p, priority %u.\n", iface, priority);
wined3d_mutex_lock();
previous = IWineD3DBuffer_SetPriority(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, priority);
previous = wined3d_buffer_set_priority(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, priority);
wined3d_mutex_unlock();
return previous;
......@@ -157,7 +157,7 @@ static DWORD WINAPI d3d8_vertexbuffer_GetPriority(IDirect3DVertexBuffer8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
priority = IWineD3DBuffer_GetPriority(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer);
priority = wined3d_buffer_get_priority(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer);
wined3d_mutex_unlock();
return priority;
......@@ -168,7 +168,7 @@ static void WINAPI d3d8_vertexbuffer_PreLoad(IDirect3DVertexBuffer8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
IWineD3DBuffer_PreLoad(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer);
wined3d_buffer_preload(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer);
wined3d_mutex_unlock();
}
......@@ -188,7 +188,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_Lock(IDirect3DVertexBuffer8 *iface,
iface, offset, size, data, flags);
wined3d_mutex_lock();
hr = IWineD3DBuffer_Map(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer,
hr = wined3d_buffer_map(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer,
offset, size, data, flags);
wined3d_mutex_unlock();
......@@ -200,7 +200,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_Unlock(IDirect3DVertexBuffer8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
IWineD3DBuffer_Unmap(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer);
wined3d_buffer_unmap(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer);
wined3d_mutex_unlock();
return D3D_OK;
......@@ -214,7 +214,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetDesc(IDirect3DVertexBuffer8 *iface, D
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
IWineD3DBuffer_GetDesc(buffer->wineD3DVertexBuffer, &wined3d_desc);
wined3d_buffer_get_desc(buffer->wineD3DVertexBuffer, &wined3d_desc);
wined3d_mutex_unlock();
desc->Type = D3DRTYPE_VERTEXBUFFER;
......@@ -313,7 +313,7 @@ static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface)
{
IDirect3DDevice8_AddRef(buffer->parentDevice);
wined3d_mutex_lock();
IWineD3DBuffer_AddRef(buffer->wineD3DIndexBuffer);
wined3d_buffer_incref(buffer->wineD3DIndexBuffer);
wined3d_mutex_unlock();
}
......@@ -332,7 +332,7 @@ static ULONG WINAPI d3d8_indexbuffer_Release(IDirect3DIndexBuffer8 *iface)
IDirect3DDevice8 *device = buffer->parentDevice;
wined3d_mutex_lock();
IWineD3DBuffer_Release(buffer->wineD3DIndexBuffer);
wined3d_buffer_decref(buffer->wineD3DIndexBuffer);
wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */
......@@ -363,7 +363,7 @@ static HRESULT WINAPI d3d8_indexbuffer_SetPrivateData(IDirect3DIndexBuffer8 *ifa
iface, debugstr_guid(guid), data, data_size, flags);
wined3d_mutex_lock();
hr = IWineD3DBuffer_SetPrivateData(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer,
hr = wined3d_buffer_set_private_data(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer,
guid, data, data_size, flags);
wined3d_mutex_unlock();
......@@ -379,7 +379,7 @@ static HRESULT WINAPI d3d8_indexbuffer_GetPrivateData(IDirect3DIndexBuffer8 *ifa
iface, debugstr_guid(guid), data, data_size);
wined3d_mutex_lock();
hr = IWineD3DBuffer_GetPrivateData(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer,
hr = wined3d_buffer_get_private_data(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer,
guid, data, data_size);
wined3d_mutex_unlock();
......@@ -393,7 +393,7 @@ static HRESULT WINAPI d3d8_indexbuffer_FreePrivateData(IDirect3DIndexBuffer8 *if
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
wined3d_mutex_lock();
hr = IWineD3DBuffer_FreePrivateData(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, guid);
hr = wined3d_buffer_free_private_data(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, guid);
wined3d_mutex_unlock();
return hr;
......@@ -406,7 +406,7 @@ static DWORD WINAPI d3d8_indexbuffer_SetPriority(IDirect3DIndexBuffer8 *iface, D
TRACE("iface %p, priority %u.\n", iface, priority);
wined3d_mutex_lock();
previous = IWineD3DBuffer_SetPriority(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, priority);
previous = wined3d_buffer_set_priority(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, priority);
wined3d_mutex_unlock();
return previous;
......@@ -419,7 +419,7 @@ static DWORD WINAPI d3d8_indexbuffer_GetPriority(IDirect3DIndexBuffer8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
priority = IWineD3DBuffer_GetPriority(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer);
priority = wined3d_buffer_get_priority(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer);
wined3d_mutex_unlock();
return priority;
......@@ -430,7 +430,7 @@ static void WINAPI d3d8_indexbuffer_PreLoad(IDirect3DIndexBuffer8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
IWineD3DBuffer_PreLoad(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer);
wined3d_buffer_preload(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer);
wined3d_mutex_unlock();
}
......@@ -450,7 +450,7 @@ static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface,
iface, offset, size, data, flags);
wined3d_mutex_lock();
hr = IWineD3DBuffer_Map(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer,
hr = wined3d_buffer_map(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer,
offset, size, data, flags);
wined3d_mutex_unlock();
......@@ -462,7 +462,7 @@ static HRESULT WINAPI d3d8_indexbuffer_Unlock(IDirect3DIndexBuffer8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
IWineD3DBuffer_Unmap(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer);
wined3d_buffer_unmap(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer);
wined3d_mutex_unlock();
return D3D_OK;
......@@ -476,7 +476,7 @@ static HRESULT WINAPI d3d8_indexbuffer_GetDesc(IDirect3DIndexBuffer8 *iface, D3D
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
IWineD3DBuffer_GetDesc(buffer->wineD3DIndexBuffer, &wined3d_desc);
wined3d_buffer_get_desc(buffer->wineD3DIndexBuffer, &wined3d_desc);
wined3d_mutex_unlock();
desc->Format = d3dformat_from_wined3dformat(buffer->format);
......
......@@ -283,13 +283,9 @@ struct IDirect3DVertexBuffer8Impl
const IDirect3DVertexBuffer8Vtbl *lpVtbl;
LONG ref;
/* IDirect3DResource8 fields */
IWineD3DBuffer *wineD3DVertexBuffer;
/* Parent reference */
LPDIRECT3DDEVICE8 parentDevice;
DWORD fvf;
struct wined3d_buffer *wineD3DVertexBuffer;
IDirect3DDevice8 *parentDevice;
DWORD fvf;
};
HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Impl *device,
......@@ -308,12 +304,8 @@ struct IDirect3DIndexBuffer8Impl
const IDirect3DIndexBuffer8Vtbl *lpVtbl;
LONG ref;
/* IDirect3DResource8 fields */
IWineD3DBuffer *wineD3DIndexBuffer;
/* Parent reference */
LPDIRECT3DDEVICE8 parentDevice;
struct wined3d_buffer *wineD3DIndexBuffer;
IDirect3DDevice8 *parentDevice;
enum wined3d_format_id format;
};
......
......@@ -2277,7 +2277,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(IDirect3DDevice8 *iface,
IDirect3DIndexBuffer8 **ppIndexData, UINT *pBaseVertexIndex)
{
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IWineD3DBuffer *retIndexData = NULL;
struct wined3d_buffer *retIndexData = NULL;
HRESULT hr;
TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, ppIndexData, pBaseVertexIndex);
......@@ -2292,9 +2292,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(IDirect3DDevice8 *iface,
hr = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData);
if (SUCCEEDED(hr) && retIndexData)
{
*ppIndexData = IWineD3DBuffer_GetParent(retIndexData);
*ppIndexData = wined3d_buffer_get_parent(retIndexData);
IDirect3DIndexBuffer8_AddRef(*ppIndexData);
IWineD3DBuffer_Release(retIndexData);
wined3d_buffer_decref(retIndexData);
} else {
if (FAILED(hr)) FIXME("Call to GetIndices failed\n");
*ppIndexData = NULL;
......@@ -2583,7 +2583,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(IDirect3DDevice8 *ifa
UINT StreamNumber, IDirect3DVertexBuffer8 **pStream, UINT *pStride)
{
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IWineD3DBuffer *retStream = NULL;
struct wined3d_buffer *retStream = NULL;
HRESULT hr;
TRACE("iface %p, stream_idx %u, buffer %p, stride %p.\n",
......@@ -2598,9 +2598,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(IDirect3DDevice8 *ifa
&retStream, 0 /* Offset in bytes */, pStride);
if (SUCCEEDED(hr) && retStream)
{
*pStream = IWineD3DBuffer_GetParent(retStream);
*pStream = wined3d_buffer_get_parent(retStream);
IDirect3DVertexBuffer8_AddRef(*pStream);
IWineD3DBuffer_Release(retStream);
wined3d_buffer_decref(retStream);
}
else
{
......
......@@ -53,7 +53,7 @@ static ULONG WINAPI d3d9_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface)
{
IDirect3DDevice9Ex_AddRef(buffer->parentDevice);
wined3d_mutex_lock();
IWineD3DBuffer_AddRef(buffer->wineD3DVertexBuffer);
wined3d_buffer_incref(buffer->wineD3DVertexBuffer);
wined3d_mutex_unlock();
}
......@@ -72,7 +72,7 @@ static ULONG WINAPI d3d9_vertexbuffer_Release(IDirect3DVertexBuffer9 *iface)
IDirect3DDevice9Ex *device = buffer->parentDevice;
wined3d_mutex_lock();
IWineD3DBuffer_Release(buffer->wineD3DVertexBuffer);
wined3d_buffer_decref(buffer->wineD3DVertexBuffer);
wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */
......@@ -103,7 +103,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer9 *i
iface, debugstr_guid(guid), data, data_size, flags);
wined3d_mutex_lock();
hr = IWineD3DBuffer_SetPrivateData(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer,
hr = wined3d_buffer_set_private_data(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer,
guid, data, data_size, flags);
wined3d_mutex_unlock();
......@@ -119,7 +119,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer9 *i
iface, debugstr_guid(guid), data, data_size);
wined3d_mutex_lock();
hr = IWineD3DBuffer_GetPrivateData(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer,
hr = wined3d_buffer_get_private_data(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer,
guid, data, data_size);
wined3d_mutex_unlock();
......@@ -133,7 +133,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer9 *
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
wined3d_mutex_lock();
hr = IWineD3DBuffer_FreePrivateData(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, guid);
hr = wined3d_buffer_free_private_data(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, guid);
wined3d_mutex_unlock();
return hr;
......@@ -146,7 +146,7 @@ static DWORD WINAPI d3d9_vertexbuffer_SetPriority(IDirect3DVertexBuffer9 *iface,
TRACE("iface %p, priority %u.\n", iface, priority);
wined3d_mutex_lock();
previous = IWineD3DBuffer_SetPriority(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, priority);
previous = wined3d_buffer_set_priority(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, priority);
wined3d_mutex_unlock();
return previous;
......@@ -159,7 +159,7 @@ static DWORD WINAPI d3d9_vertexbuffer_GetPriority(IDirect3DVertexBuffer9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
priority = IWineD3DBuffer_GetPriority(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer);
priority = wined3d_buffer_get_priority(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer);
wined3d_mutex_unlock();
return priority;
......@@ -170,7 +170,7 @@ static void WINAPI d3d9_vertexbuffer_PreLoad(IDirect3DVertexBuffer9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
IWineD3DBuffer_PreLoad(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer);
wined3d_buffer_preload(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer);
wined3d_mutex_unlock();
}
......@@ -190,7 +190,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_Lock(IDirect3DVertexBuffer9 *iface,
iface, offset, size, data, flags);
wined3d_mutex_lock();
hr = IWineD3DBuffer_Map(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer,
hr = wined3d_buffer_map(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer,
offset, size, (BYTE **)data, flags);
wined3d_mutex_unlock();
......@@ -202,7 +202,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_Unlock(IDirect3DVertexBuffer9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
IWineD3DBuffer_Unmap(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer);
wined3d_buffer_unmap(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer);
wined3d_mutex_unlock();
return D3D_OK;
......@@ -216,7 +216,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_GetDesc(IDirect3DVertexBuffer9 *iface, D
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
IWineD3DBuffer_GetDesc(buffer->wineD3DVertexBuffer, &wined3d_desc);
wined3d_buffer_get_desc(buffer->wineD3DVertexBuffer, &wined3d_desc);
wined3d_mutex_unlock();
desc->Format = D3DFMT_VERTEXDATA;
......@@ -315,7 +315,7 @@ static ULONG WINAPI d3d9_indexbuffer_AddRef(IDirect3DIndexBuffer9 *iface)
{
IDirect3DDevice9Ex_AddRef(buffer->parentDevice);
wined3d_mutex_lock();
IWineD3DBuffer_AddRef(buffer->wineD3DIndexBuffer);
wined3d_buffer_incref(buffer->wineD3DIndexBuffer);
wined3d_mutex_unlock();
}
......@@ -334,7 +334,7 @@ static ULONG WINAPI d3d9_indexbuffer_Release(IDirect3DIndexBuffer9 *iface)
IDirect3DDevice9Ex *device = buffer->parentDevice;
wined3d_mutex_lock();
IWineD3DBuffer_Release(buffer->wineD3DIndexBuffer);
wined3d_buffer_decref(buffer->wineD3DIndexBuffer);
wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */
......@@ -365,7 +365,7 @@ static HRESULT WINAPI d3d9_indexbuffer_SetPrivateData(IDirect3DIndexBuffer9 *ifa
iface, debugstr_guid(guid), data, data_size, flags);
wined3d_mutex_lock();
hr = IWineD3DBuffer_SetPrivateData(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer,
hr = wined3d_buffer_set_private_data(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer,
guid, data, data_size, flags);
wined3d_mutex_unlock();
......@@ -381,7 +381,7 @@ static HRESULT WINAPI d3d9_indexbuffer_GetPrivateData(IDirect3DIndexBuffer9 *ifa
iface, debugstr_guid(guid), data, data_size);
wined3d_mutex_lock();
hr = IWineD3DBuffer_GetPrivateData(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer,
hr = wined3d_buffer_get_private_data(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer,
guid, data, data_size);
wined3d_mutex_unlock();
......@@ -395,7 +395,7 @@ static HRESULT WINAPI d3d9_indexbuffer_FreePrivateData(IDirect3DIndexBuffer9 *if
TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
wined3d_mutex_lock();
hr = IWineD3DBuffer_FreePrivateData(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, guid);
hr = wined3d_buffer_free_private_data(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, guid);
wined3d_mutex_unlock();
return hr;
......@@ -408,7 +408,7 @@ static DWORD WINAPI d3d9_indexbuffer_SetPriority(IDirect3DIndexBuffer9 *iface, D
TRACE("iface %p, priority %u.\n", iface, priority);
wined3d_mutex_lock();
previous = IWineD3DBuffer_SetPriority(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, priority);
previous = wined3d_buffer_set_priority(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, priority);
wined3d_mutex_unlock();
return previous;
......@@ -421,7 +421,7 @@ static DWORD WINAPI d3d9_indexbuffer_GetPriority(IDirect3DIndexBuffer9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
priority = IWineD3DBuffer_GetPriority(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer);
priority = wined3d_buffer_get_priority(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer);
wined3d_mutex_unlock();
return priority;
......@@ -432,7 +432,7 @@ static void WINAPI d3d9_indexbuffer_PreLoad(IDirect3DIndexBuffer9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
IWineD3DBuffer_PreLoad(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer);
wined3d_buffer_preload(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer);
wined3d_mutex_unlock();
}
......@@ -452,7 +452,7 @@ static HRESULT WINAPI d3d9_indexbuffer_Lock(IDirect3DIndexBuffer9 *iface,
iface, offset, size, data, flags);
wined3d_mutex_lock();
hr = IWineD3DBuffer_Map(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer,
hr = wined3d_buffer_map(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer,
offset, size, (BYTE **)data, flags);
wined3d_mutex_unlock();
......@@ -464,7 +464,7 @@ static HRESULT WINAPI d3d9_indexbuffer_Unlock(IDirect3DIndexBuffer9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
IWineD3DBuffer_Unmap(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer);
wined3d_buffer_unmap(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer);
wined3d_mutex_unlock();
return D3D_OK;
......@@ -478,7 +478,7 @@ static HRESULT WINAPI d3d9_indexbuffer_GetDesc(IDirect3DIndexBuffer9 *iface, D3D
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
IWineD3DBuffer_GetDesc(buffer->wineD3DIndexBuffer, &wined3d_desc);
wined3d_buffer_get_desc(buffer->wineD3DIndexBuffer, &wined3d_desc);
wined3d_mutex_unlock();
desc->Format = d3dformat_from_wined3dformat(buffer->format);
......
......@@ -275,12 +275,8 @@ typedef struct IDirect3DVertexBuffer9Impl
const IDirect3DVertexBuffer9Vtbl *lpVtbl;
LONG ref;
/* IDirect3DResource9 fields */
IWineD3DBuffer *wineD3DVertexBuffer;
/* Parent reference */
LPDIRECT3DDEVICE9EX parentDevice;
struct wined3d_buffer *wineD3DVertexBuffer;
IDirect3DDevice9Ex *parentDevice;
DWORD fvf;
} IDirect3DVertexBuffer9Impl;
......@@ -300,11 +296,8 @@ typedef struct IDirect3DIndexBuffer9Impl
const IDirect3DIndexBuffer9Vtbl *lpVtbl;
LONG ref;
/* IDirect3DResource9 fields */
IWineD3DBuffer *wineD3DIndexBuffer;
/* Parent reference */
LPDIRECT3DDEVICE9EX parentDevice;
struct wined3d_buffer *wineD3DIndexBuffer;
IDirect3DDevice9Ex *parentDevice;
enum wined3d_format_id format;
} IDirect3DIndexBuffer9Impl;
......
......@@ -2381,7 +2381,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(IDirect3DDevice9Ex *i
UINT StreamNumber, IDirect3DVertexBuffer9 **pStream, UINT* OffsetInBytes, UINT* pStride)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DBuffer *retStream = NULL;
struct wined3d_buffer *retStream = NULL;
HRESULT hr;
TRACE("iface %p, stream_idx %u, buffer %p, offset %p, stride %p.\n",
......@@ -2395,9 +2395,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(IDirect3DDevice9Ex *i
hr = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, OffsetInBytes, pStride);
if (SUCCEEDED(hr) && retStream)
{
*pStream = IWineD3DBuffer_GetParent(retStream);
*pStream = wined3d_buffer_get_parent(retStream);
IDirect3DVertexBuffer9_AddRef(*pStream);
IWineD3DBuffer_Release(retStream);
wined3d_buffer_decref(retStream);
}
else
{
......@@ -2459,7 +2459,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9EX ifac
static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(IDirect3DDevice9Ex *iface, IDirect3DIndexBuffer9 **ppIndexData)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DBuffer *retIndexData = NULL;
struct wined3d_buffer *retIndexData = NULL;
HRESULT hr;
TRACE("iface %p, buffer %p.\n", iface, ppIndexData);
......@@ -2472,9 +2472,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(IDirect3DDevice9Ex *iface,
hr = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData);
if (SUCCEEDED(hr) && retIndexData)
{
*ppIndexData = IWineD3DBuffer_GetParent(retIndexData);
*ppIndexData = wined3d_buffer_get_parent(retIndexData);
IDirect3DIndexBuffer9_AddRef(*ppIndexData);
IWineD3DBuffer_Release(retIndexData);
wined3d_buffer_decref(retIndexData);
}
else
{
......
......@@ -333,7 +333,7 @@ struct IDirect3DDeviceImpl
/* Other object connections */
IWineD3DDevice *wineD3DDevice;
IDirectDrawImpl *ddraw;
IWineD3DBuffer *indexbuffer;
struct wined3d_buffer *indexbuffer;
IDirectDrawSurfaceImpl *target;
/* Viewport management */
......@@ -577,7 +577,7 @@ struct IDirect3DVertexBufferImpl
LONG ref;
/*** WineD3D and ddraw links ***/
IWineD3DBuffer *wineD3DVertexBuffer;
struct wined3d_buffer *wineD3DVertexBuffer;
struct wined3d_vertex_declaration *wineD3DVertexDeclaration;
IDirectDrawImpl *ddraw;
......
......@@ -290,7 +290,7 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
EnterCriticalSection(&ddraw_cs);
/* Free the index buffer. */
IWineD3DDevice_SetIndexBuffer(This->wineD3DDevice, NULL, WINED3DFMT_UNKNOWN);
IWineD3DBuffer_Release(This->indexbuffer);
wined3d_buffer_decref(This->indexbuffer);
/* There is no need to unset the vertex buffer here, IWineD3DDevice_Uninit3D will do that when
* destroying the primary stateblock. If a vertex buffer is destroyed while it is bound
......@@ -4173,11 +4173,11 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
/* check that the buffer is large enough to hold the indices,
* reallocate if necessary. */
IWineD3DBuffer_GetDesc(This->indexbuffer, &desc);
wined3d_buffer_get_desc(This->indexbuffer, &desc);
if (desc.Size < IndexCount * sizeof(WORD))
{
UINT size = max(desc.Size * 2, IndexCount * sizeof(WORD));
IWineD3DBuffer *buffer;
struct wined3d_buffer *buffer;
TRACE("Growing index buffer to %u bytes\n", size);
......@@ -4190,29 +4190,24 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
return hr;
}
IWineD3DBuffer_Release(This->indexbuffer);
wined3d_buffer_decref(This->indexbuffer);
This->indexbuffer = buffer;
}
/* copy the index stream into the index buffer.
* A new IWineD3DDevice method could be created
* which takes an user pointer containing the indices
* or a SetData-Method for the index buffer, which
* overrides the index buffer data with our pointer.
*/
hr = IWineD3DBuffer_Map(This->indexbuffer,
0 /* OffSetToLock */,
IndexCount * sizeof(WORD),
(BYTE **) &LockedIndices,
0 /* Flags */);
if(hr != D3D_OK)
/* Copy the index stream into the index buffer. A new IWineD3DDevice
* method could be created which takes an user pointer containing the
* indices or a SetData-Method for the index buffer, which overrides the
* index buffer data with our pointer. */
hr = wined3d_buffer_map(This->indexbuffer, 0, IndexCount * sizeof(WORD),
(BYTE **)&LockedIndices, 0);
if (FAILED(hr))
{
ERR("(%p) IWineD3DBuffer::Map failed with hr = %08x\n", This, hr);
ERR("Failed to map buffer, hr %#x.\n", hr);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
memcpy(LockedIndices, Indices, IndexCount * sizeof(WORD));
IWineD3DBuffer_Unmap(This->indexbuffer);
wined3d_buffer_unmap(This->indexbuffer);
/* Set the index stream */
IWineD3DDevice_SetBaseVertexIndex(This->wineD3DDevice, StartVertex);
......@@ -6814,7 +6809,7 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi
if (FAILED(hr))
{
ERR("Failed to set render target, hr %#x.\n", hr);
IWineD3DBuffer_Release(device->indexbuffer);
wined3d_buffer_decref(device->indexbuffer);
ddraw_handle_table_destroy(&device->handle_table);
return hr;
}
......
......@@ -137,7 +137,7 @@ IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface)
if (ref == 0)
{
IWineD3DBuffer *curVB = NULL;
struct wined3d_buffer *curVB = NULL;
UINT offset, stride;
EnterCriticalSection(&ddraw_cs);
......@@ -158,13 +158,11 @@ IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface)
0 /* Offset */,
0 /* stride */);
}
if(curVB)
{
IWineD3DBuffer_Release(curVB); /* For the GetStreamSource */
}
if (curVB)
wined3d_buffer_decref(curVB); /* For the GetStreamSource */
wined3d_vertex_declaration_decref(This->wineD3DVertexDeclaration);
IWineD3DBuffer_Release(This->wineD3DVertexBuffer);
wined3d_buffer_decref(This->wineD3DVertexBuffer);
LeaveCriticalSection(&ddraw_cs);
HeapFree(GetProcessHeap(), 0, This);
......@@ -228,12 +226,11 @@ IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface,
if(Size)
{
/* Get the size, for returning it, and for locking */
IWineD3DBuffer_GetDesc(This->wineD3DVertexBuffer, &Desc);
wined3d_buffer_get_desc(This->wineD3DVertexBuffer, &Desc);
*Size = Desc.Size;
}
hr = IWineD3DBuffer_Map(This->wineD3DVertexBuffer, 0 /* OffsetToLock */,
0 /* SizeToLock, 0 == Full lock */, (BYTE **)Data, wined3d_flags);
hr = wined3d_buffer_map(This->wineD3DVertexBuffer, 0, 0, (BYTE **)Data, wined3d_flags);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
......@@ -263,7 +260,7 @@ IDirect3DVertexBufferImpl_Unlock(IDirect3DVertexBuffer7 *iface)
TRACE("iface %p.\n", iface);
EnterCriticalSection(&ddraw_cs);
IWineD3DBuffer_Unmap(This->wineD3DVertexBuffer);
wined3d_buffer_unmap(This->wineD3DVertexBuffer);
LeaveCriticalSection(&ddraw_cs);
return D3D_OK;
......@@ -410,7 +407,7 @@ IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
if(!Desc) return DDERR_INVALIDPARAMS;
EnterCriticalSection(&ddraw_cs);
IWineD3DBuffer_GetDesc(This->wineD3DVertexBuffer, &WDesc);
wined3d_buffer_get_desc(This->wineD3DVertexBuffer, &WDesc);
LeaveCriticalSection(&ddraw_cs);
/* Now fill the Desc structure */
......@@ -590,7 +587,7 @@ HRESULT d3d_vertex_buffer_init(IDirect3DVertexBufferImpl *buffer,
if (!buffer->wineD3DVertexDeclaration)
{
ERR("Failed to find vertex declaration for fvf %#x.\n", desc->dwFVF);
IWineD3DBuffer_Release(buffer->wineD3DVertexBuffer);
wined3d_buffer_decref(buffer->wineD3DVertexBuffer);
LeaveCriticalSection(&ddraw_cs);
return DDERR_INVALIDPARAMS;
......
......@@ -321,7 +321,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
element = &stream_info->elements[i];
buffer = This->stateBlock->state.streams[element->stream_idx].buffer;
IWineD3DBuffer_PreLoad((IWineD3DBuffer *)buffer);
wined3d_buffer_preload(buffer);
/* If PreLoad dropped the buffer object, update the stream info. */
if (buffer->buffer_object != element->buffer_object)
......@@ -2429,20 +2429,22 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface,
/* Handle recording of state blocks */
if (This->isRecordingState) {
TRACE("Recording... not performing anything\n");
if (pStreamData) IWineD3DBuffer_AddRef(pStreamData);
if (oldSrc) IWineD3DBuffer_Release(oldSrc);
if (pStreamData)
wined3d_buffer_incref(pStreamData);
if (oldSrc)
wined3d_buffer_decref(oldSrc);
return WINED3D_OK;
}
if (pStreamData)
{
InterlockedIncrement(&((struct wined3d_buffer *)pStreamData)->bind_count);
IWineD3DBuffer_AddRef(pStreamData);
wined3d_buffer_incref(pStreamData);
}
if (oldSrc)
{
InterlockedDecrement(&((struct wined3d_buffer *)oldSrc)->bind_count);
IWineD3DBuffer_Release(oldSrc);
wined3d_buffer_decref(oldSrc);
}
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
......@@ -2470,7 +2472,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface,
*pStride = stream->stride;
if (pOffset) *pOffset = stream->offset;
if (*pStream) IWineD3DBuffer_AddRef(*pStream);
if (*pStream)
wined3d_buffer_incref(*pStream);
return WINED3D_OK;
}
......@@ -3060,20 +3063,24 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetIndexBuffer(IWineD3DDevice *iface,
/* Handle recording of state blocks */
if (This->isRecordingState) {
TRACE("Recording... not performing anything\n");
if(pIndexData) IWineD3DBuffer_AddRef(pIndexData);
if(oldIdxs) IWineD3DBuffer_Release(oldIdxs);
if (pIndexData)
wined3d_buffer_incref(pIndexData);
if (oldIdxs)
wined3d_buffer_decref(oldIdxs);
return WINED3D_OK;
}
if(oldIdxs != pIndexData) {
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
if(pIndexData) {
if (pIndexData)
{
InterlockedIncrement(&((struct wined3d_buffer *)pIndexData)->bind_count);
IWineD3DBuffer_AddRef(pIndexData);
wined3d_buffer_incref(pIndexData);
}
if(oldIdxs) {
if (oldIdxs)
{
InterlockedDecrement(&((struct wined3d_buffer *)oldIdxs)->bind_count);
IWineD3DBuffer_Release(oldIdxs);
wined3d_buffer_decref(oldIdxs);
}
}
......@@ -3086,14 +3093,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetIndexBuffer(IWineD3DDevice *iface, I
*ppIndexData = (IWineD3DBuffer *)This->stateBlock->state.index_buffer;
/* up ref count on ppindexdata */
if (*ppIndexData) {
IWineD3DBuffer_AddRef(*ppIndexData);
TRACE("(%p) index data set to %p\n", This, ppIndexData);
}else{
TRACE("(%p) No index data set\n", This);
}
TRACE("Returning %p\n", *ppIndexData);
if (*ppIndexData)
wined3d_buffer_incref(*ppIndexData);
TRACE("Returning %p.\n", *ppIndexData);
return WINED3D_OK;
}
......@@ -3960,7 +3963,7 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn
if (!dest->buffer_object && gl_info->supported[ARB_VERTEX_BUFFER_OBJECT])
{
dest->flags |= WINED3D_BUFFER_CREATEBO;
IWineD3DBuffer_PreLoad((IWineD3DBuffer *)dest);
wined3d_buffer_preload(dest);
}
if (dest->buffer_object)
......@@ -4915,7 +4918,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface,
stream = &This->stateBlock->state.streams[0];
vb = (IWineD3DBuffer *)stream->buffer;
stream->buffer = (struct wined3d_buffer *)pVertexStreamZeroData;
if (vb) IWineD3DBuffer_Release(vb);
if (vb)
wined3d_buffer_decref(vb);
stream->offset = 0;
stream->stride = VertexStreamZeroStride;
This->stateBlock->state.user_stream = TRUE;
......@@ -4964,7 +4968,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
stream = &This->stateBlock->state.streams[0];
vb = (IWineD3DBuffer *)stream->buffer;
stream->buffer = (struct wined3d_buffer *)pVertexStreamZeroData;
if (vb) IWineD3DBuffer_Release(vb);
if (vb)
wined3d_buffer_decref(vb);
stream->offset = 0;
stream->stride = VertexStreamZeroStride;
This->stateBlock->state.user_stream = TRUE;
......@@ -4984,7 +4989,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
ib = (IWineD3DBuffer *)This->stateBlock->state.index_buffer;
if (ib)
{
IWineD3DBuffer_Release(ib);
wined3d_buffer_decref(ib);
This->stateBlock->state.index_buffer = NULL;
}
/* No need to mark the stream source state dirty here. Either the app calls UP drawing again, or it has to call
......
......@@ -490,14 +490,14 @@ ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
struct wined3d_buffer *buffer = stateblock->state.streams[counter].buffer;
if (buffer)
{
if (IWineD3DBuffer_Release((IWineD3DBuffer *)buffer))
if (wined3d_buffer_decref(buffer))
{
WARN("Buffer %p still referenced by stateblock, stream %u.\n", buffer, counter);
}
}
}
if (stateblock->state.index_buffer)
IWineD3DBuffer_Release((IWineD3DBuffer *)stateblock->state.index_buffer);
wined3d_buffer_decref(stateblock->state.index_buffer);
if (stateblock->state.vertex_shader)
IWineD3DVertexShader_Release((IWineD3DVertexShader *)stateblock->state.vertex_shader);
if (stateblock->state.pixel_shader)
......@@ -715,9 +715,9 @@ HRESULT CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
src_state->index_buffer, src_state->base_vertex_index);
if (src_state->index_buffer)
IWineD3DBuffer_AddRef((IWineD3DBuffer *)src_state->index_buffer);
wined3d_buffer_incref(src_state->index_buffer);
if (stateblock->state.index_buffer)
IWineD3DBuffer_Release((IWineD3DBuffer *)stateblock->state.index_buffer);
wined3d_buffer_decref(stateblock->state.index_buffer);
stateblock->state.index_buffer = src_state->index_buffer;
stateblock->state.base_vertex_index = src_state->base_vertex_index;
stateblock->state.index_format = src_state->index_format;
......@@ -773,9 +773,9 @@ HRESULT CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
stateblock->state.streams[i].stride = src_state->streams[i].stride;
if (src_state->streams[i].buffer)
IWineD3DBuffer_AddRef((IWineD3DBuffer *)src_state->streams[i].buffer);
wined3d_buffer_incref(src_state->streams[i].buffer);
if (stateblock->state.streams[i].buffer)
IWineD3DBuffer_Release((IWineD3DBuffer *)stateblock->state.streams[i].buffer);
wined3d_buffer_decref(stateblock->state.streams[i].buffer);
stateblock->state.streams[i].buffer = src_state->streams[i].buffer;
}
}
......
......@@ -19,6 +19,21 @@
@ cdecl wined3d_incref(ptr)
@ cdecl wined3d_register_software_device(ptr ptr)
@ cdecl wined3d_buffer_decref(ptr)
@ cdecl wined3d_buffer_free_private_data(ptr ptr)
@ cdecl wined3d_buffer_get_desc(ptr ptr)
@ cdecl wined3d_buffer_get_parent(ptr)
@ cdecl wined3d_buffer_get_priority(ptr)
@ cdecl wined3d_buffer_get_private_data(ptr ptr ptr ptr)
@ cdecl wined3d_buffer_get_resource(ptr)
@ cdecl wined3d_buffer_get_type(ptr)
@ cdecl wined3d_buffer_incref(ptr)
@ cdecl wined3d_buffer_map(ptr long long ptr long)
@ cdecl wined3d_buffer_preload(ptr)
@ cdecl wined3d_buffer_set_priority(ptr long)
@ cdecl wined3d_buffer_set_private_data(ptr ptr ptr long long)
@ cdecl wined3d_buffer_unmap(ptr)
@ cdecl wined3d_clipper_create()
@ cdecl wined3d_clipper_decref(ptr)
@ cdecl wined3d_clipper_get_clip_list(ptr ptr ptr ptr)
......
......@@ -55,6 +55,7 @@
typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl;
typedef struct IWineD3DSwapChainImpl IWineD3DSwapChainImpl;
typedef struct wined3d_buffer IWineD3DBuffer;
struct IWineD3DBaseShaderImpl;
struct IWineD3DBaseTextureImpl;
......@@ -2542,7 +2543,6 @@ struct wined3d_map_range
struct wined3d_buffer
{
const struct IWineD3DBufferVtbl *vtbl;
struct wined3d_resource resource;
struct wined3d_buffer_desc desc;
......
......@@ -2110,6 +2110,7 @@ interface IWineD3DVolume;
interface IWineD3DSwapChain;
interface IWineD3DDevice;
struct wined3d;
struct wined3d_buffer;
struct wined3d_clipper;
struct wined3d_palette;
struct wined3d_query;
......@@ -2521,28 +2522,6 @@ interface IWineD3DSwapChain : IWineD3DBase
[
object,
local,
uuid(b3f028e8-1a40-4ab3-9292-5bf6cfd80209)
]
interface IWineD3DBuffer : IWineD3DResource
{
struct wined3d_resource *GetResource(
);
HRESULT Map(
[in] UINT offset,
[in] UINT size,
[out] BYTE **data,
[in] DWORD flags
);
void Unmap(
);
void GetDesc(
[out] WINED3DBUFFER_DESC *desc
);
}
[
object,
local,
uuid(eac93065-a4df-446f-86a1-9ef2bca40a3c)
]
interface IWineD3DBaseShader : IWineD3DBase
......@@ -2597,7 +2576,7 @@ interface IWineD3DDevice : IUnknown
[in] const void *data,
[in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DBuffer **buffer
[out] struct wined3d_buffer **buffer
);
HRESULT CreateVertexBuffer(
[in] UINT length,
......@@ -2605,7 +2584,7 @@ interface IWineD3DDevice : IUnknown
[in] WINED3DPOOL pool,
[in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DBuffer **vertex_buffer
[out] struct wined3d_buffer **vertex_buffer
);
HRESULT CreateIndexBuffer(
[in] UINT length,
......@@ -2613,7 +2592,7 @@ interface IWineD3DDevice : IUnknown
[in] WINED3DPOOL pool,
[in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DBuffer **index_buffer
[out] struct wined3d_buffer **index_buffer
);
HRESULT CreateStateBlock(
[in] WINED3DSTATEBLOCKTYPE type,
......@@ -2840,11 +2819,11 @@ interface IWineD3DDevice : IUnknown
[out] WINED3DGAMMARAMP *ramp
);
HRESULT SetIndexBuffer(
[in] IWineD3DBuffer *index_buffer,
[in] struct wined3d_buffer *index_buffer,
[in] enum wined3d_format_id format_id
);
HRESULT GetIndexBuffer(
[out] IWineD3DBuffer **index_buffer
[out] struct wined3d_buffer **index_buffer
);
HRESULT SetBaseVertexIndex(
[in] INT base_index
......@@ -2962,13 +2941,13 @@ interface IWineD3DDevice : IUnknown
);
HRESULT SetStreamSource(
[in] UINT stream_idx,
[in] IWineD3DBuffer *buffer,
[in] struct wined3d_buffer *buffer,
[in] UINT offset,
[in] UINT stride
);
HRESULT GetStreamSource(
[in] UINT stream_idx,
[out] IWineD3DBuffer **buffer,
[out] struct wined3d_buffer **buffer,
[out] UINT *offset,
[out] UINT *stride
);
......@@ -3064,7 +3043,7 @@ interface IWineD3DDevice : IUnknown
[in] UINT src_start_idx,
[in] UINT dst_idx,
[in] UINT vertex_count,
[in] IWineD3DBuffer *dest_buffer,
[in] struct wined3d_buffer *dst_buffer,
[in] struct wined3d_vertex_declaration *declaration,
[in] DWORD flags,
[in] DWORD DestFVF
......@@ -3225,6 +3204,23 @@ void * __cdecl wined3d_get_parent(const struct wined3d *wined3d);
ULONG __cdecl wined3d_incref(struct wined3d *wined3d);
HRESULT __cdecl wined3d_register_software_device(struct wined3d *wined3d, void *init_function);
ULONG __cdecl wined3d_buffer_decref(struct wined3d_buffer *buffer);
HRESULT __cdecl wined3d_buffer_free_private_data(struct wined3d_buffer *buffer, REFGUID guid);
void __cdecl wined3d_buffer_get_desc(const struct wined3d_buffer *buffer, WINED3DBUFFER_DESC *desc);
void * __cdecl wined3d_buffer_get_parent(const struct wined3d_buffer *buffer);
DWORD __cdecl wined3d_buffer_get_priority(const struct wined3d_buffer *buffer);
HRESULT __cdecl wined3d_buffer_get_private_data(const struct wined3d_buffer *buffer,
REFGUID guid, void *data, DWORD *data_size);
struct wined3d_resource * __cdecl wined3d_buffer_get_resource(struct wined3d_buffer *buffer);
WINED3DRESOURCETYPE __cdecl wined3d_buffer_get_type(const struct wined3d_buffer *buffer);
ULONG __cdecl wined3d_buffer_incref(struct wined3d_buffer *buffer);
HRESULT __cdecl wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UINT size, BYTE **data, DWORD flags);
void __cdecl wined3d_buffer_preload(struct wined3d_buffer *buffer);
DWORD __cdecl wined3d_buffer_set_priority(struct wined3d_buffer *buffer, DWORD new_priority);
HRESULT __cdecl wined3d_buffer_set_private_data(struct wined3d_buffer *buffer,
REFGUID guid, const void *data, DWORD data_size, DWORD flags);
void __cdecl wined3d_buffer_unmap(struct wined3d_buffer *buffer);
struct wined3d_clipper * __cdecl wined3d_clipper_create(void);
ULONG __cdecl wined3d_clipper_decref(struct wined3d_clipper *clipper);
HRESULT __cdecl wined3d_clipper_get_clip_list(const struct wined3d_clipper *clipper,
......
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