glfw: replace isize, usize with i32, u32 where appropriate (#126)

Fixes hexops/mach#114
This commit is contained in:
Ali Chraghi 2021-12-14 19:50:14 +03:30 committed by GitHub
parent 8b5fdbc333
commit 595cf48450
Failed to generate hash of commit
8 changed files with 87 additions and 87 deletions

View file

@ -15,7 +15,7 @@ const Cursor = @This();
ptr: *c.GLFWcursor,
// Standard system cursor shapes.
pub const Shape = enum(isize) {
pub const Shape = enum(i32) {
/// The regular arrow cursor shape.
arrow = c.GLFW_ARROW_CURSOR,
@ -60,7 +60,7 @@ pub const Shape = enum(isize) {
/// @thread_safety This function must only be called from the main thread.
///
/// see also: cursor_object, glfw.Cursor.destroy, glfw.Cursor.createStandard
pub inline fn create(image: Image, xhot: isize, yhot: isize) error{PlatformError}!Cursor {
pub inline fn create(image: Image, xhot: i32, yhot: i32) error{PlatformError}!Cursor {
internal_debug.assertInitialized();
const img = image.toC();
const cursor = c.glfwCreateCursor(&img, @intCast(c_int, xhot), @intCast(c_int, yhot));

View file

@ -18,10 +18,10 @@ const c = @import("c.zig").c;
const Image = @This();
/// The width of this image, in pixels.
width: usize,
width: u32,
/// The height of this image, in pixels.
height: usize,
height: u32,
/// The pixel data of this image, arranged left-to-right, top-to-bottom.
pixels: []u8,
@ -30,7 +30,7 @@ pixels: []u8,
owned: bool,
/// Initializes a new owned image with the given size and pixel_data_len of undefined .pixel values.
pub inline fn init(allocator: mem.Allocator, width: usize, height: usize, pixel_data_len: usize) !Image {
pub inline fn init(allocator: mem.Allocator, width: u32, height: u32, pixel_data_len: usize) !Image {
const buf = try allocator.alloc(u8, pixel_data_len);
return Image{
.width = width,
@ -48,8 +48,8 @@ pub inline fn init(allocator: mem.Allocator, width: usize, height: usize, pixel_
/// The returned memory is valid for as long as the GLFW C memory is valid.
pub inline fn fromC(native: c.GLFWimage, pixel_data_len: usize) Image {
return Image{
.width = @intCast(usize, native.width),
.height = @intCast(usize, native.height),
.width = @intCast(u32, native.width),
.height = @intCast(u32, native.height),
.pixels = native.pixels[0..pixel_data_len],
.owned = false,
};

View file

@ -63,13 +63,13 @@ const GamepadState = extern struct {
/// Returns the state of the specified gamepad button.
pub fn getButton(self: @This(), which: GamepadButton) Action {
_ = self;
return @intToEnum(Action, self.buttons[@intCast(usize, @enumToInt(which))]);
return @intToEnum(Action, self.buttons[@intCast(u32, @enumToInt(which))]);
}
/// Returns the status of the specified gamepad axis, in the range -1.0 to 1.0 inclusive.
pub fn getAxis(self: @This(), which: GamepadAxis) f32 {
_ = self;
return self.axes[@intCast(usize, @enumToInt(which))];
return self.axes[@intCast(u32, @enumToInt(which))];
}
};
@ -130,7 +130,7 @@ pub inline fn getAxes(self: Joystick) error{PlatformError}!?[]const f32 {
else => unreachable,
};
if (axes == null) return null;
return axes[0..@intCast(usize, count)];
return axes[0..@intCast(u32, count)];
}
/// Returns the state of all buttons of the specified joystick.
@ -168,7 +168,7 @@ pub inline fn getButtons(self: Joystick) error{PlatformError}!?[]const u8 {
else => unreachable,
};
if (buttons == null) return null;
return buttons[0..@intCast(usize, count)];
return buttons[0..@intCast(u32, count)];
}
/// Returns the state of all hats of the specified joystick.
@ -222,7 +222,7 @@ pub inline fn getHats(self: Joystick) error{PlatformError}!?[]const Hat {
else => unreachable,
};
if (hats == null) return null;
const slice = hats[0..@intCast(usize, count)];
const slice = hats[0..@intCast(u32, count)];
return @ptrCast(*const []const Hat, &slice).*;
}

View file

@ -20,9 +20,9 @@ handle: *c.GLFWmonitor,
/// virtual screen.
const Pos = struct {
/// The x coordinate.
x: usize,
x: u32,
/// The y coordinate.
y: usize,
y: u32,
};
/// Returns the position of the monitor's viewport on the virtual screen.
@ -42,7 +42,7 @@ pub inline fn getPos(self: Monitor) error{PlatformError}!Pos {
Error.PlatformError => @errSetCast(error{PlatformError}, err),
else => unreachable,
};
return Pos{ .x = @intCast(usize, xpos), .y = @intCast(usize, ypos) };
return Pos{ .x = @intCast(u32, xpos), .y = @intCast(u32, ypos) };
}
/// The monitor workarea, in screen coordinates.
@ -52,10 +52,10 @@ pub inline fn getPos(self: Monitor) error{PlatformError}!Pos {
/// operating system task bar where present. If no task bar exists then the work area is the
/// monitor resolution in screen coordinates.
const Workarea = struct {
x: usize,
y: usize,
width: usize,
height: usize,
x: u32,
y: u32,
width: u32,
height: u32,
};
/// Retrieves the work area of the monitor.
@ -77,13 +77,13 @@ pub inline fn getWorkarea(self: Monitor) error{PlatformError}!Workarea {
Error.PlatformError => @errSetCast(error{PlatformError}, err),
else => unreachable,
};
return Workarea{ .x = @intCast(usize, xpos), .y = @intCast(usize, ypos), .width = @intCast(usize, width), .height = @intCast(usize, height) };
return Workarea{ .x = @intCast(u32, xpos), .y = @intCast(u32, ypos), .width = @intCast(u32, width), .height = @intCast(u32, height) };
}
/// The physical size, in millimetres, of the display area of a monitor.
const PhysicalSize = struct {
width_mm: usize,
height_mm: usize,
width_mm: u32,
height_mm: u32,
};
/// Returns the physical size of the monitor.
@ -109,7 +109,7 @@ pub inline fn getPhysicalSize(self: Monitor) PhysicalSize {
Error.NotInitialized => unreachable,
else => unreachable,
};
return PhysicalSize{ .width_mm = @intCast(usize, width_mm), .height_mm = @intCast(usize, height_mm) };
return PhysicalSize{ .width_mm = @intCast(u32, width_mm), .height_mm = @intCast(u32, height_mm) };
}
/// The content scale for a monitor.
@ -240,8 +240,8 @@ pub inline fn getVideoModes(self: Monitor, allocator: mem.Allocator) (mem.Alloca
else => unreachable,
};
const slice = try allocator.alloc(VideoMode, @intCast(usize, count));
var i: usize = 0;
const slice = try allocator.alloc(VideoMode, @intCast(u32, count));
var i: u32 = 0;
while (i < count) : (i += 1) {
slice[i] = VideoMode{ .handle = modes[i] };
}
@ -385,8 +385,8 @@ pub inline fn getAll(allocator: mem.Allocator) mem.Allocator.Error![]Monitor {
Error.NotInitialized => unreachable,
else => unreachable,
};
const slice = try allocator.alloc(Monitor, @intCast(usize, count));
var i: usize = 0;
const slice = try allocator.alloc(Monitor, @intCast(u32, count));
var i: u32 = 0;
while (i < count) : (i += 1) {
slice[i] = Monitor{ .handle = monitors[i].? };
}

View file

@ -10,33 +10,33 @@ const VideoMode = @This();
handle: c.GLFWvidmode,
/// Returns the width of the video mode, in screen coordinates.
pub inline fn getWidth(self: VideoMode) usize {
return @intCast(usize, self.handle.width);
pub inline fn getWidth(self: VideoMode) u32 {
return @intCast(u32, self.handle.width);
}
/// Returns the height of the video mode, in screen coordinates.
pub inline fn getHeight(self: VideoMode) usize {
return @intCast(usize, self.handle.height);
pub inline fn getHeight(self: VideoMode) u32 {
return @intCast(u32, self.handle.height);
}
/// Returns the bit depth of the red channel of the video mode.
pub inline fn getRedBits(self: VideoMode) usize {
return @intCast(usize, self.handle.redBits);
pub inline fn getRedBits(self: VideoMode) u32 {
return @intCast(u32, self.handle.redBits);
}
/// Returns the bit depth of the green channel of the video mode.
pub inline fn getGreenBits(self: VideoMode) usize {
return @intCast(usize, self.handle.greenBits);
pub inline fn getGreenBits(self: VideoMode) u32 {
return @intCast(u32, self.handle.greenBits);
}
/// Returns the bit depth of the blue channel of the video mode.
pub inline fn getBlueBits(self: VideoMode) usize {
return @intCast(usize, self.handle.blueBits);
pub inline fn getBlueBits(self: VideoMode) u32 {
return @intCast(u32, self.handle.blueBits);
}
/// Returns the refresh rate of the video mode, in Hz.
pub inline fn getRefreshRate(self: VideoMode) usize {
return @intCast(usize, self.handle.refreshRate);
pub inline fn getRefreshRate(self: VideoMode) u32 {
return @intCast(u32, self.handle.refreshRate);
}
test "getters" {

View file

@ -48,16 +48,16 @@ pub const InternalUserPointer = struct {
user_pointer: ?*c_void,
// Callbacks to be invoked by wrapper functions.
setPosCallback: ?fn (window: Window, xpos: isize, ypos: isize) void,
setSizeCallback: ?fn (window: Window, width: isize, height: isize) void,
setPosCallback: ?fn (window: Window, xpos: i32, ypos: i32) void,
setSizeCallback: ?fn (window: Window, width: i32, height: i32) void,
setCloseCallback: ?fn (window: Window) void,
setRefreshCallback: ?fn (window: Window) void,
setFocusCallback: ?fn (window: Window, focused: bool) void,
setIconifyCallback: ?fn (window: Window, iconified: bool) void,
setMaximizeCallback: ?fn (window: Window, maximized: bool) void,
setFramebufferSizeCallback: ?fn (window: Window, width: isize, height: isize) void,
setFramebufferSizeCallback: ?fn (window: Window, width: u32, height: u32) void,
setContentScaleCallback: ?fn (window: Window, xscale: f32, yscale: f32) void,
setKeyCallback: ?fn (window: Window, key: Key, scancode: isize, action: Action, mods: Mods) void,
setKeyCallback: ?fn (window: Window, key: Key, scancode: i32, action: Action, mods: Mods) void,
setCharCallback: ?fn (window: Window, codepoint: u21) void,
setMouseButtonCallback: ?fn (window: Window, button: MouseButton, action: Action, mods: Mods) void,
setCursorPosCallback: ?fn (window: Window, xpos: f64, ypos: f64) void,
@ -412,8 +412,8 @@ pub const Hints = struct {
///
/// see also: window_creation, glfw.Window.destroy
pub inline fn create(
width: usize,
height: usize,
width: u32,
height: u32,
title: [*:0]const u8,
monitor: ?Monitor,
share: ?Window,
@ -586,8 +586,8 @@ pub inline fn setIcon(self: Window, allocator: mem.Allocator, images: ?[]Image)
}
pub const Pos = struct {
x: usize,
y: usize,
x: u32,
y: u32,
};
/// Retrieves the position of the content area of the specified window.
@ -613,7 +613,7 @@ pub inline fn getPos(self: Window) error{PlatformError}!Pos {
Error.PlatformError => @errSetCast(error{PlatformError}, err),
else => unreachable,
};
return Pos{ .x = @intCast(usize, x), .y = @intCast(usize, y) };
return Pos{ .x = @intCast(u32, x), .y = @intCast(u32, y) };
}
/// Sets the position of the content area of the specified window.
@ -647,8 +647,8 @@ pub inline fn setPos(self: Window, pos: Pos) error{PlatformError}!void {
}
pub const Size = struct {
width: usize,
height: usize,
width: u32,
height: u32,
};
/// Retrieves the size of the content area of the specified window.
@ -672,7 +672,7 @@ pub inline fn getSize(self: Window) error{PlatformError}!Size {
Error.PlatformError => @errSetCast(error{PlatformError}, err),
else => unreachable,
};
return Size{ .width = @intCast(usize, width), .height = @intCast(usize, height) };
return Size{ .width = @intCast(u32, width), .height = @intCast(u32, height) };
}
/// Sets the size of the content area of the specified window.
@ -710,8 +710,8 @@ pub inline fn setSize(self: Window, size: Size) error{PlatformError}!void {
/// A size with option width/height, used to represent e.g. constraints on a windows size while
/// allowing specific axis to be unconstrained (null) if desired.
pub const SizeOptional = struct {
width: ?usize,
height: ?usize,
width: ?u32,
height: ?u32,
};
/// Sets the size limits of the specified window's content area.
@ -786,7 +786,7 @@ pub inline fn setSizeLimits(self: Window, min: SizeOptional, max: SizeOptional)
/// @thread_safety This function must only be called from the main thread.
///
/// see also: window_sizelimits, glfw.Window.setSizeLimits
pub inline fn setAspectRatio(self: Window, numerator: ?usize, denominator: ?usize) error{PlatformError}!void {
pub inline fn setAspectRatio(self: Window, numerator: ?u32, denominator: ?u32) error{PlatformError}!void {
internal_debug.assertInitialized();
if (numerator != null and denominator != null) {
@ -827,14 +827,14 @@ pub inline fn getFramebufferSize(self: Window) error{PlatformError}!Size {
Error.PlatformError => @errSetCast(error{PlatformError}, err),
else => unreachable,
};
return Size{ .width = @intCast(usize, width), .height = @intCast(usize, height) };
return Size{ .width = @intCast(u32, width), .height = @intCast(u32, height) };
}
pub const FrameSize = struct {
left: usize,
top: usize,
right: usize,
bottom: usize,
left: u32,
top: u32,
right: u32,
bottom: u32,
};
/// Retrieves the size of the frame of the window.
@ -864,10 +864,10 @@ pub inline fn getFrameSize(self: Window) error{PlatformError}!FrameSize {
else => unreachable,
};
return FrameSize{
.left = @intCast(usize, left),
.top = @intCast(usize, top),
.right = @intCast(usize, right),
.bottom = @intCast(usize, bottom),
.left = @intCast(u32, left),
.top = @intCast(u32, top),
.right = @intCast(u32, right),
.bottom = @intCast(u32, bottom),
};
}
@ -1230,7 +1230,7 @@ pub inline fn getMonitor(self: Window) ?Monitor {
/// @thread_safety This function must only be called from the main thread.
///
/// see also: window_monitor, window_full_screen, glfw.Window.getMonitor, glfw.Window.setSize
pub inline fn setMonitor(self: Window, monitor: ?Monitor, xpos: isize, ypos: isize, width: isize, height: isize, refresh_rate: ?usize) error{PlatformError}!void {
pub inline fn setMonitor(self: Window, monitor: ?Monitor, xpos: i32, ypos: i32, width: i32, height: i32, refresh_rate: ?u32) error{PlatformError}!void {
internal_debug.assertInitialized();
c.glfwSetWindowMonitor(
self.handle,
@ -1296,7 +1296,7 @@ pub const Attrib = enum(c_int) {
/// @thread_safety This function must only be called from the main thread.
///
/// see also: window_attribs, glfw.Window.setAttrib
pub inline fn getAttrib(self: Window, attrib: Attrib) error{PlatformError}!isize {
pub inline fn getAttrib(self: Window, attrib: Attrib) error{PlatformError}!i32 {
internal_debug.assertInitialized();
const v = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib));
getError() catch |err| return switch (err) {
@ -1393,7 +1393,7 @@ fn setPosCallbackWrapper(handle: ?*c.GLFWwindow, xpos: c_int, ypos: c_int) callc
internal_debug.assertInitialized();
const window = from(handle.?) catch unreachable;
const internal = window.getInternal();
internal.setPosCallback.?(window, @intCast(isize, xpos), @intCast(isize, ypos));
internal.setPosCallback.?(window, @intCast(i32, xpos), @intCast(i32, ypos));
}
/// Sets the position callback for the specified window.
@ -1416,7 +1416,7 @@ fn setPosCallbackWrapper(handle: ?*c.GLFWwindow, xpos: c_int, ypos: c_int) callc
/// @thread_safety This function must only be called from the main thread.
///
/// see also: window_pos
pub inline fn setPosCallback(self: Window, callback: ?fn (window: Window, xpos: isize, ypos: isize) void) void {
pub inline fn setPosCallback(self: Window, callback: ?fn (window: Window, xpos: i32, ypos: i32) void) void {
internal_debug.assertInitialized();
var internal = self.getInternal();
internal.setPosCallback = callback;
@ -1431,7 +1431,7 @@ fn setSizeCallbackWrapper(handle: ?*c.GLFWwindow, width: c_int, height: c_int) c
internal_debug.assertInitialized();
const window = from(handle.?) catch unreachable;
const internal = window.getInternal();
internal.setSizeCallback.?(window, @intCast(isize, width), @intCast(isize, height));
internal.setSizeCallback.?(window, @intCast(i32, width), @intCast(i32, height));
}
/// Sets the size callback for the specified window.
@ -1447,7 +1447,7 @@ fn setSizeCallbackWrapper(handle: ?*c.GLFWwindow, width: c_int, height: c_int) c
/// @thread_safety This function must only be called from the main thread.
///
/// see also: window_size
pub inline fn setSizeCallback(self: Window, callback: ?fn (window: Window, width: isize, height: isize) void) void {
pub inline fn setSizeCallback(self: Window, callback: ?fn (window: Window, width: i32, height: i32) void) void {
internal_debug.assertInitialized();
var internal = self.getInternal();
internal.setSizeCallback = callback;
@ -1645,7 +1645,7 @@ fn setFramebufferSizeCallbackWrapper(handle: ?*c.GLFWwindow, width: c_int, heigh
internal_debug.assertInitialized();
const window = from(handle.?) catch unreachable;
const internal = window.getInternal();
internal.setFramebufferSizeCallback.?(window, @intCast(isize, width), @intCast(isize, height));
internal.setFramebufferSizeCallback.?(window, @intCast(u32, width), @intCast(u32, height));
}
/// Sets the framebuffer resize callback for the specified window.
@ -1664,7 +1664,7 @@ fn setFramebufferSizeCallbackWrapper(handle: ?*c.GLFWwindow, width: c_int, heigh
/// @thread_safety This function must only be called from the main thread.
///
/// see also: window_fbsize
pub inline fn setFramebufferSizeCallback(self: Window, callback: ?fn (window: Window, width: isize, height: isize) void) void {
pub inline fn setFramebufferSizeCallback(self: Window, callback: ?fn (window: Window, width: u32, height: u32) void) void {
internal_debug.assertInitialized();
var internal = self.getInternal();
internal.setFramebufferSizeCallback = callback;
@ -1817,7 +1817,7 @@ pub inline fn getInputModeRawMouseMotion(self: Window) bool {
/// @thread_safety This function must only be called from the main thread.
///
/// see also: glfw.Window.setInputMode
pub inline fn getInputMode(self: Window, mode: InputMode) isize {
pub inline fn getInputMode(self: Window, mode: InputMode) i32 {
internal_debug.assertInitialized();
const value = c.glfwGetInputMode(self.handle, @enumToInt(mode));
@ -1827,7 +1827,7 @@ pub inline fn getInputMode(self: Window, mode: InputMode) isize {
else => unreachable,
};
return @intCast(isize, value);
return @intCast(i32, value);
}
/// Sets an input option for the specified window.
@ -2047,7 +2047,7 @@ pub inline fn setCursor(self: Window, cursor: Cursor) error{PlatformError}!void
fn setKeyCallbackWrapper(handle: ?*c.GLFWwindow, key: c_int, scancode: c_int, action: c_int, mods: c_int) callconv(.C) void {
const window = from(handle.?) catch unreachable;
const internal = window.getInternal();
internal.setKeyCallback.?(window, @intToEnum(Key, key), @intCast(isize, scancode), @intToEnum(Action, action), Mods.fromInt(mods));
internal.setKeyCallback.?(window, @intToEnum(Key, key), @intCast(i32, scancode), @intToEnum(Action, action), Mods.fromInt(mods));
}
/// Sets the key callback.
@ -2084,7 +2084,7 @@ fn setKeyCallbackWrapper(handle: ?*c.GLFWwindow, key: c_int, scancode: c_int, ac
/// @thread_safety This function must only be called from the main thread.
///
/// see also: input_key
pub inline fn setKeyCallback(self: Window, callback: ?fn (window: Window, key: Key, scancode: isize, action: Action, mods: Mods) void) void {
pub inline fn setKeyCallback(self: Window, callback: ?fn (window: Window, key: Key, scancode: i32, action: Action, mods: Mods) void) void {
internal_debug.assertInitialized();
var internal = self.getInternal();
internal.setKeyCallback = callback;
@ -2278,7 +2278,7 @@ pub inline fn setScrollCallback(self: Window, callback: ?fn (window: Window, xof
fn setDropCallbackWrapper(handle: ?*c.GLFWwindow, path_count: c_int, paths: [*c][*c]const u8) callconv(.C) void {
const window = from(handle.?) catch unreachable;
const internal = window.getInternal();
internal.setDropCallback.?(window, @ptrCast([*][*:0]const u8, paths)[0..@intCast(usize, path_count)]);
internal.setDropCallback.?(window, @ptrCast([*][*:0]const u8, paths)[0..@intCast(u32, path_count)]);
}
/// Sets the path drop callback.
@ -2516,11 +2516,11 @@ test "setIcon" {
defer window.destroy();
// Create an all-red icon image.
var width: usize = 48;
var height: usize = 48;
var width: u32 = 48;
var height: u32 = 48;
const icon = try Image.init(allocator, width, height, width * height * 4);
var x: usize = 0;
var y: usize = 0;
var x: u32 = 0;
var y: u32 = 0;
while (y <= height) : (y += 1) {
while (x <= width) : (x += 1) {
icon.pixels[(x * y * 4) + 0] = 255; // red
@ -2918,7 +2918,7 @@ test "setPosCallback" {
defer window.destroy();
window.setPosCallback((struct {
fn callback(_window: Window, xpos: isize, ypos: isize) void {
fn callback(_window: Window, xpos: i32, ypos: i32) void {
_ = _window;
_ = xpos;
_ = ypos;
@ -2939,7 +2939,7 @@ test "setSizeCallback" {
defer window.destroy();
window.setSizeCallback((struct {
fn callback(_window: Window, width: isize, height: isize) void {
fn callback(_window: Window, width: i32, height: i32) void {
_ = _window;
_ = width;
_ = height;
@ -3058,7 +3058,7 @@ test "setFramebufferSizeCallback" {
defer window.destroy();
window.setFramebufferSizeCallback((struct {
fn callback(_window: Window, width: isize, height: isize) void {
fn callback(_window: Window, width: u32, height: u32) void {
_ = _window;
_ = width;
_ = height;
@ -3385,7 +3385,7 @@ test "setKeyCallback" {
defer window.destroy();
window.setKeyCallback((struct {
fn callback(_window: Window, key: Key, scancode: isize, action: Action, mods: Mods) void {
fn callback(_window: Window, key: Key, scancode: i32, action: Action, mods: Mods) void {
_ = _window;
_ = key;
_ = scancode;

View file

@ -214,7 +214,7 @@ pub const Key = enum(c_int) {
/// @thread_safety This function must only be called from the main thread.
///
/// see also: input_key_name
pub inline fn getName(self: Key, scancode: isize) error{PlatformError}!?[:0]const u8 {
pub inline fn getName(self: Key, scancode: i32) error{PlatformError}!?[:0]const u8 {
internal_debug.assertInitialized();
const name_opt = cc.glfwGetKeyName(@enumToInt(self), @intCast(c_int, scancode));
getError() catch |err| return switch (err) {
@ -240,7 +240,7 @@ pub const Key = enum(c_int) {
/// Possible errors include glfw.Error.NotInitialized, glfw.Error.InvalidEnum and glfw.Error.PlatformError.
///
/// @thread_safety This function may be called from any thread.
pub inline fn getScancode(self: Key) error{PlatformError}!isize {
pub inline fn getScancode(self: Key) error{PlatformError}!i32 {
internal_debug.assertInitialized();
const scancode = cc.glfwGetKeyScancode(@enumToInt(self));
getError() catch |err| return switch (err) {

View file

@ -99,7 +99,7 @@ pub inline fn getCurrentContext() std.mem.Allocator.Error!?Window {
/// @thread_safety This function may be called from any thread.
///
/// see also: buffer_swap, glfwSwapBuffers
pub inline fn swapInterval(interval: isize) error{ NoCurrentContext, PlatformError }!void {
pub inline fn swapInterval(interval: i32) error{ NoCurrentContext, PlatformError }!void {
internal_debug.assertInitialized();
c.glfwSwapInterval(@intCast(c_int, interval));
getError() catch |err| return switch (err) {