- Revision
- 275073
- Author
- [email protected]
- Date
- 2021-03-25 20:09:08 -0700 (Thu, 25 Mar 2021)
Log Message
[Metal ANGLE] Add CPU mipmap generation for workaround on Intel devices.
https://bugs.webkit.org/show_bug.cgi?id=223778
Patch by Kyle Piddington <[email protected]> on 2021-03-25
Reviewed by Dean Jackson.
Mipmap generation on Intel does not reliably work for textures with
width less than four. To reliably pass webGL conformance, we need
to switch to CPU mipmap generation when generating mipmaps in this
specific circumstance.
This patch fixes the following four tests on Intel
webgl/1.0.3/conformance/limits/gl-max-texture-dimensions.html
webgl/1.0.3/conformance/textures/texture-size.html
webgl/2.0.0/conformance/limits/gl-max-texture-dimensions.html
webgl/2.0.0/conformance/textures/misc/texture-size.html
* include/platform/Feature.h:
(angle::FeatureCategoryToString):
* include/platform/FeaturesMtl.h:
* src/libANGLE/renderer/metal/DisplayMtl.mm:
(rx::DisplayMtl::initializeFeatures):
* src/libANGLE/renderer/metal/TextureMtl.mm:
(rx::TextureMtl::generateMipmap):
Modified Paths
Diff
Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (275072 => 275073)
--- trunk/Source/ThirdParty/ANGLE/ChangeLog 2021-03-26 02:27:29 UTC (rev 275072)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog 2021-03-26 03:09:08 UTC (rev 275073)
@@ -1,3 +1,29 @@
+2021-03-25 Kyle Piddington <[email protected]>
+
+ [Metal ANGLE] Add CPU mipmap generation for workaround on Intel devices.
+ https://bugs.webkit.org/show_bug.cgi?id=223778
+
+ Reviewed by Dean Jackson.
+
+ Mipmap generation on Intel does not reliably work for textures with
+ width less than four. To reliably pass webGL conformance, we need
+ to switch to CPU mipmap generation when generating mipmaps in this
+ specific circumstance.
+
+ This patch fixes the following four tests on Intel
+ webgl/1.0.3/conformance/limits/gl-max-texture-dimensions.html
+ webgl/1.0.3/conformance/textures/texture-size.html
+ webgl/2.0.0/conformance/limits/gl-max-texture-dimensions.html
+ webgl/2.0.0/conformance/textures/misc/texture-size.html
+
+ * include/platform/Feature.h:
+ (angle::FeatureCategoryToString):
+ * include/platform/FeaturesMtl.h:
+ * src/libANGLE/renderer/metal/DisplayMtl.mm:
+ (rx::DisplayMtl::initializeFeatures):
+ * src/libANGLE/renderer/metal/TextureMtl.mm:
+ (rx::TextureMtl::generateMipmap):
+
2021-03-25 Jessie Berlin <[email protected]>
Remove 10.13 DEPLOYMENT_TARGETs and SYSTEM_VERSION_PREFIXs
Modified: trunk/Source/ThirdParty/ANGLE/include/platform/Feature.h (275072 => 275073)
--- trunk/Source/ThirdParty/ANGLE/include/platform/Feature.h 2021-03-26 02:27:29 UTC (rev 275072)
+++ trunk/Source/ThirdParty/ANGLE/include/platform/Feature.h 2021-03-26 03:09:08 UTC (rev 275073)
@@ -33,6 +33,7 @@
VulkanWorkarounds,
VulkanFeatures,
MetalFeatures,
+ MetalWorkarounds,
};
constexpr char kFeatureCategoryFrontendWorkarounds[] = "Frontend workarounds";
@@ -43,6 +44,7 @@
constexpr char kFeatureCategoryVulkanWorkarounds[] = "Vulkan workarounds";
constexpr char kFeatureCategoryVulkanFeatures[] = "Vulkan features";
constexpr char kFeatureCategoryMetalFeatures[] = "Metal features";
+constexpr char kFeatureCategoryMetalWorkarounds[] = "Metal Workarounds";
constexpr char kFeatureCategoryUnknown[] = "Unknown";
inline const char *FeatureCategoryToString(const FeatureCategory &fc)
@@ -81,6 +83,10 @@
return kFeatureCategoryMetalFeatures;
break;
+ case FeatureCategory::MetalWorkarounds:
+ return kFeatureCategoryMetalWorkarounds;
+ break;
+
default:
return kFeatureCategoryUnknown;
break;
Modified: trunk/Source/ThirdParty/ANGLE/include/platform/FeaturesMtl.h (275072 => 275073)
--- trunk/Source/ThirdParty/ANGLE/include/platform/FeaturesMtl.h 2021-03-26 02:27:29 UTC (rev 275072)
+++ trunk/Source/ThirdParty/ANGLE/include/platform/FeaturesMtl.h 2021-03-26 03:09:08 UTC (rev 275073)
@@ -120,6 +120,11 @@
"rewrite_row_major_matrices", FeatureCategory::MetalFeatures,
"Rewrite row major matrices in shaders as column major.",
&members};
+
+ Feature intelThinMipmapWorkaround = {
+ "intel_thin_mipmap_workaround", FeatureCategory::MetalWorkarounds,
+ "Generate mipmaps for thin (<5 pixel) wide textures on the CPU for Intel",
+ &members};
};
} // namespace angle
Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm (275072 => 275073)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm 2021-03-26 02:27:29 UTC (rev 275072)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm 2021-03-26 03:09:08 UTC (rev 275073)
@@ -856,6 +856,8 @@
ANGLE_FEATURE_CONDITION((&mFeatures), rewriteRowMajorMatrices, true);
ANGLE_FEATURE_CONDITION((&mFeatures), emulateTransformFeedback, true);
+ ANGLE_FEATURE_CONDITION((&mFeatures),intelThinMipmapWorkaround, isIntel());
+
angle::PlatformMethods *platform = ANGLEPlatformCurrent();
platform->overrideFeaturesMtl(platform, &mFeatures);
Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/TextureMtl.mm (275072 => 275073)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/TextureMtl.mm 2021-03-26 02:27:29 UTC (rev 275072)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/TextureMtl.mm 2021-03-26 03:09:08 UTC (rev 275073)
@@ -1119,6 +1119,9 @@
//
bool sRGB = mFormat.actualInternalFormat().colorEncoding == GL_SRGB;
+ bool needsCPUPath = contextMtl->getDisplay()->getFeatures().intelThinMipmapWorkaround.enabled
+ && mNativeTexture->widthAt0() < 5;
+
if (caps.writable && mState.getType() == gl::TextureType::_3D)
{
// http://anglebug.com/4921.
@@ -1127,7 +1130,7 @@
ANGLE_TRY(contextMtl->getDisplay()->getUtils().generateMipmapCS(contextMtl, mNativeTexture,
sRGB, &mNativeLevelViews));
}
- else if (caps.filterable && caps.colorRenderable)
+ else if (!needsCPUPath && caps.filterable && caps.colorRenderable)
{
mtl::BlitCommandEncoder *blitEncoder = contextMtl->getBlitCommandEncoder();
blitEncoder->generateMipmapsForTexture(mNativeTexture);