xref: /aosp_15_r20/external/deqp/external/vulkancts/modules/vulkan/compute/vktComputeTestsUtil.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 #ifndef _VKTCOMPUTETESTSUTIL_HPP
2 #define _VKTCOMPUTETESTSUTIL_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 Compute tests utility classes
24  *//*--------------------------------------------------------------------*/
25 
26 #include "vkDefs.hpp"
27 #include "vkMemUtil.hpp"
28 #include "vkRef.hpp"
29 #include "vkRefUtil.hpp"
30 #include "vkPrograms.hpp"
31 #include "vkTypeUtil.hpp"
32 #include "vkImageUtil.hpp"
33 #include "vkObjUtil.hpp"
34 
35 namespace vkt
36 {
37 namespace compute
38 {
39 vk::VkBufferImageCopy makeBufferImageCopy(const vk::VkExtent3D extent, const uint32_t arraySize);
40 
makeExtent3D(const tcu::IVec3 & vec)41 inline vk::VkExtent3D makeExtent3D(const tcu::IVec3 &vec)
42 {
43     return vk::makeExtent3D(vec.x(), vec.y(), vec.z());
44 }
45 
getImageSizeBytes(const tcu::IVec3 & imageSize,const vk::VkFormat format)46 inline vk::VkDeviceSize getImageSizeBytes(const tcu::IVec3 &imageSize, const vk::VkFormat format)
47 {
48     return tcu::getPixelSize(vk::mapVkFormat(format)) * imageSize.x() * imageSize.y() * imageSize.z();
49 }
50 
51 } // namespace compute
52 } // namespace vkt
53 
54 #endif // _VKTCOMPUTETESTSUTIL_HPP
55