wined3d: Getting the current pixel shader should never fail.
This commit is contained in:
parent
0c54dfe7ba
commit
07b5c4becf
|
@ -2242,7 +2242,6 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *ifac
|
||||||
{
|
{
|
||||||
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
|
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
|
||||||
IWineD3DPixelShader *object;
|
IWineD3DPixelShader *object;
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
TRACE("iface %p, shader %p.\n", iface, ppShader);
|
TRACE("iface %p, shader %p.\n", iface, ppShader);
|
||||||
|
|
||||||
|
@ -2252,8 +2251,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *ifac
|
||||||
}
|
}
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object);
|
object = IWineD3DDevice_GetPixelShader(This->WineD3DDevice);
|
||||||
if (SUCCEEDED(hr) && object)
|
if (object)
|
||||||
{
|
{
|
||||||
IDirect3DPixelShader8Impl *d3d8_shader;
|
IDirect3DPixelShader8Impl *d3d8_shader;
|
||||||
d3d8_shader = IWineD3DPixelShader_GetParent(object);
|
d3d8_shader = IWineD3DPixelShader_GetParent(object);
|
||||||
|
@ -2268,13 +2267,13 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *ifac
|
||||||
|
|
||||||
TRACE("(%p) : returning %#x\n", This, *ppShader);
|
TRACE("(%p) : returning %#x\n", This, *ppShader);
|
||||||
|
|
||||||
return hr;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) {
|
static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) {
|
||||||
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
|
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
|
||||||
IDirect3DPixelShader8Impl *shader;
|
IDirect3DPixelShader8Impl *shader;
|
||||||
IWineD3DPixelShader *cur = NULL;
|
IWineD3DPixelShader *cur;
|
||||||
|
|
||||||
TRACE("iface %p, shader %#x.\n", iface, pShader);
|
TRACE("iface %p, shader %#x.\n", iface, pShader);
|
||||||
|
|
||||||
|
@ -2288,8 +2287,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 i
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &cur);
|
cur = IWineD3DDevice_GetPixelShader(This->WineD3DDevice);
|
||||||
|
|
||||||
if (cur)
|
if (cur)
|
||||||
{
|
{
|
||||||
if (cur == shader->wineD3DPixelShader) IDirect3DDevice8_SetPixelShader(iface, 0);
|
if (cur == shader->wineD3DPixelShader) IDirect3DDevice8_SetPixelShader(iface, 0);
|
||||||
|
|
|
@ -2513,36 +2513,28 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *if
|
||||||
IDirect3DPixelShader9 **shader)
|
IDirect3DPixelShader9 **shader)
|
||||||
{
|
{
|
||||||
IWineD3DPixelShader *wined3d_shader;
|
IWineD3DPixelShader *wined3d_shader;
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
TRACE("iface %p, shader %p.\n", iface, shader);
|
TRACE("iface %p, shader %p.\n", iface, shader);
|
||||||
|
|
||||||
if (!shader) return D3DERR_INVALIDCALL;
|
if (!shader) return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = IWineD3DDevice_GetPixelShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, &wined3d_shader);
|
wined3d_shader = IWineD3DDevice_GetPixelShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice);
|
||||||
if (SUCCEEDED(hr))
|
if (wined3d_shader)
|
||||||
{
|
{
|
||||||
if (wined3d_shader)
|
*shader = IWineD3DPixelShader_GetParent(wined3d_shader);
|
||||||
{
|
IDirect3DPixelShader9_AddRef(*shader);
|
||||||
*shader = IWineD3DPixelShader_GetParent(wined3d_shader);
|
IWineD3DPixelShader_Release(wined3d_shader);
|
||||||
IDirect3DPixelShader9_AddRef(*shader);
|
|
||||||
IWineD3DPixelShader_Release(wined3d_shader);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*shader = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WARN("Failed to get pixel shader, hr %#x.\n", hr);
|
*shader = NULL;
|
||||||
}
|
}
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
TRACE("Returning %p.\n", *shader);
|
TRACE("Returning %p.\n", *shader);
|
||||||
|
|
||||||
return hr;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(IDirect3DDevice9Ex *iface,
|
static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(IDirect3DDevice9Ex *iface,
|
||||||
|
|
|
@ -3604,20 +3604,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, I
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3DDevice *iface, IWineD3DPixelShader **ppShader) {
|
static IWineD3DPixelShader * WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3DDevice *iface)
|
||||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
{
|
||||||
|
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
|
||||||
|
IWineD3DPixelShader *shader;
|
||||||
|
|
||||||
if (NULL == ppShader) {
|
TRACE("iface %p.\n", iface);
|
||||||
WARN("(%p) : PShader is NULL, returning INVALIDCALL\n", This);
|
|
||||||
return WINED3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ppShader = This->stateBlock->pixelShader;
|
shader = device->stateBlock->pixelShader;
|
||||||
if (NULL != *ppShader) {
|
if (shader) IWineD3DPixelShader_AddRef(shader);
|
||||||
IWineD3DPixelShader_AddRef(*ppShader);
|
|
||||||
}
|
TRACE("Returning %p.\n", shader);
|
||||||
TRACE("(%p) : returning %p\n", This, *ppShader);
|
return shader;
|
||||||
return WINED3D_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB(
|
static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB(
|
||||||
|
|
|
@ -3091,8 +3091,7 @@ interface IWineD3DDevice : IUnknown
|
||||||
HRESULT SetPixelShader(
|
HRESULT SetPixelShader(
|
||||||
[in] IWineD3DPixelShader *shader
|
[in] IWineD3DPixelShader *shader
|
||||||
);
|
);
|
||||||
HRESULT GetPixelShader(
|
IWineD3DPixelShader *GetPixelShader(
|
||||||
[out] IWineD3DPixelShader **shader
|
|
||||||
);
|
);
|
||||||
HRESULT SetPixelShaderConstantB(
|
HRESULT SetPixelShaderConstantB(
|
||||||
[in] UINT start_register,
|
[in] UINT start_register,
|
||||||
|
|
Loading…
Reference in New Issue