misc: chore: Use collection expressions in Vulkan project

This commit is contained in:
Evan Husted 2025-01-26 15:32:25 -06:00
parent 9cb3b40ffc
commit ed2590a8ac
32 changed files with 212 additions and 240 deletions

View File

@ -19,9 +19,9 @@ namespace Ryujinx.Graphics.Vulkan
private readonly NativeArray<BufferMemoryBarrier> _bufferBarrierBatch = new(MaxBarriersPerCall); private readonly NativeArray<BufferMemoryBarrier> _bufferBarrierBatch = new(MaxBarriersPerCall);
private readonly NativeArray<ImageMemoryBarrier> _imageBarrierBatch = new(MaxBarriersPerCall); private readonly NativeArray<ImageMemoryBarrier> _imageBarrierBatch = new(MaxBarriersPerCall);
private readonly List<BarrierWithStageFlags<MemoryBarrier, int>> _memoryBarriers = new(); private readonly List<BarrierWithStageFlags<MemoryBarrier, int>> _memoryBarriers = [];
private readonly List<BarrierWithStageFlags<BufferMemoryBarrier, int>> _bufferBarriers = new(); private readonly List<BarrierWithStageFlags<BufferMemoryBarrier, int>> _bufferBarriers = [];
private readonly List<BarrierWithStageFlags<ImageMemoryBarrier, TextureStorage>> _imageBarriers = new(); private readonly List<BarrierWithStageFlags<ImageMemoryBarrier, TextureStorage>> _imageBarriers = [];
private int _queuedBarrierCount; private int _queuedBarrierCount;
private enum IncoherentBarrierType private enum IncoherentBarrierType

View File

@ -486,7 +486,7 @@ namespace Ryujinx.Graphics.Vulkan
(int keyOffset, int keySize) = FromMirrorKey(key); (int keyOffset, int keySize) = FromMirrorKey(key);
if (!(offset + size <= keyOffset || offset >= keyOffset + keySize)) if (!(offset + size <= keyOffset || offset >= keyOffset + keySize))
{ {
toRemove ??= new List<ulong>(); toRemove ??= [];
toRemove.Add(key); toRemove.Add(key);
} }

View File

@ -150,10 +150,7 @@ namespace Ryujinx.Graphics.Vulkan
} }
else else
{ {
_ranges = new List<Range> _ranges = [new(offset, size)];
{
new(offset, size)
};
} }
} }

View File

@ -249,7 +249,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
if (entry.DependencyList == null) if (entry.DependencyList == null)
{ {
entry.DependencyList = new List<Dependency>(); entry.DependencyList = [];
entries[i] = entry; entries[i] = entry;
} }
@ -340,7 +340,7 @@ namespace Ryujinx.Graphics.Vulkan
DestroyEntry(entry); DestroyEntry(entry);
} }
(toRemove ??= new List<ulong>()).Add(range.Key); (toRemove ??= []).Add(range.Key);
} }
} }
@ -362,7 +362,7 @@ namespace Ryujinx.Graphics.Vulkan
if (!_ranges.TryGetValue(key, out List<Entry> value)) if (!_ranges.TryGetValue(key, out List<Entry> value))
{ {
value = new List<Entry>(); value = [];
_ranges.Add(key, value); _ranges.Add(key, value);
} }

View File

@ -47,8 +47,8 @@ namespace Ryujinx.Graphics.Vulkan
api.AllocateCommandBuffers(device, in allocateInfo, out CommandBuffer); api.AllocateCommandBuffers(device, in allocateInfo, out CommandBuffer);
Dependants = new List<IAuto>(); Dependants = [];
Waitables = new List<MultiFenceHolder>(); Waitables = [];
} }
} }

View File

@ -142,11 +142,11 @@ namespace Ryujinx.Graphics.Vulkan
_bufferTextureRefs = new TextureBuffer[Constants.MaxTextureBindings * 2]; _bufferTextureRefs = new TextureBuffer[Constants.MaxTextureBindings * 2];
_bufferImageRefs = new TextureBuffer[Constants.MaxImageBindings * 2]; _bufferImageRefs = new TextureBuffer[Constants.MaxImageBindings * 2];
_textureArrayRefs = Array.Empty<ArrayRef<TextureArray>>(); _textureArrayRefs = [];
_imageArrayRefs = Array.Empty<ArrayRef<ImageArray>>(); _imageArrayRefs = [];
_textureArrayExtraRefs = Array.Empty<ArrayRef<TextureArray>>(); _textureArrayExtraRefs = [];
_imageArrayExtraRefs = Array.Empty<ArrayRef<ImageArray>>(); _imageArrayExtraRefs = [];
_uniformBuffers = new DescriptorBufferInfo[Constants.MaxUniformBufferBindings]; _uniformBuffers = new DescriptorBufferInfo[Constants.MaxUniformBufferBindings];
_storageBuffers = new DescriptorBufferInfo[Constants.MaxStorageBufferBindings]; _storageBuffers = new DescriptorBufferInfo[Constants.MaxStorageBufferBindings];
@ -218,7 +218,7 @@ namespace Ryujinx.Graphics.Vulkan
if (isMainPipeline) if (isMainPipeline)
{ {
FeedbackLoopHazards = new(); FeedbackLoopHazards = [];
} }
} }

View File

