diff --git a/src/default/render.rs b/src/default/render.rs index e56c7b7..0004373 100644 --- a/src/default/render.rs +++ b/src/default/render.rs @@ -24,8 +24,6 @@ impl UiRenderer { pub fn draw(&mut self) { let output = match self.surface.get_current_texture() { CurrentSurfaceTexture::Success(texture) => texture, - // Still drawable; the surface has just changed under us, and - // reconfiguring is what the next frame wants rather than this one. CurrentSurfaceTexture::Suboptimal(texture) => { self.surface.configure(&self.device, &self.config); texture @@ -34,7 +32,6 @@ impl UiRenderer { self.surface.configure(&self.device, &self.config); return; } - // Nothing to draw into this frame. CurrentSurfaceTexture::Timeout | CurrentSurfaceTexture::Occluded | CurrentSurfaceTexture::Validation => return, @@ -81,8 +78,6 @@ impl UiRenderer { pub fn new(window: Arc) -> Self { let size = window.inner_size(); - // The display handle is what GLES needs to present on Wayland, and it - // has to be the one the surface is made from. let instance = Instance::new(InstanceDescriptor { backends: Backends::PRIMARY, display: Some(Box::new(window.clone())), diff --git a/tests/draw_cost.rs b/tests/draw_cost.rs index d7ea2a3..36a1005 100644 --- a/tests/draw_cost.rs +++ b/tests/draw_cost.rs @@ -4,20 +4,19 @@ //! //! cargo test --release --test draw_cost -- --ignored --nocapture //! -//! **Read the instruction count, not the clock.** Wall time here swings by 2x -//! between runs of one binary on this machine -- more under `cargo test` than -//! run directly -- while instructions retired are stable to 0.1%: +//! Wall time is the wrong number to read for anything under a few percent -- +//! it varied by 2x between runs of one unchanged binary where instructions +//! retired varied by 0.1%. Count those instead: //! //! perf stat -e instructions:u target/release/.../draw_cost-* --ignored //! -//! Measured that way on 2026-09-13, drawing each primitive through its own -//! `PrimitiveRender` rather than a match in the renderer costs **6 -//! instructions per list drawn**, which is 0.1% of a frame at both 256 and -//! 1024 layers. Recording one list into the pass costs wgpu ~5,400. +//! That is how `PrimitiveRender` was measured against a match in the renderer: +//! 6 instructions per list drawn, against the ~5,400 wgpu spends recording +//! one. //! -//! The instance is leaked on purpose. Dropping the last one makes the Vulkan -//! loader unload Mesa's ICD, which faults when a thread that touched Vulkan -//! exits -- and libtest runs every test on a spawned thread. +//! The instance is leaked deliberately. A Vulkan loader may unload the driver +//! when the last one drops, which can fault as a thread that used it exits -- +//! and every test runs on a spawned thread. use std::time::Instant; @@ -30,13 +29,13 @@ use wgpu::{Color as GpuColor, *}; const SIZE: u32 = 1024; const FRAMES: u32 = 200; -/// Reported as the best of this many batches. The mean moves by 15% between -/// runs on this machine, which is more than the thing being measured. +/// Reported as the best of this many batches, since the mean moves by more +/// than the thing being measured. const BATCHES: u32 = 8; fn gpu() -> Option<(Device, Queue)> { - // Probed rather than assumed: this machine's Vulkan device comes and goes, - // and GL is what is left when it is gone. + // Probed rather than assumed: there may be no Vulkan adapter, and GL is + // what is left when there is not. let all = Instance::new(InstanceDescriptor::new_without_display_handle()); let instance = match pollster::block_on(all.request_adapter(&RequestAdapterOptions::default())) {