Reality Display Processor/Commands

Revision as of 09:13, 14 March 2024 by Tharo (talk | contribs) (Set Primitive Depth)
0 1 2 3 4 5 6 7
0x00 No Operation No Operation No Operation No Operation No Operation No Operation No Operation No Operation
0x08 Fill Triangle Fill Triangle (Z) Fill Triangle (T) Fill Triangle (TZ) Fill Triangle (S) Fill Triangle (SZ) Fill Triangle (ST) Fill Triangle (STZ)
0x10 No Operation No Operation No Operation No Operation No Operation No Operation No Operation No Operation
0x18 No Operation No Operation No Operation No Operation No Operation No Operation No Operation No Operation
0x20 No Operation No Operation No Operation No Operation Texture Rectangle Texture Rectangle Flip Sync Load Sync Pipe
0x28 Sync Tile Sync Full Set Key GB Set Key R Set Convert Set Scissor Set Primitive Depth Set Other Modes
0x30 Load TLUT No Operation Set Tile Size Load Block Load Tile Set Tile Fill Rectangle Set Fill Color
0x38 Set Fog Color Set Blend Color Set Primitive Color Set Environment Color Set Combine Mode Set Texture Image Set Depth Image Set Color Image

0x08 through 0x0F - Triangle


Triangle 0x08 through 0x0F
Word 0 63:48 0 0 1 shade texture zbuffer lmajor level[2:0] tile[2:0]
47:32 y.lo[13:0]
31:16 y.md[13:0]
15:0 y.hi[13:0]
Word 1 63:48 x.lo.c.i[15:0]
47:32 x.lo.c.f[15:0]
31:16 x.lo.s.i[15:0]
15:0 x.lo.s.f[15:0]
Word 2 63:48 x.hi.c.i[15:0]
47:32 x.hi.c.f[15:0]
31:16 x.hi.s.i[15:0]
15:0 x.hi.s.f[15:0]
Word 3 63:48 x.md.c.i[15:0]
47:32 x.md.c.f[15:0]
31:16 x.md.s.i[15:0]
15:0 x.md.s.f[15:0]

Word 0

bit 61:56 command: 0x08 through 0x0F depending on features specified
bit 58 shade: if 1, command is followed by 8 words specifying shading instructions
bit 57 texture: if 1, command is followed by 8 words specifying texturing instructions
bit 56 zbuffer: if 1, command is followed by 2 words specifying zbuffering instructions
bit 55 lmajor: ?
bit 53:51 level[2:0]: -
bit 50:48 tile[2:0]: -
bit 45:32 y.lo[13:0]: -
bit 29:16 y.md[13:0]: -
bit 13:0 y.hi[13:0]: -

Word 1

bit 63:48 x.lo.c.i[15:0]: -
bit 47:32 x.lo.c.f[15:0]: -
bit 31:16 x.lo.s.i[15:0]: -
bit 15:0 x.lo.s.f[15:0]: -

Word 2

bit 63:48 x.hi.c.i[15:0]: -
bit 47:32 x.hi.c.f[15:0]: -
bit 31:16 x.hi.s.i[15:0]: -
bit 15:0 x.hi.s.f[15:0]: -

Word 3

bit 63:48 x.md.c.i[15:0]: -
bit 47:32 x.md.c.f[15:0]: -
bit 31:16 x.md.s.i[15:0]: -
bit 15:0 x.md.s.f[15:0]: -

0x0C through 0x0F - Shaded Triangle


After above 4 words describing a triangle, if requested by the command, these 8 words describing shading instructions:

Shaded Triangle (suffix) 0x0C0x0F
Word 0 63:48 r.c.i[15:0]
47:32 g.c.i[15:0]
31:16 b.c.i[15:0]
15:0 a.c.i[15:0]
Word 1 63:48 r.x.i[15:0]
47:32 g.x.i[15:0]
31:16 b.x.i[15:0]
15:0 a.x.i[15:0]
Word 2 63:48 r.c.f[15:0]
47:32 g.c.f[15:0]
31:16 b.c.f[15:0]
15:0 a.c.f[15:0]
Word 3 63:48 r.x.f[15:0]
47:32 g.x.f[15:0]
31:16 b.x.f[15:0]
15:0 a.x.f[15:0]
Word 4 63:48 r.e.i[15:0]
47:32 g.e.i[15:0]
31:16 b.e.i[15:0]
15:0 a.e.i[15:0]
Word 5 63:48 r.y.i[15:0]
47:32 g.y.i[15:0]
31:16 b.y.i[15:0]
15:0 a.y.i[15:0]
Word 6 63:48 r.e.f[15:0]
47:32 g.e.f[15:0]
31:16 b.e.f[15:0]
15:0 a.e.f[15:0]
Word 7 63:48 r.y.f[15:0]
47:32 g.y.f[15:0]
31:16 b.y.f[15:0]
15:0 a.y.f[15:0]

