1e5c31af7Sopenharmony_ci#ifndef _VKTIMAGETEXTURE_HPP
2e5c31af7Sopenharmony_ci#define _VKTIMAGETEXTURE_HPP
3e5c31af7Sopenharmony_ci/*------------------------------------------------------------------------
4e5c31af7Sopenharmony_ci * Vulkan Conformance Tests
5e5c31af7Sopenharmony_ci * ------------------------
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Copyright (c) 2016 The Khronos Group Inc.
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 Texture utility class
24e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ci#include "tcuDefs.hpp"
27e5c31af7Sopenharmony_ci#include "vktImageTestsUtil.hpp"
28e5c31af7Sopenharmony_ci
29e5c31af7Sopenharmony_cinamespace vkt
30e5c31af7Sopenharmony_ci{
31e5c31af7Sopenharmony_cinamespace image
32e5c31af7Sopenharmony_ci{
33e5c31af7Sopenharmony_ci
34e5c31af7Sopenharmony_ci//! Texture buffer/image abstraction. Helps managing size, number of layers and number of mipmap levels.
35e5c31af7Sopenharmony_ciclass Texture
36e5c31af7Sopenharmony_ci{
37e5c31af7Sopenharmony_cipublic:
38e5c31af7Sopenharmony_ci						Texture			(const ImageType imageType, const tcu::IVec3& imageLayerSize, const int layers, const int samples = 1, const int levels = 1);
39e5c31af7Sopenharmony_ci						Texture			(const Texture& other, const int samples);
40e5c31af7Sopenharmony_ci
41e5c31af7Sopenharmony_ci	ImageType			type			(void) const { return m_type; }			//!< Texture type
42e5c31af7Sopenharmony_ci	tcu::IVec3			layerSize		(const int mipLevel = 0) const;			//!< Size of a single layer for mipmap level 0
43e5c31af7Sopenharmony_ci	int					numLayers		(void) const { return m_numLayers; }	//!< Number of array layers (for array and cube types)
44e5c31af7Sopenharmony_ci	int					numSamples		(void) const { return m_numSamples; }	//!< Number of samples per texel (multisampled texture)
45e5c31af7Sopenharmony_ci
46e5c31af7Sopenharmony_ci	tcu::IVec3			size			(const int mipLevel = 0) const;			//!< Size including number of layers in additional dimension (e.g. z in 2d texture) for mipmap level 0
47e5c31af7Sopenharmony_ci	int					dimension		(void) const;							//!< Coordinate dimension used for addressing (e.g. 3 (x,y,z) for 2d array)
48e5c31af7Sopenharmony_ci	int					layerDimension	(void) const;							//!< Coordinate dimension used for addressing a single layer (e.g. 2 (x,y) for 2d array)
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_ci	int					numMipmapLevels	(void) const { return m_numMipmapLevels; }	//!< Number of levels of detail (mipmap texture)
51e5c31af7Sopenharmony_ci
52e5c31af7Sopenharmony_ciprivate:
53e5c31af7Sopenharmony_ci	void				checkInvariants	(void) const;
54e5c31af7Sopenharmony_ci
55e5c31af7Sopenharmony_ci	const tcu::IVec3	m_layerSize;
56e5c31af7Sopenharmony_ci	const ImageType		m_type;
57e5c31af7Sopenharmony_ci	const int			m_numLayers;
58e5c31af7Sopenharmony_ci	const int			m_numSamples;
59e5c31af7Sopenharmony_ci	const int			m_numMipmapLevels;
60e5c31af7Sopenharmony_ci};
61e5c31af7Sopenharmony_ci
62e5c31af7Sopenharmony_ciinline bool isCube (const Texture& texture)
63e5c31af7Sopenharmony_ci{
64e5c31af7Sopenharmony_ci	return texture.type() == IMAGE_TYPE_CUBE || texture.type() == IMAGE_TYPE_CUBE_ARRAY;
65e5c31af7Sopenharmony_ci}
66e5c31af7Sopenharmony_ci
67e5c31af7Sopenharmony_ci} // image
68e5c31af7Sopenharmony_ci} // vkt
69e5c31af7Sopenharmony_ci
70e5c31af7Sopenharmony_ci#endif // _VKTIMAGETEXTURE_HPP
71