microsoft/compiler: Use nir info.fs.uses_sample_shading to force sample-rate

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20614>
This commit is contained in:
Jesse Natalie 2023-01-05 10:36:27 -08:00 committed by Marge Bot
parent cbc481f39f
commit 5d8e89f92f
3 changed files with 7 additions and 5 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -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) {