LCOV - code coverage report
Current view: top level - pression - downloader.h (source / functions) Hit Total Coverage
Test: Pression Lines: 0 1 0.0 %
Date: 2016-12-06 05:44:58 Functions: 0 2 0.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2013-2014, Stefan.Eilemann@epfl.ch
       3             :  *
       4             :  * This file is part of Pression <https://github.com/Eyescale/Pression>
       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 PRESSION_DOWNLOADER_H
      21             : #define PRESSION_DOWNLOADER_H
      22             : 
      23             : #include <pression/api.h>
      24             : #include <pression/types.h>
      25             : #include <lunchbox/thread.h>         // thread-safety macros
      26             : 
      27             : namespace pression
      28             : {
      29             : namespace detail { class Downloader; }
      30             : 
      31             : /** A C++ class to handle one downloader plugin instance. */
      32             : class Downloader
      33             : {
      34             : public:
      35             :     /** Construct a new, invalid downloader instance. @version 1.7.1 */
      36             :     PRESSION_API Downloader();
      37             : 
      38             :     /**
      39             :      * Construct a new, named downloader instance.
      40             :      *
      41             :      * @param from the plugin registry.
      42             :      * @param name the name of the downloader.
      43             :      * @param gl the OpenGL function table to verify that the plugin is
      44             :      *           compatible with this GL implementation.
      45             :      * @version 1.7.1
      46             :      */
      47             :     PRESSION_API Downloader( PluginRegistry& from, const uint32_t name,
      48             :                              const GLEWContext* gl = 0 );
      49             : 
      50             :     /** Destruct this downloader. @version 1.7.1 */
      51             :     PRESSION_API virtual ~Downloader();
      52             : 
      53             :     /** @return true if the instance is usable. @version 1.7.1 */
      54             :     PRESSION_API bool isGood() const;
      55             : 
      56             :     /**
      57             :      * @return true if the instance is usable for the given name.
      58             :      * @version 1.7.1
      59             :      */
      60             :     PRESSION_API bool uses( const uint32_t name ) const;
      61             : 
      62             :     /**
      63             :      * @return true if the download supports the given parameters.
      64             :      * @version 1.7.1
      65             :      */
      66             :     PRESSION_API bool supports( const uint32_t inputToken, const bool noAlpha,
      67             :                                 const uint64_t capabilities ) const;
      68             : 
      69             :     /**
      70             :      * Find the best downloader in all plugins for the given parameters.
      71             :      *
      72             :      * This convenience method searches all compressors in all plugins to find
      73             :      * the downloader which supports the given parameters and provides the
      74             :      * highest speed.
      75             :      *
      76             :      * @param from the plugin registry to choose from.
      77             :      * @param internalFormat the input token type to the downloader.
      78             :      * @param minQuality the minimum quality.
      79             :      * @param ignoreAlpha true if the downloader may drop the alpha channel.
      80             :      * @param capabilities the capabilities required by the downloader.
      81             :      * @param gl the OpenGL function table.
      82             :      * @return the name of the chosen downloader.
      83             :      * @version 1.7.1
      84             :      */
      85             :     static PRESSION_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             : 
      92             :     /** @return the information about the allocated instance. @version 1.7.1 */
      93             :     PRESSION_API const EqCompressorInfo& getInfo() const;
      94             : 
      95             :     /**
      96             :      * Set up a new, named downloader instance.
      97             :      *
      98             :      * @param from the plugin registry.
      99             :      * @param name the name of the downloader.
     100             :      * @param gl the OpenGL function table to verify that the plugin is
     101             :      *           compatible with this GL implementation.
     102             :      * @return true on success, false otherwise.
     103             :      * @version 1.7.1
     104             :      */
     105             :     PRESSION_API bool setup( PluginRegistry& from, const uint32_t name,
     106             :                              const GLEWContext* gl = 0 );
     107             : 
     108             :     /**
     109             :      * Set up a new, auto-selected downloader instance.
     110             :      * @sa choose() for parameters.
     111             :      * @version 1.7.1
     112             :      */
     113             :     PRESSION_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             : 
     118             :     /** Reset to EQ_COMPRESSOR_NONE. @version 1.7.1 */
     119             :     PRESSION_API void clear();
     120             : 
     121             :     /**
     122             :      * Start downloading data from the GPU to the CPU
     123             :      *
     124             :      * @param buffer data destination buffer.
     125             :      * @param inDims the dimensions of the input data.
     126             :      * @param flags capability flags for the compression.
     127             :      * @param outDims return value for the dimensions of the output data.
     128             :      * @param source the source texture name, or 0 for framebuffer.
     129             :      * @param gl the OpenGL function table.
     130             :      * @return true if finish is needed, false if a synchronous download was
     131             :      *         performed.
     132             :      * @version 1.7.1
     133             :      */
     134             :     PRESSION_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             : 
     138             :     /**
     139             :      * Finish download data from the GPU to the CPU
     140             :      *
     141             :      * @param buffer data destination buffer.
     142             :      * @param inDims the dimensions of the input data.
     143             :      * @param flags capability flags for the compression.
     144             :      * @param outDims return value for the dimensions of the output data.
     145             :      * @param gl the OpenGL function table.
     146             :      * @version 1.7.1
     147             :      */
     148             :     PRESSION_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             :     Downloader( const Downloader& );
     154             :     Downloader operator=( const Downloader& );
     155             :     detail::Downloader* const impl_;
     156           0 :     LB_TS_VAR( _thread );
     157             : };
     158             : }
     159             : #endif  // PRESSION_DOWNLOADER_H

Generated by: LCOV version 1.11