0
0
Fork 0

Vulkan: Update Silk.NET to 2.21 (#7266)

* Update Silk.NET version

* fix: add MoltenVK resolver workaround

fix: add MoltenVK resolver workaround

* Cleanup

* Readonly ref warnings

* Remove driver id todo
This commit is contained in:
riperiperi 2024-09-01 21:33:11 +01:00 committed by GitHub
parent 2c5c0392f9
commit 398fa1c238
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 94 additions and 60 deletions

View file

@ -39,9 +39,9 @@
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" /> <PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />
<PackageVersion Include="shaderc.net" Version="0.1.0" /> <PackageVersion Include="shaderc.net" Version="0.1.0" />
<PackageVersion Include="SharpZipLib" Version="1.4.2" /> <PackageVersion Include="SharpZipLib" Version="1.4.2" />
<PackageVersion Include="Silk.NET.Vulkan" Version="2.16.0" /> <PackageVersion Include="Silk.NET.Vulkan" Version="2.21.0" />
<PackageVersion Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.16.0" /> <PackageVersion Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.21.0" />
<PackageVersion Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.16.0" /> <PackageVersion Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.21.0" />
<PackageVersion Include="SkiaSharp" Version="2.88.7" /> <PackageVersion Include="SkiaSharp" Version="2.88.7" />
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="2.88.7" /> <PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="2.88.7" />
<PackageVersion Include="SPB" Version="0.0.4-build32" /> <PackageVersion Include="SPB" Version="0.0.4-build32" />

View file

@ -122,7 +122,7 @@ namespace Ryujinx.Graphics.Vulkan
Range = (uint)size, Range = (uint)size,
}; };
_gd.Api.CreateBufferView(_device, bufferViewCreateInfo, null, out var bufferView).ThrowOnError(); _gd.Api.CreateBufferView(_device, in bufferViewCreateInfo, null, out var bufferView).ThrowOnError();
return new Auto<DisposableBufferView>(new DisposableBufferView(_gd.Api, _device, bufferView), this, _waitable, _buffer); return new Auto<DisposableBufferView>(new DisposableBufferView(_gd.Api, _device, bufferView), this, _waitable, _buffer);
} }
@ -153,7 +153,7 @@ namespace Ryujinx.Graphics.Vulkan
PipelineStageFlags.AllCommandsBit, PipelineStageFlags.AllCommandsBit,
DependencyFlags.DeviceGroupBit, DependencyFlags.DeviceGroupBit,
1, 1,
memoryBarrier, in memoryBarrier,
0, 0,
null, null,
0, 0,
@ -770,7 +770,7 @@ namespace Ryujinx.Graphics.Vulkan
0, 0,
null, null,
1, 1,
memoryBarrier, in memoryBarrier,
0, 0,
null); null);
} }

View file

@ -221,7 +221,7 @@ namespace Ryujinx.Graphics.Vulkan
PBufferBinds = &bufferBind PBufferBinds = &bufferBind
}; };
gd.Api.QueueBindSparse(gd.Queue, 1, bindSparseInfo, default).ThrowOnError(); gd.Api.QueueBindSparse(gd.Queue, 1, in bindSparseInfo, default).ThrowOnError();
} }
var holder = new BufferHolder(gd, _device, buffer, (int)size, storageAllocations); var holder = new BufferHolder(gd, _device, buffer, (int)size, storageAllocations);

View file

@ -25,7 +25,10 @@ namespace Ryujinx.Graphics.Vulkan
{ {
var buffer = _buffer.Get(cbs, _offset, _size, true).Value; var buffer = _buffer.Get(cbs, _offset, _size, true).Value;
gd.TransformFeedbackApi.CmdBindTransformFeedbackBuffers(cbs.CommandBuffer, binding, 1, buffer, (ulong)_offset, (ulong)_size); ulong offset = (ulong)_offset;
ulong size = (ulong)_size;
gd.TransformFeedbackApi.CmdBindTransformFeedbackBuffers(cbs.CommandBuffer, binding, 1, in buffer, in offset, in size);
} }
} }

View file

