Commit b7fc9518 by Alexey Knyazev Committed by Commit Bot

Do not expose emulated ETC1 textures to WebGL

Add a new "emulatedEtc1" limitation. Bug: chromium:1048244 Change-Id: Ia04746773db3ad75781a8adfda988d36bd2c57f7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2718865Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
parent fcd7affb
......@@ -778,6 +778,9 @@ struct Limitations
// PVRTC1 textures must be squares.
bool squarePvrtc1 = false;
// ETC1 texture support is emulated.
bool emulatedEtc1 = false;
};
struct TypePrecision
......
......@@ -3722,6 +3722,12 @@ void Context::initCaps()
}
}
// Hide emulated ETC1 extension from WebGL contexts.
if (mWebGLContext && getLimitations().emulatedEtc1)
{
mSupportedExtensions.compressedETC1RGB8TextureOES = false;
}
// If we're capturing application calls for replay, don't expose any binary formats to prevent
// traces from trying to use cached results
if (getFrameCapture()->enabled())
......
......@@ -712,11 +712,16 @@ void DisplayMtl::initializeTextureCaps() const
// Re-verify texture extensions.
mNativeExtensions.setTextureExtensionSupport(mNativeTextureCaps);
// Enable ANGLE-specific ETC2/EAC extension that is not set by the call above.
// When ETC2/EAC formats are natively supported, enable ANGLE-specific extension string to
// expose them to WebGL. In other case, mark potentially-available ETC1 extension as emulated.
if (supportsAppleGPUFamily(1) && gl::DetermineCompressedTextureETCSupport(mNativeTextureCaps))
{
mNativeExtensions.compressedTextureETC = true;
}
else
{
mNativeLimitations.emulatedEtc1 = true;
}
// Enable ASTC sliced 3D, requires MTLGPUFamilyApple3
if (supportsAppleGPUFamily(3) && mNativeExtensions.textureCompressionASTCLDRKHR)
......
......@@ -295,12 +295,17 @@ void RendererVk::ensureCapsInitialized() const
// Enable GL_EXT_buffer_storage
mNativeExtensions.bufferStorageEXT = true;
// To ensure that ETC2/EAC formats are enabled only on hardware that supports them natively,
// this flag is not set by the function above and must be set explicitly. It exposes
// ANGLE_compressed_texture_etc extension string.
mNativeExtensions.compressedTextureETC =
(mPhysicalDeviceFeatures.textureCompressionETC2 == VK_TRUE) &&
gl::DetermineCompressedTextureETCSupport(mNativeTextureCaps);
// When ETC2/EAC formats are natively supported, enable ANGLE-specific extension string to
// expose them to WebGL. In other case, mark potentially-available ETC1 extension as emulated.
if ((mPhysicalDeviceFeatures.textureCompressionETC2 == VK_TRUE) &&
gl::DetermineCompressedTextureETCSupport(mNativeTextureCaps))
{
mNativeExtensions.compressedTextureETC = true;
}
else
{
mNativeLimitations.emulatedEtc1 = true;
}
// Vulkan doesn't support ASTC 3D block textures, which are required by
// GL_OES_texture_compression_astc.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment