Fix texture/sampler mapping in sRGB tests am: c8efb45ead am: 984445983d am: bd25f07ba0
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / api / vktApiBufferAndImageAllocationUtil.hpp
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
32 namespace vk
33 {
34 class Allocator;
35 class MemoryRequirement;
36 class Allocation;
37 }
38
39 namespace vkt
40 {
41
42 namespace api
43 {
44
45 using namespace vk;
46
47 class IBufferAllocator
48 {
49 public:
50         virtual void                                            createTestBuffer                                (VkDeviceSize                           size,
51                                                                                                                                                  VkBufferUsageFlags                     usage,
52                                                                                                                                                  Context&                                       context,
53                                                                                                                                                  Allocator&                     allocator,
54                                                                                                                                                  Move<VkBuffer>&                        buffer,
55                                                                                                                                                  const MemoryRequirement&       requirement,
56                                                                                                                                                  de::MovePtr<Allocation>&       memory) const = 0;
57 };
58
59 class BufferSuballocation : public IBufferAllocator
60 {
61 public:
62         virtual void                                            createTestBuffer                                (VkDeviceSize                           size,
63                                                                                                                                                  VkBufferUsageFlags                     usage,
64                                                                                                                                                  Context&                                       context,
65                                                                                                                                                  Allocator&                                     allocator,
66                                                                                                                                                  Move<VkBuffer>&                        buffer,
67                                                                                                                                                  const MemoryRequirement&       requirement,
68                                                                                                                                                  de::MovePtr<Allocation>&       memory) const; // override
69 };
70
71 class BufferDedicatedAllocation : public IBufferAllocator
72 {
73 public:
74         virtual void                                            createTestBuffer                                (VkDeviceSize                           size,
75                                                                                                                                                  VkBufferUsageFlags                     usage,
76                                                                                                                                                  Context&                                       context,
77                                                                                                                                                  Allocator&                                     allocator,
78                                                                                                                                                  Move<VkBuffer>&                        buffer,
79                                                                                                                                                  const MemoryRequirement&       requirement,
80                                                                                                                                                  de::MovePtr<Allocation>&       memory) const; // override
81 };
82
83 class IImageAllocator
84 {
85 public:
86         virtual void                                            createTestImage                                 (tcu::IVec2                                     size,
87                                                                                                                                                  VkFormat                                       format,
88                                                                                                                                                  Context&                                       context,
89                                                                                                                                                  Allocator&                                     allocator,
90                                                                                                                                                  Move<VkImage>&                         image,
91                                                                                                                                                  const MemoryRequirement&       requirement,
92                                                                                                                                                  de::MovePtr<Allocation>&       memory) const = 0;
93 };
94
95 class ImageSuballocation : public IImageAllocator
96 {
97 public:
98         virtual void                                            createTestImage                                 (tcu::IVec2                                     size,
99                                                                                                                                                  VkFormat                                       format,
100                                                                                                                                                  Context&                                       context,
101                                                                                                                                                  Allocator&                                     allocator,
102                                                                                                                                                  Move<VkImage>&                         image,
103                                                                                                                                                  const MemoryRequirement&       requirement,
104                                                                                                                                                  de::MovePtr<Allocation>&       memory) const; // override
105 };
106
107 class ImageDedicatedAllocation  : public IImageAllocator
108 {
109 public:
110         virtual void                                            createTestImage                                 (tcu::IVec2                                     size,
111                                                                                                                                                  VkFormat                                       format,
112                                                                                                                                                  Context&                                       context,
113                                                                                                                                                  Allocator&                                     allocator,
114                                                                                                                                                  Move<VkImage>&                         image,
115                                                                                                                                                  const MemoryRequirement&       requirement,
116                                                                                                                                                  de::MovePtr<Allocation>&       memory) const; // override
117 };
118
119 } // api
120 } // vkt
121
122 #endif // _VKTAPIBUFFERANDIMAGEALLOCATIONUTIL_HPP