aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGreg Daniel <egdaniel@google.com>2018-03-01 15:32:12 -0500
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2018-03-01 22:44:44 +0000
commit0aa4e74e8c3987b17af4ea1142c19b75848eb740 (patch)
treeb90056746a88ca3f3282b7623fdedf6642eb730e /src
parent6ce9d8849bc090128e21c841a2cb42c5b13d9de6 (diff)
downloadskqp-0aa4e74e8c3987b17af4ea1142c19b75848eb740.tar.gz
Move the rest of Vulkan driver workarounds into helper function in GrVkCaps
Move workaround for fSRGBsupport before config table init in GrVkCaps No-Tree-Checks: true 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> Reviewed-on: https://skia-review.googlesource.com/111462 Reviewed-by: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/vk/GrVkCaps.cpp81
1 files changed, 49 insertions, 32 deletions
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index a439bfa3a7..e56d0e8205 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -85,6 +85,16 @@ void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface*
this->initGrCaps(properties, memoryProperties, featureFlags);
this->initShaderCaps(properties, featureFlags);
+
+ if (!contextOptions.fDisableDriverCorrectnessWorkarounds) {
+#if defined(SK_CPU_X86)
+ // We need to do this before initing the config table since it uses fSRGBSupport
+ if (kImagination_VkVendor == properties.vendorID) {
+ fSRGBSupport = false;
+ }
+#endif
+ }
+
this->initConfigTable(vkInterface, physDev, properties);
this->initStencilFormat(vkInterface, physDev);
@@ -112,10 +122,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 +131,45 @@ 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;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // 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 +204,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.
@@ -178,21 +219,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) {
@@ -225,10 +252,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;
@@ -244,12 +267,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;