RUNTIME: a failed submission's line names memory flags itself
ash is built without its debug feature here, so vk::MemoryPropertyFlags has no Debug: the line names each flag (and any bit without a name by its value). Verified by the build job that failed on it (m3-max-26103) and the new unit test memory_flags_are_named_and_an_unnamed_bit_is_given_by_its_value.
This commit is contained in:
1 parent
cc9b00f0c8
commit
234ea4de4e
2 files changed
+39
-3
No files matched your search
@@ -172,12 +172,38 @@ impl TypeFlags {
|
||||
/// Memory type `index` with its flags, where known: "type 2 (DEVICE_LOCAL)".
|
||||
pub(crate) fn of(&self, index: u32) -> String {
|
||||
match (self.0.as_ref()).and_then(|types| types.get(index as usize)) {
|
||||
Some(flags) => format!("type {index} ({flags:?})"),
|
||||
Some(&flags) => format!("type {index} ({})", flag_names(flags)),
|
||||
None => format!("type {index}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// `flags` by their names, `|` between them, any bit without one by its value; "none" for none.
|
||||
pub(crate) fn flag_names(flags: vk::MemoryPropertyFlags) -> String {
|
||||
use vk::MemoryPropertyFlags as F;
|
||||
let named = [
|
||||
(F::DEVICE_LOCAL, "DEVICE_LOCAL"),
|
||||
(F::HOST_VISIBLE, "HOST_VISIBLE"),
|
||||
(F::HOST_COHERENT, "HOST_COHERENT"),
|
||||
(F::HOST_CACHED, "HOST_CACHED"),
|
||||
(F::LAZILY_ALLOCATED, "LAZILY_ALLOCATED"),
|
||||
(F::PROTECTED, "PROTECTED"),
|
||||
];
|
||||
let mut names: Vec<String> = (named.iter())
|
||||
.filter(|(flag, _)| flags.contains(*flag))
|
||||
.map(|(_, name)| (*name).to_owned())
|
||||
.collect();
|
||||
let known = named.iter().fold(F::empty(), |all, (flag, _)| all | *flag);
|
||||
let other = flags & !known;
|
||||
if !other.is_empty() {
|
||||
names.push(format!("{:#x}", other.as_raw()));
|
||||
}
|
||||
match names.is_empty() {
|
||||
true => "none".to_owned(),
|
||||
false => names.join("|"),
|
||||
}
|
||||
}
|
||||
|
||||
/// What a semaphore of a failed submission is to the runtime.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum Role {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
//! back from it as it was handed to the call, and the line's words for what it holds, bounded.
|
||||
|
||||
use crate::submit_failure::{
|
||||
lists, Carried, InfoLists, InfoReport, Report, Resources, Role, SemaphoreUse, Standing, NAMED,
|
||||
NAMED_SEMAPHORES,
|
||||
flag_names, lists, Carried, InfoLists, InfoReport, Report, Resources, Role, SemaphoreUse,
|
||||
Standing, NAMED, NAMED_SEMAPHORES,
|
||||
};
|
||||
use ash::vk::{self, Handle};
|
||||
|
||||
@@ -139,6 +139,16 @@ fn the_line_names_what_the_failed_submission_held_and_flags_invalid_values() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn memory_flags_are_named_and_an_unnamed_bit_is_given_by_its_value() {
|
||||
use vk::MemoryPropertyFlags as F;
|
||||
let flags = F::DEVICE_LOCAL | F::HOST_VISIBLE | F::HOST_COHERENT;
|
||||
assert_eq!(flag_names(flags), "DEVICE_LOCAL|HOST_VISIBLE|HOST_COHERENT");
|
||||
assert_eq!(flag_names(F::empty()), "none");
|
||||
let unnamed = F::from_raw(0x100);
|
||||
assert_eq!(flag_names(F::HOST_CACHED | unnamed), "HOST_CACHED|0x100");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_line_names_at_most_its_bounds_and_counts_the_rest() {
|
||||
let mut resources = Resources::default();
|
||||
|
||||
Reference in new issue
Block a user