From 197671b58683134609c967aa3b4c48af7cf9bf56 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 5 Sep 2019 22:28:37 +0100 Subject: [PATCH] multisampling: only build the per-sample pipeline if the device supports it Bug: #605 --- examples/multisampling/multisampling.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/multisampling/multisampling.cpp b/examples/multisampling/multisampling.cpp index 476a3680..a7655f2f 100644 --- a/examples/multisampling/multisampling.cpp +++ b/examples/multisampling/multisampling.cpp @@ -577,13 +577,17 @@ public: VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.MSAA)); - // MSAA with sample shading pipeline - // Sample shading enables per-sample shading to avoid shader aliasing and smooth out e.g. high frequency texture maps - // Note: This will trade performance for are more stable image - multisampleState.sampleShadingEnable = VK_TRUE; // Enable per-sample shading (instead of per-fragment) - multisampleState.minSampleShading = 0.25f; // Minimum fraction for sample shading - - VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.MSAASampleShading)); + + if (vulkanDevice->features.sampleRateShading) + { + // MSAA with sample shading pipeline + // Sample shading enables per-sample shading to avoid shader aliasing and smooth out e.g. high frequency texture maps + // Note: This will trade performance for are more stable image + multisampleState.sampleShadingEnable = VK_TRUE; // Enable per-sample shading (instead of per-fragment) + multisampleState.minSampleShading = 0.25f; // Minimum fraction for sample shading + + VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr, &pipelines.MSAASampleShading)); + } } // Prepare and initialize uniform buffer containing shader uniforms