1 #ifndef _VKTPIPELINEMULTISAMPLETESTSUTIL_HPP
2 #define _VKTPIPELINEMULTISAMPLETESTSUTIL_HPP
3 /*------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
7 * Copyright (c) 2016 The Khronos Group Inc.
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.
22 * \file vktPipelineMultisampleTestsUtil.hpp
23 * \brief Multisample Tests Utility Classes
24 *//*--------------------------------------------------------------------*/
27 #include "vkMemUtil.hpp"
29 #include "vkRefUtil.hpp"
30 #include "vkPrograms.hpp"
31 #include "vkTypeUtil.hpp"
32 #include "vkImageUtil.hpp"
33 #include "deSharedPtr.hpp"
50 IMAGE_TYPE_CUBE_ARRAY,
56 // Image helper functions
57 vk::VkImageType mapImageType (const ImageType imageType);
58 vk::VkImageViewType mapImageViewType (const ImageType imageType);
59 std::string getImageTypeName (const ImageType imageType);
60 std::string getShaderImageType (const tcu::TextureFormat& format, const ImageType imageType);
61 std::string getShaderImageDataType (const tcu::TextureFormat& format);
62 std::string getShaderImageFormatQualifier (const tcu::TextureFormat& format);
63 std::string getShaderImageCoordinates (const ImageType imageType, const std::string& x, const std::string& xy, const std::string& xyz);
64 //!< Size used for addresing image in a compute shader
65 tcu::UVec3 getShaderGridSize (const ImageType imageType, const tcu::UVec3& imageSize, const deUint32 mipLevel = 0);
66 //!< Size of a single image layer
67 tcu::UVec3 getLayerSize (const ImageType imageType, const tcu::UVec3& imageSize);
68 //!< Number of array layers (for array and cube types)
69 deUint32 getNumLayers (const ImageType imageType, const tcu::UVec3& imageSize);
70 //!< Number of texels in an image
71 deUint32 getNumPixels (const ImageType imageType, const tcu::UVec3& imageSize);
72 //!< Coordinate dimension used for addressing (e.g. 3 (x,y,z) for 2d array)
73 deUint32 getDimensions (const ImageType imageType);
74 //!< Coordinate dimension used for addressing a single layer (e.g. 2 (x,y) for 2d array)
75 deUint32 getLayerDimensions (const ImageType imageType);
76 vk::VkExtent3D mipLevelExtents (const vk::VkExtent3D& baseExtents, const deUint32 mipLevel);
77 tcu::UVec3 mipLevelExtents (const tcu::UVec3& baseExtents, const deUint32 mipLevel);
78 deUint32 getImageMipLevelSizeInBytes (const vk::VkExtent3D& baseExtents, const deUint32 layersCount, const tcu::TextureFormat& format, const deUint32 mipmapLevel, const deUint32 numSamples = 1u);
79 deUint32 getImageSizeInBytes (const vk::VkExtent3D& baseExtents, const deUint32 layersCount, const tcu::TextureFormat& format, const deUint32 mipmapLevelsCount = 1u, const deUint32 numSamples = 1u);
80 deUint32 getImageMaxMipLevels (const vk::VkImageFormatProperties& imageFormatProperties, const vk::VkExtent3D& extent);
84 FEATURE_TESSELLATION_SHADER = 1u << 0,
85 FEATURE_GEOMETRY_SHADER = 1u << 1,
86 FEATURE_SHADER_FLOAT_64 = 1u << 2,
87 FEATURE_VERTEX_PIPELINE_STORES_AND_ATOMICS = 1u << 3,
88 FEATURE_FRAGMENT_STORES_AND_ATOMICS = 1u << 4,
89 FEATURE_SHADER_TESSELLATION_AND_GEOMETRY_POINT_SIZE = 1u << 5,
91 typedef deUint32 FeatureFlags;
93 void requireFeatures(const vk::InstanceInterface& instanceInterface, const vk::VkPhysicalDevice physicalDevice, const FeatureFlags flags);
96 inline de::SharedPtr<vk::Unique<T> > makeVkSharedPtr(vk::Move<T> vkMove)
98 return de::SharedPtr<vk::Unique<T> >(new vk::Unique<T>(vkMove));
102 inline std::size_t sizeInBytes(const std::vector<T>& vec)
104 return vec.size() * sizeof(vec[0]);
108 inline const T* dataPointer(const std::vector<T>& vec)
110 return (vec.size() != 0 ? &vec[0] : DE_NULL);
117 #endif // _VKTPIPELINEMULTISAMPLETESTSUTIL_HPP