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

Async pipeline compilation #10812

Merged
merged 26 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ impl Node for CASNode {
return Ok(());
};

let pipeline = pipeline_cache.get_render_pipeline(pipeline.0).unwrap();
let Some(pipeline) = pipeline_cache.get_render_pipeline(pipeline.0) else {
return Ok(());
};

let view_target = target.post_process_write();
let source = view_target.source;
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_core_pipeline/src/fxaa/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ impl ViewNode for FxaaNode {
return Ok(());
};

let pipeline = pipeline_cache
.get_render_pipeline(pipeline.pipeline_id)
.unwrap();
let Some(pipeline) = pipeline_cache.get_render_pipeline(pipeline.pipeline_id) else {
return Ok(());
};

let post_process = target.post_process_write();
let source = post_process.source;
Expand Down
5 changes: 4 additions & 1 deletion crates/bevy_core_pipeline/src/upscaling/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct ViewUpscalingPipeline(CachedRenderPipelineId);

fn prepare_view_upscaling_pipelines(
mut commands: Commands,
pipeline_cache: Res<PipelineCache>,
mut pipeline_cache: ResMut<PipelineCache>,
mut pipelines: ResMut<SpecializedRenderPipelines<BlitPipeline>>,
blit_pipeline: Res<BlitPipeline>,
view_targets: Query<(Entity, &ViewTarget, Option<&ExtractedCamera>)>,
Expand All @@ -49,6 +49,9 @@ fn prepare_view_upscaling_pipelines(
};
let pipeline = pipelines.specialize(&pipeline_cache, &blit_pipeline, key);

// Ensure the pipeline is loaded before continuing the frame to prevent frames without any GPU work submitted
pipeline_cache.block_on_render_pipeline(pipeline);

commands
.entity(entity)
.insert(ViewUpscalingPipeline(pipeline));
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ serialize = [
multi-threaded = [
"bevy_asset/multi-threaded",
"bevy_ecs/multi-threaded",
"bevy_render/multi-threaded",
"bevy_tasks/multi-threaded",
]
async-io = ["bevy_tasks/async-io"]
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_pbr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ smallvec = "1.6"
thread_local = "1.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
naga_oil = "0.12"
naga_oil = "0.13"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# Omit the `glsl` feature in non-WebAssembly by default.
naga_oil = { version = "0.12", default-features = false, features = [
naga_oil = { version = "0.13", default-features = false, features = [
"test_shader",
] }

Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ bmp = ["image/bmp"]
webp = ["image/webp"]
dds = ["ddsfile"]
pnm = ["image/pnm"]
multi-threaded = ["bevy_tasks/multi-threaded"]
bevy_ci_testing = ["bevy_app/bevy_ci_testing"]

shader_format_glsl = ["naga/glsl-in", "naga/wgsl-out", "naga_oil/glsl"]
Expand Down Expand Up @@ -72,7 +73,7 @@ wgpu = { version = "0.19.1", default-features = false, features = [
"fragile-send-sync-non-atomic-wasm",
] }
naga = { version = "0.19", features = ["wgsl-in"] }
naga_oil = { version = "0.12", default-features = false, features = [
naga_oil = { version = "0.13", default-features = false, features = [
"test_shader",
] }
serde = { version = "1", features = ["derive"] }
Expand Down
Loading
Loading