Use a slightly more correct calling convention for OpenGL/Vulkan procs

This commit is contained in:
Carl Åstholm 2024-02-10 23:08:44 +01:00 committed by Stephen Gutekanst
parent 63da35e57c
commit c5180a0b52
2 changed files with 4 additions and 3 deletions

View file

@ -1,4 +1,5 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin");
const c = @import("c.zig").c; const c = @import("c.zig").c;
const Window = @import("Window.zig"); const Window = @import("Window.zig");
@ -122,13 +123,12 @@ pub inline fn extensionSupported(extension: [:0]const u8) bool {
return c.glfwExtensionSupported(extension.ptr) == c.GLFW_TRUE; return c.glfwExtensionSupported(extension.ptr) == c.GLFW_TRUE;
} }
const builtin = @import("builtin");
/// Client API function pointer type. /// Client API function pointer type.
/// ///
/// Generic function pointer used for returning client API function pointers. /// Generic function pointer used for returning client API function pointers.
/// ///
/// see also: context_glext, glfwGetProcAddress /// see also: context_glext, glfwGetProcAddress
pub const GLProc = *const fn () callconv(.C) void; pub const GLProc = *const fn () callconv(if (builtin.os.tag == .windows and builtin.cpu.arch == .x86) .Stdcall else .C) void;
/// Returns the address of the specified function for the current context. /// Returns the address of the specified function for the current context.
/// ///

View file

@ -1,4 +1,5 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin");
const c = @import("c.zig").c; const c = @import("c.zig").c;
const Window = @import("Window.zig"); const Window = @import("Window.zig");
@ -93,7 +94,7 @@ pub inline fn getRequiredInstanceExtensions() ?[][*:0]const u8 {
/// Generic function pointer used for returning Vulkan API function pointers. /// Generic function pointer used for returning Vulkan API function pointers.
/// ///
/// see also: vulkan_proc, glfw.getInstanceProcAddress /// see also: vulkan_proc, glfw.getInstanceProcAddress
pub const VKProc = *const fn () callconv(.C) void; pub const VKProc = *const fn () callconv(if (builtin.os.tag == .windows and builtin.cpu.arch == .x86) .Stdcall else .C) void;
/// Returns the address of the specified Vulkan instance function. /// Returns the address of the specified Vulkan instance function.
/// ///