gpu: Update example to latest zig/glfw

Update the mach/gpu only example to work with the latest zig and
recent glfw error handling changes.
This commit is contained in:
Austin Rude 2023-01-12 15:21:25 -07:00 committed by Stephen Gutekanst
parent 340e886e78
commit c02578721a
3 changed files with 26 additions and 13 deletions

View file

@ -11,7 +11,7 @@ pub fn main() !void {
gpu.Impl.init();
const setup = try sample_utils.setup(allocator);
const framebuffer_size = try setup.window.getFramebufferSize();
const framebuffer_size = setup.window.getFramebufferSize();
const window_data = try allocator.create(WindowData);
window_data.* = .{
@ -133,7 +133,7 @@ fn frame(params: FrameParams) !void {
const pool = try sample_utils.AutoReleasePool.init();
defer sample_utils.AutoReleasePool.release(pool);
try glfw.pollEvents();
glfw.pollEvents();
const pl = params.window.getUserPointer(WindowData).?;
if (pl.swap_chain == null or !std.meta.eql(pl.current_desc, pl.target_desc)) {
pl.swap_chain = params.device.createSwapChain(pl.surface, &pl.target_desc);