WebGLExtensionCompressedTextureATC.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #include "WebGLExtensions.h"
  5. #include "GLContext.h"
  6. #include "mozilla/dom/WebGLRenderingContextBinding.h"
  7. #include "WebGLContext.h"
  8. #ifdef FOO
  9. #error FOO is already defined! We use FOO() macros to keep things succinct in this file.
  10. #endif
  11. namespace mozilla {
  12. WebGLExtensionCompressedTextureATC::WebGLExtensionCompressedTextureATC(WebGLContext* webgl)
  13. : WebGLExtensionBase(webgl)
  14. {
  15. RefPtr<WebGLContext> webgl_ = webgl; // Bug 1201275
  16. const auto fnAdd = [&webgl_](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
  17. auto& fua = webgl_->mFormatUsage;
  18. auto usage = fua->EditUsage(effFormat);
  19. usage->isFilterable = true;
  20. fua->AllowSizedTexFormat(sizedFormat, usage);
  21. webgl_->mCompressedTextureFormats.AppendElement(sizedFormat);
  22. };
  23. #define FOO(x) LOCAL_GL_ ## x, webgl::EffectiveFormat::x
  24. fnAdd(FOO(ATC_RGB_AMD));
  25. fnAdd(FOO(ATC_RGBA_EXPLICIT_ALPHA_AMD));
  26. fnAdd(FOO(ATC_RGBA_INTERPOLATED_ALPHA_AMD));
  27. #undef FOO
  28. }
  29. WebGLExtensionCompressedTextureATC::~WebGLExtensionCompressedTextureATC()
  30. {
  31. }
  32. IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionCompressedTextureATC, WEBGL_compressed_texture_atc)
  33. } // namespace mozilla