Commit 6909b514 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Just return the shader from wined3d_device_get_vertex_shader().

parent b97ec7ae
...@@ -2174,7 +2174,6 @@ static HRESULT WINAPI d3d8_device_DeleteVertexShader(IDirect3DDevice8 *iface, DW ...@@ -2174,7 +2174,6 @@ static HRESULT WINAPI d3d8_device_DeleteVertexShader(IDirect3DDevice8 *iface, DW
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_vertex_shader *shader_impl; struct d3d8_vertex_shader *shader_impl;
struct wined3d_shader *cur;
TRACE("iface %p, shader %#x.\n", iface, shader); TRACE("iface %p, shader %#x.\n", iface, shader);
...@@ -2187,12 +2186,9 @@ static HRESULT WINAPI d3d8_device_DeleteVertexShader(IDirect3DDevice8 *iface, DW ...@@ -2187,12 +2186,9 @@ static HRESULT WINAPI d3d8_device_DeleteVertexShader(IDirect3DDevice8 *iface, DW
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
} }
if ((cur = wined3d_device_get_vertex_shader(device->wined3d_device))) if (shader_impl->wined3d_shader
{ && wined3d_device_get_vertex_shader(device->wined3d_device) == shader_impl->wined3d_shader)
if (cur == shader_impl->wined3d_shader) IDirect3DDevice8_SetVertexShader(iface, 0);
IDirect3DDevice8_SetVertexShader(iface, 0);
wined3d_shader_decref(cur);
}
wined3d_mutex_unlock(); wined3d_mutex_unlock();
......
...@@ -2286,13 +2286,11 @@ static HRESULT WINAPI d3d9_device_GetVertexShader(IDirect3DDevice9Ex *iface, IDi ...@@ -2286,13 +2286,11 @@ static HRESULT WINAPI d3d9_device_GetVertexShader(IDirect3DDevice9Ex *iface, IDi
TRACE("iface %p, shader %p.\n", iface, shader); TRACE("iface %p, shader %p.\n", iface, shader);
wined3d_mutex_lock(); wined3d_mutex_lock();
wined3d_shader = wined3d_device_get_vertex_shader(device->wined3d_device); if ((wined3d_shader = wined3d_device_get_vertex_shader(device->wined3d_device)))
if (wined3d_shader)
{ {
shader_impl = wined3d_shader_get_parent(wined3d_shader); shader_impl = wined3d_shader_get_parent(wined3d_shader);
*shader = &shader_impl->IDirect3DVertexShader9_iface; *shader = &shader_impl->IDirect3DVertexShader9_iface;
IDirect3DVertexShader9_AddRef(*shader); IDirect3DVertexShader9_AddRef(*shader);
wined3d_shader_decref(wined3d_shader);
} }
else else
{ {
......
...@@ -2480,16 +2480,9 @@ void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struc ...@@ -2480,16 +2480,9 @@ void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struc
struct wined3d_shader * CDECL wined3d_device_get_vertex_shader(const struct wined3d_device *device) struct wined3d_shader * CDECL wined3d_device_get_vertex_shader(const struct wined3d_device *device)
{ {
struct wined3d_shader *shader;
TRACE("device %p.\n", device); TRACE("device %p.\n", device);
shader = device->stateBlock->state.vertex_shader; return device->stateBlock->state.vertex_shader;
if (shader)
wined3d_shader_incref(shader);
TRACE("Returning %p.\n", shader);
return shader;
} }
HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment