Skip to main content

ptx_parser/type/instruction/
txq.rs

1//! Original PTX specification:
2//!
3//! txq.tquery.b32         d, [a];       // texture attributes
4//! txq.level.tlquery.b32  d, [a], lod;  // texture attributes
5//! txq.squery.b32         d, [a];       // sampler attributes
6//! .tquery  = { .width, .height, .depth,
7//! .channel_data_type, .channel_order,
8//! .normalized_coords, .array_size,
9//! .num_mipmap_levels, .num_samples};
10//! .tlquery = { .width, .height, .depth };
11//! .squery  = { .force_unnormalized_coords, .filter_mode,
12//! .addr_mode_0, addr_mode_1, addr_mode_2 };
13
14#![allow(unused)]
15use crate::r#type::common::*;
16
17pub mod section_0 {
18    use crate::Spanned;
19    use crate::parser::Span;
20    use crate::r#type::common::*;
21
22    use serde::Serialize;
23
24    #[derive(Debug, Clone, PartialEq, Serialize)]
25    pub enum Tquery {
26        ChannelDataType,  // .channel_data_type
27        NormalizedCoords, // .normalized_coords
28        NumMipmapLevels,  // .num_mipmap_levels
29        ChannelOrder,     // .channel_order
30        NumSamples,       // .num_samples
31        ArraySize,        // .array_size
32        Height,           // .height
33        Width,            // .width
34        Depth,            // .depth
35    }
36
37    #[derive(Debug, Clone, PartialEq, Serialize)]
38    pub enum Tlquery {
39        Height, // .height
40        Width,  // .width
41        Depth,  // .depth
42    }
43
44    #[derive(Debug, Clone, PartialEq, Serialize)]
45    pub enum Squery {
46        ForceUnnormalizedCoords, // .force_unnormalized_coords
47        FilterMode,              // .filter_mode
48        AddrMode0,               // .addr_mode_0
49        AddrMode1,               // addr_mode_1
50        AddrMode2,               // addr_mode_2
51    }
52
53    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
54    pub struct TxqTqueryB32 {
55        pub tquery: Tquery,    // .tquery
56        pub b32: (),           // .b32
57        pub d: GeneralOperand, // d
58        pub a: AddressOperand, // [a]
59        pub span: Span,
60    }
61
62    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
63    pub struct TxqLevelTlqueryB32 {
64        pub level: (),           // .level
65        pub tlquery: Tlquery,    // .tlquery
66        pub b32: (),             // .b32
67        pub d: GeneralOperand,   // d
68        pub a: AddressOperand,   // [a]
69        pub lod: GeneralOperand, // lod
70        pub span: Span,
71    }
72
73    #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
74    pub struct TxqSqueryB32 {
75        pub squery: Squery,    // .squery
76        pub b32: (),           // .b32
77        pub d: GeneralOperand, // d
78        pub a: AddressOperand, // [a]
79        pub span: Span,
80    }
81}
82
83// Re-export types with section suffixes to avoid naming conflicts
84// e.g., Type0 for section_0::Type, Type1 for section_1::Type
85pub use section_0::Squery as Squery0;
86pub use section_0::Tlquery as Tlquery0;
87pub use section_0::Tquery as Tquery0;
88pub use section_0::TxqLevelTlqueryB32;
89pub use section_0::TxqSqueryB32;
90pub use section_0::TxqTqueryB32;