• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _RRMULTISAMPLEPIXELBUFFERACCESS_HPP
2 #define _RRMULTISAMPLEPIXELBUFFERACCESS_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program Reference Renderer
5  * -----------------------------------------------
6  *
7  * Copyright 2014 The Android Open Source Project
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  *//*!
22  * \file
23  * \brief Multisampled pixel buffer access
24  *//*--------------------------------------------------------------------*/
25 
26 #include "rrDefs.hpp"
27 #include "tcuTexture.hpp"
28 
29 namespace rr
30 {
31 
32 /*--------------------------------------------------------------------*//*!
33  * \brief Read-write pixel data access to multisampled buffers.
34  *
35  * Multisampled data access follows the multisampled indexing convention.
36  *
37  * Prevents accidental usage of non-multisampled buffer as multisampled
38  * with PixelBufferAccess.
39  *//*--------------------------------------------------------------------*/
40 class MultisamplePixelBufferAccess
41 {
42 												MultisamplePixelBufferAccess	(const tcu::PixelBufferAccess& rawAccess);
43 
44 public:
45 												MultisamplePixelBufferAccess	(void);
46 
raw(void) const47 	inline const tcu::PixelBufferAccess&		raw								(void) const { return m_access; }
getNumSamples(void) const48 	inline int									getNumSamples					(void) const { return raw().getWidth(); }
49 
50 	const tcu::PixelBufferAccess				toSinglesampleAccess			(void) const;
51 
52 	static MultisamplePixelBufferAccess			fromSinglesampleAccess			(const tcu::PixelBufferAccess& singlesampledAccess);
53 	static MultisamplePixelBufferAccess			fromMultisampleAccess			(const tcu::PixelBufferAccess& multisampledAccess);
54 
55 private:
56 	tcu::PixelBufferAccess						m_access;
57 } DE_WARN_UNUSED_TYPE;
58 
59 /*--------------------------------------------------------------------*//*!
60  * \brief Read-only pixel data access to multisampled buffers.
61  *
62  * Multisampled data access follows the multisampled indexing convention.
63  *
64  * Prevents accidental usage of non-multisampled buffer as multisampled
65  * with PixelBufferAccess.
66  *//*--------------------------------------------------------------------*/
67 class MultisampleConstPixelBufferAccess
68 {
69 												MultisampleConstPixelBufferAccess		(const tcu::ConstPixelBufferAccess& rawAccess);
70 
71 public:
72 												MultisampleConstPixelBufferAccess		(const rr::MultisamplePixelBufferAccess& msAccess);
73 												MultisampleConstPixelBufferAccess		(void);
74 
raw(void) const75 	inline const tcu::ConstPixelBufferAccess&	raw										(void) const { return m_access; }
getNumSamples(void) const76 	inline int									getNumSamples							(void) const { return raw().getWidth(); }
77 
78 	const tcu::ConstPixelBufferAccess			toSinglesampleAccess					(void) const;
79 
80 	static MultisampleConstPixelBufferAccess	fromSinglesampleAccess					(const tcu::ConstPixelBufferAccess& singlesampledAccess);
81 	static MultisampleConstPixelBufferAccess	fromMultisampleAccess					(const tcu::ConstPixelBufferAccess& multisampledAccess);
82 
83 private:
84 	tcu::ConstPixelBufferAccess					m_access;
85 } DE_WARN_UNUSED_TYPE;
86 
87 // Multisampled versions of tcu-utils
88 
89 MultisamplePixelBufferAccess		getSubregion					(const MultisamplePixelBufferAccess& access, int x, int y, int width, int height);
90 MultisampleConstPixelBufferAccess	getSubregion					(const MultisampleConstPixelBufferAccess& access, int x, int y, int width, int height);
91 
92 void								resolveMultisampleColorBuffer	(const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
93 void								resolveMultisampleDepthBuffer	(const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
94 void								resolveMultisampleStencilBuffer	(const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
95 void								resolveMultisampleBuffer		(const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
96 tcu::Vec4							resolveMultisamplePixel			(const MultisampleConstPixelBufferAccess& access, int x, int y);
97 
98 void								clear							(const MultisamplePixelBufferAccess& access, const tcu::Vec4& color);
99 void								clear							(const MultisamplePixelBufferAccess& access, const tcu::IVec4& color);
100 void								clearDepth						(const MultisamplePixelBufferAccess& access, float depth);
101 void								clearStencil					(const MultisamplePixelBufferAccess& access, int stencil);
102 
103 } // rr
104 
105 #endif // _RRMULTISAMPLEPIXELBUFFERACCESS_HPP
106