misc: chore: Fix object creation in Vulkan project

This commit is contained in:
Evan Husted 2025-01-26 15:16:32 -06:00
parent eae6dba610
commit 5f023ca49b
37 changed files with 172 additions and 172 deletions

View File

@ -145,7 +145,7 @@ namespace Ryujinx.Graphics.Vulkan
stages |= PipelineStageFlags.DrawIndirectBit; stages |= PipelineStageFlags.DrawIndirectBit;
} }
MemoryBarrier barrier = new MemoryBarrier() MemoryBarrier barrier = new()
{ {
SType = StructureType.MemoryBarrier, SType = StructureType.MemoryBarrier,
SrcAccessMask = access, SrcAccessMask = access,
@ -175,7 +175,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
// Feedback loop barrier. // Feedback loop barrier.
MemoryBarrier barrier = new MemoryBarrier() MemoryBarrier barrier = new()
{ {
SType = StructureType.MemoryBarrier, SType = StructureType.MemoryBarrier,
SrcAccessMask = AccessFlags.ShaderWriteBit, SrcAccessMask = AccessFlags.ShaderWriteBit,

View File

@ -220,7 +220,7 @@ namespace Ryujinx.Graphics.Vulkan
public BitMapStruct<T> Union(BitMapStruct<T> other) public BitMapStruct<T> Union(BitMapStruct<T> other)
{ {
BitMapStruct<T> result = new BitMapStruct<T>(); BitMapStruct<T> result = new();
ref T masks = ref _masks; ref T masks = ref _masks;
ref T otherMasks = ref other._masks; ref T otherMasks = ref other._masks;

View File

@ -113,7 +113,7 @@ namespace Ryujinx.Graphics.Vulkan
public unsafe Auto<DisposableBufferView> CreateView(VkFormat format, int offset, int size, Action invalidateView) public unsafe Auto<DisposableBufferView> CreateView(VkFormat format, int offset, int size, Action invalidateView)
{ {
BufferViewCreateInfo bufferViewCreateInfo = new BufferViewCreateInfo BufferViewCreateInfo bufferViewCreateInfo = new()
{ {
SType = StructureType.BufferViewCreateInfo, SType = StructureType.BufferViewCreateInfo,
Buffer = new VkBuffer(_bufferHandle), Buffer = new VkBuffer(_bufferHandle),
@ -205,7 +205,7 @@ namespace Ryujinx.Graphics.Vulkan
// Build data for the new mirror. // Build data for the new mirror.
Span<byte> baseData = new Span<byte>((void*)(_map + offset), size); Span<byte> baseData = new((void*)(_map + offset), size);
Span<byte> modData = _pendingData.AsSpan(offset, size); Span<byte> modData = _pendingData.AsSpan(offset, size);
StagingBufferReserved? newMirror = _gd.BufferManager.StagingBuffer.TryReserveData(cbs, size); StagingBufferReserved? newMirror = _gd.BufferManager.StagingBuffer.TryReserveData(cbs, size);
@ -723,7 +723,7 @@ namespace Ryujinx.Graphics.Vulkan
dstOffset, dstOffset,
size); size);
BufferCopy region = new BufferCopy((ulong)srcOffset, (ulong)dstOffset, (ulong)size); BufferCopy region = new((ulong)srcOffset, (ulong)dstOffset, (ulong)size);
gd.Api.CmdCopyBuffer(cbs.CommandBuffer, srcBuffer, dstBuffer, 1, &region); gd.Api.CmdCopyBuffer(cbs.CommandBuffer, srcBuffer, dstBuffer, 1, &region);
@ -804,7 +804,7 @@ namespace Ryujinx.Graphics.Vulkan
return null; return null;
} }
I8ToI16CacheKey key = new I8ToI16CacheKey(_gd); I8ToI16CacheKey key = new(_gd);
if (!_cachedConvertedBuffers.TryGetValue(offset, size, key, out BufferHolder holder)) if (!_cachedConvertedBuffers.TryGetValue(offset, size, key, out BufferHolder holder))
{ {
@ -828,7 +828,7 @@ namespace Ryujinx.Graphics.Vulkan
return null; return null;
} }
AlignedVertexBufferCacheKey key = new AlignedVertexBufferCacheKey(_gd, stride, alignment); AlignedVertexBufferCacheKey key = new(_gd, stride, alignment);
if (!_cachedConvertedBuffers.TryGetValue(offset, size, key, out BufferHolder holder)) if (!_cachedConvertedBuffers.TryGetValue(offset, size, key, out BufferHolder holder))
{ {
@ -854,7 +854,7 @@ namespace Ryujinx.Graphics.Vulkan
return null; return null;
} }
TopologyConversionCacheKey key = new TopologyConversionCacheKey(_gd, pattern, indexSize); TopologyConversionCacheKey key = new(_gd, pattern, indexSize);
if (!_cachedConvertedBuffers.TryGetValue(offset, size, key, out BufferHolder holder)) if (!_cachedConvertedBuffers.TryGetValue(offset, size, key, out BufferHolder holder))
{ {

View File

@ -103,13 +103,13 @@ namespace Ryujinx.Graphics.Vulkan
usage |= BufferUsageFlags.IndirectBufferBit; usage |= BufferUsageFlags.IndirectBufferBit;
} }
ExternalMemoryBufferCreateInfo externalMemoryBuffer = new ExternalMemoryBufferCreateInfo ExternalMemoryBufferCreateInfo externalMemoryBuffer = new()
{ {
SType = StructureType.ExternalMemoryBufferCreateInfo, SType = StructureType.ExternalMemoryBufferCreateInfo,
HandleTypes = ExternalMemoryHandleTypeFlags.HostAllocationBitExt, HandleTypes = ExternalMemoryHandleTypeFlags.HostAllocationBitExt,
}; };
BufferCreateInfo bufferCreateInfo = new BufferCreateInfo BufferCreateInfo bufferCreateInfo = new()
{ {
SType = StructureType.BufferCreateInfo, SType = StructureType.BufferCreateInfo,
Size = (ulong)size, Size = (ulong)size,
@ -124,7 +124,7 @@ namespace Ryujinx.Graphics.Vulkan
gd.Api.BindBufferMemory(_device, buffer, allocation.GetUnsafe().Memory, allocation.GetUnsafe().Offset + offset); gd.Api.BindBufferMemory(_device, buffer, allocation.GetUnsafe().Memory, allocation.GetUnsafe().Offset + offset);
BufferHolder holder = new BufferHolder(gd, _device, buffer, allocation, size, BufferAllocationType.HostMapped, BufferAllocationType.HostMapped, (int)offset); BufferHolder holder = new(gd, _device, buffer, allocation, size, BufferAllocationType.HostMapped, BufferAllocationType.HostMapped, (int)offset);
BufferCount++; BufferCount++;
@ -149,7 +149,7 @@ namespace Ryujinx.Graphics.Vulkan
size += (ulong)range.Size; size += (ulong)range.Size;
} }
BufferCreateInfo bufferCreateInfo = new BufferCreateInfo() BufferCreateInfo bufferCreateInfo = new()
{ {
SType = StructureType.BufferCreateInfo, SType = StructureType.BufferCreateInfo,
Size = size, Size = size,
@ -207,14 +207,14 @@ namespace Ryujinx.Graphics.Vulkan
fixed (SparseMemoryBind* pMemoryBinds = memoryBinds) fixed (SparseMemoryBind* pMemoryBinds = memoryBinds)
{ {
SparseBufferMemoryBindInfo bufferBind = new SparseBufferMemoryBindInfo() SparseBufferMemoryBindInfo bufferBind = new()
{ {
Buffer = buffer, Buffer = buffer,
BindCount = (uint)memoryBinds.Length, BindCount = (uint)memoryBinds.Length,
PBinds = pMemoryBinds PBinds = pMemoryBinds
}; };
BindSparseInfo bindSparseInfo = new BindSparseInfo() BindSparseInfo bindSparseInfo = new()
{ {
SType = StructureType.BindSparseInfo, SType = StructureType.BindSparseInfo,
BufferBindCount = 1, BufferBindCount = 1,
@ -224,7 +224,7 @@ namespace Ryujinx.Graphics.Vulkan
gd.Api.QueueBindSparse(gd.Queue, 1, in bindSparseInfo, default).ThrowOnError(); gd.Api.QueueBindSparse(gd.Queue, 1, in bindSparseInfo, default).ThrowOnError();
} }
BufferHolder holder = new BufferHolder(gd, _device, buffer, (int)size, storageAllocations); BufferHolder holder = new(gd, _device, buffer, (int)size, storageAllocations);
BufferCount++; BufferCount++;
@ -295,7 +295,7 @@ namespace Ryujinx.Graphics.Vulkan
usage |= BufferUsageFlags.IndirectBufferBit; usage |= BufferUsageFlags.IndirectBufferBit;
} }
BufferCreateInfo bufferCreateInfo = new BufferCreateInfo BufferCreateInfo bufferCreateInfo = new()
{ {
SType = StructureType.BufferCreateInfo, SType = StructureType.BufferCreateInfo,
Size = (ulong)Environment.SystemPageSize, Size = (ulong)Environment.SystemPageSize,
@ -331,7 +331,7 @@ namespace Ryujinx.Graphics.Vulkan
usage |= BufferUsageFlags.IndirectBufferBit; usage |= BufferUsageFlags.IndirectBufferBit;
} }
BufferCreateInfo bufferCreateInfo = new BufferCreateInfo BufferCreateInfo bufferCreateInfo = new()
{ {
SType = StructureType.BufferCreateInfo, SType = StructureType.BufferCreateInfo,
Size = (ulong)size, Size = (ulong)size,
@ -402,7 +402,7 @@ namespace Ryujinx.Graphics.Vulkan
if (buffer.Handle != 0) if (buffer.Handle != 0)
{ {
BufferHolder holder = new BufferHolder(gd, _device, buffer, allocation, size, baseType, resultType); BufferHolder holder = new(gd, _device, buffer, allocation, size, baseType, resultType);
return holder; return holder;
} }
@ -493,7 +493,7 @@ namespace Ryujinx.Graphics.Vulkan
return (null, null); return (null, null);
} }
TopologyConversionIndirectCacheKey indexBufferKey = new TopologyConversionIndirectCacheKey( TopologyConversionIndirectCacheKey indexBufferKey = new(
gd, gd,
pattern, pattern,
indexSize, indexSize,
@ -507,14 +507,14 @@ namespace Ryujinx.Graphics.Vulkan
indexBufferKey, indexBufferKey,
out BufferHolder convertedIndexBuffer); out BufferHolder convertedIndexBuffer);
IndirectDataCacheKey indirectBufferKey = new IndirectDataCacheKey(pattern); IndirectDataCacheKey indirectBufferKey = new(pattern);
bool hasConvertedIndirectBuffer = indirectBufferHolder.TryGetCachedConvertedBuffer( bool hasConvertedIndirectBuffer = indirectBufferHolder.TryGetCachedConvertedBuffer(
indirectBuffer.Offset, indirectBuffer.Offset,
indirectBuffer.Size, indirectBuffer.Size,
indirectBufferKey, indirectBufferKey,
out BufferHolder convertedIndirectBuffer); out BufferHolder convertedIndirectBuffer);
DrawCountCacheKey drawCountBufferKey = new DrawCountCacheKey(); DrawCountCacheKey drawCountBufferKey = new();
bool hasCachedDrawCount = true; bool hasCachedDrawCount = true;
if (hasDrawCount) if (hasDrawCount)
@ -568,7 +568,7 @@ namespace Ryujinx.Graphics.Vulkan
// Any modification of the indirect buffer should invalidate the index buffers that are associated with it, // Any modification of the indirect buffer should invalidate the index buffers that are associated with it,
// since we used the indirect data to find the range of the index buffer that is used. // since we used the indirect data to find the range of the index buffer that is used.
Dependency indexBufferDependency = new Dependency( Dependency indexBufferDependency = new(
indexBufferHolder, indexBufferHolder,
indexBuffer.Offset, indexBuffer.Offset,
indexBuffer.Size, indexBuffer.Size,
@ -590,7 +590,7 @@ namespace Ryujinx.Graphics.Vulkan
// If we have a draw count, any modification of the draw count should invalidate all indirect buffers // If we have a draw count, any modification of the draw count should invalidate all indirect buffers
// where we used it to find the range of indirect data that is actually used. // where we used it to find the range of indirect data that is actually used.
Dependency indirectBufferDependency = new Dependency( Dependency indirectBufferDependency = new(
indirectBufferHolder, indirectBufferHolder,
indirectBuffer.Offset, indirectBuffer.Offset,
indirectBuffer.Size, indirectBuffer.Size,

View File

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

View File

@ -37,7 +37,7 @@ namespace Ryujinx.Graphics.Vulkan
public void Initialize(Vk api, Device device, CommandPool pool) public void Initialize(Vk api, Device device, CommandPool pool)
{ {
CommandBufferAllocateInfo allocateInfo = new CommandBufferAllocateInfo CommandBufferAllocateInfo allocateInfo = new()
{ {
SType = StructureType.CommandBufferAllocateInfo, SType = StructureType.CommandBufferAllocateInfo,
CommandBufferCount = 1, CommandBufferCount = 1,
@ -75,7 +75,7 @@ namespace Ryujinx.Graphics.Vulkan
_concurrentFenceWaitUnsupported = concurrentFenceWaitUnsupported; _concurrentFenceWaitUnsupported = concurrentFenceWaitUnsupported;
_owner = Thread.CurrentThread; _owner = Thread.CurrentThread;
CommandPoolCreateInfo commandPoolCreateInfo = new CommandPoolCreateInfo CommandPoolCreateInfo commandPoolCreateInfo = new()
{ {
SType = StructureType.CommandPoolCreateInfo, SType = StructureType.CommandPoolCreateInfo,
QueueFamilyIndex = queueFamilyIndex, QueueFamilyIndex = queueFamilyIndex,
@ -248,7 +248,7 @@ namespace Ryujinx.Graphics.Vulkan
_inUseCount++; _inUseCount++;
CommandBufferBeginInfo commandBufferBeginInfo = new CommandBufferBeginInfo CommandBufferBeginInfo commandBufferBeginInfo = new()
{ {
SType = StructureType.CommandBufferBeginInfo, SType = StructureType.CommandBufferBeginInfo,
}; };

View File

@ -33,7 +33,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
if (bufferInfo.Buffer.Handle != 0UL) if (bufferInfo.Buffer.Handle != 0UL)
{ {
WriteDescriptorSet writeDescriptorSet = new WriteDescriptorSet WriteDescriptorSet writeDescriptorSet = new()
{ {
SType = StructureType.WriteDescriptorSet, SType = StructureType.WriteDescriptorSet,
DstSet = _descriptorSets[setIndex], DstSet = _descriptorSets[setIndex],
@ -56,7 +56,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (DescriptorBufferInfo* pBufferInfo = bufferInfo) fixed (DescriptorBufferInfo* pBufferInfo = bufferInfo)
{ {
WriteDescriptorSet writeDescriptorSet = new WriteDescriptorSet WriteDescriptorSet writeDescriptorSet = new()
{ {
SType = StructureType.WriteDescriptorSet, SType = StructureType.WriteDescriptorSet,
DstSet = _descriptorSets[setIndex], DstSet = _descriptorSets[setIndex],
@ -74,7 +74,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
if (imageInfo.ImageView.Handle != 0UL) if (imageInfo.ImageView.Handle != 0UL)
{ {
WriteDescriptorSet writeDescriptorSet = new WriteDescriptorSet WriteDescriptorSet writeDescriptorSet = new()
{ {
SType = StructureType.WriteDescriptorSet, SType = StructureType.WriteDescriptorSet,
DstSet = _descriptorSets[setIndex], DstSet = _descriptorSets[setIndex],
@ -97,7 +97,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (DescriptorImageInfo* pImageInfo = imageInfo) fixed (DescriptorImageInfo* pImageInfo = imageInfo)
{ {
WriteDescriptorSet writeDescriptorSet = new WriteDescriptorSet WriteDescriptorSet writeDescriptorSet = new()
{ {
SType = StructureType.WriteDescriptorSet, SType = StructureType.WriteDescriptorSet,
DstSet = _descriptorSets[setIndex], DstSet = _descriptorSets[setIndex],
@ -134,7 +134,7 @@ namespace Ryujinx.Graphics.Vulkan
count++; count++;
} }
WriteDescriptorSet writeDescriptorSet = new WriteDescriptorSet WriteDescriptorSet writeDescriptorSet = new()
{ {
SType = StructureType.WriteDescriptorSet, SType = StructureType.WriteDescriptorSet,
DstSet = _descriptorSets[setIndex], DstSet = _descriptorSets[setIndex],
@ -156,7 +156,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
if (texelBufferView.Handle != 0UL) if (texelBufferView.Handle != 0UL)
{ {
WriteDescriptorSet writeDescriptorSet = new WriteDescriptorSet WriteDescriptorSet writeDescriptorSet = new()
{ {
SType = StructureType.WriteDescriptorSet, SType = StructureType.WriteDescriptorSet,
DstSet = _descriptorSets[setIndex], DstSet = _descriptorSets[setIndex],
@ -190,7 +190,7 @@ namespace Ryujinx.Graphics.Vulkan
count++; count++;
} }
WriteDescriptorSet writeDescriptorSet = new WriteDescriptorSet WriteDescriptorSet writeDescriptorSet = new()
{ {
SType = StructureType.WriteDescriptorSet, SType = StructureType.WriteDescriptorSet,
DstSet = _descriptorSets[setIndex], DstSet = _descriptorSets[setIndex],

View File

@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (DescriptorPoolSize* pPoolsSize = poolSizes) fixed (DescriptorPoolSize* pPoolsSize = poolSizes)
{ {
DescriptorPoolCreateInfo descriptorPoolCreateInfo = new DescriptorPoolCreateInfo DescriptorPoolCreateInfo descriptorPoolCreateInfo = new()
{ {
SType = StructureType.DescriptorPoolCreateInfo, SType = StructureType.DescriptorPoolCreateInfo,
Flags = updateAfterBind ? DescriptorPoolCreateFlags.UpdateAfterBindBit : DescriptorPoolCreateFlags.None, Flags = updateAfterBind ? DescriptorPoolCreateFlags.UpdateAfterBindBit : DescriptorPoolCreateFlags.None,
@ -69,7 +69,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
fixed (DescriptorSetLayout* pLayouts = layouts) fixed (DescriptorSetLayout* pLayouts = layouts)
{ {
DescriptorSetAllocateInfo descriptorSetAllocateInfo = new DescriptorSetAllocateInfo DescriptorSetAllocateInfo descriptorSetAllocateInfo = new()
{ {
SType = StructureType.DescriptorSetAllocateInfo, SType = StructureType.DescriptorSetAllocateInfo,
DescriptorPool = _pool, DescriptorPool = _pool,

View File

@ -86,7 +86,7 @@ namespace Ryujinx.Graphics.Vulkan
Size = (int)structureOffset; Size = (int)structureOffset;
DescriptorUpdateTemplateCreateInfo info = new DescriptorUpdateTemplateCreateInfo() DescriptorUpdateTemplateCreateInfo info = new()
{ {
SType = StructureType.DescriptorUpdateTemplateCreateInfo, SType = StructureType.DescriptorUpdateTemplateCreateInfo,
DescriptorUpdateEntryCount = (uint)segments.Length, DescriptorUpdateEntryCount = (uint)segments.Length,
@ -173,7 +173,7 @@ namespace Ryujinx.Graphics.Vulkan
Size = (int)structureOffset; Size = (int)structureOffset;
DescriptorUpdateTemplateCreateInfo info = new DescriptorUpdateTemplateCreateInfo() DescriptorUpdateTemplateCreateInfo info = new()
{ {
SType = StructureType.DescriptorUpdateTemplateCreateInfo, SType = StructureType.DescriptorUpdateTemplateCreateInfo,
DescriptorUpdateEntryCount = (uint)entry, DescriptorUpdateEntryCount = (uint)entry,

View File

@ -157,7 +157,7 @@ namespace Ryujinx.Graphics.Vulkan
_uniformSetPd = new int[Constants.MaxUniformBufferBindings]; _uniformSetPd = new int[Constants.MaxUniformBufferBindings];
DescriptorImageInfo initialImageInfo = new DescriptorImageInfo DescriptorImageInfo initialImageInfo = new()
{ {
ImageLayout = ImageLayout.General, ImageLayout = ImageLayout.General,
}; };
@ -441,7 +441,7 @@ namespace Ryujinx.Graphics.Vulkan
Range = (ulong)buffer.Size, Range = (ulong)buffer.Size,
}; };
BufferRef newRef = new BufferRef(vkBuffer, ref buffer); BufferRef newRef = new(vkBuffer, ref buffer);
ref DescriptorBufferInfo currentInfo = ref _storageBuffers[index]; ref DescriptorBufferInfo currentInfo = ref _storageBuffers[index];

View File

@ -98,7 +98,7 @@ namespace Ryujinx.Graphics.Vulkan.Effects
{ {
TextureCreateInfo originalInfo = view.Info; TextureCreateInfo originalInfo = view.Info;
TextureCreateInfo info = new TextureCreateInfo( TextureCreateInfo info = new(
width, width,
height, height,
originalInfo.Depth, originalInfo.Depth,

View File

@ -109,7 +109,7 @@ namespace Ryujinx.Graphics.Vulkan.Effects
QualityUltra = Quality == 3 ? 1 : 0, QualityUltra = Quality == 3 ? 1 : 0,
}; };
SpecDescription specInfo = new SpecDescription( SpecDescription specInfo = new(
(0, SpecConstType.Int32), (0, SpecConstType.Int32),
(1, SpecConstType.Int32), (1, SpecConstType.Int32),
(2, SpecConstType.Int32), (2, SpecConstType.Int32),
@ -143,7 +143,7 @@ namespace Ryujinx.Graphics.Vulkan.Effects
private void Initialize() private void Initialize()
{ {
TextureCreateInfo areaInfo = new TextureCreateInfo(AreaWidth, TextureCreateInfo areaInfo = new(AreaWidth,
AreaHeight, AreaHeight,
1, 1,
1, 1,
@ -159,7 +159,7 @@ namespace Ryujinx.Graphics.Vulkan.Effects
SwizzleComponent.Blue, SwizzleComponent.Blue,
SwizzleComponent.Alpha); SwizzleComponent.Alpha);
TextureCreateInfo searchInfo = new TextureCreateInfo(SearchWidth, TextureCreateInfo searchInfo = new(SearchWidth,
SearchHeight, SearchHeight,
1, 1,
1, 1,

View File

@ -20,7 +20,7 @@ namespace Ryujinx.Graphics.Vulkan
_device = device; _device = device;
_concurrentWaitUnsupported = concurrentWaitUnsupported; _concurrentWaitUnsupported = concurrentWaitUnsupported;
FenceCreateInfo fenceCreateInfo = new FenceCreateInfo FenceCreateInfo fenceCreateInfo = new()
{ {
SType = StructureType.FenceCreateInfo, SType = StructureType.FenceCreateInfo,
}; };

View File

@ -240,7 +240,7 @@ namespace Ryujinx.Graphics.Vulkan
attachments[i] = _attachments[i].Get(cbs).Value; attachments[i] = _attachments[i].Get(cbs).Value;
} }
FramebufferCreateInfo framebufferCreateInfo = new FramebufferCreateInfo FramebufferCreateInfo framebufferCreateInfo = new()
{ {
SType = StructureType.FramebufferCreateInfo, SType = StructureType.FramebufferCreateInfo,
RenderPass = renderPass.Get(cbs).Value, RenderPass = renderPass.Get(cbs).Value,

View File

@ -65,7 +65,7 @@ namespace Ryujinx.Graphics.Vulkan
public void Add(ref TKey key, TValue value) public void Add(ref TKey key, TValue value)
{ {
Entry entry = new Entry Entry entry = new()
{ {
Hash = key.GetHashCode(), Hash = key.GetHashCode(),
Key = key, Key = key,

View File

@ -259,13 +259,13 @@ namespace Ryujinx.Graphics.Vulkan
for (int l = 0; l < levels; l++) for (int l = 0; l < levels; l++)
{ {
Extents2D mipSrcRegion = new Extents2D( Extents2D mipSrcRegion = new(
srcRegion.X1 >> l, srcRegion.X1 >> l,
srcRegion.Y1 >> l, srcRegion.Y1 >> l,
srcRegion.X2 >> l, srcRegion.X2 >> l,
srcRegion.Y2 >> l); srcRegion.Y2 >> l);
Extents2D mipDstRegion = new Extents2D( Extents2D mipDstRegion = new(
dstRegion.X1 >> l, dstRegion.X1 >> l,
dstRegion.Y1 >> l, dstRegion.Y1 >> l,
dstRegion.X2 >> l, dstRegion.X2 >> l,
@ -335,7 +335,7 @@ namespace Ryujinx.Graphics.Vulkan
int dstWidth = Math.Max(1, dst.Width >> mipDstLevel); int dstWidth = Math.Max(1, dst.Width >> mipDstLevel);
int dstHeight = Math.Max(1, dst.Height >> mipDstLevel); int dstHeight = Math.Max(1, dst.Height >> mipDstLevel);
Extents2D extents = new Extents2D( Extents2D extents = new(
0, 0,
0, 0,
Math.Min(srcWidth, dstWidth), Math.Min(srcWidth, dstWidth),
@ -411,7 +411,7 @@ namespace Ryujinx.Graphics.Vulkan
Span<Viewport> viewports = stackalloc Viewport[1]; Span<Viewport> viewports = stackalloc Viewport[1];
Rectangle<float> rect = new Rectangle<float>( Rectangle<float> rect = new(
MathF.Min(dstRegion.X1, dstRegion.X2), MathF.Min(dstRegion.X1, dstRegion.X2),
MathF.Min(dstRegion.Y1, dstRegion.Y2), MathF.Min(dstRegion.Y1, dstRegion.Y2),
MathF.Abs(dstRegion.X2 - dstRegion.X1), MathF.Abs(dstRegion.X2 - dstRegion.X1),
@ -507,7 +507,7 @@ namespace Ryujinx.Graphics.Vulkan
Span<Viewport> viewports = stackalloc Viewport[1]; Span<Viewport> viewports = stackalloc Viewport[1];
Rectangle<float> rect = new Rectangle<float>( Rectangle<float> rect = new(
MathF.Min(dstRegion.X1, dstRegion.X2), MathF.Min(dstRegion.X1, dstRegion.X2),
MathF.Min(dstRegion.Y1, dstRegion.Y2), MathF.Min(dstRegion.Y1, dstRegion.Y2),
MathF.Abs(dstRegion.X2 - dstRegion.X1), MathF.Abs(dstRegion.X2 - dstRegion.X1),
@ -780,7 +780,7 @@ namespace Ryujinx.Graphics.Vulkan
Span<Viewport> viewports = stackalloc Viewport[1]; Span<Viewport> viewports = stackalloc Viewport[1];
Rectangle<float> rect = new Rectangle<float>( Rectangle<float> rect = new(
MathF.Min(dstRegion.X1, dstRegion.X2), MathF.Min(dstRegion.X1, dstRegion.X2),
MathF.Min(dstRegion.Y1, dstRegion.Y2), MathF.Min(dstRegion.Y1, dstRegion.Y2),
MathF.Abs(dstRegion.X2 - dstRegion.X1), MathF.Abs(dstRegion.X2 - dstRegion.X1),
@ -915,7 +915,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>(); List<BufferCopy> bufferCopy = new();
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.
@ -1119,7 +1119,7 @@ namespace Ryujinx.Graphics.Vulkan
Span<Viewport> viewports = stackalloc Viewport[1]; Span<Viewport> viewports = stackalloc Viewport[1];
Rectangle<float> rect = new Rectangle<float>(0, 0, dst.Width, dst.Height); Rectangle<float> rect = new(0, 0, dst.Width, dst.Height);
viewports[0] = new Viewport( viewports[0] = new Viewport(
rect, rect,
@ -1240,7 +1240,7 @@ namespace Ryujinx.Graphics.Vulkan
Span<Viewport> viewports = stackalloc Viewport[1]; Span<Viewport> viewports = stackalloc Viewport[1];
Rectangle<float> rect = new Rectangle<float>(0, 0, dst.Width, dst.Height); Rectangle<float> rect = new(0, 0, dst.Width, dst.Height);
viewports[0] = new Viewport( viewports[0] = new Viewport(
rect, rect,
@ -1429,7 +1429,7 @@ namespace Ryujinx.Graphics.Vulkan
_ => Target.Texture2D, _ => Target.Texture2D,
}; };
TextureCreateInfo info = new TextureCreateInfo( TextureCreateInfo info = new(
Math.Max(1, from.Info.Width >> level), Math.Max(1, from.Info.Width >> level),
Math.Max(1, from.Info.Height >> level), Math.Max(1, from.Info.Height >> level),
1, 1,

View File

@ -108,7 +108,7 @@ namespace Ryujinx.Graphics.Vulkan
PHostPointer = (void*)pageAlignedPointer, PHostPointer = (void*)pageAlignedPointer,
}; };
MemoryAllocateInfo memoryAllocateInfo = new MemoryAllocateInfo MemoryAllocateInfo memoryAllocateInfo = new()
{ {
SType = StructureType.MemoryAllocateInfo, SType = StructureType.MemoryAllocateInfo,
AllocationSize = pageAlignedSize, AllocationSize = pageAlignedSize,
@ -124,9 +124,9 @@ namespace Ryujinx.Graphics.Vulkan
return false; return false;
} }
MemoryAllocation allocation = new MemoryAllocation(this, deviceMemory, pageAlignedPointer, 0, pageAlignedSize); MemoryAllocation allocation = new(this, deviceMemory, pageAlignedPointer, 0, pageAlignedSize);
Auto<MemoryAllocation> allocAuto = new Auto<MemoryAllocation>(allocation); Auto<MemoryAllocation> allocAuto = new(allocation);
HostMemoryAllocation hostAlloc = new HostMemoryAllocation(allocAuto, pageAlignedPointer, pageAlignedSize); HostMemoryAllocation hostAlloc = new(allocAuto, pageAlignedPointer, pageAlignedSize);
allocAuto.IncrementReferenceCount(); allocAuto.IncrementReferenceCount();
allocAuto.Dispose(); // Kept alive by ref count only. allocAuto.Dispose(); // Kept alive by ref count only.

View File

@ -65,7 +65,7 @@ namespace Ryujinx.Graphics.Vulkan
try try
{ {
MemoryAllocatorBlockList newBl = new MemoryAllocatorBlockList(_api, _device, memoryTypeIndex, _blockAlignment, isBuffer); MemoryAllocatorBlockList newBl = new(_api, _device, memoryTypeIndex, _blockAlignment, isBuffer);
_blockLists.Add(newBl); _blockLists.Add(newBl);
return newBl.Allocate(size, alignment, map); return newBl.Allocate(size, alignment, map);

View File

@ -44,7 +44,7 @@ namespace Ryujinx.Graphics.Vulkan
Size = size; Size = size;
_freeRanges = new List<Range> _freeRanges = new List<Range>
{ {
new Range(0, size), new(0, size),
}; };
} }
@ -88,7 +88,7 @@ namespace Ryujinx.Graphics.Vulkan
private void InsertFreeRange(ulong offset, ulong size) private void InsertFreeRange(ulong offset, ulong size)
{ {
Range range = new Range(offset, size); Range range = new(offset, size);
int index = _freeRanges.BinarySearch(range); int index = _freeRanges.BinarySearch(range);
if (index < 0) if (index < 0)
{ {
@ -101,7 +101,7 @@ namespace Ryujinx.Graphics.Vulkan
private void InsertFreeRangeComingled(ulong offset, ulong size) private void InsertFreeRangeComingled(ulong offset, ulong size)
{ {
ulong endOffset = offset + size; ulong endOffset = offset + size;
Range range = new Range(offset, size); Range range = new(offset, size);
int index = _freeRanges.BinarySearch(range); int index = _freeRanges.BinarySearch(range);
if (index < 0) if (index < 0)
{ {
@ -213,7 +213,7 @@ namespace Ryujinx.Graphics.Vulkan
ulong blockAlignedSize = BitUtils.AlignUp(size, (ulong)_blockAlignment); ulong blockAlignedSize = BitUtils.AlignUp(size, (ulong)_blockAlignment);
MemoryAllocateInfo memoryAllocateInfo = new MemoryAllocateInfo MemoryAllocateInfo memoryAllocateInfo = new()
{ {
SType = StructureType.MemoryAllocateInfo, SType = StructureType.MemoryAllocateInfo,
AllocationSize = blockAlignedSize, AllocationSize = blockAlignedSize,
@ -231,7 +231,7 @@ namespace Ryujinx.Graphics.Vulkan
hostPointer = (nint)pointer; hostPointer = (nint)pointer;
} }
Block newBlock = new Block(deviceMemory, hostPointer, blockAlignedSize); Block newBlock = new(deviceMemory, hostPointer, blockAlignedSize);
InsertBlock(newBlock); InsertBlock(newBlock);

View File

@ -105,7 +105,7 @@ namespace Ryujinx.Graphics.Vulkan
AutoFlush = new AutoFlushCounter(gd); AutoFlush = new AutoFlushCounter(gd);
EndRenderPassDelegate = EndRenderPass; EndRenderPassDelegate = EndRenderPass;
PipelineCacheCreateInfo pipelineCacheCreateInfo = new PipelineCacheCreateInfo PipelineCacheCreateInfo pipelineCacheCreateInfo = new()
{ {
SType = StructureType.PipelineCacheCreateInfo, SType = StructureType.PipelineCacheCreateInfo,
}; };
@ -220,8 +220,8 @@ namespace Ryujinx.Graphics.Vulkan
BeginRenderPass(); BeginRenderPass();
ClearValue clearValue = new ClearValue(new ClearColorValue(color.Red, color.Green, color.Blue, color.Alpha)); ClearValue clearValue = new(new ClearColorValue(color.Red, color.Green, color.Blue, color.Alpha));
ClearAttachment attachment = new ClearAttachment(ImageAspectFlags.ColorBit, (uint)index, clearValue); ClearAttachment attachment = new(ImageAspectFlags.ColorBit, (uint)index, clearValue);
ClearRect clearRect = FramebufferParams.GetClearRect(ClearScissor, layer, layerCount); ClearRect clearRect = FramebufferParams.GetClearRect(ClearScissor, layer, layerCount);
Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect); Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect);
@ -234,7 +234,7 @@ namespace Ryujinx.Graphics.Vulkan
return; return;
} }
ClearValue clearValue = new ClearValue(null, new ClearDepthStencilValue(depthValue, (uint)stencilValue)); ClearValue clearValue = new(null, new ClearDepthStencilValue(depthValue, (uint)stencilValue));
ImageAspectFlags flags = depthMask ? ImageAspectFlags.DepthBit : 0; ImageAspectFlags flags = depthMask ? ImageAspectFlags.DepthBit : 0;
if (stencilMask) if (stencilMask)
@ -258,7 +258,7 @@ namespace Ryujinx.Graphics.Vulkan
BeginRenderPass(); BeginRenderPass();
ClearAttachment attachment = new ClearAttachment(flags, 0, clearValue); ClearAttachment attachment = new(flags, 0, clearValue);
ClearRect clearRect = FramebufferParams.GetClearRect(ClearScissor, layer, layerCount); ClearRect clearRect = FramebufferParams.GetClearRect(ClearScissor, layer, layerCount);
Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect); Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect);
@ -1058,8 +1058,8 @@ namespace Ryujinx.Graphics.Vulkan
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
Rectangle<int> region = regions[i]; Rectangle<int> region = regions[i];
Offset2D offset = new Offset2D(region.X, region.Y); Offset2D offset = new(region.X, region.Y);
Extent2D extent = new Extent2D((uint)region.Width, (uint)region.Height); Extent2D extent = new((uint)region.Width, (uint)region.Height);
DynamicState.SetScissor(i, new Rect2D(offset, extent)); DynamicState.SetScissor(i, new Rect2D(offset, extent));
} }
@ -1714,10 +1714,10 @@ namespace Ryujinx.Graphics.Vulkan
{ {
FramebufferParams.InsertLoadOpBarriers(Gd, Cbs); FramebufferParams.InsertLoadOpBarriers(Gd, Cbs);
Rect2D renderArea = new Rect2D(null, new Extent2D(FramebufferParams.Width, FramebufferParams.Height)); Rect2D renderArea = new(null, new Extent2D(FramebufferParams.Width, FramebufferParams.Height));
ClearValue clearValue = new ClearValue(); ClearValue clearValue = new();
RenderPassBeginInfo renderPassBeginInfo = new RenderPassBeginInfo RenderPassBeginInfo renderPassBeginInfo = new()
{ {
SType = StructureType.RenderPassBeginInfo, SType = StructureType.RenderPassBeginInfo,
RenderPass = _renderPass.Get(Cbs).Value, RenderPass = _renderPass.Get(Cbs).Value,

View File

@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Vulkan
AttachmentDescription[] attachmentDescs = null; AttachmentDescription[] attachmentDescs = null;
SubpassDescription subpass = new SubpassDescription SubpassDescription subpass = new()
{ {
PipelineBindPoint = PipelineBindPoint.Graphics, PipelineBindPoint = PipelineBindPoint.Graphics,
}; };
@ -111,7 +111,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (AttachmentDescription* pAttachmentDescs = attachmentDescs) fixed (AttachmentDescription* pAttachmentDescs = attachmentDescs)
{ {
RenderPassCreateInfo renderPassCreateInfo = new RenderPassCreateInfo RenderPassCreateInfo renderPassCreateInfo = new()
{ {
SType = StructureType.RenderPassCreateInfo, SType = StructureType.RenderPassCreateInfo,
PAttachments = pAttachmentDescs, PAttachments = pAttachmentDescs,

View File

@ -81,7 +81,7 @@ namespace Ryujinx.Graphics.Vulkan
ReadOnlyCollection<ResourceDescriptorCollection> setDescriptors, ReadOnlyCollection<ResourceDescriptorCollection> setDescriptors,
bool usePushDescriptors) bool usePushDescriptors)
{ {
PlceKey key = new PlceKey(setDescriptors, usePushDescriptors); PlceKey key = new(setDescriptors, usePushDescriptors);
return _plces.GetOrAdd(key, newKey => new PipelineLayoutCacheEntry(gd, device, setDescriptors, usePushDescriptors)); return _plces.GetOrAdd(key, newKey => new PipelineLayoutCacheEntry(gd, device, setDescriptors, usePushDescriptors));
} }

View File

@ -83,7 +83,7 @@ namespace Ryujinx.Graphics.Vulkan
updateAfterBindFlags[setIndex] = true; updateAfterBindFlags[setIndex] = true;
} }
DescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo = new DescriptorSetLayoutCreateInfo DescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo = new()
{ {
SType = StructureType.DescriptorSetLayoutCreateInfo, SType = StructureType.DescriptorSetLayoutCreateInfo,
PBindings = pLayoutBindings, PBindings = pLayoutBindings,
@ -99,7 +99,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (DescriptorSetLayout* pLayouts = layouts) fixed (DescriptorSetLayout* pLayouts = layouts)
{ {
PipelineLayoutCreateInfo pipelineLayoutCreateInfo = new PipelineLayoutCreateInfo PipelineLayoutCreateInfo pipelineLayoutCreateInfo = new()
{ {
SType = StructureType.PipelineLayoutCreateInfo, SType = StructureType.PipelineLayoutCreateInfo,
PSetLayouts = pLayouts, PSetLayouts = pLayouts,

View File

@ -338,7 +338,7 @@ namespace Ryujinx.Graphics.Vulkan
return pipeline; return pipeline;
} }
ComputePipelineCreateInfo pipelineCreateInfo = new ComputePipelineCreateInfo ComputePipelineCreateInfo pipelineCreateInfo = new()
{ {
SType = StructureType.ComputePipelineCreateInfo, SType = StructureType.ComputePipelineCreateInfo,
Stage = Stages[0], Stage = Stages[0],
@ -405,7 +405,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (VertexInputBindingDescription* pVertexBindingDescriptions = &Internal.VertexBindingDescriptions[0]) fixed (VertexInputBindingDescription* pVertexBindingDescriptions = &Internal.VertexBindingDescriptions[0])
fixed (PipelineColorBlendAttachmentState* pColorBlendAttachmentState = &Internal.ColorBlendAttachmentState[0]) fixed (PipelineColorBlendAttachmentState* pColorBlendAttachmentState = &Internal.ColorBlendAttachmentState[0])
{ {
PipelineVertexInputStateCreateInfo vertexInputState = new PipelineVertexInputStateCreateInfo PipelineVertexInputStateCreateInfo vertexInputState = new()
{ {
SType = StructureType.PipelineVertexInputStateCreateInfo, SType = StructureType.PipelineVertexInputStateCreateInfo,
VertexAttributeDescriptionCount = VertexAttributeDescriptionsCount, VertexAttributeDescriptionCount = VertexAttributeDescriptionsCount,
@ -442,20 +442,20 @@ namespace Ryujinx.Graphics.Vulkan
primitiveRestartEnable &= topologySupportsRestart; primitiveRestartEnable &= topologySupportsRestart;
PipelineInputAssemblyStateCreateInfo inputAssemblyState = new PipelineInputAssemblyStateCreateInfo PipelineInputAssemblyStateCreateInfo inputAssemblyState = new()
{ {
SType = StructureType.PipelineInputAssemblyStateCreateInfo, SType = StructureType.PipelineInputAssemblyStateCreateInfo,
PrimitiveRestartEnable = primitiveRestartEnable, PrimitiveRestartEnable = primitiveRestartEnable,
Topology = HasTessellationControlShader ? PrimitiveTopology.PatchList : Topology, Topology = HasTessellationControlShader ? PrimitiveTopology.PatchList : Topology,
}; };
PipelineTessellationStateCreateInfo tessellationState = new PipelineTessellationStateCreateInfo PipelineTessellationStateCreateInfo tessellationState = new()
{ {
SType = StructureType.PipelineTessellationStateCreateInfo, SType = StructureType.PipelineTessellationStateCreateInfo,
PatchControlPoints = PatchControlPoints, PatchControlPoints = PatchControlPoints,
}; };
PipelineRasterizationStateCreateInfo rasterizationState = new PipelineRasterizationStateCreateInfo PipelineRasterizationStateCreateInfo rasterizationState = new()
{ {
SType = StructureType.PipelineRasterizationStateCreateInfo, SType = StructureType.PipelineRasterizationStateCreateInfo,
DepthClampEnable = DepthClampEnable, DepthClampEnable = DepthClampEnable,
@ -467,7 +467,7 @@ namespace Ryujinx.Graphics.Vulkan
DepthBiasEnable = DepthBiasEnable, DepthBiasEnable = DepthBiasEnable,
}; };
PipelineViewportStateCreateInfo viewportState = new PipelineViewportStateCreateInfo PipelineViewportStateCreateInfo viewportState = new()
{ {
SType = StructureType.PipelineViewportStateCreateInfo, SType = StructureType.PipelineViewportStateCreateInfo,
ViewportCount = ViewportsCount, ViewportCount = ViewportsCount,
@ -476,7 +476,7 @@ namespace Ryujinx.Graphics.Vulkan
if (gd.Capabilities.SupportsDepthClipControl) if (gd.Capabilities.SupportsDepthClipControl)
{ {
PipelineViewportDepthClipControlCreateInfoEXT viewportDepthClipControlState = new PipelineViewportDepthClipControlCreateInfoEXT PipelineViewportDepthClipControlCreateInfoEXT viewportDepthClipControlState = new()
{ {
SType = StructureType.PipelineViewportDepthClipControlCreateInfoExt, SType = StructureType.PipelineViewportDepthClipControlCreateInfoExt,
NegativeOneToOne = DepthMode, NegativeOneToOne = DepthMode,
@ -485,7 +485,7 @@ namespace Ryujinx.Graphics.Vulkan
viewportState.PNext = &viewportDepthClipControlState; viewportState.PNext = &viewportDepthClipControlState;
} }
PipelineMultisampleStateCreateInfo multisampleState = new PipelineMultisampleStateCreateInfo PipelineMultisampleStateCreateInfo multisampleState = new()
{ {
SType = StructureType.PipelineMultisampleStateCreateInfo, SType = StructureType.PipelineMultisampleStateCreateInfo,
SampleShadingEnable = false, SampleShadingEnable = false,
@ -495,19 +495,19 @@ namespace Ryujinx.Graphics.Vulkan
AlphaToOneEnable = AlphaToOneEnable, AlphaToOneEnable = AlphaToOneEnable,
}; };
StencilOpState stencilFront = new StencilOpState( StencilOpState stencilFront = new(
StencilFrontFailOp, StencilFrontFailOp,
StencilFrontPassOp, StencilFrontPassOp,
StencilFrontDepthFailOp, StencilFrontDepthFailOp,
StencilFrontCompareOp); StencilFrontCompareOp);
StencilOpState stencilBack = new StencilOpState( StencilOpState stencilBack = new(
StencilBackFailOp, StencilBackFailOp,
StencilBackPassOp, StencilBackPassOp,
StencilBackDepthFailOp, StencilBackDepthFailOp,
StencilBackCompareOp); StencilBackCompareOp);
PipelineDepthStencilStateCreateInfo depthStencilState = new PipelineDepthStencilStateCreateInfo PipelineDepthStencilStateCreateInfo depthStencilState = new()
{ {
SType = StructureType.PipelineDepthStencilStateCreateInfo, SType = StructureType.PipelineDepthStencilStateCreateInfo,
DepthTestEnable = DepthTestEnable, DepthTestEnable = DepthTestEnable,
@ -544,7 +544,7 @@ namespace Ryujinx.Graphics.Vulkan
// so we need to force disable them here. // so we need to force disable them here.
bool logicOpEnable = LogicOpEnable && (gd.Vendor == Vendor.Nvidia || Internal.LogicOpsAllowed); bool logicOpEnable = LogicOpEnable && (gd.Vendor == Vendor.Nvidia || Internal.LogicOpsAllowed);
PipelineColorBlendStateCreateInfo colorBlendState = new PipelineColorBlendStateCreateInfo PipelineColorBlendStateCreateInfo colorBlendState = new()
{ {
SType = StructureType.PipelineColorBlendStateCreateInfo, SType = StructureType.PipelineColorBlendStateCreateInfo,
LogicOpEnable = logicOpEnable, LogicOpEnable = logicOpEnable,
@ -595,7 +595,7 @@ namespace Ryujinx.Graphics.Vulkan
dynamicStates[dynamicStatesCount++] = DynamicState.AttachmentFeedbackLoopEnableExt; dynamicStates[dynamicStatesCount++] = DynamicState.AttachmentFeedbackLoopEnableExt;
} }
PipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo = new PipelineDynamicStateCreateInfo PipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo = new()
{ {
SType = StructureType.PipelineDynamicStateCreateInfo, SType = StructureType.PipelineDynamicStateCreateInfo,
DynamicStateCount = (uint)dynamicStatesCount, DynamicStateCount = (uint)dynamicStatesCount,
@ -619,7 +619,7 @@ namespace Ryujinx.Graphics.Vulkan
} }
} }
GraphicsPipelineCreateInfo pipelineCreateInfo = new GraphicsPipelineCreateInfo GraphicsPipelineCreateInfo pipelineCreateInfo = new()
{ {
SType = StructureType.GraphicsPipelineCreateInfo, SType = StructureType.GraphicsPipelineCreateInfo,
Flags = flags, Flags = flags,

View File

@ -45,7 +45,7 @@ namespace Ryujinx.Graphics.Vulkan.Queries
QueryPipelineStatisticFlags flags = type == CounterType.PrimitivesGenerated ? QueryPipelineStatisticFlags flags = type == CounterType.PrimitivesGenerated ?
QueryPipelineStatisticFlags.GeometryShaderPrimitivesBit : 0; QueryPipelineStatisticFlags.GeometryShaderPrimitivesBit : 0;
QueryPoolCreateInfo queryPoolCreateInfo = new QueryPoolCreateInfo QueryPoolCreateInfo queryPoolCreateInfo = new()
{ {
SType = StructureType.QueryPoolCreateInfo, SType = StructureType.QueryPoolCreateInfo,
QueryCount = 1, QueryCount = 1,

View File

@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Vulkan
AttachmentDescription[] attachmentDescs = null; AttachmentDescription[] attachmentDescs = null;
SubpassDescription subpass = new SubpassDescription SubpassDescription subpass = new()
{ {
PipelineBindPoint = PipelineBindPoint.Graphics, PipelineBindPoint = PipelineBindPoint.Graphics,
}; };
@ -114,7 +114,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (AttachmentDescription* pAttachmentDescs = attachmentDescs) fixed (AttachmentDescription* pAttachmentDescs = attachmentDescs)
{ {
RenderPassCreateInfo renderPassCreateInfo = new RenderPassCreateInfo RenderPassCreateInfo renderPassCreateInfo = new()
{ {
SType = StructureType.RenderPassCreateInfo, SType = StructureType.RenderPassCreateInfo,
PAttachments = pAttachmentDescs, PAttachments = pAttachmentDescs,
@ -149,7 +149,7 @@ namespace Ryujinx.Graphics.Vulkan
public Auto<DisposableFramebuffer> GetFramebuffer(VulkanRenderer gd, CommandBufferScoped cbs, FramebufferParams fb) public Auto<DisposableFramebuffer> GetFramebuffer(VulkanRenderer gd, CommandBufferScoped cbs, FramebufferParams fb)
{ {
FramebufferCacheKey key = new FramebufferCacheKey(fb.Width, fb.Height, fb.Layers); FramebufferCacheKey key = new(fb.Width, fb.Height, fb.Layers);
if (!_framebuffers.TryGetValue(ref key, out Auto<DisposableFramebuffer> result)) if (!_framebuffers.TryGetValue(ref key, out Auto<DisposableFramebuffer> result))
{ {

View File

@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Vulkan
BorderColor borderColor = GetConstrainedBorderColor(info.BorderColor, out bool cantConstrain); BorderColor borderColor = GetConstrainedBorderColor(info.BorderColor, out bool cantConstrain);
Silk.NET.Vulkan.SamplerCreateInfo samplerCreateInfo = new Silk.NET.Vulkan.SamplerCreateInfo Silk.NET.Vulkan.SamplerCreateInfo samplerCreateInfo = new()
{ {
SType = StructureType.SamplerCreateInfo, SType = StructureType.SamplerCreateInfo,
MagFilter = info.MagFilter.Convert(), MagFilter = info.MagFilter.Convert(),
@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Vulkan
if (cantConstrain && gd.Capabilities.SupportsCustomBorderColor) if (cantConstrain && gd.Capabilities.SupportsCustomBorderColor)
{ {
ClearColorValue color = new ClearColorValue( ClearColorValue color = new(
info.BorderColor.Red, info.BorderColor.Red,
info.BorderColor.Green, info.BorderColor.Green,
info.BorderColor.Blue, info.BorderColor.Blue,

View File

@ -59,7 +59,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (byte* pCode = spirv) fixed (byte* pCode = spirv)
{ {
ShaderModuleCreateInfo shaderModuleCreateInfo = new ShaderModuleCreateInfo ShaderModuleCreateInfo shaderModuleCreateInfo = new()
{ {
SType = StructureType.ShaderModuleCreateInfo, SType = StructureType.ShaderModuleCreateInfo,
CodeSize = (uint)spirv.Length, CodeSize = (uint)spirv.Length,
@ -102,7 +102,7 @@ namespace Ryujinx.Graphics.Vulkan
return null; return null;
} }
Span<byte> spirvBytes = new Span<byte>((void*)scr.CodePointer, (int)scr.CodeLength); Span<byte> spirvBytes = new((void*)scr.CodePointer, (int)scr.CodeLength);
byte[] code = new byte[(scr.CodeLength + 3) & ~3]; byte[] code = new byte[(scr.CodeLength + 3) & ~3];

View File

@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Vulkan
for (int i = 0; i < shaders.Length; i++) for (int i = 0; i < shaders.Length; i++)
{ {
Shader shader = new Shader(gd.Api, device, shaders[i]); Shader shader = new(gd.Api, device, shaders[i]);
stages |= 1u << shader.StageFlags switch stages |= 1u << shader.StageFlags switch
{ {

View File

@ -89,7 +89,7 @@ namespace Ryujinx.Graphics.Vulkan
_data = new byte[data.Length]; _data = new byte[data.Length];
data.CopyTo(_data); data.CopyTo(_data);
HashCode hc = new HashCode(); HashCode hc = new();
hc.AddBytes(data); hc.AddBytes(data);
_hash = hc.ToHashCode(); _hash = hc.ToHashCode();
} }

View File

@ -34,8 +34,8 @@ namespace Ryujinx.Graphics.Vulkan
return Math.Clamp(value, 0, max); return Math.Clamp(value, 0, max);
} }
Offset3D xy1 = new Offset3D(Clamp(extents.X1, width) >> level, Clamp(extents.Y1, height) >> level, 0); Offset3D xy1 = new(Clamp(extents.X1, width) >> level, Clamp(extents.Y1, height) >> level, 0);
Offset3D xy2 = new Offset3D(Clamp(extents.X2, width) >> level, Clamp(extents.Y2, height) >> level, 1); Offset3D xy2 = new(Clamp(extents.X2, width) >> level, Clamp(extents.Y2, height) >> level, 1);
return (xy1, xy2); return (xy1, xy2);
} }
@ -50,8 +50,8 @@ namespace Ryujinx.Graphics.Vulkan
dstAspectFlags = dstInfo.Format.ConvertAspectFlags(); dstAspectFlags = dstInfo.Format.ConvertAspectFlags();
} }
ImageBlit.SrcOffsetsBuffer srcOffsets = new ImageBlit.SrcOffsetsBuffer(); ImageBlit.SrcOffsetsBuffer srcOffsets = new();
ImageBlit.DstOffsetsBuffer dstOffsets = new ImageBlit.DstOffsetsBuffer(); ImageBlit.DstOffsetsBuffer dstOffsets = new();
Filter filter = linearFilter && !dstInfo.Format.IsDepthOrStencil() ? Filter.Linear : Filter.Nearest; Filter filter = linearFilter && !dstInfo.Format.IsDepthOrStencil() ? Filter.Linear : Filter.Nearest;
@ -74,13 +74,13 @@ namespace Ryujinx.Graphics.Vulkan
for (int level = 0; level < levels; level++) for (int level = 0; level < levels; level++)
{ {
ImageSubresourceLayers srcSl = new ImageSubresourceLayers(srcAspectFlags, copySrcLevel, (uint)srcLayer, (uint)layers); ImageSubresourceLayers srcSl = new(srcAspectFlags, copySrcLevel, (uint)srcLayer, (uint)layers);
ImageSubresourceLayers dstSl = new ImageSubresourceLayers(dstAspectFlags, copyDstLevel, (uint)dstLayer, (uint)layers); ImageSubresourceLayers dstSl = new(dstAspectFlags, copyDstLevel, (uint)dstLayer, (uint)layers);
(srcOffsets.Element0, srcOffsets.Element1) = ExtentsToOffset3D(srcRegion, srcInfo.Width, srcInfo.Height, level); (srcOffsets.Element0, srcOffsets.Element1) = ExtentsToOffset3D(srcRegion, srcInfo.Width, srcInfo.Height, level);
(dstOffsets.Element0, dstOffsets.Element1) = ExtentsToOffset3D(dstRegion, dstInfo.Width, dstInfo.Height, level); (dstOffsets.Element0, dstOffsets.Element1) = ExtentsToOffset3D(dstRegion, dstInfo.Width, dstInfo.Height, level);
ImageBlit region = new ImageBlit ImageBlit region = new()
{ {
SrcSubresource = srcSl, SrcSubresource = srcSl,
SrcOffsets = srcOffsets, SrcOffsets = srcOffsets,
@ -299,13 +299,13 @@ namespace Ryujinx.Graphics.Vulkan
break; break;
} }
ImageSubresourceLayers srcSl = new ImageSubresourceLayers( ImageSubresourceLayers srcSl = new(
srcAspect, srcAspect,
(uint)(srcViewLevel + srcLevel + level), (uint)(srcViewLevel + srcLevel + level),
(uint)(srcViewLayer + srcLayer), (uint)(srcViewLayer + srcLayer),
(uint)srcLayers); (uint)srcLayers);
ImageSubresourceLayers dstSl = new ImageSubresourceLayers( ImageSubresourceLayers dstSl = new(
dstAspect, dstAspect,
(uint)(dstViewLevel + dstLevel + level), (uint)(dstViewLevel + dstLevel + level),
(uint)(dstViewLayer + dstLayer), (uint)(dstViewLayer + dstLayer),
@ -314,17 +314,17 @@ namespace Ryujinx.Graphics.Vulkan
int copyWidth = sizeInBlocks ? BitUtils.DivRoundUp(width, blockWidth) : width; int copyWidth = sizeInBlocks ? BitUtils.DivRoundUp(width, blockWidth) : width;
int copyHeight = sizeInBlocks ? BitUtils.DivRoundUp(height, blockHeight) : height; int copyHeight = sizeInBlocks ? BitUtils.DivRoundUp(height, blockHeight) : height;
Extent3D extent = new Extent3D((uint)copyWidth, (uint)copyHeight, (uint)srcDepth); Extent3D extent = new((uint)copyWidth, (uint)copyHeight, (uint)srcDepth);
if (srcInfo.Samples > 1 && srcInfo.Samples != dstInfo.Samples) if (srcInfo.Samples > 1 && srcInfo.Samples != dstInfo.Samples)
{ {
ImageResolve region = new ImageResolve(srcSl, new Offset3D(0, 0, srcZ), dstSl, new Offset3D(0, 0, dstZ), extent); ImageResolve region = new(srcSl, new Offset3D(0, 0, srcZ), dstSl, new Offset3D(0, 0, dstZ), extent);
api.CmdResolveImage(commandBuffer, srcImage, ImageLayout.General, dstImage, ImageLayout.General, 1, in region); api.CmdResolveImage(commandBuffer, srcImage, ImageLayout.General, dstImage, ImageLayout.General, 1, in region);
} }
else else
{ {
ImageCopy region = new ImageCopy(srcSl, new Offset3D(0, 0, srcZ), dstSl, new Offset3D(0, 0, dstZ), extent); ImageCopy region = new(srcSl, new Offset3D(0, 0, srcZ), dstSl, new Offset3D(0, 0, dstZ), extent);
api.CmdCopyImage(commandBuffer, srcImage, ImageLayout.General, dstImage, ImageLayout.General, 1, in region); api.CmdCopyImage(commandBuffer, srcImage, ImageLayout.General, dstImage, ImageLayout.General, 1, in region);
} }
@ -360,10 +360,10 @@ namespace Ryujinx.Graphics.Vulkan
TextureView src, TextureView src,
TextureView dst) TextureView dst)
{ {
AttachmentReference2 dsAttachmentReference = new AttachmentReference2(StructureType.AttachmentReference2, null, 0, ImageLayout.General); AttachmentReference2 dsAttachmentReference = new(StructureType.AttachmentReference2, null, 0, ImageLayout.General);
AttachmentReference2 dsResolveAttachmentReference = new AttachmentReference2(StructureType.AttachmentReference2, null, 1, ImageLayout.General); AttachmentReference2 dsResolveAttachmentReference = new(StructureType.AttachmentReference2, null, 1, ImageLayout.General);
SubpassDescriptionDepthStencilResolve subpassDsResolve = new SubpassDescriptionDepthStencilResolve SubpassDescriptionDepthStencilResolve subpassDsResolve = new()
{ {
SType = StructureType.SubpassDescriptionDepthStencilResolve, SType = StructureType.SubpassDescriptionDepthStencilResolve,
PDepthStencilResolveAttachment = &dsResolveAttachmentReference, PDepthStencilResolveAttachment = &dsResolveAttachmentReference,
@ -371,7 +371,7 @@ namespace Ryujinx.Graphics.Vulkan
StencilResolveMode = ResolveModeFlags.SampleZeroBit, StencilResolveMode = ResolveModeFlags.SampleZeroBit,
}; };
SubpassDescription2 subpass = new SubpassDescription2 SubpassDescription2 subpass = new()
{ {
SType = StructureType.SubpassDescription2, SType = StructureType.SubpassDescription2,
PipelineBindPoint = PipelineBindPoint.Graphics, PipelineBindPoint = PipelineBindPoint.Graphics,
@ -411,7 +411,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (AttachmentDescription2* pAttachmentDescs = attachmentDescs) fixed (AttachmentDescription2* pAttachmentDescs = attachmentDescs)
{ {
RenderPassCreateInfo2 renderPassCreateInfo = new RenderPassCreateInfo2 RenderPassCreateInfo2 renderPassCreateInfo = new()
{ {
SType = StructureType.RenderPassCreateInfo2, SType = StructureType.RenderPassCreateInfo2,
PAttachments = pAttachmentDescs, PAttachments = pAttachmentDescs,
@ -424,7 +424,7 @@ namespace Ryujinx.Graphics.Vulkan
gd.Api.CreateRenderPass2(device, in renderPassCreateInfo, null, out RenderPass renderPass).ThrowOnError(); gd.Api.CreateRenderPass2(device, in renderPassCreateInfo, null, out RenderPass renderPass).ThrowOnError();
using Auto<DisposableRenderPass> rp = new Auto<DisposableRenderPass>(new DisposableRenderPass(gd.Api, device, renderPass)); using Auto<DisposableRenderPass> rp = new(new DisposableRenderPass(gd.Api, device, renderPass));
ImageView* attachments = stackalloc ImageView[2]; ImageView* attachments = stackalloc ImageView[2];
@ -434,7 +434,7 @@ namespace Ryujinx.Graphics.Vulkan
attachments[0] = srcView.Get(cbs).Value; attachments[0] = srcView.Get(cbs).Value;
attachments[1] = dstView.Get(cbs).Value; attachments[1] = dstView.Get(cbs).Value;
FramebufferCreateInfo framebufferCreateInfo = new FramebufferCreateInfo FramebufferCreateInfo framebufferCreateInfo = new()
{ {
SType = StructureType.FramebufferCreateInfo, SType = StructureType.FramebufferCreateInfo,
RenderPass = rp.Get(cbs).Value, RenderPass = rp.Get(cbs).Value,
@ -446,12 +446,12 @@ namespace Ryujinx.Graphics.Vulkan
}; };
gd.Api.CreateFramebuffer(device, in framebufferCreateInfo, null, out Framebuffer framebuffer).ThrowOnError(); gd.Api.CreateFramebuffer(device, in framebufferCreateInfo, null, out Framebuffer framebuffer).ThrowOnError();
using Auto<DisposableFramebuffer> fb = new Auto<DisposableFramebuffer>(new DisposableFramebuffer(gd.Api, device, framebuffer), null, srcView, dstView); using Auto<DisposableFramebuffer> fb = new(new DisposableFramebuffer(gd.Api, device, framebuffer), null, srcView, dstView);
Rect2D renderArea = new Rect2D(null, new Extent2D((uint)src.Info.Width, (uint)src.Info.Height)); Rect2D renderArea = new(null, new Extent2D((uint)src.Info.Width, (uint)src.Info.Height));
ClearValue clearValue = new ClearValue(); ClearValue clearValue = new();
RenderPassBeginInfo renderPassBeginInfo = new RenderPassBeginInfo RenderPassBeginInfo renderPassBeginInfo = new()
{ {
SType = StructureType.RenderPassBeginInfo, SType = StructureType.RenderPassBeginInfo,
RenderPass = rp.Get(cbs).Value, RenderPass = rp.Get(cbs).Value,

View File

@ -89,7 +89,7 @@ namespace Ryujinx.Graphics.Vulkan
ImageType type = info.Target.Convert(); ImageType type = info.Target.Convert();
Extent3D extent = new Extent3D((uint)info.Width, (uint)info.Height, depth); Extent3D extent = new((uint)info.Width, (uint)info.Height, depth);
SampleCountFlags sampleCountFlags = ConvertToSampleCountFlags(gd.Capabilities.SupportedSampleCounts, (uint)info.Samples); SampleCountFlags sampleCountFlags = ConvertToSampleCountFlags(gd.Capabilities.SupportedSampleCounts, (uint)info.Samples);
@ -111,7 +111,7 @@ namespace Ryujinx.Graphics.Vulkan
flags |= ImageCreateFlags.Create2DArrayCompatibleBit; flags |= ImageCreateFlags.Create2DArrayCompatibleBit;
} }
ImageCreateInfo imageCreateInfo = new ImageCreateInfo ImageCreateInfo imageCreateInfo = new()
{ {
SType = StructureType.ImageCreateInfo, SType = StructureType.ImageCreateInfo,
ImageType = type, ImageType = type,
@ -274,9 +274,9 @@ namespace Ryujinx.Graphics.Vulkan
ImageAspectFlags aspectFlags = _info.Format.ConvertAspectFlags(); ImageAspectFlags aspectFlags = _info.Format.ConvertAspectFlags();
ImageSubresourceRange subresourceRange = new ImageSubresourceRange(aspectFlags, 0, (uint)_info.Levels, 0, (uint)_info.GetLayers()); ImageSubresourceRange subresourceRange = new(aspectFlags, 0, (uint)_info.Levels, 0, (uint)_info.GetLayers());
ImageMemoryBarrier barrier = new ImageMemoryBarrier ImageMemoryBarrier barrier = new()
{ {
SType = StructureType.ImageMemoryBarrier, SType = StructureType.ImageMemoryBarrier,
SrcAccessMask = 0, SrcAccessMask = 0,
@ -402,17 +402,17 @@ namespace Ryujinx.Graphics.Vulkan
int rowLength = (Info.GetMipStride(level) / Info.BytesPerPixel) * Info.BlockWidth; int rowLength = (Info.GetMipStride(level) / Info.BytesPerPixel) * Info.BlockWidth;
ImageSubresourceLayers sl = new ImageSubresourceLayers( ImageSubresourceLayers sl = new(
aspectFlags, aspectFlags,
(uint)(dstLevel + level), (uint)(dstLevel + level),
(uint)layer, (uint)layer,
(uint)layers); (uint)layers);
Extent3D extent = new Extent3D((uint)width, (uint)height, (uint)depth); Extent3D extent = new((uint)width, (uint)height, (uint)depth);
int z = is3D ? dstLayer : 0; int z = is3D ? dstLayer : 0;
BufferImageCopy region = new BufferImageCopy( BufferImageCopy region = new(
(ulong)offset, (ulong)offset,
(uint)BitUtils.AlignUp(rowLength, Info.BlockWidth), (uint)BitUtils.AlignUp(rowLength, Info.BlockWidth),
(uint)BitUtils.AlignUp(height, Info.BlockHeight), (uint)BitUtils.AlignUp(height, Info.BlockHeight),

View File

@ -95,23 +95,23 @@ namespace Ryujinx.Graphics.Vulkan
swizzleG = tempB; swizzleG = tempB;
} }
ComponentMapping componentMapping = new ComponentMapping(swizzleR, swizzleG, swizzleB, swizzleA); ComponentMapping componentMapping = new(swizzleR, swizzleG, swizzleB, swizzleA);
ImageAspectFlags aspectFlags = info.Format.ConvertAspectFlags(info.DepthStencilMode); ImageAspectFlags aspectFlags = info.Format.ConvertAspectFlags(info.DepthStencilMode);
ImageAspectFlags aspectFlagsDepth = info.Format.ConvertAspectFlags(); ImageAspectFlags aspectFlagsDepth = info.Format.ConvertAspectFlags();
ImageSubresourceRange subresourceRange = new ImageSubresourceRange(aspectFlags, (uint)firstLevel, levels, (uint)firstLayer, layers); ImageSubresourceRange subresourceRange = new(aspectFlags, (uint)firstLevel, levels, (uint)firstLayer, layers);
ImageSubresourceRange subresourceRangeDepth = new ImageSubresourceRange(aspectFlagsDepth, (uint)firstLevel, levels, (uint)firstLayer, layers); ImageSubresourceRange subresourceRangeDepth = new(aspectFlagsDepth, (uint)firstLevel, levels, (uint)firstLayer, layers);
unsafe Auto<DisposableImageView> CreateImageView(ComponentMapping cm, ImageSubresourceRange sr, ImageViewType viewType, ImageUsageFlags usageFlags) unsafe Auto<DisposableImageView> CreateImageView(ComponentMapping cm, ImageSubresourceRange sr, ImageViewType viewType, ImageUsageFlags usageFlags)
{ {
ImageViewUsageCreateInfo imageViewUsage = new ImageViewUsageCreateInfo ImageViewUsageCreateInfo imageViewUsage = new()
{ {
SType = StructureType.ImageViewUsageCreateInfo, SType = StructureType.ImageViewUsageCreateInfo,
Usage = usageFlags, Usage = usageFlags,
}; };
ImageViewCreateInfo imageCreateInfo = new ImageViewCreateInfo ImageViewCreateInfo imageCreateInfo = new()
{ {
SType = StructureType.ImageViewCreateInfo, SType = StructureType.ImageViewCreateInfo,
Image = storage.GetImageForViewCreation(), Image = storage.GetImageForViewCreation(),
@ -136,7 +136,7 @@ namespace Ryujinx.Graphics.Vulkan
_imageView = CreateImageView(componentMapping, subresourceRange, type, shaderUsage); _imageView = CreateImageView(componentMapping, subresourceRange, type, shaderUsage);
// Framebuffer attachments and storage images requires a identity component mapping. // Framebuffer attachments and storage images requires a identity component mapping.
ComponentMapping identityComponentMapping = new ComponentMapping( ComponentMapping identityComponentMapping = new(
ComponentSwizzle.R, ComponentSwizzle.R,
ComponentSwizzle.G, ComponentSwizzle.G,
ComponentSwizzle.B, ComponentSwizzle.B,
@ -934,17 +934,17 @@ namespace Ryujinx.Graphics.Vulkan
aspectFlags = ImageAspectFlags.DepthBit; aspectFlags = ImageAspectFlags.DepthBit;
} }
ImageSubresourceLayers sl = new ImageSubresourceLayers( ImageSubresourceLayers sl = new(
aspectFlags, aspectFlags,
(uint)(FirstLevel + dstLevel + level), (uint)(FirstLevel + dstLevel + level),
(uint)(FirstLayer + layer), (uint)(FirstLayer + layer),
(uint)layers); (uint)layers);
Extent3D extent = new Extent3D((uint)width, (uint)height, (uint)depth); Extent3D extent = new((uint)width, (uint)height, (uint)depth);
int z = is3D ? dstLayer : 0; int z = is3D ? dstLayer : 0;
BufferImageCopy region = new BufferImageCopy( BufferImageCopy region = new(
(ulong)offset, (ulong)offset,
(uint)AlignUpNpot(rowLength, Info.BlockWidth), (uint)AlignUpNpot(rowLength, Info.BlockWidth),
(uint)AlignUpNpot(height, Info.BlockHeight), (uint)AlignUpNpot(height, Info.BlockHeight),
@ -993,9 +993,9 @@ namespace Ryujinx.Graphics.Vulkan
aspectFlags = ImageAspectFlags.DepthBit; aspectFlags = ImageAspectFlags.DepthBit;
} }
ImageSubresourceLayers sl = new ImageSubresourceLayers(aspectFlags, (uint)(FirstLevel + dstLevel), (uint)(FirstLayer + dstLayer), 1); ImageSubresourceLayers sl = new(aspectFlags, (uint)(FirstLevel + dstLevel), (uint)(FirstLayer + dstLayer), 1);
Extent3D extent = new Extent3D((uint)width, (uint)height, 1); Extent3D extent = new((uint)width, (uint)height, 1);
int rowLengthAlignment = Info.BlockWidth; int rowLengthAlignment = Info.BlockWidth;
@ -1005,7 +1005,7 @@ namespace Ryujinx.Graphics.Vulkan
rowLengthAlignment = 4 / Info.BytesPerPixel; rowLengthAlignment = 4 / Info.BytesPerPixel;
} }
BufferImageCopy region = new BufferImageCopy( BufferImageCopy region = new(
0, 0,
(uint)AlignUpNpot(width, rowLengthAlignment), (uint)AlignUpNpot(width, rowLengthAlignment),
(uint)AlignUpNpot(height, Info.BlockHeight), (uint)AlignUpNpot(height, Info.BlockHeight),

View File

@ -62,7 +62,7 @@ namespace Ryujinx.Graphics.Vulkan
_ => throw new ArgumentException($"Invalid log level \"{_logLevel}\"."), _ => throw new ArgumentException($"Invalid log level \"{_logLevel}\"."),
}; };
DebugUtilsMessengerCreateInfoEXT debugUtilsMessengerCreateInfo = new DebugUtilsMessengerCreateInfoEXT DebugUtilsMessengerCreateInfoEXT debugUtilsMessengerCreateInfo = new()
{ {
SType = StructureType.DebugUtilsMessengerCreateInfoExt, SType = StructureType.DebugUtilsMessengerCreateInfoExt,
MessageType = messageType, MessageType = messageType,

View File

@ -55,7 +55,7 @@ namespace Ryujinx.Graphics.Vulkan
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>(); List<string> enabledLayers = new();
IReadOnlySet<string> instanceExtensions = VulkanInstance.GetInstanceExtensions(api); IReadOnlySet<string> instanceExtensions = VulkanInstance.GetInstanceExtensions(api);
IReadOnlySet<string> instanceLayers = VulkanInstance.GetInstanceLayers(api); IReadOnlySet<string> instanceLayers = VulkanInstance.GetInstanceLayers(api);
@ -86,7 +86,7 @@ namespace Ryujinx.Graphics.Vulkan
IntPtr appName = Marshal.StringToHGlobalAnsi(AppName); IntPtr appName = Marshal.StringToHGlobalAnsi(AppName);
ApplicationInfo applicationInfo = new ApplicationInfo ApplicationInfo applicationInfo = new()
{ {
PApplicationName = (byte*)appName, PApplicationName = (byte*)appName,
ApplicationVersion = 1, ApplicationVersion = 1,
@ -108,7 +108,7 @@ namespace Ryujinx.Graphics.Vulkan
ppEnabledLayers[i] = Marshal.StringToHGlobalAnsi(enabledLayers[i]); ppEnabledLayers[i] = Marshal.StringToHGlobalAnsi(enabledLayers[i]);
} }
InstanceCreateInfo instanceCreateInfo = new InstanceCreateInfo InstanceCreateInfo instanceCreateInfo = new()
{ {
SType = StructureType.InstanceCreateInfo, SType = StructureType.InstanceCreateInfo,
PApplicationInfo = &applicationInfo, PApplicationInfo = &applicationInfo,
@ -166,7 +166,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
IntPtr appName = Marshal.StringToHGlobalAnsi(AppName); IntPtr appName = Marshal.StringToHGlobalAnsi(AppName);
ApplicationInfo applicationInfo = new ApplicationInfo ApplicationInfo applicationInfo = new()
{ {
PApplicationName = (byte*)appName, PApplicationName = (byte*)appName,
ApplicationVersion = 1, ApplicationVersion = 1,
@ -175,7 +175,7 @@ namespace Ryujinx.Graphics.Vulkan
ApiVersion = _maximumVulkanVersion, ApiVersion = _maximumVulkanVersion,
}; };
InstanceCreateInfo instanceCreateInfo = new InstanceCreateInfo InstanceCreateInfo instanceCreateInfo = new()
{ {
SType = StructureType.InstanceCreateInfo, SType = StructureType.InstanceCreateInfo,
PApplicationInfo = &applicationInfo, PApplicationInfo = &applicationInfo,
@ -246,7 +246,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
const QueueFlags RequiredFlags = QueueFlags.GraphicsBit | QueueFlags.ComputeBit; const QueueFlags RequiredFlags = QueueFlags.GraphicsBit | QueueFlags.ComputeBit;
KhrSurface khrSurface = new KhrSurface(api.Context); KhrSurface khrSurface = new(api.Context);
for (uint index = 0; index < physicalDevice.QueueFamilyProperties.Length; index++) for (uint index = 0; index < physicalDevice.QueueFamilyProperties.Length; index++)
{ {
@ -281,7 +281,7 @@ namespace Ryujinx.Graphics.Vulkan
queuePriorities[i] = 1f; queuePriorities[i] = 1f;
} }
DeviceQueueCreateInfo queueCreateInfo = new DeviceQueueCreateInfo DeviceQueueCreateInfo queueCreateInfo = new()
{ {
SType = StructureType.DeviceQueueCreateInfo, SType = StructureType.DeviceQueueCreateInfo,
QueueFamilyIndex = queueFamilyIndex, QueueFamilyIndex = queueFamilyIndex,
@ -394,7 +394,7 @@ namespace Ryujinx.Graphics.Vulkan
PhysicalDeviceFeatures supportedFeatures = features2.Features; PhysicalDeviceFeatures supportedFeatures = features2.Features;
PhysicalDeviceFeatures features = new PhysicalDeviceFeatures PhysicalDeviceFeatures features = new()
{ {
DepthBiasClamp = supportedFeatures.DepthBiasClamp, DepthBiasClamp = supportedFeatures.DepthBiasClamp,
DepthClamp = supportedFeatures.DepthClamp, DepthClamp = supportedFeatures.DepthClamp,
@ -465,7 +465,7 @@ namespace Ryujinx.Graphics.Vulkan
pExtendedFeatures = &featuresRobustness2; pExtendedFeatures = &featuresRobustness2;
} }
PhysicalDeviceExtendedDynamicStateFeaturesEXT featuresExtendedDynamicState = new PhysicalDeviceExtendedDynamicStateFeaturesEXT PhysicalDeviceExtendedDynamicStateFeaturesEXT featuresExtendedDynamicState = new()
{ {
SType = StructureType.PhysicalDeviceExtendedDynamicStateFeaturesExt, SType = StructureType.PhysicalDeviceExtendedDynamicStateFeaturesExt,
PNext = pExtendedFeatures, PNext = pExtendedFeatures,
@ -474,7 +474,7 @@ namespace Ryujinx.Graphics.Vulkan
pExtendedFeatures = &featuresExtendedDynamicState; pExtendedFeatures = &featuresExtendedDynamicState;
PhysicalDeviceVulkan11Features featuresVk11 = new PhysicalDeviceVulkan11Features PhysicalDeviceVulkan11Features featuresVk11 = new()
{ {
SType = StructureType.PhysicalDeviceVulkan11Features, SType = StructureType.PhysicalDeviceVulkan11Features,
PNext = pExtendedFeatures, PNext = pExtendedFeatures,
@ -483,7 +483,7 @@ namespace Ryujinx.Graphics.Vulkan
pExtendedFeatures = &featuresVk11; pExtendedFeatures = &featuresVk11;
PhysicalDeviceVulkan12Features featuresVk12 = new PhysicalDeviceVulkan12Features PhysicalDeviceVulkan12Features featuresVk12 = new()
{ {
SType = StructureType.PhysicalDeviceVulkan12Features, SType = StructureType.PhysicalDeviceVulkan12Features,
PNext = pExtendedFeatures, PNext = pExtendedFeatures,
@ -595,7 +595,7 @@ namespace Ryujinx.Graphics.Vulkan
ppEnabledExtensions[i] = Marshal.StringToHGlobalAnsi(enabledExtensions[i]); ppEnabledExtensions[i] = Marshal.StringToHGlobalAnsi(enabledExtensions[i]);
} }
DeviceCreateInfo deviceCreateInfo = new DeviceCreateInfo DeviceCreateInfo deviceCreateInfo = new()
{ {
SType = StructureType.DeviceCreateInfo, SType = StructureType.DeviceCreateInfo,
PNext = pExtendedFeatures, PNext = pExtendedFeatures,

View File

@ -215,7 +215,7 @@ namespace Ryujinx.Graphics.Vulkan
bool supportsPushDescriptors = _physicalDevice.IsDeviceExtensionPresent(KhrPushDescriptor.ExtensionName); bool supportsPushDescriptors = _physicalDevice.IsDeviceExtensionPresent(KhrPushDescriptor.ExtensionName);
PhysicalDevicePushDescriptorPropertiesKHR propertiesPushDescriptor = new PhysicalDevicePushDescriptorPropertiesKHR() PhysicalDevicePushDescriptorPropertiesKHR propertiesPushDescriptor = new()
{ {
SType = StructureType.PhysicalDevicePushDescriptorPropertiesKhr SType = StructureType.PhysicalDevicePushDescriptorPropertiesKhr
}; };

View File

@ -127,7 +127,7 @@ namespace Ryujinx.Graphics.Vulkan
SwapchainKHR oldSwapchain = _swapchain; SwapchainKHR oldSwapchain = _swapchain;
SwapchainCreateInfoKHR swapchainCreateInfo = new SwapchainCreateInfoKHR SwapchainCreateInfoKHR swapchainCreateInfo = new()
{ {
SType = StructureType.SwapchainCreateInfoKhr, SType = StructureType.SwapchainCreateInfoKhr,
Surface = _surface, Surface = _surface,
@ -144,7 +144,7 @@ namespace Ryujinx.Graphics.Vulkan
Clipped = true, Clipped = true,
}; };
TextureCreateInfo textureCreateInfo = new TextureCreateInfo( TextureCreateInfo textureCreateInfo = new(
_width, _width,
_height, _height,
1, 1,
@ -179,7 +179,7 @@ namespace Ryujinx.Graphics.Vulkan
_swapchainImageViews[i] = CreateSwapchainImageView(_swapchainImages[i], surfaceFormat.Format, textureCreateInfo); _swapchainImageViews[i] = CreateSwapchainImageView(_swapchainImages[i], surfaceFormat.Format, textureCreateInfo);
} }
SemaphoreCreateInfo semaphoreCreateInfo = new SemaphoreCreateInfo SemaphoreCreateInfo semaphoreCreateInfo = new()
{ {
SType = StructureType.SemaphoreCreateInfo, SType = StructureType.SemaphoreCreateInfo,
}; };
@ -201,7 +201,7 @@ namespace Ryujinx.Graphics.Vulkan
private unsafe TextureView CreateSwapchainImageView(Image swapchainImage, VkFormat format, TextureCreateInfo info) private unsafe TextureView CreateSwapchainImageView(Image swapchainImage, VkFormat format, TextureCreateInfo info)
{ {
ComponentMapping componentMapping = new ComponentMapping( ComponentMapping componentMapping = new(
ComponentSwizzle.R, ComponentSwizzle.R,
ComponentSwizzle.G, ComponentSwizzle.G,
ComponentSwizzle.B, ComponentSwizzle.B,
@ -209,9 +209,9 @@ namespace Ryujinx.Graphics.Vulkan
ImageAspectFlags aspectFlags = ImageAspectFlags.ColorBit; ImageAspectFlags aspectFlags = ImageAspectFlags.ColorBit;
ImageSubresourceRange subresourceRange = new ImageSubresourceRange(aspectFlags, 0, 1, 0, 1); ImageSubresourceRange subresourceRange = new(aspectFlags, 0, 1, 0, 1);
ImageViewCreateInfo imageCreateInfo = new ImageViewCreateInfo ImageViewCreateInfo imageCreateInfo = new()
{ {
SType = StructureType.ImageViewCreateInfo, SType = StructureType.ImageViewCreateInfo,
Image = swapchainImage, Image = swapchainImage,
@ -467,7 +467,7 @@ namespace Ryujinx.Graphics.Vulkan
Result result; Result result;
PresentInfoKHR presentInfo = new PresentInfoKHR PresentInfoKHR presentInfo = new()
{ {
SType = StructureType.PresentInfoKhr, SType = StructureType.PresentInfoKhr,
WaitSemaphoreCount = 1, WaitSemaphoreCount = 1,
@ -594,9 +594,9 @@ namespace Ryujinx.Graphics.Vulkan
ImageLayout srcLayout, ImageLayout srcLayout,
ImageLayout dstLayout) ImageLayout dstLayout)
{ {
ImageSubresourceRange subresourceRange = new ImageSubresourceRange(ImageAspectFlags.ColorBit, 0, 1, 0, 1); ImageSubresourceRange subresourceRange = new(ImageAspectFlags.ColorBit, 0, 1, 0, 1);
ImageMemoryBarrier barrier = new ImageMemoryBarrier ImageMemoryBarrier barrier = new()
{ {
SType = StructureType.ImageMemoryBarrier, SType = StructureType.ImageMemoryBarrier,
SrcAccessMask = srcAccess, SrcAccessMask = srcAccess,