aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/renderer/metal/shaders.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/renderer/metal/shaders.zig
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/renderer/metal/shaders.zig')
-rw-r--r--vendor/libghostty-vt/src/renderer/metal/shaders.zig30
1 files changed, 12 insertions, 18 deletions
diff --git a/vendor/libghostty-vt/src/renderer/metal/shaders.zig b/vendor/libghostty-vt/src/renderer/metal/shaders.zig
index 0be02357..6ae32106 100644
--- a/vendor/libghostty-vt/src/renderer/metal/shaders.zig
+++ b/vendor/libghostty-vt/src/renderer/metal/shaders.zig
@@ -3,6 +3,7 @@ const Allocator = std.mem.Allocator;
const macos = @import("macos");
const objc = @import("objc");
const math = @import("../../math.zig");
+const global = @import("../../global.zig");
const mtl = @import("api.zig");
const Pipeline = @import("Pipeline.zig");
@@ -76,22 +77,16 @@ const PipelineDescription = struct {
/// We create a type for the pipeline collection based on our desc array.
const PipelineCollection = t: {
- var fields: [pipeline_descs.len]std.builtin.Type.StructField = undefined;
- for (pipeline_descs, 0..) |pipeline, i| {
- fields[i] = .{
- .name = pipeline[0],
- .type = Pipeline,
- .default_value_ptr = null,
- .is_comptime = false,
- .alignment = @alignOf(Pipeline),
- };
+ const StructField = std.builtin.Type.StructField;
+
+ var names: [pipeline_descs.len][]const u8 = undefined;
+ var types = [_]type{Pipeline} ** pipeline_descs.len;
+ var attrs = [_]StructField.Attributes{.{ .@"align" = @alignOf(Pipeline) }} ** pipeline_descs.len;
+
+ for (pipeline_descs, &names) |pipeline, *name| {
+ name.* = pipeline[0];
}
- break :t @Type(.{ .@"struct" = .{
- .layout = .auto,
- .fields = &fields,
- .decls = &.{},
- .is_tuple = false,
- } });
+ break :t @Struct(.auto, null, &names, &types, &attrs);
};
/// This contains the state for the shaders used by the Metal renderer.
@@ -332,7 +327,7 @@ pub const BgImage = extern struct {
/// Initialize the MTLLibrary. A MTLLibrary is a collection of shaders.
fn initLibrary(device: objc.Object) !objc.Object {
- const start = try std.time.Instant.now();
+ const start: std.Io.Timestamp = .now(global.io(), .awake);
const data = try macos.dispatch.Data.create(
@embedFile("ghostty_metallib"),
@@ -352,8 +347,7 @@ fn initLibrary(device: objc.Object) !objc.Object {
);
try checkError(err);
- const end = try std.time.Instant.now();
- log.debug("shader library loaded time={}us", .{end.since(start) / std.time.ns_per_us});
+ log.debug("shader library loaded time={}us", .{start.untilNow(global.io(), .awake).toMicroseconds()});
return library;
}