From 1f8ecd3ae0e43c17361de75f338060c3e2bcb6e8 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Mon, 3 Jul 2023 14:21:14 +0200 Subject: [PATCH] broadcom: use nir info to keep track of implicit sample shading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems NIR is tracking this for us now so we can stop doing this in the backend. Also, new CTS tests seem to add the requirement where in the presence of some builtin's like gl_SampleID in a shader, even if unused, sample shading is expected to be enabled, which is something we can't track in the backend since the variable may have been dropped by then. Fixes 2 failures in: dEQP-VK.draw.renderpass.implicit_sample_shading.sample* Reviewed-by: Alejandro PiƱeiro Part-of: --- src/broadcom/compiler/nir_to_vir.c | 7 ------- src/broadcom/compiler/v3d_compiler.h | 9 ++++----- src/broadcom/compiler/vir.c | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index ad461dbe24c..ca072971f01 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -4346,13 +4346,6 @@ nir_to_vir(struct v3d_compile *c) c->line_x = emit_fragment_varying(c, NULL, -1, 0, 0); c->uses_implicit_point_line_varyings = true; } - - c->force_per_sample_msaa = - c->s->info.fs.uses_sample_qualifier || - BITSET_TEST(c->s->info.system_values_read, - SYSTEM_VALUE_SAMPLE_ID) || - BITSET_TEST(c->s->info.system_values_read, - SYSTEM_VALUE_SAMPLE_POS); break; case MESA_SHADER_COMPUTE: /* Set up the TSO for barriers, assuming we do some. */ diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h index 9f4129870e1..eb4e692464b 100644 --- a/src/broadcom/compiler/v3d_compiler.h +++ b/src/broadcom/compiler/v3d_compiler.h @@ -693,11 +693,6 @@ struct v3d_compile { /* True if a fragment shader reads gl_PrimitiveID */ bool fs_uses_primitive_id; - /* If the fragment shader does anything that requires to force - * per-sample MSAA, such as reading gl_SampleID. - */ - bool force_per_sample_msaa; - /* Whether we are using the fallback scheduler. This will be set after * register allocation has failed once. */ @@ -1051,6 +1046,10 @@ struct v3d_fs_prog_data { bool uses_center_w; bool uses_implicit_point_line_varyings; bool lock_scoreboard_on_first_thrsw; + + /* If the fragment shader does anything that requires to force + * per-sample MSAA, such as reading gl_SampleID. + */ bool force_per_sample_msaa; }; diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index 499215454c0..a1a10a5f8f7 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -840,7 +840,7 @@ v3d_fs_set_prog_data(struct v3d_compile *c, c->uses_implicit_point_line_varyings; prog_data->lock_scoreboard_on_first_thrsw = c->lock_scoreboard_on_first_thrsw; - prog_data->force_per_sample_msaa = c->force_per_sample_msaa; + prog_data->force_per_sample_msaa = c->s->info.fs.uses_sample_shading; prog_data->uses_pid = c->fs_uses_primitive_id; }