Bug 1700051: part 26) Correct typo in comment of `mozInlineSpellWordUtil::BuildSoftTe...
[gecko.git] / dom / canvas / WebGLExtensionCompressedTextureRGTC.cpp
blobb1932aaa4d5c4c61fac2d83d5a22bd73b52e3a9b
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 WebGLExtensionCompressedTextureRGTC::WebGLExtensionCompressedTextureRGTC(
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_RED_RGTC1));
31 fnAdd(_(COMPRESSED_SIGNED_RED_RGTC1));
32 fnAdd(_(COMPRESSED_RG_RGTC2));
33 fnAdd(_(COMPRESSED_SIGNED_RG_RGTC2));
35 #undef _
38 bool WebGLExtensionCompressedTextureRGTC::IsSupported(
39 const WebGLContext* const webgl) {
40 return webgl->gl->IsSupported(gl::GLFeature::texture_compression_rgtc);
43 } // namespace mozilla