Commit 7dadbc58 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Introduce wined3d_state_reset().

parent 0ab3adf6
...@@ -2079,11 +2079,8 @@ static void wined3d_cs_mt_push_constants(struct wined3d_device_context *context, ...@@ -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) 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); state_cleanup(&cs->state);
memset(&cs->state, 0, sizeof(cs->state)); wined3d_state_reset(&cs->state, &cs->c.device->adapter->d3d_info);
state_init(&cs->state, &adapter->d3d_info, WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT);
} }
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
......
...@@ -1251,8 +1251,7 @@ void wined3d_device_uninit_3d(struct wined3d_device *device) ...@@ -1251,8 +1251,7 @@ void wined3d_device_uninit_3d(struct wined3d_device *device)
heap_free(device->swapchains); heap_free(device->swapchains);
device->swapchains = NULL; device->swapchains = NULL;
memset(state, 0, sizeof(*state)); wined3d_state_reset(state, &device->adapter->d3d_info);
state_init(state, &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT);
} }
/* Enables thread safety in the wined3d device and its resources. Called by DirectDraw /* 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, ...@@ -5754,8 +5753,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
device->adapter->adapter_ops->adapter_uninit_3d(device); device->adapter->adapter_ops->adapter_uninit_3d(device);
memset(state, 0, sizeof(*state)); wined3d_state_reset(state, &device->adapter->d3d_info);
state_init(state, &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT);
device_init_swapchain_state(device, swapchain); device_init_swapchain_state(device, swapchain);
if (wined3d_settings.logo) if (wined3d_settings.logo)
......
...@@ -3710,6 +3710,18 @@ struct wined3d_state ...@@ -3710,6 +3710,18 @@ struct wined3d_state
struct wined3d_rasterizer_state *rasterizer_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) static inline bool wined3d_state_uses_depth_buffer(const struct wined3d_state *state)
{ {
if (!state->depth_stencil_state) if (!state->depth_stencil_state)
...@@ -4639,10 +4651,6 @@ struct wined3d_light_info *wined3d_light_state_get_light(const struct wined3d_li ...@@ -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, 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; 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 enum wined3d_cs_queue_id
{ {
WINED3D_CS_QUEUE_DEFAULT = 0, WINED3D_CS_QUEUE_DEFAULT = 0,
......
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