wined3d: Introduce wined3d_state_reset().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2021-03-15 16:11:35 +01:00 committed by Alexandre Julliard
parent 0ab3adf65a
commit 7dadbc586e
3 changed files with 15 additions and 12 deletions

View File

@ -2079,11 +2079,8 @@ static void wined3d_cs_mt_push_constants(struct wined3d_device_context *context,
static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
{
struct wined3d_adapter *adapter = cs->c.device->adapter;
state_cleanup(&cs->state);
memset(&cs->state, 0, sizeof(cs->state));
state_init(&cs->state, &adapter->d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT);
wined3d_state_reset(&cs->state, &cs->c.device->adapter->d3d_info);
}
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)

View File

@ -1251,8 +1251,7 @@ void wined3d_device_uninit_3d(struct wined3d_device *device)
heap_free(device->swapchains);
device->swapchains = NULL;
memset(state, 0, sizeof(*state));
state_init(state, &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT);
wined3d_state_reset(state, &device->adapter->d3d_info);
}
/* Enables thread safety in the wined3d device and its resources. Called by DirectDraw
@ -5754,8 +5753,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
device->adapter->adapter_ops->adapter_uninit_3d(device);
memset(state, 0, sizeof(*state));
state_init(state, &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT);
wined3d_state_reset(state, &device->adapter->d3d_info);
device_init_swapchain_state(device, swapchain);
if (wined3d_settings.logo)

View File

@ -3710,6 +3710,18 @@ struct wined3d_state
struct wined3d_rasterizer_state *rasterizer_state;
};
void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN;
void state_init(struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info, uint32_t flags) DECLSPEC_HIDDEN;
void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;
static inline void wined3d_state_reset(struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info)
{
uint32_t flags = state->flags;
memset(state, 0, sizeof(*state));
state_init(state, d3d_info, flags);
}
static inline bool wined3d_state_uses_depth_buffer(const struct wined3d_state *state)
{
if (!state->depth_stencil_state)
@ -4639,10 +4651,6 @@ struct wined3d_light_info *wined3d_light_state_get_light(const struct wined3d_li
HRESULT wined3d_light_state_set_light(struct wined3d_light_state *state, DWORD light_idx,
const struct wined3d_light *params, struct wined3d_light_info **light_info) DECLSPEC_HIDDEN;
void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN;
void state_init(struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN;
void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;
enum wined3d_cs_queue_id
{
WINED3D_CS_QUEUE_DEFAULT = 0,