Bug 1306174 - Remove ETC support from core WebGL2. r=ethlin, a=ritu
authorJeff Gilbert <jdashg@gmail.com>
Wed, 28 Sep 2016 16:32:34 -0700
changeset 356105 5a3299a08cb7904639232ed809e1bd46b7b8c894
parent 356104 7accfe73f21270e6ce3763309690876f62f0fd23
child 356106 5da0f51ab6dedc79ef70db5d6d56d9215cf237fe
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersethlin, ritu
bugs1306174
milestone51.0a2
Bug 1306174 - Remove ETC support from core WebGL2. r=ethlin, a=ritu
dom/canvas/WebGL2Context.cpp
dom/canvas/WebGLContextExtensions.cpp
dom/canvas/WebGLExtensionCompressedTextureES3.cpp
dom/canvas/WebGLFormats.cpp
dom/canvas/WebGLTypes.h
--- a/dom/canvas/WebGL2Context.cpp
+++ b/dom/canvas/WebGL2Context.cpp
@@ -175,30 +175,12 @@ WebGLContext::InitWebGL2(FailureReason* 
         gl->fEnable(LOCAL_GL_PRIMITIVE_RESTART_FIXED_INDEX);
     } else {
         MOZ_ASSERT(gl->IsSupported(gl::GLFeature::prim_restart));
         gl->fEnable(LOCAL_GL_PRIMITIVE_RESTART);
     }
 
     //////
 
