diff --git a/src/gallium/drivers/d3d12/d3d12_nir_passes.c b/src/gallium/drivers/d3d12/d3d12_nir_passes.c index 4f2f6cbd814..742239b709b 100644 --- a/src/gallium/drivers/d3d12/d3d12_nir_passes.c +++ b/src/gallium/drivers/d3d12/d3d12_nir_passes.c @@ -946,6 +946,8 @@ d3d12_disable_multisampling(nir_shader *s) var->data.sample = false; } BITSET_CLEAR(s->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID); + s->info.fs.uses_sample_qualifier = false; + s->info.fs.uses_sample_shading = false; return progress; } diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index 6d7fe3f9c46..3994c636f1d 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -5764,7 +5764,9 @@ emit_module(struct ntd_context *ctx, const struct nir_to_dxil_options *opts) } ctx->mod.info.has_per_sample_input = - BITSET_TEST(ctx->shader->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID); + BITSET_TEST(ctx->shader->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID) || + ctx->shader->info.fs.uses_sample_shading || + ctx->shader->info.fs.uses_sample_qualifier; if (!ctx->mod.info.has_per_sample_input && ctx->shader->info.stage == MESA_SHADER_FRAGMENT) { nir_foreach_variable_with_modes(var, ctx->shader, nir_var_shader_in | nir_var_system_value) { if (var->data.sample) { @@ -6032,9 +6034,8 @@ allocate_sysvalues(struct ntd_context *ctx) driver_location = MAX2(driver_location, var->data.driver_location + 1); if (ctx->shader->info.stage == MESA_SHADER_FRAGMENT && - ctx->shader->info.inputs_read && !BITSET_TEST(ctx->shader->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID)) { - bool need_sample_id = false; + bool need_sample_id = ctx->shader->info.fs.uses_sample_shading; /* "var->data.sample = true" sometimes just mean, "I want per-sample * shading", which explains why we can end up with vars having flat diff --git a/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c b/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c index 8349d805b20..6d3702667c9 100644 --- a/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c +++ b/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c @@ -794,8 +794,7 @@ dxil_spirv_nir_passes(nir_shader *nir, // Force sample-rate shading if we're asked to. if (conf->force_sample_rate_shading) { assert(nir->info.stage == MESA_SHADER_FRAGMENT); - nir_foreach_shader_in_variable(var, nir) - var->data.sample = true; + nir->info.fs.uses_sample_shading = true; } if (conf->zero_based_vertex_instance_id) {