From ce25668d020fc29a5815d1f2bedee44a796ea234 Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Mon, 17 Jul 2023 18:28:43 +0200 Subject: [PATCH] ir3: Use NIR info to enable per sample shading NIR is tracking this better than us. 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. See https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/3712 Fixes: dEQP-VK.draw.*.implicit_sample_shading.sample_id_static_use dEQP-VK.draw.*.implicit_sample_shading.sample_position_static_use Signed-off-by: Danylo Piliaiev Part-of: --- src/freedreno/ir3/ir3_compiler_nir.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 636c454cedb..0890f053df6 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -2301,8 +2301,6 @@ emit_intrinsic(struct ir3_context *ctx, nir_intrinsic_instr *intr) dst[0] = ctx->instance_id; break; case nir_intrinsic_load_sample_id: - ctx->so->per_samp = true; - FALLTHROUGH; case nir_intrinsic_load_sample_id_no_per_sample: if (!ctx->samp_id) { ctx->samp_id = create_sysval_input(ctx, SYSTEM_VALUE_SAMPLE_ID, 0x1); @@ -4297,12 +4295,6 @@ emit_instructions(struct ir3_context *ctx) /* some varying setup which can't be done in setup_input(): */ if (ctx->so->type == MESA_SHADER_FRAGMENT) { nir_foreach_shader_in_variable (var, ctx->s) { - /* if any varyings have 'sample' qualifer, that triggers us - * to run in per-sample mode: - */ - if (var->data.sample) - ctx->so->per_samp = true; - /* set rasterflat flag for front/back color */ if (var->data.interpolation == INTERP_MODE_NONE) { switch (var->data.location) { @@ -5028,6 +5020,8 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler, ctx->s->info.fs.post_depth_coverage) so->post_depth_coverage = true; + ctx->so->per_samp = ctx->s->info.fs.uses_sample_shading; + out: if (ret) { if (so->ir)