@ -45,7 +45,7 @@ namespace Ryujinx.Graphics.Vulkan
Level = CommandBufferLevel.Primary, Level = CommandBufferLevel.Primary,
}; };
api.AllocateCommandBuffers(device, allocateInfo, out CommandBuffer); api.AllocateCommandBuffers(device, in allocateInfo, out CommandBuffer);
Dependants = new List<IAuto>(); Dependants = new List<IAuto>();
Waitables = new List<MultiFenceHolder>(); Waitables = new List<MultiFenceHolder>();
@ -83,7 +83,7 @@ namespace Ryujinx.Graphics.Vulkan
CommandPoolCreateFlags.ResetCommandBufferBit, CommandPoolCreateFlags.ResetCommandBufferBit,
}; };
api.CreateCommandPool(device, commandPoolCreateInfo, null, out _pool).ThrowOnError(); api.CreateCommandPool(device, in commandPoolCreateInfo, null, out _pool).ThrowOnError();
// We need at least 2 command buffers to get texture data in some cases. // We need at least 2 command buffers to get texture data in some cases.
_totalCommandBuffers = isLight ? 2 : MaxCommandBuffers; _totalCommandBuffers = isLight ? 2 : MaxCommandBuffers;
@ -253,7 +253,7 @@ namespace Ryujinx.Graphics.Vulkan
SType = StructureType.CommandBufferBeginInfo, SType = StructureType.CommandBufferBeginInfo,
}; };
_api.BeginCommandBuffer(entry.CommandBuffer, commandBufferBeginInfo).ThrowOnError(); _api.BeginCommandBuffer(entry.CommandBuffer, in commandBufferBeginInfo).ThrowOnError();
return new CommandBufferScoped(this, entry.CommandBuffer, cursor); return new CommandBufferScoped(this, entry.CommandBuffer, cursor);
} }
@ -311,7 +311,7 @@ namespace Ryujinx.Graphics.Vulkan
lock (_queueLock) lock (_queueLock)
{ {
_api.QueueSubmit(_queue, 1, sInfo, entry.Fence.GetUnsafe()).ThrowOnError(); _api.QueueSubmit(_queue, 1, in sInfo, entry.Fence.GetUnsafe()).ThrowOnError();
} }
} }
} }

View file

@ -43,7 +43,7 @@ namespace Ryujinx.Graphics.Vulkan
PBufferInfo = &bufferInfo, PBufferInfo = &bufferInfo,
}; };
_holder.Api.UpdateDescriptorSets(_holder.Device, 1, writeDescriptorSet, 0, null); _holder.Api.UpdateDescriptorSets(_holder.Device, 1, in writeDescriptorSet, 0, null);
} }
} }
@ -66,7 +66,7 @@ namespace Ryujinx.Graphics.Vulkan
PBufferInfo = pBufferInfo, PBufferInfo = pBufferInfo,
}; };
_holder.Api.UpdateDescriptorSets(_holder.Device, 1, writeDescriptorSet, 0, null); _holder.Api.UpdateDescriptorSets(_holder.Device, 1, in writeDescriptorSet, 0, null);
} }
} }
@ -84,7 +84,7 @@ namespace Ryujinx.Graphics.Vulkan
PImageInfo = &imageInfo, PImageInfo = &imageInfo,
}; };
_holder.Api.UpdateDescriptorSets(_holder.Device, 1, writeDescriptorSet, 0, null); _holder.Api.UpdateDescriptorSets(_holder.Device, 1, in writeDescriptorSet, 0, null);
} }
} }
@ -107,7 +107,7 @@ namespace Ryujinx.Graphics.Vulkan
PImageInfo = pImageInfo, PImageInfo = pImageInfo,
}; };
_holder.Api.UpdateDescriptorSets(_holder.Device, 1, writeDescriptorSet, 0, null); _holder.Api.UpdateDescriptorSets(_holder.Device, 1, in writeDescriptorSet, 0, null);
} }
} }
@ -144,7 +144,7 @@ namespace Ryujinx.Graphics.Vulkan
PImageInfo = pImageInfo, PImageInfo = pImageInfo,
}; };
_holder.Api.UpdateDescriptorSets(_holder.Device, 1, writeDescriptorSet, 0, null); _holder.Api.UpdateDescriptorSets(_holder.Device, 1, in writeDescriptorSet, 0, null);
i += count - 1; i += count - 1;
} }
@ -166,7 +166,7 @@ namespace Ryujinx.Graphics.Vulkan
PTexelBufferView = &texelBufferView, PTexelBufferView = &texelBufferView,
}; };
_holder.Api.UpdateDescriptorSets(_holder.Device, 1, writeDescriptorSet, 0, null); _holder.Api.UpdateDescriptorSets(_holder.Device, 1, in writeDescriptorSet, 0, null);
} }
} }
@ -200,7 +200,7 @@ namespace Ryujinx.Graphics.Vulkan
PTexelBufferView = pTexelBufferView + i, PTexelBufferView = pTexelBufferView + i,
}; };
_holder.Api.UpdateDescriptorSets(_holder.Device, 1, writeDescriptorSet, 0, null); _holder.Api.UpdateDescriptorSets(_holder.Device, 1, in writeDescriptorSet, 0, null);
} }
i += count; i += count;

