Commit 942e2100 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

d3d8: Retrieve texture states from the primary stateblock.

parent 27e8a5dd
...@@ -2251,26 +2251,38 @@ tss_lookup[] = ...@@ -2251,26 +2251,38 @@ tss_lookup[] =
}; };
static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface, static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface,
DWORD stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *value) DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD *value)
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
const struct wined3d_stateblock_state *device_state;
const struct tss_lookup *l; const struct tss_lookup *l;
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, state, value);
if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3)
stage -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
if (stage >= WINED3D_MAX_COMBINED_SAMPLERS)
{
WARN("Invalid stage %u.\n", stage);
*value = 0;
return D3D_OK;
}
if (Type >= ARRAY_SIZE(tss_lookup)) if (state >= ARRAY_SIZE(tss_lookup))
{ {
WARN("Invalid Type %#x passed.\n", Type); WARN("Invalid state %#x.\n", state);
return D3D_OK; return D3D_OK;
} }
l = &tss_lookup[Type]; l = &tss_lookup[state];
wined3d_mutex_lock(); wined3d_mutex_lock();
device_state = wined3d_stateblock_get_state(device->state);
if (l->sampler_state) if (l->sampler_state)
*value = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->u.sampler_state); *value = device_state->sampler_states[stage][l->u.sampler_state];
else else
*value = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, l->u.texture_state); *value = device_state->texture_states[stage][l->u.texture_state];
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return D3D_OK; return D3D_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment