ddraw: Track the primary stateblock state locally.
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:
parent
872d33f29c
commit
db9db753c3
|
@ -422,6 +422,7 @@ static void ddraw_destroy(struct ddraw *This)
|
|||
|
||||
if (This->wined3d_swapchain)
|
||||
ddraw_destroy_swapchain(This);
|
||||
wined3d_stateblock_decref(This->state);
|
||||
wined3d_device_decref(This->wined3d_device);
|
||||
wined3d_decref(This->wined3d);
|
||||
|
||||
|
@ -5025,5 +5026,13 @@ HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type de
|
|||
|
||||
list_init(&ddraw->surface_list);
|
||||
|
||||
if (FAILED(hr = wined3d_stateblock_create(ddraw->wined3d_device, WINED3D_SBT_PRIMARY, &ddraw->state)))
|
||||
{
|
||||
ERR("Failed to create the primary stateblock, hr %#x.\n", hr);
|
||||
wined3d_device_decref(ddraw->wined3d_device);
|
||||
wined3d_decref(ddraw->wined3d);
|
||||
return hr;
|
||||
}
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
|
|
@ -127,6 +127,8 @@ struct ddraw
|
|||
/* FVF management */
|
||||
struct FvfToDecl *decls;
|
||||
UINT numConvertedDecls, declArraySize;
|
||||
|
||||
struct wined3d_stateblock *state;
|
||||
};
|
||||
|
||||
#define DDRAW_WINDOW_CLASS_NAME "DirectDrawDeviceWnd"
|
||||
|
@ -351,7 +353,7 @@ struct d3d_device
|
|||
|
||||
struct wined3d_vec4 user_clip_planes[D3DMAXUSERCLIPPLANES];
|
||||
|
||||
struct wined3d_stateblock *recording;
|
||||
struct wined3d_stateblock *recording, *state, *update_state;
|
||||
};
|
||||
|
||||
HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUnknown *rt_iface,
|
||||
|
|
|
@ -5620,7 +5620,7 @@ static HRESULT d3d_device7_BeginStateBlock(IDirect3DDevice7 *iface)
|
|||
return D3DERR_INBEGINSTATEBLOCK;
|
||||
}
|
||||
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_ddraw_from_wined3d(hr);
|
||||
|
@ -5688,6 +5688,7 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl
|
|||
}
|
||||
wined3d_sb = device->recording;
|
||||
device->recording = NULL;
|
||||
device->update_state = device->state;
|
||||
|
||||
h = ddraw_allocate_handle(&device->handle_table, wined3d_sb, DDRAW_HANDLE_STATEBLOCK);
|
||||
if (h == DDRAW_INVALID_HANDLE)
|
||||
|
@ -6978,12 +6979,15 @@ static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw,
|
|||
/* This is for convenience. */
|
||||
device->wined3d_device = ddraw->wined3d_device;
|
||||
wined3d_device_incref(ddraw->wined3d_device);
|
||||
device->update_state = device->state = ddraw->state;
|
||||
wined3d_stateblock_incref(ddraw->state);
|
||||
|
||||
/* Render to the back buffer */
|
||||
if (FAILED(hr = wined3d_device_set_rendertarget_view(ddraw->wined3d_device,
|
||||
0, ddraw_surface_get_rendertarget_view(target), TRUE)))
|
||||
{
|
||||
ERR("Failed to set render target, hr %#x.\n", hr);
|
||||
wined3d_stateblock_decref(device->state);
|
||||
ddraw_handle_table_destroy(&device->handle_table);
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -6081,6 +6081,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
if (ddraw->d3ddevice->recording)
|
||||
wined3d_stateblock_decref(ddraw->d3ddevice->recording);
|
||||
ddraw->d3ddevice->recording = NULL;
|
||||
ddraw->d3ddevice->update_state = ddraw->d3ddevice->state;
|
||||
}
|
||||
|
||||
wined3d_device_set_render_state(ddraw->wined3d_device, WINED3D_RS_ZENABLE,
|
||||
|
|
Loading…
Reference in New Issue