wined3d: wined3d_device_get_sampler_state() never fails.

This commit is contained in:
Henri Verbeet 2012-09-18 22:13:58 +02:00 committed by Alexandre Julliard
parent 0d96be2c20
commit 62670c7ba5
6 changed files with 21 additions and 38 deletions

View File

@ -1785,7 +1785,7 @@ static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface,
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
const struct tss_lookup *l; const struct tss_lookup *l;
HRESULT hr; HRESULT hr = D3D_OK;
TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, stage, Type, value); TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, stage, Type, value);
@ -1799,7 +1799,7 @@ static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface,
wined3d_mutex_lock(); wined3d_mutex_lock();
if (l->sampler_state) if (l->sampler_state)
hr = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->state, value); *value = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->state);
else else
hr = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, l->state, value); hr = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, l->state, value);
wined3d_mutex_unlock(); wined3d_mutex_unlock();

View File

@ -1794,15 +1794,14 @@ static HRESULT WINAPI d3d9_device_GetSamplerState(IDirect3DDevice9Ex *iface,
DWORD sampler, D3DSAMPLERSTATETYPE state, DWORD *value) DWORD sampler, D3DSAMPLERSTATETYPE state, DWORD *value)
{ {
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
HRESULT hr;
TRACE("iface %p, sampler %u, state %#x, value %p.\n", iface, sampler, state, value); TRACE("iface %p, sampler %u, state %#x, value %p.\n", iface, sampler, state, value);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_get_sampler_state(device->wined3d_device, sampler, state, value); *value = wined3d_device_get_sampler_state(device->wined3d_device, sampler, state);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return D3D_OK;
} }
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetSamplerState(IDirect3DDevice9Ex *iface, static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetSamplerState(IDirect3DDevice9Ex *iface,

View File

@ -2217,7 +2217,7 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface,
D3DRENDERSTATETYPE state, DWORD *value) D3DRENDERSTATETYPE state, DWORD *value)
{ {
struct d3d_device *device = impl_from_IDirect3DDevice7(iface); struct d3d_device *device = impl_from_IDirect3DDevice7(iface);
HRESULT hr; HRESULT hr = D3D_OK;
TRACE("iface %p, state %#x, value %p.\n", iface, state, value); TRACE("iface %p, state %#x, value %p.\n", iface, state, value);
@ -2231,8 +2231,7 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface,
{ {
enum wined3d_texture_filter_type tex_mag; enum wined3d_texture_filter_type tex_mag;
hr = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MAG_FILTER, &tex_mag); tex_mag = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MAG_FILTER);
switch (tex_mag) switch (tex_mag)
{ {
case WINED3D_TEXF_POINT: case WINED3D_TEXF_POINT:
@ -2253,16 +2252,8 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface,
enum wined3d_texture_filter_type tex_min; enum wined3d_texture_filter_type tex_min;
enum wined3d_texture_filter_type tex_mip; enum wined3d_texture_filter_type tex_mip;
hr = wined3d_device_get_sampler_state(device->wined3d_device, tex_min = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MIN_FILTER);
0, WINED3D_SAMP_MIN_FILTER, &tex_min); tex_mip = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MIP_FILTER);
if (FAILED(hr))
{
wined3d_mutex_unlock();
return hr;
}
hr = wined3d_device_get_sampler_state(device->wined3d_device,
0, WINED3D_SAMP_MIP_FILTER, &tex_mip);
switch (tex_min) switch (tex_min)
{ {
case WINED3D_TEXF_POINT: case WINED3D_TEXF_POINT:
@ -2311,12 +2302,10 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface,
case D3DRENDERSTATE_TEXTUREADDRESS: case D3DRENDERSTATE_TEXTUREADDRESS:
case D3DRENDERSTATE_TEXTUREADDRESSU: case D3DRENDERSTATE_TEXTUREADDRESSU:
hr = wined3d_device_get_sampler_state(device->wined3d_device, *value = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_ADDRESS_U);
0, WINED3D_SAMP_ADDRESS_U, value);
break; break;
case D3DRENDERSTATE_TEXTUREADDRESSV: case D3DRENDERSTATE_TEXTUREADDRESSV:
hr = wined3d_device_get_sampler_state(device->wined3d_device, *value = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_ADDRESS_V);
0, WINED3D_SAMP_ADDRESS_V, value);
break; break;
case D3DRENDERSTATE_BORDERCOLOR: case D3DRENDERSTATE_BORDERCOLOR:
@ -2332,7 +2321,6 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface,
case D3DRENDERSTATE_ZBIAS: case D3DRENDERSTATE_ZBIAS:
*value = wined3d_device_get_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS); *value = wined3d_device_get_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS);
hr = D3D_OK;
break; break;
default: default:
@ -2344,7 +2332,6 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface,
break; break;
} }
*value = wined3d_device_get_render_state(device->wined3d_device, state); *value = wined3d_device_get_render_state(device->wined3d_device, state);
hr = D3D_OK;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
@ -4584,8 +4571,8 @@ static HRESULT d3d_device7_GetTextureStageState(IDirect3DDevice7 *iface,
DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD *value) DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD *value)
{ {
struct d3d_device *device = impl_from_IDirect3DDevice7(iface); struct d3d_device *device = impl_from_IDirect3DDevice7(iface);
HRESULT hr;
const struct tss_lookup *l; const struct tss_lookup *l;
HRESULT hr = D3D_OK;
TRACE("iface %p, stage %u, state %#x, value %p.\n", TRACE("iface %p, stage %u, state %#x, value %p.\n",
iface, stage, state, value); iface, stage, state, value);
@ -4605,7 +4592,7 @@ static HRESULT d3d_device7_GetTextureStageState(IDirect3DDevice7 *iface,
if (l->sampler_state) if (l->sampler_state)
{ {
hr = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->state, value); *value = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->state);
switch (state) switch (state)
{ {

View File

@ -2363,11 +2363,11 @@ void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device,
device_invalidate_state(device, STATE_SAMPLER(sampler_idx)); device_invalidate_state(device, STATE_SAMPLER(sampler_idx));
} }
HRESULT CDECL wined3d_device_get_sampler_state(const struct wined3d_device *device, DWORD CDECL wined3d_device_get_sampler_state(const struct wined3d_device *device,
UINT sampler_idx, enum wined3d_sampler_state state, DWORD *value) UINT sampler_idx, enum wined3d_sampler_state state)
{ {
TRACE("device %p, sampler_idx %u, state %s, value %p.\n", TRACE("device %p, sampler_idx %u, state %s.\n",
device, sampler_idx, debug_d3dsamplerstate(state), value); device, sampler_idx, debug_d3dsamplerstate(state));
if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3) if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3)
sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS);
@ -2376,13 +2376,10 @@ HRESULT CDECL wined3d_device_get_sampler_state(const struct wined3d_device *devi
/ sizeof(*device->stateBlock->state.sampler_states)) / sizeof(*device->stateBlock->state.sampler_states))
{ {
WARN("Invalid sampler %u.\n", sampler_idx); WARN("Invalid sampler %u.\n", sampler_idx);
return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ return 0; /* Windows accepts overflowing this array ... we do not. */
} }
*value = device->stateBlock->state.sampler_states[sampler_idx][state]; return device->stateBlock->state.sampler_states[sampler_idx][state];
TRACE("Returning %#x.\n", *value);
return WINED3D_OK;
} }
HRESULT CDECL wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect) HRESULT CDECL wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect)

View File

@ -77,7 +77,7 @@
@ cdecl wined3d_device_get_raster_status(ptr long ptr) @ cdecl wined3d_device_get_raster_status(ptr long ptr)
@ cdecl wined3d_device_get_render_state(ptr long) @ cdecl wined3d_device_get_render_state(ptr long)
@ cdecl wined3d_device_get_render_target(ptr long ptr) @ cdecl wined3d_device_get_render_target(ptr long ptr)
@ cdecl wined3d_device_get_sampler_state(ptr long long ptr) @ cdecl wined3d_device_get_sampler_state(ptr long long)
@ cdecl wined3d_device_get_scissor_rect(ptr ptr) @ cdecl wined3d_device_get_scissor_rect(ptr ptr)
@ cdecl wined3d_device_get_software_vertex_processing(ptr) @ cdecl wined3d_device_get_software_vertex_processing(ptr)
@ cdecl wined3d_device_get_stream_source(ptr long ptr ptr ptr) @ cdecl wined3d_device_get_stream_source(ptr long ptr ptr ptr)

View File

@ -2145,8 +2145,8 @@ HRESULT __cdecl wined3d_device_get_raster_status(const struct wined3d_device *de
DWORD __cdecl wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state); DWORD __cdecl wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state);
HRESULT __cdecl wined3d_device_get_render_target(const struct wined3d_device *device, HRESULT __cdecl wined3d_device_get_render_target(const struct wined3d_device *device,
UINT render_target_idx, struct wined3d_surface **render_target); UINT render_target_idx, struct wined3d_surface **render_target);
HRESULT __cdecl wined3d_device_get_sampler_state(const struct wined3d_device *device, DWORD __cdecl wined3d_device_get_sampler_state(const struct wined3d_device *device,
UINT sampler_idx, enum wined3d_sampler_state state, DWORD *value); UINT sampler_idx, enum wined3d_sampler_state state);
HRESULT __cdecl wined3d_device_get_scissor_rect(const struct wined3d_device *device, RECT *rect); HRESULT __cdecl wined3d_device_get_scissor_rect(const struct wined3d_device *device, RECT *rect);
BOOL __cdecl wined3d_device_get_software_vertex_processing(const struct wined3d_device *device); BOOL __cdecl wined3d_device_get_software_vertex_processing(const struct wined3d_device *device);
HRESULT __cdecl wined3d_device_get_stream_source(const struct wined3d_device *device, HRESULT __cdecl wined3d_device_get_stream_source(const struct wined3d_device *device,