Skip to content
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

Disable the async pipeline by default #500

Merged
merged 4 commits into from
Mar 5, 2024

Conversation

DJMcNab
Copy link
Member

@DJMcNab DJMcNab commented Mar 5, 2024

The async pipeline is not wired up to do robust readback, so it has few advantages (see #366)

This PR also enables the non-async pipeline's interaction with the GPU profiling (which should make it work on wasm)

@simbleau this might also properly fix #494, incidentally.

src/lib.rs Outdated
Comment on lines 376 to 384
#[cfg(feature = "wgpu-profiler")]
self.profiler.end_frame().unwrap();
#[cfg(feature = "wgpu-profiler")]
if let Some(result) = self
.profiler
.process_finished_frame(queue.get_timestamp_period())
{
self.profile_result = Some(result);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[cfg(feature = "wgpu-profiler")]
self.profiler.end_frame().unwrap();
#[cfg(feature = "wgpu-profiler")]
if let Some(result) = self
.profiler
.process_finished_frame(queue.get_timestamp_period())
{
self.profile_result = Some(result);
}
#[cfg(feature = "wgpu-profiler")]
{
self.profiler.end_frame().unwrap();
if let Some(result) = self
.profiler
.process_finished_frame(queue.get_timestamp_period())
{
self.profile_result = Some(result);
}
}

#[cfg(not(target_arch = "wasm32"))]
{
// Note: we don't run the async/"robust" pipeline, as
// it requires more async wiring for the readback.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we get more detail here? What is meant by "async wiring" - Is this a limitation of !Send futures, single-threaded wasm, etc. - What exactly is the issue on WASM that we aren't doing async pipelines there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thread is #gpu > async on wasm. Broadly, the issue is: if we spawn a future, that needs to keep hold of the scene. But that's incompatible with lifetimes of keeping the scene around (to reuse allocations, etc.)

In theory, we should do this much more carefully, but we haven't yet. That might also be useful in contexts outside of browsers too, allowing multi-threaded scene rendering

Co-Authored-By: "Spencer C. Imbleau" <spencer@imbleau.com>
@DJMcNab DJMcNab enabled auto-merge March 5, 2024 14:23
@DJMcNab DJMcNab added this pull request to the merge queue Mar 5, 2024
Merged via the queue into linebender:main with commit ec5c8a4 Mar 5, 2024
9 checks passed
@DJMcNab DJMcNab deleted the optional_async branch March 5, 2024 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Web Demo hangs after a minute
2 participants