Repository navigation
Stop recording the unused Hi-Z pyramid (#269) #389
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
Changes from 1 commit
8623310
f56b2fa
596eed6
2ce0da5
36757da
c666937
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
draw_into built six compute passes per frame for a pyramid no pass samples. That was the allocation jump past the #269 floor. The pyramid stays off until sample_hiz is set. Lavapipe samples are back in 100-120. The passes that still record keep the wgpu-core command lists. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1047,8 +1047,12 @@ pub struct Renderer { | |
| mesh_external: Option<Mesh>, | ||
| /// Named models for multi-model rendering (terrain, trees, rocks, etc.) | ||
| models: std::collections::HashMap<String, RenderModel>, | ||
| /// One Hi-Z pyramid. SSR, SSGI, and occlusion sample its R32Float copy. | ||
| /// One Hi-Z pyramid. Built only when [`Self::sample_hiz`] is set, because | ||
| /// each mip is its own wgpu compute pass (#269). | ||
| hiz: Option<crate::hiz_pyramid::HizPyramid>, | ||
| /// A recorded pass will sample [`crate::hiz_pyramid::HizPyramid::view`]. | ||
| /// SSGI reads scene depth directly, so this stays false until that wiring exists. | ||
| sample_hiz: bool, | ||
| /// GL rejects `textureLoad` on `texture_depth_2d`, so the pyramid stays off. | ||
| hiz_depth_load: bool, | ||
| /// Presentation-only particle sim. `None` until an emitter is enabled. | ||
|
|
@@ -3755,6 +3759,7 @@ fn vs(input: VSIn) -> VSOut { | |
| mesh_external: None, | ||
| models: std::collections::HashMap::new(), | ||
| hiz: None, | ||
| sample_hiz: false, | ||
| hiz_depth_load, | ||
| particle_sim: None, | ||
| particle_draw: None, | ||
|
|
@@ -8089,9 +8094,7 @@ fn vs(input: VSIn) -> VSOut { | |
| self.open_timing_gap(enc, "after_post"); | ||
|
|
||
| self.close_timing_gap(enc); | ||
| let hiz_stamp = self.begin_named_stamp(enc, "hiz"); | ||
| self.record_hiz(enc, depth_view); | ||
| self.end_named_stamp(enc, hiz_stamp); | ||
| self.open_timing_gap(enc, "after_hiz"); | ||
| self.close_timing_gap(enc); | ||
| let particle_stamp = self.begin_named_stamp(enc, "particles"); | ||
|
|
@@ -8326,7 +8329,11 @@ fn vs(input: VSIn) -> VSOut { | |
| enc: &mut wgpu::CommandEncoder, | ||
| depth_view: Option<&wgpu::TextureView>, | ||
| ) { | ||
| if !self.hiz_depth_load { | ||
| if !self.hiz_depth_load || !self.sample_hiz { | ||
| // Nothing in draw_into reads HizPyramid::view. SSGI samples the | ||
| // scene depth. Building the chain anyway is one wgpu command | ||
| // list per mip (#269): six passes at 64×64, about +108 allocs, | ||
| // and 0.275 ms on the 1660 Ti heavy scene. | ||
| return; | ||
| } | ||
| let width = self.config.width.max(1); | ||
|
cursor[bot] marked this conversation as resolved.
Resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
wgpu-core 25.0.2 rejects a zero mip count ( The phase plan's follow-up is to call |
||
|
|
@@ -8345,9 +8352,11 @@ fn vs(input: VSIn) -> VSOut { | |
| &source, | ||
| )); | ||
| } | ||
| let stamp = self.begin_named_stamp(enc, "hiz"); | ||
| if let Some(pyramid) = self.hiz.as_ref() { | ||
| pyramid.build(enc); | ||
| } | ||
| self.end_named_stamp(enc, stamp); | ||
| } | ||
|
|
||
| pub fn surface_size(&self) -> (u32, u32) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.