Bug 1700051: part 26) Correct typo in comment of `mozInlineSpellWordUtil::BuildSoftTe...
[gecko.git] / dom / canvas / WebGLExtensionCompressedTextureBPTC.cpp
blob353526b55749cb7097ade6c0b22fce3525672672
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 WebGLExtensionCompressedTextureBPTC::WebGLExtensionCompressedTextureBPTC(
15 WebGLContext* const webgl)
16 : WebGLExtensionBase(webgl) {
17 MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
19 auto& fua = webgl->mFormatUsage;
21 const auto fnAdd = [&](const GLenum sizedFormat,
22 const webgl::EffectiveFormat effFormat) {
23 auto usage = fua->EditUsage(effFormat);
24 usage->isFilterable = true;
25 fua->AllowSizedTexFormat(sizedFormat, usage);
28 #define _(X) LOCAL_GL_##X, webgl::EffectiveFormat::X
30 fnAdd(_(COMPRESSED_RGBA_BPTC_UNORM));
31 fnAdd(_(COMPRESSED_SRGB_ALPHA_BPTC_UNORM));
32 fnAdd(_(COMPRESSED_RGB_BPTC_SIGNED_FLOAT));
33 fnAdd(_(COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT));
35 #undef _
38 bool WebGLExtensionCompressedTextureBPTC::IsSupported(
39 const WebGLContext* const webgl) {
40 return webgl->gl->IsSupported(gl::GLFeature::texture_compression_bptc);
43 } // namespace mozilla