View file

@ -40,7 +40,7 @@ namespace Ryujinx.Graphics.Vulkan
PPoolSizes = pPoolsSize, PPoolSizes = pPoolsSize,
}; };
Api.CreateDescriptorPool(device, descriptorPoolCreateInfo, null, out _pool).ThrowOnError(); Api.CreateDescriptorPool(device, in descriptorPoolCreateInfo, null, out _pool).ThrowOnError();
} }
} }

View file

@ -250,7 +250,7 @@ namespace Ryujinx.Graphics.Vulkan
Layers = Layers, Layers = Layers,
}; };
api.CreateFramebuffer(_device, framebufferCreateInfo, null, out var framebuffer).ThrowOnError(); api.CreateFramebuffer(_device, in framebufferCreateInfo, null, out var framebuffer).ThrowOnError();
return new Auto<DisposableFramebuffer>(new DisposableFramebuffer(api, _device, framebuffer), null, _attachments); return new Auto<DisposableFramebuffer>(new DisposableFramebuffer(api, _device, framebuffer), null, _attachments);
} }

View file

@ -115,7 +115,7 @@ namespace Ryujinx.Graphics.Vulkan
PNext = &importInfo, PNext = &importInfo,
}; };
Result result = _api.AllocateMemory(_device, memoryAllocateInfo, null, out var deviceMemory); Result result = _api.AllocateMemory(_device, in memoryAllocateInfo, null, out var deviceMemory);
if (result < Result.Success) if (result < Result.Success)
{ {

View file

@ -220,7 +220,7 @@ namespace Ryujinx.Graphics.Vulkan
MemoryTypeIndex = (uint)MemoryTypeIndex, MemoryTypeIndex = (uint)MemoryTypeIndex,
}; };
_api.AllocateMemory(_device, memoryAllocateInfo, null, out var deviceMemory).ThrowOnError(); _api.AllocateMemory(_device, in memoryAllocateInfo, null, out var deviceMemory).ThrowOnError();
IntPtr hostPointer = IntPtr.Zero; IntPtr hostPointer = IntPtr.Zero;

View file

@ -1,3 +1,4 @@
using Silk.NET.Core.Loader;
using Silk.NET.Vulkan; using Silk.NET.Vulkan;
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -8,6 +9,8 @@ namespace Ryujinx.Graphics.Vulkan.MoltenVK
[SupportedOSPlatform("macos")] [SupportedOSPlatform("macos")]
public static partial class MVKInitialization public static partial class MVKInitialization
{ {
private const string VulkanLib = "libvulkan.dylib";
[LibraryImport("libMoltenVK.dylib")] [LibraryImport("libMoltenVK.dylib")]
private static partial Result vkGetMoltenVKConfigurationMVK(IntPtr unusedInstance, out MVKConfiguration config, in IntPtr configSize); private static partial Result vkGetMoltenVKConfigurationMVK(IntPtr unusedInstance, out MVKConfiguration config, in IntPtr configSize);
@ -29,5 +32,20 @@ namespace Ryujinx.Graphics.Vulkan.MoltenVK
vkSetMoltenVKConfigurationMVK(IntPtr.Zero, config, configSize); vkSetMoltenVKConfigurationMVK(IntPtr.Zero, config, configSize);
} }
private static string[] Resolver(string path)
{
if (path.EndsWith(VulkanLib))
{
path = path[..^VulkanLib.Length] + "libMoltenVK.dylib";
return [path];
}
return Array.Empty<string>();
}
public static void InitializeResolver()
{
((DefaultPathResolver)PathResolver.Default).Resolvers.Insert(0, Resolver);
}
} }
} }

