aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-03-01 13:13:44 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-01 19:17:44 +0000
commitbce5eb99e6c06489c5225698ff114d1624cf918c (patch)
treec6204182ee15302fc396a6b7c4fb2513cf381434
parent8fb750d512062db49010d26ff23ffb89854dc1ef (diff)
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 <jvanverth@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
-rw-r--r--src/gpu/vk/GrVkCaps.cpp77
1 files 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;