glfw: add glfw.vulkanSupported
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
ad7d6b405d
commit
fa25ebf037
1 changed files with 30 additions and 20 deletions
|
@ -6,26 +6,28 @@ const getError = @import("errors.zig").getError;
|
||||||
|
|
||||||
// TODO(vulkan):
|
// TODO(vulkan):
|
||||||
|
|
||||||
// /// Returns whether the Vulkan loader and an ICD have been found.
|
/// Returns whether the Vulkan loader and an ICD have been found.
|
||||||
// ///
|
///
|
||||||
// /// This function returns whether the Vulkan loader and any minimally functional ICD have been
|
/// This function returns whether the Vulkan loader and any minimally functional ICD have been
|
||||||
// /// found.
|
/// found.
|
||||||
// ///
|
///
|
||||||
// /// The availability of a Vulkan loader and even an ICD does not by itself guarantee that surface
|
/// The availability of a Vulkan loader and even an ICD does not by itself guarantee that surface
|
||||||
// /// creation or even instance creation is possible. For example, on Fermi systems Nvidia will
|
/// creation or even instance creation is possible. For example, on Fermi systems Nvidia will
|
||||||
// /// install an ICD that provides no actual Vulkan support. Call glfw.getRequiredInstanceExtensions
|
/// install an ICD that provides no actual Vulkan support. Call glfw.getRequiredInstanceExtensions
|
||||||
// /// to check whether the extensions necessary for Vulkan surface creation are available and
|
/// to check whether the extensions necessary for Vulkan surface creation are available and
|
||||||
// /// glfw.getPhysicalDevicePresentationSupport to check whether a queue family of a physical device
|
/// glfw.getPhysicalDevicePresentationSupport to check whether a queue family of a physical device
|
||||||
// /// supports image presentation.
|
/// supports image presentation.
|
||||||
// ///
|
///
|
||||||
// /// @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE` otherwise.
|
/// @return `true` if Vulkan is minimally available, or `false` otherwise.
|
||||||
// ///
|
///
|
||||||
// /// Possible errors include glfw.Error.NotInitialized.
|
/// Possible errors include glfw.Error.NotInitialized.
|
||||||
// ///
|
///
|
||||||
// /// @thread_safety This function may be called from any thread.
|
/// @thread_safety This function may be called from any thread.
|
||||||
// ///
|
pub inline fn vulkanSupported() Error!bool {
|
||||||
// /// see also: vulkan_support
|
const supported = c.glfwVulkanSupported();
|
||||||
// GLFWAPI int glfwVulkanSupported(void);
|
try getError();
|
||||||
|
return supported == c.GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// /// Returns the Vulkan instance extensions required by GLFW.
|
// /// Returns the Vulkan instance extensions required by GLFW.
|
||||||
// ///
|
// ///
|
||||||
|
@ -181,6 +183,14 @@ pub inline fn getInstanceProcAddress(vk_instance: ?*opaque {}, proc_name: [*c]co
|
||||||
// /// see also: vulkan_surface, glfw.getRequiredInstanceExtensions
|
// /// see also: vulkan_surface, glfw.getRequiredInstanceExtensions
|
||||||
// GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
// GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||||
|
|
||||||
|
test "vulkanSupported" {
|
||||||
|
const glfw = @import("main.zig");
|
||||||
|
try glfw.init();
|
||||||
|
defer glfw.terminate();
|
||||||
|
|
||||||
|
_ = try glfw.vulkanSupported();
|
||||||
|
}
|
||||||
|
|
||||||
test "getInstanceProcAddress" {
|
test "getInstanceProcAddress" {
|
||||||
const glfw = @import("main.zig");
|
const glfw = @import("main.zig");
|
||||||
try glfw.init();
|
try glfw.init();
|
||||||
|
|
Loading…
Add table
Reference in a new issue