Word 0

bit 63:48 r.c.i[15:0]: -
bit 47:32 g.c.i[15:0]: -
bit 31:16 b.c.i[15:0]: -
bit 15:0 a.c.i[15:0]: -

Word 1

bit 63:48 r.x.i[15:0]: -
bit 47:32 g.x.i[15:0]: -
bit 31:16 b.x.i[15:0]: -
bit 15:0 a.x.i[15:0]: -

Word 2

bit 63:48 r.c.f[15:0]: -
bit 47:32 g.c.f[15:0]: -
bit 31:16 b.c.f[15:0]: -
bit 15:0 a.c.f[15:0]: -

Word 3

bit 63:48 r.x.f[15:0]: -
bit 47:32 g.x.f[15:0]: -
bit 31:16 b.x.f[15:0]: -
bit 15:0 a.x.f[15:0]: -

Word 4

bit 63:48 r.e.i[15:0]: -
bit 47:32 g.e.i[15:0]: -
bit 31:16 b.e.i[15:0]: -
bit 15:0 a.e.i[15:0]: -

Word 5

bit 63:48 r.y.i[15:0]: -
bit 47:32 g.y.i[15:0]: -
bit 31:16 b.y.i[15:0]: -
bit 15:0 a.y.i[15:0]: -

Word 6

bit 63:48 r.e.f[15:0]: -
bit 47:32 g.e.f[15:0]: -
bit 31:16 b.e.f[15:0]: -
bit 15:0 a.e.f[15:0]: -

Word 7

bit 63:48 r.y.f[15:0]: -
bit 47:32 g.y.f[15:0]: -
bit 31:16 b.y.f[15:0]: -
bit 15:0 a.y.f[15:0]: -

0x0A, 0x0B, 0x0E, 0x0F - Textured Triangle


After above 4 words describing a triangle, and optional 8 words describing shading, these 8 words describing texturing instructions:

Textured Triangle (A,B,E,F)
Word 0 63:48 s.c.i[15:0]
47:32 t.c.i[15:0]
31:16 w.c.i[15:0]
15:0
Word 1 63:48 s.x.i[15:0]
47:32 t.x.i[15:0]
31:16 w.x.i[15:0]
15:0
Word 2 63:48 s.c.f[15:0]
47:32 t.c.f[15:0]
31:16 w.c.f[15:0]
15:0
Word 3 63:48 s.x.f[15:0]
47:32 t.x.f[15:0]
31:16 w.x.f[15:0]
15:0
Word 4 63:48 s.e.i[15:0]
47:32 t.e.i[15:0]
31:16 w.e.i[15:0]
15:0
Word 5 63:48 s.y.i[15:0]
47:32 t.y.i[15:0]
31:16 w.y.i[15:0]
15:0
Word 6 63:48 s.e.f[15:0]
47:32 t.e.f[15:0]
31:16 w.e.f[15:0]
15:0
Word 7 63:48 s.y.f[15:0]
47:32 t.y.f[15:0]
31:16 w.y.f[15:0]
15:0

Word 0

bit 63:48 s.c.i[15:0]: -
bit 47:32 t.c.i[15:0]: -
bit 31:16 w.c.i[15:0]: -

Word 1

bit 63:48 s.x.i[15:0]: -
bit 47:32 t.x.i[15:0]: -
bit 31:16 w.x.i[15:0]: -

Word 2

bit 63:48 s.c.f[15:0]: -
bit 47:32 t.c.f[15:0]: -
bit 31:16 w.c.f[15:0]: -

Word 3

bit 63:48 s.x.f[15:0]: -
bit 47:32 t.x.f[15:0]: -
bit 31:16 w.x.f[15:0]: -

Word 4

bit 63:48 s.e.i[15:0]: -
bit 47:32 t.e.i[15:0]: -
bit 31:16 w.e.i[15:0]: -

Word 5

bit 63:48 s.y.i[15:0]: -
bit 47:32 t.y.i[15:0]: -
bit 31:16 w.y.i[15:0]: -

