Пример #1
0
        public void Dispose()
        {
            //if (mPresentationLayer != null)
            //{
            //    mPresentationLayer.Dispose();
            //}

            if (mGraphicsDevice != null)
            {
                mGraphicsDevice.Dispose();
            }

            if (mSwapchains != null)
            {
                mSwapchains.Dispose();
            }

            if (mConfiguration != null)
            {
                mConfiguration.Dispose();
            }
        }
Пример #2
0
        public void Dispose()
        {
            if (mGraphicsDevice != null)
            {
                mGraphicsDevice.Dispose();
            }

            if (mSwapchains != null)
            {
                mSwapchains.Dispose();
            }

            if (mConfiguration != null)
            {
                if (PresentComplete != null)
                {
                    PresentComplete.DestroySemaphore(mConfiguration.Device, null);
                }

                if (mConfiguration.Partition != null)
                {
                    var commandPool = mConfiguration.Partition.CommandPool;
                    if (commandPool != null)
                    {
                        if (mPresentBuffers != null)
                        {
                            mConfiguration.Device.FreeCommandBuffers(
                                commandPool,
                                mPresentBuffers);
                            mPresentBuffers = null;
                        }
                    }
                }

                mConfiguration.Dispose();
            }
        }
Пример #3
0
        private void ReleaseUnmanagedResources()
        {
            var device = mConfiguration.Device;

            if (device != null)
            {
                if (mPipeline != null)
                {
                    mPipeline.DestroyPipeline(device, null);
                }

                if (mPipelineLayout != null)
                {
                    mPipelineLayout.DestroyPipelineLayout(device, null);
                }

                if (mDescriptorSetLayout != null)
                {
                    mDescriptorSetLayout.DestroyDescriptorSetLayout(device, null);
                }

                if (vertices.buffer != null)
                {
                    vertices.buffer.DestroyBuffer(device, null);
                }

                if (vertices.memory != null)
                {
                    vertices.memory.FreeMemory(device, null);
                }

                if (indices.buffer != null)
                {
                    indices.buffer.DestroyBuffer(device, null);
                }

                if (indices.memory != null)
                {
                    indices.memory.FreeMemory(device, null);
                }

                if (uniformDataVS.buffer != null)
                {
                    uniformDataVS.buffer.DestroyBuffer(device, null);
                }

                if (uniformDataVS.memory != null)
                {
                    uniformDataVS.memory.FreeMemory(device, null);
                }

                if (mPresentCompleteSemaphore != null)
                {
                    mPresentCompleteSemaphore.DestroySemaphore(device, null);
                }


                if (mRenderCompleteSemaphore != null)
                {
                    mRenderCompleteSemaphore.DestroySemaphore(device, null);
                }

                foreach (var fence in mWaitFences)
                {
                    fence.DestroyFence(device, null);
                }

                if (mDescriptorPool != null)
                {
                    mDescriptorPool.DestroyDescriptorPool(device, null);
                }

                if (drawCmdBuffers != null)
                {
                    mConfiguration.Device.FreeCommandBuffers(mConfiguration.Partition.CommandPool, drawCmdBuffers);
                }

                if (mPostPresentCmdBuffer != null)
                {
                    mConfiguration.Device.FreeCommandBuffers(mConfiguration.Partition.CommandPool, new[] { mPostPresentCmdBuffer });
                }


                if (mPrePresentCmdBuffer != null)
                {
                    mConfiguration.Device.FreeCommandBuffers(mConfiguration.Partition.CommandPool, new[] { mPrePresentCmdBuffer });
                }

                if (mGraphicsDevice != null)
                {
                    mGraphicsDevice.Dispose();
                }
            }
        }
Пример #4
0
        void ReleaseUnmanagedResources()
        {
            var device = mConfiguration.Device;

            if (device != null)
            {
                if (mSetLayout != null)
                {
                    mSetLayout.DestroyDescriptorSetLayout(device, null);
                }

                if (mDescriptorPool != null)
                {
                    if (mUniformDescriptorSet != null)
                    {
                        device.FreeDescriptorSets(mDescriptorPool, new[] { mUniformDescriptorSet });
                    }

                    mDescriptorPool.DestroyDescriptorPool(device, null);
                }

                if (mPresentingCmdBuffers != null)
                {
                    device.FreeCommandBuffers(mConfiguration.Partition.CommandPool, mPresentingCmdBuffers);
                }

                if (mRenderCmdBuffers != null)
                {
                    device.FreeCommandBuffers(mConfiguration.Partition.CommandPool, mRenderCmdBuffers);
                }

                if (mDeviceMemory != null)
                {
                    mDeviceMemory.FreeMemory(device, null);
                }

                if (mBuffer != null)
                {
                    mBuffer.DestroyBuffer(device, null);
                }

                if (mPipelineState != null)
                {
                    mPipelineState.DestroyPipeline(device, null);
                }

                if (mPipelineLayout != null)
                {
                    mPipelineLayout.DestroyPipelineLayout(device, null);
                }
            }

            if (mSwapchains != null)
            {
                mSwapchains.Dispose();
            }

            if (mGraphicsDevice != null)
            {
                mGraphicsDevice.Dispose();
            }
        }