Exemplo n.º 1
0
        /// <summary>
        /// スワップチェーンが変更された時に呼び出される
        /// </summary>
        /// <param name="device"></param>
        /// <param name="swapChain"></param>
        /// <param name="desc">変更後のスワップチェーン情報</param>
        internal override void OnSwapChainResized(SharpDX.Direct3D11.Device device, SwapChain swapChain, SwapChainDescription desc)
        {
            if (HasRenderTarget)
            {
                if (Is2DTexture)
                {
                    Texture2DDescription d2Desc = m_descTx.D2;

                    m_descTx.D2      = m_swapChainReleasingSave2D.a2DDesc[0];
                    m_aTexture[0].d2 = new Texture2D(App.DXDevice, m_descTx.D2);
                    m_type           = ResourceDimension.Texture2D;;
                    m_aResourceTx[0] = m_aTexture[0].d2;
                    m_createdTxNum   = 1;

                    // 1.レンダーターゲット
                    if (HasRenderTarget)
                    {
                        CreateRenderTargetView(0, m_swapChainReleasingSave2D.aDescRTV[0]);
                    }
                    // 2.シェーダーターゲット
                    if (HasShaderResource)
                    {
                        CreateShaderResourceView(0, m_swapChainReleasingSave2D.descSRV);
                    }
                    // 3.深度ステンシル
                    if (HasDepthStencil)
                    {
                        CreateDepthTexture();
                    }
                    m_swapChainReleasingSave2D = null;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// スワップチェーンが変更される前に呼び出される
        /// </summary>
        internal override void OnSwapChainReleasing()
        {
            if (HasRenderTarget)
            {
                if (Is2DTexture)
                {
                    m_swapChainReleasingSave2D            = new SwapChainReleasingSave2D();
                    m_swapChainReleasingSave2D.a2DDesc[0] = m_descTx.D2;

                    //Utilities.Dispose(ref m_aResourceTx[0]);
                    //Utilities.Dispose(ref m_aTexture[0].d2);

                    // 1.レンダーターゲット
                    if (HasRenderTarget)
                    {
                        if (m_aRenderTargetView[0] == null)
                        {
                            throw new NullReferenceException();
                        }

                        m_swapChainReleasingSave2D.aDescRTV[0] = m_aRenderTargetView[0].Description;
                        //Utilities.Dispose(ref m_aRenderTargetView[0]);
                    }
                    // 2.シェーダーターゲット
                    if (HasShaderResource)
                    {
                        if (m_aTxResourceView[0] == null)
                        {
                            throw new NullReferenceException();
                        }

                        m_swapChainReleasingSave2D.descSRV = m_aTxResourceView[0].Description;
                        //Utilities.Dispose(ref m_aTxResourceView[0]);
                    }
                    // 3.深度ステンシル
                    if (HasDepthStencil)
                    {
                        //Utilities.Dispose(ref m_depthStencilView);
                        //Utilities.Dispose(ref m_resourceDepth);
                        //Utilities.Dispose(ref m_depth.D2);
                    }
                    AllClear();
                }
            }
        }