LCOV - code coverage report
Current view: top level - eq - gl.cpp (source / functions) Hit Total Coverage
Test: Equalizer Lines: 1 20 5.0 %
Date: 2017-12-16 05:07:20 Functions: 2 4 50.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2011-2014, Stefan Eilemann <eile@eyescale.ch>
       3             :  *
       4             :  * This library is free software; you can redistribute it and/or modify it under
       5             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       6             :  * by the Free Software Foundation.
       7             :  *
       8             :  * This library is distributed in the hope that it will be useful, but WITHOUT
       9             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      10             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      11             :  * details.
      12             :  *
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      15             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      16             :  */
      17             : 
      18             : #include "gl.h"
      19             : 
      20             : #include <eq/glException.h>
      21             : #include <lunchbox/debug.h>
      22             : 
      23             : namespace eq
      24             : {
      25           0 : void debugGLError(const std::string& when, const GLenum error, const char* file,
      26             :                   const int line)
      27             : {
      28           0 :     LBWARN << lunchbox::disableFlush << "Got " << glError(error) << ' ' << when
      29           0 :            << " in " << file << ':' << line << std::endl
      30           0 :            << lunchbox::backtrace << lunchbox::enableFlush << std::endl;
      31           0 :     throw GLException(error);
      32             : }
      33             : 
      34           0 : std::string glError(const GLenum error)
      35             : {
      36           0 :     switch (error)
      37             :     {
      38             :     case EQ_UNKNOWN_GL_ERROR:
      39           0 :         return std::string("Failed OpenGL operation returned GL_NO_ERROR");
      40             :     case GL_INVALID_ENUM:
      41           0 :         return std::string("GL_INVALID_ENUM");
      42             :     case GL_INVALID_VALUE:
      43           0 :         return std::string("GL_INVALID_VALUE");
      44             :     case GL_INVALID_OPERATION:
      45           0 :         return std::string("GL_INVALID_OPERATION");
      46             :     case GL_STACK_OVERFLOW:
      47           0 :         return std::string("GL_STACK_OVERFLOW");
      48             :     case GL_STACK_UNDERFLOW:
      49           0 :         return std::string("GL_STACK_UNDERFLOW");
      50             :     case GL_OUT_OF_MEMORY:
      51           0 :         return std::string("GL_OUT_OF_MEMORY");
      52             :     case GL_INVALID_FRAMEBUFFER_OPERATION:
      53           0 :         return std::string("GL_INVALID_FRAMEBUFFER_OPERATION");
      54             :     default:
      55           0 :         break;
      56             :     }
      57             : 
      58           0 :     std::ostringstream os;
      59           0 :     os << "GL error 0x" << std::hex << error << std::dec;
      60           0 :     return os.str();
      61             : }
      62          30 : }

Generated by: LCOV version 1.11