mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-07 03:48:21 +00:00
renderer: make GraphicsAPI.swap_chain_count required
This commit is contained in:
@@ -34,6 +34,9 @@ pub const imagepkg = @import("metal/image.zig");
|
|||||||
|
|
||||||
pub const custom_shader_target: shadertoy.Target = .msl;
|
pub const custom_shader_target: shadertoy.Target = .msl;
|
||||||
|
|
||||||
|
/// Triple buffering.
|
||||||
|
pub const swap_chain_count = 3;
|
||||||
|
|
||||||
const log = std.log.scoped(.metal);
|
const log = std.log.scoped(.metal);
|
||||||
|
|
||||||
// Get native API access on certain platforms so we can do more customization.
|
// Get native API access on certain platforms so we can do more customization.
|
||||||
|
@@ -204,15 +204,7 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
|
|||||||
// If this is one then we don't do any double+ buffering at all.
|
// If this is one then we don't do any double+ buffering at all.
|
||||||
// This is comptime because there isn't a good reason to change
|
// This is comptime because there isn't a good reason to change
|
||||||
// this at runtime and there is a lot of complexity to support it.
|
// this at runtime and there is a lot of complexity to support it.
|
||||||
const buf_count = count: {
|
const buf_count = GraphicsAPI.swap_chain_count;
|
||||||
if (@hasDecl(GraphicsAPI, "swap_chain_count")) {
|
|
||||||
break :count GraphicsAPI.swap_chain_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default to triple buffering if
|
|
||||||
// graphics API has no preference.
|
|
||||||
break :count 3;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// `buf_count` structs that can hold the
|
/// `buf_count` structs that can hold the
|
||||||
/// data needed by the GPU to draw a frame.
|
/// data needed by the GPU to draw a frame.
|
||||||
|
Reference in New Issue
Block a user