LCOV - code coverage report
Current view: top level - dom/canvas - WebGLExtensionCompressedTextureASTC.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 56 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 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             : 
      11             : namespace mozilla {
      12             : 
      13           0 : WebGLExtensionCompressedTextureASTC::WebGLExtensionCompressedTextureASTC(WebGLContext* webgl)
      14           0 :     : WebGLExtensionBase(webgl)
      15             : {
      16           0 :     MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
      17             : 
      18           0 :     RefPtr<WebGLContext> webgl_ = webgl; // Bug 1201275
      19           0 :     const auto fnAdd = [&webgl_](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
      20           0 :         auto& fua = webgl_->mFormatUsage;
      21             : 
      22           0 :         auto usage = fua->EditUsage(effFormat);
      23           0 :         usage->isFilterable = true;
      24           0 :         fua->AllowSizedTexFormat(sizedFormat, usage);
      25             : 
      26           0 :         webgl_->mCompressedTextureFormats.AppendElement(sizedFormat);
      27           0 :     };
      28             : 
      29             : #define FOO(x) LOCAL_GL_ ## x, webgl::EffectiveFormat::x
      30             : 
      31           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_4x4_KHR));
      32           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_5x4_KHR));
      33           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_5x5_KHR));
      34           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_6x5_KHR));
      35           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_6x6_KHR));
      36           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_8x5_KHR));
      37           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_8x6_KHR));
      38           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_8x8_KHR));
      39           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_10x5_KHR));
      40           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_10x6_KHR));
      41           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_10x8_KHR));
      42           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_10x10_KHR));
      43           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_12x10_KHR));
      44           0 :     fnAdd(FOO(COMPRESSED_RGBA_ASTC_12x12_KHR));
      45             : 
      46           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR));
      47           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR));
      48           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR));
      49           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR));
      50           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR));
      51           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR));
      52           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR));
      53           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR));
      54           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR));
      55           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR));
      56           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR));
      57           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR));
      58           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR));
      59           0 :     fnAdd(FOO(COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR));
      60             : 
      61             : #undef FOO
      62           0 : }
      63             : 
      64           0 : WebGLExtensionCompressedTextureASTC::~WebGLExtensionCompressedTextureASTC()
      65             : {
      66           0 : }
      67             : 
      68             : void
      69           0 : WebGLExtensionCompressedTextureASTC::GetSupportedProfiles(dom::Nullable< nsTArray<nsString> >& retval) const
      70             : {
      71           0 :     retval.SetNull();
      72           0 :     if (mIsLost) {
      73           0 :         mContext->ErrorInvalidOperation("%s: Extension is lost.",
      74           0 :                                         "drawElementsInstancedANGLE");
      75           0 :         return;
      76             :     }
      77             : 
      78           0 :     nsTArray<nsString>& arr = retval.SetValue();
      79           0 :     arr.AppendElement(NS_LITERAL_STRING("ldr"));
      80             : 
      81           0 :     if (mContext->gl->IsExtensionSupported(gl::GLContext::KHR_texture_compression_astc_hdr)) {
      82           0 :         arr.AppendElement(NS_LITERAL_STRING("hdr"));
      83             :     }
      84             : }
      85             : 
      86             : bool
      87           0 : WebGLExtensionCompressedTextureASTC::IsSupported(const WebGLContext* webgl)
      88             : {
      89           0 :     gl::GLContext* gl = webgl->GL();
      90           0 :     return gl->IsExtensionSupported(gl::GLContext::KHR_texture_compression_astc_ldr);
      91             : }
      92             : 
      93           0 : IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionCompressedTextureASTC, WEBGL_compressed_texture_astc)
      94             : 
      95             : } // namespace mozilla

Generated by: LCOV version 1.13