mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-22 09:03:36 +00:00
Multisampling support
This commit is contained in:
parent
fb20e5b371
commit
6810796638
4 changed files with 23 additions and 11 deletions
|
@ -15,6 +15,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
public uint Height { get; }
|
public uint Height { get; }
|
||||||
public uint Layers { get; }
|
public uint Layers { get; }
|
||||||
|
|
||||||
|
public uint[] AttachmentSamples { get; }
|
||||||
public VkFormat[] AttachmentFormats { get; }
|
public VkFormat[] AttachmentFormats { get; }
|
||||||
public int[] AttachmentIndices { get; }
|
public int[] AttachmentIndices { get; }
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
Height = height;
|
Height = height;
|
||||||
Layers = 1;
|
Layers = 1;
|
||||||
|
|
||||||
|
AttachmentSamples = new[] { 1u };
|
||||||
AttachmentFormats = new[] { format };
|
AttachmentFormats = new[] { format };
|
||||||
AttachmentIndices = new[] { 0 };
|
AttachmentIndices = new[] { 0 };
|
||||||
|
|
||||||
|
@ -56,6 +58,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
_attachments = new Auto<DisposableImageView>[count];
|
_attachments = new Auto<DisposableImageView>[count];
|
||||||
|
|
||||||
|
AttachmentSamples = new uint[count];
|
||||||
AttachmentFormats = new VkFormat[count];
|
AttachmentFormats = new VkFormat[count];
|
||||||
AttachmentIndices = new int[count];
|
AttachmentIndices = new int[count];
|
||||||
MaxColorAttachmentIndex = colors.Length - 1;
|
MaxColorAttachmentIndex = colors.Length - 1;
|
||||||
|
@ -75,6 +78,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
_attachments[index] = texture.GetImageViewForAttachment();
|
_attachments[index] = texture.GetImageViewForAttachment();
|
||||||
|
|
||||||
|
AttachmentSamples[index] = (uint)texture.Info.Samples;
|
||||||
AttachmentFormats[index] = texture.VkFormat;
|
AttachmentFormats[index] = texture.VkFormat;
|
||||||
AttachmentIndices[index] = bindIndex;
|
AttachmentIndices[index] = bindIndex;
|
||||||
|
|
||||||
|
@ -95,6 +99,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
{
|
{
|
||||||
_attachments[count - 1] = dsTexture.GetImageViewForAttachment();
|
_attachments[count - 1] = dsTexture.GetImageViewForAttachment();
|
||||||
|
|
||||||
|
AttachmentSamples[count - 1] = (uint)dsTexture.Info.Samples;
|
||||||
AttachmentFormats[count - 1] = dsTexture.VkFormat;
|
AttachmentFormats[count - 1] = dsTexture.VkFormat;
|
||||||
|
|
||||||
width = Math.Min(width, (uint)dsTexture.Width);
|
width = Math.Min(width, (uint)dsTexture.Width);
|
||||||
|
|
|
@ -97,6 +97,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
_newState.Initialize();
|
_newState.Initialize();
|
||||||
_newState.LineWidth = 1f;
|
_newState.LineWidth = 1f;
|
||||||
|
_newState.SamplesCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual DescriptorSetLayout[] CreateDescriptorSetLayouts(VulkanGraphicsDevice gd, Device device, out PipelineLayout layout)
|
protected virtual DescriptorSetLayout[] CreateDescriptorSetLayouts(VulkanGraphicsDevice gd, Device device, out PipelineLayout layout)
|
||||||
|
@ -916,6 +917,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
{
|
{
|
||||||
FramebufferParams = new FramebufferParams(Device, colors, depthStencil);
|
FramebufferParams = new FramebufferParams(Device, colors, depthStencil);
|
||||||
UpdatePipelineAttachmentFormats();
|
UpdatePipelineAttachmentFormats();
|
||||||
|
_newState.SamplesCount = FramebufferParams.AttachmentSamples.Length != 0 ? FramebufferParams.AttachmentSamples[0] : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdatePipelineAttachmentFormats()
|
protected void UpdatePipelineAttachmentFormats()
|
||||||
|
@ -959,7 +961,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
attachmentDescs[i] = new AttachmentDescription(
|
attachmentDescs[i] = new AttachmentDescription(
|
||||||
0,
|
0,
|
||||||
FramebufferParams.AttachmentFormats[i],
|
FramebufferParams.AttachmentFormats[i],
|
||||||
SampleCountFlags.SampleCount1Bit,
|
TextureStorage.ConvertToSampleCountFlags(FramebufferParams.AttachmentSamples[i]),
|
||||||
AttachmentLoadOp.Load,
|
AttachmentLoadOp.Load,
|
||||||
AttachmentStoreOp.Store,
|
AttachmentStoreOp.Store,
|
||||||
AttachmentLoadOp.Load,
|
AttachmentLoadOp.Load,
|
||||||
|
|
|
@ -33,37 +33,37 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
public uint StencilFrontCompareMask
|
public uint StencilFrontCompareMask
|
||||||
{
|
{
|
||||||
get => (UInt32)((Internal.Id2 >> 0) & 0xFFFFFFFF);
|
get => (uint)((Internal.Id2 >> 0) & 0xFFFFFFFF);
|
||||||
set => Internal.Id2 = (Internal.Id2 & 0xFFFFFFFF00000000) | ((ulong)value << 0);
|
set => Internal.Id2 = (Internal.Id2 & 0xFFFFFFFF00000000) | ((ulong)value << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint StencilFrontWriteMask
|
public uint StencilFrontWriteMask
|
||||||
{
|
{
|
||||||
get => (UInt32)((Internal.Id2 >> 32) & 0xFFFFFFFF);
|
get => (uint)((Internal.Id2 >> 32) & 0xFFFFFFFF);
|
||||||
set => Internal.Id2 = (Internal.Id2 & 0xFFFFFFFF) | ((ulong)value << 32);
|
set => Internal.Id2 = (Internal.Id2 & 0xFFFFFFFF) | ((ulong)value << 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint StencilFrontReference
|
public uint StencilFrontReference
|
||||||
{
|
{
|
||||||
get => (UInt32)((Internal.Id3 >> 0) & 0xFFFFFFFF);
|
get => (uint)((Internal.Id3 >> 0) & 0xFFFFFFFF);
|
||||||
set => Internal.Id3 = (Internal.Id3 & 0xFFFFFFFF00000000) | ((ulong)value << 0);
|
set => Internal.Id3 = (Internal.Id3 & 0xFFFFFFFF00000000) | ((ulong)value << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint StencilBackCompareMask
|
public uint StencilBackCompareMask
|
||||||
{
|
{
|
||||||
get => (UInt32)((Internal.Id3 >> 32) & 0xFFFFFFFF);
|
get => (uint)((Internal.Id3 >> 32) & 0xFFFFFFFF);
|
||||||
set => Internal.Id3 = (Internal.Id3 & 0xFFFFFFFF) | ((ulong)value << 32);
|
set => Internal.Id3 = (Internal.Id3 & 0xFFFFFFFF) | ((ulong)value << 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint StencilBackWriteMask
|
public uint StencilBackWriteMask
|
||||||
{
|
{
|
||||||
get => (UInt32)((Internal.Id4 >> 0) & 0xFFFFFFFF);
|
get => (uint)((Internal.Id4 >> 0) & 0xFFFFFFFF);
|
||||||
set => Internal.Id4 = (Internal.Id4 & 0xFFFFFFFF00000000) | ((ulong)value << 0);
|
set => Internal.Id4 = (Internal.Id4 & 0xFFFFFFFF00000000) | ((ulong)value << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint StencilBackReference
|
public uint StencilBackReference
|
||||||
{
|
{
|
||||||
get => (UInt32)((Internal.Id4 >> 32) & 0xFFFFFFFF);
|
get => (uint)((Internal.Id4 >> 32) & 0xFFFFFFFF);
|
||||||
set => Internal.Id4 = (Internal.Id4 & 0xFFFFFFFF) | ((ulong)value << 32);
|
set => Internal.Id4 = (Internal.Id4 & 0xFFFFFFFF) | ((ulong)value << 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,10 +285,16 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
public uint PatchControlPoints
|
public uint PatchControlPoints
|
||||||
{
|
{
|
||||||
get => (UInt32)((Internal.Id10 >> 0) & 0xFFFFFFFF);
|
get => (uint)((Internal.Id10 >> 0) & 0xFFFFFFFF);
|
||||||
set => Internal.Id10 = (Internal.Id10 & 0xFFFFFFFF00000000) | ((ulong)value << 0);
|
set => Internal.Id10 = (Internal.Id10 & 0xFFFFFFFF00000000) | ((ulong)value << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint SamplesCount
|
||||||
|
{
|
||||||
|
get => (uint)((Internal.Id10 >> 32) & 0xFFFFFFFF);
|
||||||
|
set => Internal.Id10 = (Internal.Id10 & 0xFFFFFFFF) | ((ulong)value << 32);
|
||||||
|
}
|
||||||
|
|
||||||
public NativeArray<PipelineShaderStageCreateInfo> Stages;
|
public NativeArray<PipelineShaderStageCreateInfo> Stages;
|
||||||
public PipelineLayout PipelineLayout;
|
public PipelineLayout PipelineLayout;
|
||||||
|
|
||||||
|
@ -406,7 +412,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
{
|
{
|
||||||
SType = StructureType.PipelineMultisampleStateCreateInfo,
|
SType = StructureType.PipelineMultisampleStateCreateInfo,
|
||||||
SampleShadingEnable = false,
|
SampleShadingEnable = false,
|
||||||
RasterizationSamples = SampleCountFlags.SampleCount1Bit,
|
RasterizationSamples = TextureStorage.ConvertToSampleCountFlags(SamplesCount),
|
||||||
MinSampleShading = 1
|
MinSampleShading = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -302,9 +302,8 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SampleCountFlags ConvertToSampleCountFlags(uint samples)
|
public static SampleCountFlags ConvertToSampleCountFlags(uint samples)
|
||||||
{
|
{
|
||||||
return SampleCountFlags.SampleCount1Bit;
|
|
||||||
if (samples == 0 || samples > (uint)SampleCountFlags.SampleCount64Bit)
|
if (samples == 0 || samples > (uint)SampleCountFlags.SampleCount64Bit)
|
||||||
{
|
{
|
||||||
return SampleCountFlags.SampleCount1Bit;
|
return SampleCountFlags.SampleCount1Bit;
|
||||||
|
|
Loading…
Reference in a new issue