Expand description
GTE function-op wrappers.
Each op corresponds to one COP2 cofun instruction. The constants
below are the exact 32-bit encodings PSX-SPX documents – the same
bits the MIPS CPU would dispatch on hardware and the same bits the
emulator’s Gte::execute decodes. On host we hand them straight
to the per-thread software GTE in crate::host; on MIPS we emit
them as .word instructions so LLVM’s integrated assembler can’t
reject the COP2 mnemonics it doesn’t recognise.
Encoding (per PSX-SPX, “GTE Coprocessor Opcodes”):
bits 31..26 = 0x12 (010010) -- COP2
bit 25 = 1 -- `cop2 cofun` prefix
bit 19 = sf -- fraction-shift
bits 18..17 = mx -- MVMVA matrix select
bits 16..15 = vx -- MVMVA vector select
bits 14..13 = cv -- MVMVA translation select
bit 10 = lm -- IR lower-bound mode
bits 5..0 = opcode -- function idThe 0x4A000000 base (0x12<<26 | 1<<25) is common to every op.
Functions§
- average_
z3 ⚠ - Average SZ1..SZ3 weighted by ZSF3 into OTZ and MAC0 (
AVSZ3). - average_
z4 ⚠ - Average SZ0..SZ3 weighted by ZSF4 into OTZ and MAC0 (
AVSZ4). - color_
color ⚠ - Light IR through the light color matrix and modulate by RGBC (
CC). - color_
depth_ ⚠cue color_colorfollowed by a depth cue toward the far color (CDP).- depth_
cue_ ⚠light - Depth-cue a lit color:
RGBC*IRtoward FC by IR0 (DCPL). - depth_
cue_ ⚠single - Depth-cue RGBC toward the far color by IR0 (
DPCS). - depth_
cue_ ⚠triple depth_cue_singlerun three times against the RGB FIFO (DPCT).- interpolate_
far_ ⚠color - Interpolate IR toward the far color by IR0, then push the color FIFO
(
INTPL). - light_
color_ ⚠depth_ single - Light, color and depth-cue one vertex normal (
NCDS,sf=1, lm=0). - light_
color_ ⚠depth_ triple light_color_depth_singlefor V0, V1 and V2 (NCDT).- light_
color_ ⚠single - Light and color one vertex normal, no depth cue (
NCCS). - light_
color_ ⚠triple light_color_singlefor V0, V1 and V2 (NCCT).- light_
single ⚠ - Light one vertex normal, without the RGBC modulate (
NCS). - light_
triple ⚠ light_singlefor V0, V1 and V2 (NCT).- nccs⚠
Deprecated - Renamed to
light_color_single. - ncct⚠
Deprecated - Renamed to
light_color_triple. - outer_
product ⚠ - Outer product of IR with the rotation matrix diagonal (
OP,sf=1). - project_
single ⚠ - Perspective-project V0 (
RTPS,sf=1, lm=0). - project_
triple ⚠ - Perspective-project V0, V1 and V2 in sequence (
RTPT,sf=1, lm=0). - rotate_
translate_ ⚠v0 - Rotate V0 by RT and add TR, without the perspective divide
(
MVMVAwithmx=RT, vx=V0, cv=TR, sf=1, lm=0). - rotate_
v0_ ⚠far_ color - Rotate V0 by RT with the far color as the translation
(
MVMVAwithmx=RT, vx=V0, cv=FC, sf=1, lm=0). - rtps⚠
Deprecated - Renamed to
project_single. - rtpt⚠
Deprecated - Renamed to
project_triple. - scale_
vector ⚠ - Scale the IR vector by IR0 into MAC, then push the color FIFO
(
GPF,sf=1). - scale_
vector_ ⚠accumulate - Add the IR vector scaled by IR0 to MAC, then push the color FIFO
(
GPL,sf=1). - scale_
vector_ ⚠unshifted - Scale the IR vector by IR0 into MAC, then push the color FIFO, without
the fractional right shift (
GPF,sf=0). - screen_
winding ⚠ - Winding of the three SXY entries (
NCLIP): the Z component of(SXY1-SXY0) × (SXY2-SXY0)into MAC0. - square⚠
- Square the current IR vector into MAC1/2/3 (
SQR,sf=1). - square_
unshifted ⚠ - Square the current IR vector into MAC1/2/3 without the fractional
right shift (
SQR,sf=0).