gfx-rs/wgpu

Examples: Please comment ControlFlow usage in framework.rs

Open

#3,920 建立於 2023年7月11日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)Rust (9,290 star) (703 fork)batch import
area: documentationgood first issue

描述

TLDR: Please add a comment on this line in the wgpu examples.

Explanation: I have been developing small programs based on the "hello-triangle" example. The hello-triangle example is not (and should not be) animated. When I tried to add animation to my hello-triangle program, I got stuck. The answer turned out to be to replace ControlFlow::wait with ControlFlow::poll in the winit handling. I was not able to figure this out on my own. I was able to identify that the hello-triangle example is nonanimated and the "water" example is animated, and I was able to figure out this was because framework.rs and hello-triangle/main.rs are doing something different, but I couldn't figure out what. I actually looked right at the "poll" line in winit and kept reading because I didn't understand the significance. I had to get help on Matrix. Significantly obscuring what is happening is a totally baffling additional quirk in framework.rs where it does something different if "metal-auto-capture" is enabled. I have no idea what this means but assume it is Apple related.

Suggestion: Add a comment saying "Request poll mode so we can continuously animate", or something, and additionally explaining why the metal-auto-capture clause is present. I cannot write a PR for this because I don't know what the metal part does, sorry.

BONUS EXTRA CREDIT: Add a comment to this line reading "Enable VSync". I spent a decent chunk of time even with help on Matrix trying to figure out how to enable VSync before realizing VSync was already enabled I just didn't understand what "Fifo" meant. It makes sense the API is the way it is but it's quite nonobvious that present_mode:Fifo means "enable vsync", the example code is an appropriate place to clarify this.

貢獻者指南

Examples: Please comment ControlFlow usage in framework.rs · gfx-rs/wgpu#3920 | Good First Issue