diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-12-04 15:07:11 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-04 15:07:11 -0300 |
commit | 73aed239c356c4c573819eb6ee1e2d414d2d5579 (patch) | |
tree | a62251a52f79673925161a9843339df81483fbfb /Ryujinx.Graphics.Vulkan/TextureStorage.cs | |
parent | 9ac66336a216644a1b671e7949702d2e749838d2 (diff) |
Implement non-MS to MS copies with draws (#3958)1.1.420
* Implement non-MS to MS copies with draws, simplify MS to non-MS copies and supports any host sample count
* Remove unused program
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/TextureStorage.cs')
-rw-r--r-- | Ryujinx.Graphics.Vulkan/TextureStorage.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Vulkan/TextureStorage.cs b/Ryujinx.Graphics.Vulkan/TextureStorage.cs index 16a49048..591a0c28 100644 --- a/Ryujinx.Graphics.Vulkan/TextureStorage.cs +++ b/Ryujinx.Graphics.Vulkan/TextureStorage.cs @@ -77,7 +77,7 @@ namespace Ryujinx.Graphics.Vulkan var extent = new Extent3D((uint)info.Width, (uint)info.Height, depth); - var sampleCountFlags = ConvertToSampleCountFlags((uint)info.Samples); + var sampleCountFlags = ConvertToSampleCountFlags(gd.Capabilities.SupportedSampleCounts, (uint)info.Samples); var usage = DefaultUsageFlags; @@ -306,7 +306,7 @@ namespace Ryujinx.Graphics.Vulkan } } - public static SampleCountFlags ConvertToSampleCountFlags(uint samples) + public static SampleCountFlags ConvertToSampleCountFlags(SampleCountFlags supportedSampleCounts, uint samples) { if (samples == 0 || samples > (uint)SampleCountFlags.Count64Bit) { @@ -314,7 +314,15 @@ namespace Ryujinx.Graphics.Vulkan } // Round up to the nearest power of two. - return (SampleCountFlags)(1u << (31 - BitOperations.LeadingZeroCount(samples))); + SampleCountFlags converted = (SampleCountFlags)(1u << (31 - BitOperations.LeadingZeroCount(samples))); + + // Pick nearest sample count that the host actually supports. + while (converted != SampleCountFlags.SampleCount1Bit && (converted & supportedSampleCounts) == 0) + { + converted = (SampleCountFlags)((uint)converted >> 1); + } + + return converted; } public TextureView CreateView(TextureCreateInfo info, int firstLayer, int firstLevel) |