diff options
author | Rob Clark <[email protected]> | 2015-01-06 16:44:26 -0500 |
---|---|---|
committer | Rob Clark <[email protected]> | 2015-01-07 19:37:28 -0500 |
commit | 56370b9feb269f185858422ee8fdf74a3dc99a33 (patch) | |
tree | 760e97348a81d96c40636aed4aafe76161654190 /src | |
parent | 063e2ef76a450f7b08ac942a0ca3842b9498f31b (diff) |
freedreno/ir3: legalize vs unused sam dst components
We probably could be more clever elsewhere and mask out components that
are not used. But either way, legalize should realize that there is
also a write-after-write hazard with texture sample instructions.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_compiler.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_legalize.c | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c index 5cf8656a9e7..fe145d4ed1c 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c @@ -1374,12 +1374,13 @@ trans_samp(const struct instr_translater *t, collect = ir3_instr_create(ctx->block, -1, OPC_META_FI); ir3_reg_create(collect, 0, 0); - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { if (tinf.src_wrmask & (1 << i)) ssa_src(ctx, ir3_reg_create(collect, 0, IR3_REG_SSA), coord, src_swiz(coord, i)); else if (tinf.src_wrmask & ~((1 << i) - 1)) ir3_reg_create(collect, 0, 0); + } /* Attach derivatives onto the end of the fan-in. Derivatives start after * the 4th argument, so make sure that fi is padded up to 4 first. diff --git a/src/gallium/drivers/freedreno/ir3/ir3_legalize.c b/src/gallium/drivers/freedreno/ir3/ir3_legalize.c index 6194deda846..2ef11f183d7 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_legalize.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_legalize.c @@ -80,7 +80,13 @@ static void legalize(struct ir3_legalize_ctx *ctx) ctx->max_bary = MAX2(ctx->max_bary, inloc->iim_val); } - for (i = 1; i < n->regs_count; i++) { + /* NOTE: consider dst register too.. it could happen that + * texture sample instruction (for example) writes some + * components which are unused. A subsequent instruction + * that writes the same register can race w/ the sam instr + * resulting in undefined results: + */ + for (i = 0; i < n->regs_count; i++) { reg = n->regs[i]; if (reg_gpr(reg)) { |