Merge vulkan-cts-1.0 into vulkan-cts-1.0-dev
[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 (deUint32 width, deUint32 height, deUint32 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 arrayPitch, VkDeviceSize depthPitch)
92 {
93         VkSubresourceLayout res;
94         res.offset              = offset;
95         res.size                = size;
96         res.rowPitch    = rowPitch;
97         res.arrayPitch  = arrayPitch;
98         res.depthPitch  = depthPitch;
99         return res;
100 }
101
102 inline VkComponentMapping makeComponentMapping (VkComponentSwizzle r, VkComponentSwizzle g, VkComponentSwizzle b, VkComponentSwizzle a)
103 {
104         VkComponentMapping res;
105         res.r   = r;
106         res.g   = g;
107         res.b   = b;
108         res.a   = a;
109         return res;
110 }
111
112 inline VkImageSubresourceRange makeImageSubresourceRange (VkImageAspectFlags aspectMask, deUint32 baseMipLevel, deUint32 levelCount, deUint32 baseArrayLayer, deUint32 layerCount)
113 {
114         VkImageSubresourceRange res;
115         res.aspectMask          = aspectMask;
116         res.baseMipLevel        = baseMipLevel;
117         res.levelCount          = levelCount;
118         res.baseArrayLayer      = baseArrayLayer;
119         res.layerCount          = layerCount;
120         return res;
121 }
122
123 inline VkSpecializationMapEntry makeSpecializationMapEntry (deUint32 constantID, deUint32 offset, deUintptr size)
124 {
125         VkSpecializationMapEntry res;
126         res.constantID  = constantID;
127         res.offset              = offset;
128         res.size                = size;
129         return res;
130 }
131
132 inline VkSpecializationInfo makeSpecializationInfo (deUint32 mapEntryCount, const VkSpecializationMapEntry* pMapEntries, deUintptr dataSize, const void* pData)
133 {
134         VkSpecializationInfo res;
135         res.mapEntryCount       = mapEntryCount;
136         res.pMapEntries         = pMapEntries;
137         res.dataSize            = dataSize;
138         res.pData                       = pData;
139         return res;
140 }
141
142 inline VkVertexInputBindingDescription makeVertexInputBindingDescription (deUint32 binding, deUint32 stride, VkVertexInputRate inputRate)
143 {
144         VkVertexInputBindingDescription res;
145         res.binding             = binding;
146         res.stride              = stride;
147         res.inputRate   = inputRate;
148         return res;
149 }
150
151 inline VkVertexInputAttributeDescription makeVertexInputAttributeDescription (deUint32 location, deUint32 binding, VkFormat format, deUint32 offset)
152 {
153         VkVertexInputAttributeDescription res;
154         res.location    = location;
155         res.binding             = binding;
156         res.format              = format;
157         res.offset              = offset;
158         return res;
159 }
160
161 inline VkViewport makeViewport (float x, float y, float width, float height, float minDepth, float maxDepth)
162 {
163         VkViewport res;
164         res.x                   = x;
165         res.y                   = y;
166         res.width               = width;
167         res.height              = height;
168         res.minDepth    = minDepth;
169         res.maxDepth    = maxDepth;
170         return res;
171 }
172
173 inline VkOffset2D makeOffset2D (deInt32 x, deInt32 y)
174 {
175         VkOffset2D res;
176         res.x   = x;
177         res.y   = y;
178         return res;
179 }
180
181 inline VkExtent2D makeExtent2D (deUint32 width, deUint32 height)
182 {
183         VkExtent2D res;
184         res.width       = width;
185         res.height      = height;
186         return res;
187 }
188
189 inline VkStencilOpState makeStencilOpState (VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp, deUint32 compareMask, deUint32 writeMask, deUint32 reference)
190 {
191         VkStencilOpState res;
192         res.failOp              = failOp;
193         res.passOp              = passOp;
194         res.depthFailOp = depthFailOp;
195         res.compareOp   = compareOp;
196         res.compareMask = compareMask;
197         res.writeMask   = writeMask;
198         res.reference   = reference;
199         return res;
200 }
201
202 inline VkPipelineColorBlendAttachmentState makePipelineColorBlendAttachmentState (VkBool32 blendEnable, VkBlendFactor srcColorBlendFactor, VkBlendFactor dstColorBlendFactor, VkBlendOp colorBlendOp, VkBlendFactor srcAlphaBlendFactor, VkBlendFactor dstAlphaBlendFactor, VkBlendOp alphaBlendOp, VkColorComponentFlags colorWriteMask)
203 {
204         VkPipelineColorBlendAttachmentState res;
205         res.blendEnable                 = blendEnable;
206         res.srcColorBlendFactor = srcColorBlendFactor;
207         res.dstColorBlendFactor = dstColorBlendFactor;
208         res.colorBlendOp                = colorBlendOp;
209         res.srcAlphaBlendFactor = srcAlphaBlendFactor;
210         res.dstAlphaBlendFactor = dstAlphaBlendFactor;
211         res.alphaBlendOp                = alphaBlendOp;
212         res.colorWriteMask              = colorWriteMask;
213         return res;
214 }
215
216 inline VkPushConstantRange makePushConstantRange (VkShaderStageFlags stageFlags, deUint32 offset, deUint32 size)
217 {
218         VkPushConstantRange res;
219         res.stageFlags  = stageFlags;
220         res.offset              = offset;
221         res.size                = size;
222         return res;
223 }
224
225 inline VkDescriptorSetLayoutBinding makeDescriptorSetLayoutBinding (deUint32 binding, VkDescriptorType descriptorType, deUint32 descriptorCount, VkShaderStageFlags stageFlags, const VkSampler* pImmutableSamplers)
226 {
227         VkDescriptorSetLayoutBinding res;
228         res.binding                             = binding;
229         res.descriptorType              = descriptorType;
230         res.descriptorCount             = descriptorCount;
231         res.stageFlags                  = stageFlags;
232         res.pImmutableSamplers  = pImmutableSamplers;
233         return res;
234 }
235
236 inline VkDescriptorPoolSize makeDescriptorPoolSize (VkDescriptorType type, deUint32 descriptorCount)
237 {
238         VkDescriptorPoolSize res;
239         res.type                        = type;
240         res.descriptorCount     = descriptorCount;
241         return res;
242 }
243
244 inline VkDescriptorImageInfo makeDescriptorImageInfo (VkSampler sampler, VkImageView imageView, VkImageLayout imageLayout)
245 {
246         VkDescriptorImageInfo res;
247         res.sampler             = sampler;
248         res.imageView   = imageView;
249         res.imageLayout = imageLayout;
250         return res;
251 }
252
253 inline VkDescriptorBufferInfo makeDescriptorBufferInfo (VkBuffer buffer, VkDeviceSize offset, VkDeviceSize range)
254 {
255         VkDescriptorBufferInfo res;
256         res.buffer      = buffer;
257         res.offset      = offset;
258         res.range       = range;
259         return res;
260 }
261
262 inline VkAttachmentDescription makeAttachmentDescription (VkAttachmentDescriptionFlags flags, VkFormat format, VkSampleCountFlagBits samples, VkAttachmentLoadOp loadOp, VkAttachmentStoreOp storeOp, VkAttachmentLoadOp stencilLoadOp, VkAttachmentStoreOp stencilStoreOp, VkImageLayout initialLayout, VkImageLayout finalLayout)
263 {
264         VkAttachmentDescription res;
265         res.flags                       = flags;
266         res.format                      = format;
267         res.samples                     = samples;
268         res.loadOp                      = loadOp;
269         res.storeOp                     = storeOp;
270         res.stencilLoadOp       = stencilLoadOp;
271         res.stencilStoreOp      = stencilStoreOp;
272         res.initialLayout       = initialLayout;
273         res.finalLayout         = finalLayout;
274         return res;
275 }
276
277 inline VkAttachmentReference makeAttachmentReference (deUint32 attachment, VkImageLayout layout)
278 {
279         VkAttachmentReference res;
280         res.attachment  = attachment;
281         res.layout              = layout;
282         return res;
283 }
284
285 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 deUint32* pPreserveAttachments)
286 {
287         VkSubpassDescription res;
288         res.flags                                       = flags;
289         res.pipelineBindPoint           = pipelineBindPoint;
290         res.inputAttachmentCount        = inputAttachmentCount;
291         res.pInputAttachments           = pInputAttachments;
292         res.colorAttachmentCount        = colorAttachmentCount;
293         res.pColorAttachments           = pColorAttachments;
294         res.pResolveAttachments         = pResolveAttachments;
295         res.pDepthStencilAttachment     = pDepthStencilAttachment;
296         res.preserveAttachmentCount     = preserveAttachmentCount;
297         res.pPreserveAttachments        = pPreserveAttachments;
298         return res;
299 }
300
301 inline VkSubpassDependency makeSubpassDependency (deUint32 srcSubpass, deUint32 dstSubpass, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkDependencyFlags dependencyFlags)
302 {
303         VkSubpassDependency res;
304         res.srcSubpass          = srcSubpass;
305         res.dstSubpass          = dstSubpass;
306         res.srcStageMask        = srcStageMask;
307         res.dstStageMask        = dstStageMask;
308         res.srcAccessMask       = srcAccessMask;
309         res.dstAccessMask       = dstAccessMask;
310         res.dependencyFlags     = dependencyFlags;
311         return res;
312 }
313
314 inline VkBufferCopy makeBufferCopy (VkDeviceSize srcOffset, VkDeviceSize dstOffset, VkDeviceSize size)
315 {
316         VkBufferCopy res;
317         res.srcOffset   = srcOffset;
318         res.dstOffset   = dstOffset;
319         res.size                = size;
320         return res;
321 }
322
323 inline VkImageSubresourceLayers makeImageSubresourceLayers (VkImageAspectFlags aspectMask, deUint32 mipLevel, deUint32 baseArrayLayer, deUint32 layerCount)
324 {
325         VkImageSubresourceLayers res;
326         res.aspectMask          = aspectMask;
327         res.mipLevel            = mipLevel;
328         res.baseArrayLayer      = baseArrayLayer;
329         res.layerCount          = layerCount;
330         return res;
331 }
332
333 inline VkClearDepthStencilValue makeClearDepthStencilValue (float depth, deUint32 stencil)
334 {
335         VkClearDepthStencilValue res;
336         res.depth       = depth;
337         res.stencil     = stencil;
338         return res;
339 }
340
341 inline VkDispatchIndirectCommand makeDispatchIndirectCommand (deUint32 x, deUint32 y, deUint32 z)
342 {
343         VkDispatchIndirectCommand res;
344         res.x   = x;
345         res.y   = y;
346         res.z   = z;
347         return res;
348 }
349
350 inline VkDrawIndexedIndirectCommand makeDrawIndexedIndirectCommand (deUint32 indexCount, deUint32 instanceCount, deUint32 firstIndex, deInt32 vertexOffset, deUint32 firstInstance)
351 {
352         VkDrawIndexedIndirectCommand res;
353         res.indexCount          = indexCount;
354         res.instanceCount       = instanceCount;
355         res.firstIndex          = firstIndex;
356         res.vertexOffset        = vertexOffset;
357         res.firstInstance       = firstInstance;
358         return res;
359 }
360
361 inline VkDrawIndirectCommand makeDrawIndirectCommand (deUint32 vertexCount, deUint32 instanceCount, deUint32 firstVertex, deUint32 firstInstance)
362 {
363         VkDrawIndirectCommand res;
364         res.vertexCount         = vertexCount;
365         res.instanceCount       = instanceCount;
366         res.firstVertex         = firstVertex;
367         res.firstInstance       = firstInstance;
368         return res;
369 }
370
371 inline VkSurfaceFormatKHR makeSurfaceFormatKHR (VkFormat format, VkColorSpaceKHR colorSpace)
372 {
373         VkSurfaceFormatKHR res;
374         res.format              = format;
375         res.colorSpace  = colorSpace;
376         return res;
377 }
378
379 inline VkDisplayPlanePropertiesKHR makeDisplayPlanePropertiesKHR (VkDisplayKHR currentDisplay, deUint32 currentStackIndex)
380 {
381         VkDisplayPlanePropertiesKHR res;
382         res.currentDisplay              = currentDisplay;
383         res.currentStackIndex   = currentStackIndex;
384         return res;
385 }