gpu: example: use SwapChain .getCurrentTextureView, .present, .release
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
1315c6eb53
commit
117ad5dc3b
1 changed files with 4 additions and 4 deletions
|
|
@ -191,10 +191,10 @@ fn frame(params: FrameParams) !void {
|
||||||
pl.current_desc = pl.target_desc;
|
pl.current_desc = pl.target_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
const back_buffer_view = c.wgpuSwapChainGetCurrentTextureView(@ptrCast(c.WGPUSwapChain, pl.swap_chain.?.ptr));
|
const back_buffer_view = pl.swap_chain.?.getCurrentTextureView();
|
||||||
var render_pass_info = std.mem.zeroes(c.WGPURenderPassDescriptor);
|
var render_pass_info = std.mem.zeroes(c.WGPURenderPassDescriptor);
|
||||||
var color_attachment = std.mem.zeroes(c.WGPURenderPassColorAttachment);
|
var color_attachment = std.mem.zeroes(c.WGPURenderPassColorAttachment);
|
||||||
color_attachment.view = back_buffer_view;
|
color_attachment.view = @ptrCast(c.WGPUTextureView, back_buffer_view.ptr);
|
||||||
color_attachment.resolveTarget = null;
|
color_attachment.resolveTarget = null;
|
||||||
color_attachment.clearValue = c.WGPUColor{ .r = 0.0, .g = 0.0, .b = 0.0, .a = 0.0 };
|
color_attachment.clearValue = c.WGPUColor{ .r = 0.0, .g = 0.0, .b = 0.0, .a = 0.0 };
|
||||||
color_attachment.loadOp = c.WGPULoadOp_Clear;
|
color_attachment.loadOp = c.WGPULoadOp_Clear;
|
||||||
|
|
@ -216,6 +216,6 @@ fn frame(params: FrameParams) !void {
|
||||||
const buf = gpu.CommandBuffer{ .ptr = &commands, .vtable = undefined };
|
const buf = gpu.CommandBuffer{ .ptr = &commands, .vtable = undefined };
|
||||||
params.queue.submit(1, &buf);
|
params.queue.submit(1, &buf);
|
||||||
c.wgpuCommandBufferRelease(commands);
|
c.wgpuCommandBufferRelease(commands);
|
||||||
c.wgpuSwapChainPresent(@ptrCast(c.WGPUSwapChain, pl.swap_chain.?.ptr));
|
pl.swap_chain.?.present();
|
||||||
c.wgpuTextureViewRelease(back_buffer_view);
|
back_buffer_view.release();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue