Commit 7163cb05 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Make blend state cleanup more consistent with samplers cleanup.

parent e11ae91b
...@@ -525,11 +525,11 @@ static void device_leftover_rasterizer_state(struct wine_rb_entry *entry, void * ...@@ -525,11 +525,11 @@ static void device_leftover_rasterizer_state(struct wine_rb_entry *entry, void *
ERR("Leftover rasterizer state %p.\n", state); ERR("Leftover rasterizer state %p.\n", state);
} }
static void device_free_blend_state(struct wine_rb_entry *entry, void *context) static void device_leftover_blend_state(struct wine_rb_entry *entry, void *context)
{ {
struct wined3d_blend_state *state = WINE_RB_ENTRY_VALUE(entry, struct wined3d_blend_state, entry); struct wined3d_blend_state *blend_state = WINE_RB_ENTRY_VALUE(entry, struct wined3d_blend_state, entry);
wined3d_blend_state_decref(state); ERR("Leftover blend state %p.\n", blend_state);
} }
void wined3d_device_cleanup(struct wined3d_device *device) void wined3d_device_cleanup(struct wined3d_device *device)
...@@ -539,8 +539,6 @@ void wined3d_device_cleanup(struct wined3d_device *device) ...@@ -539,8 +539,6 @@ void wined3d_device_cleanup(struct wined3d_device *device)
if (device->swapchain_count) if (device->swapchain_count)
wined3d_device_uninit_3d(device); wined3d_device_uninit_3d(device);
wine_rb_destroy(&device->blend_states, device_free_blend_state, NULL);
wined3d_cs_destroy(device->cs); wined3d_cs_destroy(device->cs);
for (i = 0; i < ARRAY_SIZE(device->multistate_funcs); ++i) for (i = 0; i < ARRAY_SIZE(device->multistate_funcs); ++i)
...@@ -570,6 +568,7 @@ void wined3d_device_cleanup(struct wined3d_device *device) ...@@ -570,6 +568,7 @@ void wined3d_device_cleanup(struct wined3d_device *device)
wine_rb_destroy(&device->samplers, device_leftover_sampler, NULL); wine_rb_destroy(&device->samplers, device_leftover_sampler, NULL);
wine_rb_destroy(&device->rasterizer_states, device_leftover_rasterizer_state, NULL); wine_rb_destroy(&device->rasterizer_states, device_leftover_rasterizer_state, NULL);
wine_rb_destroy(&device->blend_states, device_leftover_blend_state, NULL);
wined3d_decref(device->wined3d); wined3d_decref(device->wined3d);
device->wined3d = NULL; device->wined3d = NULL;
...@@ -1118,6 +1117,13 @@ static void device_free_rasterizer_state(struct wine_rb_entry *entry, void *cont ...@@ -1118,6 +1117,13 @@ static void device_free_rasterizer_state(struct wine_rb_entry *entry, void *cont
wined3d_rasterizer_state_decref(state); wined3d_rasterizer_state_decref(state);
} }
static void device_free_blend_state(struct wine_rb_entry *entry, void *context)
{
struct wined3d_blend_state *blend_state = WINE_RB_ENTRY_VALUE(entry, struct wined3d_blend_state, entry);
wined3d_blend_state_decref(blend_state);
}
void wined3d_device_uninit_3d(struct wined3d_device *device) void wined3d_device_uninit_3d(struct wined3d_device *device)
{ {
BOOL no3d = device->wined3d->flags & WINED3D_NO3D; BOOL no3d = device->wined3d->flags & WINED3D_NO3D;
...@@ -1159,6 +1165,7 @@ void wined3d_device_uninit_3d(struct wined3d_device *device) ...@@ -1159,6 +1165,7 @@ void wined3d_device_uninit_3d(struct wined3d_device *device)
wine_rb_clear(&device->samplers, device_free_sampler, NULL); wine_rb_clear(&device->samplers, device_free_sampler, NULL);
wine_rb_clear(&device->rasterizer_states, device_free_rasterizer_state, NULL); wine_rb_clear(&device->rasterizer_states, device_free_rasterizer_state, NULL);
wine_rb_clear(&device->blend_states, device_free_blend_state, NULL);
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{ {
...@@ -5336,6 +5343,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, ...@@ -5336,6 +5343,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wine_rb_clear(&device->samplers, device_free_sampler, NULL); wine_rb_clear(&device->samplers, device_free_sampler, NULL);
wine_rb_clear(&device->rasterizer_states, device_free_rasterizer_state, NULL); wine_rb_clear(&device->rasterizer_states, device_free_rasterizer_state, NULL);
wine_rb_clear(&device->blend_states, device_free_blend_state, NULL);
if (reset_state) if (reset_state)
{ {
......
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