LCOV - code coverage report
Current view: top level - eq/compressor - compressorReadDrawPixels.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 4 7 57.1 %
Date: 2017-12-16 05:07:20 Functions: 2 3 66.7 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2010, Cedric Stalder <cedric.stalder@gmail.com>
       3             :  *               2010-2014, Stefan Eilemann <eile@eyescale.ch>
       4             :  *
       5             :  * This library is free software; you can redistribute it and/or modify it under
       6             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       7             :  * by the Free Software Foundation.
       8             :  *
       9             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      10             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      11             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      12             :  * details.
      13             :  *
      14             :  * You should have received a copy of the GNU Lesser General Public License
      15             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      16             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      17             :  */
      18             : 
      19             : #ifndef EQ_PLUGIN_COMPRESSORREADDRAWPIXELS
      20             : #define EQ_PLUGIN_COMPRESSORREADDRAWPIXELS
      21             : 
      22             : #include "compressor.h"
      23             : #include <eq/gl.h>
      24             : #include <eq/util/types.h>
      25             : 
      26             : namespace eq
      27             : {
      28             : namespace plugin
      29             : {
      30             : enum FlushMode
      31             : {
      32             :     FLUSH_TEXTURE,
      33             :     KEEP_TEXTURE
      34             : };
      35             : 
      36             : class CompressorReadDrawPixels : public Compressor
      37             : {
      38             : public:
      39             :     explicit CompressorReadDrawPixels(const unsigned name);
      40             :     virtual ~CompressorReadDrawPixels();
      41             : 
      42           2 :     static void* getNewCompressor(const unsigned name)
      43             :     {
      44           2 :         return new CompressorReadDrawPixels(name);
      45             :     }
      46             : 
      47           2 :     static void* getNewDecompressor(const unsigned name)
      48             :     {
      49           2 :         return new CompressorReadDrawPixels(name);
      50             :     }
      51             : 
      52           0 :     void compress(const void* const, const eq_uint64_t, const bool) override
      53             :     {
      54           0 :         LBDONTCALL;
      55           0 :     }
      56             : 
      57             :     static bool isCompatible(const GLEWContext*);
      58             : 
      59             :     void download(const GLEWContext*, const eq_uint64_t*, const unsigned,
      60             :                   const eq_uint64_t, eq_uint64_t*, void**) override;
      61             : 
      62             :     void upload(const GLEWContext*, const void*, const eq_uint64_t*,
      63             :                 const eq_uint64_t, const eq_uint64_t*, const unsigned) override;
      64             : 
      65             :     void startDownload(const GLEWContext*, const eq_uint64_t*, const unsigned,
      66             :                        const eq_uint64_t) override;
      67             : 
      68             :     void finishDownload(const GLEWContext*, const eq_uint64_t*,
      69             :                         const eq_uint64_t, eq_uint64_t*, void**) override;
      70             : 
      71             : protected:
      72             :     lunchbox::Bufferb _buffer;
      73             :     util::Texture* _texture;
      74             :     util::PixelBufferObject* _pbo;
      75             :     unsigned _internalFormat; //!< the GL format
      76             :     unsigned _format;         //!< the GL format
      77             :     unsigned _type;           //!< the GL type
      78             :     const unsigned _depth;    //!< the size of one output token
      79             : 
      80             :     void _resizeBuffer(const eq_uint64_t);
      81             :     void _initTexture(const GLEWContext*, const eq_uint64_t);
      82             :     void _initAsyncTexture(const GLEWContext*, const eq_uint64_t,
      83             :                            const eq_uint64_t);
      84             :     bool _initPBO(const GLEWContext*, const eq_uint64_t);
      85             :     void _initDownload(const GLEWContext*, const eq_uint64_t*, eq_uint64_t*);
      86             :     void* _downloadTexture(const GLEWContext* glewContext,
      87             :                            const FlushMode mode);
      88             : };
      89             : }
      90             : }
      91             : #endif // EQ_PLUGIN_COMPRESSORREADDRAWPIXELS

Generated by: LCOV version 1.11