told_once, heap_refused_notice: ETC2RGB8, and no second lock inside an assertion

The pixel format is PixelFormat::ETC2RGB8; and an assertion whose message
locked the sink's list again while its condition held the lock would wait
on itself where it failed: each reads the list once.
This commit is contained in:
Anees Iqbal committed 2026-11-11 02:45:22 -08:00
1 parent b39d22516f
commit 320a0ded3a
2 files changed
+5 -6

No files matched your search

@@ -88,13 +88,12 @@ fn a_placement_heap_names_a_texture_it_does_not_make_inside_it() {
let size = heap.size();
// Made at the heap's start: nothing said.
assert!(heap.new_texture_at_offset(&d, 0).is_ok());
let named = || lock(&heard).len();
refused(&heap, &d, 1);
assert_eq!(lock(&heard).len(), 1, "{:?}", lock(&heard));
assert_eq!(withheld(&device), 0);
assert_eq!((named(), withheld(&device)), (1, 0));
// A second refusal: counted, not named.
refused(&heap, &d, last);
assert_eq!(lock(&heard).len(), 1, "{:?}", lock(&heard));
assert_eq!(withheld(&device), 1);
assert_eq!((named(), withheld(&device)), (1, 1));
// Outside the heap: neither.
refused(&heap, &d, size);
assert_eq!(withheld(&device), 1);
@@ -73,7 +73,7 @@ fn withheld(counts: &WorkCounts, told: Told) -> u64 {
fn message(told: Told, name: &str) -> DebugMessage {
if told == Told::TwinDecodeFailed {
let failed = crate::error::internal("a decode that failed");
return twin_decode_failed(PixelFormat::ETC2_RGB8, [8, 8, 1], &failed);
return twin_decode_failed(PixelFormat::ETC2RGB8, [8, 8, 1], &failed);
}
DebugMessage {
severity: MessageSeverity::Info,
@@ -131,7 +131,7 @@ fn a_second_late_reservation_is_counted_not_said() {
};
let late = || device.work_counts().late_reservation_withheld;
reserve(2);
assert!(lock(&heard).is_empty(), "{:?}", lock(&heard));
assert_eq!(*lock(&heard), Vec::<String>::new());
reserve(4);
assert_eq!(*lock(&heard), ["metal2vulkan-late-reservation"]);
assert_eq!(late(), 0);