PipelineHelperShader.cs
1 using Silk.NET.Vulkan; 2 using VkFormat = Silk.NET.Vulkan.Format; 3 4 namespace Ryujinx.Graphics.Vulkan 5 { 6 class PipelineHelperShader : PipelineBase 7 { 8 public PipelineHelperShader(VulkanRenderer gd, Device device) : base(gd, device) 9 { 10 } 11 12 public void SetRenderTarget(TextureView view, uint width, uint height) 13 { 14 CreateFramebuffer(view, width, height); 15 CreateRenderPass(); 16 SignalStateChange(); 17 } 18 19 private void CreateFramebuffer(TextureView view, uint width, uint height) 20 { 21 FramebufferParams = new FramebufferParams(Device, view, width, height); 22 UpdatePipelineAttachmentFormats(); 23 } 24 25 public void SetCommandBuffer(CommandBufferScoped cbs) 26 { 27 CommandBuffer = (Cbs = cbs).CommandBuffer; 28 29 // Restore per-command buffer state. 30 31 if (Pipeline != null) 32 { 33 Gd.Api.CmdBindPipeline(CommandBuffer, Pbp, Pipeline.Get(CurrentCommandBuffer).Value); 34 } 35 36 SignalCommandBufferChange(); 37 } 38 39 public void Finish() 40 { 41 EndRenderPass(); 42 } 43 44 public void Finish(VulkanRenderer gd, CommandBufferScoped cbs) 45 { 46 Finish(); 47 48 if (gd.PipelineInternal.IsCommandBufferActive(cbs.CommandBuffer)) 49 { 50 gd.PipelineInternal.Restore(); 51 } 52 } 53 } 54 }