wined3d: Remove COM from the buffer implementation.
This commit is contained in:
parent
b7c427b483
commit
a27ee75ed2
|
@ -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;
|
||||
|
|
|
@ -635,36 +635,11 @@ const BYTE *buffer_get_memory(struct wined3d_buffer *buffer,
|
|||
}
|
||||
}
|
||||
|
||||
/* IUnknown methods */
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE buffer_QueryInterface(IWineD3DBuffer *iface,
|
||||
REFIID riid, void **object)
|
||||
ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer)
|
||||
{
|
||||
TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
|
||||
ULONG refcount = InterlockedIncrement(&buffer->resource.ref);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IWineD3DBuffer)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DResource)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|
||||
|| IsEqualGUID(riid, &IID_IUnknown))
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
*object = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
|
||||
|
||||
*object = NULL;
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE buffer_AddRef(IWineD3DBuffer *iface)
|
||||
{
|
||||
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
|
||||
ULONG refcount = InterlockedIncrement(&This->resource.ref);
|
||||
|
||||
TRACE("%p increasing refcount to %u\n", This, refcount);
|
||||
TRACE("%p increasing refcount to %u.\n", buffer, refcount);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
@ -732,60 +707,56 @@ static void buffer_unload(struct wined3d_resource *resource)
|
|||
}
|
||||
|
||||
/* Do not call while under the GL lock. */
|
||||
static ULONG STDMETHODCALLTYPE buffer_Release(IWineD3DBuffer *iface)
|
||||
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
|
||||
{
|
||||
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
|
||||
ULONG refcount = InterlockedDecrement(&This->resource.ref);
|
||||
ULONG refcount = InterlockedDecrement(&buffer->resource.ref);
|
||||
|
||||
TRACE("%p decreasing refcount to %u\n", This, refcount);
|
||||
TRACE("%p decreasing refcount to %u.\n", buffer, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
buffer_unload(&This->resource);
|
||||
resource_cleanup(&This->resource);
|
||||
This->resource.parent_ops->wined3d_object_destroyed(This->resource.parent);
|
||||
HeapFree(GetProcessHeap(), 0, This->maps);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
buffer_unload(&buffer->resource);
|
||||
resource_cleanup(&buffer->resource);
|
||||
buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent);
|
||||
HeapFree(GetProcessHeap(), 0, buffer->maps);
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
/* IWineD3DBase methods */
|
||||
static void * STDMETHODCALLTYPE buffer_GetParent(IWineD3DBuffer *iface)
|
||||
void * CDECL wined3d_buffer_get_parent(const struct wined3d_buffer *buffer)
|
||||
{
|
||||
TRACE("iface %p.\n", iface);
|
||||
TRACE("buffer %p.\n", buffer);
|
||||
|
||||
return ((struct wined3d_buffer *)iface)->resource.parent;
|
||||
return buffer->resource.parent;
|
||||
}
|
||||
|
||||
/* IWineD3DResource methods */
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE buffer_SetPrivateData(IWineD3DBuffer *iface,
|
||||
HRESULT CDECL wined3d_buffer_set_private_data(struct wined3d_buffer *buffer,
|
||||
REFGUID guid, const void *data, DWORD data_size, DWORD flags)
|
||||
{
|
||||
return resource_set_private_data(&((struct wined3d_buffer *)iface)->resource, guid, data, data_size, flags);
|
||||
return resource_set_private_data(&buffer->resource, guid, data, data_size, flags);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE buffer_GetPrivateData(IWineD3DBuffer *iface,
|
||||
HRESULT CDECL wined3d_buffer_get_private_data(const struct wined3d_buffer *buffer,
|
||||
REFGUID guid, void *data, DWORD *data_size)
|
||||
{
|
||||
return resource_get_private_data(&((struct wined3d_buffer *)iface)->resource, guid, data, data_size);
|
||||
return resource_get_private_data(&buffer->resource, guid, data, data_size);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE buffer_FreePrivateData(IWineD3DBuffer *iface, REFGUID guid)
|
||||
HRESULT CDECL wined3d_buffer_free_private_data(struct wined3d_buffer *buffer, REFGUID guid)
|
||||
{
|
||||
return resource_free_private_data(&((struct wined3d_buffer *)iface)->resource, guid);
|
||||
return resource_free_private_data(&buffer->resource, guid);
|
||||
}
|
||||
|
||||
static DWORD STDMETHODCALLTYPE buffer_SetPriority(IWineD3DBuffer *iface, DWORD priority)
|
||||
DWORD CDECL wined3d_buffer_set_priority(struct wined3d_buffer *buffer, DWORD priority)
|
||||
{
|
||||
return resource_set_priority(&((struct wined3d_buffer *)iface)->resource, priority);
|
||||
return resource_set_priority(&buffer->resource, priority);
|
||||
}
|
||||
|
||||
static DWORD STDMETHODCALLTYPE buffer_GetPriority(IWineD3DBuffer *iface)
|
||||
DWORD CDECL wined3d_buffer_get_priority(const struct wined3d_buffer *buffer)
|
||||
{
|
||||
return resource_get_priority(&((struct wined3d_buffer *)iface)->resource);
|
||||
return resource_get_priority(&buffer->resource);
|
||||
}
|
||||
|
||||
/* The caller provides a context and binds the buffer */
|
||||
|
@ -934,31 +905,31 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
|
|||
}
|
||||
|
||||
/* Do not call while under the GL lock. */
|
||||
static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
|
||||
void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer)
|
||||
{
|
||||
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
|
||||
IWineD3DDeviceImpl *device = This->resource.device;
|
||||
DWORD flags = buffer->flags & (WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD);
|
||||
IWineD3DDeviceImpl *device = buffer->resource.device;
|
||||
UINT start = 0, end = 0, len = 0, vertices;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
BOOL decl_changed = FALSE;
|
||||
unsigned int i, j;
|
||||
BYTE *data;
|
||||
DWORD flags = This->flags & (WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD);
|
||||
|
||||
TRACE("iface %p\n", iface);
|
||||
This->flags &= ~(WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD);
|
||||
TRACE("buffer %p.\n", buffer);
|
||||
|
||||
buffer->flags &= ~(WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD);
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
if (!This->buffer_object)
|
||||
if (!buffer->buffer_object)
|
||||
{
|
||||
/* TODO: Make converting independent from VBOs */
|
||||
if (This->flags & WINED3D_BUFFER_CREATEBO)
|
||||
if (buffer->flags & WINED3D_BUFFER_CREATEBO)
|
||||
{
|
||||
buffer_create_buffer_object(This, gl_info);
|
||||
This->flags &= ~WINED3D_BUFFER_CREATEBO;
|
||||
buffer_create_buffer_object(buffer, gl_info);
|
||||
buffer->flags &= ~WINED3D_BUFFER_CREATEBO;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -968,18 +939,20 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
|
|||
}
|
||||
|
||||
/* Reading the declaration makes only sense if the stateblock is finalized and the buffer bound to a stream */
|
||||
if (device->isInDraw && This->bind_count > 0)
|
||||
if (device->isInDraw && buffer->bind_count > 0)
|
||||
{
|
||||
decl_changed = buffer_find_decl(This);
|
||||
This->flags |= WINED3D_BUFFER_HASDESC;
|
||||
decl_changed = buffer_find_decl(buffer);
|
||||
buffer->flags |= WINED3D_BUFFER_HASDESC;
|
||||
}
|
||||
|
||||
if (!decl_changed && !(This->flags & WINED3D_BUFFER_HASDESC && buffer_is_dirty(This)))
|
||||
if (!decl_changed && !(buffer->flags & WINED3D_BUFFER_HASDESC && buffer_is_dirty(buffer)))
|
||||
{
|
||||
context_release(context);
|
||||
++This->draw_count;
|
||||
if (This->draw_count > VB_RESETDECLCHANGE) This->decl_change_count = 0;
|
||||
if (This->draw_count > VB_RESETFULLCONVS) This->full_conversion_count = 0;
|
||||
++buffer->draw_count;
|
||||
if (buffer->draw_count > VB_RESETDECLCHANGE)
|
||||
buffer->decl_change_count = 0;
|
||||
if (buffer->draw_count > VB_RESETFULLCONVS)
|
||||
buffer->full_conversion_count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -989,31 +962,31 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
|
|||
*/
|
||||
if (decl_changed)
|
||||
{
|
||||
++This->decl_change_count;
|
||||
This->draw_count = 0;
|
||||
++buffer->decl_change_count;
|
||||
buffer->draw_count = 0;
|
||||
|
||||
if (This->decl_change_count > VB_MAXDECLCHANGES ||
|
||||
(This->conversion_map && (This->resource.usage & WINED3DUSAGE_DYNAMIC)))
|
||||
if (buffer->decl_change_count > VB_MAXDECLCHANGES
|
||||
|| (buffer->conversion_map && (buffer->resource.usage & WINED3DUSAGE_DYNAMIC)))
|
||||
{
|
||||
FIXME("Too many declaration changes or converting dynamic buffer, stopping converting\n");
|
||||
|
||||
buffer_unload(&This->resource);
|
||||
This->flags &= ~WINED3D_BUFFER_CREATEBO;
|
||||
buffer_unload(&buffer->resource);
|
||||
buffer->flags &= ~WINED3D_BUFFER_CREATEBO;
|
||||
|
||||
/* The stream source state handler might have read the memory of the vertex buffer already
|
||||
* and got the memory in the vbo which is not valid any longer. Dirtify the stream source
|
||||
* to force a reload. This happens only once per changed vertexbuffer and should occur rather
|
||||
* rarely
|
||||
*/
|
||||
/* The stream source state handler might have read the memory of
|
||||
* the vertex buffer already and got the memory in the vbo which
|
||||
* is not valid any longer. Dirtify the stream source to force a
|
||||
* reload. This happens only once per changed vertexbuffer and
|
||||
* should occur rather rarely. */
|
||||
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC);
|
||||
goto end;
|
||||
}
|
||||
buffer_check_buffer_object_size(This, gl_info);
|
||||
buffer_check_buffer_object_size(buffer, gl_info);
|
||||
|
||||
/* The declaration changed, reload the whole buffer */
|
||||
WARN("Reloading buffer because of decl change\n");
|
||||
buffer_clear_dirty_areas(This);
|
||||
if(!buffer_add_dirty_area(This, 0, 0))
|
||||
buffer_clear_dirty_areas(buffer);
|
||||
if (!buffer_add_dirty_area(buffer, 0, 0))
|
||||
{
|
||||
ERR("buffer_add_dirty_area failed, this is not expected\n");
|
||||
goto end;
|
||||
|
@ -1029,89 +1002,90 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
|
|||
* changes it every minute drop the VBO after VB_MAX_DECL_CHANGES minutes. So count draws without
|
||||
* decl changes and reset the decl change count after a specific number of them
|
||||
*/
|
||||
if(buffer_is_fully_dirty(This))
|
||||
if (buffer_is_fully_dirty(buffer))
|
||||
{
|
||||
++This->full_conversion_count;
|
||||
if(This->full_conversion_count > VB_MAXFULLCONVERSIONS)
|
||||
++buffer->full_conversion_count;
|
||||
if (buffer->full_conversion_count > VB_MAXFULLCONVERSIONS)
|
||||
{
|
||||
FIXME("Too many full buffer conversions, stopping converting\n");
|
||||
buffer_unload(&This->resource);
|
||||
This->flags &= ~WINED3D_BUFFER_CREATEBO;
|
||||
FIXME("Too many full buffer conversions, stopping converting.\n");
|
||||
buffer_unload(&buffer->resource);
|
||||
buffer->flags &= ~WINED3D_BUFFER_CREATEBO;
|
||||
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++This->draw_count;
|
||||
if (This->draw_count > VB_RESETDECLCHANGE) This->decl_change_count = 0;
|
||||
if (This->draw_count > VB_RESETFULLCONVS) This->full_conversion_count = 0;
|
||||
++buffer->draw_count;
|
||||
if (buffer->draw_count > VB_RESETDECLCHANGE)
|
||||
buffer->decl_change_count = 0;
|
||||
if (buffer->draw_count > VB_RESETFULLCONVS)
|
||||
buffer->full_conversion_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
|
||||
{
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER);
|
||||
}
|
||||
if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
|
||||
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER);
|
||||
|
||||
if (!This->conversion_map)
|
||||
if (!buffer->conversion_map)
|
||||
{
|
||||
/* That means that there is nothing to fixup. Just upload from This->resource.allocatedMemory
|
||||
* directly into the vbo. Do not free the system memory copy because drawPrimitive may need it if
|
||||
* the stride is 0, for instancing emulation, vertex blending emulation or shader emulation.
|
||||
*/
|
||||
TRACE("No conversion needed\n");
|
||||
/* That means that there is nothing to fixup. Just upload from
|
||||
* buffer->resource.allocatedMemory directly into the vbo. Do not
|
||||
* free the system memory copy because drawPrimitive may need it if
|
||||
* the stride is 0, for instancing emulation, vertex blending
|
||||
* emulation or shader emulation. */
|
||||
TRACE("No conversion needed.\n");
|
||||
|
||||
/* Nothing to do because we locked directly into the vbo */
|
||||
if (!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER))
|
||||
if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
|
||||
{
|
||||
context_release(context);
|
||||
return;
|
||||
}
|
||||
|
||||
buffer_direct_upload(This, context->gl_info, flags);
|
||||
buffer_direct_upload(buffer, context->gl_info, flags);
|
||||
|
||||
context_release(context);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER))
|
||||
if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
|
||||
{
|
||||
buffer_get_sysmem(This, gl_info);
|
||||
buffer_get_sysmem(buffer, gl_info);
|
||||
}
|
||||
|
||||
/* Now for each vertex in the buffer that needs conversion */
|
||||
vertices = This->resource.size / This->stride;
|
||||
vertices = buffer->resource.size / buffer->stride;
|
||||
|
||||
if (This->conversion_shift)
|
||||
if (buffer->conversion_shift)
|
||||
{
|
||||
TRACE("Shifted conversion\n");
|
||||
data = HeapAlloc(GetProcessHeap(), 0, vertices * This->conversion_stride);
|
||||
data = HeapAlloc(GetProcessHeap(), 0, vertices * buffer->conversion_stride);
|
||||
|
||||
start = 0;
|
||||
len = This->resource.size;
|
||||
len = buffer->resource.size;
|
||||
end = start + len;
|
||||
|
||||
if (This->maps[0].offset || This->maps[0].size != This->resource.size)
|
||||
if (buffer->maps[0].offset || buffer->maps[0].size != buffer->resource.size)
|
||||
{
|
||||
FIXME("Implement partial buffer load with shifted conversion\n");
|
||||
}
|
||||
|
||||
for (i = start / This->stride; i < min((end / This->stride) + 1, vertices); ++i)
|
||||
for (i = start / buffer->stride; i < min((end / buffer->stride) + 1, vertices); ++i)
|
||||
{
|
||||
for (j = 0; j < This->stride; ++j)
|
||||
for (j = 0; j < buffer->stride; ++j)
|
||||
{
|
||||
switch(This->conversion_map[j])
|
||||
switch (buffer->conversion_map[j])
|
||||
{
|
||||
case CONV_NONE:
|
||||
data[This->conversion_stride * i + j + This->conversion_shift[j]]
|
||||
= This->resource.allocatedMemory[This->stride * i + j];
|
||||
data[buffer->conversion_stride * i + j + buffer->conversion_shift[j]]
|
||||
= buffer->resource.allocatedMemory[buffer->stride * i + j];
|
||||
break;
|
||||
|
||||
case CONV_FLOAT16_2:
|
||||
{
|
||||
float *out = (float *)(&data[This->conversion_stride * i + j + This->conversion_shift[j]]);
|
||||
const WORD *in = (WORD *)(&This->resource.allocatedMemory[i * This->stride + j]);
|
||||
float *out = (float *)(&data[buffer->conversion_stride * i + j + buffer->conversion_shift[j]]);
|
||||
const WORD *in = (WORD *)(&buffer->resource.allocatedMemory[i * buffer->stride + j]);
|
||||
|
||||
out[1] = float_16_to_32(in + 1);
|
||||
out[0] = float_16_to_32(in + 0);
|
||||
|
@ -1120,63 +1094,63 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
|
|||
}
|
||||
|
||||
default:
|
||||
FIXME("Unimplemented conversion %d in shifted conversion\n", This->conversion_map[j]);
|
||||
FIXME("Unimplemented conversion %#x in shifted conversion.\n", buffer->conversion_map[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
|
||||
GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object));
|
||||
checkGLcall("glBindBufferARB");
|
||||
GL_EXTCALL(glBufferSubDataARB(This->buffer_type_hint, 0, vertices * This->conversion_stride, data));
|
||||
GL_EXTCALL(glBufferSubDataARB(buffer->buffer_type_hint, 0, vertices * buffer->conversion_stride, data));
|
||||
checkGLcall("glBufferSubDataARB");
|
||||
LEAVE_GL();
|
||||
}
|
||||
else
|
||||
{
|
||||
data = HeapAlloc(GetProcessHeap(), 0, This->resource.size);
|
||||
data = HeapAlloc(GetProcessHeap(), 0, buffer->resource.size);
|
||||
|
||||
while(This->modified_areas)
|
||||
while (buffer->modified_areas)
|
||||
{
|
||||
This->modified_areas--;
|
||||
start = This->maps[This->modified_areas].offset;
|
||||
len = This->maps[This->modified_areas].size;
|
||||
buffer->modified_areas--;
|
||||
start = buffer->maps[buffer->modified_areas].offset;
|
||||
len = buffer->maps[buffer->modified_areas].size;
|
||||
end = start + len;
|
||||
|
||||
memcpy(data + start, This->resource.allocatedMemory + start, end - start);
|
||||
for (i = start / This->stride; i < min((end / This->stride) + 1, vertices); ++i)
|
||||
memcpy(data + start, buffer->resource.allocatedMemory + start, end - start);
|
||||
for (i = start / buffer->stride; i < min((end / buffer->stride) + 1, vertices); ++i)
|
||||
{
|
||||
for (j = 0; j < This->stride; ++j)
|
||||
for (j = 0; j < buffer->stride; ++j)
|
||||
{
|
||||
switch(This->conversion_map[j])
|
||||
switch (buffer->conversion_map[j])
|
||||
{
|
||||
case CONV_NONE:
|
||||
/* Done already */
|
||||
j += 3;
|
||||
break;
|
||||
case CONV_D3DCOLOR:
|
||||
fixup_d3dcolor((DWORD *) (data + i * This->stride + j));
|
||||
fixup_d3dcolor((DWORD *)(data + i * buffer->stride + j));
|
||||
j += 3;
|
||||
break;
|
||||
|
||||
case CONV_POSITIONT:
|
||||
fixup_transformed_pos((float *) (data + i * This->stride + j));
|
||||
fixup_transformed_pos((float *)(data + i * buffer->stride + j));
|
||||
j += 15;
|
||||
break;
|
||||
|
||||
case CONV_FLOAT16_2:
|
||||
ERR("Did not expect FLOAT16 conversion in unshifted conversion\n");
|
||||
ERR("Did not expect FLOAT16 conversion in unshifted conversion.\n");
|
||||
default:
|
||||
FIXME("Unimplemented conversion %d in shifted conversion\n", This->conversion_map[j]);
|
||||
FIXME("Unimplemented conversion %u in unshifted conversion.\n", buffer->conversion_map[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
|
||||
GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object));
|
||||
checkGLcall("glBindBufferARB");
|
||||
GL_EXTCALL(glBufferSubDataARB(This->buffer_type_hint, start, len, data + start));
|
||||
GL_EXTCALL(glBufferSubDataARB(buffer->buffer_type_hint, start, len, data + start));
|
||||
checkGLcall("glBufferSubDataARB");
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
@ -1188,9 +1162,9 @@ end:
|
|||
context_release(context);
|
||||
}
|
||||
|
||||
static WINED3DRESOURCETYPE STDMETHODCALLTYPE buffer_GetType(IWineD3DBuffer *iface)
|
||||
WINED3DRESOURCETYPE CDECL wined3d_buffer_get_type(const struct wined3d_buffer *buffer)
|
||||
{
|
||||
return resource_get_type(&((struct wined3d_buffer *)iface)->resource);
|
||||
return resource_get_type(&buffer->resource);
|
||||
}
|
||||
|
||||
/* IWineD3DBuffer methods */
|
||||
|
@ -1245,82 +1219,80 @@ static GLbitfield buffer_gl_map_flags(DWORD d3d_flags)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static struct wined3d_resource * STDMETHODCALLTYPE buffer_GetResource(IWineD3DBuffer *iface)
|
||||
struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
|
||||
{
|
||||
TRACE("iface %p.\n", iface);
|
||||
TRACE("buffer %p.\n", buffer);
|
||||
|
||||
return &((struct wined3d_buffer *)iface)->resource;
|
||||
return &buffer->resource;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset, UINT size, BYTE **data, DWORD flags)
|
||||
HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UINT size, BYTE **data, DWORD flags)
|
||||
{
|
||||
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
|
||||
BOOL dirty = buffer_is_dirty(buffer);
|
||||
LONG count;
|
||||
BOOL dirty = buffer_is_dirty(This);
|
||||
|
||||
TRACE("iface %p, offset %u, size %u, data %p, flags %#x\n", iface, offset, size, data, flags);
|
||||
TRACE("buffer %p, offset %u, size %u, data %p, flags %#x\n", buffer, offset, size, data, flags);
|
||||
|
||||
flags = buffer_sanitize_flags(This, flags);
|
||||
flags = buffer_sanitize_flags(buffer, flags);
|
||||
if (!(flags & WINED3DLOCK_READONLY))
|
||||
{
|
||||
if (!buffer_add_dirty_area(This, offset, size)) return E_OUTOFMEMORY;
|
||||
if (!buffer_add_dirty_area(buffer, offset, size)) return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
count = InterlockedIncrement(&This->lock_count);
|
||||
count = InterlockedIncrement(&buffer->lock_count);
|
||||
|
||||
if (This->buffer_object)
|
||||
if (buffer->buffer_object)
|
||||
{
|
||||
if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER))
|
||||
if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
|
||||
{
|
||||
if(count == 1)
|
||||
if (count == 1)
|
||||
{
|
||||
IWineD3DDeviceImpl *device = This->resource.device;
|
||||
IWineD3DDeviceImpl *device = buffer->resource.device;
|
||||
struct wined3d_context *context;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
|
||||
if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
|
||||
{
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER);
|
||||
}
|
||||
if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
|
||||
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER);
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
gl_info = context->gl_info;
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
|
||||
GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object));
|
||||
|
||||
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
|
||||
{
|
||||
GLbitfield mapflags = buffer_gl_map_flags(flags);
|
||||
This->resource.allocatedMemory = GL_EXTCALL(glMapBufferRange(This->buffer_type_hint, 0,
|
||||
This->resource.size, mapflags));
|
||||
buffer->resource.allocatedMemory = GL_EXTCALL(glMapBufferRange(buffer->buffer_type_hint,
|
||||
0, buffer->resource.size, mapflags));
|
||||
checkGLcall("glMapBufferRange");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(This->flags & WINED3D_BUFFER_APPLESYNC)
|
||||
if (buffer->flags & WINED3D_BUFFER_APPLESYNC)
|
||||
{
|
||||
LEAVE_GL();
|
||||
buffer_sync_apple(This, flags, gl_info);
|
||||
buffer_sync_apple(buffer, flags, gl_info);
|
||||
ENTER_GL();
|
||||
}
|
||||
This->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_READ_WRITE_ARB));
|
||||
buffer->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(buffer->buffer_type_hint,
|
||||
GL_READ_WRITE_ARB));
|
||||
checkGLcall("glMapBufferARB");
|
||||
}
|
||||
LEAVE_GL();
|
||||
|
||||
if (((DWORD_PTR) This->resource.allocatedMemory) & (RESOURCE_ALIGNMENT - 1))
|
||||
if (((DWORD_PTR)buffer->resource.allocatedMemory) & (RESOURCE_ALIGNMENT - 1))
|
||||
{
|
||||
WARN("Pointer %p is not %u byte aligned, falling back to double buffered operation\n",
|
||||
This->resource.allocatedMemory, RESOURCE_ALIGNMENT);
|
||||
WARN("Pointer %p is not %u byte aligned, falling back to double buffered operation.\n",
|
||||
buffer->resource.allocatedMemory, RESOURCE_ALIGNMENT);
|
||||
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint));
|
||||
GL_EXTCALL(glUnmapBufferARB(buffer->buffer_type_hint));
|
||||
checkGLcall("glUnmapBufferARB");
|
||||
LEAVE_GL();
|
||||
This->resource.allocatedMemory = NULL;
|
||||
buffer->resource.allocatedMemory = NULL;
|
||||
|
||||
buffer_get_sysmem(This, gl_info);
|
||||
TRACE("New pointer is %p\n", This->resource.allocatedMemory);
|
||||
buffer_get_sysmem(buffer, gl_info);
|
||||
TRACE("New pointer is %p.\n", buffer->resource.allocatedMemory);
|
||||
}
|
||||
context_release(context);
|
||||
}
|
||||
|
@ -1329,140 +1301,112 @@ static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset,
|
|||
{
|
||||
if (dirty)
|
||||
{
|
||||
if (This->flags & WINED3D_BUFFER_NOSYNC && !(flags & WINED3DLOCK_NOOVERWRITE))
|
||||
if (buffer->flags & WINED3D_BUFFER_NOSYNC && !(flags & WINED3DLOCK_NOOVERWRITE))
|
||||
{
|
||||
This->flags &= ~WINED3D_BUFFER_NOSYNC;
|
||||
buffer->flags &= ~WINED3D_BUFFER_NOSYNC;
|
||||
}
|
||||
}
|
||||
else if(flags & WINED3DLOCK_NOOVERWRITE)
|
||||
{
|
||||
This->flags |= WINED3D_BUFFER_NOSYNC;
|
||||
buffer->flags |= WINED3D_BUFFER_NOSYNC;
|
||||
}
|
||||
|
||||
if (flags & WINED3DLOCK_DISCARD)
|
||||
{
|
||||
This->flags |= WINED3D_BUFFER_DISCARD;
|
||||
buffer->flags |= WINED3D_BUFFER_DISCARD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*data = This->resource.allocatedMemory + offset;
|
||||
*data = buffer->resource.allocatedMemory + offset;
|
||||
|
||||
TRACE("Returning memory at %p (base %p, offset %u)\n", *data, This->resource.allocatedMemory, offset);
|
||||
/* TODO: check Flags compatibility with This->currentDesc.Usage (see MSDN) */
|
||||
TRACE("Returning memory at %p (base %p, offset %u).\n", *data, buffer->resource.allocatedMemory, offset);
|
||||
/* TODO: check Flags compatibility with buffer->currentDesc.Usage (see MSDN) */
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface)
|
||||
void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer)
|
||||
{
|
||||
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
|
||||
ULONG i;
|
||||
|
||||
TRACE("(%p)\n", This);
|
||||
TRACE("buffer %p.\n", buffer);
|
||||
|
||||
/* In the case that the number of Unmap calls > the
|
||||
* number of Map calls, d3d returns always D3D_OK.
|
||||
* This is also needed to prevent Map from returning garbage on
|
||||
* the next call (this will happen if the lock_count is < 0). */
|
||||
if (!This->lock_count)
|
||||
if (!buffer->lock_count)
|
||||
{
|
||||
WARN("Unmap called without a previous Map call.\n");
|
||||
WARN("Unmap called without a previous map call.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (InterlockedDecrement(&This->lock_count))
|
||||
if (InterlockedDecrement(&buffer->lock_count))
|
||||
{
|
||||
/* Delay loading the buffer until everything is unlocked */
|
||||
TRACE("Ignoring unlock\n");
|
||||
TRACE("Ignoring unmap.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER) && This->buffer_object)
|
||||
if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER) && buffer->buffer_object)
|
||||
{
|
||||
IWineD3DDeviceImpl *device = This->resource.device;
|
||||
IWineD3DDeviceImpl *device = buffer->resource.device;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
|
||||
if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
|
||||
if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
|
||||
{
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER);
|
||||
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER);
|
||||
}
|
||||
|
||||
context = context_acquire(device, NULL);
|
||||
gl_info = context->gl_info;
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
|
||||
GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object));
|
||||
|
||||
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
|
||||
{
|
||||
for(i = 0; i < This->modified_areas; i++)
|
||||
for (i = 0; i < buffer->modified_areas; ++i)
|
||||
{
|
||||
GL_EXTCALL(glFlushMappedBufferRange(This->buffer_type_hint,
|
||||
This->maps[i].offset,
|
||||
This->maps[i].size));
|
||||
GL_EXTCALL(glFlushMappedBufferRange(buffer->buffer_type_hint,
|
||||
buffer->maps[i].offset, buffer->maps[i].size));
|
||||
checkGLcall("glFlushMappedBufferRange");
|
||||
}
|
||||
}
|
||||
else if (This->flags & WINED3D_BUFFER_FLUSH)
|
||||
else if (buffer->flags & WINED3D_BUFFER_FLUSH)
|
||||
{
|
||||
for(i = 0; i < This->modified_areas; i++)
|
||||
for (i = 0; i < buffer->modified_areas; ++i)
|
||||
{
|
||||
GL_EXTCALL(glFlushMappedBufferRangeAPPLE(This->buffer_type_hint,
|
||||
This->maps[i].offset,
|
||||
This->maps[i].size));
|
||||
GL_EXTCALL(glFlushMappedBufferRangeAPPLE(buffer->buffer_type_hint,
|
||||
buffer->maps[i].offset, buffer->maps[i].size));
|
||||
checkGLcall("glFlushMappedBufferRangeAPPLE");
|
||||
}
|
||||
}
|
||||
|
||||
GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint));
|
||||
GL_EXTCALL(glUnmapBufferARB(buffer->buffer_type_hint));
|
||||
LEAVE_GL();
|
||||
context_release(context);
|
||||
|
||||
This->resource.allocatedMemory = NULL;
|
||||
buffer_clear_dirty_areas(This);
|
||||
buffer->resource.allocatedMemory = NULL;
|
||||
buffer_clear_dirty_areas(buffer);
|
||||
}
|
||||
else if (This->flags & WINED3D_BUFFER_HASDESC)
|
||||
else if (buffer->flags & WINED3D_BUFFER_HASDESC)
|
||||
{
|
||||
buffer_PreLoad(iface);
|
||||
wined3d_buffer_preload(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE buffer_GetDesc(IWineD3DBuffer *iface, WINED3DBUFFER_DESC *desc)
|
||||
void CDECL wined3d_buffer_get_desc(const struct wined3d_buffer *buffer, WINED3DBUFFER_DESC *desc)
|
||||
{
|
||||
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
|
||||
TRACE("buffer %p, desc %p.\n", buffer, desc);
|
||||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
desc->Type = This->resource.resourceType;
|
||||
desc->Usage = This->resource.usage;
|
||||
desc->Pool = This->resource.pool;
|
||||
desc->Size = This->resource.size;
|
||||
desc->Type = buffer->resource.resourceType;
|
||||
desc->Usage = buffer->resource.usage;
|
||||
desc->Pool = buffer->resource.pool;
|
||||
desc->Size = buffer->resource.size;
|
||||
}
|
||||
|
||||
static const struct IWineD3DBufferVtbl wined3d_buffer_vtbl =
|
||||
{
|
||||
/* IUnknown methods */
|
||||
buffer_QueryInterface,
|
||||
buffer_AddRef,
|
||||
buffer_Release,
|
||||
/* IWineD3DBase methods */
|
||||
buffer_GetParent,
|
||||
/* IWineD3DResource methods */
|
||||
buffer_SetPrivateData,
|
||||
buffer_GetPrivateData,
|
||||
buffer_FreePrivateData,
|
||||
buffer_SetPriority,
|
||||
buffer_GetPriority,
|
||||
buffer_PreLoad,
|
||||
buffer_GetType,
|
||||
/* IWineD3DBuffer methods */
|
||||
buffer_GetResource,
|
||||
buffer_Map,
|
||||
buffer_Unmap,
|
||||
buffer_GetDesc,
|
||||
};
|
||||
|
||||
static const struct wined3d_resource_ops buffer_resource_ops =
|
||||
{
|
||||
buffer_unload,
|
||||
|
@ -1483,8 +1427,6 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
buffer->vtbl = &wined3d_buffer_vtbl;
|
||||
|
||||
hr = resource_init(&buffer->resource, WINED3DRTYPE_BUFFER, device, size,
|
||||
usage, format, pool, parent, parent_ops, &buffer_resource_ops);
|
||||
if (FAILED(hr))
|
||||
|
@ -1528,7 +1470,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
|
|||
{
|
||||
BYTE *ptr;
|
||||
|
||||
hr = IWineD3DBuffer_Map((IWineD3DBuffer *)buffer, 0, size, &ptr, 0);
|
||||
hr = wined3d_buffer_map(buffer, 0, size, &ptr, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Failed to map buffer, hr %#x\n", hr);
|
||||
|
@ -1539,7 +1481,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
|
|||
|
||||
memcpy(ptr, data, size);
|
||||
|
||||
IWineD3DBuffer_Unmap((IWineD3DBuffer *)buffer);
|
||||
wined3d_buffer_unmap(buffer);
|
||||
}
|
||||
|
||||
buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps));
|
||||
|
|
|
@ -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;
|
||||
|
@ -2518,28 +2519,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,
|
||||
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue