Bug 1285117 - Reintroduce WebGL2 compressed formats. - r=ethlin
MozReview-Commit-ID: IYNkrE33ywr
--- a/dom/canvas/WebGL2Context.cpp
+++ b/dom/canvas/WebGL2Context.cpp
@@ -157,12 +157,32 @@ WebGLContext::InitWebGL2(FailureReason*
if (!gl->IsGLES()) {
// Desktop OpenGL requires the following to be enabled in order to
// support sRGB operations on framebuffers.
gl->MakeCurrent();
gl->fEnable(LOCAL_GL_FRAMEBUFFER_SRGB_EXT);
}
+ //////
+
+ static const GLenum kWebGL2_CompressedFormats[] = {
+ LOCAL_GL_COMPRESSED_R11_EAC,
+ LOCAL_GL_COMPRESSED_SIGNED_R11_EAC,
+ LOCAL_GL_COMPRESSED_RG11_EAC,
+ LOCAL_GL_COMPRESSED_SIGNED_RG11_EAC,
+ LOCAL_GL_COMPRESSED_RGB8_ETC2,
+ LOCAL_GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ LOCAL_GL_COMPRESSED_RGBA8_ETC2_EAC,
+ LOCAL_GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
+ LOCAL_GL_COMPRESSED_SRGB8_ETC2,
+ LOCAL_GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
+ };
+
+ mCompressedTextureFormats.AppendElements(kWebGL2_CompressedFormats,
+ MOZ_ARRAY_LENGTH(kWebGL2_CompressedFormats));
+
+ //////
+
return true;
}
} // namespace mozilla
--- a/dom/canvas/WebGLFormats.cpp
+++ b/dom/canvas/WebGLFormats.cpp
@@ -801,17 +801,16 @@ FormatUsageAuthority::CreateForWebGL2(gl
fnAllowES3TexFormat(FOO(DEPTH_COMPONENT16 ), true, false);
fnAllowES3TexFormat(FOO(DEPTH_COMPONENT24 ), true, false);
fnAllowES3TexFormat(FOO(DEPTH_COMPONENT32F), true, false);
fnAllowES3TexFormat(FOO(DEPTH24_STENCIL8 ), true, false);
fnAllowES3TexFormat(FOO(DEPTH32F_STENCIL8 ), true, false);
// GLES 3.0.4, p147, table 3.19
// GLES 3.0.4, p286+, $C.1 "ETC Compressed Texture Image Formats"
-#if ALLOW_ES3_FORMATS
// Note that all compressed texture formats are filterable:
// GLES 3.0.4 p161:
// "[A] texture is complete unless any of the following conditions hold true:
// [...]
// * The effective internal format specified for the texture arrays is a sized
// internal color format that is not texture-filterable (see table 3.13) and [the
// mag filter requires filtering]."
// Compressed formats are not sized internal color formats, and indeed they are not
@@ -821,17 +820,17 @@ FormatUsageAuthority::CreateForWebGL2(gl
fnAllowES3TexFormat(FOO(COMPRESSED_RGBA8_ETC2_EAC ), false, true);
fnAllowES3TexFormat(FOO(COMPRESSED_SRGB8_ALPHA8_ETC2_EAC ), false, true);
fnAllowES3TexFormat(FOO(COMPRESSED_R11_EAC ), false, true);
fnAllowES3TexFormat(FOO(COMPRESSED_RG11_EAC ), false, true);
fnAllowES3TexFormat(FOO(COMPRESSED_SIGNED_R11_EAC ), false, true);
fnAllowES3TexFormat(FOO(COMPRESSED_SIGNED_RG11_EAC ), false, true);
fnAllowES3TexFormat(FOO(COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 ), false, true);
fnAllowES3TexFormat(FOO(COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2), false, true);
-#endif
+
#undef FOO
// GLES 3.0.4, p206, "Required Renderbuffer Formats":
// "Implementations are also required to support STENCIL_INDEX8. Requesting this
// internal format for a renderbuffer will allocate at least 8 stencil bit planes."
auto usage = ptr->EditUsage(EffectiveFormat::STENCIL_INDEX8);
usage->isRenderable = true;