Mesa (main): microsoft/spirv_to_dxil: Allow forcing per-sample shading
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Apr 19 09:12:22 UTC 2022
Module: Mesa
Branch: main
Commit: 80a5deee620cfee7a8d1f63ef1b2b1736995895b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=80a5deee620cfee7a8d1f63ef1b2b1736995895b
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Wed Apr 13 02:14:36 2022 -0700
microsoft/spirv_to_dxil: Allow forcing per-sample shading
Needed to support VkPipelineMultisampleStateCreateInfo::sampleShadingEnable.
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15916>
---
src/microsoft/spirv_to_dxil/spirv_to_dxil.c | 7 +++++++
src/microsoft/spirv_to_dxil/spirv_to_dxil.h | 3 +++
2 files changed, 10 insertions(+)
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 {
More information about the mesa-commit
mailing list