Skip to content

Commit

Permalink
Use a slightly more correct calling convention for OpenGL/Vulkan procs
Browse files Browse the repository at this point in the history
  • Loading branch information
castholm authored and slimsag committed Mar 2, 2024
1 parent 63da35e commit c5180a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/opengl.zig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const std = @import("std");
const builtin = @import("builtin");

const c = @import("c.zig").c;
const Window = @import("Window.zig");
Expand Down Expand Up @@ -122,13 +123,12 @@ pub inline fn extensionSupported(extension: [:0]const u8) bool {
return c.glfwExtensionSupported(extension.ptr) == c.GLFW_TRUE;
}

const builtin = @import("builtin");
/// Client API function pointer type.
///
/// Generic function pointer used for returning client API function pointers.
///
/// 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.
///
Expand Down
3 changes: 2 additions & 1 deletion src/vulkan.zig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const std = @import("std");
const builtin = @import("builtin");

const c = @import("c.zig").c;
const Window = @import("Window.zig");
Expand Down Expand Up @@ -93,7 +94,7 @@ pub inline fn getRequiredInstanceExtensions() ?[][*:0]const u8 {
/// Generic function pointer used for returning Vulkan API function pointers.
///
/// 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.
///
Expand Down

0 comments on commit c5180a0

Please sign in to comment.