-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Expose desired_maximum_frame_latency
through window creation
#12954
Conversation
// 1 is the minimum, but may cause lower framerates due to the cpu waiting for the gpu to finish | ||
// all work for the previous frame before starting work on the next frame, which then means the gpu | ||
// has to wait for the cpu to finish to start on the next frame. | ||
const DEFAULT_DESIRED_MAXIMUM_FRAME_LATENCY: u32 = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this change depending on if pipelined rendering is enabled as the initial issue suggests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to do some general latency benchmarking to see the impact of changing from 2 to 1 when pipelined rending is disabled. From some quick testing it seemed that this had a neutral to negative impact on the average frame rate when running some stress tests, but I didn't test latency yet and that's probably the main thing to check for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to note that I was wrong about 2 being what we we're using previously (wgpu defaulted to 3 (triple buffering), but changed their default to 2 in the PR that added this setting), though we've been using 2 for bevy 0.13 so not really sure if it matters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine to defer changing the default for pipelined rendering to a follow-up, but I am curious about the results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good.
I did some unscientific latency benchmarking using presentmon's click to photon latency measurements, and 1 frame was quite a bit worse than 2 with pipelined rendering when I tested it with scene viewer (probably due to the lower framerate, or maybe inaccuracies in presentmon's latency measurements?)
Sorry for getting back late, did some quick testing with pipelined rendering disabled to see if switching to one frame for that case might make sense, running on this scene I got way worse frame times (80 against 50 fps), and worse latency (40 against 50ms) using Presentmon. |
Objective
Solution
Window
andExtractedWindow
Changelog
Added
wgpu
'sdesired_maximum_frame_latency
is exposed through window creation. This can be used to override the default maximum number of queued frames on the GPU (currently 2).Migration Guide
desired_maximum_frame_latency
field must be added to instances ofWindow
andExtractedWindow
where all fields are explicitly specified.