Пример #1
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();
                }
            }
        }
Пример #2
0
        void ReleaseManagedResources()
        {
            // Clean up used Vulkan resources
            // Note : Inherited destructor cleans up resources stored in base class

            destroyTextureImage(texture);

            if (mManager != null)
            {
                Debug.Assert(mManager.Configuration != null);
                var device = mManager.Configuration.Device;

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

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

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

                if (vertexBuffer != null)
                {
                    vertexBuffer.Destroy();
                }

                if (indexBuffer != null)
                {
                    indexBuffer.Destroy();
                }

                if (uniformBufferVS != null)
                {
                    uniformBufferVS.Destroy();
                }

                if (mManager.Configuration.Partition.CommandPool != null)
                {
                    device.FreeCommandBuffers(
                        mManager.Configuration.Partition.CommandPool,
                        mPresentBuffers);

                    if (drawCmdBuffers != null)
                    {
                        device.FreeCommandBuffers(
                            mManager.Configuration.Partition.CommandPool,
                            drawCmdBuffers);
                    }
                }

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

                    mDescriptorPool.DestroyDescriptorPool(device, null);
                }
            }
            mManager.Dispose();
        }
Пример #3
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();
            }
        }