ptx_parser/unparser/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)]
15
16use crate::lexer::PtxToken;
17use crate::unparser::{PtxUnparser, common::*};
18
19pub mod section_0 {
20    use super::*;
21    use crate::r#type::instruction::txq::section_0::*;
22
23    impl PtxUnparser for TxqTqueryB32 {
24        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
25            push_opcode(tokens, "txq");
26                    match &self.tquery {
27                            Tquery::ChannelDataType => {
28                                    push_directive(tokens, "channel_data_type");
29                            }
30                            Tquery::NormalizedCoords => {
31                                    push_directive(tokens, "normalized_coords");
32                            }
33                            Tquery::NumMipmapLevels => {
34                                    push_directive(tokens, "num_mipmap_levels");
35                            }
36                            Tquery::ChannelOrder => {
37                                    push_directive(tokens, "channel_order");
38                            }
39                            Tquery::NumSamples => {
40                                    push_directive(tokens, "num_samples");
41                            }
42                            Tquery::ArraySize => {
43                                    push_directive(tokens, "array_size");
44                            }
45                            Tquery::Height => {
46                                    push_directive(tokens, "height");
47                            }
48                            Tquery::Width => {
49                                    push_directive(tokens, "width");
50                            }
51                            Tquery::Depth => {
52                                    push_directive(tokens, "depth");
53                            }
54                    }
55                    push_directive(tokens, "b32");
56                    self.d.unparse_tokens(tokens);
57            tokens.push(PtxToken::Comma);
58                    self.a.unparse_tokens(tokens);
59            tokens.push(PtxToken::Semicolon);
60        }
61    }
62
63    impl PtxUnparser for TxqLevelTlqueryB32 {
64        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
65            push_opcode(tokens, "txq");
66                    push_directive(tokens, "level");
67                    match &self.tlquery {
68                            Tlquery::Height => {
69                                    push_directive(tokens, "height");
70                            }
71                            Tlquery::Width => {
72                                    push_directive(tokens, "width");
73                            }
74                            Tlquery::Depth => {
75                                    push_directive(tokens, "depth");
76                            }
77                    }
78                    push_directive(tokens, "b32");
79                    self.d.unparse_tokens(tokens);
80            tokens.push(PtxToken::Comma);
81                    self.a.unparse_tokens(tokens);
82            tokens.push(PtxToken::Comma);
83                    self.lod.unparse_tokens(tokens);
84            tokens.push(PtxToken::Semicolon);
85        }
86    }
87
88    impl PtxUnparser for TxqSqueryB32 {
89        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
90            push_opcode(tokens, "txq");
91                    match &self.squery {
92                            Squery::ForceUnnormalizedCoords => {
93                                    push_directive(tokens, "force_unnormalized_coords");
94                            }
95                            Squery::FilterMode => {
96                                    push_directive(tokens, "filter_mode");
97                            }
98                            Squery::AddrMode0 => {
99                                    push_directive(tokens, "addr_mode_0");
100                            }
101                            Squery::AddrMode1 => {
102                                    push_token_from_str(tokens, "addr_mode_1");
103                            }
104                            Squery::AddrMode2 => {
105                                    push_token_from_str(tokens, "addr_mode_2");
106                            }
107                    }
108                    push_directive(tokens, "b32");
109                    self.d.unparse_tokens(tokens);
110            tokens.push(PtxToken::Comma);
111                    self.a.unparse_tokens(tokens);
112            tokens.push(PtxToken::Semicolon);
113        }
114    }
115
116}
117