View file

@ -102,7 +102,7 @@ namespace Ryujinx.Graphics.Vulkan
SType = StructureType.PipelineCacheCreateInfo, SType = StructureType.PipelineCacheCreateInfo,
}; };
gd.Api.CreatePipelineCache(device, pipelineCacheCreateInfo, null, out PipelineCache).ThrowOnError(); gd.Api.CreatePipelineCache(device, in pipelineCacheCreateInfo, null, out PipelineCache).ThrowOnError();
_descriptorSetUpdater = new DescriptorSetUpdater(gd, device); _descriptorSetUpdater = new DescriptorSetUpdater(gd, device);
_vertexBufferUpdater = new VertexBufferUpdater(gd); _vertexBufferUpdater = new VertexBufferUpdater(gd);
@ -1628,7 +1628,7 @@ namespace Ryujinx.Graphics.Vulkan
ClearValueCount = 1, ClearValueCount = 1,
}; };
Gd.Api.CmdBeginRenderPass(CommandBuffer, renderPassBeginInfo, SubpassContents.Inline); Gd.Api.CmdBeginRenderPass(CommandBuffer, in renderPassBeginInfo, SubpassContents.Inline);
RenderPassActive = true; RenderPassActive = true;
} }
} }

View file

@ -116,7 +116,7 @@ namespace Ryujinx.Graphics.Vulkan
DependencyCount = 1, DependencyCount = 1,
}; };
gd.Api.CreateRenderPass(device, renderPassCreateInfo, null, out var renderPass).ThrowOnError(); gd.Api.CreateRenderPass(device, in renderPassCreateInfo, null, out var renderPass).ThrowOnError();
return new DisposableRenderPass(gd.Api, device, renderPass); return new DisposableRenderPass(gd.Api, device, renderPass);
} }

View file

@ -91,7 +91,7 @@ namespace Ryujinx.Graphics.Vulkan
Flags = flags, Flags = flags,
}; };
gd.Api.CreateDescriptorSetLayout(device, descriptorSetLayoutCreateInfo, null, out layouts[setIndex]).ThrowOnError(); gd.Api.CreateDescriptorSetLayout(device, in descriptorSetLayoutCreateInfo, null, out layouts[setIndex]).ThrowOnError();
} }
} }

View file

@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Vulkan.Queries
PipelineStatistics = flags, PipelineStatistics = flags,
}; };
gd.Api.CreateQueryPool(device, queryPoolCreateInfo, null, out _queryPool).ThrowOnError(); gd.Api.CreateQueryPool(device, in queryPoolCreateInfo, null, out _queryPool).ThrowOnError();
} }
var buffer = gd.BufferManager.Create(gd, sizeof(long), forConditionalRendering: true); var buffer = gd.BufferManager.Create(gd, sizeof(long), forConditionalRendering: true);

View file

@ -125,7 +125,7 @@ namespace Ryujinx.Graphics.Vulkan
DependencyCount = 1, DependencyCount = 1,
}; };
gd.Api.CreateRenderPass(device, renderPassCreateInfo, null, out var renderPass).ThrowOnError(); gd.Api.CreateRenderPass(device, in renderPassCreateInfo, null, out var renderPass).ThrowOnError();
_renderPass = new Auto<DisposableRenderPass>(new DisposableRenderPass(gd.Api, device, renderPass)); _renderPass = new Auto<DisposableRenderPass>(new DisposableRenderPass(gd.Api, device, renderPass));
} }

