use serde::Serialize;
use crate::{Label, ResourceId};
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum AlphaComparison {
Output,
Transformed,
Dithered {
scale_word: u32,
},
Unwritten,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum MatrixLines {
Rows,
Columns,
Unshown(Unshown),
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum Unshown {
NotRead,
NotApplied,
BothWays {
along: usize,
across: usize,
},
Unexamined {
why: String,
},
}
impl std::fmt::Display for Unshown {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Unshown::NotRead => f.write_str("the program's results are made of none of the matrix's words"),
Unshown::NotApplied => f.write_str(
"the program sums no product of the matrix's words with other values: it does not show how it \
applies the matrix",
),
Unshown::BothWays { along, across } => write!(
f,
"the program applies the matrix both ways: {along} sums of one line's words and {across} of one lane's"
),
Unshown::Unexamined { why } => f.write_str(why),
}
}
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
pub struct ConstantBufferBinding {
pub resource: ResourceId,
pub bound_size: Option<u32>,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
pub struct OutputUse {
pub label: Label,
pub target: u32,
pub blend_weight: u8,
pub discard_tested: u8,
}