From 9ee22aeaa88c775b2ab6bfd1c5f4662a67ce2fba Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sat, 16 Jul 2022 20:18:48 -0700 Subject: [PATCH] gpu: add SwapChain.Descriptor Signed-off-by: Stephen Gutekanst --- gpu/TODO-webgpu.h | 11 ----------- gpu/src/swap_chain.zig | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/gpu/TODO-webgpu.h b/gpu/TODO-webgpu.h index 560f24e7..e5afb026 100644 --- a/gpu/TODO-webgpu.h +++ b/gpu/TODO-webgpu.h @@ -1,14 +1,3 @@ -pub const WGPUSwapChainDescriptor = extern struct { - next_in_chain: *const ChainedStruct, - label: ?[*:0]const u8 = null, - usage: TextureUsageFlags, - format: TextureFormat, - width: u32, - height: u32, - present_mode: PresentMode, - implementation: u64, -}; - pub const WGPUTextureBindingLayout = extern struct { next_in_chain: *const ChainedStruct, sample_type: TextureSampleType, diff --git a/gpu/src/swap_chain.zig b/gpu/src/swap_chain.zig index c272e4f8..7945dbe3 100644 --- a/gpu/src/swap_chain.zig +++ b/gpu/src/swap_chain.zig @@ -1,6 +1,21 @@ +const ChainedStruct = @import("types.zig").ChainedStruct; +const PresentMode = @import("types.zig").PresentMode; +const Texture = @import("texture.zig").Texture; + pub const SwapChain = enum(usize) { _, // TODO: verify there is a use case for nullable value of this type. pub const none: SwapChain = @intToEnum(SwapChain, 0); + + pub const Descriptor = extern struct { + next_in_chain: *const ChainedStruct, + label: ?[*:0]const u8 = null, + usage: Texture.UsageFlags, + format: Texture.Format, + width: u32, + height: u32, + present_mode: PresentMode, + implementation: u64, + }; };