Line data Source code
1 :
2 : /* Copyright (c) 2006-2016, Stefan Eilemann <eile@equalizergraphics.com>
3 : * Daniel Nachbaur <danielnachbaur@gmail.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 EQFABRIC_FRAMEDATA_H
20 : #define EQFABRIC_FRAMEDATA_H
21 :
22 : #include <eq/fabric/api.h>
23 : #include <eq/fabric/types.h>
24 : #include <eq/fabric/vmmlib.h>
25 :
26 : #include <eq/fabric/frame.h> // for Frame::Type
27 : #include <eq/fabric/renderContext.h> // member
28 :
29 : namespace eq
30 : {
31 : namespace fabric
32 : {
33 1 : class FrameData
34 : {
35 : public:
36 1 : FrameData() : _frameType( Frame::TYPE_MEMORY ), _buffers( 0 ) {}
37 :
38 : /**
39 : * Set the covered area for readbacks.
40 : *
41 : * Preset for Equalizer output frames. The given pixel viewport is used
42 : * together with the Frame offset to compute the area for the readback()
43 : * operation.
44 : */
45 0 : void setPixelViewport( const PixelViewport& pvp ) { _pvp = pvp; }
46 :
47 : /** @return the covered area for readbacks. */
48 0 : const PixelViewport& getPixelViewport() const { return _pvp; }
49 :
50 : /** Set the (color, depth) buffers of the source frame. */
51 2 : void setBuffers( const uint32_t buffers ) { _buffers = buffers; }
52 :
53 : /** Disable the usage of a frame buffer attachment for all images. */
54 0 : void disableBuffer( const Frame::Buffer buffer ) { _buffers &= ~buffer; }
55 :
56 : /** @return the (color, depth) buffers of the source frame. */
57 63 : uint32_t getBuffers() const { return _buffers; }
58 :
59 : /** Set the source context decomposition wrt dest channel. */
60 0 : void setContext( const RenderContext& context ) { _context = context; }
61 :
62 : /** @return the source context decomposition wrt dest channel. */
63 63 : const RenderContext& getContext() const { return _context; }
64 0 : RenderContext& getContext() { return _context; }
65 :
66 : /** Set additional zoom for input frames. */
67 : void setZoom( const Zoom& zoom ) { _zoom = zoom; }
68 :
69 : /** @return the additional zoom. */
70 63 : const Zoom& getZoom() const { return _zoom; }
71 :
72 : /**
73 : * Set the frame storage type.
74 : *
75 : * @param type frame storage type.
76 : */
77 0 : void setType( const fabric::Frame::Type type ) { _frameType = type; }
78 :
79 : /** @return the frame storage type. */
80 0 : Frame::Type getType() const { return _frameType; }
81 :
82 : EQFABRIC_API void serialize( co::DataOStream& os ) const;
83 : EQFABRIC_API void deserialize( co::DataIStream& is );
84 :
85 : protected:
86 : PixelViewport _pvp;
87 : RenderContext _context; //<! source channel render context
88 : Zoom _zoom;
89 : Frame::Type _frameType;
90 : uint32_t _buffers;
91 : template< class T > friend void lunchbox::byteswap( T& );
92 : };
93 :
94 : }
95 : }
96 :
97 : namespace lunchbox
98 : {
99 : template<> inline void byteswap( eq::fabric::FrameData& value )
100 : {
101 : byteswap( value._pvp );
102 : byteswap( value._context );
103 : byteswap( value._zoom );
104 : byteswap( value._frameType );
105 : byteswap( value._buffers );
106 : }
107 : }
108 :
109 : #endif // EQFABRIC_FRAMEDATA_H
|