tri D,S2,S1 draws a primitive using the fixed Triangle Engine parameter registers. Set DrawCtl[3:0] = 0xB before writing the parameters. The instruction performs a vector add before launch; it can load XY, ZQ, UV, RA, GB, R2F or G2B2 as part of the operation.
Launch takes one cycle after setup. Engine time is stated as 4 + scanlines + pixels cycles, excluding memory stalls. The RISC continues until it needs a shared resource or writes a busy shadowed register. There is a three-instruction hazard from tri to a Fill Engine instruction.
| Locations | Parameters |
|---|---|
a0..a13 / %128..%141 | XTop, YTop, Z, Q, R, A, G, B, R2, F, G2, B2, U, V |
a14 / %142 | dXLong/dy |
a16..a29 / %144..%157 | XMid, YMid and span gradients |
a30 / %158 | dXTop/dy |
q0 / %160 | dX: direction, swapxy and primitive type |
q1 / %161 | YBot |
q2..q13 / %162..%173 | Edge gradients |
q14 / %174 | dXBot/dy |
a15, a31 and q15 are not assigned triangle parameters. Full positions and formats are in the shadow register map.
Set the DrawCtl mono bit before writing color or color-gradient registers. With mono enabled, writing a component replicates it to the respective R, G and B values. There is no hazard between enabling shadowing and writing shadow registers.
Load all start values after enabling shadowing and before the first tri. Load dX and all edge X gradients. Initialize every iterated parameter before each tri; only gradients for enabled parameters are required. XTop, YTop and XMid always iterate. For a long edge on the left, dX is zero; for a long edge on the right, dX is 0x80000000.
Sort vertices by Y. The longest edge is walked in Y; spans go left-to-right when that edge is on the left and right-to-left when it is on the right. For parameter p:
E1_dpdy = (p2 - p0) / (y2 - y0) x3 = x0 + E1_dxdy * (y1 - y0) dpdx = (p1 - p3) / abs(x1 - x3)
The hardware applies Y subpixel correction to X, X2, Z, U, V and Q, and X subpixel correction to Z, U, V and Q. Color correction in Y may be done by microcode. Coverage includes pixels with X ≥ left edge and X < right edge. The edges must not intersect before YBot.
Q iteration enables perspective-correct U/V. DrawCtl also enables Z, diffuse color, specular color, alpha and fog iteration independently. Non-iterated Pixel Engine parameters retain their current values.
dX[3:1] selects triangle, line, span, dot or aaedge. Triangle uses edge and span gradients; line and aaedge use edge gradients; span uses span gradients; dot uses neither. swapxy makes X the major edge direction and applies to all primitive types.
Pixel processing · Context save
Sources: Technical Spec, p.16, Technical Spec, p.17, Technical Spec, p.18, Technical Spec, p.19, Technical Spec, p.20