mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 14:00:29 +00:00
renderer/metal: load shaders from precompiled lib
This commit is contained in:
3
pkg/macos/dispatch/c.zig
Normal file
3
pkg/macos/dispatch/c.zig
Normal file
@@ -0,0 +1,3 @@
|
||||
pub usingnamespace @cImport({
|
||||
@cInclude("dispatch/dispatch.h");
|
||||
});
|
||||
31
pkg/macos/dispatch/data.zig
Normal file
31
pkg/macos/dispatch/data.zig
Normal file
@@ -0,0 +1,31 @@
|
||||
const std = @import("std");
|
||||
const foundation = @import("../foundation.zig");
|
||||
const c = @import("c.zig");
|
||||
|
||||
pub const Data = opaque {
|
||||
pub const DESTRUCTOR_DEFAULT = c.DISPATCH_DATA_DESTRUCTOR_DEFAULT;
|
||||
|
||||
pub fn create(
|
||||
data: []const u8,
|
||||
queue: ?*anyopaque,
|
||||
destructor: ?*anyopaque,
|
||||
) !*Data {
|
||||
return dispatch_data_create(
|
||||
data.ptr,
|
||||
data.len,
|
||||
queue,
|
||||
destructor,
|
||||
) orelse return error.OutOfMemory;
|
||||
}
|
||||
|
||||
pub fn release(data: *Data) void {
|
||||
foundation.c.CFRelease(data);
|
||||
}
|
||||
};
|
||||
|
||||
extern "c" fn dispatch_data_create(
|
||||
data: [*]const u8,
|
||||
len: usize,
|
||||
queue: ?*anyopaque,
|
||||
destructor: ?*anyopaque,
|
||||
) ?*Data;
|
||||
8
pkg/macos/dispatch/queue.zig
Normal file
8
pkg/macos/dispatch/queue.zig
Normal file
@@ -0,0 +1,8 @@
|
||||
const std = @import("std");
|
||||
const c = @import("c.zig");
|
||||
|
||||
pub const Queue = *anyopaque; // dispatch_queue_t
|
||||
|
||||
pub fn getMain() Queue {
|
||||
return c.dispatch_get_main_queue().?;
|
||||
}
|
||||
Reference in New Issue
Block a user