/* * Copyright 2009, 2011 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * */ #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d); ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view) { ULONG refcount = InterlockedIncrement(&view->refcount); TRACE("%p increasing refcount to %u.\n", view, refcount); return refcount; } #if defined(STAGING_CSMT) void wined3d_rendertarget_view_destroy(struct wined3d_rendertarget_view *view) { HeapFree(GetProcessHeap(), 0, view); } #endif /* STAGING_CSMT */ ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view) { ULONG refcount = InterlockedDecrement(&view->refcount); TRACE("%p decreasing refcount to %u.\n", view, refcount); if (!refcount) { #if defined(STAGING_CSMT) struct wined3d_device *device = view->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_resource_decref(view->resource); wined3d_cs_emit_view_destroy(device->cs, view); #else /* STAGING_CSMT */ /* 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_resource_decref(view->resource); HeapFree(GetProcessHeap(), 0, view); #endif /* STAGING_CSMT */ } return refcount; }
ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view) { ULONG refcount = InterlockedDecrement(&view->refcount); TRACE("%p decreasing refcount to %u.\n", view, refcount); if (!refcount) { if (view->object) { const struct wined3d_gl_info *gl_info; struct wined3d_context *context; context = context_acquire(view->resource->device, NULL); gl_info = context->gl_info; gl_info->gl_ops.gl.p_glDeleteTextures(1, &view->object); checkGLcall("glDeleteTextures"); context_release(context); } /* 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_resource_decref(view->resource); HeapFree(GetProcessHeap(), 0, view); } return refcount; }
ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view) { ULONG refcount = InterlockedDecrement(&view->refcount); TRACE("%p decreasing refcount to %u.\n", view, refcount); if (!refcount) { /* 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_resource_decref(view->resource); HeapFree(GetProcessHeap(), 0, view); } return refcount; }
ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view) { ULONG refcount = InterlockedDecrement(&view->refcount); TRACE("%p decreasing refcount to %u.\n", view, refcount); if (!refcount) { struct wined3d_device *device = view->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_resource_decref(view->resource); wined3d_cs_emit_view_destroy(device->cs, view); } return refcount; }