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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #include "WebGL2Context.h"
       7             : #include "WebGLActiveInfo.h"
       8             : #include "WebGLProgram.h"
       9             : #include "WebGLTransformFeedback.h"
      10             : #include "GLContext.h"
      11             : 
      12             : namespace mozilla {
      13             : 
      14             : // -------------------------------------------------------------------------
      15             : // Transform Feedback
      16             : 
      17             : already_AddRefed<WebGLTransformFeedback>
      18           0 : WebGL2Context::CreateTransformFeedback()
      19             : {
      20           0 :     if (IsContextLost())
      21           0 :         return nullptr;
      22             : 
      23           0 :     MakeContextCurrent();
      24           0 :     GLuint tf = 0;
      25           0 :     gl->fGenTransformFeedbacks(1, &tf);
      26             : 
      27           0 :     RefPtr<WebGLTransformFeedback> ret = new WebGLTransformFeedback(this, tf);
      28           0 :     return ret.forget();
      29             : }
      30             : 
      31             : void
      32           0 : WebGL2Context::DeleteTransformFeedback(WebGLTransformFeedback* tf)
      33             : {
      34           0 :     const char funcName[] = "deleteTransformFeedback";
      35           0 :     if (!ValidateDeleteObject(funcName, tf))
      36           0 :         return;
      37             : 
      38           0 :     if (tf->mIsActive) {
      39           0 :         ErrorInvalidOperation("%s: Cannot delete active transform feedbacks.", funcName);
      40           0 :         return;
      41             :     }
      42             : 
      43           0 :     if (mBoundTransformFeedback == tf) {
      44           0 :         BindTransformFeedback(LOCAL_GL_TRANSFORM_FEEDBACK, nullptr);
      45             :     }
      46             : 
      47           0 :     tf->RequestDelete();
      48             : }
      49             : 
      50             : bool
      51           0 : WebGL2Context::IsTransformFeedback(const WebGLTransformFeedback* tf)
      52             : {
      53           0 :     if (!ValidateIsObject("isTransformFeedback", tf))
      54           0 :         return false;
      55             : 
      56           0 :     MakeContextCurrent();
      57           0 :     return gl->fIsTransformFeedback(tf->mGLName);
      58             : }
      59             : 
      60             : void
      61           0 : WebGL2Context::BindTransformFeedback(GLenum target, WebGLTransformFeedback* tf)
      62             : {
      63           0 :     const char funcName[] = "bindTransformFeedback";
      64           0 :     if (IsContextLost())
      65           0 :         return;
      66             : 
      67           0 :     if (target != LOCAL_GL_TRANSFORM_FEEDBACK)
      68           0 :         return ErrorInvalidEnum("%s: `target` must be TRANSFORM_FEEDBACK.", funcName);
      69             : 
      70           0 :     if (tf && !ValidateObject(funcName, *tf))
      71           0 :         return;
      72             : 
      73           0 :     if (mBoundTransformFeedback->mIsActive &&
      74           0 :         !mBoundTransformFeedback->mIsPaused)
      75             :     {
      76           0 :         ErrorInvalidOperation("%s: Currently bound transform feedback is active and not"
      77             :                               " paused.",
      78           0 :                               funcName);
      79           0 :         return;
      80             :     }
      81             : 
      82             :     ////
      83             : 
      84           0 :     if (mBoundTransformFeedback) {
      85           0 :         mBoundTransformFeedback->AddBufferBindCounts(-1);
      86             :     }
      87             : 
      88           0 :     mBoundTransformFeedback = (tf ? tf : mDefaultTransformFeedback);
      89             : 
      90           0 :     MakeContextCurrent();
      91           0 :     gl->fBindTransformFeedback(target, mBoundTransformFeedback->mGLName);
      92             : 
      93           0 :     if (mBoundTransformFeedback) {
      94           0 :         mBoundTransformFeedback->AddBufferBindCounts(+1);
      95             :     }
      96             : }
      97             : 
      98             : void
      99           0 : WebGL2Context::BeginTransformFeedback(GLenum primMode)
     100             : {
     101           0 :     if (IsContextLost())
     102           0 :         return;
     103             : 
     104           0 :     mBoundTransformFeedback->BeginTransformFeedback(primMode);
     105             : }
     106             : 
     107             : void
     108           0 : WebGL2Context::EndTransformFeedback()
     109             : {
     110           0 :     if (IsContextLost())
     111           0 :         return;
     112             : 
     113           0 :     mBoundTransformFeedback->EndTransformFeedback();
     114             : }
     115             : 
     116             : void
     117           0 : WebGL2Context::PauseTransformFeedback()
     118             : {
     119           0 :     if (IsContextLost())
     120           0 :         return;
     121             : 
     122           0 :     mBoundTransformFeedback->PauseTransformFeedback();
     123             : }
     124             : 
     125             : void
     126           0 : WebGL2Context::ResumeTransformFeedback()
     127             : {
     128           0 :     if (IsContextLost())
     129           0 :         return;
     130             : 
     131           0 :     mBoundTransformFeedback->ResumeTransformFeedback();
     132             : }
     133             : 
     134             : void
     135           0 : WebGL2Context::TransformFeedbackVaryings(WebGLProgram& program,
     136             :                                          const dom::Sequence<nsString>& varyings,
     137             :                                          GLenum bufferMode)
     138             : {
     139           0 :     if (IsContextLost())
     140           0 :         return;
     141             : 
     142           0 :     if (!ValidateObject("transformFeedbackVaryings: program", program))
     143           0 :         return;
     144             : 
     145           0 :     program.TransformFeedbackVaryings(varyings, bufferMode);
     146             : }
     147             : 
     148             : already_AddRefed<WebGLActiveInfo>
     149           0 : WebGL2Context::GetTransformFeedbackVarying(const WebGLProgram& program, GLuint index)
     150             : {
     151           0 :     if (IsContextLost())
     152           0 :         return nullptr;
     153             : 
     154           0 :     if (!ValidateObject("getTransformFeedbackVarying: program", program))
     155           0 :         return nullptr;
     156             : 
     157           0 :     return program.GetTransformFeedbackVarying(index);
     158             : }
     159             : 
     160             : } // namespace mozilla

Generated by: LCOV version 1.13