mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-28 15:08:13 +02:00
Revert "misc: chore: Remove redundant code"
This reverts commit 05a88ccc94.
This commit is contained in:
@@ -67,7 +67,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
return (access, stages);
|
||||
}
|
||||
|
||||
private readonly record struct StageFlags
|
||||
private readonly record struct StageFlags : IEquatable<StageFlags>
|
||||
{
|
||||
public readonly PipelineStageFlags Source;
|
||||
public readonly PipelineStageFlags Dest;
|
||||
@@ -122,7 +122,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void FlushMemoryBarrier(ShaderCollection program, bool inRenderPass)
|
||||
public unsafe void FlushMemoryBarrier(ShaderCollection program, bool inRenderPass)
|
||||
{
|
||||
if (_queuedIncoherentBarrier > IncoherentBarrierType.None)
|
||||
{
|
||||
@@ -182,7 +182,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
}
|
||||
}
|
||||
|
||||
public void Flush(CommandBufferScoped cbs, bool inRenderPass, RenderPassHolder rpHolder, Action endRenderPass)
|
||||
public unsafe void Flush(CommandBufferScoped cbs, bool inRenderPass, RenderPassHolder rpHolder, Action endRenderPass)
|
||||
{
|
||||
Flush(cbs, null, inRenderPass, rpHolder, endRenderPass);
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDataUnchecked<T>(int offset, ReadOnlySpan<T> data) where T : unmanaged
|
||||
public unsafe void SetDataUnchecked<T>(int offset, ReadOnlySpan<T> data) where T : unmanaged
|
||||
{
|
||||
SetDataUnchecked(offset, MemoryMarshal.AsBytes(data));
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
}
|
||||
}
|
||||
|
||||
public DescriptorSetCollection AllocateDescriptorSets(ReadOnlySpan<DescriptorSetLayout> layouts, int consumedDescriptors)
|
||||
public unsafe DescriptorSetCollection AllocateDescriptorSets(ReadOnlySpan<DescriptorSetLayout> layouts, int consumedDescriptors)
|
||||
{
|
||||
TryAllocateDescriptorSets(layouts, consumedDescriptors, isTry: false, out var dsc);
|
||||
return dsc;
|
||||
|
||||
@@ -9,48 +9,48 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
class FormatCapabilities
|
||||
{
|
||||
private static readonly Format[] _scaledFormats =
|
||||
private static readonly GAL.Format[] _scaledFormats =
|
||||
[
|
||||
Format.R8Uscaled,
|
||||
Format.R8Sscaled,
|
||||
Format.R16Uscaled,
|
||||
Format.R16Sscaled,
|
||||
Format.R8G8Uscaled,
|
||||
Format.R8G8Sscaled,
|
||||
Format.R16G16Uscaled,
|
||||
Format.R16G16Sscaled,
|
||||
Format.R8G8B8Uscaled,
|
||||
Format.R8G8B8Sscaled,
|
||||
Format.R16G16B16Uscaled,
|
||||
Format.R16G16B16Sscaled,
|
||||
Format.R8G8B8A8Uscaled,
|
||||
Format.R8G8B8A8Sscaled,
|
||||
Format.R16G16B16A16Uscaled,
|
||||
Format.R16G16B16A16Sscaled,
|
||||
Format.R10G10B10A2Uscaled,
|
||||
Format.R10G10B10A2Sscaled
|
||||
GAL.Format.R8Uscaled,
|
||||
GAL.Format.R8Sscaled,
|
||||
GAL.Format.R16Uscaled,
|
||||
GAL.Format.R16Sscaled,
|
||||
GAL.Format.R8G8Uscaled,
|
||||
GAL.Format.R8G8Sscaled,
|
||||
GAL.Format.R16G16Uscaled,
|
||||
GAL.Format.R16G16Sscaled,
|
||||
GAL.Format.R8G8B8Uscaled,
|
||||
GAL.Format.R8G8B8Sscaled,
|
||||
GAL.Format.R16G16B16Uscaled,
|
||||
GAL.Format.R16G16B16Sscaled,
|
||||
GAL.Format.R8G8B8A8Uscaled,
|
||||
GAL.Format.R8G8B8A8Sscaled,
|
||||
GAL.Format.R16G16B16A16Uscaled,
|
||||
GAL.Format.R16G16B16A16Sscaled,
|
||||
GAL.Format.R10G10B10A2Uscaled,
|
||||
GAL.Format.R10G10B10A2Sscaled
|
||||
];
|
||||
|
||||
private static readonly Format[] _intFormats =
|
||||
private static readonly GAL.Format[] _intFormats =
|
||||
[
|
||||
Format.R8Uint,
|
||||
Format.R8Sint,
|
||||
Format.R16Uint,
|
||||
Format.R16Sint,
|
||||
Format.R8G8Uint,
|
||||
Format.R8G8Sint,
|
||||
Format.R16G16Uint,
|
||||
Format.R16G16Sint,
|
||||
Format.R8G8B8Uint,
|
||||
Format.R8G8B8Sint,
|
||||
Format.R16G16B16Uint,
|
||||
Format.R16G16B16Sint,
|
||||
Format.R8G8B8A8Uint,
|
||||
Format.R8G8B8A8Sint,
|
||||
Format.R16G16B16A16Uint,
|
||||
Format.R16G16B16A16Sint,
|
||||
Format.R10G10B10A2Uint,
|
||||
Format.R10G10B10A2Sint
|
||||
GAL.Format.R8Uint,
|
||||
GAL.Format.R8Sint,
|
||||
GAL.Format.R16Uint,
|
||||
GAL.Format.R16Sint,
|
||||
GAL.Format.R8G8Uint,
|
||||
GAL.Format.R8G8Sint,
|
||||
GAL.Format.R16G16Uint,
|
||||
GAL.Format.R16G16Sint,
|
||||
GAL.Format.R8G8B8Uint,
|
||||
GAL.Format.R8G8B8Sint,
|
||||
GAL.Format.R16G16B16Uint,
|
||||
GAL.Format.R16G16B16Sint,
|
||||
GAL.Format.R8G8B8A8Uint,
|
||||
GAL.Format.R8G8B8A8Sint,
|
||||
GAL.Format.R16G16B16A16Uint,
|
||||
GAL.Format.R16G16B16A16Sint,
|
||||
GAL.Format.R10G10B10A2Uint,
|
||||
GAL.Format.R10G10B10A2Sint
|
||||
];
|
||||
|
||||
private readonly FormatFeatureFlags[] _bufferTable;
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
TriFanToTrisPattern = new IndexBufferPattern(Gd, 3, 3, 2, [int.MinValue, -1, 0], 1, true);
|
||||
}
|
||||
|
||||
public void Barrier()
|
||||
public unsafe void Barrier()
|
||||
{
|
||||
Gd.Barriers.QueueMemoryBarrier();
|
||||
}
|
||||
@@ -255,7 +255,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect);
|
||||
}
|
||||
|
||||
public void CommandBufferBarrier()
|
||||
public unsafe void CommandBufferBarrier()
|
||||
{
|
||||
Gd.Barriers.QueueCommandBufferBarrier();
|
||||
}
|
||||
@@ -1348,7 +1348,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
_descriptorSetUpdater.ForceImageDirty();
|
||||
}
|
||||
|
||||
public void TextureBarrier()
|
||||
public unsafe void TextureBarrier()
|
||||
{
|
||||
Gd.Barriers.QueueTextureBarrier();
|
||||
}
|
||||
@@ -1446,7 +1446,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
_newState.SamplesCount = FramebufferParams.AttachmentSamples.Length != 0 ? FramebufferParams.AttachmentSamples[0] : 1;
|
||||
}
|
||||
|
||||
protected void CreateRenderPass()
|
||||
protected unsafe void CreateRenderPass()
|
||||
{
|
||||
var hasFramebuffer = FramebufferParams != null;
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
/// <param name="size">The minimum size the reserved data requires</param>
|
||||
/// <param name="alignment">The required alignment for the buffer offset</param>
|
||||
/// <returns>The reserved range of the staging buffer</returns>
|
||||
public StagingBufferReserved? TryReserveData(CommandBufferScoped cbs, int size, int alignment)
|
||||
public unsafe StagingBufferReserved? TryReserveData(CommandBufferScoped cbs, int size, int alignment)
|
||||
{
|
||||
if (size > BufferSize)
|
||||
{
|
||||
@@ -235,7 +235,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
/// <param name="cbs">Command buffer to reserve the data on</param>
|
||||
/// <param name="size">The minimum size the reserved data requires</param>
|
||||
/// <returns>The reserved range of the staging buffer</returns>
|
||||
public StagingBufferReserved? TryReserveData(CommandBufferScoped cbs, int size)
|
||||
public unsafe StagingBufferReserved? TryReserveData(CommandBufferScoped cbs, int size)
|
||||
{
|
||||
return TryReserveData(cbs, size, _resourceAlignment);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Linq;
|
||||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
class SyncManager(VulkanRenderer gd, Device device)
|
||||
class SyncManager
|
||||
{
|
||||
private class SyncHandle
|
||||
{
|
||||
@@ -23,10 +23,19 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
private ulong _firstHandle;
|
||||
|
||||
private readonly List<SyncHandle> _handles = [];
|
||||
private readonly VulkanRenderer _gd;
|
||||
private readonly Device _device;
|
||||
private readonly List<SyncHandle> _handles;
|
||||
private ulong _flushId;
|
||||
private long _waitTicks;
|
||||
|
||||
public SyncManager(VulkanRenderer gd, Device device)
|
||||
{
|
||||
_gd = gd;
|
||||
_device = device;
|
||||
_handles = [];
|
||||
}
|
||||
|
||||
public void RegisterFlush()
|
||||
{
|
||||
_flushId++;
|
||||
@@ -36,17 +45,17 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
ulong flushId = _flushId;
|
||||
MultiFenceHolder waitable = new();
|
||||
if (strict || gd.InterruptAction == null)
|
||||
if (strict || _gd.InterruptAction == null)
|
||||
{
|
||||
gd.FlushAllCommands();
|
||||
gd.CommandBufferPool.AddWaitable(waitable);
|
||||
_gd.FlushAllCommands();
|
||||
_gd.CommandBufferPool.AddWaitable(waitable);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't flush commands, instead wait for the current command buffer to finish.
|
||||
// If this sync is waited on before the command buffer is submitted, interrupt the gpu thread and flush it manually.
|
||||
|
||||
gd.CommandBufferPool.AddInUseWaitable(waitable);
|
||||
_gd.CommandBufferPool.AddInUseWaitable(waitable);
|
||||
}
|
||||
|
||||
SyncHandle handle = new()
|
||||
@@ -79,7 +88,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
if (handle.ID > lastHandle)
|
||||
{
|
||||
bool signaled = handle.Signalled || handle.Waitable.WaitForFences(gd.Api, device, 0);
|
||||
bool signaled = handle.Signalled || handle.Waitable.WaitForFences(_gd.Api, _device, 0);
|
||||
if (signaled)
|
||||
{
|
||||
lastHandle = handle.ID;
|
||||
@@ -125,11 +134,11 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
if (result.NeedsFlush(_flushId))
|
||||
{
|
||||
gd.InterruptAction(() =>
|
||||
_gd.InterruptAction(() =>
|
||||
{
|
||||
if (result.NeedsFlush(_flushId))
|
||||
{
|
||||
gd.FlushAllCommands();
|
||||
_gd.FlushAllCommands();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -141,7 +150,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
return;
|
||||
}
|
||||
|
||||
bool signaled = result.Signalled || result.Waitable.WaitForFences(gd.Api, device, 1000000000);
|
||||
bool signaled = result.Signalled || result.Waitable.WaitForFences(_gd.Api, _device, 1000000000);
|
||||
|
||||
if (!signaled)
|
||||
{
|
||||
@@ -173,7 +182,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
break;
|
||||
}
|
||||
|
||||
bool signaled = first.Waitable.WaitForFences(gd.Api, device, 0);
|
||||
bool signaled = first.Waitable.WaitForFences(_gd.Api, _device, 0);
|
||||
if (signaled)
|
||||
{
|
||||
// Delete the sync object.
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
private bool _initialized;
|
||||
|
||||
public uint ProgramCount { get; set; }
|
||||
public uint ProgramCount { get; set; } = 0;
|
||||
|
||||
internal FormatCapabilities FormatCapabilities { get; private set; }
|
||||
internal HardwareCapabilities Capabilities;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
private ScalingFilter _currentScalingFilter;
|
||||
private bool _colorSpacePassthroughEnabled;
|
||||
|
||||
public Window(VulkanRenderer gd, SurfaceKHR surface, PhysicalDevice physicalDevice, Device device)
|
||||
public unsafe Window(VulkanRenderer gd, SurfaceKHR surface, PhysicalDevice physicalDevice, Device device)
|
||||
{
|
||||
_gd = gd;
|
||||
_physicalDevice = physicalDevice;
|
||||
|
||||
Reference in New Issue
Block a user