pub struct GpuProfiler { /* private fields */ }Expand description
阶段 B4:GPU 端 timestamp query profiler
初始化:走 mount(只有开了 profiling feature 的构建才会调 new),
有 TIMESTAMP_QUERY 就创 query_set + buffer;没有返回 None(降级为 None 模式)。
Implementations§
Source§impl GpuProfiler
impl GpuProfiler
Sourcepub fn new(device: &Device) -> Option<Self>
pub fn new(device: &Device) -> Option<Self>
阶段 B4:创 GPU profiler。返回 None 如果设备不支持完整 timestamp feature。
Sourcepub fn write_begin(&self, pass: &mut RenderPass<'_>)
pub fn write_begin(&self, pass: &mut RenderPass<'_>)
阶段 B4:在 render pass 头调一次
Sourcepub fn write_end(&self, pass: &mut RenderPass<'_>)
pub fn write_end(&self, pass: &mut RenderPass<'_>)
阶段 B4:在 render pass 尾调一次
Sourcepub fn resolve(&mut self, device: &Device, queue: &Queue) -> Option<u32>
pub fn resolve(&mut self, device: &Device, queue: &Queue) -> Option<u32>
阶段 B4:用独立 encoder resolve query → 同步读 → 算 GPU 端 paint 耗时(微秒)
阻塞性:这个调用会 device.poll(Wait) 强制 GPU 同步,profile 模式才用。
返回 None 当 slot 写满尚未读。
pub fn last_gpu_paint_us(&self) -> u32
Auto Trait Implementations§
impl !RefUnwindSafe for GpuProfiler
impl !UnwindSafe for GpuProfiler
impl Forget for GpuProfiler
impl Freeze for GpuProfiler
impl Move for GpuProfiler
impl Send for GpuProfiler
impl Sync for GpuProfiler
impl Unpin for GpuProfiler
impl UnsafeUnpin for GpuProfiler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more