View file

@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Vulkan
samplerCreateInfo.BorderColor = BorderColor.FloatCustomExt; samplerCreateInfo.BorderColor = BorderColor.FloatCustomExt;
} }
gd.Api.CreateSampler(device, samplerCreateInfo, null, out var sampler).ThrowOnError(); gd.Api.CreateSampler(device, in samplerCreateInfo, null, out var sampler).ThrowOnError();
_sampler = new Auto<DisposableSampler>(new DisposableSampler(gd.Api, device, sampler)); _sampler = new Auto<DisposableSampler>(new DisposableSampler(gd.Api, device, sampler));
} }

View file

@ -64,7 +64,7 @@ namespace Ryujinx.Graphics.Vulkan
PCode = (uint*)pCode, PCode = (uint*)pCode,
}; };
api.CreateShaderModule(device, shaderModuleCreateInfo, null, out _module).ThrowOnError(); api.CreateShaderModule(device, in shaderModuleCreateInfo, null, out _module).ThrowOnError();
} }
CompileStatus = ProgramLinkStatus.Success; CompileStatus = ProgramLinkStatus.Success;

View file

@ -88,7 +88,7 @@ namespace Ryujinx.Graphics.Vulkan
DstOffsets = dstOffsets, DstOffsets = dstOffsets,
}; };
api.CmdBlitImage(commandBuffer, srcImage, ImageLayout.General, dstImage, ImageLayout.General, 1, region, filter); api.CmdBlitImage(commandBuffer, srcImage, ImageLayout.General, dstImage, ImageLayout.General, 1, in region, filter);
copySrcLevel++; copySrcLevel++;
copyDstLevel++; copyDstLevel++;
@ -320,13 +320,13 @@ namespace Ryujinx.Graphics.Vulkan
{ {
var region = new ImageResolve(srcSl, new Offset3D(0, 0, srcZ), dstSl, new Offset3D(0, 0, dstZ), extent); var region = new ImageResolve(srcSl, new Offset3D(0, 0, srcZ), dstSl, new Offset3D(0, 0, dstZ), extent);
api.CmdResolveImage(commandBuffer, srcImage, ImageLayout.General, dstImage, ImageLayout.General, 1, region); api.CmdResolveImage(commandBuffer, srcImage, ImageLayout.General, dstImage, ImageLayout.General, 1, in region);
} }
else else
{ {
var region = new ImageCopy(srcSl, new Offset3D(0, 0, srcZ), dstSl, new Offset3D(0, 0, dstZ), extent); var region = new ImageCopy(srcSl, new Offset3D(0, 0, srcZ), dstSl, new Offset3D(0, 0, dstZ), extent);
api.CmdCopyImage(commandBuffer, srcImage, ImageLayout.General, dstImage, ImageLayout.General, 1, region); api.CmdCopyImage(commandBuffer, srcImage, ImageLayout.General, dstImage, ImageLayout.General, 1, in region);
} }
width = Math.Max(1, width >> 1); width = Math.Max(1, width >> 1);
@ -422,7 +422,7 @@ namespace Ryujinx.Graphics.Vulkan
DependencyCount = 1, DependencyCount = 1,
}; };
gd.Api.CreateRenderPass2(device, renderPassCreateInfo, null, out var renderPass).ThrowOnError(); gd.Api.CreateRenderPass2(device, in renderPassCreateInfo, null, out var renderPass).ThrowOnError();
using var rp = new Auto<DisposableRenderPass>(new DisposableRenderPass(gd.Api, device, renderPass)); using var rp = new Auto<DisposableRenderPass>(new DisposableRenderPass(gd.Api, device, renderPass));
@ -445,7 +445,7 @@ namespace Ryujinx.Graphics.Vulkan
Layers = (uint)src.Layers, Layers = (uint)src.Layers,
}; };
gd.Api.CreateFramebuffer(device, framebufferCreateInfo, null, out var framebuffer).ThrowOnError(); gd.Api.CreateFramebuffer(device, in framebufferCreateInfo, null, out var framebuffer).ThrowOnError();
using var fb = new Auto<DisposableFramebuffer>(new DisposableFramebuffer(gd.Api, device, framebuffer), null, srcView, dstView); using var fb = new Auto<DisposableFramebuffer>(new DisposableFramebuffer(gd.Api, device, framebuffer), null, srcView, dstView);
var renderArea = new Rect2D(null, new Extent2D((uint)src.Info.Width, (uint)src.Info.Height)); var renderArea = new Rect2D(null, new Extent2D((uint)src.Info.Width, (uint)src.Info.Height));
@ -465,7 +465,7 @@ namespace Ryujinx.Graphics.Vulkan
// to resolve the depth-stencil texture. // to resolve the depth-stencil texture.
// TODO: Do speculative resolve and part of the same render pass as the draw to avoid // TODO: Do speculative resolve and part of the same render pass as the draw to avoid
// ending the current render pass? // ending the current render pass?
gd.Api.CmdBeginRenderPass(cbs.CommandBuffer, renderPassBeginInfo, SubpassContents.Inline); gd.Api.CmdBeginRenderPass(cbs.CommandBuffer, in renderPassBeginInfo, SubpassContents.Inline);
gd.Api.CmdEndRenderPass(cbs.CommandBuffer); gd.Api.CmdEndRenderPass(cbs.CommandBuffer);
} }
} }