Word 6

bit 63:48 s.e.f[15:0]: -
bit 47:32 t.e.f[15:0]: -
bit 31:16 w.e.f[15:0]: -

Word 7

bit 63:48 s.y.f[15:0]: -
bit 47:32 t.y.f[15:0]: -
bit 31:16 w.y.f[15:0]: -

0x09, 0x0B, 0x0D, 0x0F - Zbuffered Triangle


After above 4 words describing a triangle, optional 8 words describing shading, and optional 8 words describing texturing, these two words describing Zbuffering:

Zbuffered Triangle (9,B,D,F)
Word 0 63:48 d.i[15:0]
47:32 d.f[15:0]
31:16 x.i[15:0]
15:0 x.f[15:0]
Word 1 63:48 e.i[15:0]
47:32 e.f[15:0]
31:16 y.i[15:0]
15:0 y.f[15:0]

Word 0

bit 63:48 d.i[15:0]: -
bit 47:32 d.f[15:0]: -
bit 31:16 x.i[15:0]: -
bit 15:0 x.f[15:0]: -

Word 1

bit 63:48 e.i[15:0]: -
bit 47:32 e.f[15:0]: -
bit 31:16 y.i[15:0]: -
bit 15:0 y.f[15:0]: -

0x24 and 0x25 - Texture_Rectangle


Texture_Rectangle 0x24 and Texture_Rectangle_Flip 0x25
Word 0 63:48 command[5:0] = 0x24 or 0x25 x.lo[11:4]
47:32 x.lo[3:0] y.lo[11:0]
31:16 tile[2:0] x.hi[11:4]
15:0 x.hi[3:0] y.hi[11:0]
Word 1 63:48 s.i[15:0]
47:32 t.i[15:0]
31:16 s.f[15:0]
15:0 t.f[15:0]

Word 0

bit 61:56 command[5:0]: 0x24 (Texture_Rectangle) or 0x25 (Texture_Rectangle_Flip)
bit 55:44 x.lo[11:0]: -
bit 43:32 y.lo[11:0]: -
bit 26:24 tile[2:0]: -
bit 23:12 x.hi[11:0]: -
bit 11:0 y.hi[11:0]: -

Word 1

bit 63:48 s.i[15:0]: -
bit 47:32 t.i[15:0]: -
bit 31:16 s.f[15:0]: -
bit 15:0 t.f[15:0]: -

0x26 - Sync_Load


Sync_Load 0x26
63:48 command = 0x26[5:0]
47:32
31:16
15:0
bit 61:56 command[5:0]: 0x26

0x27 - Sync_Pipe


Sync_Pipe 0x27
63:48 command = 0x27[5:0]
47:32
31:16
15:0
bit 61:56 command[5:0]: 0x27

0x28 - Sync_Tile


Sync_Tile 0x28
63:48 command = 0x28[5:0]
47:32
31:16
15:0
bit 61:56 command[5:0]: 0x28

0x29 - Sync_Full


Sync_Full 0x29
63:48 command = 0x29[5:0]
47:32
31:16
15:0
bit 61:56 command[5:0]: 0x29

0x2a - Set_Key_GB


Set_Key_GB 0x2a
63:48 command = 0x2a[5:0] key.g.width[11:4]
47:32 key.g.width[3:0] key.b.width[11:0]
31:16 key.g.center[7:0] key.g.scale[7:0]
15:0 key.b.center[7:0] key.b.scale[7:0]
bit 61:56 command[5:0]: 0x2a
bit 55:44 key.g.width[11:0]: -
bit 43:32 key.b.width[11:0]: -
bit 31:24 key.g.center[7:0]: -
bit 23:16 key.g.scale[7:0]: -
bit 15:8 key.b.center[7:0]: -
bit 7:0 key.b.scale[7:0]: -

0x2b - Set_Key_R


Set_Key_R 0x2b
63:48 command = 0x2b[5:0]
47:32
31:16 key.r.width[11:0]
15:0 key.r.center[7:0] key.r.scale[7:0]
bit 61:56 command[5:0]: 0x2b
bit 27:16 key.r.width[11:0]: -
bit 15:8 key.r.center[7:0]: -
bit 7:0 key.r.scale[7:0]: -

0x2c - Set_Convert


