From bce5eb99e6c06489c5225698ff114d1624cf918c Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Thu, 1 Mar 2018 13:13:44 -0500 Subject: Move the rest of Vulkan driver workarounds into helper function in GrVkCaps Bug: skia: Change-Id: Ic9dfc9d09b3fd1d6c8491f6da0d46d03c125a10f Reviewed-on: https://skia-review.googlesource.com/111440 Reviewed-by: Jim Van Verth Commit-Queue: Greg Daniel --- src/gpu/vk/GrVkCaps.cpp | 77 +++++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 32 deletions(-) diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index 6644ca6fde..40a0eb5e3f 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -112,10 +112,6 @@ void GrVkCaps::applyDriverCorrectnessWorkarounds(const VkPhysicalDevicePropertie fCrossContextTextureSupport = false; } - if (kARM_VkVendor == properties.vendorID) { - fInstanceAttribSupport = false; - } - #if defined(SK_BUILD_FOR_WIN) if (kNvidia_VkVendor == properties.vendorID) { fMustSleepOnTearDown = true; @@ -125,6 +121,51 @@ void GrVkCaps::applyDriverCorrectnessWorkarounds(const VkPhysicalDevicePropertie fMustSleepOnTearDown = true; } #endif + + // AMD seems to have issues binding new VkPipelines inside a secondary command buffer. + // Current workaround is to use a different secondary command buffer for each new VkPipeline. + if (kAMD_VkVendor == properties.vendorID) { + fNewCBOnPipelineChange = true; + } + + //////////////////////////////////////////////////////////////////////////// + // GrCaps workarounds + //////////////////////////////////////////////////////////////////////////// + + if (kARM_VkVendor == properties.vendorID) { + fInstanceAttribSupport = false; + } + + // AMD advertises support for MAX_UINT vertex input attributes, but in reality only supports 32. + if (kAMD_VkVendor == properties.vendorID) { + fMaxVertexAttributes = SkTMin(fMaxVertexAttributes, 32); + } + + if (kIntel_VkVendor == properties.vendorID) { + fCanUseWholeSizeOnFlushMappedMemory = false; + } + +#if defined(SK_CPU_X86) + if (kImagination_VkVendor == properties.vendorID) { + fSRGBSupport = false; + } +#endif + + //////////////////////////////////////////////////////////////////////////// + // GrShaderCaps workarounds + //////////////////////////////////////////////////////////////////////////// + + if (kAMD_VkVendor == properties.vendorID) { + // Currently DualSourceBlending is not working on AMD. vkCreateGraphicsPipeline fails when + // using a draw with dual source. Looking into whether it is driver bug or issue with our + // SPIR-V. Bug skia:6405 + fShaderCaps->fDualSourceBlendingSupport = false; + } + + if (kImagination_VkVendor == properties.vendorID) { + fShaderCaps->fAtan2ImplementedAsAtanYOverX = true; + } + } int get_max_sample_count(VkSampleCountFlags flags) { @@ -159,10 +200,6 @@ void GrVkCaps::initGrCaps(const VkPhysicalDeviceProperties& properties, // we ever find that need. static const uint32_t kMaxVertexAttributes = 64; fMaxVertexAttributes = SkTMin(properties.limits.maxVertexInputAttributes, kMaxVertexAttributes); - // AMD advertises support for MAX_UINT vertex input attributes, but in reality only supports 32. - if (kAMD_VkVendor == properties.vendorID) { - fMaxVertexAttributes = SkTMin(fMaxVertexAttributes, 32); - } // We could actually query and get a max size for each config, however maxImageDimension2D will // give the minimum max size across all configs. So for simplicity we will use that for now. @@ -181,21 +218,7 @@ void GrVkCaps::initGrCaps(const VkPhysicalDeviceProperties& properties, fOversizedStencilSupport = true; fSampleShadingSupport = SkToBool(featureFlags & kSampleRateShading_GrVkFeatureFlag); - // AMD seems to have issues binding new VkPipelines inside a secondary command buffer. - // Current workaround is to use a different secondary command buffer for each new VkPipeline. - if (kAMD_VkVendor == properties.vendorID) { - fNewCBOnPipelineChange = true; - } - if (kIntel_VkVendor == properties.vendorID) { - fCanUseWholeSizeOnFlushMappedMemory = false; - } - -#if defined(SK_CPU_X86) - if (kImagination_VkVendor == properties.vendorID) { - fSRGBSupport = false; - } -#endif } void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties, uint32_t featureFlags) { @@ -228,10 +251,6 @@ void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties, uint } } - if (kImagination_VkVendor == properties.vendorID) { - shaderCaps->fAtan2ImplementedAsAtanYOverX = true; - } - // Vulkan is based off ES 3.0 so the following should all be supported shaderCaps->fUsesPrecisionModifiers = true; shaderCaps->fFlatInterpolationSupport = true; @@ -247,12 +266,6 @@ void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties, uint shaderCaps->fGSInvocationsSupport = shaderCaps->fGeometryShaderSupport; shaderCaps->fDualSourceBlendingSupport = SkToBool(featureFlags & kDualSrcBlend_GrVkFeatureFlag); - if (kAMD_VkVendor == properties.vendorID) { - // Currently DualSourceBlending is not working on AMD. vkCreateGraphicsPipeline fails when - // using a draw with dual source. Looking into whether it is driver bug or issue with our - // SPIR-V. Bug skia:6405 - shaderCaps->fDualSourceBlendingSupport = false; - } shaderCaps->fIntegerSupport = true; shaderCaps->fTexelBufferSupport = true; -- cgit v1.2.3