gpu: example: use SwapChain.configure

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-11 20:17:05 -07:00 committed by Stephen Gutekanst
parent ef3eed7afb
commit 1315c6eb53

View file

@ -182,15 +182,12 @@ fn frame(params: FrameParams) !void {
const use_legacy_api = pl.surface == null;
if (!use_legacy_api) {
pl.swap_chain = params.device.nativeCreateSwapChain(pl.surface, &pl.target_desc);
} else {
c.wgpuSwapChainConfigure(
@ptrCast(c.WGPUSwapChain, pl.swap_chain.?.ptr),
@enumToInt(pl.swap_chain_format),
c.WGPUTextureUsage_RenderAttachment,
@intCast(u32, pl.target_desc.width),
@intCast(u32, pl.target_desc.height),
);
}
} else pl.swap_chain.?.configure(
pl.swap_chain_format,
.render_attachment,
pl.target_desc.width,
pl.target_desc.height,
);
pl.current_desc = pl.target_desc;
}