X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fvc4%2Fvc4_qir_validate.c;h=302eb48265c35e48bdcd1f49c864dff73c3e2e8c;hb=a700a82bdac19433533ccf31ab635350cb58203b;hp=af2e3baf8156d3b3669e31cb6b87ee249788da1f;hpb=a1f698881e13a4993e958815b79f8150d48e2739;p=mesa.git diff --git a/src/gallium/drivers/vc4/vc4_qir_validate.c b/src/gallium/drivers/vc4/vc4_qir_validate.c index af2e3baf815..302eb48265c 100644 --- a/src/gallium/drivers/vc4/vc4_qir_validate.c +++ b/src/gallium/drivers/vc4/vc4_qir_validate.c @@ -25,10 +25,10 @@ #include "vc4_qpu.h" static void -fail_instr(struct qinst *inst, const char *msg) +fail_instr(struct vc4_compile *c, struct qinst *inst, const char *msg) { fprintf(stderr, "qir_validate: %s: ", msg); - qir_dump_inst(stderr, inst); + qir_dump_inst(c, inst); fprintf(stderr, "\n"); abort(); } @@ -50,18 +50,18 @@ void qir_validate(struct vc4_compile *c) struct qinst *def = c->defs[i]; if (def && def->cond != QPU_COND_ALWAYS) - fail_instr(def, "SSA def with condition"); + fail_instr(c, def, "SSA def with condition"); } - list_for_each_entry(struct qinst, inst, &c->instructions, link) { + qir_for_each_inst_inorder(inst, c) { switch (inst->dst.file) { case QFILE_TEMP: if (inst->dst.index >= c->num_temps) - fail_instr(inst, "bad temp index"); + fail_instr(c, inst, "bad temp index"); if (c->defs[inst->dst.index] && already_assigned[inst->dst.index]) { - fail_instr(inst, "Re-assignment of SSA value"); + fail_instr(c, inst, "Re-assignment of SSA value"); } already_assigned[inst->dst.index] = true; break; @@ -79,37 +79,58 @@ void qir_validate(struct vc4_compile *c) case QFILE_FRAG_X: case QFILE_FRAG_Y: case QFILE_FRAG_REV_FLAG: + case QFILE_QPU_ELEMENT: case QFILE_SMALL_IMM: case QFILE_LOAD_IMM: - fail_instr(inst, "Bad dest file"); + fail_instr(c, inst, "Bad dest file"); + break; + + case QFILE_TEX_S: + case QFILE_TEX_T: + case QFILE_TEX_R: + case QFILE_TEX_B: + if (inst->src[qir_get_tex_uniform_src(inst)].file != + QFILE_UNIF) { + fail_instr(c, inst, + "tex op missing implicit uniform"); + } + break; + + case QFILE_TEX_S_DIRECT: + if (inst->op != QOP_ADD) { + fail_instr(c, inst, + "kernel validation requires that " + "direct texture lookups use an ADD"); + } break; } - for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) { + for (int i = 0; i < qir_get_nsrc(inst); i++) { struct qreg src = inst->src[i]; switch (src.file) { case QFILE_TEMP: if (src.index >= c->num_temps) - fail_instr(inst, "bad temp index"); + fail_instr(c, inst, "bad temp index"); break; case QFILE_VARY: case QFILE_UNIF: case QFILE_VPM: case QFILE_LOAD_IMM: + case QFILE_QPU_ELEMENT: break; case QFILE_SMALL_IMM: if (qpu_encode_small_immediate(src.index) == ~0) - fail_instr(inst, "bad small immediate"); + fail_instr(c, inst, "bad small immediate"); break; case QFILE_FRAG_X: case QFILE_FRAG_Y: case QFILE_FRAG_REV_FLAG: if (c->stage != QSTAGE_FRAG) - fail_instr(inst, "frag access in VS/CS"); + fail_instr(c, inst, "frag access in VS/CS"); break; case QFILE_NULL: @@ -117,7 +138,12 @@ void qir_validate(struct vc4_compile *c) case QFILE_TLB_COLOR_WRITE_MS: case QFILE_TLB_Z_WRITE: case QFILE_TLB_STENCIL_SETUP: - fail_instr(inst, "Bad src file"); + case QFILE_TEX_S_DIRECT: + case QFILE_TEX_S: + case QFILE_TEX_T: + case QFILE_TEX_R: + case QFILE_TEX_B: + fail_instr(c, inst, "Bad src file"); break; } }