[PATCH 2/4] wined3d: wined3d_device_set_render_state() never fails.

Henri Verbeet hverbeet at codeweavers.com
Mon Sep 10 17:27:02 CDT 2012


---
 dlls/d3d8/device.c     |   16 +++++-----------
 dlls/d3d9/device.c     |    5 ++---
 dlls/ddraw/device.c    |    6 ++++--
 dlls/wined3d/device.c  |    6 ++----
 include/wine/wined3d.h |    2 +-
 5 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 5a029f2..2cf957e 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -600,7 +600,7 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
     wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters);
     if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, NULL, reset_enum_callback)))
     {
-        hr = wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0);
+        wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0);
         device->lost = FALSE;
     }
     else
@@ -1453,7 +1453,6 @@ static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface,
         D3DRENDERSTATETYPE state, DWORD value)
 {
     struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
-    HRESULT hr;
 
     TRACE("iface %p, state %#x, value %#x.\n", iface, state, value);
 
@@ -1461,15 +1460,15 @@ static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface,
     switch (state)
     {
         case D3DRS_ZBIAS:
-            hr = wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value);
+            wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value);
             break;
 
         default:
-            hr = wined3d_device_set_render_state(device->wined3d_device, state, value);
+            wined3d_device_set_render_state(device->wined3d_device, state, value);
     }
     wined3d_mutex_unlock();
 
-    return hr;
+    return D3D_OK;
 }
 
 static HRESULT WINAPI d3d8_device_GetRenderState(IDirect3DDevice8 *iface,
@@ -3038,13 +3037,8 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
         return hr;
     }
 
-    hr = wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0);
+    wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0);
     wined3d_mutex_unlock();
-    if (FAILED(hr))
-    {
-        ERR("Failed to set minimum pointsize, hr %#x.\n", hr);
-        goto err;
-    }
 
     present_parameters_from_wined3d_swapchain_desc(parameters, &swapchain_desc);
 
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 2e33c9f..63a611d 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -1519,15 +1519,14 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetRenderState(IDirect3DDevi
         D3DRENDERSTATETYPE state, DWORD value)
 {
     struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
-    HRESULT hr;
 
     TRACE("iface %p, state %#x, value %#x.\n", iface, state, value);
 
     wined3d_mutex_lock();
-    hr = wined3d_device_set_render_state(device->wined3d_device, state, value);
+    wined3d_device_set_render_state(device->wined3d_device, state, value);
     wined3d_mutex_unlock();
 
-    return hr;
+    return D3D_OK;
 }
 
 static HRESULT WINAPI d3d9_device_GetRenderState(IDirect3DDevice9Ex *iface,
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 7848b0d..a81fa31 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -2627,7 +2627,8 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
             break;
 
         case D3DRENDERSTATE_ZBIAS:
-            hr = wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value);
+            wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value);
+            hr = D3D_OK;
             break;
 
         default:
@@ -2639,7 +2640,8 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
                 break;
             }
 
-            hr = wined3d_device_set_render_state(device->wined3d_device, state, value);
+            wined3d_device_set_render_state(device->wined3d_device, state, value);
+            hr = D3D_OK;
             break;
     }
     wined3d_mutex_unlock();
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e0849ce..3998408 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2317,7 +2317,7 @@ void CDECL wined3d_device_get_viewport(const struct wined3d_device *device, stru
     *viewport = device->stateBlock->state.viewport;
 }
 
-HRESULT CDECL wined3d_device_set_render_state(struct wined3d_device *device,
+void CDECL wined3d_device_set_render_state(struct wined3d_device *device,
         enum wined3d_render_state state, DWORD value)
 {
     DWORD old_value = device->stateBlock->state.render_states[state];
@@ -2331,7 +2331,7 @@ HRESULT CDECL wined3d_device_set_render_state(struct wined3d_device *device,
     if (device->isRecordingState)
     {
         TRACE("Recording... not performing anything.\n");
-        return WINED3D_OK;
+        return;
     }
 
     /* Compared here and not before the assignment to allow proper stateblock recording. */
@@ -2339,8 +2339,6 @@ HRESULT CDECL wined3d_device_set_render_state(struct wined3d_device *device,
         TRACE("Application is setting the old value over, nothing to do.\n");
     else
         device_invalidate_state(device, STATE_RENDER(state));
-
-    return WINED3D_OK;
 }
 
 HRESULT CDECL wined3d_device_get_render_state(const struct wined3d_device *device,
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 1fa1342..d2a2811 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2220,7 +2220,7 @@ HRESULT __cdecl wined3d_device_set_ps_consts_f(struct wined3d_device *device,
         UINT start_register, const float *constants, UINT vector4f_count);
 HRESULT __cdecl wined3d_device_set_ps_consts_i(struct wined3d_device *device,
         UINT start_register, const int *constants, UINT vector4i_count);
-HRESULT __cdecl wined3d_device_set_render_state(struct wined3d_device *device,
+void __cdecl wined3d_device_set_render_state(struct wined3d_device *device,
         enum wined3d_render_state state, DWORD value);
 HRESULT __cdecl wined3d_device_set_render_target(struct wined3d_device *device,
         UINT render_target_idx, struct wined3d_surface *render_target, BOOL set_viewport);
-- 
1.7.8.6




More information about the wine-patches mailing list