[PATCH 3/5] wined3d: Introduce a separate function for cleaning up a wined3d_state structure.
Henri Verbeet
hverbeet at codeweavers.com
Mon Aug 26 02:23:39 CDT 2013
---
dlls/wined3d/stateblock.c | 38 ++++++++++++++++++++++----------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 3685a2e..8abd8e5 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -588,6 +588,27 @@ void state_unbind_resources(struct wined3d_state *state)
}
}
+static void state_cleanup(struct wined3d_state *state)
+{
+ unsigned int counter;
+
+ state_unbind_resources(state);
+
+ for (counter = 0; counter < LIGHTMAP_SIZE; ++counter)
+ {
+ struct list *e1, *e2;
+ LIST_FOR_EACH_SAFE(e1, e2, &state->light_map[counter])
+ {
+ struct wined3d_light_info *light = LIST_ENTRY(e1, struct wined3d_light_info, entry);
+ list_remove(&light->entry);
+ HeapFree(GetProcessHeap(), 0, light);
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, state->vs_consts_f);
+ HeapFree(GetProcessHeap(), 0, state->ps_consts_f);
+}
+
ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
{
ULONG refcount = InterlockedDecrement(&stateblock->ref);
@@ -596,24 +617,9 @@ ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
if (!refcount)
{
- int counter;
-
- state_unbind_resources(&stateblock->state);
-
- for (counter = 0; counter < LIGHTMAP_SIZE; ++counter)
- {
- struct list *e1, *e2;
- LIST_FOR_EACH_SAFE(e1, e2, &stateblock->state.light_map[counter])
- {
- struct wined3d_light_info *light = LIST_ENTRY(e1, struct wined3d_light_info, entry);
- list_remove(&light->entry);
- HeapFree(GetProcessHeap(), 0, light);
- }
- }
+ state_cleanup(&stateblock->state);
- HeapFree(GetProcessHeap(), 0, stateblock->state.vs_consts_f);
HeapFree(GetProcessHeap(), 0, stateblock->changed.vertexShaderConstantsF);
- HeapFree(GetProcessHeap(), 0, stateblock->state.ps_consts_f);
HeapFree(GetProcessHeap(), 0, stateblock->changed.pixelShaderConstantsF);
HeapFree(GetProcessHeap(), 0, stateblock->contained_vs_consts_f);
HeapFree(GetProcessHeap(), 0, stateblock->contained_ps_consts_f);
--
1.8.1.5
More information about the wine-patches
mailing list