Minor code tweaks

このコミットが含まれているのは:
Sergio Pedri committed 2019-09-23 19:39:49 +02:00
1 親 8d9f444a75
コミット f92309a498
3ファイル変更
+9 -7

検索条件に一致するファイルはありません

+1 -1
ファイルの表示
@@ -24,7 +24,7 @@ namespace ComputeSharp.Shaders.Mappings
"unsigned", "vector", "vertexfragment", "zero"
};
private static Regex _KeywordsRegex;
private static Regex? _KeywordsRegex;
/// <summary>
/// The <see cref="Regex"/> to use to match variable names
+1 -1
ファイルの表示
@@ -13,7 +13,7 @@ namespace ComputeSharp.Shaders.Mappings
/// </summary>
internal static class HlslKnownMethods
{
private static IReadOnlyDictionary<string, string> _KnownMethods;
private static IReadOnlyDictionary<string, string>? _KnownMethods;
/// <summary>
/// The mapping of supported known methods to HLSL methods
+7 -5
ファイルの表示
@@ -14,12 +14,17 @@ namespace ComputeSharp
/// </summary>
public static class Gpu
{
/// <summary>
/// The loaded collection of supported devices and descriptions
/// </summary>
private static IReadOnlyList<(ID3D12Device Device, AdapterDescription Description)>? _Devices;
/// <summary>
/// Gets whether or not the <see cref="Gpu"/> APIs can be used on the current machine (ie. if there is at least a supported GPU device)
/// </summary>
public static bool IsSupported { get; } = (_Devices = DeviceHelper.QueryAllSupportedDevices()).Any();
private static GraphicsDevice _Default;
private static GraphicsDevice? _Default;
/// <summary>
/// Gets the default <see cref="GraphicsDevice"/> instance for the current machine
@@ -30,7 +35,7 @@ namespace ComputeSharp
{
if (!IsSupported) throw new NotSupportedException("There isn't a supported GPU device on the current machine");
return _Default ??= new GraphicsDevice(_Devices[0].Device, _Devices[0].Description);
return _Default ??= new GraphicsDevice(_Devices![0].Device, _Devices[0].Description);
}
}
@@ -40,8 +45,5 @@ namespace ComputeSharp
/// <returns>A sequence of supported <see cref="GraphicsDevice"/> objects that can be used to run compute shaders</returns>
[Pure]
public static IEnumerable<GraphicsDevice> EnumerateDevices() => _Devices.Select(device => new GraphicsDevice(device.Device, device.Description));
// The loaded collection of supported devices
private static IReadOnlyList<(ID3D12Device Device, AdapterDescription Description)> _Devices;
}
}