wined3d: Getting the current pixel shader should never fail.

This commit is contained in:
Henri Verbeet 2010-09-06 22:18:56 +02:00 committed by Alexandre Julliard
parent 0c54dfe7ba
commit 07b5c4becf
4 changed files with 23 additions and 36 deletions

View File

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

View File

@ -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,

View File

@ -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(

View File

@ -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,