wined3d: Just return the shader from wined3d_device_get_pixel_shader().

This commit is contained in:
Henri Verbeet 2012-09-25 10:34:43 +02:00 committed by Alexandre Julliard
parent fc711d4955
commit 6e4c40689c
3 changed files with 4 additions and 19 deletions

View File

@ -2463,7 +2463,6 @@ static HRESULT WINAPI d3d8_device_GetPixelShader(IDirect3DDevice8 *iface, DWORD
{
struct d3d8_pixel_shader *d3d8_shader;
d3d8_shader = wined3d_shader_get_parent(object);
wined3d_shader_decref(object);
*shader = d3d8_shader->handle;
}
else
@ -2481,7 +2480,6 @@ static HRESULT WINAPI d3d8_device_DeletePixelShader(IDirect3DDevice8 *iface, DWO
{
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_pixel_shader *shader_impl;
struct wined3d_shader *cur;
TRACE("iface %p, shader %#x.\n", iface, shader);
@ -2494,12 +2492,8 @@ static HRESULT WINAPI d3d8_device_DeletePixelShader(IDirect3DDevice8 *iface, DWO
return D3DERR_INVALIDCALL;
}
if ((cur = wined3d_device_get_pixel_shader(device->wined3d_device)))
{
if (cur == shader_impl->wined3d_shader)
IDirect3DDevice8_SetPixelShader(iface, 0);
wined3d_shader_decref(cur);
}
if (wined3d_device_get_pixel_shader(device->wined3d_device) == shader_impl->wined3d_shader)
IDirect3DDevice8_SetPixelShader(iface, 0);
wined3d_mutex_unlock();

View File

@ -2586,13 +2586,11 @@ static HRESULT WINAPI d3d9_device_GetPixelShader(IDirect3DDevice9Ex *iface, IDir
if (!shader) return D3DERR_INVALIDCALL;
wined3d_mutex_lock();
wined3d_shader = wined3d_device_get_pixel_shader(device->wined3d_device);
if (wined3d_shader)
if ((wined3d_shader = wined3d_device_get_pixel_shader(device->wined3d_device)))
{
shader_impl = wined3d_shader_get_parent(wined3d_shader);
*shader = &shader_impl->IDirect3DPixelShader9_iface;
IDirect3DPixelShader9_AddRef(*shader);
wined3d_shader_decref(wined3d_shader);
}
else
{

View File

@ -2862,16 +2862,9 @@ void CDECL wined3d_device_set_pixel_shader(struct wined3d_device *device, struct
struct wined3d_shader * CDECL wined3d_device_get_pixel_shader(const struct wined3d_device *device)
{
struct wined3d_shader *shader;
TRACE("device %p.\n", device);
shader = device->stateBlock->state.pixel_shader;
if (shader)
wined3d_shader_incref(shader);
TRACE("Returning %p.\n", shader);
return shader;
return device->stateBlock->state.pixel_shader;
}
HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device,