Zebediah Figura : d3d8: Retrieve texture states from the primary stateblock.
Alexandre Julliard
julliard at winehq.org
Mon Feb 24 15:23:53 CST 2020
Module: wine
Branch: master
Commit: 942e21003781c787a26571ae65776bb036374f2d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=942e21003781c787a26571ae65776bb036374f2d
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Fri Feb 21 17:04:49 2020 -0600
d3d8: Retrieve texture states from the primary stateblock.
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 | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 7c1a6fe9fd..41384d84bc 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2251,26 +2251,38 @@ tss_lookup[] =
};
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);
+ const struct wined3d_stateblock_state *device_state;
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;
}
- l = &tss_lookup[Type];
+ l = &tss_lookup[state];
wined3d_mutex_lock();
+ device_state = wined3d_stateblock_get_state(device->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
- *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();
return D3D_OK;
More information about the wine-cvs
mailing list