wined3d: Make wined3d_device_set_texture() infallible.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-03-22 09:47:06 -05:00 committed by Alexandre Julliard
parent 61c32ac8d6
commit 4d67ac1758
5 changed files with 15 additions and 17 deletions

View File

@ -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

View File

@ -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[] =

View File

@ -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,

View File

@ -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)

View File

@ -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,