Re-add Perlin noise rounding workaround for Android Vulkan
Without this workaround the filters-turb-01-f.svg Gold images are very very wrong for the P30/MaliG76 for the vk config(s).
There are also some subtle-ish artifacts (~19/255 magnitude) on the GalaxyS7_G930FD/MaliT880 for the vk config(s) on the same SVG.
Bug: skia:14171
Change-Id: I6d774bc708fcb80e9739ad7879c3c18a52f4af64
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/664181
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ganesh/gl/GrGLCaps.cpp b/src/gpu/ganesh/gl/GrGLCaps.cpp
index 9cc66ee..d4546ae 100644
--- a/src/gpu/ganesh/gl/GrGLCaps.cpp
+++ b/src/gpu/ganesh/gl/GrGLCaps.cpp
@@ -4110,6 +4110,10 @@
}
#if defined(SK_BUILD_FOR_ANDROID)
+ // On the following GPUs, the Perlin noise code needs to aggressively snap to multiples
+ // of 1/255 to avoid artifacts in the double table lookup:
+ // Tegra3, PowerVRGE8320 (Wembley), MaliG76, and Adreno308
+ // Given the range of vendors we're just blanket enabling it on Android for OpenGL.
fShaderCaps->fPerlinNoiseRoundingFix = true;
#endif
diff --git a/src/gpu/ganesh/vk/GrVkCaps.cpp b/src/gpu/ganesh/vk/GrVkCaps.cpp
index 1413203..9cbd016 100644
--- a/src/gpu/ganesh/vk/GrVkCaps.cpp
+++ b/src/gpu/ganesh/vk/GrVkCaps.cpp
@@ -553,6 +553,12 @@
fShaderCaps->fColorSpaceMathNeedsFloat = true;
}
+ // On the Mali G76 and T880, the Perlin noise code needs to aggressively snap to multiples
+ // of 1/255 to avoid artifacts in the double table lookup.
+ if (kARM_VkVendor == properties.vendorID) {
+ fShaderCaps->fPerlinNoiseRoundingFix = true;
+ }
+
// On various devices, when calling vkCmdClearAttachments on a primary command buffer, it
// corrupts the bound buffers on the command buffer. As a workaround we invalidate our knowledge
// of bound buffers so that we will rebind them on the next draw.