Henri Verbeet : wined3d: wined3d_device_set_vertex_declaration() never fails.

Alexandre Julliard julliard at winehq.org
Fri Sep 21 14:22:39 CDT 2012


Module: wine
Branch: master
Commit: 01918d05ed17ae01016b7d05e67024d4bd4c1e8e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=01918d05ed17ae01016b7d05e67024d4bd4c1e8e

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Sep 20 22:59:20 2012 +0200

wined3d: wined3d_device_set_vertex_declaration() never fails.

---

 dlls/d3d8/device.c     |    5 ++---
 dlls/d3d9/device.c     |   12 ++++--------
 dlls/ddraw/device.c    |   37 ++++---------------------------------
 dlls/wined3d/device.c  |   10 +++++-----
 include/wine/wined3d.h |    2 +-
 5 files changed, 16 insertions(+), 50 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 5e21a38..244e4c0 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -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);
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 06988f7..ea2fd1f 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -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)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 20b2510..86cd5c1 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -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. */
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 9daeb60..4d6d03c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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,
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0d84adc..90e71c0 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -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);




More information about the wine-cvs mailing list