Ryujinx-uplift/src/Ryujinx.Graphics.Vulkan/PipelineHelperShader.cs
riperiperi c94f0fbb83
Vulkan: Add Render Pass / Framebuffer Cache (#6182)
* Vulkan: Add Render Pass / Framebuffer Cache

Cache is owned by each texture view.

- Window's way of getting framebuffer cache for swapchain images is really messy - it creates a TextureView out of just a vk image view, with invalid info and no storage.

* Clear up limited use of alternate TextureView constructor

* Formatting and messages

* More formatting and messages

I apologize for `_colorsCanonical[index]?.Storage?.InsertReadToWriteBarrier`, the compiler made me do it

* Self review, change GetFramebuffer to GetPassAndFramebuffer

* Avoid allocations on Remove for HashTableSlim

* Member can be readonly

* Generate texture create info for swapchain images

* Improve hashcode

* Remove format, samples, size and isDepthStencil when possible

Tested in a number of games, seems fine.

* Removed load op barriers

These can be introduced later.

* Reintroduce UpdateModifications

Technically meant to be replaced by load op stuff.
2024-01-31 23:49:50 +01:00

55 lines
1.4 KiB
C#

using Silk.NET.Vulkan;
using VkFormat = Silk.NET.Vulkan.Format;
namespace Ryujinx.Graphics.Vulkan
{
class PipelineHelperShader : PipelineBase
{
public PipelineHelperShader(VulkanRenderer gd, Device device) : base(gd, device)
{
}
public void SetRenderTarget(TextureView view, uint width, uint height)
{
CreateFramebuffer(view, width, height);
CreateRenderPass();
SignalStateChange();
}
private void CreateFramebuffer(TextureView view, uint width, uint height)
{
FramebufferParams = new FramebufferParams(Device, view, width, height);
UpdatePipelineAttachmentFormats();
}
public void SetCommandBuffer(CommandBufferScoped cbs)
{
CommandBuffer = (Cbs = cbs).CommandBuffer;
// Restore per-command buffer state.
if (Pipeline != null)
{
Gd.Api.CmdBindPipeline(CommandBuffer, Pbp, Pipeline.Get(CurrentCommandBuffer).Value);
}
SignalCommandBufferChange();
}
public void Finish()
{
EndRenderPass();
}
public void Finish(VulkanRenderer gd, CommandBufferScoped cbs)
{
Finish();
if (gd.PipelineInternal.IsCommandBufferActive(cbs.CommandBuffer))
{
gd.PipelineInternal.Restore();
}
}
}
}