PipelineHelperShader.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Silk.NET.Vulkan;
  2. using VkFormat = Silk.NET.Vulkan.Format;
  3. namespace Ryujinx.Graphics.Vulkan
  4. {
  5. class PipelineHelperShader : PipelineBase
  6. {
  7. public PipelineHelperShader(VulkanRenderer gd, Device device) : base(gd, device)
  8. {
  9. }
  10. public void SetRenderTarget(Auto<DisposableImageView> view, uint width, uint height, bool isDepthStencil, VkFormat format)
  11. {
  12. CreateFramebuffer(view, width, height, isDepthStencil, format);
  13. CreateRenderPass();
  14. SignalStateChange();
  15. }
  16. private void CreateFramebuffer(Auto<DisposableImageView> view, uint width, uint height, bool isDepthStencil, VkFormat format)
  17. {
  18. FramebufferParams = new FramebufferParams(Device, view, width, height, isDepthStencil, format);
  19. UpdatePipelineAttachmentFormats();
  20. }
  21. public void SetCommandBuffer(CommandBufferScoped cbs)
  22. {
  23. CommandBuffer = (Cbs = cbs).CommandBuffer;
  24. // Restore per-command buffer state.
  25. if (Pipeline != null)
  26. {
  27. Gd.Api.CmdBindPipeline(CommandBuffer, Pbp, Pipeline.Get(CurrentCommandBuffer).Value);
  28. }
  29. SignalCommandBufferChange();
  30. }
  31. public void Finish()
  32. {
  33. EndRenderPass();
  34. }
  35. }
  36. }