ULONG CDECL wined3d_palette_decref(struct wined3d_palette *palette) { ULONG refcount = InterlockedDecrement(&palette->ref); TRACE("%p decreasing refcount to %u.\n", palette, refcount); if (!refcount) wined3d_cs_destroy_object(palette->device->cs, wined3d_palette_destroy_object, palette); return refcount; }
ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler) { ULONG refcount = InterlockedDecrement(&sampler->refcount); TRACE("%p decreasing refcount to %u.\n", sampler, refcount); if (!refcount) { sampler->parent_ops->wined3d_object_destroyed(sampler->parent); wined3d_cs_destroy_object(sampler->device->cs, wined3d_sampler_destroy_object, sampler); } return refcount; }
void resource_cleanup(struct wined3d_resource *resource) { const struct wined3d *d3d = resource->device->wined3d; TRACE("Cleaning up resource %p.\n", resource); if (!(resource->usage & WINED3DUSAGE_PRIVATE)) { if (resource->pool == WINED3D_POOL_DEFAULT && d3d->flags & WINED3D_VIDMEM_ACCOUNTING) { TRACE("Decrementing device memory pool by %u.\n", resource->size); adapter_adjust_memory(resource->device->adapter, (INT64)0 - resource->size); } device_resource_released(resource->device, resource); } wined3d_resource_acquire(resource); wined3d_cs_destroy_object(resource->device->cs, wined3d_resource_destroy_object, resource); }
ULONG CDECL wined3d_unordered_access_view_decref(struct wined3d_unordered_access_view *view) { ULONG refcount = InterlockedDecrement(&view->refcount); TRACE("%p decreasing refcount to %u.\n", view, refcount); if (!refcount) { struct wined3d_resource *resource = view->resource; struct wined3d_device *device = resource->device; /* Call wined3d_object_destroyed() before releasing the resource, * since releasing the resource may end up destroying the parent. */ view->parent_ops->wined3d_object_destroyed(view->parent); wined3d_cs_destroy_object(device->cs, wined3d_unordered_access_view_destroy_object, view); wined3d_resource_decref(resource); } return refcount; }