Skip to content

Fixed crash under Wayland when using a scaling factor. #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/triangle.zig
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ pub fn main() !void {
);
defer destroyCommandBuffers(&gc, pool, allocator, cmdbufs);

var state: Swapchain.PresentState = .optimal;
while (c.glfwWindowShouldClose(window) == c.GLFW_FALSE) {
var w: c_int = undefined;
var h: c_int = undefined;
Expand All @@ -136,11 +137,6 @@ pub fn main() !void {

const cmdbuf = cmdbufs[swapchain.image_index];

const state = swapchain.present(cmdbuf) catch |err| switch (err) {
error.OutOfDateKHR => Swapchain.PresentState.suboptimal,
else => |narrow| return narrow,
};

if (state == .suboptimal or extent.width != @as(u32, @intCast(w)) or extent.height != @as(u32, @intCast(h))) {
extent.width = @intCast(w);
extent.height = @intCast(h);
Expand All @@ -161,6 +157,10 @@ pub fn main() !void {
framebuffers,
);
}
state = swapchain.present(cmdbuf) catch |err| switch (err) {
error.OutOfDateKHR => Swapchain.PresentState.suboptimal,
else => |narrow| return narrow,
};

c.glfwPollEvents();
}
Expand Down
Loading