-    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/WebGLContextExtensions.cpp
+++ b/dom/canvas/WebGLContextExtensions.cpp
@@ -43,17 +43,17 @@ WebGLContext::GetExtensionString(WebGLEx
         WEBGL_EXTENSION_IDENTIFIER(OES_standard_derivatives)
         WEBGL_EXTENSION_IDENTIFIER(OES_texture_float)
         WEBGL_EXTENSION_IDENTIFIER(OES_texture_float_linear)
         WEBGL_EXTENSION_IDENTIFIER(OES_texture_half_float)
         WEBGL_EXTENSION_IDENTIFIER(OES_texture_half_float_linear)
         WEBGL_EXTENSION_IDENTIFIER(OES_vertex_array_object)
         WEBGL_EXTENSION_IDENTIFIER(WEBGL_color_buffer_float)
         WEBGL_EXTENSION_IDENTIFIER(WEBGL_compressed_texture_atc)
-        WEBGL_EXTENSION_IDENTIFIER(WEBGL_compressed_texture_es3)
+        WEBGL_EXTENSION_IDENTIFIER(WEBGL_compressed_texture_es3_0)
         WEBGL_EXTENSION_IDENTIFIER(WEBGL_compressed_texture_etc1)
         WEBGL_EXTENSION_IDENTIFIER(WEBGL_compressed_texture_pvrtc)
         WEBGL_EXTENSION_IDENTIFIER(WEBGL_compressed_texture_s3tc)
         WEBGL_EXTENSION_IDENTIFIER(WEBGL_debug_renderer_info)
         WEBGL_EXTENSION_IDENTIFIER(WEBGL_debug_shaders)
         WEBGL_EXTENSION_IDENTIFIER(WEBGL_depth_texture)
         WEBGL_EXTENSION_IDENTIFIER(WEBGL_draw_buffers)
         WEBGL_EXTENSION_IDENTIFIER(WEBGL_lose_context)
@@ -117,16 +117,18 @@ WebGLContext::IsExtensionSupported(WebGL
 
     // OES_
     case WebGLExtensionID::OES_texture_float_linear:
         return gl->IsSupported(gl::GLFeature::texture_float_linear);
 
     // WEBGL_
     case WebGLExtensionID::WEBGL_compressed_texture_atc:
         return gl->IsExtensionSupported(gl::GLContext::AMD_compressed_ATC_texture);
+    case WebGLExtensionID::WEBGL_compressed_texture_es3_0:
+        return gl->IsSupported(gl::GLFeature::ES3_compatibility);
     case WebGLExtensionID::WEBGL_compressed_texture_etc1:
         return gl->IsExtensionSupported(gl::GLContext::OES_compressed_ETC1_RGB8_texture);
     case WebGLExtensionID::WEBGL_compressed_texture_pvrtc:
         return gl->IsExtensionSupported(gl::GLContext::IMG_texture_compression_pvrtc);
     case WebGLExtensionID::WEBGL_compressed_texture_s3tc:
         if (gl->IsExtensionSupported(gl::GLContext::EXT_texture_compression_s3tc))
             return true;
 
@@ -207,18 +209,16 @@ WebGLContext::IsExtensionSupported(WebGL
             // For warnings-as-errors.
             break;
         }
 
         if (gfxPrefs::WebGLDraftExtensionsEnabled()) {
             switch (ext) {
             case WebGLExtensionID::EXT_disjoint_timer_query:
                 return WebGLExtensionDisjointTimerQuery::IsSupported(this);
-            case WebGLExtensionID::WEBGL_compressed_texture_es3:
-                return gl->IsExtensionSupported(gl::GLContext::ARB_ES3_compatibility);
 
             default:
                 // For warnings-as-errors.
                 break;
             }
         }
     }
 
@@ -390,17 +390,17 @@ WebGLContext::EnableExtension(WebGLExten
 
     // WEBGL_
     case WebGLExtensionID::WEBGL_color_buffer_float:
         obj = new WebGLExtensionColorBufferFloat(this);
         break;
     case WebGLExtensionID::WEBGL_compressed_texture_atc:
         obj = new WebGLExtensionCompressedTextureATC(this);
         break;
-    case WebGLExtensionID::WEBGL_compressed_texture_es3:
+    case WebGLExtensionID::WEBGL_compressed_texture_es3_0:
         obj = new WebGLExtensionCompressedTextureES3(this);
         break;
     case WebGLExtensionID::WEBGL_compressed_texture_etc1:
         obj = new WebGLExtensionCompressedTextureETC1(this);
         break;
     case WebGLExtensionID::WEBGL_compressed_texture_pvrtc:
         obj = new WebGLExtensionCompressedTexturePVRTC(this);
         break;
--- a/dom/canvas/WebGLExtensionCompressedTextureES3.cpp
+++ b/dom/canvas/WebGLExtensionCompressedTextureES3.cpp
@@ -12,16 +12,28 @@
 #error FOO is already defined! We use FOO() macros to keep things succinct in this file.
 #endif
 
 namespace mozilla {
 
 WebGLExtensionCompressedTextureES3::WebGLExtensionCompressedTextureES3(WebGLContext* webgl)
     : WebGLExtensionBase(webgl)
 {
+    // GLES 3.0.4, p147, table 3.19
+    // GLES 3.0.4, p286+, $C.1 "ETC Compressed Texture Image 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
+    // listed in table 3.13.
+
     RefPtr<WebGLContext> webgl_ = webgl; // Bug 1201275
     const auto fnAdd = [&webgl_](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
         auto& fua = webgl_->mFormatUsage;
 
         auto usage = fua->EditUsage(effFormat);
         usage->isFilterable = true;
         fua->AllowSizedTexFormat(sizedFormat, usage);
 
--- a/dom/canvas/WebGLFormats.cpp
+++ b/dom/canvas/WebGLFormats.cpp
@@ -954,38 +954,16 @@ FormatUsageAuthority::CreateForWebGL2(gl
 
     // GLES 3.0.4, p133, table 3.14
     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"
-    // 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
-    // listed in table 3.13.
-    fnAllowES3TexFormat(FOO(COMPRESSED_RGB8_ETC2                     ), false, true);
-    fnAllowES3TexFormat(FOO(COMPRESSED_SRGB8_ETC2                    ), false, true);
-    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);
-
 #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->SetRenderable();
--- a/dom/canvas/WebGLTypes.h
+++ b/dom/canvas/WebGLTypes.h
@@ -153,17 +153,17 @@ enum class WebGLExtensionID : uint8_t {
     OES_standard_derivatives,
     OES_texture_float,
     OES_texture_float_linear,
     OES_texture_half_float,
     OES_texture_half_float_linear,
     OES_vertex_array_object,
     WEBGL_color_buffer_float,
     WEBGL_compressed_texture_atc,
-    WEBGL_compressed_texture_es3,
+    WEBGL_compressed_texture_es3_0,
     WEBGL_compressed_texture_etc1,
     WEBGL_compressed_texture_pvrtc,
     WEBGL_compressed_texture_s3tc,
     WEBGL_debug_renderer_info,
     WEBGL_debug_shaders,
     WEBGL_depth_texture,
     WEBGL_draw_buffers,
     WEBGL_lose_context,