@ -50,10 +50,9 @@ namespace Ryujinx.Graphics.Vulkan.Effects
_sampler = _renderer.CreateSampler(SamplerCreateInfo.Create(MinFilter.Linear, MagFilter.Linear)); _sampler = _renderer.CreateSampler(SamplerCreateInfo.Create(MinFilter.Linear, MagFilter.Linear));
_scalingProgram = _renderer.CreateProgramWithMinimalLayout(new[] _scalingProgram = _renderer.CreateProgramWithMinimalLayout([
{ new ShaderSource(scalingShader, ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(scalingShader, ShaderStage.Compute, TargetLanguage.Spirv), ], scalingResourceLayout);
}, scalingResourceLayout);
} }
public void Run( public void Run(
@ -70,8 +69,8 @@ namespace Ryujinx.Graphics.Vulkan.Effects
_pipeline.SetProgram(_scalingProgram); _pipeline.SetProgram(_scalingProgram);
_pipeline.SetTextureAndSampler(ShaderStage.Compute, 1, view, _sampler); _pipeline.SetTextureAndSampler(ShaderStage.Compute, 1, view, _sampler);
ReadOnlySpan<float> dimensionsBuffer = stackalloc float[] ReadOnlySpan<float> dimensionsBuffer =
{ [
source.X1, source.X1,
source.X2, source.X2,
source.Y1, source.Y1,
@ -79,8 +78,8 @@ namespace Ryujinx.Graphics.Vulkan.Effects
destination.X1, destination.X1,
destination.X2, destination.X2,
destination.Y1, destination.Y1,
destination.Y2, destination.Y2
}; ];
int rangeSize = dimensionsBuffer.Length * sizeof(float); int rangeSize = dimensionsBuffer.Length * sizeof(float);
using ScopedTemporaryBuffer buffer = _renderer.BufferManager.ReserveOrCreate(_renderer, cbs, rangeSize); using ScopedTemporaryBuffer buffer = _renderer.BufferManager.ReserveOrCreate(_renderer, cbs, rangeSize);
@ -90,7 +89,7 @@ namespace Ryujinx.Graphics.Vulkan.Effects
int dispatchX = (width + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; int dispatchX = (width + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim;
int dispatchY = (height + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; int dispatchY = (height + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim;
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(2, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(2, buffer.Range)]);
_pipeline.SetImage(0, destinationTexture); _pipeline.SetImage(0, destinationTexture);
_pipeline.DispatchCompute(dispatchX, dispatchY, 1); _pipeline.DispatchCompute(dispatchX, dispatchY, 1);
_pipeline.ComputeBarrier(); _pipeline.ComputeBarrier();

View File

@ -70,15 +70,13 @@ namespace Ryujinx.Graphics.Vulkan.Effects
_sampler = _renderer.CreateSampler(SamplerCreateInfo.Create(MinFilter.Linear, MagFilter.Linear)); _sampler = _renderer.CreateSampler(SamplerCreateInfo.Create(MinFilter.Linear, MagFilter.Linear));
_scalingProgram = _renderer.CreateProgramWithMinimalLayout(new[] _scalingProgram = _renderer.CreateProgramWithMinimalLayout([
{ new ShaderSource(scalingShader, ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(scalingShader, ShaderStage.Compute, TargetLanguage.Spirv), ], scalingResourceLayout);
}, scalingResourceLayout);
_sharpeningProgram = _renderer.CreateProgramWithMinimalLayout(new[] _sharpeningProgram = _renderer.CreateProgramWithMinimalLayout([
{ new ShaderSource(sharpeningShader, ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(sharpeningShader, ShaderStage.Compute, TargetLanguage.Spirv), ], sharpeningResourceLayout);
}, sharpeningResourceLayout);
} }
public void Run( public void Run(
@ -127,8 +125,8 @@ namespace Ryujinx.Graphics.Vulkan.Effects
float scaleX = srcWidth / view.Width; float scaleX = srcWidth / view.Width;
float scaleY = srcHeight / view.Height; float scaleY = srcHeight / view.Height;
ReadOnlySpan<float> dimensionsBuffer = stackalloc float[] ReadOnlySpan<float> dimensionsBuffer =
{ [
source.X1, source.X1,
source.X2, source.X2,
source.Y1, source.Y1,
@ -138,14 +136,14 @@ namespace Ryujinx.Graphics.Vulkan.Effects
destination.Y1, destination.Y1,
destination.Y2, destination.Y2,
scaleX, scaleX,
scaleY, scaleY
}; ];
int rangeSize = dimensionsBuffer.Length * sizeof(float); int rangeSize = dimensionsBuffer.Length * sizeof(float);
using ScopedTemporaryBuffer buffer = _renderer.BufferManager.ReserveOrCreate(_renderer, cbs, rangeSize); using ScopedTemporaryBuffer buffer = _renderer.BufferManager.ReserveOrCreate(_renderer, cbs, rangeSize);
buffer.Holder.SetDataUnchecked(buffer.Offset, dimensionsBuffer); buffer.Holder.SetDataUnchecked(buffer.Offset, dimensionsBuffer);
ReadOnlySpan<float> sharpeningBufferData = stackalloc float[] { 1.5f - (Level * 0.01f * 1.5f) }; ReadOnlySpan<float> sharpeningBufferData = [1.5f - (Level * 0.01f * 1.5f)];
using ScopedTemporaryBuffer sharpeningBuffer = _renderer.BufferManager.ReserveOrCreate(_renderer, cbs, sizeof(float)); using ScopedTemporaryBuffer sharpeningBuffer = _renderer.BufferManager.ReserveOrCreate(_renderer, cbs, sizeof(float));
sharpeningBuffer.Holder.SetDataUnchecked(sharpeningBuffer.Offset, sharpeningBufferData); sharpeningBuffer.Holder.SetDataUnchecked(sharpeningBuffer.Offset, sharpeningBufferData);
@ -153,7 +151,7 @@ namespace Ryujinx.Graphics.Vulkan.Effects
int dispatchX = (width + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; int dispatchX = (width + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim;
int dispatchY = (height + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; int dispatchY = (height + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim;
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(2, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(2, buffer.Range)]);
_pipeline.SetImage(ShaderStage.Compute, 0, _intermediaryTexture.GetView(FormatTable.ConvertRgba8SrgbToUnorm(view.Info.Format))); _pipeline.SetImage(ShaderStage.Compute, 0, _intermediaryTexture.GetView(FormatTable.ConvertRgba8SrgbToUnorm(view.Info.Format)));
_pipeline.DispatchCompute(dispatchX, dispatchY, 1); _pipeline.DispatchCompute(dispatchX, dispatchY, 1);
_pipeline.ComputeBarrier(); _pipeline.ComputeBarrier();
@ -161,7 +159,7 @@ namespace Ryujinx.Graphics.Vulkan.Effects
// Sharpening pass // Sharpening pass
_pipeline.SetProgram(_sharpeningProgram); _pipeline.SetProgram(_sharpeningProgram);
_pipeline.SetTextureAndSampler(ShaderStage.Compute, 1, _intermediaryTexture, _sampler); _pipeline.SetTextureAndSampler(ShaderStage.Compute, 1, _intermediaryTexture, _sampler);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(4, sharpeningBuffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(4, sharpeningBuffer.Range)]);
_pipeline.SetImage(0, destinationTexture); _pipeline.SetImage(0, destinationTexture);
_pipeline.DispatchCompute(dispatchX, dispatchY, 1); _pipeline.DispatchCompute(dispatchX, dispatchY, 1);
_pipeline.ComputeBarrier(); _pipeline.ComputeBarrier();

View File

@ -46,10 +46,9 @@ namespace Ryujinx.Graphics.Vulkan.Effects
_samplerLinear = _renderer.CreateSampler(SamplerCreateInfo.Create(MinFilter.Linear, MagFilter.Linear)); _samplerLinear = _renderer.CreateSampler(SamplerCreateInfo.Create(MinFilter.Linear, MagFilter.Linear));
_shaderProgram = _renderer.CreateProgramWithMinimalLayout(new[] _shaderProgram = _renderer.CreateProgramWithMinimalLayout([
{ new ShaderSource(shader, ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(shader, ShaderStage.Compute, TargetLanguage.Spirv), ], resourceLayout);
}, resourceLayout);
} }
public TextureView Run(TextureView view, CommandBufferScoped cbs, int width, int height) public TextureView Run(TextureView view, CommandBufferScoped cbs, int width, int height)
@ -64,13 +63,13 @@ namespace Ryujinx.Graphics.Vulkan.Effects
_pipeline.SetProgram(_shaderProgram); _pipeline.SetProgram(_shaderProgram);
_pipeline.SetTextureAndSampler(ShaderStage.Compute, 1, view, _samplerLinear); _pipeline.SetTextureAndSampler(ShaderStage.Compute, 1, view, _samplerLinear);
ReadOnlySpan<float> resolutionBuffer = stackalloc float[] { view.Width, view.Height }; ReadOnlySpan<float> resolutionBuffer = [view.Width, view.Height];
int rangeSize = resolutionBuffer.Length * sizeof(float); int rangeSize = resolutionBuffer.Length * sizeof(float);
using ScopedTemporaryBuffer buffer = _renderer.BufferManager.ReserveOrCreate(_renderer, cbs, rangeSize); using ScopedTemporaryBuffer buffer = _renderer.BufferManager.ReserveOrCreate(_renderer, cbs, rangeSize);
buffer.Holder.SetDataUnchecked(buffer.Offset, resolutionBuffer); buffer.Holder.SetDataUnchecked(buffer.Offset, resolutionBuffer);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(2, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(2, buffer.Range)]);
int dispatchX = BitUtils.DivRoundUp(view.Width, IPostProcessingEffect.LocalGroupSize); int dispatchX = BitUtils.DivRoundUp(view.Width, IPostProcessingEffect.LocalGroupSize);
int dispatchY = BitUtils.DivRoundUp(view.Height, IPostProcessingEffect.LocalGroupSize); int dispatchY = BitUtils.DivRoundUp(view.Height, IPostProcessingEffect.LocalGroupSize);

View File

@ -117,20 +117,17 @@ namespace Ryujinx.Graphics.Vulkan.Effects
(4, SpecConstType.Float32), (4, SpecConstType.Float32),
(5, SpecConstType.Float32)); (5, SpecConstType.Float32));
_edgeProgram = _renderer.CreateProgramWithMinimalLayout(new[] _edgeProgram = _renderer.CreateProgramWithMinimalLayout([
{ new ShaderSource(edgeShader, ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(edgeShader, ShaderStage.Compute, TargetLanguage.Spirv), ], edgeResourceLayout, [specInfo]);
}, edgeResourceLayout, new[] { specInfo });
_blendProgram = _renderer.CreateProgramWithMinimalLayout(new[] _blendProgram = _renderer.CreateProgramWithMinimalLayout([
{ new ShaderSource(blendShader, ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(blendShader, ShaderStage.Compute, TargetLanguage.Spirv), ], blendResourceLayout, [specInfo]);
}, blendResourceLayout, new[] { specInfo });
_neighbourProgram = _renderer.CreateProgramWithMinimalLayout(new[] _neighbourProgram = _renderer.CreateProgramWithMinimalLayout([
{ new ShaderSource(neighbourShader, ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(neighbourShader, ShaderStage.Compute, TargetLanguage.Spirv), ], neighbourResourceLayout, [specInfo]);
}, neighbourResourceLayout, new[] { specInfo });
} }
public void DeletePipelines() public void DeletePipelines()
@ -214,12 +211,12 @@ namespace Ryujinx.Graphics.Vulkan.Effects
_pipeline.SetTextureAndSampler(ShaderStage.Compute, 1, view, _samplerLinear); _pipeline.SetTextureAndSampler(ShaderStage.Compute, 1, view, _samplerLinear);
_pipeline.Specialize(_specConstants); _pipeline.Specialize(_specConstants);
ReadOnlySpan<float> resolutionBuffer = stackalloc float[] { view.Width, view.Height }; ReadOnlySpan<float> resolutionBuffer = [view.Width, view.Height];
int rangeSize = resolutionBuffer.Length * sizeof(float); int rangeSize = resolutionBuffer.Length * sizeof(float);
using ScopedTemporaryBuffer buffer = _renderer.BufferManager.ReserveOrCreate(_renderer, cbs, rangeSize); using ScopedTemporaryBuffer buffer = _renderer.BufferManager.ReserveOrCreate(_renderer, cbs, rangeSize);
buffer.Holder.SetDataUnchecked(buffer.Offset, resolutionBuffer); buffer.Holder.SetDataUnchecked(buffer.Offset, resolutionBuffer);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(2, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(2, buffer.Range)]);
_pipeline.SetImage(ShaderStage.Compute, 0, _edgeOutputTexture.GetView(FormatTable.ConvertRgba8SrgbToUnorm(view.Info.Format))); _pipeline.SetImage(ShaderStage.Compute, 0, _edgeOutputTexture.GetView(FormatTable.ConvertRgba8SrgbToUnorm(view.Info.Format)));
_pipeline.DispatchCompute(dispatchX, dispatchY, 1); _pipeline.DispatchCompute(dispatchX, dispatchY, 1);
_pipeline.ComputeBarrier(); _pipeline.ComputeBarrier();

View File

@ -110,7 +110,7 @@ namespace Ryujinx.Graphics.Vulkan
try try
{ {
FenceHelper.WaitAllIndefinitely(_api, _device, stackalloc Fence[] { _fence }); FenceHelper.WaitAllIndefinitely(_api, _device, [_fence]);
} }
finally finally
{ {
@ -119,7 +119,7 @@ namespace Ryujinx.Graphics.Vulkan
} }
else else
{ {
FenceHelper.WaitAllIndefinitely(_api, _device, stackalloc Fence[] { _fence }); FenceHelper.WaitAllIndefinitely(_api, _device, [_fence]);
} }
} }
@ -134,7 +134,7 @@ namespace Ryujinx.Graphics.Vulkan
try try
{ {
return FenceHelper.AllSignaled(_api, _device, stackalloc Fence[] { _fence }); return FenceHelper.AllSignaled(_api, _device, [_fence]);
} }
finally finally
{ {
@ -143,7 +143,7 @@ namespace Ryujinx.Graphics.Vulkan
} }
else else
{ {
return FenceHelper.AllSignaled(_api, _device, stackalloc Fence[] { _fence }); return FenceHelper.AllSignaled(_api, _device, [_fence]);
} }
} }

View File

@ -9,7 +9,8 @@ namespace Ryujinx.Graphics.Vulkan
{ {
class FormatCapabilities class FormatCapabilities
{ {
private static readonly GAL.Format[] _scaledFormats = { private static readonly GAL.Format[] _scaledFormats =
[
GAL.Format.R8Uscaled, GAL.Format.R8Uscaled,
GAL.Format.R8Sscaled, GAL.Format.R8Sscaled,
GAL.Format.R16Uscaled, GAL.Format.R16Uscaled,
@ -27,10 +28,11 @@ namespace Ryujinx.Graphics.Vulkan
GAL.Format.R16G16B16A16Uscaled, GAL.Format.R16G16B16A16Uscaled,
GAL.Format.R16G16B16A16Sscaled, GAL.Format.R16G16B16A16Sscaled,
GAL.Format.R10G10B10A2Uscaled, GAL.Format.R10G10B10A2Uscaled,
GAL.Format.R10G10B10A2Sscaled, GAL.Format.R10G10B10A2Sscaled
}; ];
private static readonly GAL.Format[] _intFormats = { private static readonly GAL.Format[] _intFormats =
[
GAL.Format.R8Uint, GAL.Format.R8Uint,
GAL.Format.R8Sint, GAL.Format.R8Sint,
GAL.Format.R16Uint, GAL.Format.R16Uint,
@ -48,8 +50,8 @@ namespace Ryujinx.Graphics.Vulkan
GAL.Format.R16G16B16A16Uint, GAL.Format.R16G16B16A16Uint,
GAL.Format.R16G16B16A16Sint, GAL.Format.R16G16B16A16Sint,
GAL.Format.R10G10B10A2Uint, GAL.Format.R10G10B10A2Uint,
GAL.Format.R10G10B10A2Sint, GAL.Format.R10G10B10A2Sint
}; ];
private readonly FormatFeatureFlags[] _bufferTable; private readonly FormatFeatureFlags[] _bufferTable;
private readonly FormatFeatureFlags[] _optimalTable; private readonly FormatFeatureFlags[] _optimalTable;

View File

@ -39,7 +39,7 @@ namespace Ryujinx.Graphics.Vulkan
bool isDepthStencil = format.IsDepthOrStencil(); bool isDepthStencil = format.IsDepthOrStencil();
_device = device; _device = device;
_attachments = new[] { view.GetImageViewForAttachment() }; _attachments = [view.GetImageViewForAttachment()];
_validColorAttachments = isDepthStencil ? 0u : 1u; _validColorAttachments = isDepthStencil ? 0u : 1u;
_baseAttachment = view; _baseAttachment = view;
@ -49,7 +49,7 @@ namespace Ryujinx.Graphics.Vulkan
} }
else else
{ {
_colors = new TextureView[] { view }; _colors = [view];
_colorsCanonical = _colors; _colorsCanonical = _colors;
} }
@ -57,9 +57,9 @@ namespace Ryujinx.Graphics.Vulkan
Height = height; Height = height;
Layers = 1; Layers = 1;
AttachmentSamples = new[] { (uint)view.Info.Samples }; AttachmentSamples = [(uint)view.Info.Samples];
AttachmentFormats = new[] { view.VkFormat }; AttachmentFormats = [view.VkFormat];
AttachmentIndices = isDepthStencil ? Array.Empty<int>() : new[] { 0 }; AttachmentIndices = isDepthStencil ? [] : [0];
AttachmentIntegerFormatMask = format.IsInteger() ? 1u : 0u; AttachmentIntegerFormatMask = format.IsInteger() ? 1u : 0u;
LogicOpsAllowed = !format.IsFloatOrSrgb(); LogicOpsAllowed = !format.IsFloatOrSrgb();

View File

@ -89,10 +89,10 @@ namespace Ryujinx.Graphics.Vulkan
} }
else else
{ {
bucket.Entries = new[] bucket.Entries =
{ [
entry, entry
}; ];
} }
bucket.Length++; bucket.Length++;

View File

@ -69,109 +69,95 @@ namespace Ryujinx.Graphics.Vulkan
.Add(ResourceStages.Vertex, ResourceType.UniformBuffer, 1) .Add(ResourceStages.Vertex, ResourceType.UniformBuffer, 1)
.Add(ResourceStages.Fragment, ResourceType.TextureAndSampler, 0).Build(); .Add(ResourceStages.Fragment, ResourceType.TextureAndSampler, 0).Build();
_programColorBlit = gd.CreateProgramWithMinimalLayout(new[] _programColorBlit = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("ColorBlitFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorBlitFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, blitResourceLayout); ], blitResourceLayout);
_programColorBlitMs = gd.CreateProgramWithMinimalLayout(new[] _programColorBlitMs = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("ColorBlitMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorBlitMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, blitResourceLayout); ], blitResourceLayout);
_programColorBlitClearAlpha = gd.CreateProgramWithMinimalLayout(new[] _programColorBlitClearAlpha = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("ColorBlitClearAlphaFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorBlitClearAlphaFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, blitResourceLayout); ], blitResourceLayout);
ResourceLayout colorClearResourceLayout = new ResourceLayoutBuilder().Add(ResourceStages.Vertex, ResourceType.UniformBuffer, 1).Build(); ResourceLayout colorClearResourceLayout = new ResourceLayoutBuilder().Add(ResourceStages.Vertex, ResourceType.UniformBuffer, 1).Build();
_programColorClearF = gd.CreateProgramWithMinimalLayout(new[] _programColorClearF = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorClearVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorClearVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("ColorClearFFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorClearFFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, colorClearResourceLayout); ], colorClearResourceLayout);
_programColorClearSI = gd.CreateProgramWithMinimalLayout(new[] _programColorClearSI = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorClearVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorClearVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("ColorClearSIFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorClearSIFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, colorClearResourceLayout); ], colorClearResourceLayout);
_programColorClearUI = gd.CreateProgramWithMinimalLayout(new[] _programColorClearUI = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorClearVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorClearVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("ColorClearUIFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorClearUIFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, colorClearResourceLayout); ], colorClearResourceLayout);
_programDepthStencilClear = gd.CreateProgramWithMinimalLayout(new[] _programDepthStencilClear = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorClearVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorClearVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("DepthStencilClearFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("DepthStencilClearFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, colorClearResourceLayout); ], colorClearResourceLayout);
ResourceLayout strideChangeResourceLayout = new ResourceLayoutBuilder() ResourceLayout strideChangeResourceLayout = new ResourceLayoutBuilder()
.Add(ResourceStages.Compute, ResourceType.UniformBuffer, 0) .Add(ResourceStages.Compute, ResourceType.UniformBuffer, 0)
.Add(ResourceStages.Compute, ResourceType.StorageBuffer, 1) .Add(ResourceStages.Compute, ResourceType.StorageBuffer, 1)
.Add(ResourceStages.Compute, ResourceType.StorageBuffer, 2, true).Build(); .Add(ResourceStages.Compute, ResourceType.StorageBuffer, 2, true).Build();
_programStrideChange = gd.CreateProgramWithMinimalLayout(new[] _programStrideChange = gd.CreateProgramWithMinimalLayout([
{ new ShaderSource(ReadSpirv("ChangeBufferStride.spv"), ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(ReadSpirv("ChangeBufferStride.spv"), ShaderStage.Compute, TargetLanguage.Spirv), ], strideChangeResourceLayout);
}, strideChangeResourceLayout);
ResourceLayout colorCopyResourceLayout = new ResourceLayoutBuilder() ResourceLayout colorCopyResourceLayout = new ResourceLayoutBuilder()
.Add(ResourceStages.Compute, ResourceType.UniformBuffer, 0) .Add(ResourceStages.Compute, ResourceType.UniformBuffer, 0)
.Add(ResourceStages.Compute, ResourceType.TextureAndSampler, 0) .Add(ResourceStages.Compute, ResourceType.TextureAndSampler, 0)
.Add(ResourceStages.Compute, ResourceType.Image, 0, true).Build(); .Add(ResourceStages.Compute, ResourceType.Image, 0, true).Build();
_programColorCopyShortening = gd.CreateProgramWithMinimalLayout(new[] _programColorCopyShortening = gd.CreateProgramWithMinimalLayout([
{ new ShaderSource(ReadSpirv("ColorCopyShorteningCompute.spv"), ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(ReadSpirv("ColorCopyShorteningCompute.spv"), ShaderStage.Compute, TargetLanguage.Spirv), ], colorCopyResourceLayout);
}, colorCopyResourceLayout);
_programColorCopyToNonMs = gd.CreateProgramWithMinimalLayout(new[] _programColorCopyToNonMs = gd.CreateProgramWithMinimalLayout([
{ new ShaderSource(ReadSpirv("ColorCopyToNonMsCompute.spv"), ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(ReadSpirv("ColorCopyToNonMsCompute.spv"), ShaderStage.Compute, TargetLanguage.Spirv), ], colorCopyResourceLayout);
}, colorCopyResourceLayout);
_programColorCopyWidening = gd.CreateProgramWithMinimalLayout(new[] _programColorCopyWidening = gd.CreateProgramWithMinimalLayout([
{ new ShaderSource(ReadSpirv("ColorCopyWideningCompute.spv"), ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(ReadSpirv("ColorCopyWideningCompute.spv"), ShaderStage.Compute, TargetLanguage.Spirv), ], colorCopyResourceLayout);
}, colorCopyResourceLayout);
ResourceLayout colorDrawToMsResourceLayout = new ResourceLayoutBuilder() ResourceLayout colorDrawToMsResourceLayout = new ResourceLayoutBuilder()
.Add(ResourceStages.Fragment, ResourceType.UniformBuffer, 0) .Add(ResourceStages.Fragment, ResourceType.UniformBuffer, 0)
.Add(ResourceStages.Fragment, ResourceType.TextureAndSampler, 0).Build(); .Add(ResourceStages.Fragment, ResourceType.TextureAndSampler, 0).Build();
_programColorDrawToMs = gd.CreateProgramWithMinimalLayout(new[] _programColorDrawToMs = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorDrawToMsVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorDrawToMsVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("ColorDrawToMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorDrawToMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, colorDrawToMsResourceLayout); ], colorDrawToMsResourceLayout);
ResourceLayout convertD32S8ToD24S8ResourceLayout = new ResourceLayoutBuilder() ResourceLayout convertD32S8ToD24S8ResourceLayout = new ResourceLayoutBuilder()
.Add(ResourceStages.Compute, ResourceType.UniformBuffer, 0) .Add(ResourceStages.Compute, ResourceType.UniformBuffer, 0)
.Add(ResourceStages.Compute, ResourceType.StorageBuffer, 1) .Add(ResourceStages.Compute, ResourceType.StorageBuffer, 1)
.Add(ResourceStages.Compute, ResourceType.StorageBuffer, 2, true).Build(); .Add(ResourceStages.Compute, ResourceType.StorageBuffer, 2, true).Build();
_programConvertD32S8ToD24S8 = gd.CreateProgramWithMinimalLayout(new[] _programConvertD32S8ToD24S8 = gd.CreateProgramWithMinimalLayout([
{ new ShaderSource(ReadSpirv("ConvertD32S8ToD24S8.spv"), ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(ReadSpirv("ConvertD32S8ToD24S8.spv"), ShaderStage.Compute, TargetLanguage.Spirv), ], convertD32S8ToD24S8ResourceLayout);
}, convertD32S8ToD24S8ResourceLayout);
ResourceLayout convertIndexBufferResourceLayout = new ResourceLayoutBuilder() ResourceLayout convertIndexBufferResourceLayout = new ResourceLayoutBuilder()
.Add(ResourceStages.Compute, ResourceType.UniformBuffer, 0) .Add(ResourceStages.Compute, ResourceType.UniformBuffer, 0)
.Add(ResourceStages.Compute, ResourceType.StorageBuffer, 1) .Add(ResourceStages.Compute, ResourceType.StorageBuffer, 1)
.Add(ResourceStages.Compute, ResourceType.StorageBuffer, 2, true).Build(); .Add(ResourceStages.Compute, ResourceType.StorageBuffer, 2, true).Build();
_programConvertIndexBuffer = gd.CreateProgramWithMinimalLayout(new[] _programConvertIndexBuffer = gd.CreateProgramWithMinimalLayout([
{ new ShaderSource(ReadSpirv("ConvertIndexBuffer.spv"), ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(ReadSpirv("ConvertIndexBuffer.spv"), ShaderStage.Compute, TargetLanguage.Spirv), ], convertIndexBufferResourceLayout);
}, convertIndexBufferResourceLayout);
ResourceLayout convertIndirectDataResourceLayout = new ResourceLayoutBuilder() ResourceLayout convertIndirectDataResourceLayout = new ResourceLayoutBuilder()
.Add(ResourceStages.Compute, ResourceType.UniformBuffer, 0) .Add(ResourceStages.Compute, ResourceType.UniformBuffer, 0)
@ -179,60 +165,51 @@ namespace Ryujinx.Graphics.Vulkan
.Add(ResourceStages.Compute, ResourceType.StorageBuffer, 2, true) .Add(ResourceStages.Compute, ResourceType.StorageBuffer, 2, true)
.Add(ResourceStages.Compute, ResourceType.StorageBuffer, 3).Build(); .Add(ResourceStages.Compute, ResourceType.StorageBuffer, 3).Build();
_programConvertIndirectData = gd.CreateProgramWithMinimalLayout(new[] _programConvertIndirectData = gd.CreateProgramWithMinimalLayout([
{ new ShaderSource(ReadSpirv("ConvertIndirectData.spv"), ShaderStage.Compute, TargetLanguage.Spirv)
new ShaderSource(ReadSpirv("ConvertIndirectData.spv"), ShaderStage.Compute, TargetLanguage.Spirv), ], convertIndirectDataResourceLayout);
}, convertIndirectDataResourceLayout);
_programDepthBlit = gd.CreateProgramWithMinimalLayout(new[] _programDepthBlit = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("DepthBlitFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("DepthBlitFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, blitResourceLayout); ], blitResourceLayout);
_programDepthBlitMs = gd.CreateProgramWithMinimalLayout(new[] _programDepthBlitMs = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("DepthBlitMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("DepthBlitMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, blitResourceLayout); ], blitResourceLayout);
_programDepthDrawToMs = gd.CreateProgramWithMinimalLayout(new[] _programDepthDrawToMs = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorDrawToMsVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorDrawToMsVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("DepthDrawToMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("DepthDrawToMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, colorDrawToMsResourceLayout); ], colorDrawToMsResourceLayout);
_programDepthDrawToNonMs = gd.CreateProgramWithMinimalLayout(new[] _programDepthDrawToNonMs = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorDrawToMsVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorDrawToMsVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("DepthDrawToNonMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("DepthDrawToNonMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, colorDrawToMsResourceLayout); ], colorDrawToMsResourceLayout);
if (gd.Capabilities.SupportsShaderStencilExport) if (gd.Capabilities.SupportsShaderStencilExport)
{ {
_programStencilBlit = gd.CreateProgramWithMinimalLayout(new[] _programStencilBlit = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("StencilBlitFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("StencilBlitFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, blitResourceLayout); ], blitResourceLayout);
_programStencilBlitMs = gd.CreateProgramWithMinimalLayout(new[] _programStencilBlitMs = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorBlitVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("StencilBlitMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("StencilBlitMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, blitResourceLayout); ], blitResourceLayout);
_programStencilDrawToMs = gd.CreateProgramWithMinimalLayout(new[] _programStencilDrawToMs = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorDrawToMsVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorDrawToMsVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("StencilDrawToMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("StencilDrawToMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, colorDrawToMsResourceLayout); ], colorDrawToMsResourceLayout);
_programStencilDrawToNonMs = gd.CreateProgramWithMinimalLayout(new[] _programStencilDrawToNonMs = gd.CreateProgramWithMinimalLayout([
{
new ShaderSource(ReadSpirv("ColorDrawToMsVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("ColorDrawToMsVertex.spv"), ShaderStage.Vertex, TargetLanguage.Spirv),
new ShaderSource(ReadSpirv("StencilDrawToNonMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv), new ShaderSource(ReadSpirv("StencilDrawToNonMsFragment.spv"), ShaderStage.Fragment, TargetLanguage.Spirv)
}, colorDrawToMsResourceLayout); ], colorDrawToMsResourceLayout);
} }
} }
@ -407,7 +384,7 @@ namespace Ryujinx.Graphics.Vulkan
buffer.Holder.SetDataUnchecked<float>(buffer.Offset, region); buffer.Holder.SetDataUnchecked<float>(buffer.Offset, region);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(1, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(1, buffer.Range)]);
Span<Viewport> viewports = stackalloc Viewport[1]; Span<Viewport> viewports = stackalloc Viewport[1];
@ -450,8 +427,8 @@ namespace Ryujinx.Graphics.Vulkan
int dstHeight = dst.Height; int dstHeight = dst.Height;
_pipeline.SetRenderTarget(dst, (uint)dstWidth, (uint)dstHeight); _pipeline.SetRenderTarget(dst, (uint)dstWidth, (uint)dstHeight);
_pipeline.SetRenderTargetColorMasks(new uint[] { 0xf }); _pipeline.SetRenderTargetColorMasks([0xf]);
_pipeline.SetScissors(stackalloc Rectangle<int>[] { new Rectangle<int>(0, 0, dstWidth, dstHeight) }); _pipeline.SetScissors([new Rectangle<int>(0, 0, dstWidth, dstHeight)]);
if (clearAlpha) if (clearAlpha)
{ {
@ -503,7 +480,7 @@ namespace Ryujinx.Graphics.Vulkan
buffer.Holder.SetDataUnchecked<float>(buffer.Offset, region); buffer.Holder.SetDataUnchecked<float>(buffer.Offset, region);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(1, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(1, buffer.Range)]);
Span<Viewport> viewports = stackalloc Viewport[1]; Span<Viewport> viewports = stackalloc Viewport[1];
@ -526,7 +503,7 @@ namespace Ryujinx.Graphics.Vulkan
int dstHeight = dst.Height; int dstHeight = dst.Height;
_pipeline.SetRenderTarget(dst, (uint)dstWidth, (uint)dstHeight); _pipeline.SetRenderTarget(dst, (uint)dstWidth, (uint)dstHeight);
_pipeline.SetScissors(stackalloc Rectangle<int>[] { new Rectangle<int>(0, 0, dstWidth, dstHeight) }); _pipeline.SetScissors([new Rectangle<int>(0, 0, dstWidth, dstHeight)]);
_pipeline.SetViewports(viewports); _pipeline.SetViewports(viewports);
_pipeline.SetPrimitiveTopology(PrimitiveTopology.TriangleStrip); _pipeline.SetPrimitiveTopology(PrimitiveTopology.TriangleStrip);
@ -657,7 +634,7 @@ namespace Ryujinx.Graphics.Vulkan
buffer.Holder.SetDataUnchecked(buffer.Offset, clearColor); buffer.Holder.SetDataUnchecked(buffer.Offset, clearColor);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(1, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(1, buffer.Range)]);
Span<Viewport> viewports = stackalloc Viewport[1]; Span<Viewport> viewports = stackalloc Viewport[1];
@ -689,7 +666,7 @@ namespace Ryujinx.Graphics.Vulkan
_pipeline.SetRenderTarget(dst, (uint)dstWidth, (uint)dstHeight); _pipeline.SetRenderTarget(dst, (uint)dstWidth, (uint)dstHeight);
_pipeline.SetRenderTargetColorMasks(new[] { componentMask }); _pipeline.SetRenderTargetColorMasks(new[] { componentMask });
_pipeline.SetViewports(viewports); _pipeline.SetViewports(viewports);
_pipeline.SetScissors(stackalloc Rectangle<int>[] { scissor }); _pipeline.SetScissors([scissor]);
_pipeline.SetPrimitiveTopology(PrimitiveTopology.TriangleStrip); _pipeline.SetPrimitiveTopology(PrimitiveTopology.TriangleStrip);
_pipeline.Draw(4, 1, 0, 0); _pipeline.Draw(4, 1, 0, 0);
_pipeline.Finish(); _pipeline.Finish();
@ -717,9 +694,9 @@ namespace Ryujinx.Graphics.Vulkan
using ScopedTemporaryBuffer buffer = gd.BufferManager.ReserveOrCreate(gd, cbs, ClearColorBufferSize); using ScopedTemporaryBuffer buffer = gd.BufferManager.ReserveOrCreate(gd, cbs, ClearColorBufferSize);
buffer.Holder.SetDataUnchecked<float>(buffer.Offset, stackalloc float[] { depthValue }); buffer.Holder.SetDataUnchecked<float>(buffer.Offset, [depthValue]);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(1, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(1, buffer.Range)]);
Span<Viewport> viewports = stackalloc Viewport[1]; Span<Viewport> viewports = stackalloc Viewport[1];
@ -735,7 +712,7 @@ namespace Ryujinx.Graphics.Vulkan
_pipeline.SetProgram(_programDepthStencilClear); _pipeline.SetProgram(_programDepthStencilClear);
_pipeline.SetRenderTarget(dst, (uint)dstWidth, (uint)dstHeight); _pipeline.SetRenderTarget(dst, (uint)dstWidth, (uint)dstHeight);
_pipeline.SetViewports(viewports); _pipeline.SetViewports(viewports);
_pipeline.SetScissors(stackalloc Rectangle<int>[] { scissor }); _pipeline.SetScissors([scissor]);
_pipeline.SetPrimitiveTopology(PrimitiveTopology.TriangleStrip); _pipeline.SetPrimitiveTopology(PrimitiveTopology.TriangleStrip);
_pipeline.SetDepthTest(new DepthTestDescriptor(true, depthMask, CompareOp.Always)); _pipeline.SetDepthTest(new DepthTestDescriptor(true, depthMask, CompareOp.Always));
_pipeline.SetStencilTest(CreateStencilTestDescriptor(stencilMask != 0, stencilValue, 0xff, stencilMask)); _pipeline.SetStencilTest(CreateStencilTestDescriptor(stencilMask != 0, stencilValue, 0xff, stencilMask));
@ -776,7 +753,7 @@ namespace Ryujinx.Graphics.Vulkan
gd.BufferManager.SetData<float>(bufferHandle, 0, region); gd.BufferManager.SetData<float>(bufferHandle, 0, region);
pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(1, new BufferRange(bufferHandle, 0, RegionBufferSize)) }); pipeline.SetUniformBuffers([new BufferAssignment(1, new BufferRange(bufferHandle, 0, RegionBufferSize))]);
Span<Viewport> viewports = stackalloc Viewport[1]; Span<Viewport> viewports = stackalloc Viewport[1];
@ -852,7 +829,7 @@ namespace Ryujinx.Graphics.Vulkan
_pipeline.SetCommandBuffer(cbs); _pipeline.SetCommandBuffer(cbs);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(0, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(0, buffer.Range)]);
Span<Auto<DisposableBuffer>> sbRanges = new Auto<DisposableBuffer>[2]; Span<Auto<DisposableBuffer>> sbRanges = new Auto<DisposableBuffer>[2];
@ -915,7 +892,7 @@ namespace Ryujinx.Graphics.Vulkan
gd.Api.CmdFillBuffer(cbs.CommandBuffer, dstBuffer, 0, Vk.WholeSize, 0); gd.Api.CmdFillBuffer(cbs.CommandBuffer, dstBuffer, 0, Vk.WholeSize, 0);
List<BufferCopy> bufferCopy = new(); List<BufferCopy> bufferCopy = [];
int outputOffset = 0; int outputOffset = 0;
// Try to merge copies of adjacent indices to reduce copy count. // Try to merge copies of adjacent indices to reduce copy count.
@ -1030,7 +1007,7 @@ namespace Ryujinx.Graphics.Vulkan
Format srcFormat = GetFormat(componentSize, srcBpp / componentSize); Format srcFormat = GetFormat(componentSize, srcBpp / componentSize);
Format dstFormat = GetFormat(componentSize, dstBpp / componentSize); Format dstFormat = GetFormat(componentSize, dstBpp / componentSize);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(0, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(0, buffer.Range)]);
for (int l = 0; l < levels; l++) for (int l = 0; l < levels; l++)
{ {
@ -1111,7 +1088,7 @@ namespace Ryujinx.Graphics.Vulkan
1); 1);
_pipeline.SetCommandBuffer(cbs); _pipeline.SetCommandBuffer(cbs);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(0, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(0, buffer.Range)]);
if (isDepthOrStencil) if (isDepthOrStencil)
{ {
@ -1130,7 +1107,7 @@ namespace Ryujinx.Graphics.Vulkan
0f, 0f,
1f); 1f);
_pipeline.SetScissors(stackalloc Rectangle<int>[] { new Rectangle<int>(0, 0, dst.Width, dst.Height) }); _pipeline.SetScissors([new Rectangle<int>(0, 0, dst.Width, dst.Height)]);
_pipeline.SetViewports(viewports); _pipeline.SetViewports(viewports);
_pipeline.SetPrimitiveTopology(PrimitiveTopology.TriangleStrip); _pipeline.SetPrimitiveTopology(PrimitiveTopology.TriangleStrip);
@ -1251,12 +1228,12 @@ namespace Ryujinx.Graphics.Vulkan
0f, 0f,
1f); 1f);
_pipeline.SetRenderTargetColorMasks(new uint[] { 0xf }); _pipeline.SetRenderTargetColorMasks([0xf]);
_pipeline.SetScissors(stackalloc Rectangle<int>[] { new Rectangle<int>(0, 0, dst.Width, dst.Height) }); _pipeline.SetScissors([new Rectangle<int>(0, 0, dst.Width, dst.Height)]);
_pipeline.SetViewports(viewports); _pipeline.SetViewports(viewports);
_pipeline.SetPrimitiveTopology(PrimitiveTopology.TriangleStrip); _pipeline.SetPrimitiveTopology(PrimitiveTopology.TriangleStrip);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(0, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(0, buffer.Range)]);
if (isDepthOrStencil) if (isDepthOrStencil)
{ {
@ -1578,9 +1555,9 @@ namespace Ryujinx.Graphics.Vulkan
srcIndirectBufferOffset, srcIndirectBufferOffset,
indirectDataSize); indirectDataSize);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(0, drawCountBufferAligned) }); _pipeline.SetUniformBuffers([new BufferAssignment(0, drawCountBufferAligned)]);
_pipeline.SetStorageBuffers(1, new[] { srcIndirectBuffer.GetBuffer(), dstIndirectBuffer.GetBuffer() }); _pipeline.SetStorageBuffers(1, new[] { srcIndirectBuffer.GetBuffer(), dstIndirectBuffer.GetBuffer() });
_pipeline.SetStorageBuffers(stackalloc[] { new BufferAssignment(3, patternScoped.Range) }); _pipeline.SetStorageBuffers([new BufferAssignment(3, patternScoped.Range)]);
_pipeline.SetProgram(_programConvertIndirectData); _pipeline.SetProgram(_programConvertIndirectData);
_pipeline.DispatchCompute(1, 1, 1); _pipeline.DispatchCompute(1, 1, 1);
@ -1607,7 +1584,8 @@ namespace Ryujinx.Graphics.Vulkan
0, 0,
convertedCount * outputIndexSize); convertedCount * outputIndexSize);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(0, new BufferRange(patternScoped.Handle, patternScoped.Offset, ParamsBufferSize)) }); _pipeline.SetUniformBuffers([new BufferAssignment(0, new BufferRange(patternScoped.Handle, patternScoped.Offset, ParamsBufferSize))
]);
_pipeline.SetStorageBuffers(1, new[] { srcIndexBuffer.GetBuffer(), dstIndexBuffer.GetBuffer() }); _pipeline.SetStorageBuffers(1, new[] { srcIndexBuffer.GetBuffer(), dstIndexBuffer.GetBuffer() });
_pipeline.SetProgram(_programConvertIndexBuffer); _pipeline.SetProgram(_programConvertIndexBuffer);
@ -1675,7 +1653,7 @@ namespace Ryujinx.Graphics.Vulkan
_pipeline.SetCommandBuffer(cbs); _pipeline.SetCommandBuffer(cbs);
_pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(0, buffer.Range) }); _pipeline.SetUniformBuffers([new BufferAssignment(0, buffer.Range)]);
Span<Auto<DisposableBuffer>> sbRanges = new Auto<DisposableBuffer>[2]; Span<Auto<DisposableBuffer>> sbRanges = new Auto<DisposableBuffer>[2];

