Skip to content

Commit

Permalink
fix tests, doctests and wasm build (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidster authored Feb 7, 2024
1 parent 47f2e5d commit 5f3debd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use wgpu_profiler::*;
# let (device, queue) = adapter
# .request_device(
# &wgpu::DeviceDescriptor {
# features: wgpu::Features::TIMESTAMP_QUERY,
# required_features: wgpu::Features::TIMESTAMP_QUERY,
# ..Default::default()
# },
# None,
Expand Down
8 changes: 7 additions & 1 deletion src/profiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,15 @@ impl GpuProfiler {
None
};

let pid = if cfg!(target_arch = "wasm32") {
0
} else {
std::process::id()
};

GpuProfilerQuery {
label,
pid: std::process::id(),
pid,
tid: std::thread::current().id(),
timer_query_pair: query,
handle: self.next_scope_tree_handle(),
Expand Down
6 changes: 3 additions & 3 deletions tests/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn invalid_pending_frame_count() {

#[test]
fn end_frame_unclosed_query() {
let (_, device, _) = create_device(wgpu::Features::TIMESTAMP_QUERY).unwrap();
let (_, device, _queue) = create_device(wgpu::Features::TIMESTAMP_QUERY).unwrap();

let mut profiler = wgpu_profiler::GpuProfiler::new(GpuProfilerSettings::default()).unwrap();
let unclosed_query = {
Expand All @@ -44,7 +44,7 @@ fn end_frame_unclosed_query() {

#[test]
fn end_frame_unresolved_query() {
let (_, device, _) = create_device(wgpu::Features::TIMESTAMP_QUERY).unwrap();
let (_, device, _queue) = create_device(wgpu::Features::TIMESTAMP_QUERY).unwrap();

let mut profiler = wgpu_profiler::GpuProfiler::new(GpuProfilerSettings::default()).unwrap();
{
Expand All @@ -70,7 +70,7 @@ fn end_frame_unresolved_query() {

#[test]
fn change_settings_while_query_open() {
let (_, device, _) = create_device(wgpu::Features::TIMESTAMP_QUERY).unwrap();
let (_, device, _queue) = create_device(wgpu::Features::TIMESTAMP_QUERY).unwrap();

let mut profiler = wgpu_profiler::GpuProfiler::new(GpuProfilerSettings::default()).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion tests/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn create_device(
let (device, queue) = adapter
.request_device(
&wgpu::DeviceDescriptor {
features,
required_features: features,
..Default::default()
},
None,
Expand Down

0 comments on commit 5f3debd

Please sign in to comment.