[PATCH 4/5] wined3d: Just return the shader from wined3d_device_get_vertex_shader().
Henri Verbeet
hverbeet at codeweavers.com
Sun Sep 23 15:14:48 CDT 2012
---
dlls/d3d8/device.c | 10 +++-------
dlls/d3d9/device.c | 4 +---
dlls/wined3d/device.c | 9 +--------
3 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 5325a6d..709ac52 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2174,7 +2174,6 @@ static HRESULT WINAPI d3d8_device_DeleteVertexShader(IDirect3DDevice8 *iface, DW
{
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_vertex_shader *shader_impl;
- struct wined3d_shader *cur;
TRACE("iface %p, shader %#x.\n", iface, shader);
@@ -2187,12 +2186,9 @@ static HRESULT WINAPI d3d8_device_DeleteVertexShader(IDirect3DDevice8 *iface, DW
return D3DERR_INVALIDCALL;
}
- if ((cur = wined3d_device_get_vertex_shader(device->wined3d_device)))
- {
- if (cur == shader_impl->wined3d_shader)
- IDirect3DDevice8_SetVertexShader(iface, 0);
- wined3d_shader_decref(cur);
- }
+ if (shader_impl->wined3d_shader
+ && wined3d_device_get_vertex_shader(device->wined3d_device) == shader_impl->wined3d_shader)
+ IDirect3DDevice8_SetVertexShader(iface, 0);
wined3d_mutex_unlock();
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 5a17943..0418d69 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2286,13 +2286,11 @@ static HRESULT WINAPI d3d9_device_GetVertexShader(IDirect3DDevice9Ex *iface, IDi
TRACE("iface %p, shader %p.\n", iface, shader);
wined3d_mutex_lock();
- wined3d_shader = wined3d_device_get_vertex_shader(device->wined3d_device);
- if (wined3d_shader)
+ if ((wined3d_shader = wined3d_device_get_vertex_shader(device->wined3d_device)))
{
shader_impl = wined3d_shader_get_parent(wined3d_shader);
*shader = &shader_impl->IDirect3DVertexShader9_iface;
IDirect3DVertexShader9_AddRef(*shader);
- wined3d_shader_decref(wined3d_shader);
}
else
{
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 2cf0f85..664f1bd 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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 *shader;
-
TRACE("device %p.\n", device);
- shader = device->stateBlock->state.vertex_shader;
- if (shader)
- wined3d_shader_incref(shader);
-
- TRACE("Returning %p.\n", shader);
- return shader;
+ return device->stateBlock->state.vertex_shader;
}
HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
--
1.7.8.6
More information about the wine-patches
mailing list