Implement non-MS to MS copies with draws (#3958)

* Implement non-MS to MS copies with draws, simplify MS to non-MS copies and supports any host sample count

* Remove unused program
This commit is contained in:
gdkchan 2022-12-04 15:07:11 -03:00 committed by GitHub
parent 9ac66336a2
commit 73aed239c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 577 additions and 462 deletions

View file

@ -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)