Set_Convert 0x2c
63:48 command = 0x2c[5:0] convert.k[0][8:3]
47:32 convert.k[0][2:0] convert.k[1][8:0] convert.k[2][8:5]
31:16 convert.k[2][4:0] convert.k[3][8:0] convert.k[4][8:7]
15:0 convert.k[4][6:0] convert.k[5][7:0]
bit 61:56 command[5:0]: 0x2c
bit 53:45 convert.k[0][8:0]: -
bit 44:36 convert.k[1][8:0]: -
bit 35:27 convert.k[2][8:0]: -
bit 26:18 convert.k[3][8:0]: -
bit 17:9 convert.k[4][8:0]: -
bit 7:0 convert.k[5][7:0]: -

0x2d - Set_Scissor


Set_Scissor 0x2d
63:48 command = 0x2d[5:0] scissor.x.hi[11:4]
47:32 scissor.x.hi[3:0] scissor.y.hi[11:0]
31:16 scissor.field scissor.odd scissor.x.lo[11:4]
15:0 scissor.x.lo[3:0] scissor.y.lo[11:0]
bit 61:56 command[5:0]: 0x2d
bit 55:44 scissor.x.hi[11:0]: -
bit 43:32 scissor.y.hi[11:0]: -
bit 25 scissor.field: ?
bit 24 scissor.odd: ?
bit 23:12 scissor.x.lo[11:0]: -
bit 11:0 scissor.y.lo[11:0]: -

0x2e - Set Primitive Depth


Set Primitive Depth 0x2e
63:48 command = 0x2e[5:0]
47:32
31:16 z[15:0]
15:0 dz[15:0]
bit 61:56 command[5:0]: 0x2e
bit 31:16 z[15:0]: Primitive depth value
bit 15:0 dz[15:0]: Primitive dz value

Sets the primitive depth registers to the provided values. Primitive depth may be selected for depth compare instead of using per-pixel depth in the othermodes configuration. This is the only way to set a depth value for rectangle commands.

When used, the primitive depth value is taken to be the integer part of the s15.3 fixed-point z value, the fractional bits will be zero. Notably, due to not having control over the fractional bits it is impossible to configure a primitive depth value that writes the maximum possible depth value into the z-buffer.

Unlike the majority of other attribute-setters, primitive depth operates correctly even in the absence of pipeline synchronizations. Primitive depth may be changed between primitive rendering without corrupting prior primitives.

Hazards

  • The dz value provided should be a power of 2 to ensure correct operation. RDP hardware uses a cheap integer log2 algorithm for computing log2(dz) that is only guaranteed to produce correct results when the input is a power of 2. Notably, the value 0xFFFF happens to work correctly.

0x2f - Set_Other_Modes


Set_Other_Modes 0x2f
63:48 command = 0x2f[5:0] other.atomicPrimitive other.reserved1 other.cycleType[1:0] other.perspective other.detailTexture other.sharpenTexture other.lodTexture
47:32 other.tlut other.tlutType other.sampleType other.midTexel other.bilerp[0] other.bilerp[1] other.convertOne other.colorKey other.colorDitherMode[1:0] other.alphaDitherMode[1:0] other.reserved2[3:0]
31:16 other.blend1a[0][1:0] other.blend1a[1][1:0] other.blend1b[0][1:0] other.blend1b[1][1:0] other.blend2a[0][1:0] other.blend2a[1][1:0] other.blend2b[0][1:0] other.blend2b[1][1:0]
15:0 other.reserved3 other.forceBlend other.alphaCoverage other.coverageXalpha other.zMode[1:0] other.coverageMode[1:0] other.colorOnCoverage other.imageRead other.zUpdate other.zCompare other.antialias other.zSource other.ditherAlpha other.alphaCompare
bit 61:56 command[5:0]: 0x2f
bit 55 other.atomicPrimitive: ?
bit 54 other.reserved1: ?
bit 53:52 other.cycleType[1:0]: -
bit 51 other.perspective: ?
bit 50 other.detailTexture: ?
bit 49 other.sharpenTexture: ?
bit 48 other.lodTexture: ?
bit 47 other.tlut: ?
bit 46 other.tlutType: ?
bit 45 other.sampleType: ?
bit 44 other.midTexel: ?
bit 43 other.bilerp[0]: ?
bit 42 other.bilerp[1]: ?
bit 41 other.convertOne: ?
bit 40 other.colorKey: ?
bit 39:38 other.colorDitherMode[1:0]: -
bit 37:36 other.alphaDitherMode[1:0]: -
bit 35:32 other.reserved2[3:0]: -
bit 31:30 other.blend1a[0][1:0]: -
bit 29:28 other.blend1a[1][1:0]: -
bit 27:26 other.blend1b[0][1:0]: -
bit 25:24 other.blend1b[1][1:0]: -
bit 23:22 other.blend2a[0][1:0]: -
bit 21:20 other.blend2a[1][1:0]: -
bit 19:18 other.blend2b[0][1:0]: -
bit 17:16 other.blend2b[1][1:0]: -
bit 15 other.reserved3: ?
bit 14 other.forceBlend: ?
bit 13 other.alphaCoverage: ?
bit 12 other.coverageXalpha: ?
bit 11:10 other.zMode[1:0]: -
bit 9:8 other.coverageMode[1:0]: -
bit 7 other.colorOnCoverage: ?
bit 6 other.imageRead: ?
bit 5 other.zUpdate: ?
bit 4 other.zCompare: ?
bit 3 other.antialias: ?
bit 2 other.zSource: ?
bit 1 other.ditherAlpha: ?
bit 0 other.alphaCompare: ?

