#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum TextureDim {
Tex1d,
Tex2d,
Tex3d,
}
impl TextureDim {
#[must_use]
pub const fn as_ptx_str(self) -> &'static str {
match self {
Self::Tex1d => ".1d",
Self::Tex2d => ".2d",
Self::Tex3d => ".3d",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum SurfaceOp {
Load,
Store,
}
impl SurfaceOp {
#[must_use]
pub const fn as_ptx_str(self) -> &'static str {
match self {
Self::Load => "suld",
Self::Store => "sust",
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn texture_dim_ptx_str() {
assert_eq!(TextureDim::Tex1d.as_ptx_str(), ".1d");
assert_eq!(TextureDim::Tex2d.as_ptx_str(), ".2d");
assert_eq!(TextureDim::Tex3d.as_ptx_str(), ".3d");
}
#[test]
fn surface_op_ptx_str() {
assert_eq!(SurfaceOp::Load.as_ptx_str(), "suld");
assert_eq!(SurfaceOp::Store.as_ptx_str(), "sust");
}
}