/ src / Ryujinx.Graphics.Vulkan / MoltenVK / MVKConfiguration.cs
MVKConfiguration.cs
  1  using System;
  2  using System.Runtime.InteropServices;
  3  
  4  namespace Ryujinx.Graphics.Vulkan.MoltenVK
  5  {
  6      enum MVKConfigLogLevel
  7      {
  8          None = 0,
  9          Error = 1,
 10          Warning = 2,
 11          Info = 3,
 12          Debug = 4,
 13      }
 14  
 15      enum MVKConfigTraceVulkanCalls
 16      {
 17          None = 0,
 18          Enter = 1,
 19          EnterExit = 2,
 20          Duration = 3,
 21      }
 22  
 23      enum MVKConfigAutoGPUCaptureScope
 24      {
 25          None = 0,
 26          Device = 1,
 27          Frame = 2,
 28      }
 29  
 30      [Flags]
 31      enum MVKConfigAdvertiseExtensions
 32      {
 33          All = 0x00000001,
 34          MoltenVK = 0x00000002,
 35          WSI = 0x00000004,
 36          Portability = 0x00000008,
 37      }
 38  
 39      enum MVKVkSemaphoreSupportStyle
 40      {
 41          MVK_CONFIG_VK_SEMAPHORE_SUPPORT_STYLE_SINGLE_QUEUE = 0,
 42          MVK_CONFIG_VK_SEMAPHORE_SUPPORT_STYLE_METAL_EVENTS_WHERE_SAFE = 1,
 43          MVK_CONFIG_VK_SEMAPHORE_SUPPORT_STYLE_METAL_EVENTS = 2,
 44          MVK_CONFIG_VK_SEMAPHORE_SUPPORT_STYLE_CALLBACK = 3,
 45          MVK_CONFIG_VK_SEMAPHORE_SUPPORT_STYLE_MAX_ENUM = 0x7FFFFFFF,
 46      }
 47  
 48      readonly struct Bool32
 49      {
 50          uint Value { get; }
 51  
 52          public Bool32(uint value)
 53          {
 54              Value = value;
 55          }
 56  
 57          public Bool32(bool value)
 58          {
 59              Value = value ? 1u : 0u;
 60          }
 61  
 62          public static implicit operator bool(Bool32 val) => val.Value == 1;
 63          public static implicit operator Bool32(bool val) => new(val);
 64      }
 65  
 66      [StructLayout(LayoutKind.Sequential)]
 67      struct MVKConfiguration
 68      {
 69          public Bool32 DebugMode;
 70          public Bool32 ShaderConversionFlipVertexY;
 71          public Bool32 SynchronousQueueSubmits;
 72          public Bool32 PrefillMetalCommandBuffers;
 73          public uint MaxActiveMetalCommandBuffersPerQueue;
 74          public Bool32 SupportLargeQueryPools;
 75          public Bool32 PresentWithCommandBuffer;
 76          public Bool32 SwapchainMagFilterUseNearest;
 77          public ulong MetalCompileTimeout;
 78          public Bool32 PerformanceTracking;
 79          public uint PerformanceLoggingFrameCount;
 80          public Bool32 DisplayWatermark;
 81          public Bool32 SpecializedQueueFamilies;
 82          public Bool32 SwitchSystemGPU;
 83          public Bool32 FullImageViewSwizzle;
 84          public uint DefaultGPUCaptureScopeQueueFamilyIndex;
 85          public uint DefaultGPUCaptureScopeQueueIndex;
 86          public Bool32 FastMathEnabled;
 87          public MVKConfigLogLevel LogLevel;
 88          public MVKConfigTraceVulkanCalls TraceVulkanCalls;
 89          public Bool32 ForceLowPowerGPU;
 90          public Bool32 SemaphoreUseMTLFence;
 91          public MVKVkSemaphoreSupportStyle SemaphoreSupportStyle;
 92          public MVKConfigAutoGPUCaptureScope AutoGPUCaptureScope;
 93          public IntPtr AutoGPUCaptureOutputFilepath;
 94          public Bool32 Texture1DAs2D;
 95          public Bool32 PreallocateDescriptors;
 96          public Bool32 UseCommandPooling;
 97          public Bool32 UseMTLHeap;
 98          public Bool32 LogActivityPerformanceInline;
 99          public uint ApiVersionToAdvertise;
100          public MVKConfigAdvertiseExtensions AdvertiseExtensions;
101          public Bool32 ResumeLostDevice;
102          public Bool32 UseMetalArgumentBuffers;
103      }
104  }