View File

@ -44,7 +44,7 @@ namespace Ryujinx.Graphics.Vulkan
_hostMemoryApi = hostMemoryApi; _hostMemoryApi = hostMemoryApi;
_device = device; _device = device;
_allocations = new List<HostMemoryAllocation>(); _allocations = [];
_allocationTree = new IntervalTree<ulong, HostMemoryAllocation>(); _allocationTree = new IntervalTree<ulong, HostMemoryAllocation>();
} }

View File

@ -10,7 +10,7 @@ namespace Ryujinx.Graphics.Vulkan
public IdList() public IdList()
{ {
_list = new List<T>(); _list = [];
_freeMin = 0; _freeMin = 0;
} }

View File

@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Vulkan
if (storages == null) if (storages == null)
{ {
storages = new HashSet<TextureStorage>(); storages = [];
for (int index = 0; index < _textureRefs.Length; index++) for (int index = 0; index < _textureRefs.Length; index++)
{ {

View File

@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.Vulkan
_api = api; _api = api;
_physicalDevice = physicalDevice; _physicalDevice = physicalDevice;
_device = device; _device = device;
_blockLists = new List<MemoryAllocatorBlockList>(); _blockLists = [];
_blockAlignment = (int)Math.Min(int.MaxValue, MaxDeviceMemoryUsageEstimate / _physicalDevice.PhysicalDeviceProperties.Limits.MaxMemoryAllocationCount); _blockAlignment = (int)Math.Min(int.MaxValue, MaxDeviceMemoryUsageEstimate / _physicalDevice.PhysicalDeviceProperties.Limits.MaxMemoryAllocationCount);
_lock = new(LockRecursionPolicy.NoRecursion); _lock = new(LockRecursionPolicy.NoRecursion);
} }

View File

@ -42,10 +42,10 @@ namespace Ryujinx.Graphics.Vulkan
Memory = memory; Memory = memory;
HostPointer = hostPointer; HostPointer = hostPointer;
Size = size; Size = size;
_freeRanges = new List<Range> _freeRanges =
{ [
new(0, size), new(0, size)
}; ];
} }
public ulong Allocate(ulong size, ulong alignment) public ulong Allocate(ulong size, ulong alignment)
@ -171,7 +171,7 @@ namespace Ryujinx.Graphics.Vulkan
public MemoryAllocatorBlockList(Vk api, Device device, int memoryTypeIndex, int blockAlignment, bool forBuffer) public MemoryAllocatorBlockList(Vk api, Device device, int memoryTypeIndex, int blockAlignment, bool forBuffer)
{ {
_blocks = new List<Block>(); _blocks = [];
_api = api; _api = api;
_device = device; _device = device;
MemoryTypeIndex = memoryTypeIndex; MemoryTypeIndex = memoryTypeIndex;

View File

@ -40,7 +40,7 @@ namespace Ryujinx.Graphics.Vulkan.MoltenVK
path = path[..^VulkanLib.Length] + "libMoltenVK.dylib"; path = path[..^VulkanLib.Length] + "libMoltenVK.dylib";
return [path]; return [path];
} }
return Array.Empty<string>(); return [];
} }
public static void InitializeResolver() public static void InitializeResolver()

