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;
}
MemoryBarrier barrier = new MemoryBarrier()
MemoryBarrier barrier = new()
{
SType = StructureType.MemoryBarrier,
SrcAccessMask = access,
@ -175,7 +175,7 @@ namespace Ryujinx.Graphics.Vulkan
{
// Feedback loop barrier.
MemoryBarrier barrier = new MemoryBarrier()
MemoryBarrier barrier = new()
{
SType = StructureType.MemoryBarrier,
SrcAccessMask = AccessFlags.ShaderWriteBit,

View file

@ -220,7 +220,7 @@ namespace Ryujinx.Graphics.Vulkan
public BitMapStruct<T> Union(BitMapStruct<T> other)
{
BitMapStruct<T> result = new BitMapStruct<T>();
BitMapStruct<T> result = new();
ref T masks = ref _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)
{
BufferViewCreateInfo bufferViewCreateInfo = new BufferViewCreateInfo
BufferViewCreateInfo bufferViewCreateInfo = new()
{
SType = StructureType.BufferViewCreateInfo,
Buffer = new VkBuffer(_bufferHandle),
@ -205,7 +205,7 @@ namespace Ryujinx.Graphics.Vulkan
// 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);
StagingBufferReserved? newMirror = _gd.BufferManager.StagingBuffer.TryReserveData(cbs, size);
@ -723,7 +723,7 @@ namespace Ryujinx.Graphics.Vulkan
dstOffset,
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);
@ -804,7 +804,7 @@ namespace Ryujinx.Graphics.Vulkan
return null;
}
I8ToI16CacheKey key = new I8ToI16CacheKey(_gd);
I8ToI16CacheKey key = new(_gd);
if (!_cachedConvertedBuffers.TryGetValue(offset, size, key, out BufferHolder holder))
{
@ -828,7 +828,7 @@ namespace Ryujinx.Graphics.Vulkan
return null;
}
AlignedVertexBufferCacheKey key = new AlignedVertexBufferCacheKey(_gd, stride, alignment);
AlignedVertexBufferCacheKey key = new(_gd, stride, alignment);
if (!_cachedConvertedBuffers.TryGetValue(offset, size, key, out BufferHolder holder))
{
@ -854,7 +854,7 @@ namespace Ryujinx.Graphics.Vulkan
return null;
}
TopologyConversionCacheKey key = new TopologyConversionCacheKey(_gd, pattern, indexSize);
TopologyConversionCacheKey key = new(_gd, pattern, indexSize);
if (!_cachedConvertedBuffers.TryGetValue(offset, size, key, out BufferHolder holder))
{

View file

@ -103,13 +103,13 @@ namespace Ryujinx.Graphics.Vulkan
usage |= BufferUsageFlags.IndirectBufferBit;
}
ExternalMemoryBufferCreateInfo externalMemoryBuffer = new ExternalMemoryBufferCreateInfo
ExternalMemoryBufferCreateInfo externalMemoryBuffer = new()
{
SType = StructureType.ExternalMemoryBufferCreateInfo,
HandleTypes = ExternalMemoryHandleTypeFlags.HostAllocationBitExt,
};
BufferCreateInfo bufferCreateInfo = new BufferCreateInfo
BufferCreateInfo bufferCreateInfo = new()
{
SType = StructureType.BufferCreateInfo,
Size = (ulong)size,
@ -124,7 +124,7 @@ namespace Ryujinx.Graphics.Vulkan
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++;
@ -149,7 +149,7 @@ namespace Ryujinx.Graphics.Vulkan
size += (ulong)range.Size;
}
BufferCreateInfo bufferCreateInfo = new BufferCreateInfo()
BufferCreateInfo bufferCreateInfo = new()
{
SType = StructureType.BufferCreateInfo,
Size = size,
@ -207,14 +207,14 @@ namespace Ryujinx.Graphics.Vulkan
fixed (SparseMemoryBind* pMemoryBinds = memoryBinds)
{
SparseBufferMemoryBindInfo bufferBind = new SparseBufferMemoryBindInfo()
SparseBufferMemoryBindInfo bufferBind = new()
{
Buffer = buffer,
BindCount = (uint)memoryBinds.Length,
PBinds = pMemoryBinds
};
BindSparseInfo bindSparseInfo = new BindSparseInfo()
BindSparseInfo bindSparseInfo = new()
{
SType = StructureType.BindSparseInfo,
BufferBindCount = 1,
@ -224,7 +224,7 @@ namespace Ryujinx.Graphics.Vulkan
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++;
@ -295,7 +295,7 @@ namespace Ryujinx.Graphics.Vulkan
usage |= BufferUsageFlags.IndirectBufferBit;
}
BufferCreateInfo bufferCreateInfo = new BufferCreateInfo
BufferCreateInfo bufferCreateInfo = new()
{
SType = StructureType.BufferCreateInfo,
Size = (ulong)Environment.SystemPageSize,
@ -331,7 +331,7 @@ namespace Ryujinx.Graphics.Vulkan
usage |= BufferUsageFlags.IndirectBufferBit;
}
BufferCreateInfo bufferCreateInfo = new BufferCreateInfo
BufferCreateInfo bufferCreateInfo = new()
{
SType = StructureType.BufferCreateInfo,
Size = (ulong)size,
@ -402,7 +402,7 @@ namespace Ryujinx.Graphics.Vulkan
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;
}
@ -493,7 +493,7 @@ namespace Ryujinx.Graphics.Vulkan
return (null, null);
}
TopologyConversionIndirectCacheKey indexBufferKey = new TopologyConversionIndirectCacheKey(
TopologyConversionIndirectCacheKey indexBufferKey = new(
gd,
pattern,
indexSize,
@ -507,14 +507,14 @@ namespace Ryujinx.Graphics.Vulkan
indexBufferKey,
out BufferHolder convertedIndexBuffer);
IndirectDataCacheKey indirectBufferKey = new IndirectDataCacheKey(pattern);
IndirectDataCacheKey indirectBufferKey = new(pattern);
bool hasConvertedIndirectBuffer = indirectBufferHolder.TryGetCachedConvertedBuffer(
indirectBuffer.Offset,
indirectBuffer.Size,
indirectBufferKey,
out BufferHolder convertedIndirectBuffer);
DrawCountCacheKey drawCountBufferKey = new DrawCountCacheKey();
DrawCountCacheKey drawCountBufferKey = new();
bool hasCachedDrawCount = true;
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,
// 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,
indexBuffer.Offset,
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
// where we used it to find the range of indirect data that is actually used.
Dependency indirectBufferDependency = new Dependency(
Dependency indirectBufferDependency = new(
indirectBufferHolder,
indirectBuffer.Offset,
indirectBuffer.Size,

View file

@ -152,7 +152,7 @@ namespace Ryujinx.Graphics.Vulkan
{
_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)
{
CommandBufferAllocateInfo allocateInfo = new CommandBufferAllocateInfo
CommandBufferAllocateInfo allocateInfo = new()
{
SType = StructureType.CommandBufferAllocateInfo,
CommandBufferCount = 1,
@ -75,7 +75,7 @@ namespace Ryujinx.Graphics.Vulkan
_concurrentFenceWaitUnsupported = concurrentFenceWaitUnsupported;
_owner = Thread.CurrentThread;
CommandPoolCreateInfo commandPoolCreateInfo = new CommandPoolCreateInfo
CommandPoolCreateInfo commandPoolCreateInfo = new()
{
SType = StructureType.CommandPoolCreateInfo,
QueueFamilyIndex = queueFamilyIndex,
@ -248,7 +248,7 @@ namespace Ryujinx.Graphics.Vulkan
_inUseCount++;
CommandBufferBeginInfo commandBufferBeginInfo = new CommandBufferBeginInfo
CommandBufferBeginInfo commandBufferBeginInfo = new()
{
SType = StructureType.CommandBufferBeginInfo,
};

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -81,7 +81,7 @@ namespace Ryujinx.Graphics.Vulkan
ReadOnlyCollection<ResourceDescriptorCollection> setDescriptors,
bool usePushDescriptors)
{
PlceKey key = new PlceKey(setDescriptors, usePushDescriptors);
PlceKey key = new(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;
}
DescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo = new DescriptorSetLayoutCreateInfo
DescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo = new()
{
SType = StructureType.DescriptorSetLayoutCreateInfo,
PBindings = pLayoutBindings,
@ -99,7 +99,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (DescriptorSetLayout* pLayouts = layouts)
{
PipelineLayoutCreateInfo pipelineLayoutCreateInfo = new PipelineLayoutCreateInfo
PipelineLayoutCreateInfo pipelineLayoutCreateInfo = new()
{
SType = StructureType.PipelineLayoutCreateInfo,
PSetLayouts = pLayouts,

View file

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

View file

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

View file

@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Vulkan
AttachmentDescription[] attachmentDescs = null;
SubpassDescription subpass = new SubpassDescription
SubpassDescription subpass = new()
{
PipelineBindPoint = PipelineBindPoint.Graphics,
};
@ -114,7 +114,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (AttachmentDescription* pAttachmentDescs = attachmentDescs)
{
RenderPassCreateInfo renderPassCreateInfo = new RenderPassCreateInfo
RenderPassCreateInfo renderPassCreateInfo = new()
{
SType = StructureType.RenderPassCreateInfo,
PAttachments = pAttachmentDescs,
@ -149,7 +149,7 @@ namespace Ryujinx.Graphics.Vulkan
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))
{

View file

@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Vulkan
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,
MagFilter = info.MagFilter.Convert(),
@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Vulkan
if (cantConstrain && gd.Capabilities.SupportsCustomBorderColor)
{
ClearColorValue color = new ClearColorValue(
ClearColorValue color = new(
info.BorderColor.Red,
info.BorderColor.Green,
info.BorderColor.Blue,

View file

@ -59,7 +59,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (byte* pCode = spirv)
{
ShaderModuleCreateInfo shaderModuleCreateInfo = new ShaderModuleCreateInfo
ShaderModuleCreateInfo shaderModuleCreateInfo = new()
{
SType = StructureType.ShaderModuleCreateInfo,
CodeSize = (uint)spirv.Length,
@ -102,7 +102,7 @@ namespace Ryujinx.Graphics.Vulkan
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];

View file

@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Vulkan
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
{

View file

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

View file

@ -34,8 +34,8 @@ namespace Ryujinx.Graphics.Vulkan
return Math.Clamp(value, 0, max);
}
Offset3D xy1 = new Offset3D(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 xy1 = new(Clamp(extents.X1, width) >> level, Clamp(extents.Y1, height) >> level, 0);
Offset3D xy2 = new(Clamp(extents.X2, width) >> level, Clamp(extents.Y2, height) >> level, 1);
return (xy1, xy2);
}
@ -50,8 +50,8 @@ namespace Ryujinx.Graphics.Vulkan
dstAspectFlags = dstInfo.Format.ConvertAspectFlags();
}
ImageBlit.SrcOffsetsBuffer srcOffsets = new ImageBlit.SrcOffsetsBuffer();
ImageBlit.DstOffsetsBuffer dstOffsets = new ImageBlit.DstOffsetsBuffer();
ImageBlit.SrcOffsetsBuffer srcOffsets = new();
ImageBlit.DstOffsetsBuffer dstOffsets = new();
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++)
{
ImageSubresourceLayers srcSl = new ImageSubresourceLayers(srcAspectFlags, copySrcLevel, (uint)srcLayer, (uint)layers);
ImageSubresourceLayers dstSl = new ImageSubresourceLayers(dstAspectFlags, copyDstLevel, (uint)dstLayer, (uint)layers);
ImageSubresourceLayers srcSl = new(srcAspectFlags, copySrcLevel, (uint)srcLayer, (uint)layers);
ImageSubresourceLayers dstSl = new(dstAspectFlags, copyDstLevel, (uint)dstLayer, (uint)layers);
(srcOffsets.Element0, srcOffsets.Element1) = ExtentsToOffset3D(srcRegion, srcInfo.Width, srcInfo.Height, level);
(dstOffsets.Element0, dstOffsets.Element1) = ExtentsToOffset3D(dstRegion, dstInfo.Width, dstInfo.Height, level);
ImageBlit region = new ImageBlit
ImageBlit region = new()
{
SrcSubresource = srcSl,
SrcOffsets = srcOffsets,
@ -299,13 +299,13 @@ namespace Ryujinx.Graphics.Vulkan
break;
}
ImageSubresourceLayers srcSl = new ImageSubresourceLayers(
ImageSubresourceLayers srcSl = new(
srcAspect,
(uint)(srcViewLevel + srcLevel + level),
(uint)(srcViewLayer + srcLayer),
(uint)srcLayers);
ImageSubresourceLayers dstSl = new ImageSubresourceLayers(
ImageSubresourceLayers dstSl = new(
dstAspect,
(uint)(dstViewLevel + dstLevel + level),
(uint)(dstViewLayer + dstLayer),
@ -314,17 +314,17 @@ namespace Ryujinx.Graphics.Vulkan
int copyWidth = sizeInBlocks ? BitUtils.DivRoundUp(width, blockWidth) : width;
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)
{
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);
}
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);
}
@ -360,10 +360,10 @@ namespace Ryujinx.Graphics.Vulkan
TextureView src,
TextureView dst)
{
AttachmentReference2 dsAttachmentReference = new AttachmentReference2(StructureType.AttachmentReference2, null, 0, ImageLayout.General);
AttachmentReference2 dsResolveAttachmentReference = new AttachmentReference2(StructureType.AttachmentReference2, null, 1, ImageLayout.General);
AttachmentReference2 dsAttachmentReference = new(StructureType.AttachmentReference2, null, 0, ImageLayout.General);
AttachmentReference2 dsResolveAttachmentReference = new(StructureType.AttachmentReference2, null, 1, ImageLayout.General);
SubpassDescriptionDepthStencilResolve subpassDsResolve = new SubpassDescriptionDepthStencilResolve
SubpassDescriptionDepthStencilResolve subpassDsResolve = new()
{
SType = StructureType.SubpassDescriptionDepthStencilResolve,
PDepthStencilResolveAttachment = &dsResolveAttachmentReference,
@ -371,7 +371,7 @@ namespace Ryujinx.Graphics.Vulkan
StencilResolveMode = ResolveModeFlags.SampleZeroBit,
};
SubpassDescription2 subpass = new SubpassDescription2
SubpassDescription2 subpass = new()
{
SType = StructureType.SubpassDescription2,
PipelineBindPoint = PipelineBindPoint.Graphics,
@ -411,7 +411,7 @@ namespace Ryujinx.Graphics.Vulkan
fixed (AttachmentDescription2* pAttachmentDescs = attachmentDescs)
{
RenderPassCreateInfo2 renderPassCreateInfo = new RenderPassCreateInfo2
RenderPassCreateInfo2 renderPassCreateInfo = new()
{
SType = StructureType.RenderPassCreateInfo2,
PAttachments = pAttachmentDescs,
@ -424,7 +424,7 @@ namespace Ryujinx.Graphics.Vulkan
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];
@ -434,7 +434,7 @@ namespace Ryujinx.Graphics.Vulkan
attachments[0] = srcView.Get(cbs).Value;
attachments[1] = dstView.Get(cbs).Value;
FramebufferCreateInfo framebufferCreateInfo = new FramebufferCreateInfo
FramebufferCreateInfo framebufferCreateInfo = new()
{
SType = StructureType.FramebufferCreateInfo,
RenderPass = rp.Get(cbs).Value,
@ -446,12 +446,12 @@ namespace Ryujinx.Graphics.Vulkan
};
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));
ClearValue clearValue = new ClearValue();
Rect2D renderArea = new(null, new Extent2D((uint)src.Info.Width, (uint)src.Info.Height));
ClearValue clearValue = new();
RenderPassBeginInfo renderPassBeginInfo = new RenderPassBeginInfo
RenderPassBeginInfo renderPassBeginInfo = new()
{
SType = StructureType.RenderPassBeginInfo,
RenderPass = rp.Get(cbs).Value,

View file

@ -89,7 +89,7 @@ namespace Ryujinx.Graphics.Vulkan
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);
@ -111,7 +111,7 @@ namespace Ryujinx.Graphics.Vulkan
flags |= ImageCreateFlags.Create2DArrayCompatibleBit;
}
ImageCreateInfo imageCreateInfo = new ImageCreateInfo
ImageCreateInfo imageCreateInfo = new()
{
SType = StructureType.ImageCreateInfo,
ImageType = type,
@ -274,9 +274,9 @@ namespace Ryujinx.Graphics.Vulkan
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,
SrcAccessMask = 0,
@ -402,17 +402,17 @@ namespace Ryujinx.Graphics.Vulkan
int rowLength = (Info.GetMipStride(level) / Info.BytesPerPixel) * Info.BlockWidth;
ImageSubresourceLayers sl = new ImageSubresourceLayers(
ImageSubresourceLayers sl = new(
aspectFlags,
(uint)(dstLevel + level),
(uint)layer,
(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;
BufferImageCopy region = new BufferImageCopy(
BufferImageCopy region = new(
(ulong)offset,
(uint)BitUtils.AlignUp(rowLength, Info.BlockWidth),
(uint)BitUtils.AlignUp(height, Info.BlockHeight),

View file

@ -95,23 +95,23 @@ namespace Ryujinx.Graphics.Vulkan
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 aspectFlagsDepth = info.Format.ConvertAspectFlags();
ImageSubresourceRange subresourceRange = new ImageSubresourceRange(aspectFlags, (uint)firstLevel, levels, (uint)firstLayer, layers);
ImageSubresourceRange subresourceRangeDepth = new ImageSubresourceRange(aspectFlagsDepth, (uint)firstLevel, levels, (uint)firstLayer, layers);
ImageSubresourceRange subresourceRange = new(aspectFlags, (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)
{
ImageViewUsageCreateInfo imageViewUsage = new ImageViewUsageCreateInfo
ImageViewUsageCreateInfo imageViewUsage = new()
{
SType = StructureType.ImageViewUsageCreateInfo,
Usage = usageFlags,
};
ImageViewCreateInfo imageCreateInfo = new ImageViewCreateInfo
ImageViewCreateInfo imageCreateInfo = new()
{
SType = StructureType.ImageViewCreateInfo,
Image = storage.GetImageForViewCreation(),
@ -136,7 +136,7 @@ namespace Ryujinx.Graphics.Vulkan
_imageView = CreateImageView(componentMapping, subresourceRange, type, shaderUsage);
// Framebuffer attachments and storage images requires a identity component mapping.
ComponentMapping identityComponentMapping = new ComponentMapping(
ComponentMapping identityComponentMapping = new(
ComponentSwizzle.R,
ComponentSwizzle.G,
ComponentSwizzle.B,
@ -934,17 +934,17 @@ namespace Ryujinx.Graphics.Vulkan
aspectFlags = ImageAspectFlags.DepthBit;
}
ImageSubresourceLayers sl = new ImageSubresourceLayers(
ImageSubresourceLayers sl = new(
aspectFlags,
(uint)(FirstLevel + dstLevel + level),
(uint)(FirstLayer + layer),
(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;
BufferImageCopy region = new BufferImageCopy(
BufferImageCopy region = new(
(ulong)offset,
(uint)AlignUpNpot(rowLength, Info.BlockWidth),
(uint)AlignUpNpot(height, Info.BlockHeight),
@ -993,9 +993,9 @@ namespace Ryujinx.Graphics.Vulkan
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;
@ -1005,7 +1005,7 @@ namespace Ryujinx.Graphics.Vulkan
rowLengthAlignment = 4 / Info.BytesPerPixel;
}
BufferImageCopy region = new BufferImageCopy(
BufferImageCopy region = new(
0,
(uint)AlignUpNpot(width, rowLengthAlignment),
(uint)AlignUpNpot(height, Info.BlockHeight),

View file

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

View file

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

View file

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

View file

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