Commit e84158f5 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

d3d9: Hold the lock in VertexShader methods.

parent 57acd1d9
...@@ -56,7 +56,9 @@ static ULONG WINAPI IDirect3DVertexShader9Impl_Release(LPDIRECT3DVERTEXSHADER9 i ...@@ -56,7 +56,9 @@ static ULONG WINAPI IDirect3DVertexShader9Impl_Release(LPDIRECT3DVERTEXSHADER9 i
TRACE("(%p) : ReleaseRef to %d\n", This, ref); TRACE("(%p) : ReleaseRef to %d\n", This, ref);
if (ref == 0) { if (ref == 0) {
EnterCriticalSection(&d3d9_cs);
IWineD3DVertexShader_Release(This->wineD3DVertexShader); IWineD3DVertexShader_Release(This->wineD3DVertexShader);
LeaveCriticalSection(&d3d9_cs);
IUnknown_Release(This->parentDevice); IUnknown_Release(This->parentDevice);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
...@@ -70,21 +72,27 @@ static HRESULT WINAPI IDirect3DVertexShader9Impl_GetDevice(LPDIRECT3DVERTEXSHADE ...@@ -70,21 +72,27 @@ static HRESULT WINAPI IDirect3DVertexShader9Impl_GetDevice(LPDIRECT3DVERTEXSHADE
HRESULT hr = D3D_OK; HRESULT hr = D3D_OK;
TRACE("(%p) : Relay\n", This); TRACE("(%p) : Relay\n", This);
EnterCriticalSection(&d3d9_cs);
if (D3D_OK == (hr = IWineD3DVertexShader_GetDevice(This->wineD3DVertexShader, &myDevice) && myDevice != NULL)) { if (D3D_OK == (hr = IWineD3DVertexShader_GetDevice(This->wineD3DVertexShader, &myDevice) && myDevice != NULL)) {
hr = IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice); hr = IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
IWineD3DDevice_Release(myDevice); IWineD3DDevice_Release(myDevice);
} else { } else {
*ppDevice = NULL; *ppDevice = NULL;
} }
LeaveCriticalSection(&d3d9_cs);
TRACE("(%p) returning (%p)\n", This, *ppDevice); TRACE("(%p) returning (%p)\n", This, *ppDevice);
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DVertexShader9Impl_GetFunction(LPDIRECT3DVERTEXSHADER9 iface, VOID* pData, UINT* pSizeOfData) { static HRESULT WINAPI IDirect3DVertexShader9Impl_GetFunction(LPDIRECT3DVERTEXSHADER9 iface, VOID* pData, UINT* pSizeOfData) {
IDirect3DVertexShader9Impl *This = (IDirect3DVertexShader9Impl *)iface; IDirect3DVertexShader9Impl *This = (IDirect3DVertexShader9Impl *)iface;
HRESULT hr;
TRACE("(%p) : Relay\n", This); TRACE("(%p) : Relay\n", This);
return IWineD3DVertexShader_GetFunction(This->wineD3DVertexShader, pData, pSizeOfData);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVertexShader_GetFunction(This->wineD3DVertexShader, pData, pSizeOfData);
LeaveCriticalSection(&d3d9_cs);
return hr;
} }
...@@ -116,7 +124,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9 iface, ...@@ -116,7 +124,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9 iface,
object->ref = 1; object->ref = 1;
object->lpVtbl = &Direct3DVertexShader9_Vtbl; object->lpVtbl = &Direct3DVertexShader9_Vtbl;
EnterCriticalSection(&d3d9_cs);
hrc= IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, NULL /* declaration */, pFunction, &object->wineD3DVertexShader, (IUnknown *)object); hrc= IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, NULL /* declaration */, pFunction, &object->wineD3DVertexShader, (IUnknown *)object);
LeaveCriticalSection(&d3d9_cs);
if (FAILED(hrc)) { if (FAILED(hrc)) {
...@@ -139,7 +149,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9 iface, IDi ...@@ -139,7 +149,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9 iface, IDi
HRESULT hrc = D3D_OK; HRESULT hrc = D3D_OK;
TRACE("(%p) : Relay\n", This); TRACE("(%p) : Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hrc = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, pShader==NULL?NULL:((IDirect3DVertexShader9Impl *)pShader)->wineD3DVertexShader); hrc = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, pShader==NULL?NULL:((IDirect3DVertexShader9Impl *)pShader)->wineD3DVertexShader);
LeaveCriticalSection(&d3d9_cs);
TRACE("(%p) : returning hr(%u)\n", This, hrc); TRACE("(%p) : returning hr(%u)\n", This, hrc);
return hrc; return hrc;
...@@ -151,6 +163,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9 iface, IDi ...@@ -151,6 +163,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9 iface, IDi
HRESULT hrc = D3D_OK; HRESULT hrc = D3D_OK;
TRACE("(%p) : Relay device@%p\n", This, This->WineD3DDevice); TRACE("(%p) : Relay device@%p\n", This, This->WineD3DDevice);
EnterCriticalSection(&d3d9_cs);
hrc = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader); hrc = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader);
if(hrc == D3D_OK && pShader != NULL){ if(hrc == D3D_OK && pShader != NULL){
hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)ppShader); hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)ppShader);
...@@ -158,42 +171,73 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9 iface, IDi ...@@ -158,42 +171,73 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9 iface, IDi
} else { } else {
WARN("(%p) : Call to IWineD3DDevice_GetVertexShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice); WARN("(%p) : Call to IWineD3DDevice_GetVertexShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice);
} }
LeaveCriticalSection(&d3d9_cs);
TRACE("(%p) : returning %p\n", This, *ppShader); TRACE("(%p) : returning %p\n", This, *ppShader);
return hrc; return hrc;
} }
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) { HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr;
TRACE("(%p) : Relay\n", This); TRACE("(%p) : Relay\n", This);
return IWineD3DDevice_SetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_SetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount);
LeaveCriticalSection(&d3d9_cs);
return hr;
} }
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, float* pConstantData, UINT Vector4fCount) { HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, float* pConstantData, UINT Vector4fCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr;
TRACE("(%p) : Relay\n", This); TRACE("(%p) : Relay\n", This);
return IWineD3DDevice_GetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount); EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_GetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount);
LeaveCriticalSection(&d3d9_cs);
return hr;
} }
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, CONST int* pConstantData, UINT Vector4iCount) { HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, CONST int* pConstantData, UINT Vector4iCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr;
TRACE("(%p) : Relay\n", This); TRACE("(%p) : Relay\n", This);
return IWineD3DDevice_SetVertexShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_SetVertexShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount);
LeaveCriticalSection(&d3d9_cs);
return hr;
} }
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, int* pConstantData, UINT Vector4iCount) { HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, int* pConstantData, UINT Vector4iCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr;
TRACE("(%p) : Relay\n", This); TRACE("(%p) : Relay\n", This);
return IWineD3DDevice_GetVertexShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_GetVertexShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount);
LeaveCriticalSection(&d3d9_cs);
return hr;
} }
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT Register, CONST BOOL* pConstantData, UINT BoolCount) { HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT Register, CONST BOOL* pConstantData, UINT BoolCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr;
TRACE("(%p) : Relay\n", This); TRACE("(%p) : Relay\n", This);
return IWineD3DDevice_SetVertexShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_SetVertexShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount);
LeaveCriticalSection(&d3d9_cs);
return hr;
} }
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT Register, BOOL* pConstantData, UINT BoolCount) { HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT Register, BOOL* pConstantData, UINT BoolCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr;
TRACE("(%p) : Relay\n", This); TRACE("(%p) : Relay\n", This);
return IWineD3DDevice_GetVertexShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_GetVertexShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount);
LeaveCriticalSection(&d3d9_cs);
return hr;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment