diff --git a/src/ComputeSharp/Properties/Configuration.cs b/src/ComputeSharp/Properties/Configuration.cs index ce7ee04a..b049068f 100644 --- a/src/ComputeSharp/Properties/Configuration.cs +++ b/src/ComputeSharp/Properties/Configuration.cs @@ -2,6 +2,7 @@ using System; #if DEBUG using System.Diagnostics; #endif +using System.Runtime.CompilerServices; /// /// A container for all shared configuration switches for ComputeSharp. @@ -11,32 +12,59 @@ internal static class Configuration /// /// The configuration property name for . /// - private const string EnableDebugOutput = "COMPUTESHARP_ENABLE_DEBUG_OUTPUT"; + private const string IsDebugOutputEnabledPropertyName = "COMPUTESHARP_ENABLE_DEBUG_OUTPUT"; /// /// The configuration property name for . /// - private const string EnableDeviceRemovedExtendedDataInfo = "COMPUTESHARP_ENABLE_DEVICE_REMOVED_EXTENDED_DATA"; + private const string IsDeviceRemovedExtendedDataEnabledPropertyName = "COMPUTESHARP_ENABLE_DEVICE_REMOVED_EXTENDED_DATA"; /// /// The configuration property name for . /// - private const string DisableGpuTimeout = "COMPUTESHARP_DISABLE_GPU_TIMEOUT"; + private const string IsGpuTimeoutDisabledPropertyName = "COMPUTESHARP_DISABLE_GPU_TIMEOUT"; /// - /// Indicates whether or not the debug output is enabled (defaults to ). + /// The backing field for . /// - public static readonly bool IsDebugOutputEnabled = GetConfigurationValue(EnableDebugOutput); + private static readonly bool IsDebugOutputEnabledConfigurationValue = GetConfigurationValue(IsDebugOutputEnabledPropertyName); /// - /// Indicates whether or not the debug output is enabled (defaults to ). + /// The backing field for . /// - public static readonly bool IsDeviceRemovedExtendedDataEnabled = GetConfigurationValue(EnableDeviceRemovedExtendedDataInfo); + private static readonly bool IsDeviceRemovedExtendedDataEnabledConfigurationValue = GetConfigurationValue(IsDeviceRemovedExtendedDataEnabledPropertyName); /// - /// Indicates whether or not the GPU timeout is disabled (defaults to ). + /// The backing field for . /// - public static readonly bool IsGpuTimeoutDisabled = GetConfigurationValue(DisableGpuTimeout); + private static readonly bool IsGpuTimeoutDisabledConfigurationValue = GetConfigurationValue(IsGpuTimeoutDisabledPropertyName); + + /// + /// Gets a value indicating whether or not the debug output is enabled (defaults to ). + /// + public static bool IsDebugOutputEnabled + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => IsDebugOutputEnabledConfigurationValue; + } + + /// + /// Gets a value indicating whether or not the debug output is enabled (defaults to ). + /// + public static bool IsDeviceRemovedExtendedDataEnabled + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => IsDeviceRemovedExtendedDataEnabledConfigurationValue; + } + + /// + /// Gets a value indicating whether or not the GPU timeout is disabled (defaults to ). + /// + public static bool IsGpuTimeoutDisabled + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => IsGpuTimeoutDisabledConfigurationValue; + } /// /// Gets a configuration value for a specified property. @@ -46,7 +74,7 @@ internal static class Configuration private static bool GetConfigurationValue(string propertyName) { #if DEBUG - if (Debugger.IsAttached && propertyName != DisableGpuTimeout) + if (Debugger.IsAttached && propertyName != IsGpuTimeoutDisabledPropertyName) { return true; } diff --git a/src/ComputeSharp/Properties/ILLink.Substitutions.xml b/src/ComputeSharp/Properties/ILLink.Substitutions.xml index 73ac251b..a57a24bc 100644 --- a/src/ComputeSharp/Properties/ILLink.Substitutions.xml +++ b/src/ComputeSharp/Properties/ILLink.Substitutions.xml @@ -3,26 +3,26 @@ - + - + - + - + - + - + \ No newline at end of file