renderer/metal: frame index must fit up to buffer count

This commit is contained in:
Mitchell Hashimoto
2024-04-28 10:02:07 -07:00
parent 105dbe9e05
commit b1f324e87a

View File

@ -134,7 +134,7 @@ pub const GPUState = struct {
/// The frame data, the current frame index, and the semaphore protecting /// The frame data, the current frame index, and the semaphore protecting
/// the frame data. This is used to implement double/triple/etc. buffering. /// the frame data. This is used to implement double/triple/etc. buffering.
frames: [BufferCount]FrameState, frames: [BufferCount]FrameState,
frame_index: std.math.IntFittingRange(0, BufferCount - 1) = 0, frame_index: std.math.IntFittingRange(0, BufferCount) = 0,
frame_sema: std.Thread.Semaphore = .{ .permits = BufferCount }, frame_sema: std.Thread.Semaphore = .{ .permits = BufferCount },
device: objc.Object, // MTLDevice device: objc.Object, // MTLDevice