Skip to content

Commit

Permalink
Add release of buffer and description on texture
Browse files Browse the repository at this point in the history
  • Loading branch information
gents83 committed Sep 13, 2023
1 parent c5aa05f commit 9a24345
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/tests/mem_leaks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ fn draw_test_with_reports(
drop(ppl);
drop(bgl);
drop(bg);
drop(buffer);

let global_report = ctx.instance.generate_report();
let report = global_report.hub_report();
Expand All @@ -229,6 +230,8 @@ fn draw_test_with_reports(
assert_eq!(report.bind_groups.num_kept_from_user, 0);
assert_eq!(report.texture_views.num_allocated, 1);
assert_eq!(report.texture_views.num_kept_from_user, 0);
assert_eq!(report.buffers.num_allocated, 1);
assert_eq!(report.buffers.num_kept_from_user, 0);
assert_eq!(report.textures.num_allocated, 1);
assert_eq!(report.textures.num_kept_from_user, 0);

Expand All @@ -248,17 +251,24 @@ fn draw_test_with_reports(
assert_eq!(report.bind_group_layouts.num_allocated, 0);
assert_eq!(report.pipeline_layouts.num_allocated, 0);
assert_eq!(report.texture_views.num_allocated, 0);
assert_eq!(report.textures.num_allocated, 1);
assert_eq!(report.buffers.num_allocated, 1);
assert_eq!(report.buffers.num_allocated, 0);

drop(ctx.queue);
drop(ctx.device);
drop(ctx.adapter);

let global_report = ctx.instance.generate_report();
let report = global_report.hub_report();

assert_eq!(report.devices.num_kept_from_user, 0);
assert_eq!(report.queues.num_kept_from_user, 0);
assert_eq!(report.queues.num_allocated, 0);
//Still one texture alive because surface is not dropped till the end
assert_eq!(report.textures.num_allocated, 1);
//that is keeping still the device alive
assert_eq!(report.devices.num_allocated, 1);
assert_eq!(report.textures.num_kept_from_user, 0);
assert_eq!(report.devices.num_kept_from_user, 0);

}

#[test]
Expand Down

0 comments on commit 9a24345

Please sign in to comment.