summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-11-26 18:29:00 +0100
committerSamuel Pitoiset <[email protected]>2019-11-27 07:22:54 +0100
commit86a5fbfd4afb4fb53ab8ea0a13dda33b32f8b79b (patch)
tree4e44ea2793d29274481c09122e3b1fb5876393c4 /src
parent62ff90cc5e444d173a92cb26da38a2ff252731df (diff)
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 <[email protected]> Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/amd/vulkan/radv_pipeline.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index dc2cbc4884b..95b1684fdf8 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -1099,15 +1099,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.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.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 =