0x30 - Load_Texture_LUT


Load_Texture_LUT 0x30
63:48 command = 0x30[5:0] tlut.s.lo[11:4]
47:32 tlut.s.lo[3:0] tlut.t.lo[11:0]
31:16 tlut.index[2:0] tlut.s.hi[11:4]
15:0 tlut.s.hi[3:0] tlut.t.hi[11:0]
bit 61:56 command[5:0]: 0x30
bit 55:44 tlut.s.lo[11:0]: -
bit 43:32 tlut.t.lo[11:0]: -
bit 26:24 tlut.index[2:0]: -
bit 23:12 tlut.s.hi[11:0]: -
bit 11:0 tlut.t.hi[11:0]: -

0x31 - Invalid_31


Invalid_31 0x31
63:48 command = 0x31[5:0]
47:32
31:16
15:0
bit 61:56 command[5:0]: 0x31

0x32 - Set_Tile_Size


Set_Tile_Size 0x32
63:48 command = 0x32[5:0] tileSize.s.lo[11:4]
47:32 tileSize.s.lo[3:0] tileSize.t.lo[11:0]
31:16 tileSize.index[2:0] tileSize.s.hi[11:4]
15:0 tileSize.s.hi[3:0] tileSize.t.hi[11:0]
bit 61:56 command[5:0]: 0x32
bit 55:44 tileSize.s.lo[11:0]: -
bit 43:32 tileSize.t.lo[11:0]: -
bit 26:24 tileSize.index[2:0]: -
bit 23:12 tileSize.s.hi[11:0]: -
bit 11:0 tileSize.t.hi[11:0]: -

0x33 - Load_Block


Load_Block 0x33
63:48 command = 0x33[5:0] load_.block.s.lo[11:4]
47:32 load_.block.s.lo[3:0] load_.block.t.lo[11:0]
31:16 load_.block.index[2:0] load_.block.s.hi[11:4]
15:0 load_.block.s.hi[3:0] load_.block.t.hi[11:0]
bit 61:56 command[5:0]: 0x33
bit 55:44 load_.block.s.lo[11:0]: -
bit 43:32 load_.block.t.lo[11:0]: -
bit 26:24 load_.block.index[2:0]: -
bit 23:12 load_.block.s.hi[11:0]: -
bit 11:0 load_.block.t.hi[11:0]: -

0x34 - Load_Tile


Load_Tile 0x34
63:48 command = 0x34[5:0] load_.tile.s.lo[11:4]
47:32 load_.tile.s.lo[3:0] load_.tile.t.lo[11:0]
31:16 load_.tile.index[2:0] load_.tile.s.hi[11:4]
15:0 load_.tile.s.hi[3:0] load_.tile.t.hi[11:0]
bit 61:56 command[5:0]: 0x34
bit 55:44 load_.tile.s.lo[11:0]: -
bit 43:32 load_.tile.t.lo[11:0]: -
bit 26:24 load_.tile.index[2:0]: -
bit 23:12 load_.tile.s.hi[11:0]: -
bit 11:0 load_.tile.t.hi[11:0]: -

0x35 - Set_Tile


