1#[repr(u8)]
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4#[doc(alias = "GPU_TEXTURE_FILTER_PARAM")]
5pub enum Filter {
6 #[doc(alias = "GPU_NEAREST")]
7 Nearest = ctru_sys::GPU_NEAREST,
8
9 #[doc(alias = "GPU_LINEAR")]
10 Linear = ctru_sys::GPU_LINEAR,
11}
12
13impl TryFrom<u8> for Filter {
14 type Error = String;
15
16 fn try_from(value: u8) -> Result<Self, Self::Error> {
17 match value {
18 ctru_sys::GPU_NEAREST => Ok(Self::Nearest),
19 ctru_sys::GPU_LINEAR => Ok(Self::Linear),
20 _ => Err("invalid value for FilterParam".to_string()),
21 }
22 }
23}
24
25#[repr(u8)]
27#[derive(Debug, Clone, Copy, PartialEq, Eq)]
28#[doc(alias = "GPU_TEXTURE_WRAP_PARAM")]
29pub enum Wrap {
30 #[doc(alias = "GPU_CLAMP_TO_EDGE")]
31 ClampToEdge = ctru_sys::GPU_CLAMP_TO_EDGE,
32
33 #[doc(alias = "GPU_CLAMP_TO_BORDER")]
34 ClampToBorder = ctru_sys::GPU_CLAMP_TO_BORDER,
35
36 #[doc(alias = "GPU_REPEAT")]
37 Repeat = ctru_sys::GPU_REPEAT,
38
39 #[doc(alias = "GPU_MIRRORED_REPEAT")]
40 MirroredRepeat = ctru_sys::GPU_MIRRORED_REPEAT,
41}
42
43impl TryFrom<u8> for Wrap {
44 type Error = String;
45 fn try_from(value: u8) -> Result<Self, Self::Error> {
46 match value {
47 ctru_sys::GPU_CLAMP_TO_EDGE => Ok(Self::ClampToEdge),
48 ctru_sys::GPU_CLAMP_TO_BORDER => Ok(Self::ClampToBorder),
49 ctru_sys::GPU_REPEAT => Ok(Self::Repeat),
50 ctru_sys::GPU_MIRRORED_REPEAT => Ok(Self::MirroredRepeat),
51 _ => Err("invalid value for Wrap".to_string()),
52 }
53 }
54}
55
56#[repr(u8)]
58#[derive(Debug, Clone, Copy, PartialEq, Eq)]
59#[doc(alias = "GPU_TEXTURE_MODE_PARAM")]
60pub enum Mode {
61 #[doc(alias = "GPU_TEX_2D")]
62 Tex2D = ctru_sys::GPU_TEX_2D,
63
64 #[doc(alias = "GPU_TEX_CUBE_MAP")]
65 CubeMap = ctru_sys::GPU_TEX_CUBE_MAP,
66
67 #[doc(alias = "GPU_TEX_SHADOW_2D")]
68 Shadow2D = ctru_sys::GPU_TEX_SHADOW_2D,
69
70 #[doc(alias = "GPU_TEX_PROJECTION")]
71 Projection = ctru_sys::GPU_TEX_PROJECTION,
72
73 #[doc(alias = "GPU_TEX_SHADOW_CUBE")]
74 ShadowCube = ctru_sys::GPU_TEX_SHADOW_CUBE,
75
76 #[doc(alias = "GPU_TEX_DISABLED")]
77 Disabled = ctru_sys::GPU_TEX_DISABLED,
78}
79
80impl TryFrom<u8> for Mode {
81 type Error = String;
82 fn try_from(value: u8) -> Result<Self, Self::Error> {
83 match value {
84 ctru_sys::GPU_TEX_2D => Ok(Self::Tex2D),
85 ctru_sys::GPU_TEX_CUBE_MAP => Ok(Self::CubeMap),
86 ctru_sys::GPU_TEX_SHADOW_2D => Ok(Self::Shadow2D),
87 ctru_sys::GPU_TEX_PROJECTION => Ok(Self::Projection),
88 ctru_sys::GPU_TEX_SHADOW_CUBE => Ok(Self::ShadowCube),
89 ctru_sys::GPU_TEX_DISABLED => Ok(Self::Disabled),
90 _ => Err("invalid value for Mode".to_string()),
91 }
92 }
93}
94
95#[repr(u8)]
96#[derive(Debug, Clone, Copy, PartialEq, Eq)]
97pub enum Index {
98 Texture0 = 0,
99 Texture1 = 1,
100 Texture2 = 2,
101 Texture3 = 3,
102}
103
104impl Index {
105 pub const ALL: [Index; 4] = [
106 Index::Texture0,
107 Index::Texture1,
108 Index::Texture2,
109 Index::Texture3,
110 ];
111}
112
113#[repr(u8)]
115#[derive(Debug, Clone, Copy, PartialEq, Eq)]
116#[doc(alias = "GPU_TEXUNIT")]
117pub enum Unit {
118 #[doc(alias = "GPU_TEXUNIT0")]
119 Unit0 = ctru_sys::GPU_TEXUNIT0,
120
121 #[doc(alias = "GPU_TEXUNIT1")]
122 Unit1 = ctru_sys::GPU_TEXUNIT1,
123
124 #[doc(alias = "GPU_TEXUNIT2")]
125 Unit2 = ctru_sys::GPU_TEXUNIT2,
126}
127
128impl TryFrom<u8> for Unit {
129 type Error = String;
130 fn try_from(value: u8) -> Result<Self, Self::Error> {
131 match value {
132 ctru_sys::GPU_TEXUNIT0 => Ok(Self::Unit0),
133 ctru_sys::GPU_TEXUNIT1 => Ok(Self::Unit1),
134 ctru_sys::GPU_TEXUNIT2 => Ok(Self::Unit2),
135 _ => Err("invalid value for Unit".to_string()),
136 }
137 }
138}
139
140#[repr(u8)]
142#[derive(Debug, Clone, Copy, PartialEq, Eq)]
143#[doc(alias = "GPU_TEXCOLOR")]
144pub enum ColorFormat {
145 #[doc(alias = "GPU_RGBA8")]
147 Rgba8 = ctru_sys::GPU_RGBA8,
148
149 Rgb8 = ctru_sys::GPU_RGB8,
151
152 #[doc(alias = "GPU_RGBA5551")]
154 Rgba5551 = ctru_sys::GPU_RGBA5551,
155
156 #[doc(alias = "GPU_RGB565")]
158 Rgb565 = ctru_sys::GPU_RGB565,
159
160 #[doc(alias = "GPU_RGBA4")]
162 Rgba4 = ctru_sys::GPU_RGBA4,
163
164 #[doc(alias = "GPU_LA8")]
166 La8 = ctru_sys::GPU_LA8,
167
168 #[doc(alias = "GPU_HILO8")]
170 Hilo8 = ctru_sys::GPU_HILO8,
171
172 #[doc(alias = "GPU_L8")]
174 L8 = ctru_sys::GPU_L8,
175
176 #[doc(alias = "GPU_A8")]
178 A8 = ctru_sys::GPU_A8,
179
180 #[doc(alias = "GPU_LA4")]
182 La4 = ctru_sys::GPU_LA4,
183
184 #[doc(alias = "GPU_L4")]
186 L4 = ctru_sys::GPU_L4,
187
188 #[doc(alias = "GPU_A4")]
190 A4 = ctru_sys::GPU_A4,
191
192 #[doc(alias = "GPU_ETC1")]
194 Etc1 = ctru_sys::GPU_ETC1,
195
196 #[doc(alias = "GPU_ETC1A4")]
198 Etc1A4 = ctru_sys::GPU_ETC1A4,
199}
200
201impl ColorFormat {
202 pub const fn bits_per_pixel(&self) -> usize {
203 match self {
204 Self::Rgba8 => 32,
205 Self::Rgb8 => 24,
206 Self::Rgba5551 | Self::Rgb565 | Self::Rgba4 | Self::La8 | Self::Hilo8 => 16,
207 Self::L8 | Self::A8 | Self::La4 | Self::Etc1A4 => 8,
208 Self::L4 | Self::A4 | Self::Etc1 => 4,
209 }
210 }
211}
212
213impl TryFrom<u8> for ColorFormat {
214 type Error = String;
215 fn try_from(value: u8) -> Result<Self, Self::Error> {
216 match value {
217 ctru_sys::GPU_RGBA8 => Ok(Self::Rgba8),
218 ctru_sys::GPU_RGB8 => Ok(Self::Rgb8),
219 ctru_sys::GPU_RGBA5551 => Ok(Self::Rgba5551),
220 ctru_sys::GPU_RGB565 => Ok(Self::Rgb565),
221 ctru_sys::GPU_RGBA4 => Ok(Self::Rgba4),
222 ctru_sys::GPU_LA8 => Ok(Self::La8),
223 ctru_sys::GPU_HILO8 => Ok(Self::Hilo8),
224 ctru_sys::GPU_L8 => Ok(Self::L8),
225 ctru_sys::GPU_A8 => Ok(Self::A8),
226 ctru_sys::GPU_LA4 => Ok(Self::La4),
227 ctru_sys::GPU_L4 => Ok(Self::L4),
228 ctru_sys::GPU_A4 => Ok(Self::A4),
229 ctru_sys::GPU_ETC1 => Ok(Self::Etc1),
230 ctru_sys::GPU_ETC1A4 => Ok(Self::Etc1A4),
231 _ => Err("invalid value for ColorFormat".to_string()),
232 }
233 }
234}
235
236#[repr(u8)]
241#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
242#[doc(alias = "GPU_TEXFACE")]
243pub enum Face {
244 #[doc(alias = "GPU_POSITIVE_X")]
248 #[default]
249 PositiveX = ctru_sys::GPU_POSITIVE_X,
250
251 #[doc(alias = "GPU_NEGATIVE_X")]
253 NegativeX = ctru_sys::GPU_NEGATIVE_X,
254
255 #[doc(alias = "GPU_POSITIVE_Y")]
257 PositiveY = ctru_sys::GPU_POSITIVE_Y,
258
259 #[doc(alias = "GPU_NEGATIVE_Y")]
261 NegativeY = ctru_sys::GPU_NEGATIVE_Y,
262
263 #[doc(alias = "GPU_POSITIVE_Z")]
265 PositiveZ = ctru_sys::GPU_POSITIVE_Z,
266
267 #[doc(alias = "GPU_NEGATIVE_Z")]
269 NegativeZ = ctru_sys::GPU_NEGATIVE_Z,
270}
271
272impl Face {
273 #[allow(non_upper_case_globals)]
277 #[doc(alias = "GPU_TEXFACE_2D")]
278 pub const Bidimensional: Self = Self::PositiveX;
279}
280
281impl TryFrom<u8> for Face {
282 type Error = String;
283 fn try_from(value: u8) -> Result<Self, Self::Error> {
284 match value {
285 ctru_sys::GPU_POSITIVE_X => Ok(Self::PositiveX),
286 ctru_sys::GPU_NEGATIVE_X => Ok(Self::NegativeX),
289 ctru_sys::GPU_POSITIVE_Y => Ok(Self::PositiveY),
290 ctru_sys::GPU_NEGATIVE_Y => Ok(Self::NegativeY),
291 ctru_sys::GPU_POSITIVE_Z => Ok(Self::PositiveZ),
292 ctru_sys::GPU_NEGATIVE_Z => Ok(Self::NegativeZ),
293 _ => Err("invalid value for Face".to_string()),
294 }
295 }
296}
297
298#[repr(u8)]
300#[derive(Debug, Clone, Copy, PartialEq, Eq)]
301#[doc(alias = "GPU_PROCTEX_CLAMP")]
302pub enum ProceduralTextureClamp {
303 #[doc(alias = "GPU_PT_CLAMP_TO_ZERO")]
305 ClampToZero = ctru_sys::GPU_PT_CLAMP_TO_ZERO,
306
307 #[doc(alias = "GPU_PT_CLAMP_TO_EDGE")]
309 ClampToEdge = ctru_sys::GPU_PT_CLAMP_TO_EDGE,
310
311 #[doc(alias = "GPU_PT_REPEAT")]
313 Repeat = ctru_sys::GPU_PT_REPEAT,
314
315 #[doc(alias = "GPU_PT_MIRRORED_REPEAT")]
317 MirroredRepeat = ctru_sys::GPU_PT_MIRRORED_REPEAT,
318
319 #[doc(alias = "GPU_PT_PULSE")]
321 Pulse = ctru_sys::GPU_PT_PULSE,
322}
323
324impl TryFrom<u8> for ProceduralTextureClamp {
325 type Error = String;
326 fn try_from(value: u8) -> Result<Self, Self::Error> {
327 match value {
328 ctru_sys::GPU_PT_CLAMP_TO_ZERO => Ok(Self::ClampToZero),
329 ctru_sys::GPU_PT_CLAMP_TO_EDGE => Ok(Self::ClampToEdge),
330 ctru_sys::GPU_PT_REPEAT => Ok(Self::Repeat),
331 ctru_sys::GPU_PT_MIRRORED_REPEAT => Ok(Self::MirroredRepeat),
332 ctru_sys::GPU_PT_PULSE => Ok(Self::Pulse),
333 _ => Err("invalid value for ProceduralTextureClamp".to_string()),
334 }
335 }
336}
337
338#[repr(u8)]
340#[derive(Debug, Clone, Copy, PartialEq, Eq)]
341#[doc(alias = "GPU_PROCTEX_MAPFUNC")]
342pub enum ProceduralTextureMappingFunction {
343 #[doc(alias = "GPU_PT_U")]
345 U = ctru_sys::GPU_PT_U,
346
347 #[doc(alias = "GPU_PT_U2")]
349 U2 = ctru_sys::GPU_PT_U2,
350
351 #[doc(alias = "GPU_PT_V")]
353 V = ctru_sys::GPU_PT_V,
354
355 #[doc(alias = "GPU_PT_V2")]
357 V2 = ctru_sys::GPU_PT_V2,
358
359 #[doc(alias = "GPU_PT_ADD")]
361 Add = ctru_sys::GPU_PT_ADD,
362
363 #[doc(alias = "GPU_PT_ADD2")]
365 Add2 = ctru_sys::GPU_PT_ADD2,
366
367 #[doc(alias = "GPU_PT_SQRT2")]
369 Sqrt2 = ctru_sys::GPU_PT_SQRT2,
370
371 #[doc(alias = "GPU_PT_MIN")]
373 Min = ctru_sys::GPU_PT_MIN,
374
375 #[doc(alias = "GPU_PT_MAX")]
377 Max = ctru_sys::GPU_PT_MAX,
378
379 #[doc(alias = "GPU_PT_RMAX")]
381 RMax = ctru_sys::GPU_PT_RMAX,
382}
383
384impl TryFrom<u8> for ProceduralTextureMappingFunction {
385 type Error = String;
386 fn try_from(value: u8) -> Result<Self, Self::Error> {
387 match value {
388 ctru_sys::GPU_PT_U => Ok(Self::U),
389 ctru_sys::GPU_PT_U2 => Ok(Self::U2),
390 ctru_sys::GPU_PT_V => Ok(Self::V),
391 ctru_sys::GPU_PT_V2 => Ok(Self::V2),
392 ctru_sys::GPU_PT_ADD => Ok(Self::Add),
393 ctru_sys::GPU_PT_ADD2 => Ok(Self::Add2),
394 ctru_sys::GPU_PT_SQRT2 => Ok(Self::Sqrt2),
395 ctru_sys::GPU_PT_MIN => Ok(Self::Min),
396 ctru_sys::GPU_PT_MAX => Ok(Self::Max),
397 ctru_sys::GPU_PT_RMAX => Ok(Self::RMax),
398 _ => Err("invalid value for ProceduralTextureMappingFunction".to_string()),
399 }
400 }
401}
402
403#[repr(u8)]
405#[derive(Debug, Clone, Copy, PartialEq, Eq)]
406#[doc(alias = "GPU_PROCTEX_SHIFT")]
407pub enum ProceduralTextureShift {
408 #[doc(alias = "GPU_PT_NONE")]
410 None = ctru_sys::GPU_PT_NONE,
411
412 #[doc(alias = "GPU_PT_ODD")]
414 Odd = ctru_sys::GPU_PT_ODD,
415
416 #[doc(alias = "GPU_PT_EVEN")]
418 Even = ctru_sys::GPU_PT_EVEN,
419}
420
421impl TryFrom<u8> for ProceduralTextureShift {
422 type Error = String;
423
424 fn try_from(value: u8) -> Result<Self, Self::Error> {
425 match value {
426 ctru_sys::GPU_PT_NONE => Ok(Self::None),
427 ctru_sys::GPU_PT_ODD => Ok(Self::Odd),
428 ctru_sys::GPU_PT_EVEN => Ok(Self::Even),
429 _ => Err("invalid value for ProceduralTextureShift".to_string()),
430 }
431 }
432}
433
434#[repr(u8)]
436#[derive(Debug, Clone, Copy, PartialEq, Eq)]
437#[doc(alias = "GPU_PROCTEX_FILTER")]
438pub enum ProceduralTextureFilter {
439 #[doc(alias = "GPU_PT_NEAREST")]
441 Nearest = ctru_sys::GPU_PT_NEAREST,
442
443 #[doc(alias = "GPU_PT_LINEAR")]
445 Linear = ctru_sys::GPU_PT_LINEAR,
446
447 #[doc(alias = "GPU_PT_NEAREST_MIP_NEAREST")]
449 NearestMipNearest = ctru_sys::GPU_PT_NEAREST_MIP_NEAREST,
450
451 #[doc(alias = "GPU_PT_LINEAR_MIP_NEAREST")]
453 LinearMipNearest = ctru_sys::GPU_PT_LINEAR_MIP_NEAREST,
454
455 #[doc(alias = "GPU_PT_NEAREST_MIP_LINEAR")]
457 NearestMipLinear = ctru_sys::GPU_PT_NEAREST_MIP_LINEAR,
458
459 #[doc(alias = "GPU_PT_LINEAR_MIP_LINEAR")]
461 LinearMipLinear = ctru_sys::GPU_PT_LINEAR_MIP_LINEAR,
462}
463
464impl TryFrom<u8> for ProceduralTextureFilter {
465 type Error = String;
466
467 fn try_from(value: u8) -> Result<Self, Self::Error> {
468 match value {
469 ctru_sys::GPU_PT_NEAREST => Ok(Self::Nearest),
470 ctru_sys::GPU_PT_LINEAR => Ok(Self::Linear),
471 ctru_sys::GPU_PT_NEAREST_MIP_NEAREST => Ok(Self::NearestMipNearest),
472 ctru_sys::GPU_PT_LINEAR_MIP_NEAREST => Ok(Self::LinearMipNearest),
473 ctru_sys::GPU_PT_NEAREST_MIP_LINEAR => Ok(Self::NearestMipLinear),
474 ctru_sys::GPU_PT_LINEAR_MIP_LINEAR => Ok(Self::LinearMipLinear),
475 _ => Err("invalid value for ProceduralTextureFilter".to_string()),
476 }
477 }
478}
479
480#[repr(u8)]
482#[derive(Debug, Clone, Copy, PartialEq, Eq)]
483#[doc(alias = "GPU_PROCTEX_LUTID")]
484pub enum ProceduralTextureLutId {
485 #[doc(alias = "GPU_LUT_NOISE")]
487 Noise = ctru_sys::GPU_LUT_NOISE,
488
489 #[doc(alias = "GPU_LUT_RGBMAP")]
491 RGBMap = ctru_sys::GPU_LUT_RGBMAP,
492
493 #[doc(alias = "GPU_LUT_ALPHAMAP")]
495 AlphaMap = ctru_sys::GPU_LUT_ALPHAMAP,
496
497 #[doc(alias = "GPU_LUT_COLOR")]
499 Color = ctru_sys::GPU_LUT_COLOR,
500
501 #[doc(alias = "GPU_LUT_COLORDIF")]
503 ColorDif = ctru_sys::GPU_LUT_COLORDIF,
504}
505
506impl TryFrom<u8> for ProceduralTextureLutId {
507 type Error = String;
508
509 fn try_from(value: u8) -> Result<Self, Self::Error> {
510 match value {
511 ctru_sys::GPU_LUT_NOISE => Ok(Self::Noise),
512 ctru_sys::GPU_LUT_RGBMAP => Ok(Self::RGBMap),
513 ctru_sys::GPU_LUT_ALPHAMAP => Ok(Self::AlphaMap),
514 ctru_sys::GPU_LUT_COLOR => Ok(Self::Color),
515 ctru_sys::GPU_LUT_COLORDIF => Ok(Self::ColorDif),
516 _ => Err("invalid value for ProceduralTextureLutId".to_string()),
517 }
518 }
519}
520
521#[repr(u8)]
523#[derive(Debug, Clone, Copy, PartialEq, Eq)]
524#[doc(alias = "GPU_TEVOP_RGB")]
525pub enum RgbOperand {
526 #[doc(alias = "GPU_TEVOP_RGB_SRC_COLOR")]
528 SrcColor = ctru_sys::GPU_TEVOP_RGB_SRC_COLOR,
529
530 #[doc(alias = "GPU_TEVOP_RGB_ONE_MINUS_SRC_COLOR")]
532 OneMinusSrcColor = ctru_sys::GPU_TEVOP_RGB_ONE_MINUS_SRC_COLOR,
533
534 #[doc(alias = "GPU_TEVOP_RGB_SRC_ALPHA")]
536 SrcAlpha = ctru_sys::GPU_TEVOP_RGB_SRC_ALPHA,
537
538 #[doc(alias = "GPU_TEVOP_RGB_ONE_MINUS_SRC_ALPHA")]
540 OneMinusSrcAlpha = ctru_sys::GPU_TEVOP_RGB_ONE_MINUS_SRC_ALPHA,
541
542 #[doc(alias = "GPU_TEVOP_RGB_SRC_R")]
544 SrcR = ctru_sys::GPU_TEVOP_RGB_SRC_R,
545
546 #[doc(alias = "GPU_TEVOP_RGB_ONE_MINUS_SRC_R")]
548 OneMinusSrcR = ctru_sys::GPU_TEVOP_RGB_ONE_MINUS_SRC_R,
549
550 #[doc(alias = "GPU_TEVOP_RGB_0x06")]
552 _0x06 = ctru_sys::GPU_TEVOP_RGB_0x06,
553
554 #[doc(alias = "GPU_TEVOP_RGB_0x07")]
556 UnknownHex07 = ctru_sys::GPU_TEVOP_RGB_0x07,
557
558 #[doc(alias = "GPU_TEVOP_RGB_SRC_G")]
560 SrcG = ctru_sys::GPU_TEVOP_RGB_SRC_G,
561
562 #[doc(alias = "GPU_TEVOP_RGB_ONE_MINUS_SRC_G")]
564 OneMinusSrcG = ctru_sys::GPU_TEVOP_RGB_ONE_MINUS_SRC_G,
565
566 #[doc(alias = "GPU_TEVOP_RGB_0x0A")]
568 UnknownHex0A = ctru_sys::GPU_TEVOP_RGB_0x0A,
569
570 #[doc(alias = "GPU_TEVOP_RGB_0x0B")]
572 UnknownHex0B = ctru_sys::GPU_TEVOP_RGB_0x0B,
573
574 #[doc(alias = "GPU_TEVOP_RGB_SRC_B")]
576 SrcB = ctru_sys::GPU_TEVOP_RGB_SRC_B,
577
578 #[doc(alias = "GPU_TEVOP_RGB_ONE_MINUS_SRC_B")]
580 OneMinusSrcB = ctru_sys::GPU_TEVOP_RGB_ONE_MINUS_SRC_B,
581
582 #[doc(alias = "GPU_TEVOP_RGB_0x0E")]
584 UnknownHex0E = ctru_sys::GPU_TEVOP_RGB_0x0E,
585
586 #[doc(alias = "GPU_TEVOP_RGB_0x0F")]
588 UnknownHex0F = ctru_sys::GPU_TEVOP_RGB_0x0F,
589}
590
591impl TryFrom<u8> for RgbOperand {
592 type Error = String;
593 fn try_from(value: u8) -> Result<Self, Self::Error> {
594 match value {
595 ctru_sys::GPU_TEVOP_RGB_SRC_COLOR => Ok(Self::SrcColor),
596 ctru_sys::GPU_TEVOP_RGB_ONE_MINUS_SRC_COLOR => Ok(Self::OneMinusSrcColor),
597 ctru_sys::GPU_TEVOP_RGB_SRC_ALPHA => Ok(Self::SrcAlpha),
598 ctru_sys::GPU_TEVOP_RGB_ONE_MINUS_SRC_ALPHA => Ok(Self::OneMinusSrcAlpha),
599 ctru_sys::GPU_TEVOP_RGB_SRC_R => Ok(Self::SrcR),
600 ctru_sys::GPU_TEVOP_RGB_ONE_MINUS_SRC_R => Ok(Self::OneMinusSrcR),
601 ctru_sys::GPU_TEVOP_RGB_0x06 => Ok(Self::_0x06),
602 ctru_sys::GPU_TEVOP_RGB_0x07 => Ok(Self::UnknownHex07),
603 ctru_sys::GPU_TEVOP_RGB_SRC_G => Ok(Self::SrcG),
604 ctru_sys::GPU_TEVOP_RGB_ONE_MINUS_SRC_G => Ok(Self::OneMinusSrcG),
605 ctru_sys::GPU_TEVOP_RGB_0x0A => Ok(Self::UnknownHex0A),
606 ctru_sys::GPU_TEVOP_RGB_0x0B => Ok(Self::UnknownHex0B),
607 ctru_sys::GPU_TEVOP_RGB_SRC_B => Ok(Self::SrcB),
608 ctru_sys::GPU_TEVOP_RGB_ONE_MINUS_SRC_B => Ok(Self::OneMinusSrcB),
609 ctru_sys::GPU_TEVOP_RGB_0x0E => Ok(Self::UnknownHex0E),
610 ctru_sys::GPU_TEVOP_RGB_0x0F => Ok(Self::UnknownHex0F),
611 _ => Err("invalid value for RgbOperand".to_string()),
612 }
613 }
614}
615
616#[repr(u8)]
618#[derive(Debug, Clone, Copy, PartialEq, Eq)]
619#[doc(alias = "GPU_TEVOP_A")]
620pub enum AlphaOperand {
621 #[doc(alias = "GPU_TEVOP_A_SRC_ALPHA")]
623 SrcAlpha = ctru_sys::GPU_TEVOP_A_SRC_ALPHA,
624
625 #[doc(alias = "GPU_TEVOP_A_ONE_MINUS_SRC_ALPHA")]
627 OneMinusSrcAlpha = ctru_sys::GPU_TEVOP_A_ONE_MINUS_SRC_ALPHA,
628
629 #[doc(alias = "GPU_TEVOP_A_SRC_R")]
631 SrcRed = ctru_sys::GPU_TEVOP_A_SRC_R,
632
633 #[doc(alias = "GPU_TEVOP_A_ONE_MINUS_SRC_R")]
635 OneMinusSrcRed = ctru_sys::GPU_TEVOP_A_ONE_MINUS_SRC_R,
636
637 #[doc(alias = "GPU_TEVOP_A_SRC_G")]
639 SrcGreen = ctru_sys::GPU_TEVOP_A_SRC_G,
640
641 #[doc(alias = "GPU_TEVOP_A_ONE_MINUS_SRC_G")]
643 OneMinusSrcGreen = ctru_sys::GPU_TEVOP_A_ONE_MINUS_SRC_G,
644
645 #[doc(alias = "GPU_TEVOP_A_SRC_B")]
647 SrcBlue = ctru_sys::GPU_TEVOP_A_SRC_B,
648
649 #[doc(alias = "GPU_TEVOP_A_ONE_MINUS_SRC_B")]
651 OneMinusSrcBlue = ctru_sys::GPU_TEVOP_A_ONE_MINUS_SRC_B,
652}
653
654impl TryFrom<u8> for AlphaOperand {
655 type Error = String;
656 fn try_from(value: u8) -> Result<Self, Self::Error> {
657 match value {
658 ctru_sys::GPU_TEVOP_A_SRC_ALPHA => Ok(Self::SrcAlpha),
659 ctru_sys::GPU_TEVOP_A_ONE_MINUS_SRC_ALPHA => Ok(Self::OneMinusSrcAlpha),
660 ctru_sys::GPU_TEVOP_A_SRC_R => Ok(Self::SrcRed),
661 ctru_sys::GPU_TEVOP_A_ONE_MINUS_SRC_R => Ok(Self::OneMinusSrcRed),
662 ctru_sys::GPU_TEVOP_A_SRC_G => Ok(Self::SrcGreen),
663 ctru_sys::GPU_TEVOP_A_ONE_MINUS_SRC_G => Ok(Self::OneMinusSrcGreen),
664 ctru_sys::GPU_TEVOP_A_SRC_B => Ok(Self::SrcBlue),
665 ctru_sys::GPU_TEVOP_A_ONE_MINUS_SRC_B => Ok(Self::OneMinusSrcBlue),
666 _ => Err("invalid value for AlphaOperand".to_string()),
667 }
668 }
669}
670
671#[repr(u8)]
673#[derive(Debug, Clone, Copy, PartialEq, Eq)]
674#[doc(alias = "GPU_TEVSCALE")]
675pub enum Scale {
676 #[doc(alias = "GPU_TEVSCALE_1")]
678 Original = ctru_sys::GPU_TEVSCALE_1,
679
680 #[doc(alias = "GPU_TEVSCALE_2")]
682 Double = ctru_sys::GPU_TEVSCALE_2,
683
684 #[doc(alias = "GPU_TEVSCALE_4")]
686 Quadruple = ctru_sys::GPU_TEVSCALE_4,
687}
688
689impl TryFrom<u8> for Scale {
690 type Error = String;
691 fn try_from(value: u8) -> Result<Self, Self::Error> {
692 match value {
693 ctru_sys::GPU_TEVSCALE_1 => Ok(Self::Original),
694 ctru_sys::GPU_TEVSCALE_2 => Ok(Self::Double),
695 ctru_sys::GPU_TEVSCALE_4 => Ok(Self::Quadruple),
696 _ => Err("invalid value for Scale".to_string()),
697 }
698 }
699}