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/WebGLRenderingContextBinding.h"
9 : #include "WebGLContext.h"
10 : #include "WebGLFormats.h"
11 :
12 : #ifdef FOO
13 : #error FOO is already defined! We use FOO() macros to keep things succinct in this file.
14 : #endif
15 :
16 : namespace mozilla {
17 :
18 0 : WebGLExtensionColorBufferHalfFloat::WebGLExtensionColorBufferHalfFloat(WebGLContext* webgl)
19 0 : : WebGLExtensionBase(webgl)
20 : {
21 0 : MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
22 :
23 0 : auto& fua = webgl->mFormatUsage;
24 :
25 0 : auto fnUpdateUsage = [&fua](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
26 0 : auto usage = fua->EditUsage(effFormat);
27 0 : usage->SetRenderable();
28 0 : fua->AllowRBFormat(sizedFormat, usage);
29 0 : };
30 :
31 : #define FOO(x) fnUpdateUsage(LOCAL_GL_ ## x, webgl::EffectiveFormat::x)
32 :
33 0 : FOO(RGBA16F);
34 0 : FOO(RGB16F);
35 :
36 : #undef FOO
37 0 : }
38 :
39 0 : WebGLExtensionColorBufferHalfFloat::~WebGLExtensionColorBufferHalfFloat()
40 : {
41 0 : }
42 :
43 : bool
44 0 : WebGLExtensionColorBufferHalfFloat::IsSupported(const WebGLContext* webgl)
45 : {
46 0 : return webgl->GL()->IsSupported(gl::GLFeature::renderbuffer_color_half_float);
47 : }
48 :
49 0 : IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionColorBufferHalfFloat, EXT_color_buffer_half_float)
50 :
51 : } // namespace mozilla
|