Reland "Enable msaa ccpr on vulkan"
This is a reland of cb73b6250ec57b2d0e1d778753713140baef4d6d
Original change's description:
> Enable msaa ccpr on vulkan
>
> TBR=egdaniel@google.com
>
> Bug: skia:9643
> Change-Id: Ie06891734b700c940b996a63c7b1264ce0f2597c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254808
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Auto-Submit: Chris Dalton <csmartdalton@google.com>
Bug: skia:9643
Change-Id: I2537f03fad41ebddabbae94312b3836f7a948639
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255008
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/ccpr/GrStencilAtlasOp.cpp b/src/gpu/ccpr/GrStencilAtlasOp.cpp
index 99d513e..258e495 100644
--- a/src/gpu/ccpr/GrStencilAtlasOp.cpp
+++ b/src/gpu/ccpr/GrStencilAtlasOp.cpp
@@ -90,11 +90,13 @@
);
// Resolves stencil winding counts to A8 coverage. Leaves stencil values untouched.
+// NOTE: For the CCW face we intentionally use "1 == (stencil & 1)" because the contrapositive logic
+// (i.e. 0 != ...) causes bugs on Adreno Vulkan. http://skbug.com/9643
static constexpr GrUserStencilSettings kResolveStencilCoverage(
GrUserStencilSettings::StaticInitSeparate<
- 0x0000, 0x0000,
- GrUserStencilTest::kNotEqual, GrUserStencilTest::kNotEqual,
- 0xffff, 0x1,
+ 0x0000, 0x0001,
+ GrUserStencilTest::kNotEqual, GrUserStencilTest::kEqual,
+ 0xffff, 0x0001,
GrUserStencilOp::kKeep, GrUserStencilOp::kKeep,
GrUserStencilOp::kKeep, GrUserStencilOp::kKeep,
0xffff, 0xffff>()
@@ -106,7 +108,7 @@
GrUserStencilSettings::StaticInitSeparate<
0x0000, 0x0000,
GrUserStencilTest::kNotEqual, GrUserStencilTest::kNotEqual,
- 0xffff, 0x1,
+ 0xffff, 0x0001,
GrUserStencilOp::kZero, GrUserStencilOp::kZero,
GrUserStencilOp::kKeep, GrUserStencilOp::kKeep,
0xffff, 0xffff>()
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index aeb9ec7..6544ab1 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -385,13 +385,14 @@
this->initStencilFormat(vkInterface, physDev);
if (!contextOptions.fDisableDriverCorrectnessWorkarounds) {
- this->applyDriverCorrectnessWorkarounds(properties);
+ this->applyDriverCorrectnessWorkarounds(properties, extensions);
}
this->finishInitialization(contextOptions);
}
-void GrVkCaps::applyDriverCorrectnessWorkarounds(const VkPhysicalDeviceProperties& properties) {
+void GrVkCaps::applyDriverCorrectnessWorkarounds(const VkPhysicalDeviceProperties& properties,
+ const GrVkExtensions& extensions) {
if (kQualcomm_VkVendor == properties.vendorID) {
fMustDoCopiesFromOrigin = true;
// Transfer doesn't support this workaround.
@@ -441,9 +442,17 @@
// GrCaps workarounds
////////////////////////////////////////////////////////////////////////////
- // Temporarily disable the MSAA implementation of CCPR while we work out a crash on Win10
- // GTX660 and incorrect rendring on Adreno.
- fDriverBlacklistMSAACCPR = true;
+ // The GTX660 bot experiences crashes when running msaa ccpr with 8k textures.
+ // (We get VK_ERROR_DEVICE_LOST when calling vkGetFenceStatus.)
+ // ((Checking for mixed samples is an easy way to detect pre-maxwell architectures.))
+ bool isNVIDIAPreMaxwell = (kNvidia_VkVendor == properties.vendorID) &&
+ !extensions.hasExtension(VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME, 1);
+
+ if (isNVIDIAPreMaxwell || fDriverBugWorkarounds.max_texture_size_limit_4096) {
+ fMaxTextureSize = SkTMin(fMaxTextureSize, 4096);
+ fMaxRenderTargetSize = SkTMin(fMaxRenderTargetSize, fMaxTextureSize);
+ fMaxPreferredRenderTargetSize = SkTMin(fMaxPreferredRenderTargetSize, fMaxRenderTargetSize);
+ }
if (kARM_VkVendor == properties.vendorID) {
fInstanceAttribSupport = false;
@@ -500,9 +509,6 @@
// give the minimum max size across all configs. So for simplicity we will use that for now.
fMaxRenderTargetSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
fMaxTextureSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
- if (fDriverBugWorkarounds.max_texture_size_limit_4096) {
- fMaxTextureSize = SkTMin(fMaxTextureSize, 4096);
- }
// Our render targets are always created with textures as the color
// attachment, hence this min:
fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize);
diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h
index b0ced01..5547afc 100644
--- a/src/gpu/vk/GrVkCaps.h
+++ b/src/gpu/vk/GrVkCaps.h
@@ -216,7 +216,8 @@
void initFormatTable(const GrVkInterface*, VkPhysicalDevice, const VkPhysicalDeviceProperties&);
void initStencilFormat(const GrVkInterface* iface, VkPhysicalDevice physDev);
- void applyDriverCorrectnessWorkarounds(const VkPhysicalDeviceProperties&);
+ void applyDriverCorrectnessWorkarounds(const VkPhysicalDeviceProperties&,
+ const GrVkExtensions&);
bool onSurfaceSupportsWritePixels(const GrSurface*) const override;
bool onCanCopySurface(const GrSurfaceProxy* dst, const GrSurfaceProxy* src,