public SwapChain(IDXGISwapChain *swapChain, DeviceConfiguration config) { Vsync = config.Vsync; Width = config.Width; Height = config.Height; _swapChain = new ComPtr <IDXGISwapChain>(swapChain); _syncInterval = Vsync ? 1u : 0u; }
protected override void CreateWindowSizeDependentResources() { if (_swapChain != null) { ThrowIfFailed(_swapChain->ResizeBuffers(FrameCount, (uint)Size.Width, (uint)Size.Height, BackBufferFormat, 0)); } else { _swapChain = CreateSwapChain(); } CreateResourceViews(); _viewport = new D3D11_VIEWPORT { TopLeftX = 0, TopLeftY = 0, Width = Size.Width, Height = Size.Height, MinDepth = D3D11_MIN_DEPTH, MaxDepth = D3D11_MAX_DEPTH }; _scissorRect = new RECT { left = 0, top = 0, right = Size.Width, bottom = Size.Height }; IDXGISwapChain *CreateSwapChain() { var swapChainDesc = new DXGI_SWAP_CHAIN_DESC { BufferDesc = new DXGI_MODE_DESC { Width = (uint)Size.Width, Height = (uint)Size.Height, Format = BackBufferFormat, }, SampleDesc = new DXGI_SAMPLE_DESC { Count = 1 }, BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT, BufferCount = FrameCount, OutputWindow = Hwnd, Windowed = TRUE, SwapEffect = DXGI_SWAP_EFFECT_DISCARD, }; IDXGISwapChain *swapChain; ThrowIfFailed(DxgiFactory->CreateSwapChain((IUnknown *)D3DDevice, &swapChainDesc, &swapChain)); return(swapChain); } }
protected override void DestroyWindowSizeDependentResources() { DestroyResourceViews(); DestroySwapChain(); void DestroySwapChain() { var swapChain = _swapChain; if (swapChain != null) { _swapChain = null; _ = swapChain->Release(); } } }
protected override void Dispose(bool isDisposing) { var swapChain = _swapChain; if (swapChain != null) { _swapChain = null; _ = swapChain->Release(); } var immediateContext = _immediateContext; if (immediateContext != null) { _immediateContext = null; _ = immediateContext->Release(); } var device = _device; if (device != null) { _device = null; _ = device->Release(); } var renderTarget = _renderTarget; if (renderTarget != null) { _renderTarget = null; _ = renderTarget->Release(); } base.Dispose(isDisposing); }
public int SetSwapChain([NativeTypeName("IDXGISwapChain *")] IDXGISwapChain *swapChain) { return(((delegate * unmanaged <ISwapChainPanelNative2 *, IDXGISwapChain *, int>)(lpVtbl[3]))((ISwapChainPanelNative2 *)Unsafe.AsPointer(ref this), swapChain)); }
public HRESULT SetSwapChain(IDXGISwapChain *swapChain) { return(((delegate * unmanaged <ISwapChainPanelNative2 *, IDXGISwapChain *, int>)(lpVtbl[3]))((ISwapChainPanelNative2 *)Unsafe.AsPointer(ref this), swapChain)); }
public HRESULT SetSwapChain(IDXGISwapChain *pSwapChain) { return(((delegate * unmanaged <ID3D11Debug *, IDXGISwapChain *, int>)(lpVtbl[7]))((ID3D11Debug *)Unsafe.AsPointer(ref this), pSwapChain)); }
public int SetSwapChain([NativeTypeName("IDXGISwapChain *")] IDXGISwapChain *pSwapChain) { return(((delegate * unmanaged <ID3D11Debug *, IDXGISwapChain *, int>)(lpVtbl[7]))((ID3D11Debug *)Unsafe.AsPointer(ref this), pSwapChain)); }
protected override void Dispose(bool isDisposing) { var vertexBuffer = _vertexBuffer; if (vertexBuffer != null) { _vertexBuffer = null; _ = vertexBuffer->Release(); } var inputLayout = _inputLayout; if (inputLayout != null) { _inputLayout = null; _ = inputLayout->Release(); } var pixelShader = _pixelShader; if (pixelShader != null) { _pixelShader = null; _ = pixelShader->Release(); } var vertexShader = _vertexShader; if (vertexShader != null) { _vertexShader = null; _ = vertexShader->Release(); } var swapChain = _swapChain; if (swapChain != null) { _swapChain = null; _ = swapChain->Release(); } var immediateContext = _immediateContext; if (immediateContext != null) { _immediateContext = null; _ = immediateContext->Release(); } var device = _device; if (device != null) { _device = null; _ = device->Release(); } var renderTarget = _renderTarget; if (renderTarget != null) { _renderTarget = null; _ = renderTarget->Release(); } base.Dispose(isDisposing); }
public int SetSwapChain(IDXGISwapChain *swapChain) { return(((delegate * unmanaged <ISwapChainBackgroundPanelNative *, IDXGISwapChain *, int>)(lpVtbl[3]))((ISwapChainBackgroundPanelNative *)Unsafe.AsPointer(ref this), swapChain)); }