Equalizer  1.13.0
Parallel Rendering Framework
compressor.h
Go to the documentation of this file.
1 
2 /* Copyright (c) 2009-2010, Cedric Stalder <cedric.stalder@gmail.com>
3  * 2009-2013, Stefan Eilemann <eile@equalizergraphics.com>
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_COMPRESSOR
20 #define EQ_PLUGIN_COMPRESSOR
21 
22 #include <pression/plugins/compressor.h>
23 #include <lunchbox/buffer.h>
24 #include <vector>
25 
31 namespace eq
32 {
33 namespace plugin
34 {
35  class Compressor
36  {
37  public:
38  typedef void (*CompressorGetInfo_t)( EqCompressorInfo* const );
39  typedef void* (*NewCompressor_t)( const unsigned );
40  typedef void (*Decompress_t)( const void* const*, const
41  eq_uint64_t* const,
42  const unsigned, void* const,
43  const eq_uint64_t, const bool );
44  typedef bool ( *IsCompatible_t ) ( const GLEWContext* );
45 
46  struct Functions
47  {
48  Functions( const unsigned name, CompressorGetInfo_t getInfo,
49  NewCompressor_t newCompressor,
50  NewCompressor_t newDecompressor,
51  Decompress_t decompress, IsCompatible_t isCompatible );
52 
53  unsigned name;
54  CompressorGetInfo_t getInfo;
55  NewCompressor_t newCompressor;
56  NewCompressor_t newDecompressor;
57  Decompress_t decompress;
58  IsCompatible_t isCompatible;
59  };
60 
62  Compressor();
63  virtual ~Compressor();
64 
72  virtual void compress( const void* const inData LB_UNUSED,
73  const eq_uint64_t nPixels LB_UNUSED,
74  const bool useAlpha LB_UNUSED ) { LBDONTCALL; }
75 
76  typedef lunchbox::Bufferb Result;
77  typedef std::vector< Result* > Results;
78 
80  const Results& getResults() const { return _results; }
81 
83  unsigned getNResults() const { return _nResults; }
84 
96  virtual void download( const GLEWContext* glewContext LB_UNUSED,
97  const eq_uint64_t inDims[4] LB_UNUSED,
98  const unsigned source LB_UNUSED,
99  const eq_uint64_t flags LB_UNUSED,
100  eq_uint64_t outDims[4] LB_UNUSED,
101  void** out LB_UNUSED ) { LBDONTCALL; }
102 
114  virtual void upload( const GLEWContext* glewContext LB_UNUSED,
115  const void* buffer LB_UNUSED,
116  const eq_uint64_t inDims[4] LB_UNUSED,
117  const eq_uint64_t flags LB_UNUSED,
118  const eq_uint64_t outDims[4] LB_UNUSED,
119  const unsigned destination LB_UNUSED )
120  { LBDONTCALL; }
121 
133  virtual void startDownload( const GLEWContext* glewContext LB_UNUSED,
134  const eq_uint64_t inDims[4] LB_UNUSED,
135  const unsigned source LB_UNUSED,
136  const eq_uint64_t flags LB_UNUSED )
137  { LBDONTCALL; }
138 
150  virtual void finishDownload( const GLEWContext* glewContext LB_UNUSED,
151  const eq_uint64_t inDims[4] LB_UNUSED,
152  const eq_uint64_t flags LB_UNUSED,
153  eq_uint64_t outDims[4] LB_UNUSED,
154  void** out LB_UNUSED ) { LBDONTCALL; }
155 
157  static void registerEngine( const Functions& );
158 
159  protected:
160  Results _results;
161  unsigned _nResults;
162  };
163 }
164 }
165 
166 #endif // EQ_PLUGIN_COMPRESSOR
const Results & getResults() const
Definition: compressor.h:80
Compressor()
Construct a new compressor.
virtual void upload(const GLEWContext *glewContext, const void *buffer, const eq_uint64_t inDims[4], const eq_uint64_t flags, const eq_uint64_t outDims[4], const unsigned destination)
Transfer data from main memory into GPU memory.
Definition: compressor.h:114
virtual void compress(const void *const inData, const eq_uint64_t nPixels, const bool useAlpha)
Compress data.
Definition: compressor.h:72
virtual void finishDownload(const GLEWContext *glewContext, const eq_uint64_t inDims[4], const eq_uint64_t flags, eq_uint64_t outDims[4], void **out)
Finish transferring frame buffer data into main memory.
Definition: compressor.h:150
virtual void startDownload(const GLEWContext *glewContext, const eq_uint64_t inDims[4], const unsigned source, const eq_uint64_t flags)
Start transferring frame buffer data into main memory.
Definition: compressor.h:133
unsigned _nResults
Number of elements used in _results.
Definition: compressor.h:161
The Equalizer client library.
Definition: eq/agl/types.h:23
Results _results
The compressed data.
Definition: compressor.h:160
virtual void download(const GLEWContext *glewContext, const eq_uint64_t inDims[4], const unsigned source, const eq_uint64_t flags, eq_uint64_t outDims[4], void **out)
Transfer frame buffer data into main memory.
Definition: compressor.h:96
unsigned getNResults() const
Definition: compressor.h:83