diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-11-02 18:17:19 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-02 18:17:19 -0300 |
commit | f82309fa2dd46d4339e0709ab835d927fd25361b (patch) | |
tree | f864424c938b289780f07a12dc2e52db49721da6 /Ryujinx.Graphics.Vulkan/PipelineState.cs | |
parent | 7d8e198c33b7ad283db53315129209a2bd310f23 (diff) |
Vulkan: Implement multisample <-> non-multisample copies and depth-stencil resolve (#3723)1.1.337
* Vulkan: Implement multisample <-> non-multisample copies and depth-stencil resolve
* FramebufferParams is no longer required there
* Implement Specialization Constants and merge CopyMS Shaders (#15)
* Vulkan: Initial Specialization Constants
* Replace with specialized helper shader
* Reimplement everything
Fix nonexistant interaction with Ryu pipeline caching
Decouple specialization info from data and relocate them
Generalize mapping and add type enum to better match spv types
Use local fixed scopes instead of global unmanaged allocs
* Fix misses in initial implementation
Use correct info variable in Create2DLayerView
Add ShaderStorageImageMultisample to required feature set
* Use texture for source image
* No point in using ReadOnlyMemory
* Apply formatting feedback
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Apply formatting suggestions on shader source
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Support conversion with samples count that does not match the requested count, other minor changes
Co-authored-by: mageven <62494521+mageven@users.noreply.github.com>
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/PipelineState.cs')
-rw-r--r-- | Ryujinx.Graphics.Vulkan/PipelineState.cs | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/Ryujinx.Graphics.Vulkan/PipelineState.cs b/Ryujinx.Graphics.Vulkan/PipelineState.cs index d33bc8ce..7b6a2649 100644 --- a/Ryujinx.Graphics.Vulkan/PipelineState.cs +++ b/Ryujinx.Graphics.Vulkan/PipelineState.cs @@ -312,6 +312,7 @@ namespace Ryujinx.Graphics.Vulkan public NativeArray<PipelineShaderStageCreateInfo> Stages; public NativeArray<PipelineShaderStageRequiredSubgroupSizeCreateInfoEXT> StageRequiredSubgroupSizes; public PipelineLayout PipelineLayout; + public SpecData SpecializationData; public void Initialize() { @@ -334,7 +335,7 @@ namespace Ryujinx.Graphics.Vulkan ShaderCollection program, PipelineCache cache) { - if (program.TryGetComputePipeline(out var pipeline)) + if (program.TryGetComputePipeline(ref SpecializationData, out var pipeline)) { return pipeline; } @@ -354,20 +355,36 @@ namespace Ryujinx.Graphics.Vulkan Pipeline pipelineHandle = default; - gd.Api.CreateComputePipelines(device, cache, 1, &pipelineCreateInfo, null, &pipelineHandle).ThrowOnError(); + bool hasSpec = program.SpecDescriptions != null; + + var desc = hasSpec ? program.SpecDescriptions[0] : SpecDescription.Empty; + + if (hasSpec && SpecializationData.Length < (int)desc.Info.DataSize) + { + throw new InvalidOperationException("Specialization data size does not match description"); + } + + fixed (SpecializationInfo* info = &desc.Info) + fixed (SpecializationMapEntry* map = desc.Map) + fixed (byte* data = SpecializationData.Span) + { + if (hasSpec) + { + info->PMapEntries = map; + info->PData = data; + pipelineCreateInfo.Stage.PSpecializationInfo = info; + } + + gd.Api.CreateComputePipelines(device, cache, 1, &pipelineCreateInfo, null, &pipelineHandle).ThrowOnError(); + } pipeline = new Auto<DisposablePipeline>(new DisposablePipeline(gd.Api, device, pipelineHandle)); - program.AddComputePipeline(pipeline); + program.AddComputePipeline(ref SpecializationData, pipeline); return pipeline; } - public unsafe void DestroyComputePipeline(ShaderCollection program) - { - program.RemoveComputePipeline(); - } - public unsafe Auto<DisposablePipeline> CreateGraphicsPipeline( VulkanRenderer gd, Device device, |