View file

@ -114,7 +114,7 @@ namespace Ryujinx.Graphics.Vulkan
Flags = flags, Flags = flags,
}; };
gd.Api.CreateImage(device, imageCreateInfo, null, out _image).ThrowOnError(); gd.Api.CreateImage(device, in imageCreateInfo, null, out _image).ThrowOnError();
if (foreignAllocation == null) if (foreignAllocation == null)
{ {
@ -284,7 +284,7 @@ namespace Ryujinx.Graphics.Vulkan
0, 0,
null, null,
1, 1,
barrier); in barrier);
if (useTempCbs) if (useTempCbs)
{ {
@ -401,11 +401,11 @@ namespace Ryujinx.Graphics.Vulkan
if (to) if (to)
{ {
_gd.Api.CmdCopyImageToBuffer(commandBuffer, image, ImageLayout.General, buffer, 1, region); _gd.Api.CmdCopyImageToBuffer(commandBuffer, image, ImageLayout.General, buffer, 1, in region);
} }
else else
{ {
_gd.Api.CmdCopyBufferToImage(commandBuffer, buffer, image, ImageLayout.General, 1, region); _gd.Api.CmdCopyBufferToImage(commandBuffer, buffer, image, ImageLayout.General, 1, in region);
} }
offset += mipSize; offset += mipSize;

View file

@ -117,7 +117,7 @@ namespace Ryujinx.Graphics.Vulkan
PNext = &imageViewUsage, PNext = &imageViewUsage,
}; };
gd.Api.CreateImageView(device, imageCreateInfo, null, out var imageView).ThrowOnError(); gd.Api.CreateImageView(device, in imageCreateInfo, null, out var imageView).ThrowOnError();
return new Auto<DisposableImageView>(new DisposableImageView(gd.Api, device, imageView), null, storage.GetImage()); return new Auto<DisposableImageView>(new DisposableImageView(gd.Api, device, imageView), null, storage.GetImage());
} }
@ -492,7 +492,7 @@ namespace Ryujinx.Graphics.Vulkan
dstStageMask, dstStageMask,
DependencyFlags.None, DependencyFlags.None,
1, 1,
memoryBarrier, in memoryBarrier,
0, 0,
null, null,
0, 0,
@ -557,7 +557,7 @@ namespace Ryujinx.Graphics.Vulkan
0, 0,
null, null,
1, 1,
memoryBarrier); in memoryBarrier);
} }
public TextureView GetView(Format format) public TextureView GetView(Format format)
@ -949,11 +949,11 @@ namespace Ryujinx.Graphics.Vulkan
if (to) if (to)
{ {
_gd.Api.CmdCopyImageToBuffer(commandBuffer, image, ImageLayout.General, buffer, 1, region); _gd.Api.CmdCopyImageToBuffer(commandBuffer, image, ImageLayout.General, buffer, 1, in region);
} }
else else
{ {
_gd.Api.CmdCopyBufferToImage(commandBuffer, buffer, image, ImageLayout.General, 1, region); _gd.Api.CmdCopyBufferToImage(commandBuffer, buffer, image, ImageLayout.General, 1, in region);
} }
offset += mipSize; offset += mipSize;
@ -1010,11 +1010,11 @@ namespace Ryujinx.Graphics.Vulkan
if (to) if (to)
{ {
_gd.Api.CmdCopyImageToBuffer(commandBuffer, image, ImageLayout.General, buffer, 1, region); _gd.Api.CmdCopyImageToBuffer(commandBuffer, image, ImageLayout.General, buffer, 1, in region);
} }
else else
{ {
_gd.Api.CmdCopyBufferToImage(commandBuffer, buffer, image, ImageLayout.General, 1, region); _gd.Api.CmdCopyBufferToImage(commandBuffer, buffer, image, ImageLayout.General, 1, in region);
} }
} }

