Module: Mesa Branch: main Commit: a0d426370db53151ad3683f50083607f6aeda6ef URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0d426370db53151ad3683f50083607f6aeda6ef
Author: Danylo Piliaiev <[email protected]> Date: Tue Jul 18 14:41:03 2023 +0200 ir3: Fix FS quad ops returning wrong values from helper invocations Without SP_FS_CTRL_REG0.LODPIXMASK quad ops don't get values from helper invocations, but from the current one. Fixes: dEQP-VK.glsl.derivate.dfdxsubgroup.* dEQP-VK.glsl.derivate.dfdysubgroup.* Cc: mesa-stable Signed-off-by: Danylo Piliaiev <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24211> --- src/freedreno/ir3/ir3_compiler_nir.c | 4 +++- src/freedreno/ir3/ir3_legalize.c | 2 +- src/freedreno/ir3/ir3_shader.h | 2 +- src/freedreno/vulkan/tu_pipeline.cc | 2 +- src/gallium/drivers/freedreno/a6xx/fd6_program.cc | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 0890f053df6..5d0ee2b7a19 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -5009,8 +5009,10 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler, collect_tex_prefetches(ctx, ir); if (so->type == MESA_SHADER_FRAGMENT && - ctx->s->info.fs.needs_quad_helper_invocations) + ctx->s->info.fs.needs_quad_helper_invocations) { so->need_pixlod = true; + so->need_full_quad = true; + } if ((ctx->so->type == MESA_SHADER_FRAGMENT) && !ctx->s->info.fs.early_fragment_tests) diff --git a/src/freedreno/ir3/ir3_legalize.c b/src/freedreno/ir3/ir3_legalize.c index 6939ce5eee7..a344a009ea1 100644 --- a/src/freedreno/ir3/ir3_legalize.c +++ b/src/freedreno/ir3/ir3_legalize.c @@ -400,7 +400,7 @@ apply_fine_deriv_macro(struct ir3_legalize_ctx *ctx, struct ir3_block *block) struct ir3_instruction *op_p = ir3_instr_clone(n); op_p->flags = IR3_INSTR_P; - ctx->so->need_fine_derivatives = true; + ctx->so->need_full_quad = true; } } diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h index 6c921732c1a..f852e581abb 100644 --- a/src/freedreno/ir3/ir3_shader.h +++ b/src/freedreno/ir3/ir3_shader.h @@ -688,7 +688,7 @@ struct ir3_shader_variant { /* do we need derivatives: */ bool need_pixlod; - bool need_fine_derivatives; + bool need_full_quad; /* do we need VS driver params? */ bool need_driver_params; diff --git a/src/freedreno/vulkan/tu_pipeline.cc b/src/freedreno/vulkan/tu_pipeline.cc index 59d5ca5b8f2..3d9b272f2a0 100644 --- a/src/freedreno/vulkan/tu_pipeline.cc +++ b/src/freedreno/vulkan/tu_pipeline.cc @@ -496,7 +496,7 @@ tu6_emit_xs(struct tu_cs *cs, .branchstack = ir3_shader_branchstack_hw(xs), .threadsize = thrsz, .varying = xs->total_in != 0, - .lodpixmask = xs->need_fine_derivatives, + .lodpixmask = xs->need_full_quad, /* unknown bit, seems unnecessary */ .unk24 = true, .pixlodenable = xs->need_pixlod, diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.cc b/src/gallium/drivers/freedreno/a6xx/fd6_program.cc index cbb987c8edf..f7d82c58427 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.cc @@ -933,7 +933,7 @@ setup_stateobj(struct fd_screen *screen, struct fd_ringbuffer *ring, ring, A6XX_SP_FS_CTRL_REG0_THREADSIZE(fssz) | COND(enable_varyings, A6XX_SP_FS_CTRL_REG0_VARYING) | 0x1000000 | - COND(fs->need_fine_derivatives, A6XX_SP_FS_CTRL_REG0_LODPIXMASK) | + COND(fs->need_full_quad, A6XX_SP_FS_CTRL_REG0_LODPIXMASK) | A6XX_SP_FS_CTRL_REG0_FULLREGFOOTPRINT(fs->info.max_reg + 1) | A6XX_SP_FS_CTRL_REG0_HALFREGFOOTPRINT(fs->info.max_half_reg + 1) | COND(fs->mergedregs, A6XX_SP_FS_CTRL_REG0_MERGEDREGS) |
