Commit 01918d05 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: wined3d_device_set_vertex_declaration() never fails.

parent 63b20223
......@@ -2138,10 +2138,9 @@ static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD
return D3DERR_INVALIDCALL;
}
hr = wined3d_device_set_vertex_declaration(device->wined3d_device,
wined3d_device_set_vertex_declaration(device->wined3d_device,
shader_impl->vertex_declaration->wined3d_vertex_declaration);
if (SUCCEEDED(hr))
hr = wined3d_device_set_vertex_shader(device->wined3d_device, shader_impl->wined3d_shader);
hr = wined3d_device_set_vertex_shader(device->wined3d_device, shader_impl->wined3d_shader);
wined3d_mutex_unlock();
TRACE("Returning hr %#x\n", hr);
......
......@@ -2073,16 +2073,15 @@ static HRESULT WINAPI d3d9_device_SetVertexDeclaration(IDirect3DDevice9Ex *iface
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
struct d3d9_vertex_declaration *decl_impl = unsafe_impl_from_IDirect3DVertexDeclaration9(declaration);
HRESULT hr;
TRACE("iface %p, declaration %p.\n", iface, declaration);
wined3d_mutex_lock();
hr = wined3d_device_set_vertex_declaration(device->wined3d_device,
wined3d_device_set_vertex_declaration(device->wined3d_device,
decl_impl ? decl_impl->wined3d_declaration : NULL);
wined3d_mutex_unlock();
return hr;
return D3D_OK;
}
static HRESULT WINAPI d3d9_device_GetVertexDeclaration(IDirect3DDevice9Ex *iface,
......@@ -2188,7 +2187,6 @@ static HRESULT WINAPI d3d9_device_SetFVF(IDirect3DDevice9Ex *iface, DWORD fvf)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
struct wined3d_vertex_declaration *decl;
HRESULT hr;
TRACE("iface %p, fvf %#x.\n", iface, fvf);
......@@ -2206,12 +2204,10 @@ static HRESULT WINAPI d3d9_device_SetFVF(IDirect3DDevice9Ex *iface, DWORD fvf)
return D3DERR_DRIVERINTERNALERROR;
}
hr = wined3d_device_set_vertex_declaration(device->wined3d_device, decl);
if (FAILED(hr))
ERR("Failed to set vertex declaration.\n");
wined3d_device_set_vertex_declaration(device->wined3d_device, decl);
wined3d_mutex_unlock();
return hr;
return D3D_OK;
}
static HRESULT WINAPI d3d9_device_GetFVF(IDirect3DDevice9Ex *iface, DWORD *fvf)
......
......@@ -3406,16 +3406,8 @@ static HRESULT d3d_device7_DrawPrimitive(IDirect3DDevice7 *iface,
/* Get the stride */
stride = get_flexible_vertex_size(fvf);
/* Set the FVF */
wined3d_mutex_lock();
hr = wined3d_device_set_vertex_declaration(device->wined3d_device, ddraw_find_decl(device->ddraw, fvf));
if (hr != D3D_OK)
{
wined3d_mutex_unlock();
return hr;
}
/* This method translates to the user pointer draw of WineD3D */
wined3d_device_set_vertex_declaration(device->wined3d_device, ddraw_find_decl(device->ddraw, fvf));
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
hr = wined3d_device_draw_primitive_up(device->wined3d_device, vertex_count, vertices, stride);
wined3d_mutex_unlock();
......@@ -3518,14 +3510,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
/* Set the D3DDevice's FVF */
wined3d_mutex_lock();
hr = wined3d_device_set_vertex_declaration(device->wined3d_device, ddraw_find_decl(device->ddraw, fvf));
if (FAILED(hr))
{
WARN("Failed to set vertex declaration, hr %#x.\n", hr);
wined3d_mutex_unlock();
return hr;
}
wined3d_device_set_vertex_declaration(device->wined3d_device, ddraw_find_decl(device->ddraw, fvf));
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
hr = wined3d_device_draw_indexed_primitive_up(device->wined3d_device, index_count, indices,
WINED3DFMT_R16_UINT, vertices, get_flexible_vertex_size(fvf));
......@@ -3992,15 +3977,7 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE
stride = get_flexible_vertex_size(vb->fvf);
wined3d_mutex_lock();
hr = wined3d_device_set_vertex_declaration(device->wined3d_device, vb->wineD3DVertexDeclaration);
if (FAILED(hr))
{
WARN("Failed to set vertex declaration, hr %#x.\n", hr);
wined3d_mutex_unlock();
return hr;
}
/* Set the vertex stream source */
wined3d_device_set_vertex_declaration(device->wined3d_device, vb->wineD3DVertexDeclaration);
hr = wined3d_device_set_stream_source(device->wined3d_device, 0, vb->wineD3DVertexBuffer, 0, stride);
if (FAILED(hr))
{
......@@ -4091,13 +4068,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
wined3d_mutex_lock();
hr = wined3d_device_set_vertex_declaration(This->wined3d_device, vb->wineD3DVertexDeclaration);
if (FAILED(hr))
{
ERR(" (%p) Setting the FVF failed, hr = %x!\n", This, hr);
wined3d_mutex_unlock();
return hr;
}
wined3d_device_set_vertex_declaration(This->wined3d_device, vb->wineD3DVertexDeclaration);
/* check that the buffer is large enough to hold the indices,
* reallocate if necessary. */
......
......@@ -2411,7 +2411,7 @@ void CDECL wined3d_device_get_scissor_rect(const struct wined3d_device *device,
TRACE("Returning rect %s.\n", wine_dbgstr_rect(rect));
}
HRESULT 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 *prev = device->updateStateBlock->state.vertex_declaration;
......@@ -2429,17 +2429,17 @@ HRESULT CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *devic
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
return WINED3D_OK;
return;
}
else if (declaration == prev)
if (declaration == prev)
{
/* Checked after the assignment to allow proper stateblock recording. */
TRACE("Application is setting the old declaration over, nothing to do.\n");
return WINED3D_OK;
return;
}
device_invalidate_state(device, STATE_VDECL);
return WINED3D_OK;
}
HRESULT CDECL wined3d_device_get_vertex_declaration(const struct wined3d_device *device,
......
......@@ -2235,7 +2235,7 @@ HRESULT __cdecl wined3d_device_set_texture_stage_state(struct wined3d_device *de
UINT stage, enum wined3d_texture_stage_state state, DWORD value);
void __cdecl wined3d_device_set_transform(struct wined3d_device *device,
enum wined3d_transform_state state, const struct wined3d_matrix *matrix);
HRESULT __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);
HRESULT __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);
......
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