LCOV - code coverage report
Current view: top level - dom/canvas - WebGLExtensionColorBufferFloat.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 18 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          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 : WebGLExtensionColorBufferFloat::WebGLExtensionColorBufferFloat(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             :     // The extension doesn't actually add RGB32F; only RGBA32F.
      34           0 :     FOO(RGBA32F);
      35             : 
      36             : #undef FOO
      37           0 : }
      38             : 
      39           0 : WebGLExtensionColorBufferFloat::~WebGLExtensionColorBufferFloat()
      40             : {
      41           0 : }
      42             : 
      43             : bool
      44           0 : WebGLExtensionColorBufferFloat::IsSupported(const WebGLContext* webgl)
      45             : {
      46           0 :     gl::GLContext* gl = webgl->GL();
      47             : 
      48             :     // ANGLE supports this, but doesn't have a way to advertize its support,
      49             :     // since it's compliant with WEBGL_color_buffer_float's clamping, but not
      50             :     // EXT_color_buffer_float.
      51           0 :     return gl->IsSupported(gl::GLFeature::renderbuffer_color_float) ||
      52           0 :            gl->IsANGLE();
      53             : }
      54             : 
      55           0 : IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionColorBufferFloat, WEBGL_color_buffer_float)
      56             : 
      57             : } // namespace mozilla

Generated by: LCOV version 1.13