Commit b97ec7ae authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: wined3d_device_set_vertex_shader() never fails.

parent 1dcc63c1
...@@ -2110,7 +2110,6 @@ static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD ...@@ -2110,7 +2110,6 @@ static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD
{ {
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;
HRESULT hr;
TRACE("iface %p, shader %#x.\n", iface, shader); TRACE("iface %p, shader %#x.\n", iface, shader);
...@@ -2140,12 +2139,10 @@ static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD ...@@ -2140,12 +2139,10 @@ static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD
wined3d_device_set_vertex_declaration(device->wined3d_device, wined3d_device_set_vertex_declaration(device->wined3d_device,
shader_impl->vertex_declaration->wined3d_vertex_declaration); shader_impl->vertex_declaration->wined3d_vertex_declaration);
hr = wined3d_device_set_vertex_shader(device->wined3d_device, shader_impl->wined3d_shader); wined3d_device_set_vertex_shader(device->wined3d_device, shader_impl->wined3d_shader);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
TRACE("Returning hr %#x\n", hr); return D3D_OK;
return hr;
} }
static HRESULT WINAPI d3d8_device_GetVertexShader(IDirect3DDevice8 *iface, DWORD *shader) static HRESULT WINAPI d3d8_device_GetVertexShader(IDirect3DDevice8 *iface, DWORD *shader)
......
...@@ -2266,16 +2266,15 @@ static HRESULT WINAPI d3d9_device_SetVertexShader(IDirect3DDevice9Ex *iface, IDi ...@@ -2266,16 +2266,15 @@ static HRESULT WINAPI d3d9_device_SetVertexShader(IDirect3DDevice9Ex *iface, IDi
{ {
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
struct d3d9_vertexshader *shader_obj = unsafe_impl_from_IDirect3DVertexShader9(shader); struct d3d9_vertexshader *shader_obj = unsafe_impl_from_IDirect3DVertexShader9(shader);
HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, shader); TRACE("iface %p, shader %p.\n", iface, shader);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_set_vertex_shader(device->wined3d_device, wined3d_device_set_vertex_shader(device->wined3d_device,
shader_obj ? shader_obj->wined3d_shader : NULL); shader_obj ? shader_obj->wined3d_shader : NULL);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return D3D_OK;
} }
static HRESULT WINAPI d3d9_device_GetVertexShader(IDirect3DDevice9Ex *iface, IDirect3DVertexShader9 **shader) static HRESULT WINAPI d3d9_device_GetVertexShader(IDirect3DDevice9Ex *iface, IDirect3DVertexShader9 **shader)
......
...@@ -2449,39 +2449,33 @@ struct wined3d_vertex_declaration * CDECL wined3d_device_get_vertex_declaration( ...@@ -2449,39 +2449,33 @@ struct wined3d_vertex_declaration * CDECL wined3d_device_get_vertex_declaration(
return device->stateBlock->state.vertex_declaration; return device->stateBlock->state.vertex_declaration;
} }
HRESULT CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader) void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader)
{ {
struct wined3d_shader *prev = device->updateStateBlock->state.vertex_shader; struct wined3d_shader *prev = device->updateStateBlock->state.vertex_shader;
TRACE("device %p, shader %p.\n", device, shader); TRACE("device %p, shader %p.\n", device, shader);
if (shader)
wined3d_shader_incref(shader);
if (prev)
wined3d_shader_decref(prev);
device->updateStateBlock->state.vertex_shader = shader; device->updateStateBlock->state.vertex_shader = shader;
device->updateStateBlock->changed.vertexShader = TRUE; device->updateStateBlock->changed.vertexShader = TRUE;
if (device->isRecordingState) if (device->isRecordingState)
{ {
if (shader)
wined3d_shader_incref(shader);
if (prev)
wined3d_shader_decref(prev);
TRACE("Recording... not performing anything.\n"); TRACE("Recording... not performing anything.\n");
return WINED3D_OK; return;
} }
if (shader == prev) if (shader == prev)
{ {
TRACE("Application is setting the old shader over, nothing to do.\n"); TRACE("Application is setting the old shader over, nothing to do.\n");
return WINED3D_OK; return;
} }
if (shader)
wined3d_shader_incref(shader);
if (prev)
wined3d_shader_decref(prev);
device_invalidate_state(device, STATE_VSHADER); device_invalidate_state(device, STATE_VSHADER);
return WINED3D_OK;
} }
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)
......
...@@ -2236,7 +2236,7 @@ void __cdecl wined3d_device_set_transform(struct wined3d_device *device, ...@@ -2236,7 +2236,7 @@ void __cdecl wined3d_device_set_transform(struct wined3d_device *device,
enum wined3d_transform_state state, const struct wined3d_matrix *matrix); enum wined3d_transform_state state, const struct wined3d_matrix *matrix);
void __cdecl wined3d_device_set_vertex_declaration(struct wined3d_device *device, void __cdecl wined3d_device_set_vertex_declaration(struct wined3d_device *device,
struct wined3d_vertex_declaration *declaration); struct wined3d_vertex_declaration *declaration);
HRESULT __cdecl wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader); void __cdecl wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader);
void __cdecl wined3d_device_set_viewport(struct wined3d_device *device, const struct wined3d_viewport *viewport); void __cdecl wined3d_device_set_viewport(struct wined3d_device *device, const struct wined3d_viewport *viewport);
HRESULT __cdecl wined3d_device_set_vs_consts_b(struct wined3d_device *device, HRESULT __cdecl wined3d_device_set_vs_consts_b(struct wined3d_device *device,
UINT start_register, const BOOL *constants, UINT bool_count); UINT start_register, const BOOL *constants, UINT bool_count);
......
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