Skip to content

Commit

Permalink
fix(wasm): GpuProfilerSettings not initialized on startup (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
simbleau authored Mar 4, 2024
1 parent 387c7be commit af72e66
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions examples/with_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,27 @@ fn run(
let mut render_state = {
renderers.resize_with(render_cx.devices.len(), || None);
let id = render_state.surface.dev_id;
renderers[id] = Some(
Renderer::new(
&render_cx.devices[id].device,
RendererOptions {
surface_format: Some(render_state.surface.format),
use_cpu,
antialiasing_support: vello::AaSupport::all(),
// We currently initialise on one thread on WASM, but mark this here
// anyway
num_init_threads: NonZeroUsize::new(1),
},
)
.expect("Could create renderer"),
);
let mut renderer = Renderer::new(
&render_cx.devices[id].device,
RendererOptions {
surface_format: Some(render_state.surface.format),
use_cpu,
antialiasing_support: vello::AaSupport::all(),
// We currently initialise on one thread on WASM, but mark this here
// anyway
num_init_threads: NonZeroUsize::new(1),
},
)
.expect("Could create renderer");
renderer
.profiler
.change_settings(GpuProfilerSettings {
enable_timer_queries: args.startup_gpu_profiling_on,
enable_debug_groups: args.startup_gpu_profiling_on,
..Default::default()
})
.expect("Not setting max_num_pending_frames");
renderers[id] = Some(renderer);
Some(render_state)
};
// Whilst suspended, we drop `render_state`, but need to keep the same window.
Expand Down

0 comments on commit af72e66

Please sign in to comment.