d3d9: Use separate codepaths for failure and NULL return values in GetVertexShader() / GetPixelShader().

This commit is contained in:
Henri Verbeet 2008-12-29 16:31:22 +01:00 committed by Alexandre Julliard
parent 6f5af4047f
commit 8da71ca6a6
2 changed files with 29 additions and 10 deletions

View File

@ -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);

View File

@ -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);