mach/libs/gpu/src/swap_chain.zig
Stephen Gutekanst fdd3270a0f gpu: update to latest webgpu.h API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-06-24 21:00:07 -07:00

37 lines
1.2 KiB
Zig

const ChainedStruct = @import("main.zig").ChainedStruct;
const PresentMode = @import("main.zig").PresentMode;
const Texture = @import("texture.zig").Texture;
const TextureView = @import("texture_view.zig").TextureView;
const Impl = @import("interface.zig").Impl;
pub const SwapChain = opaque {
pub const Descriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
usage: Texture.UsageFlags,
format: Texture.Format,
width: u32,
height: u32,
present_mode: PresentMode,
};
pub inline fn getCurrentTexture(swap_chain: *SwapChain) ?*Texture {
return Impl.swapChainGetCurrentTexture(swap_chain);
}
pub inline fn getCurrentTextureView(swap_chain: *SwapChain) ?*TextureView {
return Impl.swapChainGetCurrentTextureView(swap_chain);
}
pub inline fn present(swap_chain: *SwapChain) void {
Impl.swapChainPresent(swap_chain);
}
pub inline fn reference(swap_chain: *SwapChain) void {
Impl.swapChainReference(swap_chain);
}
pub inline fn release(swap_chain: *SwapChain) void {
Impl.swapChainRelease(swap_chain);
}
};