View file

@ -90,11 +90,9 @@ namespace Ryujinx.Graphics.Vulkan
DriverId.SamsungProprietary => "Samsung", DriverId.SamsungProprietary => "Samsung",
DriverId.MesaVenus => "Venus", DriverId.MesaVenus => "Venus",
DriverId.MesaDozen => "Dozen", DriverId.MesaDozen => "Dozen",
DriverId.MesaNvk => "NVK",
// TODO: Use real enum when we have an up to date Silk.NET. DriverId.ImaginationOpenSourceMesa => "Imagination (Open)",
(DriverId)24 => "NVK", DriverId.MesaAgxv => "Honeykrisp",
(DriverId)25 => "Imagination (Open)",
(DriverId)26 => "Honeykrisp",
_ => id.ToString(), _ => id.ToString(),
}; };
} }

View file

@ -160,7 +160,7 @@ namespace Ryujinx.Graphics.Vulkan
SwizzleComponent.Blue, SwizzleComponent.Blue,
SwizzleComponent.Alpha); SwizzleComponent.Alpha);
_gd.SwapchainApi.CreateSwapchain(_device, swapchainCreateInfo, null, out _swapchain).ThrowOnError(); _gd.SwapchainApi.CreateSwapchain(_device, in swapchainCreateInfo, null, out _swapchain).ThrowOnError();
_gd.SwapchainApi.GetSwapchainImages(_device, _swapchain, &imageCount, null); _gd.SwapchainApi.GetSwapchainImages(_device, _swapchain, &imageCount, null);
@ -187,14 +187,14 @@ namespace Ryujinx.Graphics.Vulkan
for (int i = 0; i < _imageAvailableSemaphores.Length; i++) for (int i = 0; i < _imageAvailableSemaphores.Length; i++)
{ {
_gd.Api.CreateSemaphore(_device, semaphoreCreateInfo, null, out _imageAvailableSemaphores[i]).ThrowOnError(); _gd.Api.CreateSemaphore(_device, in semaphoreCreateInfo, null, out _imageAvailableSemaphores[i]).ThrowOnError();
} }
_renderFinishedSemaphores = new Semaphore[imageCount]; _renderFinishedSemaphores = new Semaphore[imageCount];
for (int i = 0; i < _renderFinishedSemaphores.Length; i++) for (int i = 0; i < _renderFinishedSemaphores.Length; i++)
{ {
_gd.Api.CreateSemaphore(_device, semaphoreCreateInfo, null, out _renderFinishedSemaphores[i]).ThrowOnError(); _gd.Api.CreateSemaphore(_device, in semaphoreCreateInfo, null, out _renderFinishedSemaphores[i]).ThrowOnError();
} }
} }
@ -220,7 +220,7 @@ namespace Ryujinx.Graphics.Vulkan
SubresourceRange = subresourceRange, SubresourceRange = subresourceRange,
}; };
_gd.Api.CreateImageView(_device, imageCreateInfo, null, out var imageView).ThrowOnError(); _gd.Api.CreateImageView(_device, in imageCreateInfo, null, out var imageView).ThrowOnError();
return new TextureView(_gd, _device, new DisposableImageView(_gd.Api, _device, imageView), info, format); return new TextureView(_gd, _device, new DisposableImageView(_gd.Api, _device, imageView), info, format);
} }
@ -479,7 +479,7 @@ namespace Ryujinx.Graphics.Vulkan
lock (_gd.QueueLock) lock (_gd.QueueLock)
{ {
_gd.SwapchainApi.QueuePresent(_gd.Queue, presentInfo); _gd.SwapchainApi.QueuePresent(_gd.Queue, in presentInfo);
} }
} }
@ -611,7 +611,7 @@ namespace Ryujinx.Graphics.Vulkan
0, 0,
null, null,
1, 1,
barrier); in barrier);
} }
private void CaptureFrame(TextureView texture, int x, int y, int width, int height, bool isBgra, bool flipX, bool flipY) private void CaptureFrame(TextureView texture, int x, int y, int width, int height, bool isBgra, bool flipX, bool flipY)

