private void createPipelineWrapper() { if (!this.swapchainCleanedUp) { this.Pipeline.Destroy(this); } this.Device.WaitIdle(); var builder = new GraphicsPipelineBuilder(); var support = VkHelper.QuerySwapchainSupport(this.PhysicalDevice, this.Window.VulkanSurface); builder.SetCapabilities(support.capabilities); builder.SetSurfaceFormat(VkHelper.SelectSwapSurfaceFormat(support.formats)); builder.SetPresentMode(VkHelper.SelectSwapPresentMode(support.presentModes)); builder.SetExtent(VkHelper.SelectSwapExtent(support.capabilities, this.Window)); builder.SetGraphicsFamilyQueueIndex(this.vkQueueFamilies.GraphicsFamily.Value); builder.SetPresentFamilyQueueIndex(this.vkQueueFamilies.PresentFamily.Value); builder.SetDescriptorSetLayout(this.DescriptorSetLayout); builder.SetVertexShader(this.VertexShader); builder.SetFragmentShader(this.FragmentShader); builder.SetRenderPassCallback((Vk.CommandBuffer buffer) => { buffer.CmdBindVertexBuffer(0, this.vkVertexBuffer, 0); buffer.CmdBindIndexBuffer(this.vkIndexBuffer, 0, Vk.IndexType.Uint16); buffer.CmdDrawIndexed((uint)this.indices.Count, 1, 0, 0, 0); }); this.Pipeline = builder.Create(this); this.swapchainCleanedUp = false; }
public SwapchainSupportDetails QuerySwapchainSupport(Vk.PhysicalDevice device) => VkHelper.QuerySwapchainSupport(device, this.Window.VulkanSurface);