update to Zig 2024.05
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
c64bc513b9
commit
707e5cc756
16 changed files with 102 additions and 93 deletions
|
|
@ -288,7 +288,7 @@ pub const Device = struct {
|
|||
pub fn processQueuedOperations(device: *Device) void {
|
||||
// Reference trackers
|
||||
if (device.queue) |queue| {
|
||||
const completed_value = queue.completed_value.load(.Acquire);
|
||||
const completed_value = queue.completed_value.load(.acquire);
|
||||
|
||||
var i: usize = 0;
|
||||
while (i < device.reference_trackers.items.len) {
|
||||
|
|
@ -2191,7 +2191,7 @@ pub const Queue = struct {
|
|||
// Internal
|
||||
pub fn waitUntil(queue: *Queue, fence_value: u64) void {
|
||||
// TODO - avoid spin loop
|
||||
while (queue.completed_value.load(.Acquire) < fence_value) {}
|
||||
while (queue.completed_value.load(.acquire) < fence_value) {}
|
||||
}
|
||||
|
||||
// Private
|
||||
|
|
@ -2220,7 +2220,7 @@ pub const Queue = struct {
|
|||
|
||||
fn completedHandler(ctx: CompletedContext, mtl_command_buffer: *mtl.CommandBuffer) void {
|
||||
_ = mtl_command_buffer;
|
||||
ctx.queue.completed_value.store(ctx.fence_value, .Release);
|
||||
ctx.queue.completed_value.store(ctx.fence_value, .release);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ pub const Tag = enum {
|
|||
}
|
||||
};
|
||||
|
||||
pub const keywords = std.ComptimeStringMap(Tag, .{
|
||||
pub const keywords = std.StaticStringMap(Tag).initComptime(.{
|
||||
.{ "enable", .k_enable },
|
||||
.{ "requires", .k_requires },
|
||||
.{ "fn", .k_fn },
|
||||
|
|
@ -368,7 +368,7 @@ pub const keywords = std.ComptimeStringMap(Tag, .{
|
|||
|
||||
pub const reserved = blk: {
|
||||
@setEvalBranchQuota(3000);
|
||||
break :blk std.ComptimeStringMap(void, .{
|
||||
break :blk std.StaticStringMap(void).initComptime(.{
|
||||
.{ "NULL", {} },
|
||||
.{ "Self", {} },
|
||||
.{ "abstract", {} },
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand)
|
|||
}
|
||||
},
|
||||
.Struct => |info| {
|
||||
if (info.layout == .Packed) {
|
||||
if (info.layout == .@"packed") {
|
||||
section.writeWord(@bitCast(operand));
|
||||
} else {
|
||||
section.writeExtendedMask(Operand, operand);
|
||||
|
|
@ -262,7 +262,7 @@ fn operandSize(comptime Operand: type, operand: Operand) usize {
|
|||
}
|
||||
break :blk total;
|
||||
},
|
||||
.Struct => |info| if (info.layout == .Packed) 1 else extendedMaskSize(Operand, operand),
|
||||
.Struct => |info| if (info.layout == .@"packed") 1 else extendedMaskSize(Operand, operand),
|
||||
.Union => extendedUnionSize(Operand, operand),
|
||||
else => unreachable,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -290,5 +290,5 @@ fn expectCodegen(
|
|||
defer allocator.free(out);
|
||||
|
||||
try std.fs.cwd().makePath("zig-out/shader/");
|
||||
try std.fs.cwd().writeFile("zig-out/shader/" ++ file_name, out);
|
||||
try std.fs.cwd().writeFile(.{ .sub_path = "zig-out/shader/" ++ file_name, .data = out });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ pub fn Manager(comptime T: type) type {
|
|||
count: u32 = 1,
|
||||
|
||||
pub fn reference(manager: *@This()) void {
|
||||
_ = @atomicRmw(u32, &manager.count, .Add, 1, .Monotonic);
|
||||
_ = @atomicRmw(u32, &manager.count, .Add, 1, .monotonic);
|
||||
}
|
||||
|
||||
pub fn release(manager: *@This()) void {
|
||||
if (@atomicRmw(u32, &manager.count, .Sub, 1, .Release) == 1) {
|
||||
@fence(.Acquire);
|
||||
const parent = @fieldParentPtr(T, "manager", manager);
|
||||
if (@atomicRmw(u32, &manager.count, .Sub, 1, .release) == 1) {
|
||||
@fence(.acquire);
|
||||
const parent: *T = @alignCast(@fieldParentPtr("manager", manager));
|
||||
parent.deinit();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue