1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "WebGLExtensions.h"
8 #include "mozilla/dom/WebGLRenderingContextBinding.h"
9 #include "WebGLContext.h"
10 #include "WebGLFormats.h"
14 WebGLExtensionCompressedTextureES3::WebGLExtensionCompressedTextureES3(
16 : WebGLExtensionBase(webgl
) {
17 // GLES 3.0.4, p147, table 3.19
18 // GLES 3.0.4, p286+, $C.1 "ETC Compressed Texture Image Formats"
19 // Note that all compressed texture formats are filterable:
21 // "[A] texture is complete unless any of the following conditions hold true:
23 // * The effective internal format specified for the texture arrays is a
24 // sized internal color format that is not texture-filterable (see table
25 // 3.13) and [the mag filter requires filtering]."
26 // Compressed formats are not sized internal color formats, and indeed they
27 // are not listed in table 3.13.
29 RefPtr
<WebGLContext
> webgl_
= webgl
; // Bug 1201275
30 const auto fnAdd
= [&webgl_
](GLenum sizedFormat
,
31 webgl::EffectiveFormat effFormat
) {
32 auto& fua
= webgl_
->mFormatUsage
;
34 auto usage
= fua
->EditUsage(effFormat
);
35 usage
->isFilterable
= true;
36 fua
->AllowSizedTexFormat(sizedFormat
, usage
);
39 #define FOO(x) LOCAL_GL_##x, webgl::EffectiveFormat::x
41 fnAdd(FOO(COMPRESSED_R11_EAC
));
42 fnAdd(FOO(COMPRESSED_SIGNED_R11_EAC
));
43 fnAdd(FOO(COMPRESSED_RG11_EAC
));
44 fnAdd(FOO(COMPRESSED_SIGNED_RG11_EAC
));
45 fnAdd(FOO(COMPRESSED_RGB8_ETC2
));
46 fnAdd(FOO(COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
));
47 fnAdd(FOO(COMPRESSED_RGBA8_ETC2_EAC
));
49 // sRGB support is manadatory in GL 4.3 and GL ES 3.0, which are the only
50 // versions to support ETC2.
51 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
));
52 fnAdd(FOO(COMPRESSED_SRGB8_ETC2
));
53 fnAdd(FOO(COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
));
58 } // namespace mozilla