MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / end_frame_with_scene

Method end_frame_with_scene

native/shared/src/renderer/mod.rs:9055–11512  ·  view source on GitHub ↗

Like end_frame, but also renders retained scene graph nodes.

(&mut self, scene: &mut crate::scene::SceneGraph, profiler: &mut crate::profiler::Profiler)

Source from the content-addressed store, hash-verified

9053
9054 /// Like end_frame, but also renders retained scene graph nodes.
9055 pub fn end_frame_with_scene(&mut self, scene: &mut crate::scene::SceneGraph, profiler: &mut crate::profiler::Profiler) {
9056 profiler.begin("joint_flush");
9057 self.flush_joint_matrices();
9058 profiler.end("joint_flush");
9059
9060 profiler.begin("surface_acquire");
9061 let output = match self.surface.get_current_texture() {
9062 wgpu::CurrentSurfaceTexture::Success(t) | wgpu::CurrentSurfaceTexture::Suboptimal(t) => t,
9063 _ => {
9064 self.surface.configure(&self.device, &self.surface_config);
9065 profiler.end("surface_acquire");
9066 return;
9067 }
9068 };
9069 profiler.end("surface_acquire");
9070 let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default());
9071
9072 let mut encoder = self.device.create_command_encoder(&wgpu::CommandEncoderDescriptor {
9073 label: Some("bloom_encoder"),
9074 });
9075
9076 // Ticket 017: gate the entire Lumen warmup + per-frame
9077 // pipeline on ssgi_enabled. Every pass below exists solely
9078 // to feed the SSGI probe trace — when SSGI is off, running
9079 // them is pure waste and breaks the --quality 0 regression
9080 // guard (the Mesh-Cards backlog + per-frame card relight
9081 // cost held the "off" preset below 60 fps). Pending queues
9082 // (BLAS / SDF / card-capture) stay populated so a runtime
9083 // setSsgiEnabled(true) flip resumes baking from where it
9084 // paused instead of leaving the caches empty.
9085 if self.ssgi_enabled {
9086 // Ticket 007b: build any freshly-created BLASes and refresh
9087 // the TLAS before the SSGI probe trace pass can sample it.
9088 // No-op when HW RT is off or when nothing has changed.
9089 profiler.begin("accel_rebuild");
9090 self.rebuild_acceleration_structures(scene, &mut encoder);
9091 profiler.end("accel_rebuild");
9092
9093 // Ticket 013: rasterise any new mesh cards into the shared
9094 // atlas. Drains `scene.pending_card_captures` — empty and
9095 // free after the first frame on a static scene.
9096 profiler.begin("card_capture");
9097 self.capture_pending_mesh_cards(scene, &mut encoder);
9098 profiler.end("card_capture");
9099
9100 // Ticket 014 V1: bake per-mesh UDFs in the same frame encoder.
9101 // Runs alongside card capture until the scene's pending queue
9102 // is drained; no-op thereafter.
9103 profiler.begin("sdf_bake");
9104 self.bake_pending_sdfs(scene, &mut encoder);
9105 profiler.end("sdf_bake");
9106
9107 // Ticket 014 V5: check if the camera has wandered past the
9108 // rebake threshold from the current clipmap centre; if so,
9109 // clear the `built` flag so the bake below fires again with
9110 // a re-centred origin. SDF trace falls back to Hi-Z for the
9111 // single frame between invalidation and re-bake completion.
9112 self.maybe_invalidate_sdf_clipmap();

Callers 3

bloom_screenshot_captureFunction · 0.80
end_frameMethod · 0.80
bloom_screenshot_captureFunction · 0.80

Calls 15

extract_frustum_planesFunction · 0.85
aabb_outside_frustumFunction · 0.85
haltonFunction · 0.85
mat4_invertFunction · 0.85
encode_png_simpleFunction · 0.85
beginMethod · 0.80
flush_joint_matricesMethod · 0.80
endMethod · 0.80
bake_pending_sdfsMethod · 0.80

Tested by

no test coverage detected