fix: use PollType::Wait and remove pre_present_notify (subtask 2.4 fixes)

This commit is contained in:
2026-05-30 17:55:14 -05:00
parent 4e8c4be649
commit 7a7191c17d

View File

@@ -955,7 +955,7 @@ fn render(&mut self) {
wgpu::SurfaceStatus::Success(surface_texture) wgpu::SurfaceStatus::Success(surface_texture)
| wgpu::SurfaceStatus::Suboptimal(surface_texture) => { | wgpu::SurfaceStatus::Suboptimal(surface_texture) => {
// Drive GPU work: shader compilation, memory allocation, fence signaling // Drive GPU work: shader compilation, memory allocation, fence signaling
if let Err(e) = self.device.poll(wgpu::Maintain::Wait) { if let Err(e) = self.device.poll(wgpu::PollType::Wait { submission_index: None, timeout: None }) {
log::error!("Device poll failed: {e}"); log::error!("Device poll failed: {e}");
return; return;
} }
@@ -1038,7 +1038,7 @@ from the [swapchain](concepts/GLOSSARY.md#swapchain). The swapchain cycles throu
23 pre-allocated back buffers. This call returns immediately if a buffer is 23 pre-allocated back buffers. This call returns immediately if a buffer is
available; it does not block on the GPU. available; it does not block on the GPU.
**`device.poll(wgpu::Maintain::Wait)`** — **Synchronous** call that drives **`device.poll(wgpu::PollType::Wait { submission_index: None, timeout: None })`** — **Synchronous** call that drives
in-flight GPU work to completion: shader compilation fences, memory allocation, in-flight GPU work to completion: shader compilation fences, memory allocation,
and queue signaling. Without this, resources accumulate because the device does and queue signaling. Without this, resources accumulate because the device does
not reclaim finished work. Called once per frame. Returns not reclaim finished work. Called once per frame. Returns
@@ -1182,10 +1182,6 @@ buffer from "render target" to "front buffer" on the next vsync.
Check logs for the description. This is a programming error, not a runtime Check logs for the description. This is a programming error, not a runtime
condition. condition.
Note: `pre_present_notify()` does **not** exist in wgpu 29. Do not call it. The
device polling via `device.poll()` is the only frame synchronization mechanism
you need.
## S8: Handling Window Resize ## S8: Handling Window Resize
WHY `surface.configure()` on resize: The swapchain allocates back buffers at a WHY `surface.configure()` on resize: The swapchain allocates back buffers at a