Line data Source code
1 :
2 : /* Copyright (c) 2013, Stefan.Eilemann@epfl.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 : #ifndef EQ_TRANSFERFINDER_H
19 : #define EQ_TRANSFERFINDER_H
20 :
21 : #include <lunchbox/plugin.h>
22 : #include <lunchbox/pluginVisitor.h>
23 : #include <lunchbox/plugins/compressor.h>
24 :
25 : namespace eq
26 : {
27 : namespace
28 : {
29 : class TransferFinder : public lunchbox::ConstPluginVisitor
30 : {
31 : public:
32 146 : TransferFinder( const uint32_t internal, const uint32_t external,
33 : const uint64_t caps, const float minQuality,
34 : const bool ignoreAlpha, const GLEWContext* gl )
35 : : internal_( internal )
36 : , external_( external )
37 146 : , caps_( caps | EQ_COMPRESSOR_TRANSFER )
38 : , minQuality_( minQuality )
39 : , ignoreAlpha_( ignoreAlpha )
40 292 : , gl_( gl )
41 146 : {}
42 :
43 146 : virtual ~TransferFinder() {}
44 :
45 10074 : virtual fabric::VisitorResult visit( const lunchbox::Plugin& plugin,
46 : const EqCompressorInfo& info )
47 : {
48 24528 : if(( (info.capabilities & caps_) == caps_ ) &&
49 8760 : ( internal_ == EQ_COMPRESSOR_DATATYPE_NONE ||
50 5360 : info.tokenType == internal_ ) &&
51 1960 : ( external_ == EQ_COMPRESSOR_DATATYPE_NONE ||
52 1126 : info.outputTokenType == external_ ) &&
53 292 : ( info.quality >= minQuality_ ) &&
54 80 : ( ignoreAlpha_ ||
55 10446 : !(info.capabilities & EQ_COMPRESSOR_IGNORE_ALPHA )) &&
56 146 : ( !gl_ || plugin.isCompatible( info.name, gl_ )))
57 : {
58 146 : result.push_back( info );
59 : }
60 10074 : return fabric::TRAVERSE_CONTINUE;
61 : }
62 :
63 : EqCompressorInfos result;
64 :
65 : private:
66 : const uint32_t internal_;
67 : const uint32_t external_;
68 : const uint64_t caps_;
69 : const float minQuality_;
70 : const bool ignoreAlpha_;
71 : const GLEWContext* gl_;
72 : };
73 : }
74 : }
75 : #endif
|