Пример #1
0
static ULONG STDMETHODCALLTYPE dxgi_device_Release(IWineDXGIDevice *iface)
{
    struct dxgi_device *This = impl_from_IWineDXGIDevice(iface);
    ULONG refcount = InterlockedDecrement(&This->refcount);

    TRACE("%p decreasing refcount to %u\n", This, refcount);

    if (!refcount)
    {
        if (This->child_layer) IUnknown_Release(This->child_layer);
        wined3d_mutex_lock();
        wined3d_device_uninit_3d(This->wined3d_device);
        wined3d_device_decref(This->wined3d_device);
        wined3d_mutex_unlock();
        IDXGIFactory1_Release(This->factory);
        wined3d_private_store_cleanup(&This->private_store);
        HeapFree(GetProcessHeap(), 0, This);
    }

    return refcount;
}
Пример #2
0
static ULONG STDMETHODCALLTYPE dxgi_swapchain_Release(IDXGISwapChain *iface)
{
    struct dxgi_swapchain *This = impl_from_IDXGISwapChain(iface);
    ULONG refcount = InterlockedDecrement(&This->refcount);

    TRACE("%p decreasing refcount to %u\n", This, refcount);

    if (!refcount)
    {
        struct wined3d_device *wined3d_device;
        HRESULT hr;

        FIXME("Only a single swapchain is supported\n");

        wined3d_device = wined3d_swapchain_get_device(This->wined3d_swapchain);
        hr = wined3d_device_uninit_3d(wined3d_device);
        if (FAILED(hr))
        {
            ERR("Uninit3D failed, hr %#x\n", hr);
        }
    }

    return refcount;
}