diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index d1edac45b41..c547da46443 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -2242,7 +2242,6 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *ifac { IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IWineD3DPixelShader *object; - HRESULT hr; TRACE("iface %p, shader %p.\n", iface, ppShader); @@ -2252,8 +2251,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *ifac } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object); - if (SUCCEEDED(hr) && object) + object = IWineD3DDevice_GetPixelShader(This->WineD3DDevice); + if (object) { IDirect3DPixelShader8Impl *d3d8_shader; d3d8_shader = IWineD3DPixelShader_GetParent(object); @@ -2268,13 +2267,13 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *ifac TRACE("(%p) : returning %#x\n", This, *ppShader); - return hr; + return D3D_OK; } static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) { IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IDirect3DPixelShader8Impl *shader; - IWineD3DPixelShader *cur = NULL; + IWineD3DPixelShader *cur; TRACE("iface %p, shader %#x.\n", iface, pShader); @@ -2288,8 +2287,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 i return D3DERR_INVALIDCALL; } - IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &cur); - + cur = IWineD3DDevice_GetPixelShader(This->WineD3DDevice); if (cur) { if (cur == shader->wineD3DPixelShader) IDirect3DDevice8_SetPixelShader(iface, 0); diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 5b03a9f1e1c..af9cc4880ce 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2513,36 +2513,28 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *if IDirect3DPixelShader9 **shader) { IWineD3DPixelShader *wined3d_shader; - HRESULT hr; TRACE("iface %p, shader %p.\n", iface, shader); if (!shader) return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPixelShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, &wined3d_shader); - if (SUCCEEDED(hr)) + wined3d_shader = IWineD3DDevice_GetPixelShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice); + if (wined3d_shader) { - if (wined3d_shader) - { - *shader = IWineD3DPixelShader_GetParent(wined3d_shader); - IDirect3DPixelShader9_AddRef(*shader); - IWineD3DPixelShader_Release(wined3d_shader); - } - else - { - *shader = NULL; - } + *shader = IWineD3DPixelShader_GetParent(wined3d_shader); + IDirect3DPixelShader9_AddRef(*shader); + IWineD3DPixelShader_Release(wined3d_shader); } else { - WARN("Failed to get pixel shader, hr %#x.\n", hr); + *shader = NULL; } wined3d_mutex_unlock(); TRACE("Returning %p.\n", *shader); - return hr; + return D3D_OK; } static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(IDirect3DDevice9Ex *iface, diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 2197a5f30b9..5529ad75203 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3604,20 +3604,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, I return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3DDevice *iface, IWineD3DPixelShader **ppShader) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +static IWineD3DPixelShader * WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3DDevice *iface) +{ + IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; + IWineD3DPixelShader *shader; - if (NULL == ppShader) { - WARN("(%p) : PShader is NULL, returning INVALIDCALL\n", This); - return WINED3DERR_INVALIDCALL; - } + TRACE("iface %p.\n", iface); - *ppShader = This->stateBlock->pixelShader; - if (NULL != *ppShader) { - IWineD3DPixelShader_AddRef(*ppShader); - } - TRACE("(%p) : returning %p\n", This, *ppShader); - return WINED3D_OK; + shader = device->stateBlock->pixelShader; + if (shader) IWineD3DPixelShader_AddRef(shader); + + TRACE("Returning %p.\n", shader); + return shader; } static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB( diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl index 0b29432b0c1..942ecdc830b 100644 --- a/include/wine/wined3d.idl +++ b/include/wine/wined3d.idl @@ -3091,8 +3091,7 @@ interface IWineD3DDevice : IUnknown HRESULT SetPixelShader( [in] IWineD3DPixelShader *shader ); - HRESULT GetPixelShader( - [out] IWineD3DPixelShader **shader + IWineD3DPixelShader *GetPixelShader( ); HRESULT SetPixelShaderConstantB( [in] UINT start_register,