View File

@ -136,8 +136,8 @@ namespace Ryujinx.Graphics.Vulkan
{ {
_descriptorSetUpdater.Initialize(IsMainPipeline); _descriptorSetUpdater.Initialize(IsMainPipeline);
QuadsToTrisPattern = new IndexBufferPattern(Gd, 4, 6, 0, new[] { 0, 1, 2, 0, 2, 3 }, 4, false); QuadsToTrisPattern = new IndexBufferPattern(Gd, 4, 6, 0, [0, 1, 2, 0, 2, 3], 4, false);
TriFanToTrisPattern = new IndexBufferPattern(Gd, 3, 3, 2, new[] { int.MinValue, -1, 0 }, 1, true); TriFanToTrisPattern = new IndexBufferPattern(Gd, 3, 3, 2, [int.MinValue, -1, 0], 1, true);
} }
public unsafe void Barrier() public unsafe void Barrier()

View File

@ -22,10 +22,10 @@ namespace Ryujinx.Graphics.Vulkan
public PipelineFull(VulkanRenderer gd, Device device) : base(gd, device) public PipelineFull(VulkanRenderer gd, Device device) : base(gd, device)
{ {
_activeQueries = new List<(QueryPool, bool)>(); _activeQueries = [];
_pendingQueryCopies = new(); _pendingQueryCopies = [];
_backingSwaps = new(); _backingSwaps = [];
_activeBufferMirrors = new(); _activeBufferMirrors = [];
CommandBuffer = (Cbs = gd.CommandBufferPool.Rent()).CommandBuffer; CommandBuffer = (Cbs = gd.CommandBufferPool.Rent()).CommandBuffer;

View File

@ -83,7 +83,7 @@ namespace Ryujinx.Graphics.Vulkan
for (int j = 0; j < _dsCache[i].Length; j++) for (int j = 0; j < _dsCache[i].Length; j++)
{ {
_dsCache[i][j] = new List<Auto<DescriptorSetCollection>>(); _dsCache[i][j] = [];
} }
} }
@ -173,7 +173,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
FreeCompletedManualDescriptorSets(); FreeCompletedManualDescriptorSets();
List<ManualDescriptorSetEntry> list = _manualDsCache[setIndex] ??= new(); List<ManualDescriptorSetEntry> list = _manualDsCache[setIndex] ??= [];
Span<ManualDescriptorSetEntry> span = CollectionsMarshal.AsSpan(list); Span<ManualDescriptorSetEntry> span = CollectionsMarshal.AsSpan(list);
Queue<int> freeQueue = _freeManualDsCacheEntries[setIndex]; Queue<int> freeQueue = _freeManualDsCacheEntries[setIndex];

