Commit 8da71ca6 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d9: Use separate codepaths for failure and NULL return values in…

d3d9: Use separate codepaths for failure and NULL return values in GetVertexShader() / GetPixelShader().
parent 6f5af404
......@@ -170,11 +170,21 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, ID
EnterCriticalSection(&d3d9_cs);
hrc = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object);
if (hrc == D3D_OK && object != NULL) {
hrc = IWineD3DPixelShader_GetParent(object, (IUnknown **)ppShader);
IWineD3DPixelShader_Release(object);
} else {
*ppShader = NULL;
if (SUCCEEDED(hrc))
{
if (object)
{
hrc = IWineD3DPixelShader_GetParent(object, (IUnknown **)ppShader);
IWineD3DPixelShader_Release(object);
}
else
{
*ppShader = NULL;
}
}
else
{
WARN("(%p) : Call to IWineD3DDevice_GetPixelShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice);
}
LeaveCriticalSection(&d3d9_cs);
......
......@@ -166,11 +166,20 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, I
TRACE("(%p) : Relay device@%p\n", This, This->WineD3DDevice);
EnterCriticalSection(&d3d9_cs);
hrc = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader);
if(hrc == D3D_OK && pShader != NULL){
hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)ppShader);
IWineD3DVertexShader_Release(pShader);
} else {
*ppShader = NULL;
if (SUCCEEDED(hrc))
{
if (pShader)
{
hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)ppShader);
IWineD3DVertexShader_Release(pShader);
}
else
{
*ppShader = NULL;
}
}
else
{
WARN("(%p) : Call to IWineD3DDevice_GetVertexShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice);
}
LeaveCriticalSection(&d3d9_cs);
......
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