1 #ifndef _VKTAPIBUFFERANDIMAGEALLOCATIONUTIL_HPP
2 #define _VKTAPIBUFFERANDIMAGEALLOCATIONUTIL_HPP
3 /*------------------------------------------------------------------------
4 * Vulkan Conformance Tests
5 * ------------------------
7 * Copyright (c) 2017 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 Utility classes for various kinds of allocation memory for buffers and images
24 *//*--------------------------------------------------------------------*/
26 #include "deUniquePtr.hpp"
29 #include "vktTestCase.hpp"
30 #include "tcuVectorType.hpp"
35 class MemoryRequirement;
47 class IBufferAllocator
50 virtual void createTestBuffer (VkDeviceSize size,
51 VkBufferUsageFlags usage,
54 Move<VkBuffer>& buffer,
55 const MemoryRequirement& requirement,
56 de::MovePtr<Allocation>& memory) const = 0;
59 class BufferSuballocation : public IBufferAllocator
62 virtual void createTestBuffer (VkDeviceSize size,
63 VkBufferUsageFlags usage,
66 Move<VkBuffer>& buffer,
67 const MemoryRequirement& requirement,
68 de::MovePtr<Allocation>& memory) const; // override
71 class BufferDedicatedAllocation : public IBufferAllocator
74 virtual void createTestBuffer (VkDeviceSize size,
75 VkBufferUsageFlags usage,
78 Move<VkBuffer>& buffer,
79 const MemoryRequirement& requirement,
80 de::MovePtr<Allocation>& memory) const; // override
86 virtual void createTestImage (tcu::IVec2 size,
91 const MemoryRequirement& requirement,
92 de::MovePtr<Allocation>& memory) const = 0;
95 class ImageSuballocation : public IImageAllocator
98 virtual void createTestImage (tcu::IVec2 size,
101 Allocator& allocator,
102 Move<VkImage>& image,
103 const MemoryRequirement& requirement,
104 de::MovePtr<Allocation>& memory) const; // override
107 class ImageDedicatedAllocation : public IImageAllocator
110 virtual void createTestImage (tcu::IVec2 size,
113 Allocator& allocator,
114 Move<VkImage>& image,
115 const MemoryRequirement& requirement,
116 de::MovePtr<Allocation>& memory) const; // override
122 #endif // _VKTAPIBUFFERANDIMAGEALLOCATIONUTIL_HPP