No immediate benefit, it was just bugging me.
}
unsigned int srcmasks[3];
- rc_compute_sources_for_writemask(opcode, usedmask, srcmasks);
+ rc_compute_sources_for_writemask(inst, usedmask, srcmasks);
for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) {
unsigned int refmask = 0;
for(struct rc_instruction * inst = c->Program.Instructions.Next;
inst != &c->Program.Instructions;
inst = inst->Next, ++ip) {
- const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);\
+ const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
int dead = 1;
if (!opcode->HasDstReg) {
else if (inst->U.I.WriteALUResult == RC_ALURESULT_W)
usemask |= RC_MASK_W;
- rc_compute_sources_for_writemask(opcode, usemask, srcmasks);
+ rc_compute_sources_for_writemask(inst, usemask, srcmasks);
for(unsigned int src = 0; src < 3; ++src) {
for(unsigned int chan = 0; chan < 4; ++chan) {
*/
#include "radeon_opcodes.h"
+#include "radeon_program.h"
#include "radeon_program_constants.h"
};
void rc_compute_sources_for_writemask(
- const struct rc_opcode_info * opcode,
+ const struct rc_instruction *inst,
unsigned int writemask,
unsigned int *srcmasks)
{
+ const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
srcmasks[0] = 0;
srcmasks[1] = 0;
srcmasks[2] = 0;
srcmasks[0] |= RC_MASK_XYZW;
srcmasks[1] |= RC_MASK_XYZW;
break;
- case RC_OPCODE_TEX:
case RC_OPCODE_TXB:
case RC_OPCODE_TXP:
- srcmasks[0] |= RC_MASK_XYZW;
+ srcmasks[0] |= RC_MASK_W;
+ /* Fall through */
+ case RC_OPCODE_TEX:
+ switch (inst->U.I.TexSrcTarget) {
+ case RC_TEXTURE_1D:
+ srcmasks[0] |= RC_MASK_X;
+ break;
+ case RC_TEXTURE_2D:
+ case RC_TEXTURE_RECT:
+ case RC_TEXTURE_1D_ARRAY:
+ srcmasks[0] |= RC_MASK_XY;
+ break;
+ case RC_TEXTURE_3D:
+ case RC_TEXTURE_CUBE:
+ case RC_TEXTURE_2D_ARRAY:
+ srcmasks[0] |= RC_MASK_XYZ;
+ break;
+ }
break;
case RC_OPCODE_DST:
srcmasks[0] |= RC_MASK_Y | RC_MASK_Z;
return &rc_opcodes[opcode];
}
+struct rc_instruction;
+
void rc_compute_sources_for_writemask(
- const struct rc_opcode_info * opcode,
+ const struct rc_instruction *inst,
unsigned int writemask,
unsigned int *srcmasks);