LCOV - code coverage report
Current view: top level - eq/fabric - error.cpp (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 20 22 90.9 %
Date: 2014-06-18 Functions: 7 7 100.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2010-2013, 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 "error.h"
      19             : 
      20             : #include "errorRegistry.h"
      21             : #include "global.h"
      22             : 
      23             : namespace eq
      24             : {
      25             : namespace fabric
      26             : {
      27             : 
      28             : namespace
      29             : {
      30        1035 : struct ErrorData
      31             : {
      32             :     const uint32_t code;
      33             :     const std::string text;
      34             : };
      35             : 
      36          30 : ErrorData _errors[] = {
      37             :     { ERROR_FBO_UNSUPPORTED, "Framebuffer objects not supported" },
      38             :     { ERROR_FRAMEBUFFER_STATUS, "Error querying framebuffer status" },
      39             :     { ERROR_FRAMEBUFFER_UNSUPPORTED, "Unsupported framebuffer format" },
      40             :     { ERROR_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT,
      41             :       "Framebuffer incomplete, missing attachment" },
      42             :     { ERROR_FRAMEBUFFER_INCOMPLETE_ATTACHMENT,
      43             :       "Framebuffer incomplete, incomplete attachment" },
      44             :     { ERROR_FRAMEBUFFER_INCOMPLETE_DIMENSIONS,
      45             :       "Framebuffer incomplete, attached images must have same dimensions" },
      46             :     { ERROR_FRAMEBUFFER_INCOMPLETE_FORMATS,
      47             :       "Framebuffer incomplete, attached images must have same format" },
      48             :     { ERROR_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER,
      49             :       "Framebuffer incomplete, missing draw buffer" },
      50             :     { ERROR_FRAMEBUFFER_INCOMPLETE_READ_BUFFER,
      51             :       "Framebuffer incomplete, missing read buffer" },
      52             :     { ERROR_FRAMEBUFFER_INITIALIZED, "FBO already initialized" },
      53             : 
      54             :     { ERROR_CUDACONTEXT_DEVICE_NOTFOUND,
      55             :       "Device not found, not enough CUDA devices" },
      56             :     { ERROR_CUDACONTEXT_INIT_FAILED,
      57             :       "CUDA initialization failed (see client log for more information)" },
      58             :     { ERROR_CUDACONTEXT_MISSING_SUPPORT,
      59             :       "Client library compiled without CUDA support" },
      60             : 
      61             :     { ERROR_WINDOWSYSTEM_UNKNOWN, "Unknown windowing system" },
      62             : 
      63             :     { ERROR_NODE_LAUNCH, "Execution of node launch command failed" },
      64             :     { ERROR_NODE_CONNECT, "Node process did not start" },
      65             : 
      66             :     { ERROR_PIPE_NODE_NOTRUNNING, "Node not running" },
      67             : 
      68             :     { ERROR_SYSTEMPIPE_PIXELFORMAT_NOTFOUND,
      69             :       "Can't find temporary pixel format" },
      70             :     { ERROR_SYSTEMPIPE_CREATECONTEXT_FAILED,
      71             :       "Can't create temporary OpenGL context" },
      72             :     { ERROR_SYSTEMPIPE_CREATEWINDOW_FAILED, "Can't create temporary window" },
      73             : 
      74             :     { ERROR_AGLPIPE_DISPLAYS_NOTFOUND, "Can't get display identifier list" },
      75             :     { ERROR_AGLPIPE_DEVICE_NOTFOUND, "Can't get display identifier for device"},
      76             : 
      77             :     { ERROR_GLXPIPE_DEVICE_NOTFOUND, "Can't open display" },
      78             :     { ERROR_GLXPIPE_GLX_NOTFOUND, "Display does not support GLX" },
      79             :     { ERROR_GLXPIPE_GLXEWINIT_FAILED, "Pipe GLXEW initialization failed" },
      80             : 
      81             :     { ERROR_WGL_CREATEAFFINITYDC_FAILED, "Can't create affinity DC" },
      82             :     { ERROR_WGLPIPE_ENUMDISPLAYS_FAILED, "Can't enumerate display devices" },
      83             :     { ERROR_WGLPIPE_CREATEDC_FAILED, "Can't create device context" },
      84             :     { ERROR_WGLPIPE_ENUMGPUS_FAILED, "Can't enumerate GPU" },
      85             :     { ERROR_WGLPIPE_REGISTERCLASS_FAILED,
      86             :       "Can't register temporary window class" },
      87             :     { ERROR_WGLPIPE_SETPF_FAILED, "Can't set temporary pixel format" },
      88             :     { ERROR_WGLPIPE_WGLEWINIT_FAILED, "Pipe WGLEW initialization failed" },
      89             : 
      90             :     { ERROR_WINDOW_PIPE_NOTRUNNING, "Pipe not running" },
      91             :     { ERROR_WINDOW_PVP_INVALID, "Invalid window pixel viewport" },
      92             : 
      93             :     { ERROR_SYSTEMWINDOW_PIXELFORMAT_NOTFOUND,
      94             :       "Can't find matching pixel format" },
      95             :     { ERROR_SYSTEMWINDOW_NO_PIXELFORMAT, "Missing pixel format" },
      96             :     { ERROR_SYSTEMWINDOW_ARB_FLOAT_FB_REQUIRED,
      97             :       "Floating-point framebuffer not supported" },
      98             : 
      99             :     { ERROR_AGLWINDOW_NO_CONTEXT, "Missing AGL context" },
     100             :     { ERROR_AGLWINDOW_CREATECONTEXT_FAILED, "Can't create AGL context" },
     101             :     { ERROR_AGLWINDOW_CREATEPBUFFER_FAILED, "Can't create AGL PBuffer" },
     102             :     { ERROR_AGLWINDOW_SETPBUFFER_FAILED, "Can't set AGL PBuffer" },
     103             :     { ERROR_AGLWINDOW_CREATEWINDOW_FAILED, "Can't create Carbon window" },
     104             :     { ERROR_AGLWINDOW_SETWINDOW_FAILED, "Can't set Carbon window" },
     105             : 
     106             :     { ERROR_GLXWINDOW_NO_DRAWABLE, "Missing GLX drawable" },
     107             :     { ERROR_GLXWINDOW_NO_DISPLAY, "Missing X11 display connection" },
     108             :     { ERROR_GLXWINDOW_CREATECONTEXT_FAILED, "Can't create glX context" },
     109             :     { ERROR_GLXWINDOW_CREATEWINDOW_FAILED, "Can't create X11 window" },
     110             :     { ERROR_GLXWINDOW_GLXQUERYVERSION_FAILED, "Can't get GLX version" },
     111             :     { ERROR_GLXWINDOW_GLX_1_3_REQUIRED, "Need at least GLX 1.3" },
     112             :     { ERROR_GLXWINDOW_NO_FBCONFIG, "Can't find FBConfig for visual" },
     113             :     { ERROR_GLXWINDOW_NO_VISUAL, "FBConfig has no associated visual" },
     114             :     { ERROR_GLXWINDOW_CREATEPBUFFER_FAILED, "Can't create glX PBuffer" },
     115             :     { ERROR_GLXWINDOW_FBCONFIG_REQUIRED,
     116             :       "Can't find FBConfig functions (GLX 1.3 or GLX_SGIX_fbconfig" },
     117             : 
     118             :     { ERROR_WGLWINDOW_NO_DRAWABLE, "Missing WGL drawable" },
     119             :     { ERROR_WGLWINDOW_SETPIXELFORMAT_FAILED, "Can't set window pixel format" },
     120             :     { ERROR_WGLWINDOW_REGISTERCLASS_FAILED, "Can't register window class" },
     121             :     { ERROR_WGLWINDOW_FULLSCREEN_FAILED, "Can't switch to fullscreen mode" },
     122             :     { ERROR_WGLWINDOW_CREATEWINDOW_FAILED, "Can't create window" },
     123             :     { ERROR_WGLWINDOW_ARB_PBUFFER_REQUIRED, "WGL_ARB_pbuffer not supported" },
     124             :     { ERROR_WGLWINDOW_CREATEPBUFFER_FAILED, "Can't create PBuffer" },
     125             :     { ERROR_WGLWINDOW_SETAFFINITY_PF_FAILED, "Can't set affinity pixel format"},
     126             :     { ERROR_WGLWINDOW_CHOOSE_PF_ARB_FAILED,
     127             :       "Can't choose pixel format using ARB extension"},
     128             :     { ERROR_WGLWINDOW_CREATECONTEXT_FAILED, "Can't create WGL context" },
     129             : 
     130             :     { ERROR_CHANNEL_WINDOW_NOTRUNNING, "Window not running" },
     131             : 
     132             :     { ERROR_PBO_UNSUPPORTED, "Pixel Buffer Objects not supported" },
     133             :     { ERROR_PBO_NOT_INITIALIZED, "PBO is not initialized" },
     134             :     { ERROR_PBO_SIZE_TOO_SMALL, "PBO size is too small, it has to be > 0" },
     135             :     { ERROR_PBO_TYPE_UNSUPPORTED, "Unsupported PBO type" },
     136             : 
     137             :     { 0, "" } // last!
     138          15 : };
     139             : }
     140             : 
     141          10 : void _initErrors()
     142             : {
     143          10 :     eq::fabric::ErrorRegistry& registry =eq::fabric::Global::getErrorRegistry();
     144         690 :     for( size_t i=0; _errors[i].code != 0; ++i )
     145         680 :         registry.setString( _errors[i].code, _errors[i].text );
     146          10 : }
     147             : 
     148          10 : void _exitErrors()
     149             : {
     150          10 :     eq::fabric::ErrorRegistry& registry =eq::fabric::Global::getErrorRegistry();
     151         690 :     for( size_t i=0; _errors[i].code != 0; ++i )
     152         680 :         registry.eraseString( _errors[i].code );
     153          10 : }
     154             : 
     155          15 : std::ostream& operator << ( std::ostream& os, const Error& error )
     156             : {
     157          15 :     const ErrorRegistry& registry = Global::getErrorRegistry();
     158          15 :     const std::string& text = registry.getString( error.getCode( ));
     159             : 
     160          15 :     if( text.empty( ))
     161           0 :         return os << "error 0x" << std::hex << uint32_t( error.getCode( ))
     162           0 :                   << std::dec;
     163             : 
     164          15 :     return os << text << " (0x" << std::hex << uint32_t( error.getCode( ))
     165          15 :               << std::dec << ")";
     166             : }
     167             : 
     168             : }
     169          45 : }

Generated by: LCOV version 1.10