Пример #1
0
 /// <summary>
 /// Handles the BeforeSwapChainResized event of the Swap control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="BeforeSwapChainResizedEventArgs"/> instance containing the event data.</param>
 private static void Swap_BeforeSwapChainResized(object sender, BeforeSwapChainResizedEventArgs e)
 {
     // Before we go about resizing the render target, we need to ensure the depth stencil is removed so that we don't end up with a depth/stencil still
     // attached that's not matched to the size of the render target.
     _graphics.SetDepthStencil(null);
     _depthStencil?.Dispose();
 }
Пример #2
0
 /// <summary>
 /// Function called before a swap chain is resized.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="BeforeSwapChainResizedEventArgs"/> instance containing the event data.</param>
 private void BeforeSwapChainResized(object sender, BeforeSwapChainResizedEventArgs e)
 {
     // Copy the render target texture to a temporary buffer and resize the main buffer.
     // The copy the temporary buffer back to the main buffer.
     _backBuffer.Texture.CopyTo(_backupImage, new DX.Rectangle(0, 0, e.NewSize.Width, e.NewSize.Height));
     _backBufferView.Dispose();
     _backBuffer.Dispose();
 }
Пример #3
0
        /// <summary>
        /// Handles the BeforeSwapChainResized event of the Screen control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="BeforeSwapChainResizedEventArgs"/> instance containing the event data.</param>
        private static void Screen_BeforeSwapChainResized(object sender, BeforeSwapChainResizedEventArgs e)
        {
            _postView1?.Dispose();
            _postTarget1?.Dispose();

            _postView2?.Dispose();
            _postTarget2?.Dispose();

            _finalView?.Dispose();
            _finalTarget?.Dispose();
        }
Пример #4
0
 /// <summary>
 /// Screens the before swap chain resized.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="BeforeSwapChainResizedEventArgs" /> instance containing the event data.</param>
 private static void Screen_BeforeSwapChainResized(object sender, BeforeSwapChainResizedEventArgs e)
 {
     // Need to remove these prior to resizing the back buffer, otherwise the size will be mismatched.
     _finalTexture?.Dispose();
     _finalTarget?.Dispose();
 }
Пример #5
0
 /// <summary>
 /// Handles the BeforeResize event of the swap chain.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="BeforeSwapChainResizedEventArgs" /> instance containing the event data.</param>
 private static void Swap_BeforeResized(object sender, BeforeSwapChainResizedEventArgs e) => _graphics.SetDepthStencil(null);