Line data Source code
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/WebGL2RenderingContextBinding.h"
9 : #include "WebGLContext.h"
10 : #include "WebGLFormats.h"
11 :
12 : namespace mozilla {
13 :
14 0 : WebGLExtensionEXTColorBufferFloat::WebGLExtensionEXTColorBufferFloat(WebGLContext* webgl)
15 0 : : WebGLExtensionBase(webgl)
16 : {
17 0 : MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
18 :
19 0 : auto& fua = webgl->mFormatUsage;
20 :
21 0 : auto fnUpdateUsage = [&fua](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
22 0 : auto usage = fua->EditUsage(effFormat);
23 0 : usage->SetRenderable();
24 0 : fua->AllowRBFormat(sizedFormat, usage);
25 0 : };
26 :
27 : #define FOO(x) fnUpdateUsage(LOCAL_GL_ ## x, webgl::EffectiveFormat::x)
28 :
29 0 : FOO(R16F);
30 0 : FOO(RG16F);
31 0 : FOO(RGBA16F);
32 :
33 0 : FOO(R32F);
34 0 : FOO(RG32F);
35 0 : FOO(RGBA32F);
36 :
37 0 : FOO(R11F_G11F_B10F);
38 :
39 : #undef FOO
40 0 : }
41 :
42 : /*static*/ bool
43 0 : WebGLExtensionEXTColorBufferFloat::IsSupported(const WebGLContext* webgl)
44 : {
45 0 : const gl::GLContext* gl = webgl->GL();
46 0 : return gl->IsSupported(gl::GLFeature::EXT_color_buffer_float);
47 : }
48 :
49 0 : IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionEXTColorBufferFloat, EXT_color_buffer_float)
50 :
51 : } // namespace mozilla
|