Bug 1700051: part 26) Correct typo in comment of `mozInlineSpellWordUtil::BuildSoftTe...
[gecko.git] / dom / canvas / WebGLExtensionCompressedTextureASTC.cpp
blob22cc1ca42f0f846b2e292fa6c82e0b1469b8b8e4
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"
7 #include "GLContext.h"
8 #include "mozilla/dom/WebGLRenderingContextBinding.h"
9 #include "WebGLContext.h"
10 #include "WebGLFormats.h"
12 namespace mozilla {
14 WebGLExtensionCompressedTextureASTC::WebGLExtensionCompressedTextureASTC(
15 WebGLContext* webgl)
16 : WebGLExtensionBase(webgl) {
17 MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
19 RefPtr<WebGLContext> webgl_ = webgl; // Bug 1201275
20 const auto fnAdd = [&webgl_](GLenum sizedFormat,
21 webgl::EffectiveFormat effFormat) {
22 auto& fua = webgl_->mFormatUsage;
24 auto usage = fua->EditUsage(effFormat);
25 usage->isFilterable = true;
26 fua->AllowSizedTexFormat(sizedFormat, usage);
29 #define FOO(x) LOCAL_GL_##x, webgl::EffectiveFormat::x
31 fnAdd(FOO(COMPRESSED_RGBA_ASTC_4x4_KHR));
32 fnAdd(FOO(COMPRESSED_RGBA_ASTC_5x4_KHR));
33 fnAdd(FOO(COMPRESSED_RGBA_ASTC_5x5_KHR));
34 fnAdd(FOO(COMPRESSED_RGBA_ASTC_6x5_KHR));
35 fnAdd(FOO(COMPRESSED_RGBA_ASTC_6x6_KHR));
36 fnAdd(FOO(COMPRESSED_RGBA_ASTC_8x5_KHR));
37 fnAdd(FOO(COMPRESSED_RGBA_ASTC_8x6_KHR));
38 fnAdd(FOO(COMPRESSED_RGBA_ASTC_8x8_KHR));
39 fnAdd(FOO(COMPRESSED_RGBA_ASTC_10x5_KHR));
40 fnAdd(FOO(COMPRESSED_RGBA_ASTC_10x6_KHR));
41 fnAdd(FOO(COMPRESSED_RGBA_ASTC_10x8_KHR));
42 fnAdd(FOO(COMPRESSED_RGBA_ASTC_10x10_KHR));
43 fnAdd(FOO(COMPRESSED_RGBA_ASTC_12x10_KHR));
44 fnAdd(FOO(COMPRESSED_RGBA_ASTC_12x12_KHR));
46 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR));
47 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR));
48 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR));
49 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR));
50 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR));
51 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR));
52 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR));
53 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR));
54 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR));
55 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR));
56 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR));
57 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR));
58 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR));
59 fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR));
61 #undef FOO
64 bool WebGLExtensionCompressedTextureASTC::IsSupported(
65 const WebGLContext* webgl) {
66 gl::GLContext* gl = webgl->GL();
67 return gl->IsExtensionSupported(
68 gl::GLContext::KHR_texture_compression_astc_ldr);
71 } // namespace mozilla