[PATCH 3/5] wined3d: wined3d_device_set_sampler_state() never fails.
Henri Verbeet
hverbeet at codeweavers.com
Tue Sep 18 15:13:57 CDT 2012
---
dlls/d3d8/device.c | 4 ++--
dlls/d3d9/device.c | 5 ++---
dlls/ddraw/device.c | 16 +++++++---------
dlls/wined3d/device.c | 10 ++++------
include/wine/wined3d.h | 2 +-
5 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index f6f0501..2b7e7c0 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1812,7 +1812,7 @@ static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface,
{
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
const struct tss_lookup *l;
- HRESULT hr;
+ HRESULT hr = D3D_OK;
TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, stage, type, value);
@@ -1826,7 +1826,7 @@ static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface,
wined3d_mutex_lock();
if (l->sampler_state)
- hr = wined3d_device_set_sampler_state(device->wined3d_device, stage, l->state, value);
+ wined3d_device_set_sampler_state(device->wined3d_device, stage, l->state, value);
else
hr = wined3d_device_set_texture_stage_state(device->wined3d_device, stage, l->state, value);
wined3d_mutex_unlock();
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index fcdfc6f..ea90e1a 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -1809,15 +1809,14 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetSamplerState(IDirect3DDev
DWORD sampler, D3DSAMPLERSTATETYPE state, DWORD value)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
- HRESULT hr;
TRACE("iface %p, sampler %u, state %#x, value %#x.\n", iface, sampler, state, value);
wined3d_mutex_lock();
- hr = wined3d_device_set_sampler_state(device->wined3d_device, sampler, state, value);
+ wined3d_device_set_sampler_state(device->wined3d_device, sampler, state, value);
wined3d_mutex_unlock();
- return hr;
+ return D3D_OK;
}
static HRESULT WINAPI d3d9_device_ValidateDevice(IDirect3DDevice9Ex *iface, DWORD *pass_count)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 996fca8..908efa3 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -2509,7 +2509,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
D3DRENDERSTATETYPE state, DWORD value)
{
struct d3d_device *device = impl_from_IDirect3DDevice7(iface);
- HRESULT hr;
+ HRESULT hr = D3D_OK;
TRACE("iface %p, state %#x, value %#x.\n", iface, state, value);
@@ -2552,7 +2552,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
break;
}
- hr = wined3d_device_set_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MAG_FILTER, tex_mag);
+ wined3d_device_set_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MAG_FILTER, tex_mag);
break;
}
@@ -2597,7 +2597,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
wined3d_device_set_sampler_state(device->wined3d_device,
0, WINED3D_SAMP_MIP_FILTER, tex_mip);
- hr = wined3d_device_set_sampler_state(device->wined3d_device,
+ wined3d_device_set_sampler_state(device->wined3d_device,
0, WINED3D_SAMP_MIN_FILTER, tex_min);
break;
}
@@ -2607,11 +2607,11 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
0, WINED3D_SAMP_ADDRESS_V, value);
/* Drop through */
case D3DRENDERSTATE_TEXTUREADDRESSU:
- hr = wined3d_device_set_sampler_state(device->wined3d_device,
+ wined3d_device_set_sampler_state(device->wined3d_device,
0, WINED3D_SAMP_ADDRESS_U, value);
break;
case D3DRENDERSTATE_TEXTUREADDRESSV:
- hr = wined3d_device_set_sampler_state(device->wined3d_device,
+ wined3d_device_set_sampler_state(device->wined3d_device,
0, WINED3D_SAMP_ADDRESS_V, value);
break;
@@ -2630,7 +2630,6 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
case D3DRENDERSTATE_ZBIAS:
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value);
- hr = D3D_OK;
break;
default:
@@ -2643,7 +2642,6 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface,
}
wined3d_device_set_render_state(device->wined3d_device, state, value);
- hr = D3D_OK;
break;
}
wined3d_mutex_unlock();
@@ -4728,7 +4726,7 @@ static HRESULT d3d_device7_SetTextureStageState(IDirect3DDevice7 *iface,
{
struct d3d_device *device = impl_from_IDirect3DDevice7(iface);
const struct tss_lookup *l;
- HRESULT hr;
+ HRESULT hr = D3D_OK;
TRACE("iface %p, stage %u, state %#x, value %#x.\n",
iface, stage, state, value);
@@ -4806,7 +4804,7 @@ static HRESULT d3d_device7_SetTextureStageState(IDirect3DDevice7 *iface,
break;
}
- hr = wined3d_device_set_sampler_state(device->wined3d_device, stage, l->state, value);
+ wined3d_device_set_sampler_state(device->wined3d_device, stage, l->state, value);
}
else
{
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a8bb403..596206c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2325,7 +2325,7 @@ DWORD CDECL wined3d_device_get_render_state(const struct wined3d_device *device,
return device->stateBlock->state.render_states[state];
}
-HRESULT CDECL wined3d_device_set_sampler_state(struct wined3d_device *device,
+void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device,
UINT sampler_idx, enum wined3d_sampler_state state, DWORD value)
{
DWORD old_value;
@@ -2340,7 +2340,7 @@ HRESULT CDECL wined3d_device_set_sampler_state(struct wined3d_device *device,
/ sizeof(*device->stateBlock->state.sampler_states))
{
WARN("Invalid sampler %u.\n", sampler_idx);
- return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */
+ return; /* Windows accepts overflowing this array ... we do not. */
}
old_value = device->stateBlock->state.sampler_states[sampler_idx][state];
@@ -2351,18 +2351,16 @@ HRESULT CDECL wined3d_device_set_sampler_state(struct wined3d_device *device,
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
- return WINED3D_OK;
+ return;
}
if (old_value == value)
{
TRACE("Application is setting the old value over, nothing to do.\n");
- return WINED3D_OK;
+ return;
}
device_invalidate_state(device, STATE_SAMPLER(sampler_idx));
-
- return WINED3D_OK;
}
HRESULT CDECL wined3d_device_get_sampler_state(const struct wined3d_device *device,
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 4d10fd6..57b6a1b 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2223,7 +2223,7 @@ 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);
-HRESULT __cdecl wined3d_device_set_sampler_state(struct wined3d_device *device,
+void __cdecl wined3d_device_set_sampler_state(struct wined3d_device *device,
UINT sampler_idx, enum wined3d_sampler_state state, DWORD value);
HRESULT __cdecl wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect);
HRESULT __cdecl wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software);
--
1.7.8.6
More information about the wine-patches
mailing list