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 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
));
38 bool WebGLExtensionCompressedTextureRGTC::IsSupported(
39 const WebGLContext
* const webgl
) {
40 return webgl
->gl
->IsSupported(gl::GLFeature::texture_compression_rgtc
);
43 } // namespace mozilla