d3d9: Release the recording stateblock before calling wined3d_device_reset().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-10-24 13:43:04 -05:00 committed by Alexandre Julliard
parent f0b09c3572
commit bb3cc5e05c
4 changed files with 20 additions and 4 deletions

View File

@ -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);

View File

@ -1858,3 +1858,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);
}

View File

@ -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)

View File

@ -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);