gpu: make swapChainGetCurrentTextureView() return value optional
This commit is contained in:
parent
eefe74fc06
commit
b45ad53a11
5 changed files with 8 additions and 8 deletions
|
|
@ -140,7 +140,7 @@ fn frame(params: FrameParams) !void {
|
|||
pl.current_desc = pl.target_desc;
|
||||
}
|
||||
|
||||
const back_buffer_view = pl.swap_chain.?.getCurrentTextureView();
|
||||
const back_buffer_view = pl.swap_chain.?.getCurrentTextureView().?;
|
||||
const color_attachment = gpu.RenderPassColorAttachment{
|
||||
.view = back_buffer_view,
|
||||
.resolve_target = null,
|
||||
|
|
|
|||
|
|
@ -1157,8 +1157,8 @@ pub const Interface = struct {
|
|||
);
|
||||
}
|
||||
|
||||
pub inline fn swapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) *gpu.TextureView {
|
||||
return @ptrCast(*gpu.TextureView, procs.swapChainGetCurrentTextureView.?(@ptrCast(c.WGPUSwapChain, swap_chain)));
|
||||
pub inline fn swapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) ?*gpu.TextureView {
|
||||
return @ptrCast(?*gpu.TextureView, procs.swapChainGetCurrentTextureView.?(@ptrCast(c.WGPUSwapChain, swap_chain)));
|
||||
}
|
||||
|
||||
pub inline fn swapChainPresent(swap_chain: *gpu.SwapChain) void {
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ pub fn Interface(comptime T: type) type {
|
|||
assertDecl(T, "surfaceReference", fn (surface: *gpu.Surface) callconv(.Inline) void);
|
||||
assertDecl(T, "surfaceRelease", fn (surface: *gpu.Surface) callconv(.Inline) void);
|
||||
assertDecl(T, "swapChainConfigure", fn (swap_chain: *gpu.SwapChain, format: gpu.Texture.Format, allowed_usage: gpu.Texture.UsageFlags, width: u32, height: u32) callconv(.Inline) void);
|
||||
assertDecl(T, "swapChainGetCurrentTextureView", fn (swap_chain: *gpu.SwapChain) callconv(.Inline) *gpu.TextureView);
|
||||
assertDecl(T, "swapChainGetCurrentTextureView", fn (swap_chain: *gpu.SwapChain) callconv(.Inline) ?*gpu.TextureView);
|
||||
assertDecl(T, "swapChainPresent", fn (swap_chain: *gpu.SwapChain) callconv(.Inline) void);
|
||||
assertDecl(T, "swapChainReference", fn (swap_chain: *gpu.SwapChain) callconv(.Inline) void);
|
||||
assertDecl(T, "swapChainRelease", fn (swap_chain: *gpu.SwapChain) callconv(.Inline) void);
|
||||
|
|
@ -1118,7 +1118,7 @@ pub fn Export(comptime T: type) type {
|
|||
}
|
||||
|
||||
// WGPU_EXPORT WGPUTextureView wgpuSwapChainGetCurrentTextureView(WGPUSwapChain swapChain);
|
||||
export fn wgpuSwapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) *gpu.TextureView {
|
||||
export fn wgpuSwapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) ?*gpu.TextureView {
|
||||
return T.swapChainGetCurrentTextureView(swap_chain);
|
||||
}
|
||||
|
||||
|
|
@ -2342,7 +2342,7 @@ pub const StubInterface = Interface(struct {
|
|||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn swapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) *gpu.TextureView {
|
||||
pub inline fn swapChainGetCurrentTextureView(swap_chain: *gpu.SwapChain) ?*gpu.TextureView {
|
||||
_ = swap_chain;
|
||||
unreachable;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub const SwapChain = opaque {
|
|||
Impl.swapChainConfigure(swap_chain, format, allowed_usage, width, height);
|
||||
}
|
||||
|
||||
pub inline fn getCurrentTextureView(swap_chain: *SwapChain) *TextureView {
|
||||
pub inline fn getCurrentTextureView(swap_chain: *SwapChain) ?*TextureView {
|
||||
return Impl.swapChainGetCurrentTextureView(swap_chain);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue