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