Bug 1700051: part 26) Correct typo in comment of `mozInlineSpellWordUtil::BuildSoftTe...
[gecko.git] / dom / canvas / WebGLExtensionEXTColorBufferFloat.cpp
blobd2bfd74434ad942f84b5e9f0cbfb865953124553
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/WebGL2RenderingContextBinding.h"
9 #include "WebGLContext.h"
10 #include "WebGLFormats.h"
12 namespace mozilla {
14 WebGLExtensionEXTColorBufferFloat::WebGLExtensionEXTColorBufferFloat(
15 WebGLContext* webgl)
16 : WebGLExtensionBase(webgl) {
17 MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
19 auto& fua = webgl->mFormatUsage;
21 auto fnUpdateUsage = [&fua](GLenum sizedFormat,
22 webgl::EffectiveFormat effFormat) {
23 auto usage = fua->EditUsage(effFormat);
24 usage->SetRenderable();
25 fua->AllowRBFormat(sizedFormat, usage);
28 #define FOO(x) fnUpdateUsage(LOCAL_GL_##x, webgl::EffectiveFormat::x)
30 FOO(R16F);
31 FOO(RG16F);
32 FOO(RGBA16F);
34 FOO(R32F);
35 FOO(RG32F);
36 FOO(RGBA32F);
38 FOO(R11F_G11F_B10F);
40 #undef FOO
43 /*static*/
44 bool WebGLExtensionEXTColorBufferFloat::IsSupported(const WebGLContext* webgl) {
45 if (!webgl->IsWebGL2()) return false;
47 const gl::GLContext* gl = webgl->GL();
48 return gl->IsSupported(gl::GLFeature::EXT_color_buffer_float);
51 } // namespace mozilla