Go to the documentation of this file. 16 #ifndef GX2_SHADER_INL_H 17 #define GX2_SHADER_INL_H 20 #define to_QWORD(w0, w1) (((u64)(w0) << 32ull) | (w1)) 21 #define to_LE(x) (__builtin_bswap32(x)) 23 #define to_QWORD(w0, w1) (((u64)(w1) << 32ull) | (w0)) 28 #define CF_DWORD0(addr) to_LE(addr) 30 #define CF_DWORD1(popCount, cfConst, cond, count, callCount, inst) \ 31 to_LE(popCount | (cfConst << 3) | (cond << 8) | (count << 10) | (callCount << 13) | (inst << 23) | (1 << 31)) 33 #define CF_ALU_WORD0(addr, kcacheBank0, kcacheBank1, kcacheMode0) \ 34 to_LE(addr | (kcacheBank0 << 22) | (kcacheBank1 << 26) | (kcacheMode0 << 30)) 35 #define CF_ALU_WORD1(kcacheMode1, kcacheAddr0, kcacheAddr1, count, altConst, inst) \ 36 to_LE(kcacheMode1 | (kcacheAddr0 << 2) | (kcacheAddr1 << 10) | (count << 18) | (altConst << 25) | (inst << 26) | (1 << 31)) 38 #define CF_EXP_WORD0(dstReg_and_type, srcReg, srcRel, indexGpr, elemSize)\ 39 to_LE(dstReg_and_type | (srcReg << 15) | (srcRel << 22) | (indexGpr << 23) | (elemSize << 30)) 41 #define CF_EXP_WORD1(srcSelX, srcSelY, srcSelZ, srcSelW, validPixelMode, inst) \ 42 to_LE(srcSelX | (srcSelY << 3) | (srcSelZ << 6) | (srcSelW << 9) | (validPixelMode << 22) | (inst << 23) | (1 << 31)) 44 #define CF_ALLOC_EXPORT_WORD0(arrayBase, type, dstReg, dstRel, indexGpr, elemSize) \ 45 to_LE(arrayBase | (type << 13) | (dstReg << 15) | (dstRel << 22) | (indexGpr << 23) | (elemSize << 30)) 47 #define CF_ALLOC_EXPORT_WORD1_BUF(arraySize, writeMask, inst) \ 48 to_LE(arraySize | (writeMask << 12) | (inst << 23) | (1 << 31)) 51 #define ALU_SRC_KCACHE0_BASE 0x80 52 #define ALU_SRC_KCACHE1_BASE 0xA0 53 #define CF_KCACHE_BANK_LOCK_1 0x1 56 #define _0_15 CF_KCACHE_BANK_LOCK_1 58 #define KC0(x) (x + ALU_SRC_KCACHE0_BASE) 59 #define KC1(x) (x + ALU_SRC_KCACHE1_BASE) 61 #define NO_BARRIER & ~to_QWORD(0,to_LE(1 << 31)) 62 #define END_OF_PROGRAM | to_QWORD(0,to_LE(1 << 21)) 63 #define VALID_PIX | to_QWORD(0,to_LE(1 << 22)) 64 #define WHOLE_QUAD_MODE | to_QWORD(0,to_LE(1 << 30)) 65 #define BURSTCNT(x) | to_QWORD(0,to_LE(x << 17)) 66 #define WRITE(x) (x >> 2) 67 #define ARRAY_SIZE(x) x 68 #define ELEM_SIZE(x) x 69 #define KCACHE0(bank, mode) | to_QWORD(CF_ALU_WORD0(0, bank, 0, mode), 0) 70 #define KCACHE1(bank, mode) | to_QWORD(CF_ALU_WORD0(0, 0, bank, 0), CF_ALU_WORD1(mode,0, 0, 0, 0, 0)) 74 #define UPDATE_EXEC_MASK(mode) | to_QWORD(0, to_LE(mode << 2)) 75 #define UPDATE_PRED | to_QWORD(0, to_LE(1ull << 3)) 76 #define CLAMP | to_QWORD(0, to_LE(1ull << 31)) 77 #define ALU_LAST | to_QWORD(to_LE(1ull << 31), 0) 81 #define ALU_WORD0(src0Sel, src0Rel, src0Chan, src0Neg, src1Sel, src1Rel, src1Chan, src1Neg, indexMode, predSel) \ 82 to_LE(src0Sel | ((src0Rel) << 9) | ((src0Chan) << 10) | ((src0Neg) << 12) | ((src1Sel) << 13) | ((src1Rel) << 22) \ 83 | ((src1Chan) << 23) | ((src1Neg) << 25) | ((indexMode) << 26) | ((predSel) << 29)) 85 #define ALU_WORD1_OP2(src0Abs, src1Abs, updateExecuteMask, updatePred, writeMask, omod, inst, encoding, bankSwizzle, dstGpr, dstRel, dstChan, clamp) \ 86 to_LE(src0Abs | (src1Abs << 1) | (updateExecuteMask << 2) | (updatePred << 3) | (writeMask << 4) | (omod << 5) | (inst << 7) | \ 87 (encoding << 15) | (bankSwizzle << 18) | ((dstGpr&0x7F) << 21) | (dstRel << 28) | ((dstChan&0x3) << 29) | (clamp << 31)) 89 #define ALU_WORD1_OP3(src2Sel, src2Rel, src2Chan, src2Neg, inst, bankSwizzle, dstGpr, dstRel, dstChan, clamp) \ 90 to_LE(src2Sel | (src2Rel << 9) | (src2Chan << 10) | (src2Neg << 12) | (inst << 13) | \ 91 (bankSwizzle << 18) | ((dstGpr&0x7F) << 21) | (dstRel << 28) | ((dstChan&0x3) << 29) | (clamp << 31)) 94 #define TEX_WORD0(inst, bcFracMode, fetchWholeQuad, resourceID, srcReg, srcRel, altConst) \ 95 to_LE(inst | (bcFracMode << 5) | (fetchWholeQuad << 7) | (resourceID << 8) | (srcReg << 16) | (srcRel << 23) | (altConst << 24)) 97 #define TEX_WORD1(dstReg, dstRel, dstSelX, dstSelY, dstSelZ, dstSelW, lodBias, coordTypeX, coordTypeY, coordTypeZ, coordTypeW) \ 98 to_LE(dstReg | (dstRel << 7) | (dstSelX << 9) | (dstSelY << 12) | (dstSelZ << 15) | (dstSelW << 18) | \ 99 (lodBias << 21) | (coordTypeX << 28) | (coordTypeY << 29) | (coordTypeZ << 30) | (coordTypeW << 31)) 101 #define TEX_WORD2(offsetX, offsetY, offsetZ, samplerID, srcSelX, srcSelY, srcSelZ, srcSelW) \ 102 to_LE(offsetX | (offsetY << 5) | (offsetZ << 10) | (samplerID << 15) | (srcSelX << 20) | (srcSelY << 23) | (srcSelZ << 26) | (srcSelW << 29)) 104 #define VTX_WORD0(inst, type, buffer_id, srcReg, srcSelX, mega) \ 105 to_LE(inst | (type << 5) | (buffer_id << 8) | (srcReg << 16) | (srcSelX << 24) | (mega << 26)) 107 #define VTX_WORD1(dstReg, dstSelX, dstSelY, dstSelZ, dstSelW) \ 108 to_LE(dstReg | (dstSelX << 9) | (dstSelY << 12) | (dstSelZ << 15) | (dstSelW << 18) | (1 << 21)) 110 #define VTX_WORD2(offset, ismega) \ 111 to_LE(offset| (ismega << 19)) 124 #define GX2_COMP_SEL(c0, c1, c2, c3) (((c0) << 24) | ((c1) << 16) | ((c2) << 8) | (c3)) 126 #define ALU_LITERAL(v) to_QWORD(to_LE(v), 0) 127 #define ALU_LITERAL2(v0,v1) to_QWORD(to_LE(v0), to_LE(v1)) 128 #define ALU_LITERAL3(v0,v1,v2) ALU_LITERAL2(v0,v1),ALU_LITERAL(v2) 129 #define ALU_LITERAL4(v0,v1,v2,v3) ALU_LITERAL2(v0,v1),ALU_LITERAL2(v2,v3) 130 #define ALU_LITERAL5(v0,v1,v2,v3,v5) ALU_LITERAL4(v0,v1,v2,v3),ALU_LITERAL(v4) 133 #define ALU_SRC_1_DBL_L 0xF4 134 #define ALU_SRC_1_DBL_M 0xF5 135 #define ALU_SRC_0_5_DBL_L 0xF6 136 #define ALU_SRC_0_5_DBL_M 0xF7 137 #define ALU_SRC_0 0xF8 138 #define ALU_SRC_1 0xF9 139 #define ALU_SRC_1_INT 0xFA 140 #define ALU_SRC_M_1_INT 0xFB 141 #define ALU_SRC_0_5 0xFC 142 #define ALU_SRC_LITERAL 0xFD 143 #define ALU_SRC_PV 0xFE 144 #define ALU_SRC_PS 0xFF 146 #define _NEG | (1 << 12) 147 #define _ABS | (1 << 13) 149 #define ALU_OMOD_OFF 0x0 150 #define ALU_OMOD_M2 0x1 151 #define ALU_OMOD_M4 0x2 152 #define ALU_OMOD_D2 0x3 154 #define ALU_VEC_012 0x0 155 #define ALU_VEC_021 0x1 156 #define ALU_VEC_120 0x2 157 #define ALU_VEC_102 0x3 158 #define ALU_VEC_201 0x4 159 #define ALU_VEC_210 0x5 160 #define VEC_012 | to_QWORD(0, to_LE(ALU_VEC_012 << 18)) 161 #define VEC_021 | to_QWORD(0, to_LE(ALU_VEC_021 << 18)) 162 #define VEC_120 | to_QWORD(0, to_LE(ALU_VEC_120 << 18)) 163 #define VEC_102 | to_QWORD(0, to_LE(ALU_VEC_102 << 18)) 164 #define VEC_201 | to_QWORD(0, to_LE(ALU_VEC_201 << 18)) 165 #define VEC_210 | to_QWORD(0, to_LE(ALU_VEC_210 << 18)) 167 #define VALID_PIX | to_QWORD(0,to_LE(1 << 22)) 169 #define ALU_SCL_210 0x0 170 #define ALU_SCL_122 0x1 171 #define ALU_SCL_212 0x2 172 #define ALU_SCL_221 0x3 174 #define SCL_210 | to_QWORD(0, to_LE(ALU_SCL_210 << 18)) 175 #define SCL_122 | to_QWORD(0, to_LE(ALU_SCL_122 << 18)) 176 #define SCL_212 | to_QWORD(0, to_LE(ALU_SCL_212 << 18)) 177 #define SCL_221 | to_QWORD(0, to_LE(ALU_SCL_221 << 18)) 180 #define FETCH_TYPE(x) x 181 #define MINI(x) ((x) - 1) 182 #define MEGA(x) (MINI(x) | 0x80000000) 185 #define VERTEX_DATA 0 186 #define INSTANCE_DATA 1 187 #define NO_INDEX_OFFSET 2 191 #define CF_COND_ACTIVE 0x0 192 #define CF_COND_FALSE 0x1 193 #define CF_COND_BOOL 0x2 194 #define CF_COND_NOT_BOOL 0x3 197 #define TEX_UNNORMALIZED 0x0 198 #define TEX_NORMALIZED 0x1 202 #define CF_INST_TEX 0x01 203 #define CF_INST_VTX 0x02 204 #define CF_INST_JUMP 0x0A 205 #define CF_INST_ELSE 0x0D 206 #define CF_INST_CALL_FS 0x13 207 #define CF_INST_EMIT_VERTEX 0x15 208 #define CF_INST_MEM_RING 0x26 210 #define CF_INST_ALU 0x08 211 #define CF_INST_ALU_PUSH_BEFORE 0x09 212 #define CF_INST_ALU_POP_AFTER 0x0A 214 #define OP2_INST_ADD 0x0 215 #define OP2_INST_MUL 0x1 216 #define OP2_INST_MUL_IEEE 0x2 217 #define OP2_INST_MIN 0x04 218 #define OP2_INST_MAX 0x03 219 #define OP2_INST_MAX_DX10 0x05 220 #define OP2_INST_FRACT 0x10 221 #define OP2_INST_SETGT 0x09 222 #define OP2_INST_SETE_DX10 0x0C 223 #define OP2_INST_SETGT_DX10 0x0D 224 #define OP2_INST_FLOOR 0x14 225 #define OP2_INST_MOV 0x19 226 #define OP2_INST_PRED_SETGT 0x21 227 #define OP2_INST_PRED_SETE_INT 0x42 228 #define OP2_INST_DOT4 0x50 229 #define OP2_INST_DOT4_IEEE 0x51 230 #define OP2_INST_RECIP_IEEE 0x66 231 #define OP2_INST_RECIPSQRT_IEEE 0x69 232 #define OP2_INST_SQRT_IEEE 0x6A 233 #define OP2_INST_SIN 0x6E 234 #define OP2_INST_COS 0x6F 236 #define OP3_INST_MULADD 0x10 237 #define OP3_INST_CNDGT 0x19 238 #define OP3_INST_CNDE_INT 0x1C 240 #define CF_INST_EXP 0x27 241 #define CF_INST_EXP_DONE 0x28 244 #define TEX_INST_GET_GRADIENTS_H 0x07 245 #define TEX_INST_GET_GRADIENTS_V 0x08 246 #define TEX_INST_SAMPLE 0x10 249 #define VTX_INST_FETCH 0x0 252 #define EXPORT_TYPE_PIXEL 0x0 253 #define EXPORT_TYPE_POS 0x1 254 #define EXPORT_TYPE_PARAM 0x2 256 #define EXPORT_ARRAY_BASE_POS(id) (0x3C + id) 257 #define EXPORT_ARRAY_BASE_PARAM(id) id 258 #define EXPORT_ARRAY_BASE_PIX(id) id 261 #define POS(id) EXPORT_ARRAY_BASE_POS(id) | (EXPORT_TYPE_POS << 13) 262 #define PARAM(id) EXPORT_ARRAY_BASE_PARAM(id) | (EXPORT_TYPE_PARAM << 13) 263 #define PIX(id) EXPORT_ARRAY_BASE_PIX(id) | (EXPORT_TYPE_PIXEL << 13) 265 #define PARAM0 PARAM(0) 266 #define PARAM1 PARAM(1) 289 #define _R120 _R(0x78) 290 #define _R121 _R(0x79) 291 #define _R122 _R(0x7A) 292 #define _R123 _R(0x7B) 293 #define _R124 _R(0x7C) 294 #define _R125 _R(0x7D) 295 #define _R126 _R(0x7E) 296 #define _R127 _R(0x7F) 310 #define CALL_FS to_QWORD(CF_DWORD0(0), CF_DWORD1(0,0,0,0,0,CF_INST_CALL_FS)) 312 #define TEX(addr, cnt) to_QWORD(CF_DWORD0(addr), CF_DWORD1(0x0, 0x0, CF_COND_ACTIVE, (cnt - 1), 0x0, CF_INST_TEX)) 313 #define VTX(addr, cnt) to_QWORD(CF_DWORD0(addr), CF_DWORD1(0x0, 0x0, CF_COND_ACTIVE, (cnt - 1), 0x0, CF_INST_VTX)) 314 #define JUMP(popCount, addr) to_QWORD(CF_DWORD0(addr), CF_DWORD1(popCount, 0x0, CF_COND_ACTIVE, 0x0, 0x0, CF_INST_JUMP)) 315 #define ELSE(popCount, addr) to_QWORD(CF_DWORD0(addr), CF_DWORD1(popCount, 0x0, CF_COND_ACTIVE, 0x0, 0x0, CF_INST_ELSE)) 317 #define ALU(addr, cnt) to_QWORD(CF_ALU_WORD0(addr, 0x0, 0x0, 0x0), CF_ALU_WORD1(0x0, 0x0, 0x0, (cnt - 1), 0x0, CF_INST_ALU)) 318 #define ALU_PUSH_BEFORE(addr, cnt) to_QWORD(CF_ALU_WORD0(addr, 0x0, 0x0, 0x0), CF_ALU_WORD1(0x0, 0x0, 0x0, (cnt - 1), 0x0, CF_INST_ALU_PUSH_BEFORE)) 319 #define ALU_POP_AFTER(addr, cnt) to_QWORD(CF_ALU_WORD0(addr, 0x0, 0x0, 0x0), CF_ALU_WORD1(0x0, 0x0, 0x0, (cnt - 1), 0x0, CF_INST_ALU_POP_AFTER)) 321 #define EXP_DONE(dstReg_and_type, srcReg, srcSelX, srcSelY, srcSelZ, srcSelW) to_QWORD(CF_EXP_WORD0(dstReg_and_type, srcReg, 0x0, 0x0, 0x0), \ 322 CF_EXP_WORD1(srcSelX, srcSelY, srcSelZ, srcSelW, 0x0, CF_INST_EXP_DONE)) 324 #define EXP(dstReg_and_type, srcReg, srcSelX, srcSelY, srcSelZ, srcSelW) to_QWORD(CF_EXP_WORD0(dstReg_and_type, srcReg, 0x0, 0x0, 0x0), \ 325 CF_EXP_WORD1(srcSelX, srcSelY, srcSelZ, srcSelW, 0x0, CF_INST_EXP)) 327 #define MEM_RING(arrayBase, dstReg, writeMask, arraySize, elemSize) \ 328 to_QWORD(CF_ALLOC_EXPORT_WORD0(arrayBase, 0x00, dstReg, 0x00, 0x00, elemSize), \ 329 CF_ALLOC_EXPORT_WORD1_BUF(arraySize, writeMask, CF_INST_MEM_RING)) 331 #define EMIT_VERTEX to_QWORD(0, CF_DWORD1(0, 0, 0, 0, 0, CF_INST_EMIT_VERTEX)) 333 #define ALU_OP2(inst, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, omod) \ 334 to_QWORD(ALU_WORD0(((src0Sel) & ((1 << 13) - 1)), 0x0, src0Chan, 0x0, ((src1Sel) & ((1 << 13) - 1)), 0x0, src1Chan, 0x0, 0x0, 0x0), \ 335 ALU_WORD1_OP2(((src0Sel) >> 13), ((src1Sel) >> 13), 0x0, 0x0, (((dstGpr&__) >> 7) ^ 0x1), omod, inst, 0x0, 0x0, dstGpr, 0x0, dstChan, 0x0)) 337 #define ALU_OP3(inst, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan) \ 338 to_QWORD(ALU_WORD0(src0Sel, 0x0, src0Chan, 0x0, src1Sel, 0x0, src1Chan, 0x0, 0x0, 0x0), \ 339 ALU_WORD1_OP3(src2Sel, 0x0, src2Chan, 0x0, inst, 0x0, dstGpr, 0x0, dstChan, 0x0)) 341 #define ALU_ADD(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 342 ALU_OP2(OP2_INST_ADD, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 344 #define ALU_ADD_x2(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 345 ALU_OP2(OP2_INST_ADD, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_M2) 347 #define ALU_ADD_D2(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 348 ALU_OP2(OP2_INST_ADD, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_D2) 350 #define ALU_MUL(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 351 ALU_OP2(OP2_INST_MUL, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 353 #define ALU_MUL_x2(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 354 ALU_OP2(OP2_INST_MUL, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_M2) 356 #define ALU_MUL_x4(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 357 ALU_OP2(OP2_INST_MUL, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_M4) 359 #define ALU_MUL_IEEE(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 360 ALU_OP2(OP2_INST_MUL_IEEE, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 362 #define ALU_MUL_IEEE_x2(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 363 ALU_OP2(OP2_INST_MUL_IEEE, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_M2) 365 #define ALU_MUL_IEEE_x4(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 366 ALU_OP2(OP2_INST_MUL_IEEE, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_M4) 368 #define ALU_FRACT(dstGpr, dstChan, src0Sel, src0Chan) \ 369 ALU_OP2(OP2_INST_FRACT, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF) 371 #define ALU_FLOOR(dstGpr, dstChan, src0Sel, src0Chan) \ 372 ALU_OP2(OP2_INST_FLOOR, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF) 374 #define ALU_SQRT_IEEE(dstGpr, dstChan, src0Sel, src0Chan) \ 375 ALU_OP2(OP2_INST_SQRT_IEEE, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF) 377 #define ALU_SQRT_IEEE_D2(dstGpr, dstChan, src0Sel, src0Chan) \ 378 ALU_OP2(OP2_INST_SQRT_IEEE, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_D2) 380 #define ALU_MOV(dstGpr, dstChan, src0Sel, src0Chan) \ 381 ALU_OP2(OP2_INST_MOV, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF) 383 #define ALU_MOV_D2(dstGpr, dstChan, src0Sel, src0Chan) \ 384 ALU_OP2(OP2_INST_MOV, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_D2) 386 #define ALU_MOV_x2(dstGpr, dstChan, src0Sel, src0Chan) \ 387 ALU_OP2(OP2_INST_MOV, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_M2) 389 #define ALU_MOV_x4(dstGpr, dstChan, src0Sel, src0Chan) \ 390 ALU_OP2(OP2_INST_MOV, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_M4) 392 #define ALU_DOT4_IEEE(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 393 ALU_OP2(OP2_INST_DOT4_IEEE, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 395 #define ALU_DOT4(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 396 ALU_OP2(OP2_INST_DOT4, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 398 #define ALU_PRED_SETGT(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 399 ALU_OP2(OP2_INST_PRED_SETGT, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 401 #define ALU_SETE_DX10(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 402 ALU_OP2(OP2_INST_SETE_DX10, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 404 #define ALU_SETGT_DX10(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 405 ALU_OP2(OP2_INST_SETGT_DX10, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 407 #define ALU_SETGT(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 408 ALU_OP2(OP2_INST_SETGT, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 410 #define ALU_PRED_SETE_INT(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 411 ALU_OP2(OP2_INST_PRED_SETE_INT, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 413 #define ALU_MIN(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 414 ALU_OP2(OP2_INST_MIN, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 416 #define ALU_MAX(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 417 ALU_OP2(OP2_INST_MAX, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 419 #define ALU_MAX_DX10(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \ 420 ALU_OP2(OP2_INST_MAX_DX10, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF) 422 #define ALU_RECIP_IEEE(dstGpr, dstChan, src0Sel, src0Chan) \ 423 ALU_OP2(OP2_INST_RECIP_IEEE, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF) 425 #define ALU_RECIPSQRT_IEEE(dstGpr, dstChan, src0Sel, src0Chan) \ 426 ALU_OP2(OP2_INST_RECIPSQRT_IEEE, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF) 428 #define ALU_SIN(dstGpr, dstChan, src0Sel, src0Chan) \ 429 ALU_OP2(OP2_INST_SIN, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF) 431 #define ALU_COS(dstGpr, dstChan, src0Sel, src0Chan) \ 432 ALU_OP2(OP2_INST_COS, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF) 434 #define ALU_COS_D2(dstGpr, dstChan, src0Sel, src0Chan) \ 435 ALU_OP2(OP2_INST_COS, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_D2) 437 #define ALU_MULADD(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan) \ 438 ALU_OP3(OP3_INST_MULADD, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan) 440 #define ALU_CNDGT(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan) \ 441 ALU_OP3(OP3_INST_CNDGT, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan) 443 #define ALU_CNDE_INT(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan) \ 444 ALU_OP3(OP3_INST_CNDE_INT, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan) 446 #define TEX_SAMPLE(dstReg, dstSelX, dstSelY, dstSelZ, dstSelW, srcReg, srcSelX, srcSelY, srcSelZ, srcSelW, resourceID, samplerID)\ 447 to_QWORD(TEX_WORD0(TEX_INST_SAMPLE, 0x0, 0x0, resourceID, srcReg, 0x0, 0x0), \ 448 TEX_WORD1(dstReg, 0x0, dstSelX, dstSelY, dstSelZ, dstSelW, 0x0, TEX_NORMALIZED, TEX_NORMALIZED, TEX_NORMALIZED, TEX_NORMALIZED)), \ 449 to_QWORD(TEX_WORD2(0x0, 0x0, 0x0, samplerID, _x, _y, _0, _x), 0x00000000) 451 #define TEX_GET_GRADIENTS_H(dstReg, dstSelX, dstSelY, dstSelZ, dstSelW, srcReg, srcSelX, srcSelY, srcSelZ, srcSelW, resourceID, samplerID)\ 452 to_QWORD(TEX_WORD0(TEX_INST_GET_GRADIENTS_H, 0x0, 0x0, resourceID, srcReg, 0x0, 0x0), \ 453 TEX_WORD1(dstReg, 0x0, dstSelX, dstSelY, dstSelZ, dstSelW, 0x0, TEX_NORMALIZED, TEX_NORMALIZED, TEX_NORMALIZED, TEX_NORMALIZED)), \ 454 to_QWORD(TEX_WORD2(0x0, 0x0, 0x0, samplerID, _x, _y, _z, _x), 0x00000000) 456 #define TEX_GET_GRADIENTS_V(dstReg, dstSelX, dstSelY, dstSelZ, dstSelW, srcReg, srcSelX, srcSelY, srcSelZ, srcSelW, resourceID, samplerID)\ 457 to_QWORD(TEX_WORD0(TEX_INST_GET_GRADIENTS_V, 0x0, 0x0, resourceID, srcReg, 0x0, 0x0), \ 458 TEX_WORD1(dstReg, 0x0, dstSelX, dstSelY, dstSelZ, dstSelW, 0x0, TEX_NORMALIZED, TEX_NORMALIZED, TEX_NORMALIZED, TEX_NORMALIZED)), \ 459 to_QWORD(TEX_WORD2(0x0, 0x0, 0x0, samplerID, _x, _y, _z, _x), 0x00000000) 462 #define VTX_FETCH(dstReg, dstSelX, dstSelY, dstSelZ, dstSelW, srcReg, srcSelX, buffer_id, type, mega, offset) \ 463 to_QWORD(VTX_WORD0(VTX_INST_FETCH, type, buffer_id, srcReg, srcSelX, mega), VTX_WORD1(dstReg, dstSelX, dstSelY, dstSelZ, dstSelW)) , \ 464 to_QWORD(VTX_WORD2(offset, (mega >> 31)), 0x00000000) 467 #define _x4(v) _x2(v), _x2(v) 468 #define _x8(v) _x4(v), _x4(v) 469 #define _x16(v) _x8(v), _x8(v) 471 #define _x9(v) _x8(v), v 472 #define _x30(v) _x16(v), _x8(v), _x4(v),_x2(v) 473 #define _x31(v) _x30(v), v