1 #ifndef _RRMULTISAMPLEPIXELBUFFERACCESS_HPP
2 #define _RRMULTISAMPLEPIXELBUFFERACCESS_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Reference Renderer
5 * -----------------------------------------------
7 * Copyright 2014 The Android Open Source Project
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * \brief Multisampled pixel buffer access
24 *//*--------------------------------------------------------------------*/
27 #include "tcuTexture.hpp"
32 /*--------------------------------------------------------------------*//*!
33 * \brief Read-write pixel data access to multisampled buffers.
35 * Multisampled data access follows the multisampled indexing convention.
37 * Prevents accidental usage of non-multisampled buffer as multisampled
38 * with PixelBufferAccess.
39 *//*--------------------------------------------------------------------*/
40 class MultisamplePixelBufferAccess
42 MultisamplePixelBufferAccess (const tcu::PixelBufferAccess& rawAccess);
45 MultisamplePixelBufferAccess (void);
47 inline const tcu::PixelBufferAccess& raw (void) const { return m_access; }
48 inline int getNumSamples (void) const { return raw().getWidth(); }
50 const tcu::PixelBufferAccess toSinglesampleAccess (void) const;
52 static MultisamplePixelBufferAccess fromSinglesampleAccess (const tcu::PixelBufferAccess& singlesampledAccess);
53 static MultisamplePixelBufferAccess fromMultisampleAccess (const tcu::PixelBufferAccess& multisampledAccess);
56 tcu::PixelBufferAccess m_access;
57 } DE_WARN_UNUSED_TYPE;
59 /*--------------------------------------------------------------------*//*!
60 * \brief Read-only pixel data access to multisampled buffers.
62 * Multisampled data access follows the multisampled indexing convention.
64 * Prevents accidental usage of non-multisampled buffer as multisampled
65 * with PixelBufferAccess.
66 *//*--------------------------------------------------------------------*/
67 class MultisampleConstPixelBufferAccess
69 MultisampleConstPixelBufferAccess (const tcu::ConstPixelBufferAccess& rawAccess);
72 MultisampleConstPixelBufferAccess (const rr::MultisamplePixelBufferAccess& msAccess);
73 MultisampleConstPixelBufferAccess (void);
75 inline const tcu::ConstPixelBufferAccess& raw (void) const { return m_access; }
76 inline int getNumSamples (void) const { return raw().getWidth(); }
78 const tcu::ConstPixelBufferAccess toSinglesampleAccess (void) const;
80 static MultisampleConstPixelBufferAccess fromSinglesampleAccess (const tcu::ConstPixelBufferAccess& singlesampledAccess);
81 static MultisampleConstPixelBufferAccess fromMultisampleAccess (const tcu::ConstPixelBufferAccess& multisampledAccess);
84 tcu::ConstPixelBufferAccess m_access;
85 } DE_WARN_UNUSED_TYPE;
87 // Multisampled versions of tcu-utils
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);
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);
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);
105 #endif // _RRMULTISAMPLEPIXELBUFFERACCESS_HPP