mirror of
https://git.zaroz.cloud/nintendo-back-up/Ryujinx.git
synced 2025-12-23 10:52:41 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96d1f0da2d | ||
|
|
597388ecda | ||
|
|
1cf6d7b7bb |
@@ -45,7 +45,7 @@ namespace Ryujinx.Audio.Backends.SDL2
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_supportSurroundConfiguration = spec.channels == 6;
|
_supportSurroundConfiguration = spec.channels >= 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,13 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
return (formatFeatureFlags & flags) == flags;
|
return (formatFeatureFlags & flags) == flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool BufferFormatSupports(FormatFeatureFlags flags, VkFormat format)
|
||||||
|
{
|
||||||
|
_api.GetPhysicalDeviceFormatProperties(_physicalDevice, format, out var fp);
|
||||||
|
|
||||||
|
return (fp.BufferFeatures & flags) == flags;
|
||||||
|
}
|
||||||
|
|
||||||
public bool OptimalFormatSupports(FormatFeatureFlags flags, GAL.Format format)
|
public bool OptimalFormatSupports(FormatFeatureFlags flags, GAL.Format format)
|
||||||
{
|
{
|
||||||
var formatFeatureFlags = _optimalTable[(int)format];
|
var formatFeatureFlags = _optimalTable[(int)format];
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
private PipelineColorBlendAttachmentState[] _storedBlend;
|
private PipelineColorBlendAttachmentState[] _storedBlend;
|
||||||
|
|
||||||
|
private ulong _drawCountSinceBarrier;
|
||||||
public ulong DrawCount { get; private set; }
|
public ulong DrawCount { get; private set; }
|
||||||
public bool RenderPassActive { get; private set; }
|
public bool RenderPassActive { get; private set; }
|
||||||
|
|
||||||
@@ -133,6 +134,18 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
public unsafe void Barrier()
|
public unsafe void Barrier()
|
||||||
{
|
{
|
||||||
|
if (_drawCountSinceBarrier != DrawCount)
|
||||||
|
{
|
||||||
|
_drawCountSinceBarrier = DrawCount;
|
||||||
|
|
||||||
|
// Barriers apparently have no effect inside a render pass on MoltenVK.
|
||||||
|
// As a workaround, end the render pass.
|
||||||
|
if (Gd.IsMoltenVk)
|
||||||
|
{
|
||||||
|
EndRenderPass();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MemoryBarrier memoryBarrier = new MemoryBarrier()
|
MemoryBarrier memoryBarrier = new MemoryBarrier()
|
||||||
{
|
{
|
||||||
SType = StructureType.MemoryBarrier,
|
SType = StructureType.MemoryBarrier,
|
||||||
@@ -551,7 +564,6 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
(uint)maxDrawCount,
|
(uint)maxDrawCount,
|
||||||
(uint)stride);
|
(uint)stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
if (isMoltenVk)
|
if (isMoltenVk)
|
||||||
{
|
{
|
||||||
UpdateVertexAttributeDescriptions();
|
UpdateVertexAttributeDescriptions(gd);
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed (VertexInputAttributeDescription* pVertexAttributeDescriptions = &Internal.VertexAttributeDescriptions[0])
|
fixed (VertexInputAttributeDescription* pVertexAttributeDescriptions = &Internal.VertexAttributeDescriptions[0])
|
||||||
@@ -641,7 +641,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateVertexAttributeDescriptions()
|
private void UpdateVertexAttributeDescriptions(VulkanRenderer gd)
|
||||||
{
|
{
|
||||||
// Vertex attributes exceeding the stride are invalid.
|
// Vertex attributes exceeding the stride are invalid.
|
||||||
// In metal, they cause glitches with the vertex shader fetching incorrect values.
|
// In metal, they cause glitches with the vertex shader fetching incorrect values.
|
||||||
@@ -651,30 +651,52 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
for (int index = 0; index < VertexAttributeDescriptionsCount; index++)
|
for (int index = 0; index < VertexAttributeDescriptionsCount; index++)
|
||||||
{
|
{
|
||||||
var attribute = Internal.VertexAttributeDescriptions[index];
|
var attribute = Internal.VertexAttributeDescriptions[index];
|
||||||
ref var vb = ref Internal.VertexBindingDescriptions[(int)attribute.Binding];
|
int vbIndex = GetVertexBufferIndex(attribute.Binding);
|
||||||
|
|
||||||
Format format = attribute.Format;
|
if (vbIndex >= 0)
|
||||||
|
|
||||||
while (vb.Stride != 0 && attribute.Offset + FormatTable.GetAttributeFormatSize(format) > vb.Stride)
|
|
||||||
{
|
{
|
||||||
Format newFormat = FormatTable.DropLastComponent(format);
|
ref var vb = ref Internal.VertexBindingDescriptions[vbIndex];
|
||||||
|
|
||||||
if (newFormat == format)
|
Format format = attribute.Format;
|
||||||
|
|
||||||
|
while (vb.Stride != 0 && attribute.Offset + FormatTable.GetAttributeFormatSize(format) > vb.Stride)
|
||||||
{
|
{
|
||||||
// That case means we failed to find a format that fits within the stride,
|
Format newFormat = FormatTable.DropLastComponent(format);
|
||||||
// so just restore the original format and give up.
|
|
||||||
format = attribute.Format;
|
if (newFormat == format)
|
||||||
break;
|
{
|
||||||
|
// That case means we failed to find a format that fits within the stride,
|
||||||
|
// so just restore the original format and give up.
|
||||||
|
format = attribute.Format;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
format = newFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
format = newFormat;
|
if (attribute.Format != format && gd.FormatCapabilities.BufferFormatSupports(FormatFeatureFlags.VertexBufferBit, format))
|
||||||
|
{
|
||||||
|
attribute.Format = format;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
attribute.Format = format;
|
|
||||||
_vertexAttributeDescriptions2[index] = attribute;
|
_vertexAttributeDescriptions2[index] = attribute;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int GetVertexBufferIndex(uint binding)
|
||||||
|
{
|
||||||
|
for (int index = 0; index < VertexBindingDescriptionsCount; index++)
|
||||||
|
{
|
||||||
|
if (Internal.VertexBindingDescriptions[index].Binding == binding)
|
||||||
|
{
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Stages.Dispose();
|
Stages.Dispose();
|
||||||
|
|||||||
Reference in New Issue
Block a user