[PATCH v2 3/6] d3d8: Track the primary stateblock state locally.
Zebediah Figura
z.figura12 at gmail.com
Wed Sep 25 23:05:41 CDT 2019
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/d3d8/d3d8_private.h | 2 +-
dlls/d3d8/device.c | 14 +++++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index 0d4d4faf898..f262d12fc7a 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -132,7 +132,7 @@ struct d3d8_device
* no GetSwapchain, GetBackBuffer doesn't accept a swapchain number). */
struct wined3d_swapchain *implicit_swapchain;
- struct wined3d_stateblock *recording;
+ struct wined3d_stateblock *recording, *state, *update_state;
};
HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter,
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 741218c9515..aac6c9e2f67 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -595,6 +595,7 @@ static ULONG WINAPI d3d8_device_Release(IDirect3DDevice8 *iface)
if (device->recording)
wined3d_stateblock_decref(device->recording);
+ wined3d_stateblock_decref(device->state);
wined3d_swapchain_decref(device->implicit_swapchain);
wined3d_device_release_focus_window(device->wined3d_device);
@@ -914,6 +915,7 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
if (device->recording)
wined3d_stateblock_decref(device->recording);
device->recording = NULL;
+ device->update_state = device->state;
present_parameters->BackBufferCount = swapchain_desc.backbuffer_count;
implicit_swapchain = wined3d_swapchain_get_parent(device->implicit_swapchain);
implicit_swapchain->swap_interval
@@ -1871,7 +1873,7 @@ static HRESULT WINAPI d3d8_device_BeginStateBlock(IDirect3DDevice8 *iface)
wined3d_mutex_lock();
if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device, &stateblock)))
- device->recording = stateblock;
+ device->update_state = device->recording = stateblock;
wined3d_mutex_unlock();
return hr;
@@ -1898,6 +1900,7 @@ static HRESULT WINAPI d3d8_device_EndStateBlock(IDirect3DDevice8 *iface, DWORD *
}
stateblock = device->recording;
device->recording = NULL;
+ device->update_state = device->state;
*token = d3d8_allocate_handle(&device->handle_table, stateblock, D3D8_HANDLE_SB);
wined3d_mutex_unlock();
@@ -3607,6 +3610,15 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
return hr;
}
+ if (FAILED(hr = wined3d_stateblock_create(device->wined3d_device, WINED3D_SBT_PRIMARY, &device->state)))
+ {
+ ERR("Failed to create primary stateblock, hr %#x.\n", hr);
+ wined3d_device_decref(device->wined3d_device);
+ wined3d_mutex_unlock();
+ return hr;
+ }
+ device->update_state = device->state;
+
if (!parameters->Windowed)
{
if (!focus_window)
--
2.23.0
More information about the wine-devel
mailing list