1#ifndef _VKTAPIBUFFERANDIMAGEALLOCATIONUTIL_HPP 2#define _VKTAPIBUFFERANDIMAGEALLOCATIONUTIL_HPP 3/*------------------------------------------------------------------------ 4 * Vulkan Conformance Tests 5 * ------------------------ 6 * 7 * Copyright (c) 2017 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 Utility classes for various kinds of allocation memory for buffers and images 24 *//*--------------------------------------------------------------------*/ 25 26#include "deUniquePtr.hpp" 27#include "vkDefs.hpp" 28#include "vkRef.hpp" 29#include "vktTestCase.hpp" 30#include "tcuVectorType.hpp" 31 32namespace vk 33{ 34class Allocator; 35class MemoryRequirement; 36class Allocation; 37} 38 39namespace vkt 40{ 41 42namespace api 43{ 44 45using namespace vk; 46 47class IBufferAllocator 48{ 49public: 50 virtual void createTestBuffer (const DeviceInterface& vk, 51 VkDevice vkDevice, 52 deUint32 queueFamilyIndex, 53 VkDeviceSize size, 54 VkBufferUsageFlags usage, 55 Context& context, 56 Allocator& allocator, 57 Move<VkBuffer>& buffer, 58 const MemoryRequirement& requirement, 59 de::MovePtr<Allocation>& memory) const = 0; 60}; 61 62class BufferSuballocation : public IBufferAllocator 63{ 64public: 65 virtual void createTestBuffer (const DeviceInterface& vk, 66 VkDevice vkDevice, 67 deUint32 queueFamilyIndex, 68 VkDeviceSize size, 69 VkBufferUsageFlags usage, 70 Context& context, 71 Allocator& allocator, 72 Move<VkBuffer>& buffer, 73 const MemoryRequirement& requirement, 74 de::MovePtr<Allocation>& memory) const; // override 75}; 76 77class BufferDedicatedAllocation : public IBufferAllocator 78{ 79public: 80 virtual void createTestBuffer (const DeviceInterface& vk, 81 VkDevice vkDevice, 82 deUint32 queueFamilyIndex, 83 VkDeviceSize size, 84 VkBufferUsageFlags usage, 85 Context& context, 86 Allocator& allocator, 87 Move<VkBuffer>& buffer, 88 const MemoryRequirement& requirement, 89 de::MovePtr<Allocation>& memory) const; // override 90}; 91 92class IImageAllocator 93{ 94public: 95 virtual void createTestImage (tcu::IVec2 size, 96 VkFormat format, 97 Context& context, 98 Allocator& allocator, 99 Move<VkImage>& image, 100 const MemoryRequirement& requirement, 101 de::MovePtr<Allocation>& memory, 102 VkImageTiling tiling = VK_IMAGE_TILING_OPTIMAL) const = 0; 103}; 104 105class ImageSuballocation : public IImageAllocator 106{ 107public: 108 virtual void createTestImage (tcu::IVec2 size, 109 VkFormat format, 110 Context& context, 111 Allocator& allocator, 112 Move<VkImage>& image, 113 const MemoryRequirement& requirement, 114 de::MovePtr<Allocation>& memory, 115 VkImageTiling tiling = VK_IMAGE_TILING_OPTIMAL) const; // override 116}; 117 118class ImageDedicatedAllocation : public IImageAllocator 119{ 120public: 121 virtual void createTestImage (tcu::IVec2 size, 122 VkFormat format, 123 Context& context, 124 Allocator& allocator, 125 Move<VkImage>& image, 126 const MemoryRequirement& requirement, 127 de::MovePtr<Allocation>& memory, 128 VkImageTiling tiling = VK_IMAGE_TILING_OPTIMAL) const; // override 129}; 130 131} // api 132} // vkt 133 134#endif // _VKTAPIBUFFERANDIMAGEALLOCATIONUTIL_HPP 135