diff options
Diffstat (limited to 'src/gl.zig')
| -rw-r--r-- | src/gl.zig | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 { |
