Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/stateblock.c | 19 +++++++++++++++++++ dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 2 ++ 3 files changed, 22 insertions(+)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index a96093295c..70724f0545 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1443,6 +1443,25 @@ void CDECL wined3d_stateblock_set_blend_factor(struct wined3d_stateblock *stateb stateblock->changed.blend_state = TRUE; }
+void CDECL wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *stateblock, + UINT sampler_idx, enum wined3d_sampler_state state, DWORD value) +{ + TRACE("stateblock %p, sampler_idx %u, state %s, value %#x.\n", + stateblock, sampler_idx, debug_d3dsamplerstate(state), value); + + if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3) + sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS); + + if (sampler_idx >= ARRAY_SIZE(stateblock->stateblock_state.sampler_states)) + { + WARN("Invalid sampler %u.\n", sampler_idx); + return; + } + + stateblock->stateblock_state.sampler_states[sampler_idx][state] = value; + stateblock->changed.samplerState[sampler_idx] |= 1u << state; +} + static void init_default_render_states(DWORD rs[WINEHIGHEST_RENDER_STATE + 1], const struct wined3d_d3d_info *d3d_info) { union diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index c7b10a2b56..bf6b786704 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -264,6 +264,7 @@ @ cdecl wined3d_stateblock_set_ps_consts_f(ptr long long ptr) @ cdecl wined3d_stateblock_set_ps_consts_i(ptr long long ptr) @ cdecl wined3d_stateblock_set_render_state(ptr long long) +@ cdecl wined3d_stateblock_set_sampler_state(ptr long long long) @ cdecl wined3d_stateblock_set_vertex_declaration(ptr ptr) @ cdecl wined3d_stateblock_set_vertex_shader(ptr ptr) @ cdecl wined3d_stateblock_set_vs_consts_b(ptr long long ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 445ecd2f55..2fd16958d5 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2671,6 +2671,8 @@ HRESULT __cdecl wined3d_stateblock_set_ps_consts_i(struct wined3d_stateblock *st unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants); void __cdecl wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateblock, enum wined3d_render_state state, DWORD value); +void __cdecl wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *stateblock, + UINT sampler_idx, enum wined3d_sampler_state state, DWORD value); void __cdecl wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock *stateblock, struct wined3d_vertex_declaration *declaration); void __cdecl wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 3d16812d59..dd4d57938e 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2603,7 +2603,9 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetSamplerState(IDirect3DDev TRACE("iface %p, sampler %u, state %#x, value %#x.\n", iface, sampler, state, value);
wined3d_mutex_lock(); - wined3d_device_set_sampler_state(device->wined3d_device, sampler, state, value); + wined3d_stateblock_set_sampler_state(device->update_state, sampler, state, value); + if (!device->recording) + wined3d_device_set_sampler_state(device->wined3d_device, sampler, state, value); wined3d_mutex_unlock();
return D3D_OK;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/stateblock.c | 23 +++++++++++++++++++++++ dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 2 ++ 3 files changed, 26 insertions(+)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 70724f0545..1965a4303f 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1462,6 +1462,29 @@ void CDECL wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *state stateblock->changed.samplerState[sampler_idx] |= 1u << state; }
+void CDECL wined3d_stateblock_set_texture_stage_state(struct wined3d_stateblock *stateblock, + UINT stage, enum wined3d_texture_stage_state state, DWORD value) +{ + TRACE("stateblock %p, stage %u, state %s, value %#x.\n", + stateblock, stage, debug_d3dtexturestate(state), value); + + if (state > WINED3D_HIGHEST_TEXTURE_STATE) + { + WARN("Invalid state %#x passed.\n", state); + return; + } + + if (stage > WINED3D_MAX_TEXTURES) + { + WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring.\n", + stage, WINED3D_MAX_TEXTURES); + return; + } + + stateblock->stateblock_state.texture_states[stage][state] = value; + stateblock->changed.textureState[stage] |= 1u << state; +} + static void init_default_render_states(DWORD rs[WINEHIGHEST_RENDER_STATE + 1], const struct wined3d_d3d_info *d3d_info) { union diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index bf6b786704..2df6c510b1 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -265,6 +265,7 @@ @ cdecl wined3d_stateblock_set_ps_consts_i(ptr long long ptr) @ cdecl wined3d_stateblock_set_render_state(ptr long long) @ cdecl wined3d_stateblock_set_sampler_state(ptr long long long) +@ cdecl wined3d_stateblock_set_texture_stage_state(ptr long long long) @ cdecl wined3d_stateblock_set_vertex_declaration(ptr ptr) @ cdecl wined3d_stateblock_set_vertex_shader(ptr ptr) @ cdecl wined3d_stateblock_set_vs_consts_b(ptr long long ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 2fd16958d5..57f5775409 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2673,6 +2673,8 @@ void __cdecl wined3d_stateblock_set_render_state(struct wined3d_stateblock *stat enum wined3d_render_state state, DWORD value); void __cdecl wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *stateblock, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value); +void __cdecl wined3d_stateblock_set_texture_stage_state(struct wined3d_stateblock *stateblock, + UINT stage, enum wined3d_texture_stage_state state, DWORD value); void __cdecl wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock *stateblock, struct wined3d_vertex_declaration *declaration); void __cdecl wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=58038
Your paranoid android.
=== debian10 (64 bit WoW report) ===
d3d9: d3d9ex.c:3133: Test failed: Expected message 0x46 for window 0x1, but didn't receive it, i=0.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index dd4d57938e..07179900c4 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2575,7 +2575,9 @@ static HRESULT WINAPI d3d9_device_SetTextureStageState(IDirect3DDevice9Ex *iface }
wined3d_mutex_lock(); - wined3d_device_set_texture_stage_state(device->wined3d_device, stage, tss_lookup[state], value); + wined3d_stateblock_set_texture_stage_state(device->update_state, stage, tss_lookup[state], value); + if (!device->recording) + wined3d_device_set_texture_stage_state(device->wined3d_device, stage, tss_lookup[state], value); wined3d_mutex_unlock();
return D3D_OK;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=58039
Your paranoid android.
=== debian10 (32 bit WoW report) ===
d3d9: d3d9ex.c:3133: Test failed: Expected message 0x46 for window 0x1, but didn't receive it, i=0.
=== debian10 (64 bit WoW report) ===
d3d9: d3d9ex.c:3133: Test failed: Expected message 0x46 for window 0x1, but didn't receive it, i=0.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index cc1409d5c1..53e92707ca 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -2226,9 +2226,17 @@ static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface,
wined3d_mutex_lock(); if (l->sampler_state) - wined3d_device_set_sampler_state(device->wined3d_device, stage, l->u.sampler_state, value); + { + wined3d_stateblock_set_sampler_state(device->update_state, stage, l->u.sampler_state, value); + if (!device->recording) + wined3d_device_set_sampler_state(device->wined3d_device, stage, l->u.sampler_state, value); + } else - wined3d_device_set_texture_stage_state(device->wined3d_device, stage, l->u.texture_state, value); + { + wined3d_stateblock_set_texture_stage_state(device->update_state, stage, l->u.texture_state, value); + if (!device->recording) + wined3d_device_set_texture_stage_state(device->wined3d_device, stage, l->u.texture_state, value); + } wined3d_mutex_unlock();
return D3D_OK;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com