-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
685d45b
commit 1c215f0
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Security; | ||
using SFML.System; | ||
|
||
namespace SFML.Window | ||
{ | ||
/// <summary>Vulkan helper functions</summary> | ||
public static class Vulkan | ||
{ | ||
//////////////////////////////////////////////////////////// | ||
/// <summary> | ||
/// Tell whether or not the system supports Vulkan | ||
/// | ||
/// This function should always be called before using | ||
/// the Vulkan features. If it returns false, then | ||
/// any attempt to use Vulkan will fail. | ||
/// | ||
/// If only compute is required, set <paramref name="requireGraphics"/> | ||
/// to false to skip checking for the extensions necessary | ||
/// for graphics rendering. | ||
/// </summary> | ||
/// <param name="requireGraphics"> True to skip checking for graphics extensions, false otherwise </param> | ||
/// <returns>True if Vulkan is supported, false otherwise</returns> | ||
//////////////////////////////////////////////////////////// | ||
public static bool IsAvailable(bool requireGraphics = true) => sfVulkan_isAvailable(requireGraphics); | ||
|
||
//////////////////////////////////////////////////////////// | ||
/// <summary> | ||
/// Get the address of a Vulkan function | ||
/// </summary> | ||
/// <param name="name"> Name of the function to get the address of </param> | ||
/// <returns>Address of the Vulkan function, <see cref="IntPtr.Zero"/> on failure</returns> | ||
//////////////////////////////////////////////////////////// | ||
public static IntPtr GetFunction(string name) => sfVulkan_getFunction(name); | ||
|
||
// TODO: Implement GetGraphicsRequiredInstanceExtensions | ||
|
||
#region Imports | ||
[DllImport(CSFML.window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
private static extern bool sfVulkan_isAvailable(bool requireGraphics); | ||
|
||
[DllImport(CSFML.window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
private static extern IntPtr sfVulkan_getFunction(string name); | ||
|
||
// TODO: Import sfVulkan_getGraphicsRequiredInstanceExtensions | ||
#endregion | ||
} | ||
} |