fixing lots of minor issues

This commit is contained in:
2025-12-05 00:36:14 +01:00
parent 4b8aae9eb9
commit 96f69de54f
8 changed files with 78 additions and 30 deletions

23
src/vulkan/RefCounter.zig git.filemode.normal_file
View File

@@ -0,0 +1,23 @@
const std = @import("std");
const Self = @This();
count: std.atomic.Value(usize),
pub const init: Self = .{ .count = std.atomic.Value(usize).init(0) };
pub inline fn ref(self: *Self) void {
_ = self.count.fetchAdd(1, .monotonic);
}
pub inline fn unref(self: *Self) void {
_ = self.count.fetchSub(1, .monotonic);
}
pub inline fn hasRefs(self: *Self) bool {
return self.getRefsCount() == 0;
}
pub inline fn getRefsCount(self: *Self) usize {
return self.count.load(.acquire);
}