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/. */ 4 5 #include "WebGLExtensions.h" 6 7 #include "GLContext.h" 8 #include "mozilla/dom/WebGLRenderingContextBinding.h" 9 #include "WebGLContext.h" 10 11 #ifdef FOO 12 #error FOO is already defined! We use FOO() macros to keep things succinct in this file. 13 #endif 14 15 namespace mozilla { 16 WebGLExtensionCompressedTexturePVRTC(WebGLContext * webgl)17WebGLExtensionCompressedTexturePVRTC::WebGLExtensionCompressedTexturePVRTC(WebGLContext* webgl) 18 : WebGLExtensionBase(webgl) 19 { 20 RefPtr<WebGLContext> webgl_ = webgl; // Bug 1201275 21 const auto fnAdd = [&webgl_](GLenum sizedFormat, webgl::EffectiveFormat effFormat) { 22 auto& fua = webgl_->mFormatUsage; 23 24 auto usage = fua->EditUsage(effFormat); 25 usage->isFilterable = true; 26 fua->AllowSizedTexFormat(sizedFormat, usage); 27 28 webgl_->mCompressedTextureFormats.AppendElement(sizedFormat); 29 }; 30 31 #define FOO(x) LOCAL_GL_ ## x, webgl::EffectiveFormat::x 32 33 fnAdd(FOO(COMPRESSED_RGB_PVRTC_4BPPV1)); 34 fnAdd(FOO(COMPRESSED_RGB_PVRTC_2BPPV1)); 35 fnAdd(FOO(COMPRESSED_RGBA_PVRTC_4BPPV1)); 36 fnAdd(FOO(COMPRESSED_RGBA_PVRTC_2BPPV1)); 37 38 #undef FOO 39 } 40 ~WebGLExtensionCompressedTexturePVRTC()41WebGLExtensionCompressedTexturePVRTC::~WebGLExtensionCompressedTexturePVRTC() 42 { 43 } 44 45 IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionCompressedTexturePVRTC, WEBGL_compressed_texture_pvrtc) 46 47 } // namespace mozilla 48