コード例 #1
0
ファイル: AppWindow.cs プロジェクト: YaakovDavis/VorticeImGui
        void resize()
        {
            if (renderView == null)//first show
            {
                var dxgiFactory = device.QueryInterface <IDXGIDevice>().GetParent <IDXGIAdapter>().GetParent <IDXGIFactory>();

                var swapchainDesc = new SwapChainDescription()
                {
                    BufferCount       = 1,
                    BufferDescription = new ModeDescription(Win32Window.Width, Win32Window.Height, format),
                    IsWindowed        = true,
                    OutputWindow      = Win32Window.Handle,
                    SampleDescription = new SampleDescription(1, 0),
                    SwapEffect        = SwapEffect.Discard,
                    Usage             = Vortice.DXGI.Usage.RenderTargetOutput
                };

                swapChain = dxgiFactory.CreateSwapChain(device, swapchainDesc);
                dxgiFactory.MakeWindowAssociation(Win32Window.Handle, WindowAssociationFlags.IgnoreAll);

                backBuffer = swapChain.GetBuffer <ID3D11Texture2D>(0);
                renderView = device.CreateRenderTargetView(backBuffer);
            }
            else
            {
                renderView.Dispose();
                backBuffer.Dispose();

                swapChain.ResizeBuffers(1, Win32Window.Width, Win32Window.Height, format, SwapChainFlags.None);

                backBuffer = swapChain.GetBuffer <ID3D11Texture2D1>(0);
                renderView = device.CreateRenderTargetView(backBuffer);
            }
        }
コード例 #2
0
    public void Dispose()
    {
        _vertexBuffer.Dispose();
        _vertexShader.Dispose();
        _pixelShader.Dispose();
        _inputLayout.Dispose();

        BackBufferTexture?.Dispose();
        OffscreenTexture?.Dispose();
        RenderTargetView.Dispose();
        DepthStencilTexture?.Dispose();
        DepthStencilView?.Dispose();

        DeviceContext.ClearState();
        DeviceContext.Flush();
        DeviceContext.Dispose();
        Device.Dispose();
        SwapChain?.Dispose();
        Factory.Dispose();

#if DEBUG
        if (DXGIGetDebugInterface1(out IDXGIDebug1? dxgiDebug).Success)
        {
            dxgiDebug !.ReportLiveObjects(DebugAll, ReportLiveObjectFlags.Summary | ReportLiveObjectFlags.IgnoreInternal);
            dxgiDebug !.Dispose();
        }
#endif
    }
コード例 #3
0
 public void Dispose()
 {
     RenderTargetView.Dispose();
     BackBuffer.Dispose();
     DeviceContext.ClearState();
     DeviceContext.Flush();
     DeviceContext.Dispose();
     Device.Dispose();
     SwapChain.Dispose();
     Factory.Dispose();
 }
コード例 #4
0
        public void Dispose()
        {
            RenderTargetView.Dispose();
            BackBuffer.Dispose();
            DeviceContext.ClearState();
            DeviceContext.Flush();
            DeviceContext.Dispose();
            Device.Dispose();
            SwapChain.Dispose();
            Factory.Dispose();

            if (DXGIGetDebugInterface1(out IDXGIDebug1 dxgiDebug).Success)
            {
                dxgiDebug.ReportLiveObjects(All, ReportLiveObjectFlags.Summary | ReportLiveObjectFlags.IgnoreInternal);
                dxgiDebug.Dispose();
            }
        }
コード例 #5
0
        public void Dispose()
        {
            BackBufferTexture?.Dispose();
            OffscreenTexture?.Dispose();
            RenderTargetView.Dispose();
            DeviceContext.ClearState();
            DeviceContext.Flush();
            DeviceContext.Dispose();
            Device.Dispose();
            SwapChain.Dispose();
            Factory?.Dispose();

            if (DXGIGetDebugInterface1(out IDXGIDebug1? dxgiDebug).Success)
            {
                dxgiDebug !.ReportLiveObjects(DebugAll, ReportLiveObjectFlags.Summary | ReportLiveObjectFlags.IgnoreInternal);
                dxgiDebug !.Dispose();
            }
        }
コード例 #6
0
    public void Dispose()
    {
        _vertexBuffer.Dispose();
        _vertexShader.Dispose();
        _pixelShader.Dispose();
        _inputLayout.Dispose();

        BackBufferTexture?.Dispose();
        OffscreenTexture?.Dispose();
        RenderTargetView.Dispose();
        DepthStencilTexture?.Dispose();
        DepthStencilView?.Dispose();

        DeviceContext.ClearState();
        DeviceContext.Flush();
        DeviceContext.Dispose();
        SwapChain?.Dispose();

#if DEBUG
        uint refCount = Device.Release();
        if (refCount > 0)
        {
            System.Diagnostics.Debug.WriteLine($"Direct3D11: There are {refCount} unreleased references left on the device");

            ID3D11Debug?d3d11Debug = Device.QueryInterfaceOrNull <ID3D11Debug>();
            if (d3d11Debug != null)
            {
                d3d11Debug.ReportLiveDeviceObjects(ReportLiveDeviceObjectFlags.Detail | ReportLiveDeviceObjectFlags.IgnoreInternal);
                d3d11Debug.Dispose();
            }
        }
#else
        Device.Dispose();
#endif
        Factory.Dispose();

#if DEBUG
        if (DXGIGetDebugInterface1(out IDXGIDebug1? dxgiDebug).Success)
        {
            dxgiDebug !.ReportLiveObjects(DebugAll, ReportLiveObjectFlags.Summary | ReportLiveObjectFlags.IgnoreInternal);
            dxgiDebug !.Dispose();
        }
#endif
    }
コード例 #7
0
 public void Dispose()
 {
     RenderTargetView?.Dispose();
     DepthStencilView?.Dispose();
 }
コード例 #8
0
ファイル: RenderTarget.cs プロジェクト: Golle/GameDev
 public void Dispose()
 {
     _renderTarget.Dispose();
 }