Lunchbox  1.9.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
downloader.h
1 
2 /* Copyright (c) 2013-2014, Stefan.Eilemann@epfl.ch
3  *
4  * This file is part of Lunchbox <https://github.com/Eyescale/Lunchbox>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef LUNCHBOX_DOWNLOADER_H
21 #define LUNCHBOX_DOWNLOADER_H
22 
23 #include <lunchbox/api.h>
24 #include <lunchbox/types.h>
25 #include <lunchbox/thread.h> // thread-safety macros
26 
27 namespace lunchbox
28 {
29 namespace detail { class Downloader; }
30 
32 class Downloader : public boost::noncopyable
33 {
34 public:
36  LUNCHBOX_API Downloader();
37 
47  LUNCHBOX_API Downloader( PluginRegistry& from, const uint32_t name,
48  const GLEWContext* gl = 0 );
49 
51  LUNCHBOX_API virtual ~Downloader();
52 
54  LUNCHBOX_API bool isGood() const;
55 
60  LUNCHBOX_API bool uses( const uint32_t name ) const;
61 
66  LUNCHBOX_API bool supports( const uint32_t inputToken, const bool noAlpha,
67  const uint64_t capabilities ) const;
68 
85  static LUNCHBOX_API uint32_t choose( const PluginRegistry& from,
86  const uint32_t internalFormat,
87  const float minQuality,
88  const bool ignoreAlpha,
89  const uint64_t capabilities,
90  const GLEWContext* gl );
91 
93  LUNCHBOX_API const EqCompressorInfo& getInfo() const;
94 
105  LUNCHBOX_API bool setup( PluginRegistry& from, const uint32_t name,
106  const GLEWContext* gl = 0 );
107 
113  LUNCHBOX_API bool setup( PluginRegistry& from,const uint32_t internalFormat,
114  const float minQuality, const bool ignoreAlpha,
115  const uint64_t capabilities,
116  const GLEWContext* gl );
117 
119  LUNCHBOX_API void clear();
120 
134  LUNCHBOX_API bool start( void** buffer, const uint64_t inDims[4],
135  const uint64_t flags, uint64_t outDims[4],
136  const unsigned source, const GLEWContext* gl );
137 
148  LUNCHBOX_API void finish( void** buffer, const uint64_t inDims[4],
149  const uint64_t flags, uint64_t outDims[4],
150  const GLEWContext* gl );
151 
152 private:
153  detail::Downloader* const impl_;
154  LB_TS_VAR( _thread );
155 };
156 }
157 #endif // LUNCHBOX_DOWNLOADER_H
A registry for loaded plugins.
LUNCHBOX_API bool isGood() const
virtual LUNCHBOX_API ~Downloader()
Destruct this downloader.
Defines export visibility macros for Lunchbox.
Basic type definitions not provided by the operating system.
A C++ class to handle one downloader plugin instance.
Definition: downloader.h:32
LUNCHBOX_API bool supports(const uint32_t inputToken, const bool noAlpha, const uint64_t capabilities) const
Information about one compressor.
LUNCHBOX_API bool start(void **buffer, const uint64_t inDims[4], const uint64_t flags, uint64_t outDims[4], const unsigned source, const GLEWContext *gl)
Start downloading data from the GPU to the CPU.
LUNCHBOX_API bool uses(const uint32_t name) const
LUNCHBOX_API void finish(void **buffer, const uint64_t inDims[4], const uint64_t flags, uint64_t outDims[4], const GLEWContext *gl)
Finish download data from the GPU to the CPU.
static LUNCHBOX_API uint32_t choose(const PluginRegistry &from, const uint32_t internalFormat, const float minQuality, const bool ignoreAlpha, const uint64_t capabilities, const GLEWContext *gl)
Find the best downloader in all plugins for the given parameters.
LUNCHBOX_API const EqCompressorInfo & getInfo() const
LUNCHBOX_API bool setup(PluginRegistry &from, const uint32_t name, const GLEWContext *gl=0)
Set up a new, named downloader instance.
LUNCHBOX_API void clear()
Reset to EQ_COMPRESSOR_NONE.
LUNCHBOX_API Downloader()
Construct a new, invalid downloader instance.