dEQP-VK.renderpass: Set IMAGE_USAGE_TRANSFER_SRC_BIT when needed
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / framework / vulkan / vkTypeUtil.inl
1 /* WARNING: This is auto-generated file. Do not modify, since changes will
2  * be lost! Modify the generating script instead.
3  */
4
5 inline VkAllocationCallbacks makeAllocationCallbacks (void* pUserData, PFN_vkAllocationFunction pfnAllocation, PFN_vkReallocationFunction pfnReallocation, PFN_vkFreeFunction pfnFree, PFN_vkInternalAllocationNotification pfnInternalAllocation, PFN_vkInternalFreeNotification pfnInternalFree)
6 {
7         VkAllocationCallbacks res;
8         res.pUserData                           = pUserData;
9         res.pfnAllocation                       = pfnAllocation;
10         res.pfnReallocation                     = pfnReallocation;
11         res.pfnFree                                     = pfnFree;
12         res.pfnInternalAllocation       = pfnInternalAllocation;
13         res.pfnInternalFree                     = pfnInternalFree;
14         return res;
15 }
16
17 inline VkExtent3D makeExtent3D (deInt32 width, deInt32 height, deInt32 depth)
18 {
19         VkExtent3D res;
20         res.width       = width;
21         res.height      = height;
22         res.depth       = depth;
23         return res;
24 }
25
26 inline VkMemoryRequirements makeMemoryRequirements (VkDeviceSize size, VkDeviceSize alignment, deUint32 memoryTypeBits)
27 {
28         VkMemoryRequirements res;
29         res.size                        = size;
30         res.alignment           = alignment;
31         res.memoryTypeBits      = memoryTypeBits;
32         return res;
33 }
34
35 inline VkSparseMemoryBind makeSparseMemoryBind (VkDeviceSize resourceOffset, VkDeviceSize size, VkDeviceMemory memory, VkDeviceSize memoryOffset, VkSparseMemoryBindFlags flags)
36 {
37         VkSparseMemoryBind res;
38         res.resourceOffset      = resourceOffset;
39         res.size                        = size;
40         res.memory                      = memory;
41         res.memoryOffset        = memoryOffset;
42         res.flags                       = flags;
43         return res;
44 }
45
46 inline VkSparseBufferMemoryBindInfo makeSparseBufferMemoryBindInfo (VkBuffer buffer, deUint32 bindCount, const VkSparseMemoryBind* pBinds)
47 {
48         VkSparseBufferMemoryBindInfo res;
49         res.buffer              = buffer;
50         res.bindCount   = bindCount;
51         res.pBinds              = pBinds;
52         return res;
53 }
54
55 inline VkSparseImageOpaqueMemoryBindInfo makeSparseImageOpaqueMemoryBindInfo (VkImage image, deUint32 bindCount, const VkSparseMemoryBind* pBinds)
56 {
57         VkSparseImageOpaqueMemoryBindInfo res;
58         res.image               = image;
59         res.bindCount   = bindCount;
60         res.pBinds              = pBinds;
61         return res;
62 }
63
64 inline VkImageSubresource makeImageSubresource (VkImageAspectFlags aspectMask, deUint32 mipLevel, deUint32 arrayLayer)
65 {
66         VkImageSubresource res;
67         res.aspectMask  = aspectMask;
68         res.mipLevel    = mipLevel;
69         res.arrayLayer  = arrayLayer;
70         return res;
71 }
72
73 inline VkOffset3D makeOffset3D (deInt32 x, deInt32 y, deInt32 z)
74 {
75         VkOffset3D res;
76         res.x   = x;
77         res.y   = y;
78         res.z   = z;
79         return res;
80 }
81
82 inline VkSparseImageMemoryBindInfo makeSparseImageMemoryBindInfo (VkImage image, deUint32 bindCount, const VkSparseImageMemoryBind* pBinds)
83 {
84         VkSparseImageMemoryBindInfo res;
85         res.image               = image;
86         res.bindCount   = bindCount;
87         res.pBinds              = pBinds;
88         return res;
89 }
90
91 inline VkSubresourceLayout makeSubresourceLayout (VkDeviceSize offset, VkDeviceSize size, VkDeviceSize rowPitch, VkDeviceSize depthPitch)
92 {
93         VkSubresourceLayout res;
94         res.offset              = offset;
95         res.size                = size;
96         res.rowPitch    = rowPitch;
97         res.depthPitch  = depthPitch;
98         return res;
99 }
100
101 inline VkComponentMapping makeComponentMapping (VkComponentSwizzle r, VkComponentSwizzle g, VkComponentSwizzle b, VkComponentSwizzle a)
102 {
103         VkComponentMapping res;
104         res.r   = r;
105         res.g   = g;
106         res.b   = b;
107         res.a   = a;
108         return res;
109 }
110
111 inline VkImageSubresourceRange makeImageSubresourceRange (VkImageAspectFlags aspectMask, deUint32 baseMipLevel, deUint32 levelCount, deUint32 baseArrayLayer, deUint32 layerCount)
112 {
113         VkImageSubresourceRange res;
114         res.aspectMask          = aspectMask;
115         res.baseMipLevel        = baseMipLevel;
116         res.levelCount          = levelCount;
117         res.baseArrayLayer      = baseArrayLayer;
118         res.layerCount          = layerCount;
119         return res;
120 }
121
122 inline VkSpecializationMapEntry makeSpecializationMapEntry (deUint32 constantID, deUint32 offset, deUintptr size)
123 {
124         VkSpecializationMapEntry res;
125         res.constantID  = constantID;
126         res.offset              = offset;
127         res.size                = size;
128         return res;
129 }
130
131 inline VkSpecializationInfo makeSpecializationInfo (deUint32 mapEntryCount, const VkSpecializationMapEntry* pMapEntries, deUintptr dataSize, const void* pData)
132 {
133         VkSpecializationInfo res;
134         res.mapEntryCount       = mapEntryCount;
135         res.pMapEntries         = pMapEntries;
136         res.dataSize            = dataSize;
137         res.pData                       = pData;
138         return res;
139 }
140
141 inline VkVertexInputBindingDescription makeVertexInputBindingDescription (deUint32 binding, deUint32 stride, VkVertexInputRate inputRate)
142 {
143         VkVertexInputBindingDescription res;
144         res.binding             = binding;
145         res.stride              = stride;
146         res.inputRate   = inputRate;
147         return res;
148 }
149
150 inline VkVertexInputAttributeDescription makeVertexInputAttributeDescription (deUint32 location, deUint32 binding, VkFormat format, deUint32 offset)
151 {
152         VkVertexInputAttributeDescription res;
153         res.location    = location;
154         res.binding             = binding;
155         res.format              = format;
156         res.offset              = offset;
157         return res;
158 }
159
160 inline VkViewport makeViewport (float x, float y, float width, float height, float minDepth, float maxDepth)
161 {
162         VkViewport res;
163         res.x                   = x;
164         res.y                   = y;
165         res.width               = width;
166         res.height              = height;
167         res.minDepth    = minDepth;
168         res.maxDepth    = maxDepth;
169         return res;
170 }
171
172 inline VkOffset2D makeOffset2D (deInt32 x, deInt32 y)
173 {
174         VkOffset2D res;
175         res.x   = x;
176         res.y   = y;
177         return res;
178 }
179
180 inline VkExtent2D makeExtent2D (deInt32 width, deInt32 height)
181 {
182         VkExtent2D res;
183         res.width       = width;
184         res.height      = height;
185         return res;
186 }
187
188 inline VkStencilOpState makeStencilOpState (VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp, deUint32 compareMask, deUint32 writeMask, deUint32 reference)
189 {
190         VkStencilOpState res;
191         res.failOp              = failOp;
192         res.passOp              = passOp;
193         res.depthFailOp = depthFailOp;
194         res.compareOp   = compareOp;
195         res.compareMask = compareMask;
196         res.writeMask   = writeMask;
197         res.reference   = reference;
198         return res;
199 }
200
201 inline VkPipelineColorBlendAttachmentState makePipelineColorBlendAttachmentState (VkBool32 blendEnable, VkBlendFactor srcColorBlendFactor, VkBlendFactor dstColorBlendFactor, VkBlendOp colorBlendOp, VkBlendFactor srcAlphaBlendFactor, VkBlendFactor dstAlphaBlendFactor, VkBlendOp alphaBlendOp, VkColorComponentFlags colorWriteMask)
202 {
203         VkPipelineColorBlendAttachmentState res;
204         res.blendEnable                 = blendEnable;
205         res.srcColorBlendFactor = srcColorBlendFactor;
206         res.dstColorBlendFactor = dstColorBlendFactor;
207         res.colorBlendOp                = colorBlendOp;
208         res.srcAlphaBlendFactor = srcAlphaBlendFactor;
209         res.dstAlphaBlendFactor = dstAlphaBlendFactor;
210         res.alphaBlendOp                = alphaBlendOp;
211         res.colorWriteMask              = colorWriteMask;
212         return res;
213 }
214
215 inline VkPushConstantRange makePushConstantRange (VkShaderStageFlags stageFlags, deUint32 offset, deUint32 size)
216 {
217         VkPushConstantRange res;
218         res.stageFlags  = stageFlags;
219         res.offset              = offset;
220         res.size                = size;
221         return res;
222 }
223
224 inline VkDescriptorSetLayoutBinding makeDescriptorSetLayoutBinding (deUint32 binding, VkDescriptorType descriptorType, deUint32 descriptorCount, VkShaderStageFlags stageFlags, const VkSampler* pImmutableSamplers)
225 {
226         VkDescriptorSetLayoutBinding res;
227         res.binding                             = binding;
228         res.descriptorType              = descriptorType;
229         res.descriptorCount             = descriptorCount;
230         res.stageFlags                  = stageFlags;
231         res.pImmutableSamplers  = pImmutableSamplers;
232         return res;
233 }
234
235 inline VkDescriptorPoolSize makeDescriptorPoolSize (VkDescriptorType type, deUint32 descriptorCount)
236 {
237         VkDescriptorPoolSize res;
238         res.type                        = type;
239         res.descriptorCount     = descriptorCount;
240         return res;
241 }
242
243 inline VkDescriptorImageInfo makeDescriptorImageInfo (VkSampler sampler, VkImageView imageView, VkImageLayout imageLayout)
244 {
245         VkDescriptorImageInfo res;
246         res.sampler             = sampler;
247         res.imageView   = imageView;
248         res.imageLayout = imageLayout;
249         return res;
250 }
251
252 inline VkDescriptorBufferInfo makeDescriptorBufferInfo (VkBuffer buffer, VkDeviceSize offset, VkDeviceSize range)
253 {
254         VkDescriptorBufferInfo res;
255         res.buffer      = buffer;
256         res.offset      = offset;
257         res.range       = range;
258         return res;
259 }
260
261 inline VkAttachmentDescription makeAttachmentDescription (VkAttachmentDescriptionFlags flags, VkFormat format, VkSampleCountFlagBits samples, VkAttachmentLoadOp loadOp, VkAttachmentStoreOp storeOp, VkAttachmentLoadOp stencilLoadOp, VkAttachmentStoreOp stencilStoreOp, VkImageLayout initialLayout, VkImageLayout finalLayout)
262 {
263         VkAttachmentDescription res;
264         res.flags                       = flags;
265         res.format                      = format;
266         res.samples                     = samples;
267         res.loadOp                      = loadOp;
268         res.storeOp                     = storeOp;
269         res.stencilLoadOp       = stencilLoadOp;
270         res.stencilStoreOp      = stencilStoreOp;
271         res.initialLayout       = initialLayout;
272         res.finalLayout         = finalLayout;
273         return res;
274 }
275
276 inline VkAttachmentReference makeAttachmentReference (deUint32 attachment, VkImageLayout layout)
277 {
278         VkAttachmentReference res;
279         res.attachment  = attachment;
280         res.layout              = layout;
281         return res;
282 }
283
284 inline VkSubpassDescription makeSubpassDescription (VkSubpassDescriptionFlags flags, VkPipelineBindPoint pipelineBindPoint, deUint32 inputAttachmentCount, const VkAttachmentReference* pInputAttachments, deUint32 colorAttachmentCount, const VkAttachmentReference* pColorAttachments, const VkAttachmentReference* pResolveAttachments, const VkAttachmentReference* pDepthStencilAttachment, deUint32 preserveAttachmentCount, const VkAttachmentReference* pPreserveAttachments)
285 {
286         VkSubpassDescription res;
287         res.flags                                       = flags;
288         res.pipelineBindPoint           = pipelineBindPoint;
289         res.inputAttachmentCount        = inputAttachmentCount;
290         res.pInputAttachments           = pInputAttachments;
291         res.colorAttachmentCount        = colorAttachmentCount;
292         res.pColorAttachments           = pColorAttachments;
293         res.pResolveAttachments         = pResolveAttachments;
294         res.pDepthStencilAttachment     = pDepthStencilAttachment;
295         res.preserveAttachmentCount     = preserveAttachmentCount;
296         res.pPreserveAttachments        = pPreserveAttachments;
297         return res;
298 }
299
300 inline VkSubpassDependency makeSubpassDependency (deUint32 srcSubpass, deUint32 dstSubpass, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkDependencyFlags dependencyFlags)
301 {
302         VkSubpassDependency res;
303         res.srcSubpass          = srcSubpass;
304         res.dstSubpass          = dstSubpass;
305         res.srcStageMask        = srcStageMask;
306         res.dstStageMask        = dstStageMask;
307         res.srcAccessMask       = srcAccessMask;
308         res.dstAccessMask       = dstAccessMask;
309         res.dependencyFlags     = dependencyFlags;
310         return res;
311 }
312
313 inline VkBufferCopy makeBufferCopy (VkDeviceSize srcOffset, VkDeviceSize dstOffset, VkDeviceSize size)
314 {
315         VkBufferCopy res;
316         res.srcOffset   = srcOffset;
317         res.dstOffset   = dstOffset;
318         res.size                = size;
319         return res;
320 }
321
322 inline VkImageSubresourceLayers makeImageSubresourceLayers (VkImageAspectFlags aspectMask, deUint32 mipLevel, deUint32 baseArrayLayer, deUint32 layerCount)
323 {
324         VkImageSubresourceLayers res;
325         res.aspectMask          = aspectMask;
326         res.mipLevel            = mipLevel;
327         res.baseArrayLayer      = baseArrayLayer;
328         res.layerCount          = layerCount;
329         return res;
330 }
331
332 inline VkClearDepthStencilValue makeClearDepthStencilValue (float depth, deUint32 stencil)
333 {
334         VkClearDepthStencilValue res;
335         res.depth       = depth;
336         res.stencil     = stencil;
337         return res;
338 }
339
340 inline VkDispatchIndirectCommand makeDispatchIndirectCommand (deUint32 x, deUint32 y, deUint32 z)
341 {
342         VkDispatchIndirectCommand res;
343         res.x   = x;
344         res.y   = y;
345         res.z   = z;
346         return res;
347 }
348
349 inline VkDrawIndexedIndirectCommand makeDrawIndexedIndirectCommand (deUint32 indexCount, deUint32 instanceCount, deUint32 firstIndex, deInt32 vertexOffset, deUint32 firstInstance)
350 {
351         VkDrawIndexedIndirectCommand res;
352         res.indexCount          = indexCount;
353         res.instanceCount       = instanceCount;
354         res.firstIndex          = firstIndex;
355         res.vertexOffset        = vertexOffset;
356         res.firstInstance       = firstInstance;
357         return res;
358 }
359
360 inline VkDrawIndirectCommand makeDrawIndirectCommand (deUint32 vertexCount, deUint32 instanceCount, deUint32 firstVertex, deUint32 firstInstance)
361 {
362         VkDrawIndirectCommand res;
363         res.vertexCount         = vertexCount;
364         res.instanceCount       = instanceCount;
365         res.firstVertex         = firstVertex;
366         res.firstInstance       = firstInstance;
367         return res;
368 }
369
370 inline VkSurfaceFormatKHR makeSurfaceFormatKHR (VkFormat format, VkColorSpaceKHR colorSpace)
371 {
372         VkSurfaceFormatKHR res;
373         res.format              = format;
374         res.colorSpace  = colorSpace;
375         return res;
376 }
377
378 inline VkDisplayPlanePropertiesKHR makeDisplayPlanePropertiesKHR (VkDisplayKHR currentDisplay, deUint32 currentStackIndex)
379 {
380         VkDisplayPlanePropertiesKHR res;
381         res.currentDisplay              = currentDisplay;
382         res.currentStackIndex   = currentStackIndex;
383         return res;
384 }