}
}
+void
+fs_visitor::fail(const char *format, ...)
+{
+ if (!failed) {
+ failed = true;
+
+ if (INTEL_DEBUG & DEBUG_WM) {
+ fprintf(stderr, "FS compile failed: ");
+
+ va_list va;
+ va_start(va, format);
+ vfprintf(stderr, format, va);
+ va_end(va);
+ }
+ }
+}
+
/**
* Returns how many MRFs an FS opcode will write over.
*
}
if (!statevar->name) {
- this->fail = true;
- printf("Failed to find builtin uniform `%s'\n", ir->name);
+ fail("Failed to find builtin uniform `%s'\n", ir->name);
return;
}
if (ir->type->is_array()) {
array_elements = ir->type->length;
if (array_elements == 0) {
- this->fail = true;
+ fail("dereferenced array '%s' has length 0\n", ir->name);
}
type = ir->type->fields.array;
} else {
ir->operands[operand]->accept(this);
if (this->result.file == BAD_FILE) {
ir_print_visitor v;
- printf("Failed to get tree for expression operand:\n");
+ fail("Failed to get tree for expression operand:\n");
ir->operands[operand]->accept(&v);
- this->fail = true;
}
op[operand] = this->result;
default:
assert(!"not reached");
- this->fail = true;
+ fail("bad cond code\n");
break;
}
return;
assert(!"not reached");
inst = emit(BRW_OPCODE_IF, reg_null_d, op[0], fs_reg(0));
inst->conditional_mod = BRW_CONDITIONAL_NZ;
- this->fail = true;
+ fail("bad condition\n");
return;
}
return;
} else {
_mesa_problem(ctx, "Unsupported opcode %d in FS", inst->opcode);
}
- this->fail = true;
+ fail("unsupported opcode in FS\n");
}
if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
v.assign_regs_trivial();
else {
while (!v.assign_regs()) {
- if (v.fail)
+ if (v.failed)
break;
}
}
}
- if (!v.fail)
+ if (!v.failed)
v.generate_code();
- assert(!v.fail); /* FINISHME: Cleanly fail, tested at link time, etc. */
+ assert(!v.failed); /* FINISHME: Cleanly fail, tested at link time, etc. */
- if (v.fail)
+ if (v.failed)
return GL_FALSE;
c->prog_data.total_grf = v.grf_used;
this->ctx = &intel->ctx;
this->mem_ctx = ralloc_context(NULL);
this->shader = shader;
- this->fail = false;
+ this->failed = false;
this->variable_ht = hash_table_ctor(0,
hash_table_pointer_hash,
hash_table_pointer_compare);
bool remove_duplicate_mrf_writes();
bool virtual_grf_interferes(int a, int b);
void schedule_instructions();
+ void fail(const char *msg, ...);
void generate_code();
void generate_fb_write(fs_inst *inst);
ir_instruction *base_ir;
/** @} */
- bool fail;
+ bool failed;
/* Result of last visit() method. */
fs_reg result;
}
if (i == class_count) {
if (this->virtual_grf_sizes[r] >= base_reg_count) {
- fprintf(stderr, "Object too large to register allocate.\n");
- this->fail = true;
+ fail("Object too large to register allocate.\n");
}
class_sizes[class_count++] = this->virtual_grf_sizes[r];
* loop back into here to try again.
*/
int reg = choose_spill_reg(g);
- if (reg == -1 || intel->gen >= 6) {
- this->fail = true;
+
+ if (reg == -1) {
+ fail("no register to spill\n");
+ } else if (intel->gen >= 6) {
+ fail("no spilling support on gen6 yet\n");
} else {
spill_reg(reg);
}