ryujinx_ryubing/src/Ryujinx.Graphics.Vulkan/Helpers.cs
GreemDev fa55608587
Some checks failed
Canary CI / Release for linux-arm64 (push) Has been cancelled
Canary CI / Release for linux-x64 (push) Has been cancelled
Canary CI / Release for win-x64 (push) Has been cancelled
Canary CI / Release MacOS universal (push) Has been cancelled
Canary CI / Create GitLab Release (push) Has been cancelled
RenderDoc API support (ryubing/ryujinx!242)
See merge request ryubing/ryujinx!242
2026-01-01 00:10:21 -06:00

32 lines
1.5 KiB
C#

using Silk.NET.Vulkan;
using System.Runtime.CompilerServices;
namespace Ryujinx.Graphics.Vulkan
{
public static class Helpers
{
extension(Vk api)
{
/// <summary>
/// C# implementation of the RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE macro from the RenderDoc API header, since we cannot use macros from C#.
/// </summary>
/// <returns>The dispatch table pointer, which sits as the first pointer-sized object in the memory pointed to by the <see cref="Vk"/>'s <see cref="Instance"/> pointer.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void* GetRenderDocDevicePointer() =>
api.CurrentInstance is not null
? api.CurrentInstance.Value.GetRenderDocDevicePointer()
: null;
}
extension(Instance instance)
{
/// <summary>
/// C# implementation of the RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE macro from the RenderDoc API header, since we cannot use macros from C#.
/// </summary>
/// <returns>The dispatch table pointer, which sits as the first pointer-sized object in the memory pointed to by the <see cref="Instance"/>'s pointer.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void* GetRenderDocDevicePointer()
=> (*((void**)(instance.Handle)));
}
}
}