From 5e613fd464041e69b517b8f5a9473616142b0954 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Tue, 26 Jul 2022 19:40:14 -0700 Subject: [PATCH] gpu: implement SwapChain methods Signed-off-by: Stephen Gutekanst --- gpu/src/swap_chain.zig | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/gpu/src/swap_chain.zig b/gpu/src/swap_chain.zig index 72248252..782326ad 100644 --- a/gpu/src/swap_chain.zig +++ b/gpu/src/swap_chain.zig @@ -3,22 +3,29 @@ const PresentMode = @import("types.zig").PresentMode; const Texture = @import("texture.zig").Texture; const TextureUsageFlags = @import("texture.zig").TextureUsageFlags; const TextureFormat = @import("texture.zig").TextureFormat; +const TextureView = @import("texture_view.zig").TextureView; +const impl = @import("interface.zig").impl; pub const SwapChain = *opaque { - // TODO - // pub inline fn swapChainConfigure(swap_chain: gpu.SwapChain, format: gpu.TextureFormat, allowed_usage: gpu.TextureUsageFlags, width: u32, height: u32) void { + pub inline fn configure(swap_chain: SwapChain, format: TextureFormat, allowed_usage: TextureUsageFlags, width: u32, height: u32) void { + impl.swapChainConfigure(swap_chain, format, allowed_usage, width, height); + } - // TODO - // pub inline fn swapChainGetCurrentTextureView(swap_chain: gpu.SwapChain) gpu.TextureView { + pub inline fn getCurrentTextureView(swap_chain: SwapChain) TextureView { + return impl.swapChainGetCurrentTextureView(swap_chain); + } - // TODO - // pub inline fn swapChainPresent(swap_chain: gpu.SwapChain) void { + pub inline fn present(swap_chain: SwapChain) void { + impl.swapChainPresent(swap_chain); + } - // TODO - // pub inline fn swapChainReference(swap_chain: gpu.SwapChain) void { + pub inline fn reference(swap_chain: SwapChain) void { + impl.swapChainReference(swap_chain); + } - // TODO - // pub inline fn swapChainRelease(swap_chain: gpu.SwapChain) void { + pub inline fn release(swap_chain: SwapChain) void { + impl.swapChainRelease(swap_chain); + } }; pub const SwapChainDescriptor = extern struct {