gpu: internalize SwapChain types
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
9d367c3957
commit
e9dcb49328
3 changed files with 16 additions and 17 deletions
|
|
@ -13,7 +13,6 @@ const Sampler = @import("sampler.zig").Sampler;
|
|||
const ShaderModule = @import("shader_module.zig").ShaderModule;
|
||||
const Surface = @import("surface.zig").Surface;
|
||||
const SwapChain = @import("swap_chain.zig").SwapChain;
|
||||
const SwapChainDescriptor = @import("swap_chain.zig").SwapChainDescriptor;
|
||||
const Texture = @import("texture.zig").Texture;
|
||||
const TextureDescriptor = @import("texture.zig").TextureDescriptor;
|
||||
const ChainedStruct = @import("types.zig").ChainedStruct;
|
||||
|
|
@ -113,7 +112,7 @@ pub const Device = opaque {
|
|||
return Impl.deviceCreateShaderModule(device, descriptor);
|
||||
}
|
||||
|
||||
pub inline fn createSwapChain(device: *Device, surface: ?*Surface, descriptor: *const SwapChainDescriptor) *SwapChain {
|
||||
pub inline fn createSwapChain(device: *Device, surface: ?*Surface, descriptor: *const SwapChain.Descriptor) *SwapChain {
|
||||
return Impl.deviceCreateSwapChain(device, surface, descriptor);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ pub fn Interface(comptime T: type) type {
|
|||
assertDecl(T, "deviceCreateRenderPipelineAsync", fn (device: *gpu.Device, descriptor: *const gpu.RenderPipeline.Descriptor, callback: gpu.CreateRenderPipelineAsyncCallback, userdata: *anyopaque) callconv(.Inline) void);
|
||||
assertDecl(T, "deviceCreateSampler", fn (device: *gpu.Device, descriptor: ?*const gpu.Sampler.Descriptor) callconv(.Inline) *gpu.Sampler);
|
||||
assertDecl(T, "deviceCreateShaderModule", fn (device: *gpu.Device, descriptor: *const gpu.ShaderModule.Descriptor) callconv(.Inline) *gpu.ShaderModule);
|
||||
assertDecl(T, "deviceCreateSwapChain", fn (device: *gpu.Device, surface: ?*gpu.Surface, descriptor: *const gpu.SwapChainDescriptor) callconv(.Inline) *gpu.SwapChain);
|
||||
assertDecl(T, "deviceCreateSwapChain", fn (device: *gpu.Device, surface: ?*gpu.Surface, descriptor: *const gpu.SwapChain.Descriptor) callconv(.Inline) *gpu.SwapChain);
|
||||
assertDecl(T, "deviceCreateTexture", fn (device: *gpu.Device, descriptor: *const gpu.TextureDescriptor) callconv(.Inline) *gpu.Texture);
|
||||
assertDecl(T, "deviceDestroy", fn (device: *gpu.Device) callconv(.Inline) void);
|
||||
assertDecl(T, "deviceEnumerateFeatures", fn (device: *gpu.Device, features: [*]gpu.FeatureName) callconv(.Inline) usize);
|
||||
|
|
@ -629,7 +629,7 @@ pub fn Export(comptime T: type) type {
|
|||
}
|
||||
|
||||
// WGPU_EXPORT WGPUSwapChain wgpuDeviceCreateSwapChain(WGPUDevice device, WGPUSurface surface /* nullable */, WGPUSwapChainDescriptor const * descriptor);
|
||||
export fn wgpuDeviceCreateSwapChain(device: *gpu.Device, surface: ?*gpu.Surface, descriptor: *const gpu.SwapChainDescriptor) *gpu.SwapChain {
|
||||
export fn wgpuDeviceCreateSwapChain(device: *gpu.Device, surface: ?*gpu.Surface, descriptor: *const gpu.SwapChain.Descriptor) *gpu.SwapChain {
|
||||
return T.deviceCreateSwapChain(device, surface, descriptor);
|
||||
}
|
||||
|
||||
|
|
@ -1715,7 +1715,7 @@ pub const StubInterface = Interface(struct {
|
|||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn deviceCreateSwapChain(device: *gpu.Device, surface: ?*gpu.Surface, descriptor: *const gpu.SwapChainDescriptor) *gpu.SwapChain {
|
||||
pub inline fn deviceCreateSwapChain(device: *gpu.Device, surface: ?*gpu.Surface, descriptor: *const gpu.SwapChain.Descriptor) *gpu.SwapChain {
|
||||
_ = device;
|
||||
_ = surface;
|
||||
_ = descriptor;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,18 @@ 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: TextureUsageFlags,
|
||||
format: TextureFormat,
|
||||
width: u32,
|
||||
height: u32,
|
||||
present_mode: PresentMode,
|
||||
/// deprecated
|
||||
implementation: u64 = 0,
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
@ -27,15 +39,3 @@ pub const SwapChain = opaque {
|
|||
Impl.swapChainRelease(swap_chain);
|
||||
}
|
||||
};
|
||||
|
||||
pub const SwapChainDescriptor = extern struct {
|
||||
next_in_chain: ?*const ChainedStruct = null,
|
||||
label: ?[*:0]const u8 = null,
|
||||
usage: TextureUsageFlags,
|
||||
format: TextureFormat,
|
||||
width: u32,
|
||||
height: u32,
|
||||
present_mode: PresentMode,
|
||||
/// deprecated
|
||||
implementation: u64 = 0,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue