Reality Display Processor/Commands: Difference between revisions
Hazard: Alpha compare in COPY mode targeting 16-bit framebuffers is only valid for RGBA5551 textures
(Parameter names and short descriptions for Triangle commands) |
(Hazard: Alpha compare in COPY mode targeting 16-bit framebuffers is only valid for RGBA5551 textures) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 20:
|}
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 41:
(TOVERIFY all of these command ids appear to behave as no-ops and take only 1 cycle to execute in testing so far, however this should be checked more extensively)
===
----
The Fill Triangle command varies in length depending on whether shade, texture or depth is enabled in the first word. For any of these properties that are enabled, additional words are appended to the base command words in order of shading, texturing, z-buffering.
==== Base Command ====
Every triangle type begins with a common base that describes the type, shape and other small properties of the triangle.
{| class="wikitable" style="text-align: center; white-space:nowrap;"
! colspan="18"|Fill Triangle <code>0x08</code> through <code>0x0F</code> (base)
|-
| rowspan="4"|Word 0 || 63:48 || — || — || 0 || 0 || 1 || shade || texture || zbuffer || lmajor || — || colspan=3| level[2:0] || colspan=3| tile[2:0]
Line 113 ⟶ 120:
}}
----
==== Optional Shading Properties ====
If the '''shade''' bit was set in the base triangle description, the above words will be followed by these 8 words describing triangle shading properties:
{| class="wikitable" style="text-align: center; white-space:nowrap;"
! colspan="18"|Fill Shaded Triangle (suffix)
|-
| rowspan="4"|Word 0 || 63:48 || - || - || - || - || - || - || - || colspan=9| r.i[8:0]
Line 241 ⟶ 250:
}}
----
==== Optional Texturing Properties ====
If the '''texture''' bit was set in the base triangle description, the above words will be followed by these 8 words describing triangle texturing properties:
{| class="wikitable" style="text-align: center; white-space:nowrap;"
! colspan="18"|Fill Textured Triangle (
|-
| rowspan="4"|Word 0 || 63:48 || colspan=16| s.i[15:0]
Line 360 ⟶ 372:
}}
----
==== Optional Depth Properties ====
If the '''zbuffer''' bit was set in the base triangle description, the above words will be followed by these 2 words describing triangle depth properties:
{| class="wikitable" style="text-align: center; white-space:nowrap;"
! colspan="18"| Fill Z-Buffered Triangle (
|-
| rowspan="4"|Word 0 || 63:48 || colspan=16| z.i[15:0]
Line 397 ⟶ 412:
}}
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 449 ⟶ 464:
* In 1-Cycle and 2-Cycle mode using attributes such as shade color and per-pixel depth may be ill-defined. (TOVERIFY: It's either always 0 or uses the last value from previous primitives, check which)
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 470 ⟶ 485:
The stall is always 25 cycles and does not wait on any particular internal signal(s), if a Sync Load is queued when it is not needed it simply wastes the full length of time.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 493 ⟶ 508:
(TOVERIFY/Speculation: Changing an attribute without a sync typically corrupts only up to at most 24 pixels of the last primitive, suggesting the RDP pixel pipeline is ~24 cycles deep. Can a tile sync account for all or at least almost all attribute changes?)
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 514 ⟶ 529:
The stall is always 33 cycles and does not wait on any particular internal signal(s), if a Sync Tile is queued when it is not needed it simply wastes the full length of time.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 535 ⟶ 550:
'''Hazards'''
* Ensure this is the final command consumed before hitting DP_END, otherwise the RDP may hang.
* Ensure no other commands are sent to RDP (via DP_START/DP_END) while a Sync Full is in progress, otherwise the RDP may hang.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 567 ⟶ 583:
Key center and scale are Color Combiner inputs, the expectation is that the Color Combiner is configured to <math>(X - \mathrm{Center}) \cdot \mathrm{Scale}</math> when chroma keying, where <math>X</math> is any color source. If not chroma keying, these may be used as general-purpose Color Combiner inputs.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 589 ⟶ 605:
Sets Chroma Key parameters for the red color channel. See '''Set Key GB''' for discussion.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 641 ⟶ 657:
K4 and K5 may also simply be used as additional general-purpose CC inputs.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 677 ⟶ 693:
* In FILL mode sometimes scissor works at the level of individual pixels while sometimes it only works at 4-pixel boundaries. (TODO understand this better, probably to do with memory alignment)
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 705 ⟶ 721:
* 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.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 876 ⟶ 892:
'''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.
* Alpha compare in COPY mode targeting 16-bit framebuffers is only valid for RGBA5551 textures, it only considers the least-significant bit in the sampled texel for determining whether to write it.
* Blender hazards:
** If memory color was set as a blender input, image_read_en should be enabled for proper operation.
Line 883 ⟶ 900:
** 2-Cycle mode pipeline bug: In the second cycle of 2-cycle mode, shade alpha is read from the next pixel.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 915 ⟶ 932:
* For correct sampling, the base TMEM address for a TLUT must be aligned to 16 TMEM words or 128 bytes.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 943 ⟶ 960:
The lower-right coordinate specifies the upper extents for clamp/mask/mirror in texture sampling.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 975 ⟶ 992:
* Load Block sets the tile size for the associated tile descriptor to (upper_left.s, upper_left.t, lower_right.s, dxt). This is generally not a useful configuration for rendering the image.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 1,007 ⟶ 1,024:
* Loads that extend past the end of TMEM will wrap back to the start.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 1,116 ⟶ 1,133:
|}
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 1,151 ⟶ 1,168:
* In COPY mode, fill rectangle behaves like texture rectangle with all texture attributes (tile, s, t, dsdx, dtdy) set to 0. (TOVERIFY: as above, is it always 0 or is it left over values from previous primitives?)
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 1,180 ⟶ 1,197:
* 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.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 1,208 ⟶ 1,225:
* 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.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 1,236 ⟶ 1,253:
* 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.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 1,275 ⟶ 1,292:
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.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 1,303 ⟶ 1,320:
* 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.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 1,560 ⟶ 1,577:
* The 1 input is valued at 256, not 255. This may contribute to overflow issues.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 1,618 ⟶ 1,635:
* 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.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
Line 1,642 ⟶ 1,659:
* Memory alignment must be 64-byte for all rendering operations to behave as expected.
===
----
{| class="wikitable" style="text-align: center; white-space:nowrap;"
|