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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "WebGL2Context.h"
       8             : 
       9             : #include "GLContext.h"
      10             : #include "WebGLContextUtils.h"
      11             : 
      12             : namespace mozilla {
      13             : 
      14             : void
      15           0 : WebGL2Context::GetInternalformatParameter(JSContext* cx, GLenum target,
      16             :                                           GLenum internalformat, GLenum pname,
      17             :                                           JS::MutableHandleValue retval,
      18             :                                           ErrorResult& out_rv)
      19             : {
      20           0 :     const char funcName[] = "getInternalfomratParameter";
      21           0 :     retval.setObjectOrNull(nullptr);
      22             : 
      23           0 :     if (IsContextLost())
      24           0 :         return;
      25             : 
      26           0 :     if (target != LOCAL_GL_RENDERBUFFER) {
      27           0 :         ErrorInvalidEnum("%s: `target` must be RENDERBUFFER, was: 0x%04x.", funcName,
      28           0 :                          target);
      29           0 :         return;
      30             :     }
      31             : 
      32             :     // GLES 3.0.4 $4.4.4 p212:
      33             :     // "An internal format is color-renderable if it is one of the formats from table 3.13
      34             :     //  noted as color-renderable or if it is unsized format RGBA or RGB."
      35             : 
      36             :     GLenum sizedFormat;
      37           0 :     switch (internalformat) {
      38             :     case LOCAL_GL_RGB:
      39           0 :         sizedFormat = LOCAL_GL_RGB8;
      40           0 :         break;
      41             :     case LOCAL_GL_RGBA:
      42           0 :         sizedFormat = LOCAL_GL_RGBA8;
      43           0 :         break;
      44             :     default:
      45           0 :         sizedFormat = internalformat;
      46           0 :         break;
      47             :     }
      48             : 
      49             :     // In RenderbufferStorage, we allow DEPTH_STENCIL. Therefore, it is accepted for
      50             :     // internalformat as well. Please ignore the conformance test fail for DEPTH_STENCIL.
      51             : 
      52           0 :     const auto usage = mFormatUsage->GetRBUsage(sizedFormat);
      53           0 :     if (!usage) {
      54           0 :         ErrorInvalidEnum("%s: `internalformat` must be color-, depth-, or stencil-renderable, was: 0x%04x.",
      55           0 :                          funcName, internalformat);
      56           0 :         return;
      57             :     }
      58             : 
      59           0 :     if (pname != LOCAL_GL_SAMPLES) {
      60           0 :         ErrorInvalidEnumInfo("%s: `pname` must be SAMPLES, was 0x%04x.", funcName, pname);
      61           0 :         return;
      62             :     }
      63             : 
      64           0 :     GLint* samples = nullptr;
      65           0 :     GLint sampleCount = 0;
      66           0 :     gl->fGetInternalformativ(LOCAL_GL_RENDERBUFFER, internalformat,
      67           0 :                              LOCAL_GL_NUM_SAMPLE_COUNTS, 1, &sampleCount);
      68           0 :     if (sampleCount > 0) {
      69           0 :         samples = new GLint[sampleCount];
      70           0 :         gl->fGetInternalformativ(LOCAL_GL_RENDERBUFFER, internalformat, LOCAL_GL_SAMPLES,
      71           0 :                                  sampleCount, samples);
      72             :     }
      73             : 
      74           0 :     JSObject* obj = dom::Int32Array::Create(cx, this, sampleCount, samples);
      75           0 :     if (!obj) {
      76           0 :         out_rv = NS_ERROR_OUT_OF_MEMORY;
      77             :     }
      78             : 
      79           0 :     delete[] samples;
      80             : 
      81           0 :     retval.setObjectOrNull(obj);
      82             : }
      83             : 
      84             : void
      85           0 : WebGL2Context::RenderbufferStorageMultisample(GLenum target, GLsizei samples,
      86             :                                               GLenum internalFormat,
      87             :                                               GLsizei width, GLsizei height)
      88             : {
      89           0 :     const char funcName[] = "renderbufferStorageMultisample";
      90           0 :     if (IsContextLost())
      91           0 :         return;
      92             : 
      93           0 :     RenderbufferStorage_base(funcName, target, samples, internalFormat, width, height);
      94             : }
      95             : 
      96             : } // namespace mozilla

Generated by: LCOV version 1.13