aboutsummaryrefslogtreecommitdiffstats
path: root/src/gl.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/gl.zig')
-rw-r--r--src/gl.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gl.zig b/src/gl.zig
index 2b7e9ea..b578350 100644
--- a/src/gl.zig
+++ b/src/gl.zig
@@ -941,11 +941,20 @@ pub const Source = struct {
};
texture: Texture,
+ freeze: bool = false,
+ step: std.atomic.Value(bool) = std.atomic.Value(bool).init(false),
+
deinit_fn: *const fn (self: *Source, allocator: std.mem.Allocator) void,
pub fn deinit(self: *Source, allocator: std.mem.Allocator) void {
self.deinit_fn(self, allocator);
}
+
+ pub fn shouldStep(self: *Source) bool {
+ const step = !self.freeze or self.step.load(.acquire);
+ if (step) self.step.store(false, .release);
+ return step;
+ }
};
pub const UniformCache = struct {