PowerBlocks SDK
 
Loading...
Searching...
No Matches
gx_tev.h
Go to the documentation of this file.
1
45
46#include <stdint.h>
47#include <stdbool.h>
48
49// This header is not supposed to be included directly.
50// Instead include gx.h
51
52/* -------------------TEV Stage Control--------------------- */
53
54typedef struct {
55 uint32_t color_control;
56 uint32_t alpha_control;
58
59typedef enum {
60 GX_TEV_STAGE_0,
61 GX_TEV_STAGE_1,
62 GX_TEV_STAGE_2,
63 GX_TEV_STAGE_3,
64 GX_TEV_STAGE_4,
65 GX_TEV_STAGE_5,
66 GX_TEV_STAGE_6,
67 GX_TEV_STAGE_7,
68 GX_TEV_STAGE_8,
69 GX_TEV_STAGE_9,
70 GX_TEV_STAGE_10,
71 GX_TEV_STAGE_11,
72 GX_TEV_STAGE_12,
73 GX_TEV_STAGE_13,
74 GX_TEV_STAGE_14,
75 GX_TEV_STAGE_15
76} gx_tev_stage_id;
77
78typedef enum {
79 GX_TEV_IO_PREVIOUS = 0x0,
80 GX_TEV_IO_REGISTER_0 = 0x2,
81 GX_TEV_IO_REGISTER_1 = 0x4,
82 GX_TEV_IO_REGISTER_2 = 0x6,
83 GX_TEV_IO_TEXTURE = 0x8,
84 GX_TEV_IO_RASTERIZER = 0xA,
85 GX_TEV_IO_ONE = 0xC, // Unsupported as alpha input
86 GX_TEV_IO_HALF = 0xD, // Unsupported as alpha input
87 GX_TEV_IO_CONSTANT = 0xE,
88 GX_TEV_IO_ZERO = 0xF,
89
90 GX_TEV_IO_ALPHA = 0x1, // Use alpha channel for color input
91} gx_tev_io_t;
92
93typedef enum {
94 GX_TEV_SCALE_1,
95 GX_TEV_SCALE_2,
96 GX_TEV_SCALE_4,
97 GX_TEV_SCALE_HALF
98} gx_tev_scale_t;
99
100typedef enum {
101 GX_TEV_BIAS_0,
102 GX_TEV_BIAS_ADD_HALF,
103 GX_TEV_BIAS_SUB_HALF
104} gx_tev_bias_t;
105
106typedef enum {
107 GX_TEV_COMPARE_R8_GREATER = 0x0,
108 GX_TEV_COMPARE_R8_EQUAL = 0x1,
109 GX_TEV_COMPARE_GR16_GREATER = 0x2,
110 GX_TEV_COMPARE_GR16_EQUAL = 0x3,
111 GX_TEV_COMPARE_BGR24_GREATER = 0x4,
112 GX_TEV_COMPARE_BGR24_EQUAL = 0x5,
113 GX_TEV_COMPARE_RGB8_GT = 0x6,
114 GX_TEV_COMPARE_RGB8_EQ = 0x7,
115 GX_TEV_COMPARE_A8_GREATER = 0x6,
116 GX_TEV_COMPARE_A8_EQUAL = 0x7
117} gx_tev_compare_t;
118
126extern void gx_set_tev_stages(int count);
127
136
145extern void gx_flash_tev_stage(gx_tev_stage_id id, const gx_tev_stage_t* tev);
146
161extern void gx_set_tev_stage_color_input(gx_tev_stage_t* tev, gx_tev_io_t a, gx_tev_io_t b, gx_tev_io_t c, gx_tev_io_t d);
162
178extern void gx_set_tev_stage_alpha_input(gx_tev_stage_t* tev, gx_tev_io_t a, gx_tev_io_t b, gx_tev_io_t c, gx_tev_io_t d);
179
189extern void gx_set_tev_stage_color_output(gx_tev_stage_t* tev, gx_tev_io_t out, bool clamp);
190
200extern void gx_set_tev_stage_alpha_output(gx_tev_stage_t* tev, gx_tev_io_t out, bool clamp);
201
213extern void gx_set_tev_stage_color_biasing(gx_tev_stage_t* tev, bool subtract, gx_tev_bias_t bias, gx_tev_scale_t scale);
214
224extern void gx_set_tev_stage_color_comparison(gx_tev_stage_t* tev, gx_tev_compare_t comparison);
225
237extern void gx_set_tev_stage_alpha_biasing(gx_tev_stage_t* tev, bool subtract, gx_tev_bias_t bias, gx_tev_scale_t scale);
238
248extern void gx_set_tev_stage_alpha_comparison(gx_tev_stage_t* tev, gx_tev_compare_t comparison);
249
250/* -------------------TEV Registers --------------------- */
251
264extern void gx_flash_tev_register_color(gx_tev_io_t reg, int r, int g, int b, int a);
void gx_set_tev_stage_color_output(gx_tev_stage_t *tev, gx_tev_io_t out, bool clamp)
Sets the color output to a TEV stage.
Definition gx.c:1459
void gx_set_tev_stages(int count)
Sets the number of tev stages.
Definition gx.c:1413
void gx_set_tev_stage_alpha_output(gx_tev_stage_t *tev, gx_tev_io_t out, bool clamp)
Sets the alpha output to a TEV stage.
Definition gx.c:1464
void gx_initialize_tev_stage(gx_tev_stage_t *tev)
Generates a empty TEV stage.
Definition gx.c:1419
void gx_set_tev_stage_alpha_biasing(gx_tev_stage_t *tev, bool subtract, gx_tev_bias_t bias, gx_tev_scale_t scale)
Sets the TEV alpha stage into biasing mode.
Definition gx.c:1482
void gx_set_tev_stage_color_input(gx_tev_stage_t *tev, gx_tev_io_t a, gx_tev_io_t b, gx_tev_io_t c, gx_tev_io_t d)
Sets the color inputs to a TEV stage.
Definition gx.c:1443
void gx_set_tev_stage_color_biasing(gx_tev_stage_t *tev, bool subtract, gx_tev_bias_t bias, gx_tev_scale_t scale)
Sets the TEV color stage into biasing mode.
Definition gx.c:1471
void gx_set_tev_stage_color_comparison(gx_tev_stage_t *tev, gx_tev_compare_t comparison)
Sets the TEV color stage into comparison mode.
Definition gx.c:1476
void gx_set_tev_stage_alpha_input(gx_tev_stage_t *tev, gx_tev_io_t a, gx_tev_io_t b, gx_tev_io_t c, gx_tev_io_t d)
Sets the color inputs to a TEV stage.
Definition gx.c:1448
void gx_set_tev_stage_alpha_comparison(gx_tev_stage_t *tev, gx_tev_compare_t comparison)
Sets the TEV alpha stage into comparison mode.
Definition gx.c:1487
void gx_flash_tev_stage(gx_tev_stage_id id, const gx_tev_stage_t *tev)
Flashes a TEV stage onto the BP.
Definition gx.c:1435
void gx_flash_tev_register_color(gx_tev_io_t reg, int r, int g, int b, int a)
Set the value of one of the TEVs internal registers.
Definition gx.c:1493
Definition gx_tev.h:54