Set_Tile 0x35
63:48 command = 0x35[5:0] tile.format[2:0] tile.size[1:0] tile.line[8:7]
47:32 tile.line[6:0] tile.address[8:0]
31:16 tile.index[2:0] tile.palette[3:0] tile.t.clamp tile.t.mirror tile.t.mask[3:2]
15:0 tile.t.mask[1:0] tile.t.shift[3:0] tile.s.clamp tile.s.mirror tile.s.mask[3:0] tile.s.shift[3:0]
bit 61:56 command[5:0]: 0x35
bit 55:53 tile.format[2:0]: -
bit 52:51 tile.size[1:0]: -
bit 49:41 tile.line[8:0]: -
bit 40:32 tile.address[8:0]: -
bit 26:24 tile.index[2:0]: -
bit 23:20 tile.palette[3:0]: -
bit 19 tile.t.clamp: ?
bit 18 tile.t.mirror: ?
bit 17:14 tile.t.mask[3:0]: -
bit 13:10 tile.t.shift[3:0]: -
bit 9 tile.s.clamp: ?
bit 8 tile.s.mirror: ?
bit 7:4 tile.s.mask[3:0]: -
bit 3:0 tile.s.shift[3:0]: -

0x36 - Fill_Rectangle


Fill_Rectangle 0x36
63:48 command = 0x36[5:0] fillRectangle_.x.lo[11:4]
47:32 fillRectangle_.x.lo[3:0] fillRectangle_.y.lo[11:0]
31:16 fillRectangle_.x.hi[11:4]
15:0 fillRectangle_.x.hi[3:0] fillRectangle_.y.hi[11:0]
bit 61:56 command[5:0]: 0x36
bit 55:44 fillRectangle_.x.lo[11:0]: -
bit 43:32 fillRectangle_.y.lo[11:0]: -
bit 23:12 fillRectangle_.x.hi[11:0]: -
bit 11:0 fillRectangle_.y.hi[11:0]: -

0x37 - Set Fill Color


Set Fill Color 0x37
63:48 command = 0x37[5:0]
47:32
31:16 color[31:16]
15:0 color[15:0]
bit 61:56 command[5:0]: 0x37
bit 31:0 color[31:0]: Fill Color. Format varies based on color image pixel size, see below

Sets the fill color register, the color to use when rendering primitives in FILL mode. This is the only color sampled by FILL mode as all other pipeline stages are bypassed. This color is not made available to the Color Combiner or the Blender, and Fill Rectangle outside of FILL mode does not use it.

Since FILL mode simply repeats the 32-bit value verbatim out to memory, proper usage of the color parameter will depend on the color image configuration:

  • 32-bit: A single RGBA32 color occupying all 32 bits.
  • 16-bit: Two RGBA16 colors occupying the upper and lower 16 bits respectively. Even pixels sample the upper half and odd pixels sample the lower half. For filling the color image with a solid color, simply let the upper and lower halves hold the same value.
  • 8-bit: Four 8-bit intensity values, repeating every four pixels.
  • 4-bit: N/A, crash

Hazards

  • This is an attribute-setting command that requires pipeline synchronization before use, otherwise currently rendering primitives may be partially rendered using both the old fill color and the new fill color, if it was used.

0x38 - Set Fog Color


Set Fog Color 0x38
63:48 command = 0x38[5:0]
47:32
31:16 red[7:0] green[7:0]
15:0 blue[7:0] alpha[7:0]
bit 61:56 command[5:0]: 0x39
bit 31:24 red[7:0]: Fog Red Value
bit 23:16 green[7:0]: Fog Green Value
bit 15:8 blue[7:0]: Fog Blue Value
bit 7:0 alpha[7:0]: Fog Alpha Value

Sets the "Fog" color register to the provided RGBA value. This color is accessible from the Blender as an input.

The name "Fog" reflects only one particular usage of how the color may be used, the name does not relate to any particular meaning in the hardware.

Hazards

  • This is an attribute-setting command that requires pipeline synchronization before use, otherwise currently rendering primitives may be partially rendered using both the old fog color and the new fog color, if it was used.

0x39 - Set Blend Color


Set Blend Color 0x39
63:48 command = 0x39[5:0]
47:32
31:16 red[7:0] green[7:0]
15:0 blue[7:0] alpha[7:0]
bit 61:56 command[5:0]: 0x39
bit 31:24 red[7:0]: Blend Red Value
bit 23:16 green[7:0]: Blend Green Value
bit 15:8 blue[7:0]: Blend Blue Value
bit 7:0 alpha[7:0]: Blend Alpha Value

Sets the "Blend" color register to the provided RGBA value. This color is accessible from the Blender as an input.

The name "Blend" reflects only one particular usage of how the color may be used, the name does not relate to any particular meaning in the hardware.

