1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
//! Original PTX specification:
//!
//! txq.tquery.b32 d, [a]; // texture attributes
//! txq.level.tlquery.b32 d, [a], lod; // texture attributes
//! txq.squery.b32 d, [a]; // sampler attributes
//! .tquery = { .width, .height, .depth,
//! .channel_data_type, .channel_order,
//! .normalized_coords, .array_size,
//! .num_mipmap_levels, .num_samples};
//! .tlquery = { .width, .height, .depth };
//! .squery = { .force_unnormalized_coords, .filter_mode,
//! .addr_mode_0, addr_mode_1, addr_mode_2 };
#![allow(unused)]
use crate::parser::{
PtxParseError, PtxParser, PtxTokenStream, Span,
util::{
between, comma_p, directive_p, exclamation_p, lbracket_p, lparen_p, map, minus_p, optional,
pipe_p, rbracket_p, rparen_p, semicolon_p, sep_by, string_p, try_map,
},
};
use crate::r#type::common::*;
use crate::{alt, ok, seq_n};
pub mod section_0 {
use super::*;
use crate::r#type::instruction::txq::section_0::*;
// ============================================================================
// Generated enum parsers
// ============================================================================
impl PtxParser for Squery {
fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
alt!(
map(string_p(".force_unnormalized_coords"), |_, _span| {
Squery::ForceUnnormalizedCoords
}),
map(string_p(".filter_mode"), |_, _span| Squery::FilterMode),
map(string_p(".addr_mode_0"), |_, _span| Squery::AddrMode0),
map(string_p("addr_mode_1"), |_, _span| Squery::AddrMode1),
map(string_p("addr_mode_2"), |_, _span| Squery::AddrMode2)
)
}
}
impl PtxParser for Tlquery {
fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
alt!(
map(string_p(".height"), |_, _span| Tlquery::Height),
map(string_p(".width"), |_, _span| Tlquery::Width),
map(string_p(".depth"), |_, _span| Tlquery::Depth)
)
}
}
impl PtxParser for Tquery {
fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
alt!(
map(string_p(".channel_data_type"), |_, _span| {
Tquery::ChannelDataType
}),
map(string_p(".normalized_coords"), |_, _span| {
Tquery::NormalizedCoords
}),
map(string_p(".num_mipmap_levels"), |_, _span| {
Tquery::NumMipmapLevels
}),
map(string_p(".channel_order"), |_, _span| Tquery::ChannelOrder),
map(string_p(".num_samples"), |_, _span| Tquery::NumSamples),
map(string_p(".array_size"), |_, _span| Tquery::ArraySize),
map(string_p(".height"), |_, _span| Tquery::Height),
map(string_p(".width"), |_, _span| Tquery::Width),
map(string_p(".depth"), |_, _span| Tquery::Depth)
)
}
}
impl PtxParser for TxqTqueryB32 {
fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
try_map(
seq_n!(
string_p("txq"),
Tquery::parse(),
string_p(".b32"),
GeneralOperand::parse(),
comma_p(),
AddressOperand::parse(),
semicolon_p()
),
|(_, tquery, b32, d, _, a, _), span| {
ok!(TxqTqueryB32 {
tquery = tquery,
b32 = b32,
d = d,
a = a,
})
},
)
}
}
impl PtxParser for TxqLevelTlqueryB32 {
fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
try_map(
seq_n!(
string_p("txq"),
string_p(".level"),
Tlquery::parse(),
string_p(".b32"),
GeneralOperand::parse(),
comma_p(),
AddressOperand::parse(),
comma_p(),
GeneralOperand::parse(),
semicolon_p()
),
|(_, level, tlquery, b32, d, _, a, _, lod, _), span| {
ok!(TxqLevelTlqueryB32 {
level = level,
tlquery = tlquery,
b32 = b32,
d = d,
a = a,
lod = lod,
})
},
)
}
}
impl PtxParser for TxqSqueryB32 {
fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
try_map(
seq_n!(
string_p("txq"),
Squery::parse(),
string_p(".b32"),
GeneralOperand::parse(),
comma_p(),
AddressOperand::parse(),
semicolon_p()
),
|(_, squery, b32, d, _, a, _), span| {
ok!(TxqSqueryB32 {
squery = squery,
b32 = b32,
d = d,
a = a,
})
},
)
}
}
}