Module: wine Branch: master Commit: c84112f86fd336c4813e4b6c677492604481d0a2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c84112f86fd336c4813e4b6c67...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon Jul 25 20:45:07 2011 +0200
wined3d: Get rid of wined3d_device_enum_resources().
---
dlls/wined3d/device.c | 71 +++++++++++++++++---------------------------- dlls/wined3d/wined3d.spec | 1 - include/wine/wined3d.h | 2 - 3 files changed, 27 insertions(+), 47 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 89dfb6c..e411cea 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1372,17 +1372,9 @@ err_out: return hr; }
-static HRESULT WINAPI device_unload_resource(struct wined3d_resource *resource, void *data) -{ - TRACE("Unloading resource %p.\n", resource); - - resource->resource_ops->resource_unload(resource); - - return S_OK; -} - HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) { + struct wined3d_resource *resource, *cursor; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; struct wined3d_surface *surface; @@ -1406,7 +1398,12 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) wined3d_surface_decref(device->logo_surface);
/* Unload resources */ - wined3d_device_enum_resources(device, device_unload_resource, NULL); + LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) + { + TRACE("Unloading resource %p.\n", resource); + + resource->resource_ops->resource_unload(resource); + }
TRACE("Deleting high order patches\n"); for(i = 0; i < PATCHMAP_SIZE; i++) { @@ -5382,24 +5379,23 @@ BOOL CDECL wined3d_device_show_cursor(struct wined3d_device *device, BOOL show) return oldVisible; }
-static HRESULT WINAPI evict_managed_resource(struct wined3d_resource *resource, void *data) +HRESULT CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) { - TRACE("checking resource %p for eviction\n", resource); + struct wined3d_resource *resource, *cursor;
- if (resource->pool == WINED3DPOOL_MANAGED) - { - TRACE("Evicting %p.\n", resource); - resource->resource_ops->resource_unload(resource); - } + TRACE("device %p.\n", device);
- return S_OK; -} + LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) + { + TRACE("Checking resource %p for eviction.\n", resource);
-HRESULT CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) -{ - TRACE("device %p.\n", device); + if (resource->pool == WINED3DPOOL_MANAGED) + { + TRACE("Evicting %p.\n", resource); + resource->resource_ops->resource_unload(resource); + } + }
- wined3d_device_enum_resources(device, evict_managed_resource, NULL); /* Invalidate stream sources, the buffer(s) may have been evicted. */ device_invalidate_state(device, STATE_STREAMSRC);
@@ -5499,6 +5495,7 @@ static BOOL is_display_mode_supported(struct wined3d_device *device, const WINED /* Do not call while under the GL lock. */ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { + struct wined3d_resource *resource, *cursor; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; struct wined3d_shader *shader; @@ -5506,7 +5503,13 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d context = context_acquire(device, NULL); gl_info = context->gl_info;
- wined3d_device_enum_resources(device, device_unload_resource, NULL); + LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) + { + TRACE("Unloading resource %p.\n", resource); + + resource->resource_ops->resource_unload(resource); + } + LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry) { device->shader_backend->shader_destroy(shader); @@ -6058,26 +6061,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso TRACE("Resource released.\n"); }
-HRESULT CDECL wined3d_device_enum_resources(struct wined3d_device *device, - D3DCB_ENUMRESOURCES callback, void *data) -{ - struct wined3d_resource *resource, *cursor; - - TRACE("device %p, callback %p, data %p.\n", device, callback, data); - - LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) - { - TRACE("enumerating resource %p.\n", resource); - if (callback(resource, data) == S_FALSE) - { - TRACE("Canceling enumeration.\n"); - break; - } - } - - return WINED3D_OK; -} - HRESULT CDECL wined3d_device_get_surface_from_dc(struct wined3d_device *device, HDC dc, struct wined3d_surface **surface) { diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index fd3809e..fedee3c 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -60,7 +60,6 @@ @ cdecl wined3d_device_draw_tri_patch(ptr long ptr ptr) @ cdecl wined3d_device_end_scene(ptr) @ cdecl wined3d_device_end_stateblock(ptr ptr) -@ cdecl wined3d_device_enum_resources(ptr ptr ptr) @ cdecl wined3d_device_evict_managed_resources(ptr) @ cdecl wined3d_device_get_available_texture_mem(ptr) @ cdecl wined3d_device_get_back_buffer(ptr long long long ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 211b945..0a09ec6 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2107,7 +2107,6 @@ struct wined3d_device_parent_ops WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain); };
-typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(struct wined3d_resource *resource, void *pData); typedef HRESULT (CDECL *wined3d_device_reset_cb)(struct wined3d_resource *resource);
void __stdcall wined3d_mutex_lock(void); @@ -2205,7 +2204,6 @@ HRESULT __cdecl wined3d_device_draw_tri_patch(struct wined3d_device *device, UIN const float *num_segs, const WINED3DTRIPATCH_INFO *tri_patch_info); HRESULT __cdecl wined3d_device_end_scene(struct wined3d_device *device); HRESULT __cdecl wined3d_device_end_stateblock(struct wined3d_device *device, struct wined3d_stateblock **stateblock); -HRESULT __cdecl wined3d_device_enum_resources(struct wined3d_device *device, D3DCB_ENUMRESOURCES callback, void *data); HRESULT __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device); UINT __cdecl wined3d_device_get_available_texture_mem(struct wined3d_device *device); HRESULT __cdecl wined3d_device_get_back_buffer(struct wined3d_device *device, UINT swapchain_idx,