Hazards

  • This is an attribute-setting command that requires pipeline synchronization before use, otherwise currently rendering primitives may be partially rendered using both the old blend color and the new blend color, if it was used.

0x3a - Set Primitive Color


Set Primitive Color 0x3a
63:48 command = 0x3a[5:0]
47:32 min_level[7:0] prim_lod_frac[7:0]
31:16 red[7:0] green[7:0]
15:0 blue[7:0] alpha[7:0]
bit 61:56 command[5:0]: 0x3a
bit 43:40 min_level[3:0]: Minimum LOD level
bit 39:32 prim_lod_frac[7:0]: Primitive LOD Fraction Color Combiner input
bit 31:24 red[7:0]: Primitive Red Value
bit 23:16 green[7:0]: Primitive Green Value
bit 15:8 blue[7:0]: Primitive Blue Value
bit 7:0 alpha[7:0]: Primitive Alpha Value

Sets the "Primitive" color register to the provided RGBA value, and some LOD parameters. The color is accessible from the Color Combiner as an input.

The name "Primitive" reflects only one particular usage of how the color may be used, the name does not relate to any particular meaning in the hardware.

prim_lod_frac is simply another Color Combiner input, despite the name it is not used by the texture LOD hardware feature. It may be used as a fixed interpolation factor.

min_level is used in the texture LOD hardware, it bounds the LOD tile selection from below. The LOD value selecting a particular tile N can be computed by

 

where Tbase is the tile number set in the triangle command. For texture rectangles this is tile 0.

If the LOD computed for a particular pixel during texture sampling is less than the minimum LOD level, tile 0 is used. Detail and sharpen modes may still apply. (TODO link to more detailed Texture LOD article)

Unlike the majority of other attribute-setters, primitive color operates correctly even in the absence of pipeline synchronizations. The primitive color may be changed between primitive rendering without corrupting prior primitives.

0x3b - Set Environment Color


Set Environment Color 0x3b
63:48 command = 0x3b[5:0]
47:32
31:16 red[7:0] green[7:0]
15:0 blue[7:0] alpha[7:0]
bit 61:56 command[5:0]: 0x3b
bit 31:24 red[7:0]: Environment Red value
bit 23:16 green[7:0]: Environment Green value
bit 15:8 blue[7:0]: Environment Blue value
bit 7:0 alpha[7:0]: Environment Alpha value

Sets the "Environment" color register to the provided RGBA value. This color is accessible from the Color Combiner as an input.

The name "Environment" reflects only one particular usage of how the color may be used, the name does not relate to any particular meaning in the hardware.

Hazards

  • This is an attribute-setting command that requires pipeline synchronization before use, otherwise currently rendering primitives may be partially rendered using both the old environment color and the new environment color, if it was used.

0x3c - Set_Combine_Mode


Set_Combine_Mode 0x3c
63:48 command = 0x3c[5:0] combine.sba.color[0][3:0] combine.mul.color[0][4:1]
47:32 combine.mul.color[0] combine.sba.alpha[0][2:0] combine.mul.alpha[0][2:0] combine.sba.color[1][3:0] combine.mul.color[1][4:0]
31:16 combine.sbb.color[0][3:0] combine.sbb.color[1][3:0] combine.sba.alpha[1][2:0] combine.mul.alpha[1][2:0] combine.add.color[0][2:1]
15:0 combine.add.color[0] combine.sbb.alpha[0][2:0] combine.add.alpha[0][2:0] combine.add.color[1][2:0] combine.sbb.alpha[1][2:0] combine.add.alpha[1][2:0]
bit 61:56 command[5:0]: 0x3c
bit 55:52 combine.sba.color[0][3:0]: -
bit 51:47 combine.mul.color[0][4:0]: -
bit 46:44 combine.sba.alpha[0][2:0]: -
bit 43:41 combine.mul.alpha[0][2:0]: -
bit 40:37 combine.sba.color[1][3:0]: -
bit 36:32 combine.mul.color[1][4:0]: -
bit 31:28 combine.sbb.color[0][3:0]: -
bit 27:24 combine.sbb.color[1][3:0]: -
bit 23:21 combine.sba.alpha[1][2:0]: -
bit 20:18 combine.mul.alpha[1][2:0]: -
bit 17:15 combine.add.color[0][2:0]: -
bit 14:12 combine.sbb.alpha[0][2:0]: -
bit 11:9 combine.add.alpha[0][2:0]: -
bit 8:6 combine.add.color[1][2:0]: -
bit 5:3 combine.sbb.alpha[1][2:0]: -
bit 2:0 combine.add.alpha[1][2:0]: -

