SPA 5.0:
{@{!}Pg}
IPA{.mode}{.msi}{.SAT}
Rd, a[ImmU10]{{, Rb{, Rc}}{,{!}Pmul}}
{&req_6}
{&rdN}
{&wrN}
{?sched}
;
{@{!}Pg}
IPA.IDX{.PASS}{.msi}{.SAT}
Rd, a[Ra]{, RZ, Rc}, {!}Puniform
{&req_6}
{&rdN}
{&wrN}
{?sched}
;
{@{!}Pg}
IPA.IDX{.MUL}{.msi}{.SAT}
Rd, a[Ra], Rb{, Rc}, {!}Puniform
{&req_6}
{&rdN}
{&wrN}
{?sched}
;
{@{!}Pg}
IPA.IDX{.CONSTANT}{.msi}{.SAT}
Rd, a[Ra]{, RZ, Rc}, {!}Puniform
{&req_6}
{&rdN}
{&wrN}
{?sched}
;
// Note: Rc useless
.mode: { .PASS, .MUL*, .CONSTANT, .SC } .msi: { .CENTER*, .CENTROID, .OFFSET, INVALID } .SAT: Output saturate to (+0.0,1.0) that maps NaN to +0.0. The saturation step will always interpret the IPA result as an fp32 value, and apply a denormal flush before saturation. Because the IS_FRONT_FACE attribute returns a boolean result (0x0000_0000 or 0xFFFF_FFFF), the .SAT modifier is ignored for this attribute.
{@{!}Pg}
IPA.IDX{.SC}{.msi}{.SAT}
Rd, a[Ra], Rb{, Rc}, {!}Puniform
{&req_6}
{&rdN}
{&wrN}
{?sched}
;
Evaluate an attribute for this fragment.
If .IDX modifier is not specified (immediate IPA), the #immU10 ( unsigned
10b immediate) is treated as byte addressed logical attribute.
If .IDX modifier is specified (indexed IPA), then Ra is treated a 32 bit
al2pResult_ps_t data structure containing physical attribute byte offset in TRAM. This structure is
usually generated by a previous AL2P instruction.
The triangle ram (TRAM) is accessed at the specified address, and the (A,B,C) plane equation is retrieved. Interpolation then returns Ax+By+C, where (x,y) is the pixel's sample location.
.mode controls the interpolation mode:
The Pmul predicate value should be set to false if the result of the interpolation multiply would not change the interpolation result (i.e. the multiplicand in Rb is 1.0). Pmul is ignored if .SAT is set.
Pmul is PT by default.
.msi controls the sampling mode:
- Rc contains sample (dx,dy) dx[15:00], format is integer pixel[15:12].subpixel[11:00] dy[31:16], format is integer pixel[31:28].subpixel[27:16] - add the (dx,dy) pair of 4.12 signed offsets from the center of the pixel before the position is interpolated. 1111.100000000000 = -8/16 1111.100100000000 = -7/16 1111.101000000000 = -6/16 1111.101100000000 = -5/16 1111.110000000000 = -4/16 1111.110100000000 = -3/16 1111.111000000000 = -2/16 1111.111100000000 = -1/16 0000.000000000000 = 0/16 // center of pixel 0000.000100000000 = 1/16 0000.001000000000 = 2/16 0000.001100000000 = 3/16 0000.010000000000 = 4/16 0000.010100000000 = 5/16 0000.011000000000 = 6/16 0000.011100000000 = 7/16
NOTE: We only implement 0.4b offsets, so the upper 4b and lower 8b are currently ignored. This allows interpolation at all 16*16 sub-pixel locations.
See the PIXLD instruction for retrieving dx,dy and coverage information for a sub-sample.
The Puniform predicate value indicates if the attribute to index is warp-uniform. If Puniform has a value of true, the HW can optimize the interpolation writeback. It is required that Puniform has the correct value, for this optimization to work. If Puniform has a value of true, and the attribute index is not warp-uniform, the behavior of this instruction is UNPREDICTABLE.
IPA.PASS R4, a[0x7c]; # interpolate WPOS.w = 1/w MUFU.RCP R4, R4; # w IPA.MUL R0, a[0x300], R4; # s: interpolate TEX0.s = s/w, multiply by w IPA.MUL R1, a[0x304], R4; # t: interpolate TEX0.t = t/w, multiply by w IPA.PASS R1, a[ 0x7c]; # WPOS.w FCMP.NE P0, R1, 1.0; MUFU.RCP R1, R1; IPA.MUL R0, a[0x300], R1, P0; # TEX0.s IPA.MUL R1, a[0x304], R1, P0; # TEX0.t AL2P P0, R5, R6, 0; IPA.IDX.PASS R2, a[R5], P0; # indexed IPA, with attribute pointed to by R6