|
| enum | gx_tev_stage_id {
GX_TEV_STAGE_0
, GX_TEV_STAGE_1
, GX_TEV_STAGE_2
, GX_TEV_STAGE_3
,
GX_TEV_STAGE_4
, GX_TEV_STAGE_5
, GX_TEV_STAGE_6
, GX_TEV_STAGE_7
,
GX_TEV_STAGE_8
, GX_TEV_STAGE_9
, GX_TEV_STAGE_10
, GX_TEV_STAGE_11
,
GX_TEV_STAGE_12
, GX_TEV_STAGE_13
, GX_TEV_STAGE_14
, GX_TEV_STAGE_15
} |
| |
| enum | gx_tev_io_t {
GX_TEV_IO_PREVIOUS = 0x0
, GX_TEV_IO_REGISTER_0 = 0x2
, GX_TEV_IO_REGISTER_1 = 0x4
, GX_TEV_IO_REGISTER_2 = 0x6
,
GX_TEV_IO_TEXTURE = 0x8
, GX_TEV_IO_RASTERIZER = 0xA
, GX_TEV_IO_ONE = 0xC
, GX_TEV_IO_HALF = 0xD
,
GX_TEV_IO_CONSTANT = 0xE
, GX_TEV_IO_ZERO = 0xF
, GX_TEV_IO_ALPHA = 0x1
} |
| |
| enum | gx_tev_scale_t { GX_TEV_SCALE_1
, GX_TEV_SCALE_2
, GX_TEV_SCALE_4
, GX_TEV_SCALE_HALF
} |
| |
| enum | gx_tev_bias_t { GX_TEV_BIAS_0
, GX_TEV_BIAS_ADD_HALF
, GX_TEV_BIAS_SUB_HALF
} |
| |
| enum | gx_tev_compare_t {
GX_TEV_COMPARE_R8_GREATER = 0x0
, GX_TEV_COMPARE_R8_EQUAL = 0x1
, GX_TEV_COMPARE_GR16_GREATER = 0x2
, GX_TEV_COMPARE_GR16_EQUAL = 0x3
,
GX_TEV_COMPARE_BGR24_GREATER = 0x4
, GX_TEV_COMPARE_BGR24_EQUAL = 0x5
, GX_TEV_COMPARE_RGB8_GT = 0x6
, GX_TEV_COMPARE_RGB8_EQ = 0x7
,
GX_TEV_COMPARE_A8_GREATER = 0x6
, GX_TEV_COMPARE_A8_EQUAL = 0x7
} |
| |
|
| void | gx_set_tev_stages (int count) |
| | Sets the number of tev stages.
|
| |
| void | gx_initialize_tev_stage (gx_tev_stage_t *tev) |
| | Generates a empty TEV stage.
|
| |
| void | gx_flash_tev_stage (gx_tev_stage_id id, const gx_tev_stage_t *tev) |
| | Flashes a TEV stage onto the BP.
|
| |
| 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.
|
| |
| 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.
|
| |
| 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.
|
| |
| 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.
|
| |
| 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.
|
| |
| 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.
|
| |
| 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.
|
| |
| 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.
|
| |
| 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.
|
| |
TEV definitions.
Though the TEV is really part of the BP. The TEV registers have been made their own header. So that their functions are organized.
Diagram of a TEV Stage:
/| +------------+
/ |>----| PREVIOUS |
+------—+ 8 +----------------------—+ / | +---------—+ | INPUT A |>-/–| | / | +------—+ | | | | +---------—+ | | | |>-—| REGISTER 1 | +------—+ 8 | COLOR MIXER | +------------—+ +----—+ 11 | | +---------—+ | INPUT B |>-/–| mix(a, b, c) |>-—| ADD & SCALE |>-—| CLAMP |>-/–| | +------—+ | (a * (1.0 - c) + b * c) | | ((c+d+b) * s) | +----—+ | | +---------—+ | | +------------—| | |>-—| REGISTER 2 | +------—+ 8 | | | | | +---------—+ | INPUT C |>-/–| | | \ | +------—+ +----------------------—+ | \ | +---------—+ | \ |>-—| REGISTER 3 | +------—+ 11 | | +---------—+ | INPUT D |—/-------------------------------------—+ +------—+
Notes:
- Each of the inputs, A-D, are selectable.
- Inputs are truncated to 8 bits, except for D that is a signed 11 bits, [-1024, 1023]
- The addition is input D, additional bias, then scale is set to be 0.5, 1, 2, or 4
- If clamping is enabled, color values are capped [0, 255], otherwise [-1024, 1023]
- You can save the output to 1 of 4 TEV registers, or just use the tev previous register.
- TEV previous becomes the pixels color at the end of the TEV pipeline.
- TEVs default mode is biasing mode, it can be in compare mode too. No mixing, It just says, if operation on input A and B is true, pass C, otherwise, 0. It still adds D as a bias.
- Author
- Samuel Fitzsimons (rainbain)
- Date
- 2025 @license MIT (see LICENSE file)