wined3d: Merge IWineD3DVertexBuffer with IWineD3DBuffer.
That still leaves IWineD3DIndexBuffer, but that code is also mostly similar, except for the conversion code (which will be unused there).
This commit is contained in:
parent
6324ba66ca
commit
aa3027a604
|
@ -320,7 +320,7 @@ struct IDirect3DVertexBuffer8Impl
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
/* IDirect3DResource8 fields */
|
/* IDirect3DResource8 fields */
|
||||||
IWineD3DVertexBuffer *wineD3DVertexBuffer;
|
IWineD3DBuffer *wineD3DVertexBuffer;
|
||||||
|
|
||||||
/* Parent reference */
|
/* Parent reference */
|
||||||
LPDIRECT3DDEVICE8 parentDevice;
|
LPDIRECT3DDEVICE8 parentDevice;
|
||||||
|
|
|
@ -2262,7 +2262,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(LPDIRECT3DDEVICE8 ifa
|
||||||
|
|
||||||
static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(LPDIRECT3DDEVICE8 iface, UINT StreamNumber,IDirect3DVertexBuffer8** pStream,UINT* pStride) {
|
static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(LPDIRECT3DDEVICE8 iface, UINT StreamNumber,IDirect3DVertexBuffer8** pStream,UINT* pStride) {
|
||||||
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
|
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
|
||||||
IWineD3DVertexBuffer *retStream = NULL;
|
IWineD3DBuffer *retStream = NULL;
|
||||||
HRESULT rc = D3D_OK;
|
HRESULT rc = D3D_OK;
|
||||||
|
|
||||||
TRACE("(%p) Relay\n" , This);
|
TRACE("(%p) Relay\n" , This);
|
||||||
|
@ -2274,8 +2274,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(LPDIRECT3DDEVICE8 ifa
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, 0 /* Offset in bytes */, pStride);
|
rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, 0 /* Offset in bytes */, pStride);
|
||||||
if (rc == D3D_OK && NULL != retStream) {
|
if (rc == D3D_OK && NULL != retStream) {
|
||||||
IWineD3DVertexBuffer_GetParent(retStream, (IUnknown **)pStream);
|
IWineD3DBuffer_GetParent(retStream, (IUnknown **)pStream);
|
||||||
IWineD3DVertexBuffer_Release(retStream);
|
IWineD3DBuffer_Release(retStream);
|
||||||
}else{
|
}else{
|
||||||
if (rc != D3D_OK){
|
if (rc != D3D_OK){
|
||||||
FIXME("Call to GetStreamSource failed %p\n", pStride);
|
FIXME("Call to GetStreamSource failed %p\n", pStride);
|
||||||
|
|
|
@ -58,7 +58,7 @@ static ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 i
|
||||||
|
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
|
IWineD3DBuffer_Release(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&d3d8_cs);
|
LeaveCriticalSection(&d3d8_cs);
|
||||||
IUnknown_Release(This->parentDevice);
|
IUnknown_Release(This->parentDevice);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
@ -85,7 +85,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEX
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
hr = IWineD3DVertexBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags);
|
hr = IWineD3DBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags);
|
||||||
LeaveCriticalSection(&d3d8_cs);
|
LeaveCriticalSection(&d3d8_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetPrivateData(LPDIRECT3DVERTEX
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
hr = IWineD3DVertexBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData);
|
hr = IWineD3DBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData);
|
||||||
LeaveCriticalSection(&d3d8_cs);
|
LeaveCriticalSection(&d3d8_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer8Impl_FreePrivateData(LPDIRECT3DVERTE
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
hr = IWineD3DVertexBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid);
|
hr = IWineD3DBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid);
|
||||||
LeaveCriticalSection(&d3d8_cs);
|
LeaveCriticalSection(&d3d8_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ static DWORD WINAPI IDirect3DVertexBuffer8Impl_SetPriority(LPDIRECT3DVERTEXBUFFE
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
ret = IWineD3DVertexBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew);
|
ret = IWineD3DBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew);
|
||||||
LeaveCriticalSection(&d3d8_cs);
|
LeaveCriticalSection(&d3d8_cs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ static DWORD WINAPI IDirect3DVertexBuffer8Impl_GetPriority(LPDIRECT3DVERTEXBUFFE
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
ret = IWineD3DVertexBuffer_GetPriority(This->wineD3DVertexBuffer);
|
ret = IWineD3DBuffer_GetPriority(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&d3d8_cs);
|
LeaveCriticalSection(&d3d8_cs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ static void WINAPI IDirect3DVertexBuffer8Impl_PreLoad(LPDIRECT3DVERTEXBUFFER8 if
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
IWineD3DVertexBuffer_PreLoad(This->wineD3DVertexBuffer);
|
IWineD3DBuffer_PreLoad(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&d3d8_cs);
|
LeaveCriticalSection(&d3d8_cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ static D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer8Impl_GetType(LPDIRECT3DVERTE
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
type = IWineD3DVertexBuffer_GetType(This->wineD3DVertexBuffer);
|
type = IWineD3DBuffer_GetType(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&d3d8_cs);
|
LeaveCriticalSection(&d3d8_cs);
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer8Impl_Lock(LPDIRECT3DVERTEXBUFFER8 if
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
hr = IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, ppbData, Flags);
|
hr = IWineD3DBuffer_Map(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, ppbData, Flags);
|
||||||
LeaveCriticalSection(&d3d8_cs);
|
LeaveCriticalSection(&d3d8_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer8Impl_Unlock(LPDIRECT3DVERTEXBUFFER8
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
hr = IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
|
hr = IWineD3DBuffer_Unmap(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&d3d8_cs);
|
LeaveCriticalSection(&d3d8_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDesc(LPDIRECT3DVERTEXBUFFER8
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d8_cs);
|
EnterCriticalSection(&d3d8_cs);
|
||||||
hr = IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, (WINED3DVERTEXBUFFER_DESC *) pDesc);
|
hr = IWineD3DBuffer_GetDesc(This->wineD3DVertexBuffer, (WINED3DVERTEXBUFFER_DESC *)pDesc);
|
||||||
LeaveCriticalSection(&d3d8_cs);
|
LeaveCriticalSection(&d3d8_cs);
|
||||||
|
|
||||||
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
|
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
|
||||||
|
|
|
@ -345,7 +345,7 @@ typedef struct IDirect3DVertexBuffer9Impl
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
/* IDirect3DResource9 fields */
|
/* IDirect3DResource9 fields */
|
||||||
IWineD3DVertexBuffer *wineD3DVertexBuffer;
|
IWineD3DBuffer *wineD3DVertexBuffer;
|
||||||
|
|
||||||
/* Parent reference */
|
/* Parent reference */
|
||||||
LPDIRECT3DDEVICE9EX parentDevice;
|
LPDIRECT3DDEVICE9EX parentDevice;
|
||||||
|
|
|
@ -470,7 +470,7 @@ static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WINED3DRTYPE_VERTEXBUFFER:
|
case WINED3DRTYPE_VERTEXBUFFER:
|
||||||
IWineD3DVertexBuffer_GetDesc((IWineD3DVertexBuffer *) resource, &vertex_desc);
|
IWineD3DBuffer_GetDesc((IWineD3DBuffer *)resource, &vertex_desc);
|
||||||
pool = vertex_desc.Pool;
|
pool = vertex_desc.Pool;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1576,7 +1576,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX i
|
||||||
|
|
||||||
static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9 **pStream, UINT* OffsetInBytes, UINT* pStride) {
|
static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9 **pStream, UINT* OffsetInBytes, UINT* pStride) {
|
||||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||||
IWineD3DVertexBuffer *retStream = NULL;
|
IWineD3DBuffer *retStream = NULL;
|
||||||
HRESULT rc = D3D_OK;
|
HRESULT rc = D3D_OK;
|
||||||
|
|
||||||
TRACE("(%p) Relay\n" , This);
|
TRACE("(%p) Relay\n" , This);
|
||||||
|
@ -1588,8 +1588,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9EX i
|
||||||
EnterCriticalSection(&d3d9_cs);
|
EnterCriticalSection(&d3d9_cs);
|
||||||
rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, OffsetInBytes, pStride);
|
rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, OffsetInBytes, pStride);
|
||||||
if (rc == D3D_OK && NULL != retStream) {
|
if (rc == D3D_OK && NULL != retStream) {
|
||||||
IWineD3DVertexBuffer_GetParent(retStream, (IUnknown **)pStream);
|
IWineD3DBuffer_GetParent(retStream, (IUnknown **)pStream);
|
||||||
IWineD3DVertexBuffer_Release(retStream);
|
IWineD3DBuffer_Release(retStream);
|
||||||
}else{
|
}else{
|
||||||
if (rc != D3D_OK){
|
if (rc != D3D_OK){
|
||||||
FIXME("Call to GetStreamSource failed %p %p\n", OffsetInBytes, pStride);
|
FIXME("Call to GetStreamSource failed %p %p\n", OffsetInBytes, pStride);
|
||||||
|
|
|
@ -59,7 +59,7 @@ static ULONG WINAPI IDirect3DVertexBuffer9Impl_Release(LPDIRECT3DVERTEXBUFFER9 i
|
||||||
|
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
EnterCriticalSection(&d3d9_cs);
|
EnterCriticalSection(&d3d9_cs);
|
||||||
IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
|
IWineD3DBuffer_Release(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
IDirect3DDevice9Ex_Release(This->parentDevice);
|
IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
@ -82,7 +82,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDevice(LPDIRECT3DVERTEXBUFFE
|
||||||
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
||||||
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
return IWineD3DVertexBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags);
|
return IWineD3DBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
||||||
|
@ -91,7 +91,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetPrivateData(LPDIRECT3DVERTEX
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d9_cs);
|
EnterCriticalSection(&d3d9_cs);
|
||||||
hr = IWineD3DVertexBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData);
|
hr = IWineD3DBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData);
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer9Impl_FreePrivateData(LPDIRECT3DVERTE
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d9_cs);
|
EnterCriticalSection(&d3d9_cs);
|
||||||
hr = IWineD3DVertexBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid);
|
hr = IWineD3DBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid);
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ static DWORD WINAPI IDirect3DVertexBuffer9Impl_SetPriority(LPDIRECT3DVERTEXBUFFE
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d9_cs);
|
EnterCriticalSection(&d3d9_cs);
|
||||||
hr = IWineD3DVertexBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew);
|
hr = IWineD3DBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew);
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ static DWORD WINAPI IDirect3DVertexBuffer9Impl_GetPriority(LPDIRECT3DVERTEXBUFFE
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d9_cs);
|
EnterCriticalSection(&d3d9_cs);
|
||||||
hr = IWineD3DVertexBuffer_GetPriority(This->wineD3DVertexBuffer);
|
hr = IWineD3DBuffer_GetPriority(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ static void WINAPI IDirect3DVertexBuffer9Impl_PreLoad(LPDIRECT3DVERTEXBUFFER9 if
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d9_cs);
|
EnterCriticalSection(&d3d9_cs);
|
||||||
IWineD3DVertexBuffer_PreLoad(This->wineD3DVertexBuffer);
|
IWineD3DBuffer_PreLoad(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ static D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer9Impl_GetType(LPDIRECT3DVERTE
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d9_cs);
|
EnterCriticalSection(&d3d9_cs);
|
||||||
ret = IWineD3DVertexBuffer_GetType(This->wineD3DVertexBuffer);
|
ret = IWineD3DBuffer_GetType(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer9Impl_Lock(LPDIRECT3DVERTEXBUFFER9 if
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d9_cs);
|
EnterCriticalSection(&d3d9_cs);
|
||||||
hr = IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags);
|
hr = IWineD3DBuffer_Map(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags);
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer9Impl_Unlock(LPDIRECT3DVERTEXBUFFER9
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d9_cs);
|
EnterCriticalSection(&d3d9_cs);
|
||||||
hr = IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
|
hr = IWineD3DBuffer_Unmap(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDesc(LPDIRECT3DVERTEXBUFFER9
|
||||||
TRACE("(%p) Relay\n", This);
|
TRACE("(%p) Relay\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&d3d9_cs);
|
EnterCriticalSection(&d3d9_cs);
|
||||||
hr = IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, (WINED3DVERTEXBUFFER_DESC *) pDesc);
|
hr = IWineD3DBuffer_GetDesc(This->wineD3DVertexBuffer, (WINED3DVERTEXBUFFER_DESC *)pDesc);
|
||||||
LeaveCriticalSection(&d3d9_cs);
|
LeaveCriticalSection(&d3d9_cs);
|
||||||
|
|
||||||
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
|
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
|
||||||
|
|
|
@ -681,7 +681,7 @@ struct IDirect3DVertexBufferImpl
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
/*** WineD3D and ddraw links ***/
|
/*** WineD3D and ddraw links ***/
|
||||||
IWineD3DVertexBuffer *wineD3DVertexBuffer;
|
IWineD3DBuffer *wineD3DVertexBuffer;
|
||||||
IWineD3DVertexDeclaration *wineD3DVertexDeclaration;
|
IWineD3DVertexDeclaration *wineD3DVertexDeclaration;
|
||||||
IDirectDrawImpl *ddraw;
|
IDirectDrawImpl *ddraw;
|
||||||
|
|
||||||
|
|
|
@ -4117,8 +4117,7 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB(IDirect3DDevice7 *iface,
|
||||||
|
|
||||||
/* Get the FVF of the vertex buffer, and its stride */
|
/* Get the FVF of the vertex buffer, and its stride */
|
||||||
EnterCriticalSection(&ddraw_cs);
|
EnterCriticalSection(&ddraw_cs);
|
||||||
hr = IWineD3DVertexBuffer_GetDesc(vb->wineD3DVertexBuffer,
|
hr = IWineD3DBuffer_GetDesc(vb->wineD3DVertexBuffer, &Desc);
|
||||||
&Desc);
|
|
||||||
if(hr != D3D_OK)
|
if(hr != D3D_OK)
|
||||||
{
|
{
|
||||||
ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr = %08x\n", This, hr);
|
ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr = %08x\n", This, hr);
|
||||||
|
@ -4247,8 +4246,7 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
|
||||||
|
|
||||||
EnterCriticalSection(&ddraw_cs);
|
EnterCriticalSection(&ddraw_cs);
|
||||||
/* Get the FVF of the vertex buffer, and its stride */
|
/* Get the FVF of the vertex buffer, and its stride */
|
||||||
hr = IWineD3DVertexBuffer_GetDesc(vb->wineD3DVertexBuffer,
|
hr = IWineD3DBuffer_GetDesc(vb->wineD3DVertexBuffer, &Desc);
|
||||||
&Desc);
|
|
||||||
if(hr != D3D_OK)
|
if(hr != D3D_OK)
|
||||||
{
|
{
|
||||||
ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr = %08x\n", This, hr);
|
ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr = %08x\n", This, hr);
|
||||||
|
|
|
@ -1043,7 +1043,7 @@ IDirect3DImpl_7_CreateVertexBuffer(IDirect3D7 *iface,
|
||||||
if(!object->wineD3DVertexDeclaration)
|
if(!object->wineD3DVertexDeclaration)
|
||||||
{
|
{
|
||||||
ERR("Cannot find the vertex declaration for fvf %08x\n", Desc->dwFVF);
|
ERR("Cannot find the vertex declaration for fvf %08x\n", Desc->dwFVF);
|
||||||
IWineD3DVertexBuffer_Release(object->wineD3DVertexBuffer);
|
IWineD3DBuffer_Release(object->wineD3DVertexBuffer);
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
HeapFree(GetProcessHeap(), 0, object);
|
||||||
LeaveCriticalSection(&ddraw_cs);
|
LeaveCriticalSection(&ddraw_cs);
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
|
|
|
@ -159,7 +159,7 @@ IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface)
|
||||||
|
|
||||||
if (ref == 0)
|
if (ref == 0)
|
||||||
{
|
{
|
||||||
IWineD3DVertexBuffer *curVB = NULL;
|
IWineD3DBuffer *curVB = NULL;
|
||||||
UINT offset, stride;
|
UINT offset, stride;
|
||||||
|
|
||||||
EnterCriticalSection(&ddraw_cs);
|
EnterCriticalSection(&ddraw_cs);
|
||||||
|
@ -182,11 +182,11 @@ IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface)
|
||||||
}
|
}
|
||||||
if(curVB)
|
if(curVB)
|
||||||
{
|
{
|
||||||
IWineD3DVertexBuffer_Release(curVB); /* For the GetStreamSource */
|
IWineD3DBuffer_Release(curVB); /* For the GetStreamSource */
|
||||||
}
|
}
|
||||||
|
|
||||||
IWineD3DVertexDeclaration_Release(This->wineD3DVertexDeclaration);
|
IWineD3DVertexDeclaration_Release(This->wineD3DVertexDeclaration);
|
||||||
IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
|
IWineD3DBuffer_Release(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&ddraw_cs);
|
LeaveCriticalSection(&ddraw_cs);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
|
||||||
|
@ -242,8 +242,7 @@ IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface,
|
||||||
if(Size)
|
if(Size)
|
||||||
{
|
{
|
||||||
/* Get the size, for returning it, and for locking */
|
/* Get the size, for returning it, and for locking */
|
||||||
hr = IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer,
|
hr = IWineD3DBuffer_GetDesc(This->wineD3DVertexBuffer, &Desc);
|
||||||
&Desc);
|
|
||||||
if(hr != D3D_OK)
|
if(hr != D3D_OK)
|
||||||
{
|
{
|
||||||
ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08x\n", This, hr);
|
ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08x\n", This, hr);
|
||||||
|
@ -253,11 +252,8 @@ IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface,
|
||||||
*Size = Desc.Size;
|
*Size = Desc.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer,
|
hr = IWineD3DBuffer_Map(This->wineD3DVertexBuffer, 0 /* OffsetToLock */,
|
||||||
0 /* OffsetToLock */,
|
0 /* SizeToLock, 0 == Full lock */, (BYTE **)Data, Flags);
|
||||||
0 /* SizeToLock, 0 == Full lock */,
|
|
||||||
(BYTE **) Data,
|
|
||||||
Flags);
|
|
||||||
LeaveCriticalSection(&ddraw_cs);
|
LeaveCriticalSection(&ddraw_cs);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -291,7 +287,7 @@ IDirect3DVertexBufferImpl_Unlock(IDirect3DVertexBuffer7 *iface)
|
||||||
TRACE("(%p)->()\n", This);
|
TRACE("(%p)->()\n", This);
|
||||||
|
|
||||||
EnterCriticalSection(&ddraw_cs);
|
EnterCriticalSection(&ddraw_cs);
|
||||||
hr = IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
|
hr = IWineD3DBuffer_Unmap(This->wineD3DVertexBuffer);
|
||||||
LeaveCriticalSection(&ddraw_cs);
|
LeaveCriticalSection(&ddraw_cs);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -376,8 +372,7 @@ IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface,
|
||||||
doClip);
|
doClip);
|
||||||
}
|
}
|
||||||
|
|
||||||
IWineD3DVertexBuffer_GetDesc(Src->wineD3DVertexBuffer,
|
IWineD3DBuffer_GetDesc(Src->wineD3DVertexBuffer, &Desc);
|
||||||
&Desc);
|
|
||||||
IWineD3DDevice_SetStreamSource(D3D->wineD3DDevice,
|
IWineD3DDevice_SetStreamSource(D3D->wineD3DDevice,
|
||||||
0, /* Stream No */
|
0, /* Stream No */
|
||||||
Src->wineD3DVertexBuffer,
|
Src->wineD3DVertexBuffer,
|
||||||
|
@ -447,8 +442,7 @@ IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
|
||||||
if(!Desc) return DDERR_INVALIDPARAMS;
|
if(!Desc) return DDERR_INVALIDPARAMS;
|
||||||
|
|
||||||
EnterCriticalSection(&ddraw_cs);
|
EnterCriticalSection(&ddraw_cs);
|
||||||
hr = IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer,
|
hr = IWineD3DBuffer_GetDesc(This->wineD3DVertexBuffer, &WDesc);
|
||||||
&WDesc);
|
|
||||||
if(hr != D3D_OK)
|
if(hr != D3D_OK)
|
||||||
{
|
{
|
||||||
ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08x\n", This, hr);
|
ERR("(%p) IWineD3DVertexBuffer::GetDesc failed with hr=%08x\n", This, hr);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -258,11 +258,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface,
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, UINT Size, DWORD Usage,
|
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, UINT Size, DWORD Usage,
|
||||||
DWORD FVF, WINED3DPOOL Pool, IWineD3DVertexBuffer** ppVertexBuffer, HANDLE *sharedHandle,
|
DWORD FVF, WINED3DPOOL Pool, IWineD3DBuffer **ppVertexBuffer, HANDLE *sharedHandle, IUnknown *parent)
|
||||||
IUnknown *parent) {
|
{
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
IWineD3DVertexBufferImpl *object;
|
struct wined3d_buffer *object;
|
||||||
WINED3DFORMAT Format = WINED3DFMT_VERTEXDATA; /* Dummy format for now */
|
WINED3DFORMAT Format = WINED3DFMT_VERTEXDATA; /* Dummy format for now */
|
||||||
int dxVersion = ( (IWineD3DImpl *) This->wineD3D)->dxVersion;
|
int dxVersion = ( (IWineD3DImpl *) This->wineD3D)->dxVersion;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -289,7 +289,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
|
||||||
return WINED3DERR_OUTOFVIDEOMEMORY;
|
return WINED3DERR_OUTOFVIDEOMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
object->lpVtbl = &IWineD3DVertexBuffer_Vtbl;
|
object->vtbl = &wined3d_buffer_vtbl;
|
||||||
hr = resource_init(&object->resource, WINED3DRTYPE_VERTEXBUFFER, This, Size, Usage, Format, Pool, parent);
|
hr = resource_init(&object->resource, WINED3DRTYPE_VERTEXBUFFER, This, Size, Usage, Format, Pool, parent);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
@ -304,7 +304,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
|
||||||
IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);
|
IWineD3DDeviceImpl_AddResource(iface, (IWineD3DResource *)object);
|
||||||
|
|
||||||
TRACE("(%p) : Size=%d, Usage=0x%08x, FVF=%x, Pool=%d - Memory@%p, Iface@%p\n", This, Size, Usage, FVF, Pool, object->resource.allocatedMemory, object);
|
TRACE("(%p) : Size=%d, Usage=0x%08x, FVF=%x, Pool=%d - Memory@%p, Iface@%p\n", This, Size, Usage, FVF, Pool, object->resource.allocatedMemory, object);
|
||||||
*ppVertexBuffer = (IWineD3DVertexBuffer *)object;
|
*ppVertexBuffer = (IWineD3DBuffer *)object;
|
||||||
|
|
||||||
object->fvf = FVF;
|
object->fvf = FVF;
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
|
||||||
} else if(dxVersion <= 7 && conv) {
|
} else if(dxVersion <= 7 && conv) {
|
||||||
TRACE("Not creating a vbo because dxVersion is 7 and the fvf needs conversion\n");
|
TRACE("Not creating a vbo because dxVersion is 7 and the fvf needs conversion\n");
|
||||||
} else {
|
} else {
|
||||||
object->Flags |= VBFLAG_CREATEVBO;
|
object->flags |= WINED3D_BUFFER_CREATEBO;
|
||||||
}
|
}
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +552,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
|
||||||
|
|
||||||
for(i = 0; i < MAX_STREAMS; i++) {
|
for(i = 0; i < MAX_STREAMS; i++) {
|
||||||
if(object->streamSource[i]) {
|
if(object->streamSource[i]) {
|
||||||
IWineD3DVertexBuffer_AddRef(object->streamSource[i]);
|
IWineD3DBuffer_AddRef(object->streamSource[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(object->pIndexData) {
|
if(object->pIndexData) {
|
||||||
|
@ -685,7 +685,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
|
||||||
|
|
||||||
for(i = 0; i < MAX_STREAMS; i++) {
|
for(i = 0; i < MAX_STREAMS; i++) {
|
||||||
if(object->streamSource[i]) {
|
if(object->streamSource[i]) {
|
||||||
IWineD3DVertexBuffer_AddRef(object->streamSource[i]);
|
IWineD3DBuffer_AddRef(object->streamSource[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(object->vertexShader) {
|
if(object->vertexShader) {
|
||||||
|
@ -2824,9 +2824,11 @@ static UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *ifa
|
||||||
/*****
|
/*****
|
||||||
* Get / Set Stream Source
|
* Get / Set Stream Source
|
||||||
*****/
|
*****/
|
||||||
static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface, UINT StreamNumber,IWineD3DVertexBuffer* pStreamData, UINT OffsetInBytes, UINT Stride) {
|
static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface, UINT StreamNumber,
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DBuffer *pStreamData, UINT OffsetInBytes, UINT Stride)
|
||||||
IWineD3DVertexBuffer *oldSrc;
|
{
|
||||||
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
IWineD3DBuffer *oldSrc;
|
||||||
|
|
||||||
if (StreamNumber >= MAX_STREAMS) {
|
if (StreamNumber >= MAX_STREAMS) {
|
||||||
WARN("Stream out of range %d\n", StreamNumber);
|
WARN("Stream out of range %d\n", StreamNumber);
|
||||||
|
@ -2857,19 +2859,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface,
|
||||||
/* Handle recording of state blocks */
|
/* Handle recording of state blocks */
|
||||||
if (This->isRecordingState) {
|
if (This->isRecordingState) {
|
||||||
TRACE("Recording... not performing anything\n");
|
TRACE("Recording... not performing anything\n");
|
||||||
if(pStreamData) IWineD3DVertexBuffer_AddRef(pStreamData);
|
if (pStreamData) IWineD3DBuffer_AddRef(pStreamData);
|
||||||
if(oldSrc) IWineD3DVertexBuffer_Release(oldSrc);
|
if (oldSrc) IWineD3DBuffer_Release(oldSrc);
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pStreamData != NULL) {
|
if (pStreamData != NULL) {
|
||||||
IWineD3DVertexBufferImpl *vbImpl = (IWineD3DVertexBufferImpl *) pStreamData;
|
InterlockedIncrement(&((struct wined3d_buffer *)pStreamData)->bind_count);
|
||||||
InterlockedIncrement(&vbImpl->bindCount);
|
IWineD3DBuffer_AddRef(pStreamData);
|
||||||
IWineD3DVertexBuffer_AddRef(pStreamData);
|
|
||||||
}
|
}
|
||||||
if (oldSrc != NULL) {
|
if (oldSrc != NULL) {
|
||||||
InterlockedDecrement(&((IWineD3DVertexBufferImpl *) oldSrc)->bindCount);
|
InterlockedDecrement(&((struct wined3d_buffer *)oldSrc)->bind_count);
|
||||||
IWineD3DVertexBuffer_Release(oldSrc);
|
IWineD3DBuffer_Release(oldSrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
|
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
|
||||||
|
@ -2877,7 +2878,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface,
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface, UINT StreamNumber,IWineD3DVertexBuffer** pStream, UINT *pOffset, UINT* pStride) {
|
static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface,
|
||||||
|
UINT StreamNumber, IWineD3DBuffer **pStream, UINT *pOffset, UINT *pStride)
|
||||||
|
{
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
|
|
||||||
TRACE("(%p) : StreamNo: %u, Stream (%p), Offset %u, Stride %u\n", This, StreamNumber,
|
TRACE("(%p) : StreamNo: %u, Stream (%p), Offset %u, Stride %u\n", This, StreamNumber,
|
||||||
|
@ -2896,7 +2899,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*pStream != NULL) {
|
if (*pStream != NULL) {
|
||||||
IWineD3DVertexBuffer_AddRef(*pStream); /* We have created a new reference to the VB */
|
IWineD3DBuffer_AddRef(*pStream); /* We have created a new reference to the VB */
|
||||||
}
|
}
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
@ -4296,7 +4299,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantF(
|
||||||
|
|
||||||
#define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size)
|
#define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size)
|
||||||
static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCount,
|
static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCount,
|
||||||
const WineDirect3DVertexStridedData *lpStrideData, IWineD3DVertexBufferImpl *dest, DWORD dwFlags)
|
const WineDirect3DVertexStridedData *lpStrideData, struct wined3d_buffer *dest, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
char *dest_ptr, *dest_conv = NULL, *dest_conv_addr = NULL;
|
char *dest_ptr, *dest_conv = NULL, *dest_conv_addr = NULL;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -4328,9 +4331,10 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn
|
||||||
ERR("Out of memory\n");
|
ERR("Out of memory\n");
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
if(dest->vbo) {
|
if (dest->buffer_object)
|
||||||
|
{
|
||||||
const void *src;
|
const void *src;
|
||||||
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, dest->vbo));
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, dest->buffer_object));
|
||||||
checkGLcall("glBindBufferARB");
|
checkGLcall("glBindBufferARB");
|
||||||
src = GL_EXTCALL(glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_READ_ONLY_ARB));
|
src = GL_EXTCALL(glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_READ_ONLY_ARB));
|
||||||
if(src) {
|
if(src) {
|
||||||
|
@ -4344,12 +4348,14 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn
|
||||||
/* Get a pointer into the destination vbo(create one if none exists) and
|
/* Get a pointer into the destination vbo(create one if none exists) and
|
||||||
* write correct opengl data into it. It's cheap and allows us to run drawStridedFast
|
* write correct opengl data into it. It's cheap and allows us to run drawStridedFast
|
||||||
*/
|
*/
|
||||||
if(!dest->vbo && GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT)) {
|
if (!dest->buffer_object && GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT))
|
||||||
dest->Flags |= VBFLAG_CREATEVBO;
|
{
|
||||||
IWineD3DVertexBuffer_PreLoad((IWineD3DVertexBuffer *) dest);
|
dest->flags |= WINED3D_BUFFER_CREATEBO;
|
||||||
|
IWineD3DBuffer_PreLoad((IWineD3DBuffer *)dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dest->vbo) {
|
if (dest->buffer_object)
|
||||||
|
{
|
||||||
unsigned char extrabytes = 0;
|
unsigned char extrabytes = 0;
|
||||||
/* If the destination vertex buffer has D3DFVF_XYZ position(non-rhw), native d3d writes RHW position, where the RHW
|
/* If the destination vertex buffer has D3DFVF_XYZ position(non-rhw), native d3d writes RHW position, where the RHW
|
||||||
* gets written into the 4 bytes after the Z position. In the case of a dest buffer that only has D3DFVF_XYZ data,
|
* gets written into the 4 bytes after the Z position. In the case of a dest buffer that only has D3DFVF_XYZ data,
|
||||||
|
@ -4636,7 +4642,7 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dest_conv) {
|
if(dest_conv) {
|
||||||
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, dest->vbo));
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, dest->buffer_object));
|
||||||
checkGLcall("glBindBufferARB(GL_ARRAY_BUFFER_ARB)");
|
checkGLcall("glBindBufferARB(GL_ARRAY_BUFFER_ARB)");
|
||||||
GL_EXTCALL(glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, dwDestIndex * get_flexible_vertex_size(DestFVF),
|
GL_EXTCALL(glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, dwDestIndex * get_flexible_vertex_size(DestFVF),
|
||||||
dwCount * get_flexible_vertex_size(DestFVF),
|
dwCount * get_flexible_vertex_size(DestFVF),
|
||||||
|
@ -4651,7 +4657,9 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn
|
||||||
}
|
}
|
||||||
#undef copy_and_next
|
#undef copy_and_next
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IWineD3DVertexBuffer* pDestBuffer, IWineD3DVertexDeclaration* pVertexDecl, DWORD Flags) {
|
static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, UINT SrcStartIndex, UINT DestIndex,
|
||||||
|
UINT VertexCount, IWineD3DBuffer *pDestBuffer, IWineD3DVertexDeclaration *pVertexDecl, DWORD Flags)
|
||||||
|
{
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
WineDirect3DVertexStridedData strided;
|
WineDirect3DVertexStridedData strided;
|
||||||
BOOL vbo = FALSE, streamWasUP = This->stateBlock->streamIsUP;
|
BOOL vbo = FALSE, streamWasUP = This->stateBlock->streamIsUP;
|
||||||
|
@ -4681,12 +4689,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface,
|
||||||
*/
|
*/
|
||||||
#define FIXSRC(type) \
|
#define FIXSRC(type) \
|
||||||
if(strided.u.s.type.VBO) { \
|
if(strided.u.s.type.VBO) { \
|
||||||
IWineD3DVertexBufferImpl *vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[strided.u.s.type.streamNo]; \
|
struct wined3d_buffer *vb = (struct wined3d_buffer *)This->stateBlock->streamSource[strided.u.s.type.streamNo]; \
|
||||||
strided.u.s.type.VBO = 0; \
|
strided.u.s.type.VBO = 0; \
|
||||||
strided.u.s.type.lpData = (BYTE *) ((unsigned long) strided.u.s.type.lpData + (unsigned long) vb->resource.allocatedMemory); \
|
strided.u.s.type.lpData = (BYTE *) ((unsigned long) strided.u.s.type.lpData + (unsigned long) vb->resource.allocatedMemory); \
|
||||||
ENTER_GL(); \
|
ENTER_GL(); \
|
||||||
GL_EXTCALL(glDeleteBuffersARB(1, &vb->vbo)); \
|
GL_EXTCALL(glDeleteBuffersARB(1, &vb->buffer_object)); \
|
||||||
vb->vbo = 0; \
|
vb->buffer_object = 0; \
|
||||||
LEAVE_GL(); \
|
LEAVE_GL(); \
|
||||||
} \
|
} \
|
||||||
if(strided.u.s.type.lpData) { \
|
if(strided.u.s.type.lpData) { \
|
||||||
|
@ -4713,7 +4721,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface,
|
||||||
#undef FIXSRC
|
#undef FIXSRC
|
||||||
}
|
}
|
||||||
|
|
||||||
return process_vertices_strided(This, DestIndex, VertexCount, &strided, (IWineD3DVertexBufferImpl *) pDestBuffer, Flags);
|
return process_vertices_strided(This, DestIndex, VertexCount, &strided,
|
||||||
|
(struct wined3d_buffer *)pDestBuffer, Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****
|
/*****
|
||||||
|
@ -5490,7 +5499,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface,
|
||||||
const void *pVertexStreamZeroData, UINT VertexStreamZeroStride)
|
const void *pVertexStreamZeroData, UINT VertexStreamZeroStride)
|
||||||
{
|
{
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
IWineD3DVertexBuffer *vb;
|
IWineD3DBuffer *vb;
|
||||||
|
|
||||||
TRACE("(%p) : vertex count %u, pVtxData %p, stride %u\n",
|
TRACE("(%p) : vertex count %u, pVtxData %p, stride %u\n",
|
||||||
This, vertex_count, pVertexStreamZeroData, VertexStreamZeroStride);
|
This, vertex_count, pVertexStreamZeroData, VertexStreamZeroStride);
|
||||||
|
@ -5502,8 +5511,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface,
|
||||||
|
|
||||||
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
|
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
|
||||||
vb = This->stateBlock->streamSource[0];
|
vb = This->stateBlock->streamSource[0];
|
||||||
This->stateBlock->streamSource[0] = (IWineD3DVertexBuffer *)pVertexStreamZeroData;
|
This->stateBlock->streamSource[0] = (IWineD3DBuffer *)pVertexStreamZeroData;
|
||||||
if(vb) IWineD3DVertexBuffer_Release(vb);
|
if (vb) IWineD3DBuffer_Release(vb);
|
||||||
This->stateBlock->streamOffset[0] = 0;
|
This->stateBlock->streamOffset[0] = 0;
|
||||||
This->stateBlock->streamStride[0] = VertexStreamZeroStride;
|
This->stateBlock->streamStride[0] = VertexStreamZeroStride;
|
||||||
This->stateBlock->streamIsUP = TRUE;
|
This->stateBlock->streamIsUP = TRUE;
|
||||||
|
@ -5531,7 +5540,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
|
||||||
{
|
{
|
||||||
int idxStride;
|
int idxStride;
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||||
IWineD3DVertexBuffer *vb;
|
IWineD3DBuffer *vb;
|
||||||
IWineD3DIndexBuffer *ib;
|
IWineD3DIndexBuffer *ib;
|
||||||
|
|
||||||
TRACE("(%p) : MinVtxIdx %u, NumVIdx %u, index count %u, pidxdata %p, IdxFmt %u, pVtxdata %p, stride=%u\n",
|
TRACE("(%p) : MinVtxIdx %u, NumVIdx %u, index count %u, pidxdata %p, IdxFmt %u, pVtxdata %p, stride=%u\n",
|
||||||
|
@ -5551,8 +5560,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
|
||||||
|
|
||||||
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
|
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
|
||||||
vb = This->stateBlock->streamSource[0];
|
vb = This->stateBlock->streamSource[0];
|
||||||
This->stateBlock->streamSource[0] = (IWineD3DVertexBuffer *)pVertexStreamZeroData;
|
This->stateBlock->streamSource[0] = (IWineD3DBuffer *)pVertexStreamZeroData;
|
||||||
if(vb) IWineD3DVertexBuffer_Release(vb);
|
if (vb) IWineD3DBuffer_Release(vb);
|
||||||
This->stateBlock->streamIsUP = TRUE;
|
This->stateBlock->streamIsUP = TRUE;
|
||||||
This->stateBlock->streamOffset[0] = 0;
|
This->stateBlock->streamOffset[0] = 0;
|
||||||
This->stateBlock->streamStride[0] = VertexStreamZeroStride;
|
This->stateBlock->streamStride[0] = VertexStreamZeroStride;
|
||||||
|
|
|
@ -108,7 +108,7 @@ void primitiveDeclarationConvertToStridedData(
|
||||||
/* Translate the declaration into strided data */
|
/* Translate the declaration into strided data */
|
||||||
strided->swizzle_map = 0;
|
strided->swizzle_map = 0;
|
||||||
for (i = 0 ; i < vertexDeclaration->declarationWNumElements - 1; ++i) {
|
for (i = 0 ; i < vertexDeclaration->declarationWNumElements - 1; ++i) {
|
||||||
GLint streamVBO = 0;
|
GLuint streamVBO = 0;
|
||||||
BOOL stride_used;
|
BOOL stride_used;
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ void primitiveDeclarationConvertToStridedData(
|
||||||
data = (BYTE *)This->stateBlock->streamSource[element->Stream];
|
data = (BYTE *)This->stateBlock->streamSource[element->Stream];
|
||||||
} else {
|
} else {
|
||||||
TRACE("Stream isn't up %d, %p\n", element->Stream, This->stateBlock->streamSource[element->Stream]);
|
TRACE("Stream isn't up %d, %p\n", element->Stream, This->stateBlock->streamSource[element->Stream]);
|
||||||
data = IWineD3DVertexBufferImpl_GetMemory(This->stateBlock->streamSource[element->Stream], 0, &streamVBO);
|
data = buffer_get_memory(This->stateBlock->streamSource[element->Stream], 0, &streamVBO);
|
||||||
|
|
||||||
/* Can't use vbo's if the base vertex index is negative. OpenGL doesn't accept negative offsets
|
/* Can't use vbo's if the base vertex index is negative. OpenGL doesn't accept negative offsets
|
||||||
* (or rather offsets bigger than the vbo, because the pointer is unsigned), so use system memory
|
* (or rather offsets bigger than the vbo, because the pointer is unsigned), so use system memory
|
||||||
|
@ -137,7 +137,7 @@ void primitiveDeclarationConvertToStridedData(
|
||||||
if(This->stateBlock->loadBaseVertexIndex < 0) {
|
if(This->stateBlock->loadBaseVertexIndex < 0) {
|
||||||
WARN("loadBaseVertexIndex is < 0 (%d), not using vbos\n", This->stateBlock->loadBaseVertexIndex);
|
WARN("loadBaseVertexIndex is < 0 (%d), not using vbos\n", This->stateBlock->loadBaseVertexIndex);
|
||||||
streamVBO = 0;
|
streamVBO = 0;
|
||||||
data = ((IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[element->Stream])->resource.allocatedMemory;
|
data = ((struct wined3d_buffer *)This->stateBlock->streamSource[element->Stream])->resource.allocatedMemory;
|
||||||
if((UINT_PTR)data < -This->stateBlock->loadBaseVertexIndex * stride) {
|
if((UINT_PTR)data < -This->stateBlock->loadBaseVertexIndex * stride) {
|
||||||
FIXME("System memory vertex data load offset is negative!\n");
|
FIXME("System memory vertex data load offset is negative!\n");
|
||||||
}
|
}
|
||||||
|
@ -200,9 +200,9 @@ void primitiveDeclarationConvertToStridedData(
|
||||||
* once in there.
|
* once in there.
|
||||||
*/
|
*/
|
||||||
for(i=0; i < numPreloadStreams; i++) {
|
for(i=0; i < numPreloadStreams; i++) {
|
||||||
IWineD3DVertexBuffer *vb = This->stateBlock->streamSource[streams[i]];
|
IWineD3DBuffer *vb = This->stateBlock->streamSource[streams[i]];
|
||||||
if(vb) {
|
if(vb) {
|
||||||
IWineD3DVertexBuffer_PreLoad(vb);
|
IWineD3DBuffer_PreLoad(vb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -675,7 +675,7 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, const WineDirect3
|
||||||
sd->u.input[instancedData[j]].dwStride * i +
|
sd->u.input[instancedData[j]].dwStride * i +
|
||||||
stateblock->streamOffset[sd->u.input[instancedData[j]].streamNo];
|
stateblock->streamOffset[sd->u.input[instancedData[j]].streamNo];
|
||||||
if(sd->u.input[instancedData[j]].VBO) {
|
if(sd->u.input[instancedData[j]].VBO) {
|
||||||
IWineD3DVertexBufferImpl *vb = (IWineD3DVertexBufferImpl *) stateblock->streamSource[sd->u.input[instancedData[j]].streamNo];
|
struct wined3d_buffer *vb = (struct wined3d_buffer *)stateblock->streamSource[sd->u.input[instancedData[j]].streamNo];
|
||||||
ptr += (long) vb->resource.allocatedMemory;
|
ptr += (long) vb->resource.allocatedMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -690,87 +690,87 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, const WineDirect3
|
||||||
|
|
||||||
static inline void remove_vbos(IWineD3DDeviceImpl *This, WineDirect3DVertexStridedData *s) {
|
static inline void remove_vbos(IWineD3DDeviceImpl *This, WineDirect3DVertexStridedData *s) {
|
||||||
unsigned char i;
|
unsigned char i;
|
||||||
IWineD3DVertexBufferImpl *vb;
|
struct wined3d_buffer *vb;
|
||||||
|
|
||||||
if(s->u.s.position.VBO) {
|
if(s->u.s.position.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.position.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.position.streamNo];
|
||||||
s->u.s.position.VBO = 0;
|
s->u.s.position.VBO = 0;
|
||||||
s->u.s.position.lpData = (BYTE *) ((unsigned long) s->u.s.position.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.position.lpData = (BYTE *) ((unsigned long) s->u.s.position.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.blendWeights.VBO) {
|
if(s->u.s.blendWeights.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.blendWeights.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.blendWeights.streamNo];
|
||||||
s->u.s.blendWeights.VBO = 0;
|
s->u.s.blendWeights.VBO = 0;
|
||||||
s->u.s.blendWeights.lpData = (BYTE *) ((unsigned long) s->u.s.blendWeights.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.blendWeights.lpData = (BYTE *) ((unsigned long) s->u.s.blendWeights.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.blendMatrixIndices.VBO) {
|
if(s->u.s.blendMatrixIndices.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.blendMatrixIndices.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.blendMatrixIndices.streamNo];
|
||||||
s->u.s.blendMatrixIndices.VBO = 0;
|
s->u.s.blendMatrixIndices.VBO = 0;
|
||||||
s->u.s.blendMatrixIndices.lpData = (BYTE *) ((unsigned long) s->u.s.blendMatrixIndices.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.blendMatrixIndices.lpData = (BYTE *) ((unsigned long) s->u.s.blendMatrixIndices.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.normal.VBO) {
|
if(s->u.s.normal.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.normal.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.normal.streamNo];
|
||||||
s->u.s.normal.VBO = 0;
|
s->u.s.normal.VBO = 0;
|
||||||
s->u.s.normal.lpData = (BYTE *) ((unsigned long) s->u.s.normal.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.normal.lpData = (BYTE *) ((unsigned long) s->u.s.normal.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.pSize.VBO) {
|
if(s->u.s.pSize.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.pSize.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.pSize.streamNo];
|
||||||
s->u.s.pSize.VBO = 0;
|
s->u.s.pSize.VBO = 0;
|
||||||
s->u.s.pSize.lpData = (BYTE *) ((unsigned long) s->u.s.pSize.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.pSize.lpData = (BYTE *) ((unsigned long) s->u.s.pSize.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.diffuse.VBO) {
|
if(s->u.s.diffuse.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.diffuse.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.diffuse.streamNo];
|
||||||
s->u.s.diffuse.VBO = 0;
|
s->u.s.diffuse.VBO = 0;
|
||||||
s->u.s.diffuse.lpData = (BYTE *) ((unsigned long) s->u.s.diffuse.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.diffuse.lpData = (BYTE *) ((unsigned long) s->u.s.diffuse.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.specular.VBO) {
|
if(s->u.s.specular.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.specular.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.specular.streamNo];
|
||||||
s->u.s.specular.VBO = 0;
|
s->u.s.specular.VBO = 0;
|
||||||
s->u.s.specular.lpData = (BYTE *) ((unsigned long) s->u.s.specular.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.specular.lpData = (BYTE *) ((unsigned long) s->u.s.specular.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
for(i = 0; i < WINED3DDP_MAXTEXCOORD; i++) {
|
for(i = 0; i < WINED3DDP_MAXTEXCOORD; i++) {
|
||||||
if(s->u.s.texCoords[i].VBO) {
|
if(s->u.s.texCoords[i].VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.texCoords[i].streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.texCoords[i].streamNo];
|
||||||
s->u.s.texCoords[i].VBO = 0;
|
s->u.s.texCoords[i].VBO = 0;
|
||||||
s->u.s.texCoords[i].lpData = (BYTE *) ((unsigned long) s->u.s.texCoords[i].lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.texCoords[i].lpData = (BYTE *) ((unsigned long) s->u.s.texCoords[i].lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(s->u.s.position2.VBO) {
|
if(s->u.s.position2.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.position2.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.position2.streamNo];
|
||||||
s->u.s.position2.VBO = 0;
|
s->u.s.position2.VBO = 0;
|
||||||
s->u.s.position2.lpData = (BYTE *) ((unsigned long) s->u.s.position2.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.position2.lpData = (BYTE *) ((unsigned long) s->u.s.position2.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.normal2.VBO) {
|
if(s->u.s.normal2.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.normal2.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.normal2.streamNo];
|
||||||
s->u.s.normal2.VBO = 0;
|
s->u.s.normal2.VBO = 0;
|
||||||
s->u.s.normal2.lpData = (BYTE *) ((unsigned long) s->u.s.normal2.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.normal2.lpData = (BYTE *) ((unsigned long) s->u.s.normal2.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.tangent.VBO) {
|
if(s->u.s.tangent.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.tangent.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.tangent.streamNo];
|
||||||
s->u.s.tangent.VBO = 0;
|
s->u.s.tangent.VBO = 0;
|
||||||
s->u.s.tangent.lpData = (BYTE *) ((unsigned long) s->u.s.tangent.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.tangent.lpData = (BYTE *) ((unsigned long) s->u.s.tangent.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.binormal.VBO) {
|
if(s->u.s.binormal.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.binormal.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.binormal.streamNo];
|
||||||
s->u.s.binormal.VBO = 0;
|
s->u.s.binormal.VBO = 0;
|
||||||
s->u.s.binormal.lpData = (BYTE *) ((unsigned long) s->u.s.binormal.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.binormal.lpData = (BYTE *) ((unsigned long) s->u.s.binormal.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.tessFactor.VBO) {
|
if(s->u.s.tessFactor.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.tessFactor.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.tessFactor.streamNo];
|
||||||
s->u.s.tessFactor.VBO = 0;
|
s->u.s.tessFactor.VBO = 0;
|
||||||
s->u.s.tessFactor.lpData = (BYTE *) ((unsigned long) s->u.s.tessFactor.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.tessFactor.lpData = (BYTE *) ((unsigned long) s->u.s.tessFactor.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.fog.VBO) {
|
if(s->u.s.fog.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.fog.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.fog.streamNo];
|
||||||
s->u.s.fog.VBO = 0;
|
s->u.s.fog.VBO = 0;
|
||||||
s->u.s.fog.lpData = (BYTE *) ((unsigned long) s->u.s.fog.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.fog.lpData = (BYTE *) ((unsigned long) s->u.s.fog.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.depth.VBO) {
|
if(s->u.s.depth.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.depth.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.depth.streamNo];
|
||||||
s->u.s.depth.VBO = 0;
|
s->u.s.depth.VBO = 0;
|
||||||
s->u.s.depth.lpData = (BYTE *) ((unsigned long) s->u.s.depth.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.depth.lpData = (BYTE *) ((unsigned long) s->u.s.depth.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
if(s->u.s.sample.VBO) {
|
if(s->u.s.sample.VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[s->u.s.sample.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.sample.streamNo];
|
||||||
s->u.s.sample.VBO = 0;
|
s->u.s.sample.VBO = 0;
|
||||||
s->u.s.sample.lpData = (BYTE *) ((unsigned long) s->u.s.sample.lpData + (unsigned long) vb->resource.allocatedMemory);
|
s->u.s.sample.lpData = (BYTE *) ((unsigned long) s->u.s.sample.lpData + (unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
|
@ -975,8 +975,8 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
|
||||||
memset(&strided, 0, sizeof(strided));
|
memset(&strided, 0, sizeof(strided));
|
||||||
primitiveDeclarationConvertToStridedData((IWineD3DDevice *) This, FALSE, &strided, NULL);
|
primitiveDeclarationConvertToStridedData((IWineD3DDevice *) This, FALSE, &strided, NULL);
|
||||||
if(strided.u.s.position.VBO) {
|
if(strided.u.s.position.VBO) {
|
||||||
IWineD3DVertexBufferImpl *vb;
|
struct wined3d_buffer *vb;
|
||||||
vb = (IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[strided.u.s.position.streamNo];
|
vb = (struct wined3d_buffer *)This->stateBlock->streamSource[strided.u.s.position.streamNo];
|
||||||
strided.u.s.position.lpData = (BYTE *) ((unsigned long) strided.u.s.position.lpData +
|
strided.u.s.position.lpData = (BYTE *) ((unsigned long) strided.u.s.position.lpData +
|
||||||
(unsigned long) vb->resource.allocatedMemory);
|
(unsigned long) vb->resource.allocatedMemory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3842,7 +3842,7 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
|
||||||
GLint curVBO = GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT) ? -1 : 0;
|
GLint curVBO = GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT) ? -1 : 0;
|
||||||
int i;
|
int i;
|
||||||
const UINT *offset = stateblock->streamOffset;
|
const UINT *offset = stateblock->streamOffset;
|
||||||
IWineD3DVertexBufferImpl *vb;
|
struct wined3d_buffer *vb;
|
||||||
DWORD_PTR shift_index;
|
DWORD_PTR shift_index;
|
||||||
|
|
||||||
/* Default to no instancing */
|
/* Default to no instancing */
|
||||||
|
@ -3870,27 +3870,28 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
|
||||||
checkGLcall("glBindBufferARB");
|
checkGLcall("glBindBufferARB");
|
||||||
curVBO = strided->u.input[i].VBO;
|
curVBO = strided->u.input[i].VBO;
|
||||||
}
|
}
|
||||||
vb = (IWineD3DVertexBufferImpl *) stateblock->streamSource[strided->u.input[i].streamNo];
|
vb = (struct wined3d_buffer *)stateblock->streamSource[strided->u.input[i].streamNo];
|
||||||
/* Use the VBO to find out if a vertex buffer exists, not the vb pointer. vb can point to a
|
/* Use the VBO to find out if a vertex buffer exists, not the vb pointer. vb can point to a
|
||||||
* user pointer data blob. In that case curVBO will be 0. If there is a vertex buffer but no
|
* user pointer data blob. In that case curVBO will be 0. If there is a vertex buffer but no
|
||||||
* vbo we won't be load converted attributes anyway
|
* vbo we won't be load converted attributes anyway
|
||||||
*/
|
*/
|
||||||
if(curVBO && vb->conv_shift) {
|
if (curVBO && vb->conversion_shift)
|
||||||
|
{
|
||||||
TRACE("Loading attribute from shifted buffer\n");
|
TRACE("Loading attribute from shifted buffer\n");
|
||||||
TRACE("Attrib %d has original stride %d, new stride %d\n", i, strided->u.input[i].dwStride, vb->conv_stride);
|
TRACE("Attrib %d has original stride %d, new stride %d\n",
|
||||||
TRACE("Original offset %p, additional offset 0x%08x\n",strided->u.input[i].lpData, vb->conv_shift[(DWORD_PTR) strided->u.input[i].lpData]);
|
i, strided->u.input[i].dwStride, vb->conversion_stride);
|
||||||
|
TRACE("Original offset %p, additional offset 0x%08x\n",
|
||||||
|
strided->u.input[i].lpData, vb->conversion_shift[(DWORD_PTR) strided->u.input[i].lpData]);
|
||||||
TRACE("Opengl type %x\n", WINED3D_ATR_GLTYPE(strided->u.input[i].dwType));
|
TRACE("Opengl type %x\n", WINED3D_ATR_GLTYPE(strided->u.input[i].dwType));
|
||||||
shift_index = ((DWORD_PTR) strided->u.input[i].lpData + offset[strided->u.input[i].streamNo]);
|
shift_index = ((DWORD_PTR) strided->u.input[i].lpData + offset[strided->u.input[i].streamNo]);
|
||||||
shift_index = shift_index % strided->u.input[i].dwStride;
|
shift_index = shift_index % strided->u.input[i].dwStride;
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(i,
|
GL_EXTCALL(glVertexAttribPointerARB(i, WINED3D_ATR_FORMAT(strided->u.input[i].dwType),
|
||||||
WINED3D_ATR_FORMAT(strided->u.input[i].dwType),
|
WINED3D_ATR_GLTYPE(strided->u.input[i].dwType),
|
||||||
WINED3D_ATR_GLTYPE(strided->u.input[i].dwType),
|
WINED3D_ATR_NORMALIZED(strided->u.input[i].dwType),
|
||||||
WINED3D_ATR_NORMALIZED(strided->u.input[i].dwType),
|
vb->conversion_stride,
|
||||||
vb->conv_stride,
|
strided->u.input[i].lpData + vb->conversion_shift[shift_index]
|
||||||
|
+ stateblock->loadBaseVertexIndex * strided->u.input[i].dwStride
|
||||||
strided->u.input[i].lpData + vb->conv_shift[shift_index] +
|
+ offset[strided->u.input[i].streamNo]));
|
||||||
stateblock->loadBaseVertexIndex * strided->u.input[i].dwStride +
|
|
||||||
offset[strided->u.input[i].streamNo]));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
GL_EXTCALL(glVertexAttribPointerARB(i,
|
GL_EXTCALL(glVertexAttribPointerARB(i,
|
||||||
|
@ -3915,7 +3916,7 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
|
||||||
*/
|
*/
|
||||||
const BYTE *ptr = strided->u.input[i].lpData + offset[strided->u.input[i].streamNo];
|
const BYTE *ptr = strided->u.input[i].lpData + offset[strided->u.input[i].streamNo];
|
||||||
if(strided->u.input[i].VBO) {
|
if(strided->u.input[i].VBO) {
|
||||||
vb = (IWineD3DVertexBufferImpl *) stateblock->streamSource[strided->u.input[i].streamNo];
|
vb = (struct wined3d_buffer *)stateblock->streamSource[strided->u.input[i].streamNo];
|
||||||
ptr += (long) vb->resource.allocatedMemory;
|
ptr += (long) vb->resource.allocatedMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ void stateblock_copy(
|
||||||
|
|
||||||
memcpy(Dest->streamStride, This->streamStride, sizeof(UINT) * MAX_STREAMS);
|
memcpy(Dest->streamStride, This->streamStride, sizeof(UINT) * MAX_STREAMS);
|
||||||
memcpy(Dest->streamOffset, This->streamOffset, sizeof(UINT) * MAX_STREAMS);
|
memcpy(Dest->streamOffset, This->streamOffset, sizeof(UINT) * MAX_STREAMS);
|
||||||
memcpy(Dest->streamSource, This->streamSource, sizeof(IWineD3DVertexBuffer*) * MAX_STREAMS);
|
memcpy(Dest->streamSource, This->streamSource, sizeof(IWineD3DBuffer *) * MAX_STREAMS);
|
||||||
memcpy(Dest->streamFreq, This->streamFreq, sizeof(UINT) * MAX_STREAMS);
|
memcpy(Dest->streamFreq, This->streamFreq, sizeof(UINT) * MAX_STREAMS);
|
||||||
memcpy(Dest->streamFlags, This->streamFlags, sizeof(UINT) * MAX_STREAMS);
|
memcpy(Dest->streamFlags, This->streamFlags, sizeof(UINT) * MAX_STREAMS);
|
||||||
memcpy(Dest->transforms, This->transforms, sizeof(WINED3DMATRIX) * (HIGHEST_TRANSFORMSTATE + 1));
|
memcpy(Dest->transforms, This->transforms, sizeof(WINED3DMATRIX) * (HIGHEST_TRANSFORMSTATE + 1));
|
||||||
|
@ -295,7 +295,8 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
|
||||||
|
|
||||||
for (counter = 0; counter < MAX_STREAMS; counter++) {
|
for (counter = 0; counter < MAX_STREAMS; counter++) {
|
||||||
if(This->streamSource[counter]) {
|
if(This->streamSource[counter]) {
|
||||||
if(0 != IWineD3DVertexBuffer_Release(This->streamSource[counter])) {
|
if (IWineD3DBuffer_Release(This->streamSource[counter]))
|
||||||
|
{
|
||||||
TRACE("Vertex buffer still referenced by stateblock, applications has leaked Stream %u, buffer %p\n", counter, This->streamSource[counter]);
|
TRACE("Vertex buffer still referenced by stateblock, applications has leaked Stream %u, buffer %p\n", counter, This->streamSource[counter]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -553,8 +554,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||||
TRACE("Updating stream source %u to %p, stride to %u\n",
|
TRACE("Updating stream source %u to %p, stride to %u\n",
|
||||||
i, targetStateBlock->streamSource[i], targetStateBlock->streamStride[i]);
|
i, targetStateBlock->streamSource[i], targetStateBlock->streamStride[i]);
|
||||||
This->streamStride[i] = targetStateBlock->streamStride[i];
|
This->streamStride[i] = targetStateBlock->streamStride[i];
|
||||||
if(targetStateBlock->streamSource[i]) IWineD3DVertexBuffer_AddRef(targetStateBlock->streamSource[i]);
|
if (targetStateBlock->streamSource[i]) IWineD3DBuffer_AddRef(targetStateBlock->streamSource[i]);
|
||||||
if(This->streamSource[i]) IWineD3DVertexBuffer_Release(This->streamSource[i]);
|
if (This->streamSource[i]) IWineD3DBuffer_Release(This->streamSource[i]);
|
||||||
This->streamSource[i] = targetStateBlock->streamSource[i];
|
This->streamSource[i] = targetStateBlock->streamSource[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -655,14 +656,14 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||||
This->scissorRect = targetStateBlock->scissorRect;
|
This->scissorRect = targetStateBlock->scissorRect;
|
||||||
|
|
||||||
if(targetStateBlock->pIndexData != This->pIndexData) {
|
if(targetStateBlock->pIndexData != This->pIndexData) {
|
||||||
if(targetStateBlock->pIndexData) IWineD3DIndexBuffer_AddRef(targetStateBlock->pIndexData);
|
if (targetStateBlock->pIndexData) IWineD3DIndexBuffer_AddRef(targetStateBlock->pIndexData);
|
||||||
if(This->pIndexData) IWineD3DIndexBuffer_Release(This->pIndexData);
|
if (This->pIndexData) IWineD3DIndexBuffer_Release(This->pIndexData);
|
||||||
This->pIndexData = targetStateBlock->pIndexData;
|
This->pIndexData = targetStateBlock->pIndexData;
|
||||||
}
|
}
|
||||||
for(i = 0; i < MAX_STREAMS; i++) {
|
for(i = 0; i < MAX_STREAMS; i++) {
|
||||||
if(targetStateBlock->streamSource[i] != This->streamSource[i]) {
|
if(targetStateBlock->streamSource[i] != This->streamSource[i]) {
|
||||||
if(targetStateBlock->streamSource[i]) IWineD3DVertexBuffer_AddRef(targetStateBlock->streamSource[i]);
|
if(targetStateBlock->streamSource[i]) IWineD3DBuffer_AddRef(targetStateBlock->streamSource[i]);
|
||||||
if(This->streamSource[i]) IWineD3DVertexBuffer_Release(This->streamSource[i]);
|
if(This->streamSource[i]) IWineD3DBuffer_Release(This->streamSource[i]);
|
||||||
This->streamSource[i] = targetStateBlock->streamSource[i];
|
This->streamSource[i] = targetStateBlock->streamSource[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -696,8 +697,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||||
}
|
}
|
||||||
for(i = 0; i < MAX_STREAMS; i++) {
|
for(i = 0; i < MAX_STREAMS; i++) {
|
||||||
if(targetStateBlock->streamSource[i] != This->streamSource[i]) {
|
if(targetStateBlock->streamSource[i] != This->streamSource[i]) {
|
||||||
if(targetStateBlock->streamSource[i]) IWineD3DVertexBuffer_AddRef(targetStateBlock->streamSource[i]);
|
if (targetStateBlock->streamSource[i]) IWineD3DBuffer_AddRef(targetStateBlock->streamSource[i]);
|
||||||
if(This->streamSource[i]) IWineD3DVertexBuffer_Release(This->streamSource[i]);
|
if (This->streamSource[i]) IWineD3DBuffer_Release(This->streamSource[i]);
|
||||||
This->streamSource[i] = targetStateBlock->streamSource[i];
|
This->streamSource[i] = targetStateBlock->streamSource[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1259,56 +1259,6 @@ HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID guid,
|
||||||
/* Tests show that the start address of resources is 32 byte aligned */
|
/* Tests show that the start address of resources is 32 byte aligned */
|
||||||
#define RESOURCE_ALIGNMENT 32
|
#define RESOURCE_ALIGNMENT 32
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* IWineD3DVertexBuffer implementation structure (extends IWineD3DResourceImpl)
|
|
||||||
*/
|
|
||||||
enum vbo_conversion_type {
|
|
||||||
CONV_NONE = 0,
|
|
||||||
CONV_D3DCOLOR = 1,
|
|
||||||
CONV_POSITIONT = 2,
|
|
||||||
CONV_FLOAT16_2 = 3 /* Also handles FLOAT16_4 */
|
|
||||||
|
|
||||||
/* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other
|
|
||||||
* fixed function semantics as D3DCOLOR or FLOAT16
|
|
||||||
*/
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct IWineD3DVertexBufferImpl
|
|
||||||
{
|
|
||||||
/* IUnknown & WineD3DResource Information */
|
|
||||||
const IWineD3DVertexBufferVtbl *lpVtbl;
|
|
||||||
IWineD3DResourceClass resource;
|
|
||||||
|
|
||||||
/* WineD3DVertexBuffer specifics */
|
|
||||||
DWORD fvf;
|
|
||||||
|
|
||||||
/* Vertex buffer object support */
|
|
||||||
GLuint vbo;
|
|
||||||
BYTE Flags;
|
|
||||||
LONG bindCount;
|
|
||||||
LONG vbo_size;
|
|
||||||
GLenum vbo_usage;
|
|
||||||
|
|
||||||
UINT dirtystart, dirtyend;
|
|
||||||
LONG lockcount;
|
|
||||||
|
|
||||||
LONG declChanges, draws;
|
|
||||||
/* Last description of the buffer */
|
|
||||||
DWORD stride; /* 0 if no conversion */
|
|
||||||
enum vbo_conversion_type *conv_map; /* NULL if no conversion */
|
|
||||||
|
|
||||||
/* Extra load offsets, for FLOAT16 conversion */
|
|
||||||
DWORD *conv_shift; /* NULL if no shifted conversion */
|
|
||||||
DWORD conv_stride; /* 0 if no shifted conversion */
|
|
||||||
} IWineD3DVertexBufferImpl;
|
|
||||||
|
|
||||||
extern const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
|
|
||||||
|
|
||||||
#define VBFLAG_OPTIMIZED 0x01 /* Optimize has been called for the VB */
|
|
||||||
#define VBFLAG_DIRTY 0x02 /* Buffer data has been modified */
|
|
||||||
#define VBFLAG_HASDESC 0x04 /* A vertex description has been found */
|
|
||||||
#define VBFLAG_CREATEVBO 0x08 /* Attempt to create a VBO next PreLoad */
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
|
* IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
|
||||||
*/
|
*/
|
||||||
|
@ -1843,7 +1793,7 @@ struct IWineD3DStateBlockImpl
|
||||||
BOOL streamIsUP;
|
BOOL streamIsUP;
|
||||||
UINT streamStride[MAX_STREAMS];
|
UINT streamStride[MAX_STREAMS];
|
||||||
UINT streamOffset[MAX_STREAMS + 1 /* tesselated pseudo-stream */ ];
|
UINT streamOffset[MAX_STREAMS + 1 /* tesselated pseudo-stream */ ];
|
||||||
IWineD3DVertexBuffer *streamSource[MAX_STREAMS];
|
IWineD3DBuffer *streamSource[MAX_STREAMS];
|
||||||
UINT streamFreq[MAX_STREAMS + 1];
|
UINT streamFreq[MAX_STREAMS + 1];
|
||||||
UINT streamFlags[MAX_STREAMS + 1]; /*0 | WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA */
|
UINT streamFlags[MAX_STREAMS + 1]; /*0 | WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA */
|
||||||
|
|
||||||
|
@ -1978,15 +1928,54 @@ typedef struct WineQueryEventData {
|
||||||
} WineQueryEventData;
|
} WineQueryEventData;
|
||||||
|
|
||||||
/* IWineD3DBuffer */
|
/* IWineD3DBuffer */
|
||||||
|
|
||||||
|
/* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other
|
||||||
|
* fixed function semantics as D3DCOLOR or FLOAT16 */
|
||||||
|
enum wined3d_buffer_conversion_type
|
||||||
|
{
|
||||||
|
CONV_NONE,
|
||||||
|
CONV_D3DCOLOR,
|
||||||
|
CONV_POSITIONT,
|
||||||
|
CONV_FLOAT16_2, /* Also handles FLOAT16_4 */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define WINED3D_BUFFER_OPTIMIZED 0x01 /* Optimize has been called for the buffer */
|
||||||
|
#define WINED3D_BUFFER_DIRTY 0x02 /* Buffer data has been modified */
|
||||||
|
#define WINED3D_BUFFER_HASDESC 0x04 /* A vertex description has been found */
|
||||||
|
#define WINED3D_BUFFER_CREATEBO 0x08 /* Attempt to create a buffer object next PreLoad */
|
||||||
|
|
||||||
struct wined3d_buffer
|
struct wined3d_buffer
|
||||||
{
|
{
|
||||||
const struct IWineD3DBufferVtbl *vtbl;
|
const struct IWineD3DBufferVtbl *vtbl;
|
||||||
IWineD3DResourceClass resource;
|
IWineD3DResourceClass resource;
|
||||||
|
|
||||||
struct wined3d_buffer_desc desc;
|
struct wined3d_buffer_desc desc;
|
||||||
|
|
||||||
|
GLuint buffer_object;
|
||||||
|
GLenum buffer_object_usage;
|
||||||
|
UINT buffer_object_size;
|
||||||
|
LONG bind_count;
|
||||||
|
DWORD flags;
|
||||||
|
|
||||||
|
UINT dirty_start;
|
||||||
|
UINT dirty_end;
|
||||||
|
LONG lock_count;
|
||||||
|
|
||||||
|
/* legacy vertex buffers */
|
||||||
|
DWORD fvf;
|
||||||
|
|
||||||
|
/* conversion stuff */
|
||||||
|
UINT conversion_count;
|
||||||
|
UINT draw_count;
|
||||||
|
UINT stride; /* 0 if no conversion */
|
||||||
|
UINT conversion_stride; /* 0 if no shifted conversion */
|
||||||
|
enum wined3d_buffer_conversion_type *conversion_map; /* NULL if no conversion */
|
||||||
|
/* Extra load offsets, for FLOAT16 conversion */
|
||||||
|
UINT *conversion_shift; /* NULL if no shifted conversion */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const IWineD3DBufferVtbl wined3d_buffer_vtbl;
|
extern const IWineD3DBufferVtbl wined3d_buffer_vtbl;
|
||||||
|
const BYTE *buffer_get_memory(IWineD3DBuffer *iface, UINT offset, GLuint *buffer_object);
|
||||||
|
|
||||||
/* IWineD3DRendertargetView */
|
/* IWineD3DRendertargetView */
|
||||||
struct wined3d_rendertarget_view
|
struct wined3d_rendertarget_view
|
||||||
|
@ -2109,15 +2098,6 @@ void multiply_matrix(WINED3DMATRIX *dest, const WINED3DMATRIX *src1, const WINED
|
||||||
unsigned int count_bits(unsigned int mask);
|
unsigned int count_bits(unsigned int mask);
|
||||||
UINT wined3d_log2i(UINT32 x);
|
UINT wined3d_log2i(UINT32 x);
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* To enable calling of inherited functions, requires prototypes
|
|
||||||
*
|
|
||||||
* Note: Only require classes which are subclassed, ie resource, basetexture,
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* IWineD3DVertexBuffer */
|
|
||||||
extern const BYTE *IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWORD iOffset, GLint *vbo);
|
|
||||||
|
|
||||||
/* TODO: Make this dynamic, based on shader limits ? */
|
/* TODO: Make this dynamic, based on shader limits ? */
|
||||||
#define MAX_REG_ADDR 1
|
#define MAX_REG_ADDR 1
|
||||||
#define MAX_REG_TEMP 32
|
#define MAX_REG_TEMP 32
|
||||||
|
|
|
@ -2410,26 +2410,6 @@ interface IWineD3DRendertargetView : IWineD3DBase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[
|
|
||||||
object,
|
|
||||||
local,
|
|
||||||
uuid(217f671e-6f30-11d9-c687-00046142c14f)
|
|
||||||
]
|
|
||||||
interface IWineD3DVertexBuffer : IWineD3DResource
|
|
||||||
{
|
|
||||||
HRESULT Lock(
|
|
||||||
[in] UINT offset,
|
|
||||||
[in] UINT size,
|
|
||||||
[out] BYTE **data,
|
|
||||||
[in] DWORD flags
|
|
||||||
);
|
|
||||||
HRESULT Unlock(
|
|
||||||
);
|
|
||||||
HRESULT GetDesc(
|
|
||||||
[out] WINED3DVERTEXBUFFER_DESC *desc
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
[
|
[
|
||||||
object,
|
object,
|
||||||
local,
|
local,
|
||||||
|
@ -2923,6 +2903,17 @@ interface IWineD3DSwapChain : IWineD3DBase
|
||||||
]
|
]
|
||||||
interface IWineD3DBuffer : IWineD3DResource
|
interface IWineD3DBuffer : IWineD3DResource
|
||||||
{
|
{
|
||||||
|
HRESULT Map(
|
||||||
|
[in] UINT offset,
|
||||||
|
[in] UINT size,
|
||||||
|
[out] BYTE **data,
|
||||||
|
[in] DWORD flags
|
||||||
|
);
|
||||||
|
HRESULT Unmap(
|
||||||
|
);
|
||||||
|
HRESULT GetDesc(
|
||||||
|
[out] WINED3DVERTEXBUFFER_DESC *desc
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[
|
[
|
||||||
|
@ -2994,7 +2985,7 @@ interface IWineD3DDevice : IWineD3DBase
|
||||||
[in] DWORD usage,
|
[in] DWORD usage,
|
||||||
[in] DWORD fvf,
|
[in] DWORD fvf,
|
||||||
[in] WINED3DPOOL pool,
|
[in] WINED3DPOOL pool,
|
||||||
[out] IWineD3DVertexBuffer **vertex_buffer,
|
[out] IWineD3DBuffer **vertex_buffer,
|
||||||
[in] HANDLE *shared_handle,
|
[in] HANDLE *shared_handle,
|
||||||
[in] IUnknown *parent
|
[in] IUnknown *parent
|
||||||
);
|
);
|
||||||
|
@ -3351,13 +3342,13 @@ interface IWineD3DDevice : IWineD3DBase
|
||||||
);
|
);
|
||||||
HRESULT SetStreamSource(
|
HRESULT SetStreamSource(
|
||||||
[in] UINT stream_idx,
|
[in] UINT stream_idx,
|
||||||
[in] IWineD3DVertexBuffer *vertex_buffer,
|
[in] IWineD3DBuffer *buffer,
|
||||||
[in] UINT offset,
|
[in] UINT offset,
|
||||||
[in] UINT stride
|
[in] UINT stride
|
||||||
);
|
);
|
||||||
HRESULT GetStreamSource(
|
HRESULT GetStreamSource(
|
||||||
[in] UINT stream_idx,
|
[in] UINT stream_idx,
|
||||||
[out] IWineD3DVertexBuffer **vertex_buffer,
|
[out] IWineD3DBuffer **buffer,
|
||||||
[out] UINT *offset,
|
[out] UINT *offset,
|
||||||
[out] UINT *stride
|
[out] UINT *stride
|
||||||
);
|
);
|
||||||
|
@ -3454,7 +3445,7 @@ interface IWineD3DDevice : IWineD3DBase
|
||||||
[in] UINT src_start_idx,
|
[in] UINT src_start_idx,
|
||||||
[in] UINT dst_idx,
|
[in] UINT dst_idx,
|
||||||
[in] UINT vertex_count,
|
[in] UINT vertex_count,
|
||||||
[in] IWineD3DVertexBuffer *dest_buffer,
|
[in] IWineD3DBuffer *dest_buffer,
|
||||||
[in] IWineD3DVertexDeclaration *declaration,
|
[in] IWineD3DVertexDeclaration *declaration,
|
||||||
[in] DWORD flags
|
[in] DWORD flags
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue