Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/stateblock.c | 15 +++++++++++++++ dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 2 ++ 3 files changed, 18 insertions(+)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index dae95ae46e8..42d1d9d4d81 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1419,6 +1419,21 @@ void CDECL wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock * stateblock->changed.vertexDecl = TRUE; }
+void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateblock, + enum wined3d_render_state state, DWORD value) +{ + TRACE("stateblock %p, state %s (%#x), value %#x.\n", stateblock, debug_d3drenderstate(state), state, value); + + if (state > WINEHIGHEST_RENDER_STATE) + { + WARN("Unhandled render state %#x.\n", state); + return; + } + + stateblock->stateblock_state.rs[state] = value; + stateblock->changed.renderState[state >> 5] |= 1u << (state & 0x1f); +} + 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 b65681f2108..488b1c4e650 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -262,6 +262,7 @@ @ cdecl wined3d_stateblock_set_ps_consts_b(ptr long long ptr) @ 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_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 f79cd212a1e..8d13a245ada 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2667,6 +2667,8 @@ HRESULT __cdecl wined3d_stateblock_set_ps_consts_f(struct wined3d_stateblock *st unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants); HRESULT __cdecl wined3d_stateblock_set_ps_consts_i(struct wined3d_stateblock *stateblock, 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_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/wined3d/stateblock.c | 9 +++++++++ dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 2 ++ 3 files changed, 12 insertions(+)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 42d1d9d4d81..a96093295ca 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1434,6 +1434,15 @@ void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateb stateblock->changed.renderState[state >> 5] |= 1u << (state & 0x1f); }
+void CDECL wined3d_stateblock_set_blend_factor(struct wined3d_stateblock *stateblock, + const struct wined3d_color *blend_factor) +{ + TRACE("stateblock %p, blend_factor %p.\n", stateblock, blend_factor); + + stateblock->stateblock_state.blend_factor = *blend_factor; + stateblock->changed.blend_state = TRUE; +} + 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 488b1c4e650..c7b10a2b562 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -258,6 +258,7 @@ @ cdecl wined3d_stateblock_create(ptr long ptr) @ cdecl wined3d_stateblock_decref(ptr) @ cdecl wined3d_stateblock_incref(ptr) +@ cdecl wined3d_stateblock_set_blend_factor(ptr ptr) @ cdecl wined3d_stateblock_set_pixel_shader(ptr ptr) @ cdecl wined3d_stateblock_set_ps_consts_b(ptr long long ptr) @ cdecl wined3d_stateblock_set_ps_consts_f(ptr long long ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 8d13a245ada..445ecd2f559 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2660,6 +2660,8 @@ HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock); ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock); ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock); +void __cdecl wined3d_stateblock_set_blend_factor(struct wined3d_stateblock *stateblock, + const struct wined3d_color *blend_factor); void __cdecl wined3d_stateblock_set_pixel_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader); HRESULT __cdecl wined3d_stateblock_set_ps_consts_b(struct wined3d_stateblock *stateblock, unsigned int start_idx, unsigned int count, const BOOL *constants);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/device.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index ee5de2f06fd..3d16812d59e 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2273,14 +2273,18 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetRenderState(IDirect3DDevi { wined3d_color_from_d3dcolor(&factor, value); wined3d_mutex_lock(); - wined3d_device_set_blend_state(device->wined3d_device, NULL, &factor); + wined3d_stateblock_set_blend_factor(device->update_state, &factor); + if (!device->recording) + wined3d_device_set_blend_state(device->wined3d_device, NULL, &factor); wined3d_mutex_unlock();
return D3D_OK; }
wined3d_mutex_lock(); - wined3d_device_set_render_state(device->wined3d_device, state, value); + wined3d_stateblock_set_render_state(device->update_state, state, value); + if (!device->recording) + wined3d_device_set_render_state(device->wined3d_device, 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/d3d8/device.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 827ec47c608..cc1409d5c1d 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1827,15 +1827,11 @@ static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface, TRACE("iface %p, state %#x, value %#x.\n", iface, state, value);
wined3d_mutex_lock(); - switch (state) - { - case D3DRS_ZBIAS: - wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value); - break; - - default: - wined3d_device_set_render_state(device->wined3d_device, state, value); - } + if (state == D3DRS_ZBIAS) + state = WINED3D_RS_DEPTHBIAS; + wined3d_stateblock_set_render_state(device->update_state, state, value); + if (!device->recording) + wined3d_device_set_render_state(device->wined3d_device, state, value); wined3d_mutex_unlock();
return D3D_OK;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com