View File

@ -144,7 +144,7 @@ namespace Ryujinx.Graphics.Vulkan
_textures = textures; _textures = textures;
_key = key; _key = key;
_forcedFences = new List<ForcedFence>(); _forcedFences = [];
} }
public Auto<DisposableFramebuffer> GetFramebuffer(VulkanRenderer gd, CommandBufferScoped cbs, FramebufferParams fb) public Auto<DisposableFramebuffer> GetFramebuffer(VulkanRenderer gd, CommandBufferScoped cbs, FramebufferParams fb)

View File

@ -18,8 +18,8 @@ namespace Ryujinx.Graphics.Vulkan
for (int index = 0; index < TotalSets; index++) for (int index = 0; index < TotalSets; index++)
{ {
_resourceDescriptors[index] = new(); _resourceDescriptors[index] = [];
_resourceUsages[index] = new(); _resourceUsages[index] = [];
} }
} }

View File

@ -168,7 +168,7 @@ namespace Ryujinx.Graphics.Vulkan
// If binding 3 is immediately used, use an alternate set of reserved bindings. // If binding 3 is immediately used, use an alternate set of reserved bindings.
ReadOnlyCollection<ResourceUsage> uniformUsage = layout.SetUsages[0].Usages; ReadOnlyCollection<ResourceUsage> uniformUsage = layout.SetUsages[0].Usages;
bool hasBinding3 = uniformUsage.Any(x => x.Binding == 3); bool hasBinding3 = uniformUsage.Any(x => x.Binding == 3);
int[] reserved = isCompute ? Array.Empty<int>() : gd.GetPushDescriptorReservedBindings(hasBinding3); int[] reserved = isCompute ? [] : gd.GetPushDescriptorReservedBindings(hasBinding3);
// Can't use any of the reserved usages. // Can't use any of the reserved usages.
for (int i = 0; i < uniformUsage.Count; i++) for (int i = 0; i < uniformUsage.Count; i++)
@ -249,7 +249,7 @@ namespace Ryujinx.Graphics.Vulkan
for (int setIndex = 0; setIndex < sets.Count; setIndex++) for (int setIndex = 0; setIndex < sets.Count; setIndex++)
{ {
List<ResourceBindingSegment> currentSegments = new(); List<ResourceBindingSegment> currentSegments = [];
ResourceDescriptor currentDescriptor = default; ResourceDescriptor currentDescriptor = default;
int currentCount = 0; int currentCount = 0;
@ -307,7 +307,7 @@ namespace Ryujinx.Graphics.Vulkan
for (int setIndex = 0; setIndex < setUsages.Count; setIndex++) for (int setIndex = 0; setIndex < setUsages.Count; setIndex++)
{ {
List<ResourceBindingSegment> currentSegments = new(); List<ResourceBindingSegment> currentSegments = [];
ResourceUsage currentUsage = default; ResourceUsage currentUsage = default;
int currentCount = 0; int currentCount = 0;

View File

@ -33,7 +33,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
_gd = gd; _gd = gd;
_device = device; _device = device;
_handles = new List<SyncHandle>(); _handles = [];
} }
public void RegisterFlush() public void RegisterFlush()

View File

@ -113,7 +113,7 @@ namespace Ryujinx.Graphics.Vulkan
if (storages == null) if (storages == null)
{ {
storages = new HashSet<TextureStorage>(); storages = [];
for (int index = 0; index < _textureRefs.Length; index++) for (int index = 0; index < _textureRefs.Length; index++)
{ {

View File

@ -21,7 +21,8 @@ namespace Ryujinx.Graphics.Vulkan
private const string AppName = "Ryujinx.Graphics.Vulkan"; private const string AppName = "Ryujinx.Graphics.Vulkan";
private const int QueuesCount = 2; private const int QueuesCount = 2;
private static readonly string[] _desirableExtensions = { private static readonly string[] _desirableExtensions =
[
ExtConditionalRendering.ExtensionName, ExtConditionalRendering.ExtensionName,
ExtExtendedDynamicState.ExtensionName, ExtExtendedDynamicState.ExtensionName,
ExtTransformFeedback.ExtensionName, ExtTransformFeedback.ExtensionName,
@ -46,16 +47,17 @@ namespace Ryujinx.Graphics.Vulkan
"VK_KHR_8bit_storage", "VK_KHR_8bit_storage",
"VK_KHR_maintenance2", "VK_KHR_maintenance2",
"VK_EXT_attachment_feedback_loop_layout", "VK_EXT_attachment_feedback_loop_layout",
"VK_EXT_attachment_feedback_loop_dynamic_state", "VK_EXT_attachment_feedback_loop_dynamic_state"
}; ];
private static readonly string[] _requiredExtensions = { private static readonly string[] _requiredExtensions =
KhrSwapchain.ExtensionName, [
}; KhrSwapchain.ExtensionName
];
internal static VulkanInstance CreateInstance(Vk api, GraphicsDebugLevel logLevel, string[] requiredExtensions) internal static VulkanInstance CreateInstance(Vk api, GraphicsDebugLevel logLevel, string[] requiredExtensions)
{ {
List<string> enabledLayers = new(); List<string> enabledLayers = [];
IReadOnlySet<string> instanceExtensions = VulkanInstance.GetInstanceExtensions(api); IReadOnlySet<string> instanceExtensions = VulkanInstance.GetInstanceExtensions(api);
IReadOnlySet<string> instanceLayers = VulkanInstance.GetInstanceLayers(api); IReadOnlySet<string> instanceLayers = VulkanInstance.GetInstanceLayers(api);
@ -197,12 +199,12 @@ namespace Ryujinx.Graphics.Vulkan
// TODO: Remove this once we relax our initialization codepaths. // TODO: Remove this once we relax our initialization codepaths.
if (instance.InstanceVersion < _minimalInstanceVulkanVersion) if (instance.InstanceVersion < _minimalInstanceVulkanVersion)
{ {
return Array.Empty<DeviceInfo>(); return [];
} }
instance.EnumeratePhysicalDevices(out VulkanPhysicalDevice[] physicalDevices).ThrowOnError(); instance.EnumeratePhysicalDevices(out VulkanPhysicalDevice[] physicalDevices).ThrowOnError();
List<DeviceInfo> deviceInfos = new(); List<DeviceInfo> deviceInfos = [];
foreach (VulkanPhysicalDevice physicalDevice in physicalDevices) foreach (VulkanPhysicalDevice physicalDevice in physicalDevices)
{ {

View File

@ -84,8 +84,8 @@ namespace Ryujinx.Graphics.Vulkan
private readonly string _preferredGpuId; private readonly string _preferredGpuId;
private int[] _pdReservedBindings; private int[] _pdReservedBindings;
private readonly static int[] _pdReservedBindingsNvn = { 3, 18, 21, 36, 30 }; private readonly static int[] _pdReservedBindingsNvn = [3, 18, 21, 36, 30];
private readonly static int[] _pdReservedBindingsOgl = { 17, 18, 34, 35, 36 }; private readonly static int[] _pdReservedBindingsOgl = [17, 18, 34, 35, 36];
internal Vendor Vendor { get; private set; } internal Vendor Vendor { get; private set; }
internal bool IsAmdWindows { get; private set; } internal bool IsAmdWindows { get; private set; }
@ -522,7 +522,7 @@ namespace Ryujinx.Graphics.Vulkan
} }
else else
{ {
_pdReservedBindings = Array.Empty<int>(); _pdReservedBindings = [];
} }
} }
@ -832,7 +832,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
Logger.Error?.PrintMsg(LogClass.Gpu, $"Error querying Vulkan devices: {ex.Message}"); Logger.Error?.PrintMsg(LogClass.Gpu, $"Error querying Vulkan devices: {ex.Message}");
return Array.Empty<DeviceInfo>(); return [];
} }
} }
@ -845,7 +845,7 @@ namespace Ryujinx.Graphics.Vulkan
catch (Exception) catch (Exception)
{ {
// If we got an exception here, Vulkan is most likely not supported. // If we got an exception here, Vulkan is most likely not supported.
return Array.Empty<DeviceInfo>(); return [];
} }
} }

