/// <summary> /// Creates render passes. /// </summary> public void Initialize(AttachmentDescription?attrDesc, SubpassDescription [] subDesc) { if (Initialized) { return; } attrDesc = attrDesc ?? DefaultAttachmentDescription; subDesc = subDesc ?? new SubpassDescription[] { DefaultGraphicsSubpass }; Handle = GraphicDevice.Handle.CreateRenderPass ( attrDesc, subDesc, new SubpassDependency[] { new SubpassDependency { SourceSubpass = Constants.SubpassExternal, DestinationSubpass = 0, SourceStageMask = PipelineStageFlags.BottomOfPipe, SourceAccessMask = AccessFlags.MemoryRead, DestinationStageMask = PipelineStageFlags.ColorAttachmentOutput, DestinationAccessMask = AccessFlags.ColorAttachmentRead | AccessFlags.ColorAttachmentWrite }, new SubpassDependency { SourceSubpass = 0, DestinationSubpass = Constants.SubpassExternal, SourceStageMask = PipelineStageFlags.ColorAttachmentOutput, SourceAccessMask = AccessFlags.ColorAttachmentRead | AccessFlags.ColorAttachmentWrite, DestinationStageMask = PipelineStageFlags.BottomOfPipe, DestinationAccessMask = AccessFlags.MemoryRead } } ); base.Initialize(); }
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; }