Ryujinx/Ryujinx.Graphics.Vulkan/PipelineHelperShader.cs
riperiperi c6d82209ab
Restride vertex buffer when stride causes attributes to misalign in Vulkan. (#3679)
* Vertex Buffer Alignment part 1

* Update CacheByRange

* Add Stride Change compute shader, fix storage buffers in helpers

* An AMD exclusive

* Reword

* Change rules - stride conversion when attrs misalign

* Fix stupid mistake

* Fix background pipeline compile

* Improve a few things.

* Fix some feedback

* Address Feedback

(the shader binary didn't change when i changed the source to use the subgroup size)

* Fix bug where rewritten buffer would be disposed instantly.
2022-09-08 20:30:19 -03:00

55 lines
1.6 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(Auto<DisposableImageView> view, uint width, uint height, bool isDepthStencil, VkFormat format)
{
CreateFramebuffer(view, width, height, isDepthStencil, format);
CreateRenderPass();
SignalStateChange();
}
private void CreateFramebuffer(Auto<DisposableImageView> view, uint width, uint height, bool isDepthStencil, VkFormat format)
{
FramebufferParams = new FramebufferParams(Device, view, width, height, isDepthStencil, format);
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();
}
}
}
}