Reality Display Processor/Commands: Difference between revisions

Start Set Other Modes
(Set Combine Mode)
(Start Set Other Modes)
Line 705:
* 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.
 
====<span style="display:none;">0x2f - Set_Other_ModesSet Other Modes ====
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
! colspan="17"|Set_Other_ModesSet Other Modes <code>0x2f</code>
|-
| 63:48 || — || — || colspan=6| command = 0x2f[5:0] || other.atomicPrimitiveatomic_prim || other.reserved1- || colspan=2| other.cycleTypecycle_type[1:0] || other.perspectivepersp_tex_en || other.detailTexturedetail_tex_en || other.sharpenTexturesharpen_tex_en || other.lodTexturetex_lod_en
|-
| 47:32 || other.tluttlut_en || other.tlutTypetlut_type || other.sampleTypesample_type || other.midTexelmid_texel || other.bilerp[0]bi_lerp_0 || other.bilerp[1]bi_lerp_1 || other.convertOneconvert_one || other.colorKeykey_en || colspan=2| other.colorDitherModergb_dither_sel[1:0] || colspan=2| other.alphaDitherModealpha_dither_sel[1:0] || colspan=4| other.reserved2[3:0]-
|-
| 31:16 || colspan=2| other.blend1a[0]bl_m1a_0[1:0] || colspan=2| other.blend1a[1]bl_m1a_1[1:0] || colspan=2| other.blend1b[0]bl_m1b_0[1:0] || colspan=2| other.blend1b[1]bl_m1b_1[1:0] || colspan=2| other.blend2a[0]bl_m2a_0[1:0] || colspan=2| other.blend2a[1]bl_m2a_1[1:0] || colspan=2| other.blend2b[0]bl_m2b_0[1:0] || colspan=2| other.blend2b[1]bl_m2b_1[1:0]
|-
| 15:0 || other.reserved3- || other.forceBlendforce_blend || other.alphaCoveragealpha_cvg_select || other.coverageXalphacvg_x_alpha || colspan=2| other.zModez_mode[1:0] || colspan=2| other.coverageModecvg_dest[1:0] || other.colorOnCoveragecolor_on_cvg || other.imageReadimage_read_en || other.zUpdatez_update_en || other.zComparez_compare_en || other.antialiasantialias_en || other.zSourcez_source_sel || other.ditherAlphadither_alpha_en || other.alphaComparealpha_compare_en
|}
{{#invoke:Register table|definitions
| 61:56 | command[5:0] | 0x2f
| 55 | atomic_prim | Enables span buffer coherency, forces active span segments to be written to the frame buffer before reading new span segments
| 55 | other.atomicPrimitive | ?
| 54 | other.reserved1- | ?
| 53:52 | cycle_type[1:0] | Determines pipeline mode. Either 1-Cycle (0), 2-Cycle (1), COPY (2), FILL (3)
| 53:52 | other.cycleType[1:0] | -
| 51 | persp_tex_en | Enables perspective correction of texture coordinates
| 51 | other.perspective | ?
| 50 | detail_tex_en | Enables "detail texture" mode in Texture LOD
| 50 | other.detailTexture | ?
| 49 | sharpen_tex_en | Enables "sharpen texture" mode in Texture LOD
| 49 | other.sharpenTexture | ?
| 48 | tex_lod_en | Enables Texture Level of Detail (LOD)
| 48 | other.lodTexture | ?
| 47 | tlut_en | Enables Texture Look-Up Table (TLUT) sampling. Texels are first fetched from low TMEM that are then used to index a palette in high TMEM to find the final color values.
| 47 | other.tlut | ?
| 46 | tlut_type | Determines TLUT texel format. Either RGBA16 (0) or IA16 (1)
| 46 | other.tlutType | ?
| 45 | sample_type | Determines texel sampling mode. Either point-sampled (0) or 2x2 bilinear (1)
| 45 | other.sampleType | ?
| 44 | mid_texel | Determines bilinear filter mode. Either 3-point (0) or average mode (1)
| 44 | other.midTexel | ?
| 43 | bi_lerp_0 | Determines texture filter mode for the first cycle. Either YUV to RGB conversion (See '''Set Convert''') (0) or bilinear filter (1)
| 43 | other.bilerp[0] | ?
| 42 | bi_lerp_1 | Determines texture filter mode for the second cycle. Either YUV to RGB conversion (See '''Set Convert''') (0) or bilinear filter (1)
| 42 | other.bilerp[1] | ?
| 41 | convert_one | Determines the input to the second texture filter stage. Either the sample from the second stage of texture sampling (0) or the result from the first texture filter cycle (1)
| 41 | other.convertOne | ?
| 40 | key_en | Enables chroma keying following the Color Combiner stage
| 40 | other.colorKey | ?
| 39:38 | other.colorDitherModergb_dither_sel[1:0] | -Set RGB dither mode
| 37:36 | other.alphaDitherModealpha_dither_sel[1:0] | -Set Alpha dither mode
| 35:32 | other.reserved2[3:0]- | -?
| 31:30 | other.blend1a[0]bl_m1a_0[1:0] | -Blender input P (first cycle)
| 29:28 | other.blend1a[1]bl_m1a_1[1:0] | -Blender input P (second cycle)
| 27:26 | other.blend1b[0]bl_m1b_0[1:0] | -Blender input A (first cycle)
| 25:24 | other.blend1b[1]bl_m1b_1[1:0] | -Blender input A (second cycle)
| 23:22 | other.blend2a[0]bl_m2a_0[1:0] | -Blender input M (first cycle)
| 21:20 | other.blend2a[1]bl_m2a_1[1:0] | -Blender input M (second cycle)
| 19:18 | other.blend2b[0]bl_m2b_0[1:0] | -Blender input B (first cycle)
| 17:16 | other.blend2b[1]bl_m2b_1[1:0] | -Blender input B (second cycle)
| 15 | other.reserved3- | ?
| 14 | force_blend | Enables blending for all pixels rather than only edge pixels
| 14 | other.forceBlend | ?
| 13 | alpha_cvg_select | Use coverage (or coverage multiplied by CC alpha) for alpha input to blender rather than alpha output from CC
| 13 | other.alphaCoverage | ?
| 12 | cvg_x_alpha | Multiply coverage and alpha from CC (used in conjunction with alpha_cvg_sel)
| 12 | other.coverageXalpha | ?
| 11:10 | other.zModez_mode[1:0] | Determines z-buffer comparator mode
| 9:8 | other.coverageModecvg_dest[1:0] | -Determines coverage output mode
| 7 | color_on_cvg | If enabled, writes the blender output only if coverage overflowed, otherwise write the 2B input verbatim
| 7 | other.colorOnCoverage | ?
| 6 | image_read_en | Enable color image reading
| 6 | other.imageRead | ?
| 5 | z_update_en | Enable z-buffer writing
| 5 | other.zUpdate | ?
| 4 | z_compare_en | Enable z-buffer reading and depth comparison
| 4 | other.zCompare | ?
| 3 | antialias_en | Enable anti-aliasing, which may enable blending on edge pixels
| 3 | other.antialias | ?
| 2 | z_source_sel | Selects either per-pixel (0) or primitive (1) depth as depth source to compare against the z-buffer
| 2 | other.zSource | ?
| 1 | dither_alpha_en | Determines alpha compare threshold source. (0 blend color register alpha, 1 random)
| 1 | other.ditherAlpha | ?
| 0 | alpha_compare_en | Enables alpha compare, pixels below the alpha threshold (compared against CC alpha output) are not written
| 0 | other.alphaCompare | ?
}}
 
