From 9d29563d3bcfa35498859aab891849f5d65ac5a0 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sat, 20 Aug 2022 10:35:03 -0700 Subject: [PATCH] glfw: improve compatibility with self-hosted compiler Signed-off-by: Stephen Gutekanst --- glfw/src/vulkan.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/glfw/src/vulkan.zig b/glfw/src/vulkan.zig index f921f483..4b59bfda 100644 --- a/glfw/src/vulkan.zig +++ b/glfw/src/vulkan.zig @@ -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. ///