Commit 3a61f3cf authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

d3d8: Track the primary stateblock state locally.

parent 40dad5a0
......@@ -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,
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment