Mesa (19.2): radv: fix enabling sample shading with SampleID/SamplePosition
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Dec 4 22:09:37 UTC 2019
Module: Mesa
Branch: 19.2
Commit: a3869c14c0d5a1731e07c5dceb2e8052793e208e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3869c14c0d5a1731e07c5dceb2e8052793e208e
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Tue Nov 26 18:29:00 2019 +0100
radv: fix enabling sample shading with SampleID/SamplePosition
When a fragment shader includes an input variable decorated with
SampleId or SamplePosition, sample shading should be enabled
because minSampleShadingFactor is expected to be 1.0.
Cc: 19.2, 19.3 <mesa-stable at lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
(cherry picked from commit 86a5fbfd4afb4fb53ab8ea0a13dda33b32f8b79b)
Conflicts resolved by Dylan Baker
---
src/amd/vulkan/radv_pipeline.c | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 654f852ab21..584d4cc5bea 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -1122,15 +1122,32 @@ radv_pipeline_init_multisample_state(struct radv_pipeline *pipeline,
int ps_iter_samples = 1;
uint32_t mask = 0xffff;
- if (vkms)
+ if (vkms) {
ms->num_samples = vkms->rasterizationSamples;
- else
- ms->num_samples = 1;
- if (vkms)
- ps_iter_samples = radv_pipeline_get_ps_iter_samples(vkms);
- if (vkms && !vkms->sampleShadingEnable && pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.force_persample) {
- ps_iter_samples = ms->num_samples;
+ /* From the Vulkan 1.1.129 spec, 26.7. Sample Shading:
+ *
+ * "Sample shading is enabled for a graphics pipeline:
+ *
+ * - If the interface of the fragment shader entry point of the
+ * graphics pipeline includes an input variable decorated
+ * with SampleId or SamplePosition. In this case
+ * minSampleShadingFactor takes the value 1.0.
+ * - Else if the sampleShadingEnable member of the
+ * VkPipelineMultisampleStateCreateInfo structure specified
+ * when creating the graphics pipeline is set to VK_TRUE. In
+ * this case minSampleShadingFactor takes the value of
+ * VkPipelineMultisampleStateCreateInfo::minSampleShading.
+ *
+ * Otherwise, sample shading is considered disabled."
+ */
+ if (pipeline->shaders[MESA_SHADER_FRAGMENT]->info.info.ps.force_persample) {
+ ps_iter_samples = ms->num_samples;
+ } else {
+ ps_iter_samples = radv_pipeline_get_ps_iter_samples(vkms);
+ }
+ } else {
+ ms->num_samples = 1;
}
const struct VkPipelineRasterizationStateRasterizationOrderAMD *raster_order =
More information about the mesa-commit
mailing list