1 #ifndef _VKTIMAGETEXTURE_HPP 2 #define _VKTIMAGETEXTURE_HPP 3 /*------------------------------------------------------------------------ 4 * Vulkan Conformance Tests 5 * ------------------------ 6 * 7 * Copyright (c) 2016 The Khronos Group Inc. 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 Texture utility class 24 *//*--------------------------------------------------------------------*/ 25 26 #include "tcuDefs.hpp" 27 #include "vktImageTestsUtil.hpp" 28 29 namespace vkt 30 { 31 namespace image 32 { 33 34 //! Texture buffer/image abstraction. Helps managing size and number of layers. 35 class Texture 36 { 37 public: 38 Texture (const ImageType type, const tcu::IVec3& layerSize, const int layers); 39 type(void) const40 ImageType type (void) const { return m_type; } //!< Texture type layerSize(void) const41 tcu::IVec3 layerSize (void) const { return m_layerSize; } //!< Size of a single layer numLayers(void) const42 int numLayers (void) const { return m_numLayers; } //!< Number of array layers (for array and cube types) 43 44 tcu::IVec3 size (void) const; //!< Size including number of layers in additional dimension (e.g. z in 2d texture) 45 int dimension (void) const; //!< Coordinate dimension used for addressing (e.g. 3 (x,y,z) for 2d array) 46 int layerDimension (void) const; //!< Coordinate dimension used for addressing a single layer (e.g. 2 (x,y) for 2d array) 47 48 private: 49 const tcu::IVec3 m_layerSize; 50 const ImageType m_type; 51 const int m_numLayers; 52 }; 53 isCube(const Texture & texture)54inline bool isCube (const Texture& texture) 55 { 56 return texture.type() == IMAGE_TYPE_CUBE || texture.type() == IMAGE_TYPE_CUBE_ARRAY; 57 } 58 59 } // image 60 } // vkt 61 62 #endif // _VKTIMAGETEXTURE_HPP 63