glfw: improve compatibility with self-hosted compiler

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-08-20 10:35:03 -07:00
parent f4d9c0d171
commit eaf60a33d2

View file

@ -34,7 +34,10 @@ pub fn initVulkanLoader(loader_function: ?VKGetInstanceProcAddr) void {
c.glfwInitVulkanLoader(loader_function orelse null);
}
pub const VKGetInstanceProcAddr = fn (vk_instance: c.VkInstance, name: [*c]const u8) callconv(.C) ?VKProc;
pub const VKGetInstanceProcAddr = if (@import("builtin").zig_backend == .stage1)
fn (vk_instance: c.VkInstance, name: [*c]const u8) callconv(.C) ?VKProc
else
*const fn (vk_instance: c.VkInstance, name: [*c]const u8) callconv(.C) ?VKProc;
/// Returns whether the Vulkan loader and an ICD have been found.
///
@ -103,7 +106,10 @@ pub inline fn getRequiredInstanceExtensions() error{APIUnavailable}![][*:0]const
/// Generic function pointer used for returning Vulkan API function pointers.
///
/// see also: vulkan_proc, glfw.getInstanceProcAddress
pub const VKProc = fn () callconv(.C) void;
pub const VKProc = if (@import("builtin").zig_backend == .stage1)
fn () callconv(.C) void
else
*const fn () callconv(.C) void;
/// Returns the address of the specified Vulkan instance function.
///