Пример #1
0
        private void CreateDescriptorSet()
        {
            this.descriptorSet = this.device.AllocateDescriptorSets(new DescriptorSetAllocateInfo
            {
                DescriptorPool = this.descriptorPool,
                SetLayouts     = new[]
                {
                    this.descriptorSetLayout
                }
            }).Single();

            this.device.UpdateDescriptorSets(
                new WriteDescriptorSet
            {
                BufferInfo = new[]
                {
                    new DescriptorBufferInfo
                    {
                        Buffer = this.uniformBuffer,
                        Offset = 0,
                        Range  = MemUtil.SizeOf <UniformBufferObject>()
                    }
                },
                DestinationSet          = this.descriptorSet,
                DestinationBinding      = 0,
                DestinationArrayElement = 0,
                DescriptorType          = DescriptorType.UniformBuffer
            }, null);
        }
Пример #2
0
        private void TearDown()
        {
            device.WaitIdle();

            this.renderFinishedSemaphore.Dispose();
            this.renderFinishedSemaphore = null;

            this.imageAvailableSemaphore.Dispose();
            this.imageAvailableSemaphore = null;

            this.descriptorPool.Dispose();
            this.descriptorPool = null;
            this.descriptorSet  = null;

            this.device.FreeMemory(this.uniformBufferMemory);
            this.uniformBufferMemory = null;

            this.uniformBuffer.Dispose();
            this.uniformBuffer = null;

            this.device.FreeMemory(this.uniformStagingBufferMemory);
            this.uniformStagingBufferMemory = null;

            this.uniformStagingBuffer.Dispose();
            this.uniformStagingBuffer = null;

            this.device.FreeMemory(this.indexBufferMemory);
            this.indexBufferMemory = null;

            this.indexBuffer.Dispose();
            this.indexBuffer = null;

            this.device.FreeMemory(this.vertexBufferMemory);
            this.vertexBufferMemory = null;

            this.vertexBuffer.Dispose();
            this.vertexBuffer = null;

            this.commandPool.Dispose();
            this.commandPool    = null;
            this.commandBuffers = null;
            this.transientCommandPool.Dispose();
            this.transientCommandPool = null;

            foreach (var frameBuffer in this.frameBuffers)
            {
                frameBuffer.Dispose();
            }
            this.frameBuffers = null;

            this.pipeline.Dispose();
            this.pipeline = null;

            this.pipelineLayout.Dispose();
            this.pipelineLayout = null;

            foreach (var imageView in this.swapChainImageViews)
            {
                imageView.Dispose();
            }
            this.swapChainImageViews = null;

            this.descriptorSetLayout.Dispose();
            this.descriptorSetLayout = null;

            this.renderPass.Dispose();
            this.renderPass = null;

            this.swapChain.Dispose();
            this.swapChain = null;

            this.device.Dispose();
            this.device = null;

            this.surface.Dispose();
            this.surface = null;

            this.debugCallback.Dispose();
            this.debugCallback = null;

            this.instance.Dispose();
            this.instance = null;
        }