Zebediah Figura : wined3d: Make wined3d_device_set_texture() infallible.

Alexandre Julliard julliard at winehq.org
Fri Mar 22 16:06:20 CDT 2019


Module: wine
Branch: master
Commit: 4d67ac17584053c6f913f05580cb9d80624065b9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4d67ac17584053c6f913f05580cb9d80624065b9

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Fri Mar 22 09:47:06 2019 -0500

wined3d: Make wined3d_device_set_texture() infallible.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d8/device.c     |  5 ++---
 dlls/d3d9/device.c     |  7 +++----
 dlls/ddraw/device.c    |  8 ++++----
 dlls/wined3d/device.c  | 10 +++++-----
 include/wine/wined3d.h |  2 +-
 5 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 61bd7bb..5016ac4 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2101,18 +2101,17 @@ static HRESULT WINAPI d3d8_device_SetTexture(IDirect3DDevice8 *iface, DWORD stag
 {
     struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
     struct d3d8_texture *texture_impl;
-    HRESULT hr;
 
     TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
 
     texture_impl = unsafe_impl_from_IDirect3DBaseTexture8(texture);
 
     wined3d_mutex_lock();
-    hr = wined3d_device_set_texture(device->wined3d_device, stage,
+    wined3d_device_set_texture(device->wined3d_device, stage,
             texture_impl ? texture_impl->wined3d_texture : NULL);
     wined3d_mutex_unlock();
 
-    return hr;
+    return D3D_OK;
 }
 
 static const struct tss_lookup
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 5844d2c..4a41443 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2448,16 +2448,15 @@ static HRESULT WINAPI d3d9_device_SetTexture(IDirect3DDevice9Ex *iface, DWORD st
 {
     struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
     struct d3d9_texture *texture_impl;
-    HRESULT hr;
 
     TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
 
     texture_impl = unsafe_impl_from_IDirect3DBaseTexture9(texture);
 
     wined3d_mutex_lock();
-    hr = wined3d_device_set_texture(device->wined3d_device, stage,
+    wined3d_device_set_texture(device->wined3d_device, stage,
             texture_impl ? texture_impl->wined3d_texture : NULL);
-    if (SUCCEEDED(hr) && !device->recording)
+    if (!device->recording)
     {
         unsigned int i = stage < 16 || (stage >= D3DVERTEXTEXTURESAMPLER0 && stage <= D3DVERTEXTEXTURESAMPLER3)
                 ? stage < 16 ? stage : stage - D3DVERTEXTEXTURESAMPLER0 + 16 : ~0u;
@@ -2472,7 +2471,7 @@ static HRESULT WINAPI d3d9_device_SetTexture(IDirect3DDevice9Ex *iface, DWORD st
     }
     wined3d_mutex_unlock();
 
-    return hr;
+    return D3D_OK;
 }
 
 static const enum wined3d_texture_stage_state tss_lookup[] =
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index d2f11c1..85ebfb6 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -2760,7 +2760,8 @@ static HRESULT WINAPI d3d_device3_SetRenderState(IDirect3DDevice3 *iface,
 
             if (value == 0)
             {
-                hr = wined3d_device_set_texture(device->wined3d_device, 0, NULL);
+                wined3d_device_set_texture(device->wined3d_device, 0, NULL);
+                hr = D3D_OK;
                 break;
             }
 
@@ -4814,7 +4815,6 @@ static HRESULT d3d_device7_SetTexture(IDirect3DDevice7 *iface,
     struct d3d_device *device = impl_from_IDirect3DDevice7(iface);
     struct ddraw_surface *surf = unsafe_impl_from_IDirectDrawSurface7(texture);
     struct wined3d_texture *wined3d_texture = NULL;
-    HRESULT hr;
 
     TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
 
@@ -4822,10 +4822,10 @@ static HRESULT d3d_device7_SetTexture(IDirect3DDevice7 *iface,
         wined3d_texture = surf->wined3d_texture;
 
     wined3d_mutex_lock();
-    hr = wined3d_device_set_texture(device->wined3d_device, stage, wined3d_texture);
+    wined3d_device_set_texture(device->wined3d_device, stage, wined3d_texture);
     wined3d_mutex_unlock();
 
-    return hr;
+    return D3D_OK;
 }
 
 static HRESULT WINAPI d3d_device7_SetTexture_FPUSetup(IDirect3DDevice7 *iface,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index f9a43c2..5039e0a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3533,7 +3533,7 @@ DWORD CDECL wined3d_device_get_texture_stage_state(const struct wined3d_device *
     return device->state.texture_states[stage][state];
 }
 
-HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
+void CDECL wined3d_device_set_texture(struct wined3d_device *device,
         UINT stage, struct wined3d_texture *texture)
 {
     struct wined3d_texture *prev;
@@ -3547,7 +3547,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
     if (stage >= ARRAY_SIZE(device->state.textures))
     {
         WARN("Ignoring invalid stage %u.\n", stage);
-        return WINED3D_OK;
+        return;
     }
 
     if (texture)
@@ -3559,7 +3559,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
     if (device->recording)
     {
         device->recording->changed.textures |= 1u << stage;
-        return WINED3D_OK;
+        return;
     }
 
     prev = device->state.textures[stage];
@@ -3568,7 +3568,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
     if (texture == prev)
     {
         TRACE("App is setting the same texture again, nothing to do.\n");
-        return WINED3D_OK;
+        return;
     }
 
     TRACE("Setting new texture to %p.\n", texture);
@@ -3580,7 +3580,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
     if (prev)
         wined3d_texture_decref(prev);
 
-    return WINED3D_OK;
+    return;
 }
 
 struct wined3d_texture * CDECL wined3d_device_get_texture(const struct wined3d_device *device, UINT stage)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 9e4eb87..51fb7e6 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2458,7 +2458,7 @@ void __cdecl wined3d_device_set_stream_output(struct wined3d_device *device, UIN
 HRESULT __cdecl wined3d_device_set_stream_source(struct wined3d_device *device,
         UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride);
 HRESULT __cdecl wined3d_device_set_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT divider);
-HRESULT __cdecl wined3d_device_set_texture(struct wined3d_device *device, UINT stage, struct wined3d_texture *texture);
+void __cdecl wined3d_device_set_texture(struct wined3d_device *device, UINT stage, struct wined3d_texture *texture);
 void __cdecl wined3d_device_set_texture_stage_state(struct wined3d_device *device,
         UINT stage, enum wined3d_texture_stage_state state, DWORD value);
 void __cdecl wined3d_device_set_transform(struct wined3d_device *device,




More information about the wine-cvs mailing list