View file

@ -4,6 +4,7 @@ using Ryujinx.Common.Configuration;
using Ryujinx.Common.GraphicsDriver; using Ryujinx.Common.GraphicsDriver;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Common.SystemInterop; using Ryujinx.Common.SystemInterop;
using Ryujinx.Graphics.Vulkan.MoltenVK;
using Ryujinx.Modules; using Ryujinx.Modules;
using Ryujinx.SDL2.Common; using Ryujinx.SDL2.Common;
using Ryujinx.UI; using Ryujinx.UI;
@ -110,6 +111,8 @@ namespace Ryujinx
if (OperatingSystem.IsMacOS()) if (OperatingSystem.IsMacOS())
{ {
MVKInitialization.InitializeResolver();
string baseDirectory = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); string baseDirectory = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
string resourcesDataDir; string resourcesDataDir;

View file

@ -18,6 +18,7 @@ using Ryujinx.Graphics.Gpu;
using Ryujinx.Graphics.Gpu.Shader; using Ryujinx.Graphics.Gpu.Shader;
using Ryujinx.Graphics.OpenGL; using Ryujinx.Graphics.OpenGL;
using Ryujinx.Graphics.Vulkan; using Ryujinx.Graphics.Vulkan;
using Ryujinx.Graphics.Vulkan.MoltenVK;
using Ryujinx.Headless.SDL2.OpenGL; using Ryujinx.Headless.SDL2.OpenGL;
using Ryujinx.Headless.SDL2.Vulkan; using Ryujinx.Headless.SDL2.Vulkan;
using Ryujinx.HLE; using Ryujinx.HLE;
@ -88,6 +89,11 @@ namespace Ryujinx.Headless.SDL2
}; };
} }
if (OperatingSystem.IsMacOS())
{
MVKInitialization.InitializeResolver();
}
Parser.Default.ParseArguments<Options>(args) Parser.Default.ParseArguments<Options>(args)
.WithParsed(Load) .WithParsed(Load)
.WithNotParsed(errors => errors.Output()); .WithNotParsed(errors => errors.Output());

View file

@ -7,6 +7,7 @@ using Ryujinx.Common.Configuration;
using Ryujinx.Common.GraphicsDriver; using Ryujinx.Common.GraphicsDriver;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Common.SystemInterop; using Ryujinx.Common.SystemInterop;
using Ryujinx.Graphics.Vulkan.MoltenVK;
using Ryujinx.Modules; using Ryujinx.Modules;
using Ryujinx.SDL2.Common; using Ryujinx.SDL2.Common;
using Ryujinx.UI.Common; using Ryujinx.UI.Common;
@ -80,6 +81,11 @@ namespace Ryujinx.Ava
// Parse arguments // Parse arguments
CommandLineState.ParseArguments(args); CommandLineState.ParseArguments(args);
if (OperatingSystem.IsMacOS())
{
MVKInitialization.InitializeResolver();
}
// Delete backup files after updating. // Delete backup files after updating.
Task.Run(Updater.CleanupUpdate); Task.Run(Updater.CleanupUpdate);