this->exec_size = dst.width;
} else {
for (int i = 0; i < sources; ++i) {
- if (src[i].file != GRF)
+ if (src[i].file != GRF && src[i].file != ATTR)
continue;
if (this->exec_size <= 1)
break;
case GRF:
case HW_REG:
+ case ATTR:
assert(this->src[i].width > 0);
if (this->src[i].width == 1) {
this->src[i].effective_width = this->exec_size;
case GRF:
case HW_REG:
case MRF:
+ case ATTR:
this->regs_written = (dst.width * dst.stride * type_sz(dst.type) + 31) / 32;
break;
case BAD_FILE:
case UNIFORM:
fprintf(file, "***u%d***", inst->dst.reg + inst->dst.reg_offset);
break;
+ case ATTR:
+ fprintf(file, "***attr%d***", inst->dst.reg + inst->dst.reg_offset);
+ break;
case HW_REG:
if (inst->dst.fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) {
switch (inst->dst.fixed_hw_reg.nr) {
case MRF:
fprintf(file, "***m%d***", inst->src[i].reg);
break;
+ case ATTR:
+ fprintf(file, "attr%d", inst->src[i].reg + inst->src[i].reg_offset);
+ break;
case UNIFORM:
fprintf(file, "u%d", inst->src[i].reg + inst->src[i].reg_offset);
if (inst->src[i].reladdr) {
case BAD_FILE:
break;
case GRF:
+ case ATTR:
reg.reg_offset += delta / 32;
break;
case MRF:
break;
case GRF:
case MRF:
+ case ATTR:
return byte_offset(reg, delta * reg.stride * type_sz(reg.type));
default:
assert(delta == 0);
break;
case GRF:
case MRF:
+ case ATTR:
return byte_offset(reg, delta * reg.width * reg.stride * type_sz(reg.type));
case UNIFORM:
reg.reg_offset += delta;
/* Probably unused. */
brw_reg = brw_null_reg();
break;
- case UNIFORM:
- unreachable("not reached");
default:
unreachable("not reached");
}
src.type = brw_type_for_base_type(ir->type);
if (constant_index) {
- assert(src.file == UNIFORM || src.file == GRF || src.file == HW_REG);
- src = offset(src, constant_index->value.i[0] * element_size);
+ if (src.file == ATTR) {
+ /* Attribute arrays get loaded as one vec4 per element. In that case
+ * offset the source register.
+ */
+ src.reg += constant_index->value.i[0];
+ } else {
+ assert(src.file == UNIFORM || src.file == GRF || src.file == HW_REG);
+ src = offset(src, constant_index->value.i[0] * element_size);
+ }
} else {
/* Variable index array dereference. We attach the variable index
* component to the reg as a pointer to a register containing the
ir->operands[operand]->fprint(stderr);
fprintf(stderr, "\n");
}
- assert(this->result.file == GRF || this->result.file == UNIFORM);
+ assert(this->result.file == GRF ||
+ this->result.file == UNIFORM || this->result.file == ATTR);
op[operand] = this->result;
/* Matrix expression operands should have been broken down to vector