GLuint saturate:1;
GLuint writemask:4;
GLuint tex_unit:4; /* texture/sampler unit for texture instructions */
- GLuint tex_target:4; /* TGSI_TEXTURE_x for texture instructions*/
+ GLuint target:4; /* TGSI_TEXTURE_x for texture instructions,
+ * target binding table index for FB_WRITE
+ */
GLuint eot:1; /* End of thread indicator for FB_WRITE*/
- GLuint target:10; /* target binding table index for FB_WRITE*/
};
struct brw_fp_dst dst;
struct brw_fp_src src[3];
unsigned opcode:8;
+ unsigned target:8; /* XXX: special usage for FB_WRITE */
unsigned tex_unit:4;
- unsigned tex_target:4;
- unsigned target:10; /* destination surface for FB_WRITE */
- unsigned eot:1; /* mark last instruction (usually FB_WRITE) */
+ unsigned pad:12;
};
/* How many input regs are there?
*/
- switch (inst->tex_target) {
+ switch (inst->target) {
case TGSI_TEXTURE_1D:
emit = BRW_WRITEMASK_X;
nr = 1;
GLuint msg_type;
/* Shadow ignored for txb.
*/
- switch (inst->tex_target) {
+ switch (inst->target) {
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
brw_MOV(p, brw_message_reg(2), arg[0]);
static struct brw_fp_instruction * emit_tex_op(struct brw_wm_compile *c,
GLuint op,
struct brw_fp_dst dest,
- GLuint tex_src_unit,
- GLuint tex_src_target,
+ GLuint tex_unit,
+ GLuint target,
struct brw_fp_src src0,
struct brw_fp_src src1,
struct brw_fp_src src2 )
{
struct brw_fp_instruction *inst = get_fp_inst(c);
+ if (tex_unit || target)
+ assert(op == TGSI_OPCODE_TXP ||
+ op == TGSI_OPCODE_TXB ||
+ op == TGSI_OPCODE_TEX ||
+ op == WM_FB_WRITE);
+
inst->opcode = op;
inst->dst = dest;
- inst->tex_unit = tex_src_unit;
- inst->tex_target = tex_src_target;
+ inst->tex_unit = tex_unit;
+ inst->target = target;
inst->src[0] = src0;
inst->src[1] = src1;
inst->src[2] = src2;
for (i = 0 ; i < c->key.nr_cbufs; i++) {
struct brw_fp_src outcolor;
- unsigned target = 1<<i;
-
- /* Set EOT flag on last inst:
- */
- if (i == c->key.nr_cbufs - 1)
- target |= 1;
outcolor = find_output_by_semantic(c, TGSI_SEMANTIC_COLOR, i);
- /* Use emit_tex_op so that we can specify the inst->tex_target
+ /* Use emit_tex_op so that we can specify the inst->target
* field, which is abused to contain the FB write target and the
* EOT marker
*/
emit_tex_op(c, WM_FB_WRITE,
dst_undef(),
- target,
- 0,
+ (i == c->key.nr_cbufs - 1), /* EOT */
+ i,
outcolor,
payload_r0_depth,
outdepth);
out->opcode = inst->opcode;
out->saturate = inst->dst.saturate;
out->tex_unit = inst->tex_unit;
- out->tex_target = inst->tex_target;
- out->eot = inst->eot; //inst->Aux & 1;
- out->target = inst->target; //inst->Aux >> 1;
+ out->target = inst->target;
+
+ /* Nasty hack:
+ */
+ out->eot = (inst->opcode == WM_FB_WRITE &&
+ inst->tex_unit != 0);
+
/* Args:
*/
case TGSI_OPCODE_TEX:
case TGSI_OPCODE_TXP:
- read0 = get_texcoord_mask(inst->tex_target);
+ read0 = get_texcoord_mask(inst->target);
break;
case TGSI_OPCODE_TXB:
- read0 = get_texcoord_mask(inst->tex_target) | BRW_WRITEMASK_W;
+ read0 = get_texcoord_mask(inst->target) | BRW_WRITEMASK_W;
break;
case WM_WPOSXY: