/***************************************************************************** * IDirect3DVertexBuffer7::Release * * Release for Vertex Buffers * * Returns: * The new refcount * *****************************************************************************/ static ULONG WINAPI d3d_vertex_buffer7_Release(IDirect3DVertexBuffer7 *iface) { struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer7(iface); ULONG ref = InterlockedDecrement(&buffer->ref); TRACE("%p decreasing refcount to %u.\n", buffer, ref); if (ref == 0) { struct wined3d_buffer *curVB = NULL; UINT offset, stride; /* D3D7 Vertex buffers don't stay bound in the device, they are passed * as a parameter to drawPrimitiveVB. DrawPrimitiveVB sets them as the * stream source in wined3d, and they should get unset there before * they are destroyed. */ wined3d_mutex_lock(); wined3d_device_get_stream_source(buffer->ddraw->wined3d_device, 0, &curVB, &offset, &stride); if (curVB == buffer->wineD3DVertexBuffer) wined3d_device_set_stream_source(buffer->ddraw->wined3d_device, 0, NULL, 0, 0); wined3d_vertex_declaration_decref(buffer->wineD3DVertexDeclaration); wined3d_buffer_decref(buffer->wineD3DVertexBuffer); wined3d_mutex_unlock(); HeapFree(GetProcessHeap(), 0, buffer); } return ref; }
/***************************************************************************** * IDirect3DVertexBuffer7::Release * * Release for Vertex Buffers * * Returns: * The new refcount * *****************************************************************************/ static ULONG WINAPI IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface) { IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface; ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", This, ref); if (ref == 0) { struct wined3d_buffer *curVB = NULL; UINT offset, stride; EnterCriticalSection(&ddraw_cs); /* D3D7 Vertex buffers don't stay bound in the device, they are passed * as a parameter to drawPrimitiveVB. DrawPrimitiveVB sets them as the * stream source in wined3d, and they should get unset there before * they are destroyed. */ wined3d_device_get_stream_source(This->ddraw->wined3d_device, 0, &curVB, &offset, &stride); if (curVB == This->wineD3DVertexBuffer) wined3d_device_set_stream_source(This->ddraw->wined3d_device, 0, NULL, 0, 0); if (curVB) wined3d_buffer_decref(curVB); /* For the GetStreamSource */ wined3d_vertex_declaration_decref(This->wineD3DVertexDeclaration); wined3d_buffer_decref(This->wineD3DVertexBuffer); LeaveCriticalSection(&ddraw_cs); HeapFree(GetProcessHeap(), 0, This); return 0; } return ref; }
static ULONG STDMETHODCALLTYPE d3d10_input_layout_Release(ID3D10InputLayout *iface) { struct d3d10_input_layout *This = impl_from_ID3D10InputLayout(iface); ULONG refcount = InterlockedDecrement(&This->refcount); TRACE("%p decreasing refcount to %u\n", This, refcount); if (!refcount) { wined3d_vertex_declaration_decref(This->wined3d_decl); } return refcount; }
static ULONG WINAPI IDirect3DVertexDeclaration8Impl_Release(IDirect3DVertexDeclaration8 *iface) { IDirect3DVertexDeclaration8Impl *This = (IDirect3DVertexDeclaration8Impl *)iface; ULONG ref_count = InterlockedDecrement(&This->ref_count); TRACE("%p decreasing refcount to %u.\n", iface, ref_count); if (!ref_count) { wined3d_mutex_lock(); wined3d_vertex_declaration_decref(This->wined3d_vertex_declaration); wined3d_mutex_unlock(); } return ref_count; }
static ULONG STDMETHODCALLTYPE d3d11_input_layout_Release(ID3D11InputLayout *iface) { struct d3d_input_layout *layout = impl_from_ID3D11InputLayout(iface); ULONG refcount = InterlockedDecrement(&layout->refcount); TRACE("%p decreasing refcount to %u.\n", layout, refcount); if (!refcount) { wined3d_mutex_lock(); wined3d_vertex_declaration_decref(layout->wined3d_decl); wined3d_mutex_unlock(); } return refcount; }