Skip to content

Commit

Permalink
[Vulkan] Only run the "IsSupported" check once.
Browse files Browse the repository at this point in the history
  • Loading branch information
mellinoe committed Mar 20, 2018
1 parent fa044e2 commit 0058c68
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Veldrid/Vk/VulkanUtil.cs
Expand Up @@ -7,6 +7,7 @@ namespace Veldrid.Vk
{
internal unsafe static class VulkanUtil
{
private static Lazy<bool> s_isVulkanLoaded = new Lazy<bool>(TryLoadVulkan);
private static readonly Lazy<string[]> s_instanceExtensions = new Lazy<string[]>(EnumerateInstanceExtensions);

[Conditional("DEBUG")]
Expand Down Expand Up @@ -134,7 +135,8 @@ private static string[] EnumerateInstanceExtensions()
return ret;
}

public static bool IsVulkanLoaded()
public static bool IsVulkanLoaded() => s_isVulkanLoaded.Value;
private static bool TryLoadVulkan()
{
try
{
Expand Down

0 comments on commit 0058c68

Please sign in to comment.