use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Subsystem {
Trace,
Report,
Replay,
Graph,
Flow,
Io,
Memory,
Sync,
Schedule,
DStorage,
Shader,
Cache,
D3d12,
Vulkan,
Courts,
Abi,
}
impl Subsystem {
pub const ALL: [Subsystem; 16] = [
Subsystem::Trace,
Subsystem::Report,
Subsystem::Replay,
Subsystem::Graph,
Subsystem::Flow,
Subsystem::Io,
Subsystem::Memory,
Subsystem::Sync,
Subsystem::Schedule,
Subsystem::DStorage,
Subsystem::Shader,
Subsystem::Cache,
Subsystem::D3d12,
Subsystem::Vulkan,
Subsystem::Courts,
Subsystem::Abi,
];
pub const fn as_str(self) -> &'static str {
match self {
Subsystem::Trace => "trace",
Subsystem::Report => "report",
Subsystem::Replay => "replay",
Subsystem::Graph => "graph",
Subsystem::Flow => "flow",
Subsystem::Io => "io",
Subsystem::Memory => "memory",
Subsystem::Sync => "sync",
Subsystem::Schedule => "schedule",
Subsystem::DStorage => "dstorage",
Subsystem::Shader => "shader",
Subsystem::Cache => "cache",
Subsystem::D3d12 => "d3d12",
Subsystem::Vulkan => "vulkan",
Subsystem::Courts => "courts",
Subsystem::Abi => "abi",
}
}
}
impl std::fmt::Display for Subsystem {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum PromotionState {
Observe,
Shadow,
NativeExperimental,
NativeDefault,
Fallback,
}
impl PromotionState {
pub const ALL: [PromotionState; 5] = [
PromotionState::Observe,
PromotionState::Shadow,
PromotionState::NativeExperimental,
PromotionState::NativeDefault,
PromotionState::Fallback,
];
pub const fn as_str(self) -> &'static str {
match self {
PromotionState::Observe => "observe",
PromotionState::Shadow => "shadow",
PromotionState::NativeExperimental => "native_experimental",
PromotionState::NativeDefault => "native_default",
PromotionState::Fallback => "fallback",
}
}
pub const fn is_native(self) -> bool {
matches!(self, PromotionState::NativeExperimental | PromotionState::NativeDefault)
}
pub const fn is_fallback(self) -> bool {
matches!(self, PromotionState::Fallback)
}
pub const fn alters_execution(self) -> bool {
matches!(self, PromotionState::NativeExperimental | PromotionState::NativeDefault)
}
}
impl std::fmt::Display for PromotionState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}