0x3d - Set Texture Image


Set Texture Image 0x3d
63:48 command = 0x3d[5:0] format[2:0] size[1:0]
47:32 width[9:0]
31:16 dramAddress[23:16]
15:0 dramAddress[15:0]
bit 61:56 command[5:0]: 0x3d
bit 55:53 format[2:0]: Texture image format
bit 52:51 size[1:0]: Texture image pixel size
bit 41:32 width[9:0]: Texture image width in pixels (-1) (possible range of 1 to 4096 pixels)
bit 23:0 dramAddress[23:0]: RDRAM physical address of the buffer containing texture data

Sets the texture image, the location in RDRAM where the texture loading pipeline should source image data, and related properties.

The texture image format parameter seems to have no function, it has no effect on any operation unlike the tile format.

Format Name Format Value
RGBA 0
YUV 1
Color-Indexed (CI) 2
Intensity-Alpha (IA) 3
Intensity (I) 4+

The size parameter is used to increment the RDRAM address during texture loading.

Bits per pixel Size Value
4 0
8 1
16 2
32 3

The width parameter is used to calculate the start address of each texture image row during loading.

This is an attribute-setting command but is not used in the rendering pipeline so does not require a pipeline synchronization before changing it. (TOVERIFY is a sync required if changing it following a load command?)

Hazards

  • Memory alignment should be 8-byte to guarantee operation. If the address falls into the range [1,7] mod 64, the RDP may hang when loading from it.

0x3e - Set Depth Image


Set Depth Image 0x3e
63:48 command = 0x3e[5:0]
47:32
31:16 dramAddress[23:16]
15:0 dramAddress[15:0]
bit 61:56 command[5:0]: 0x3e
bit 23:0 dramAddress[23:0]: RDRAM physical address of the buffer to store depth information

Sets the depth image, the region in RDRAM where depth information will be stored. The depth image width is the same as the image width for the current color image. The depth buffer format is a fixed 18-bit-per-pixel format irrespective of the color image format.

Hazards

  • This attribute must be set before rendering any primitives that read or write depth, else it will read/write depth data at an unspecified location.
  • Memory alignment must be 64-byte for all rendering operations to behave as expected.

0x3f - Set Color Image


Set Color Image 0x3f
63:48 command = 0x3f[5:0] format[2:0] size[1:0]
47:32 width[9:0]
31:16 dramAddress[23:16]
15:0 dramAddress[15:0]
bit 61:56 command[5:0]: 0x3f
bit 55:53 format[2:0]: Pixel format (same meaning as in texture format)
bit 52:51 size[1:0]: Pixel size (same meaning as in texture size)
bit 41:32 width[9:0]: Image width in pixels (-1) (possible range of 1 to 4096 pixels)
bit 23:0 dramAddress[23:0]: RDRAM physical address of the buffer where pixels will be written

Sets the color image address and properties, the region in RDRAM where primitives will be rendered to as pixels.

The image is arrayed in row-order, that is rows are adjacent in memory. It is generally more efficient to draw wide triangles rather than horizontally thin triangles that overlap many rows; for single rows span buffers are employed to alleviate stalls due to waiting on memory read/write requests while there is no such buffering across multiple rows.

Valid format/size combinations are RGBA32, RGBA16, I8. 4-bit modes only write 0s as bytes, all 8-bit modes behave identically, 16-bit and 32-bit RGBA modes differ from other modes.

Hazards

  • This attribute must be set before rendering any primitives, else it will render to an unspecified location.
  • This is an attribute-setting command that requires pipeline synchronization before use, otherwise currently rendering primitives may be split partially between the old color image and new color image. (TOVERIFY there are conflicting accounts of whether Set Color Image requires a sync, the current consensus is that sync is required to avoid all edge cases)
  • Memory alignment must be 64-byte for all rendering operations to behave as expected.
  • Rendering any primitive in FILL mode to a 4-bit color image will crash the RDP.
  • Copying a 4-bit or 8-bit texture with COPY mode is only possible if the destination color image is 8-bit.
  • Copying a 16-bit texture with COPY mode is only possible if the destination color image is 16-bit. (Note that CI textures are treated as 16-bit in COPY mode as the TLUT is 16-bit)
  • COPY mode is unavailable when a 32-bit color image is configured.