View File

@ -394,7 +394,7 @@ namespace Ryujinx.Graphics.Vulkan
_gd.CommandBufferPool.Return( _gd.CommandBufferPool.Return(
cbs, cbs,
null, null,
stackalloc[] { PipelineStageFlags.ColorAttachmentOutputBit }, [PipelineStageFlags.ColorAttachmentOutputBit],
null); null);
_gd.FlushAllCommands(); _gd.FlushAllCommands();
cbs.GetFence().Wait(); cbs.GetFence().Wait();
@ -457,9 +457,9 @@ namespace Ryujinx.Graphics.Vulkan
_gd.CommandBufferPool.Return( _gd.CommandBufferPool.Return(
cbs, cbs,
stackalloc[] { _imageAvailableSemaphores[semaphoreIndex] }, [_imageAvailableSemaphores[semaphoreIndex]],
stackalloc[] { PipelineStageFlags.ColorAttachmentOutputBit }, [PipelineStageFlags.ColorAttachmentOutputBit],
stackalloc[] { _renderFinishedSemaphores[semaphoreIndex] }); [_renderFinishedSemaphores[semaphoreIndex]]);
// TODO: Present queue. // TODO: Present queue.
Semaphore semaphore = _renderFinishedSemaphores[semaphoreIndex]; Semaphore semaphore = _renderFinishedSemaphores[semaphoreIndex];