diff options
-rw-r--r-- | asm/ir-a3xx.c | 2 | ||||
-rw-r--r-- | ir3emu.c | 29 |
2 files changed, 29 insertions, 2 deletions
diff --git a/asm/ir-a3xx.c b/asm/ir-a3xx.c index f3fd6ad..0768a15 100644 --- a/asm/ir-a3xx.c +++ b/asm/ir-a3xx.c @@ -86,7 +86,7 @@ static uint32_t reg(struct ir3_register *reg, struct ir3_shader_info *info, if (reg->flags & IR3_REG_IMMED) { val.iim_val = reg->iim_val; } else { - int8_t max = (reg->num + repeat) >> 2; + int max = (reg->num + repeat) >> 2; val.comp = reg->num & 0x3; val.num = reg->num >> 2; @@ -726,7 +726,7 @@ emu_run_cat4(struct ir3_emu_ctx *ctx, instr_cat4_t *cat4) static void emu_run_cat5(struct ir3_emu_ctx *ctx, instr_cat5_t *cat5) { - unsigned i, srccomp = 2; + unsigned i, srccomp = 2, src2comp = 0; regval_t dst[4]; /* TODO handle various # of components and args.. */ @@ -742,6 +742,11 @@ emu_run_cat5(struct ir3_emu_ctx *ctx, instr_cat5_t *cat5) break; } + if (cat5->is_s) + srccomp++; + + if (cat5->is_a) + srccomp++; if (cat5->is_p) srccomp++; @@ -749,6 +754,17 @@ emu_run_cat5(struct ir3_emu_ctx *ctx, instr_cat5_t *cat5) if (cat5->is_3d) srccomp++; + if (cat5->is_o) { + /* XXX not really correct, I think (if I understand trans_samp() + * properly).. but we'd need to know about the texture type to + * actually know # of components.. probably should get the + * cmdline compiler to spit that out in a header comment.. + */ + src2comp = 3; + } + + emu_assert(ctx, srccomp < 4); + for (i = 0; i < 4; i++) { unsigned j = (i % srccomp); regval_t src; @@ -759,6 +775,17 @@ emu_run_cat5(struct ir3_emu_ctx *ctx, instr_cat5_t *cat5) }); dst[i].u = src.u + cat5->norm.samp + cat5->norm.tex; + + if (src2comp) { + j = (i % src2comp); + + src = read_src(ctx, 0, (struct ir3_regsrc){ + .src = (reg_t)(cat5->src1 + j), + .full = cat5->full, + }); + + dst[i].u += src.u; + } } for (i = 0; i < 4; i++) { |