Configures the RDP "Other Modes", a collection of global settings.
 
'''RGB dither modes'''
 
{| class="wikitable"
! Value !! Description
|-
| 0 || 4x4 Magic Square dither matrix
|-
| 1 || 4x4 Bayer dither matrix
|-
| 2 || Random noise
|-
| 3 || Disabled, no dithering applied
|}
 
'''Alpha dither modes'''
 
{| class="wikitable"
! Value !! Description
|-
| 0 || Same pattern as chosen in RGB. If noise was chosen, use magic square. If RGB dither was disabled, use bayer.
|-
| 1 || Inverse of the same pattern as chosen in RGB. Same rules as above if RGB was noise or disabled.
|-
| 2 || Random noise
|-
| 3 || Disabled, no dithering applied
|}
 
'''Z modes'''
 
{| class="wikitable"
! Value !! Description
|-
| 0 || Opaque surface mode.
|-
| 1 || Interpenetrating surface mode.
|-
| 2 || Transparent surface mode.
|-
| 3 || Decal surface mode.
|}
 
'''Coverage destination modes'''
 
{| class="wikitable"
! Value !! Description
|-
| 0 || Clamp. Sums new and old coverage, clamps to full if there is an overflow.
|-
| 1 || Wrap. Sums new and old coverage, writes this sum modulo 8.
|-
| 2 || Full. Always write full coverage.
|-
| 3 || Save. Always write old coverage, discard new coverage. Requires image_read_en, otherwise it will behave like Full.
|}
 
'''Blender Configuration'''
 
Other modes include the blender input configuration. The blender computes either
 
<math>p \cdot a + m \cdot b</math>
 
or
 
<math>\frac{p \cdot a + m \cdot b}{a + b}</math>
 
The latter is performed only when force_blend is disabled and anti-aliasing is enabled, where it is performed only on edge pixels.
 
'''Blender P and M Inputs'''
 
{| class="wikitable"
! Value !! Description
|-
| 0 || First cycle: output color from Color Combiner final stage; Second cycle: output color from first blender cycle
|-
| 1 || Memory color from framebuffer
|-
| 2 || Blend color register RGB
|-
| 3 || Fog color register RGB
|}
 
'''Blender A Inputs'''
 
{| class="wikitable"
! Value !! Description
|-
| 0 || Output alpha from Color Combiner final stage
|-
| 1 || Fog color register Alpha
|-
| 2 || Shade Alpha (interpolated per-pixel)
|-
| 3 || Fixed 0.0
|}
 
'''Blender B Inputs'''
 
{| class="wikitable"
! Value !! Description
|-
| 0 || 1.0 - A, where A is the other alpha input
|-
| 1 || Memory coverage from framebuffer
|-
| 2 || Fixed 1.0
|-
| 3 || Fixed 0.0
|}
 
'''Hazards'''
* This is a pipeline configuration command that requires pipeline synchronization before use, otherwise currently rendering primitives may be partially rendered using both the old other modes configuration and the new other modes configuration.
* Blender hazards:
** If memory color was set as a blender input, image_read_en should be enabled for proper operation.
** If memory coverage was set as a blender input, image_read_en should be enabled for proper operation. If it is left disabled, memory coverage is set to full.
** 2-Cycle mode pipeline bug: In the first cycle of 2-cycle mode, memory color is read from the previous pixel.
** 2-Cycle mode pipeline bug: In the first cycle of 2-cycle mode, memory coverage is read from the previous pixel.
** 2-Cycle mode pipeline bug: In the second cycle of 2-cycle mode, shade alpha is read from the next pixel.
 
====<span style="display:none;">0x30 - Load_Texture_LUT ====
56

edits