[PATCH v2 1/7] d3d9: Release the recording stateblock before calling wined3d_device_reset().
Zebediah Figura
z.figura12 at gmail.com
Thu Oct 24 13:43:04 CDT 2019
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/d3d9/device.c | 13 +++++++++----
dlls/wined3d/stateblock.c | 9 +++++++++
dlls/wined3d/wined3d.spec | 1 +
include/wine/wined3d.h | 1 +
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 07179900c4..d96e7b7095 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -990,6 +990,15 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
device->index_buffer_size = 0;
}
+ if (!extended)
+ {
+ if (device->recording)
+ wined3d_stateblock_decref(device->recording);
+ device->recording = NULL;
+ device->update_state = device->state;
+ wined3d_stateblock_reset(device->state);
+ }
+
if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc,
mode ? &wined3d_mode : NULL, reset_enum_callback, !extended)))
{
@@ -997,10 +1006,6 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
if (!extended)
{
- if (device->recording)
- wined3d_stateblock_decref(device->recording);
- device->recording = NULL;
- device->update_state = device->state;
device->auto_mipmaps = 0;
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE,
!!swapchain_desc.enable_auto_depth_stencil);
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 1965a4303f..967a44262c 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1857,3 +1857,12 @@ HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device,
return WINED3D_OK;
}
+
+void CDECL wined3d_stateblock_reset(struct wined3d_stateblock *stateblock)
+{
+ TRACE("stateblock %p.\n", stateblock);
+
+ wined3d_stateblock_state_cleanup(&stateblock->stateblock_state);
+ memset(&stateblock->stateblock_state, 0, sizeof(stateblock->stateblock_state));
+ wined3d_stateblock_state_init(&stateblock->stateblock_state, stateblock->device, WINED3D_STATE_INIT_DEFAULT);
+}
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 2df6c510b1..6fba7b5661 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_reset(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)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 57f5775409..e328386d6f 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2660,6 +2660,7 @@ 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_reset(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);
--
2.20.1
More information about the wine-devel
mailing list