diff --git a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c index d02b6e1cbc1..7539678072b 100644 --- a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c +++ b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c @@ -565,6 +565,13 @@ spirv_to_dxil(const uint32_t *words, size_t word_count, NIR_PASS_V(nir, nir_lower_system_values); + // Force sample-rate shading if we're asked to. + if (conf->force_sample_rate_shading) { + assert(stage == MESA_SHADER_FRAGMENT); + nir_foreach_shader_in_variable(var, nir) + var->data.sample = true; + } + if (conf->zero_based_vertex_instance_id) { // vertex_id and instance_id should have already been transformed to // base zero before spirv_to_dxil was called. Therefore, we can zero out diff --git a/src/microsoft/spirv_to_dxil/spirv_to_dxil.h b/src/microsoft/spirv_to_dxil/spirv_to_dxil.h index f53a5445bc5..cad69ef425c 100644 --- a/src/microsoft/spirv_to_dxil/spirv_to_dxil.h +++ b/src/microsoft/spirv_to_dxil/spirv_to_dxil.h @@ -165,6 +165,9 @@ struct dxil_spirv_runtime_conf { // The caller supports read-only images to be turned into SRV accesses, // which allows us to run the nir_opt_access() pass bool read_only_images_as_srvs; + + // Force sample rate shading on a fragment shader + bool force_sample_rate_shading; }; struct dxil_spirv_debug_options {