1 #ifndef _VKTIMAGELOADSTOREUTIL_HPP
2 #define _VKTIMAGELOADSTOREUTIL_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.
23 * \brief Image load/store utilities
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
28 #include "vkImageUtil.hpp"
29 #include "vktImageTestsUtil.hpp"
30 #include "vktImageTexture.hpp"
31 #include "tcuVector.hpp"
32 #include "deSharedPtr.hpp"
39 typedef de::SharedPtr<vk::Unique<vk::VkDescriptorSet> > SharedVkDescriptorSet;
40 typedef de::SharedPtr<vk::Unique<vk::VkImageView> > SharedVkImageView;
43 inline de::SharedPtr<vk::Unique<T> > makeVkSharedPtr (vk::Move<T> vkMove)
45 return de::SharedPtr<vk::Unique<T> >(new vk::Unique<T>(vkMove));
48 inline float computeStoreColorBias (const vk::VkFormat format)
50 return isSnormFormat(format) ? -1.0f : 0.0f;
53 inline bool isIntegerFormat (const vk::VkFormat format)
55 return isIntFormat(format) || isUintFormat(format);
58 inline bool colorScaleAndBiasAreValid (const vk::VkFormat format, const float colorScale, const float colorBias)
60 // Only normalized (fixed-point) formats may have scale/bias
61 const bool integerOrFloatFormat = isIntFormat(format) || isUintFormat(format) || isFloatFormat(format);
62 return !integerOrFloatFormat || (colorScale == 1.0f && colorBias == 0.0f);
65 float computeStoreColorScale (const vk::VkFormat format, const tcu::IVec3 imageSize);
66 ImageType getImageTypeForSingleLayer (const ImageType imageType);
67 vk::VkImageCreateInfo makeImageCreateInfo (const Texture& texture, const vk::VkFormat format, const vk::VkImageUsageFlags usage, const vk::VkImageCreateFlags flags);
68 vk::VkDeviceSize getOptimalUniformBufferChunkSize (const vk::InstanceInterface& vki, const vk::VkPhysicalDevice physDevice, vk::VkDeviceSize minimumRequiredChunkSizeBytes);
73 #endif // _VKTIMAGELOADSTOREUTIL_HPP