Skip to main content

ptx_parser/type/instruction/
tld4.rs

1//! Original PTX specification:
2//!
3//! tld4.comp.2d.v4.dtype.f32    d{|p}, [a, c] {, e} {, f};
4//! tld4.comp.geom.v4.dtype.f32  d{|p}, [a, b, c] {, e} {, f};  // explicit sampler
5//! .comp  = { .r, .g, .b, .a };
6//! .geom  = { .2d, .a2d, .cube, .acube };
7//! .dtype = { .u32, .s32, .f32 };
8
9#![allow(unused)]
10use crate::r#type::common::*;
11
12pub mod section_0 {
13    use crate::Spanned;
14    use crate::parser::Span;
15    use crate::r#type::common::*;
16
17    use serde::Serialize;
18
19    #[derive(Debug, Clone, PartialEq, Serialize)]
20    pub enum Comp {
21        R, // .r
22        G, // .g
23        B, // .b
24        A, // .a
25    }
26
27    #[derive(Debug, Clone, PartialEq, Serialize)]
28    pub enum Dtype {
29        U32, // .u32
30        S32, // .s32
31        F32, // .f32
32    }
33
34    #[derive(Debug, Clone, PartialEq, Serialize)]
35    pub enum Geom {
36        Acube, // .acube
37        Cube,  // .cube
38        A2d,   // .a2d
39        _2d,   // .2d
40    }
41
42    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
43    pub struct Tld4Comp2dV4DtypeF32 {
44        pub comp: Comp,                // .comp
45        pub _2d: (),                   // .2d
46        pub v4: (),                    // .v4
47        pub dtype: Dtype,              // .dtype
48        pub f32: (),                   // .f32
49        pub d: GeneralOperand,         // first operand of d{|p}
50        pub p: Option<GeneralOperand>, // optional second operand of d{|p}
51        pub a: TexHandler2,            // [a, c]
52        pub e: Option<GeneralOperand>, // {, e}
53        pub f: Option<GeneralOperand>, // {, f}
54        pub span: Span,
55    }
56
57    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
58    pub struct Tld4CompGeomV4DtypeF32 {
59        pub comp: Comp,                // .comp
60        pub geom: Geom,                // .geom
61        pub v4: (),                    // .v4
62        pub dtype: Dtype,              // .dtype
63        pub f32: (),                   // .f32
64        pub d: GeneralOperand,         // first operand of d{|p}
65        pub p: Option<GeneralOperand>, // optional second operand of d{|p}
66        pub a: TexHandler3,            // [a, b, c]
67        pub e: Option<GeneralOperand>, // {, e}
68        pub f: Option<GeneralOperand>, // {, f}
69        pub span: Span,
70    }
71}
72
73// Re-export types with section suffixes to avoid naming conflicts
74// e.g., Type0 for section_0::Type, Type1 for section_1::Type
75pub use section_0::Comp as Comp0;
76pub use section_0::Dtype as Dtype0;
77pub use section_0::Geom as Geom0;
78pub use section_0::Tld4Comp2dV4DtypeF32;
79pub use section_0::Tld4CompGeomV4DtypeF32;