blob: 9ea1ee45735d22027a2d62f4b0c7bb0efc2c0024 [file] [log] [blame]
Jesse Halld27f6aa2015-08-15 17:58:48 -07001// Copyright (c) 2015 The Khronos Group Inc.
2//
3// Permission is hereby granted, free of charge, to any person obtaining a
4// copy of this software and/or associated documentation files (the
5// "Materials"), to deal in the Materials without restriction, including
6// without limitation the rights to use, copy, modify, merge, publish,
7// distribute, sublicense, and/or sell copies of the Materials, and to
8// permit persons to whom the Materials are furnished to do so, subject to
9// the following conditions:
10//
11// The above copyright notice and this permission notice shall be included
12// in all copies or substantial portions of the Materials.
13//
14// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
21
22import platform "platform.api"
23
24///////////////
25// Constants //
26///////////////
27
28// API version (major.minor.patch)
29define VERSION_MAJOR 0
Jesse Hall5ae3abb2015-10-08 14:00:22 -070030define VERSION_MINOR 170
Jesse Hallf09c6b12015-08-15 19:54:28 -070031define VERSION_PATCH 2
Jesse Halld27f6aa2015-08-15 17:58:48 -070032
33// API limits
34define VK_MAX_PHYSICAL_DEVICE_NAME 256
35define VK_UUID_LENGTH 16
36define VK_MAX_EXTENSION_NAME 256
37define VK_MAX_DESCRIPTION 256
38define VK_MAX_MEMORY_TYPES 32
39define VK_MAX_MEMORY_HEAPS 16 /// The maximum number of unique memory heaps, each of which supporting 1 or more memory types.
40
41// API keywords
42define VK_TRUE 1
43define VK_FALSE 0
Jesse Hall5ae3abb2015-10-08 14:00:22 -070044
45// API keyword, but needs special handling by some templates
46define NULL_HANDLE 0
Jesse Halld27f6aa2015-08-15 17:58:48 -070047
48
49/////////////
50// Types //
51/////////////
52
Jesse Hall5ae3abb2015-10-08 14:00:22 -070053type u32 VkBool32
54type u32 VkFlags
55type u64 VkDeviceSize
56type u32 VkSampleMask
57
Jesse Halld27f6aa2015-08-15 17:58:48 -070058/// Dispatchable handle types.
59@dispatchHandle type u64 VkInstance
60@dispatchHandle type u64 VkPhysicalDevice
61@dispatchHandle type u64 VkDevice
62@dispatchHandle type u64 VkQueue
63@dispatchHandle type u64 VkCmdBuffer
64
65/// Non dispatchable handle types.
66@nonDispatchHandle type u64 VkDeviceMemory
67@nonDispatchHandle type u64 VkCmdPool
68@nonDispatchHandle type u64 VkBuffer
69@nonDispatchHandle type u64 VkBufferView
70@nonDispatchHandle type u64 VkImage
71@nonDispatchHandle type u64 VkImageView
Jesse Halld27f6aa2015-08-15 17:58:48 -070072@nonDispatchHandle type u64 VkShaderModule
73@nonDispatchHandle type u64 VkShader
74@nonDispatchHandle type u64 VkPipeline
75@nonDispatchHandle type u64 VkPipelineLayout
76@nonDispatchHandle type u64 VkSampler
77@nonDispatchHandle type u64 VkDescriptorSet
78@nonDispatchHandle type u64 VkDescriptorSetLayout
79@nonDispatchHandle type u64 VkDescriptorPool
Jesse Halld27f6aa2015-08-15 17:58:48 -070080@nonDispatchHandle type u64 VkFence
81@nonDispatchHandle type u64 VkSemaphore
82@nonDispatchHandle type u64 VkEvent
83@nonDispatchHandle type u64 VkQueryPool
84@nonDispatchHandle type u64 VkFramebuffer
85@nonDispatchHandle type u64 VkRenderPass
86@nonDispatchHandle type u64 VkPipelineCache
87
88
89/////////////
90// Enums //
91/////////////
92
93enum VkImageLayout {
94 VK_IMAGE_LAYOUT_UNDEFINED = 0x00000000, /// Implicit layout an image is when its contents are undefined due to various reasons (e.g. right after creation)
95 VK_IMAGE_LAYOUT_GENERAL = 0x00000001, /// General layout when image can be used for any kind of access
96 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 0x00000002, /// Optimal layout when image is only used for color attachment read/write
97 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 0x00000003, /// Optimal layout when image is only used for depth/stencil attachment read/write
98 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 0x00000004, /// Optimal layout when image is used for read only depth/stencil attachment and shader access
99 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 0x00000005, /// Optimal layout when image is used for read only shader access
100 VK_IMAGE_LAYOUT_TRANSFER_SOURCE_OPTIMAL = 0x00000006, /// Optimal layout when image is used only as source of transfer operations
101 VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL = 0x00000007, /// Optimal layout when image is used only as destination of transfer operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700102 VK_IMAGE_LAYOUT_PREINITIALIZED = 0x00000008, /// Initial layout used when the data is populated by the CPU
Jesse Halld27f6aa2015-08-15 17:58:48 -0700103}
104
105enum VkAttachmentLoadOp {
106 VK_ATTACHMENT_LOAD_OP_LOAD = 0x00000000,
107 VK_ATTACHMENT_LOAD_OP_CLEAR = 0x00000001,
108 VK_ATTACHMENT_LOAD_OP_DONT_CARE = 0x00000002,
109}
110
111enum VkAttachmentStoreOp {
112 VK_ATTACHMENT_STORE_OP_STORE = 0x00000000,
113 VK_ATTACHMENT_STORE_OP_DONT_CARE = 0x00000001,
114}
115
116enum VkImageType {
117 VK_IMAGE_TYPE_1D = 0x00000000,
118 VK_IMAGE_TYPE_2D = 0x00000001,
119 VK_IMAGE_TYPE_3D = 0x00000002,
120}
121
122enum VkImageTiling {
123 VK_IMAGE_TILING_LINEAR = 0x00000000,
124 VK_IMAGE_TILING_OPTIMAL = 0x00000001,
125}
126
127enum VkImageViewType {
128 VK_IMAGE_VIEW_TYPE_1D = 0x00000000,
129 VK_IMAGE_VIEW_TYPE_2D = 0x00000001,
130 VK_IMAGE_VIEW_TYPE_3D = 0x00000002,
131 VK_IMAGE_VIEW_TYPE_CUBE = 0x00000003,
132 VK_IMAGE_VIEW_TYPE_1D_ARRAY = 0x00000004,
133 VK_IMAGE_VIEW_TYPE_2D_ARRAY = 0x00000005,
134 VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 0x00000006,
135}
136
137enum VkImageAspect {
138 VK_IMAGE_ASPECT_COLOR = 0x00000000,
139 VK_IMAGE_ASPECT_DEPTH = 0x00000001,
140 VK_IMAGE_ASPECT_STENCIL = 0x00000002,
141 VK_IMAGE_ASPECT_METADATA = 0x00000003,
142}
143
Jesse Halld27f6aa2015-08-15 17:58:48 -0700144enum VkCmdBufferLevel {
145 VK_CMD_BUFFER_LEVEL_PRIMARY = 0x00000000,
146 VK_CMD_BUFFER_LEVEL_SECONDARY = 0x00000001,
147}
148
149enum VkChannelSwizzle {
150 VK_CHANNEL_SWIZZLE_ZERO = 0x00000000,
151 VK_CHANNEL_SWIZZLE_ONE = 0x00000001,
152 VK_CHANNEL_SWIZZLE_R = 0x00000002,
153 VK_CHANNEL_SWIZZLE_G = 0x00000003,
154 VK_CHANNEL_SWIZZLE_B = 0x00000004,
155 VK_CHANNEL_SWIZZLE_A = 0x00000005,
156}
157
158enum VkDescriptorType {
159 VK_DESCRIPTOR_TYPE_SAMPLER = 0x00000000,
160 VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 0x00000001,
161 VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 0x00000002,
162 VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 0x00000003,
163 VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 0x00000004,
164 VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 0x00000005,
165 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 0x00000006,
166 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 0x00000007,
167 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 0x00000008,
168 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 0x00000009,
169 VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 0x0000000a,
170}
171
172enum VkDescriptorPoolUsage {
173 VK_DESCRIPTOR_POOL_USAGE_ONE_SHOT = 0x00000000,
174 VK_DESCRIPTOR_POOL_USAGE_DYNAMIC = 0x00000001,
175}
176
177enum VkDescriptorSetUsage {
178 VK_DESCRIPTOR_SET_USAGE_ONE_SHOT = 0x00000000,
179 VK_DESCRIPTOR_SET_USAGE_STATIC = 0x00000001,
180}
181
182enum VkQueryType {
183 VK_QUERY_TYPE_OCCLUSION = 0x00000000,
184 VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, /// Optional
185}
186
187enum VkTimestampType {
188 VK_TIMESTAMP_TYPE_TOP = 0x00000000,
189 VK_TIMESTAMP_TYPE_BOTTOM = 0x00000001,
190}
191
192enum VkBorderColor {
193 VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0x00000000,
194 VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 0x00000001,
195 VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 0x00000002,
196 VK_BORDER_COLOR_INT_OPAQUE_BLACK = 0x00000003,
197 VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 0x00000004,
198 VK_BORDER_COLOR_INT_OPAQUE_WHITE = 0x00000005,
199}
200
201enum VkPipelineBindPoint {
202 VK_PIPELINE_BIND_POINT_COMPUTE = 0x00000000,
203 VK_PIPELINE_BIND_POINT_GRAPHICS = 0x00000001,
204}
205
206enum VkPrimitiveTopology {
207 VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0x00000000,
208 VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 0x00000001,
209 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 0x00000002,
210 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 0x00000003,
211 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 0x00000004,
212 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 0x00000005,
213 VK_PRIMITIVE_TOPOLOGY_LINE_LIST_ADJ = 0x00000006,
214 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_ADJ = 0x00000007,
215 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ = 0x00000008,
216 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJ = 0x00000009,
217 VK_PRIMITIVE_TOPOLOGY_PATCH = 0x0000000a,
218}
219
220enum VkSharingMode {
221 VK_SHARING_MODE_EXCLUSIVE = 0x00000000,
222 VK_SHARING_MODE_CONCURRENT = 0x00000001,
223}
224
225enum VkIndexType {
226 VK_INDEX_TYPE_UINT16 = 0x00000000,
227 VK_INDEX_TYPE_UINT32 = 0x00000001,
228}
229
230enum VkTexFilter {
231 VK_TEX_FILTER_NEAREST = 0x00000000,
232 VK_TEX_FILTER_LINEAR = 0x00000001,
233}
234
235enum VkTexMipmapMode {
236 VK_TEX_MIPMAP_MODE_BASE = 0x00000000, /// Always choose base level
237 VK_TEX_MIPMAP_MODE_NEAREST = 0x00000001, /// Choose nearest mip level
238 VK_TEX_MIPMAP_MODE_LINEAR = 0x00000002, /// Linear filter between mip levels
239}
240
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700241enum VkTexAddressMode {
242 VK_TEX_ADDRESS_MODE_WRAP = 0x00000000,
243 VK_TEX_ADDRESS_MODE_MIRROR = 0x00000001,
244 VK_TEX_ADDRESS_MODE_CLAMP = 0x00000002,
245 VK_TEX_ADDRESS_MODE_MIRROR_ONCE = 0x00000003,
246 VK_TEX_ADDRESS_MODE_CLAMP_BORDER = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700247}
248
249enum VkCompareOp {
250 VK_COMPARE_OP_NEVER = 0x00000000,
251 VK_COMPARE_OP_LESS = 0x00000001,
252 VK_COMPARE_OP_EQUAL = 0x00000002,
253 VK_COMPARE_OP_LESS_EQUAL = 0x00000003,
254 VK_COMPARE_OP_GREATER = 0x00000004,
255 VK_COMPARE_OP_NOT_EQUAL = 0x00000005,
256 VK_COMPARE_OP_GREATER_EQUAL = 0x00000006,
257 VK_COMPARE_OP_ALWAYS = 0x00000007,
258}
259
260enum VkFillMode {
261 VK_FILL_MODE_POINTS = 0x00000000,
262 VK_FILL_MODE_WIREFRAME = 0x00000001,
263 VK_FILL_MODE_SOLID = 0x00000002,
264}
265
266enum VkCullMode {
267 VK_CULL_MODE_NONE = 0x00000000,
268 VK_CULL_MODE_FRONT = 0x00000001,
269 VK_CULL_MODE_BACK = 0x00000002,
270 VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
271}
272
273enum VkFrontFace {
274 VK_FRONT_FACE_CCW = 0x00000000,
275 VK_FRONT_FACE_CW = 0x00000001,
276}
277
278enum VkBlend {
279 VK_BLEND_ZERO = 0x00000000,
280 VK_BLEND_ONE = 0x00000001,
281 VK_BLEND_SRC_COLOR = 0x00000002,
282 VK_BLEND_ONE_MINUS_SRC_COLOR = 0x00000003,
283 VK_BLEND_DEST_COLOR = 0x00000004,
284 VK_BLEND_ONE_MINUS_DEST_COLOR = 0x00000005,
285 VK_BLEND_SRC_ALPHA = 0x00000006,
286 VK_BLEND_ONE_MINUS_SRC_ALPHA = 0x00000007,
287 VK_BLEND_DEST_ALPHA = 0x00000008,
288 VK_BLEND_ONE_MINUS_DEST_ALPHA = 0x00000009,
289 VK_BLEND_CONSTANT_COLOR = 0x0000000a,
290 VK_BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0000000b,
291 VK_BLEND_CONSTANT_ALPHA = 0x0000000c,
292 VK_BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x0000000d,
293 VK_BLEND_SRC_ALPHA_SATURATE = 0x0000000e,
294 VK_BLEND_SRC1_COLOR = 0x0000000f,
295 VK_BLEND_ONE_MINUS_SRC1_COLOR = 0x00000010,
296 VK_BLEND_SRC1_ALPHA = 0x00000011,
297 VK_BLEND_ONE_MINUS_SRC1_ALPHA = 0x00000012,
298}
299
300enum VkBlendOp {
301 VK_BLEND_OP_ADD = 0x00000000,
302 VK_BLEND_OP_SUBTRACT = 0x00000001,
303 VK_BLEND_OP_REVERSE_SUBTRACT = 0x00000002,
304 VK_BLEND_OP_MIN = 0x00000003,
305 VK_BLEND_OP_MAX = 0x00000004,
306}
307
308enum VkStencilOp {
309 VK_STENCIL_OP_KEEP = 0x00000000,
310 VK_STENCIL_OP_ZERO = 0x00000001,
311 VK_STENCIL_OP_REPLACE = 0x00000002,
312 VK_STENCIL_OP_INC_CLAMP = 0x00000003,
313 VK_STENCIL_OP_DEC_CLAMP = 0x00000004,
314 VK_STENCIL_OP_INVERT = 0x00000005,
315 VK_STENCIL_OP_INC_WRAP = 0x00000006,
316 VK_STENCIL_OP_DEC_WRAP = 0x00000007,
317}
318
319enum VkLogicOp {
320 VK_LOGIC_OP_CLEAR = 0x00000000,
321 VK_LOGIC_OP_AND = 0x00000001,
322 VK_LOGIC_OP_AND_REVERSE = 0x00000002,
323 VK_LOGIC_OP_COPY = 0x00000003,
324 VK_LOGIC_OP_AND_INVERTED = 0x00000004,
325 VK_LOGIC_OP_NOOP = 0x00000005,
326 VK_LOGIC_OP_XOR = 0x00000006,
327 VK_LOGIC_OP_OR = 0x00000007,
328 VK_LOGIC_OP_NOR = 0x00000008,
329 VK_LOGIC_OP_EQUIV = 0x00000009,
330 VK_LOGIC_OP_INVERT = 0x0000000a,
331 VK_LOGIC_OP_OR_REVERSE = 0x0000000b,
332 VK_LOGIC_OP_COPY_INVERTED = 0x0000000c,
333 VK_LOGIC_OP_OR_INVERTED = 0x0000000d,
334 VK_LOGIC_OP_NAND = 0x0000000e,
335 VK_LOGIC_OP_SET = 0x0000000f,
336}
337
338enum VkSystemAllocType {
339 VK_SYSTEM_ALLOC_TYPE_API_OBJECT = 0x00000000,
340 VK_SYSTEM_ALLOC_TYPE_INTERNAL = 0x00000001,
341 VK_SYSTEM_ALLOC_TYPE_INTERNAL_TEMP = 0x00000002,
342 VK_SYSTEM_ALLOC_TYPE_INTERNAL_SHADER = 0x00000003,
343 VK_SYSTEM_ALLOC_TYPE_DEBUG = 0x00000004,
344}
345
346enum VkPhysicalDeviceType {
347 VK_PHYSICAL_DEVICE_TYPE_OTHER = 0x00000000,
348 VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 0x00000001,
349 VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 0x00000002,
350 VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 0x00000003,
351 VK_PHYSICAL_DEVICE_TYPE_CPU = 0x00000004,
352}
353
354enum VkVertexInputStepRate {
355 VK_VERTEX_INPUT_STEP_RATE_VERTEX = 0x00000000,
356 VK_VERTEX_INPUT_STEP_RATE_INSTANCE = 0x00000001,
357}
358
359/// Vulkan format definitions
360enum VkFormat {
361 VK_FORMAT_UNDEFINED = 0x00000000,
362 VK_FORMAT_R4G4_UNORM = 0x00000001,
363 VK_FORMAT_R4G4_USCALED = 0x00000002,
364 VK_FORMAT_R4G4B4A4_UNORM = 0x00000003,
365 VK_FORMAT_R4G4B4A4_USCALED = 0x00000004,
366 VK_FORMAT_R5G6B5_UNORM = 0x00000005,
367 VK_FORMAT_R5G6B5_USCALED = 0x00000006,
368 VK_FORMAT_R5G5B5A1_UNORM = 0x00000007,
369 VK_FORMAT_R5G5B5A1_USCALED = 0x00000008,
370 VK_FORMAT_R8_UNORM = 0x00000009,
371 VK_FORMAT_R8_SNORM = 0x0000000A,
372 VK_FORMAT_R8_USCALED = 0x0000000B,
373 VK_FORMAT_R8_SSCALED = 0x0000000C,
374 VK_FORMAT_R8_UINT = 0x0000000D,
375 VK_FORMAT_R8_SINT = 0x0000000E,
376 VK_FORMAT_R8_SRGB = 0x0000000F,
377 VK_FORMAT_R8G8_UNORM = 0x00000010,
378 VK_FORMAT_R8G8_SNORM = 0x00000011,
379 VK_FORMAT_R8G8_USCALED = 0x00000012,
380 VK_FORMAT_R8G8_SSCALED = 0x00000013,
381 VK_FORMAT_R8G8_UINT = 0x00000014,
382 VK_FORMAT_R8G8_SINT = 0x00000015,
383 VK_FORMAT_R8G8_SRGB = 0x00000016,
384 VK_FORMAT_R8G8B8_UNORM = 0x00000017,
385 VK_FORMAT_R8G8B8_SNORM = 0x00000018,
386 VK_FORMAT_R8G8B8_USCALED = 0x00000019,
387 VK_FORMAT_R8G8B8_SSCALED = 0x0000001A,
388 VK_FORMAT_R8G8B8_UINT = 0x0000001B,
389 VK_FORMAT_R8G8B8_SINT = 0x0000001C,
390 VK_FORMAT_R8G8B8_SRGB = 0x0000001D,
391 VK_FORMAT_R8G8B8A8_UNORM = 0x0000001E,
392 VK_FORMAT_R8G8B8A8_SNORM = 0x0000001F,
393 VK_FORMAT_R8G8B8A8_USCALED = 0x00000020,
394 VK_FORMAT_R8G8B8A8_SSCALED = 0x00000021,
395 VK_FORMAT_R8G8B8A8_UINT = 0x00000022,
396 VK_FORMAT_R8G8B8A8_SINT = 0x00000023,
397 VK_FORMAT_R8G8B8A8_SRGB = 0x00000024,
398 VK_FORMAT_R10G10B10A2_UNORM = 0x00000025,
399 VK_FORMAT_R10G10B10A2_SNORM = 0x00000026,
400 VK_FORMAT_R10G10B10A2_USCALED = 0x00000027,
401 VK_FORMAT_R10G10B10A2_SSCALED = 0x00000028,
402 VK_FORMAT_R10G10B10A2_UINT = 0x00000029,
403 VK_FORMAT_R10G10B10A2_SINT = 0x0000002A,
404 VK_FORMAT_R16_UNORM = 0x0000002B,
405 VK_FORMAT_R16_SNORM = 0x0000002C,
406 VK_FORMAT_R16_USCALED = 0x0000002D,
407 VK_FORMAT_R16_SSCALED = 0x0000002E,
408 VK_FORMAT_R16_UINT = 0x0000002F,
409 VK_FORMAT_R16_SINT = 0x00000030,
410 VK_FORMAT_R16_SFLOAT = 0x00000031,
411 VK_FORMAT_R16G16_UNORM = 0x00000032,
412 VK_FORMAT_R16G16_SNORM = 0x00000033,
413 VK_FORMAT_R16G16_USCALED = 0x00000034,
414 VK_FORMAT_R16G16_SSCALED = 0x00000035,
415 VK_FORMAT_R16G16_UINT = 0x00000036,
416 VK_FORMAT_R16G16_SINT = 0x00000037,
417 VK_FORMAT_R16G16_SFLOAT = 0x00000038,
418 VK_FORMAT_R16G16B16_UNORM = 0x00000039,
419 VK_FORMAT_R16G16B16_SNORM = 0x0000003A,
420 VK_FORMAT_R16G16B16_USCALED = 0x0000003B,
421 VK_FORMAT_R16G16B16_SSCALED = 0x0000003C,
422 VK_FORMAT_R16G16B16_UINT = 0x0000003D,
423 VK_FORMAT_R16G16B16_SINT = 0x0000003E,
424 VK_FORMAT_R16G16B16_SFLOAT = 0x0000003F,
425 VK_FORMAT_R16G16B16A16_UNORM = 0x00000040,
426 VK_FORMAT_R16G16B16A16_SNORM = 0x00000041,
427 VK_FORMAT_R16G16B16A16_USCALED = 0x00000042,
428 VK_FORMAT_R16G16B16A16_SSCALED = 0x00000043,
429 VK_FORMAT_R16G16B16A16_UINT = 0x00000044,
430 VK_FORMAT_R16G16B16A16_SINT = 0x00000045,
431 VK_FORMAT_R16G16B16A16_SFLOAT = 0x00000046,
432 VK_FORMAT_R32_UINT = 0x00000047,
433 VK_FORMAT_R32_SINT = 0x00000048,
434 VK_FORMAT_R32_SFLOAT = 0x00000049,
435 VK_FORMAT_R32G32_UINT = 0x0000004A,
436 VK_FORMAT_R32G32_SINT = 0x0000004B,
437 VK_FORMAT_R32G32_SFLOAT = 0x0000004C,
438 VK_FORMAT_R32G32B32_UINT = 0x0000004D,
439 VK_FORMAT_R32G32B32_SINT = 0x0000004E,
440 VK_FORMAT_R32G32B32_SFLOAT = 0x0000004F,
441 VK_FORMAT_R32G32B32A32_UINT = 0x00000050,
442 VK_FORMAT_R32G32B32A32_SINT = 0x00000051,
443 VK_FORMAT_R32G32B32A32_SFLOAT = 0x00000052,
444 VK_FORMAT_R64_SFLOAT = 0x00000053,
445 VK_FORMAT_R64G64_SFLOAT = 0x00000054,
446 VK_FORMAT_R64G64B64_SFLOAT = 0x00000055,
447 VK_FORMAT_R64G64B64A64_SFLOAT = 0x00000056,
448 VK_FORMAT_R11G11B10_UFLOAT = 0x00000057,
449 VK_FORMAT_R9G9B9E5_UFLOAT = 0x00000058,
450 VK_FORMAT_D16_UNORM = 0x00000059,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700451 VK_FORMAT_D24_UNORM_X8 = 0x0000005A,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700452 VK_FORMAT_D32_SFLOAT = 0x0000005B,
453 VK_FORMAT_S8_UINT = 0x0000005C,
454 VK_FORMAT_D16_UNORM_S8_UINT = 0x0000005D,
455 VK_FORMAT_D24_UNORM_S8_UINT = 0x0000005E,
456 VK_FORMAT_D32_SFLOAT_S8_UINT = 0x0000005F,
457 VK_FORMAT_BC1_RGB_UNORM = 0x00000060,
458 VK_FORMAT_BC1_RGB_SRGB = 0x00000061,
459 VK_FORMAT_BC1_RGBA_UNORM = 0x00000062,
460 VK_FORMAT_BC1_RGBA_SRGB = 0x00000063,
461 VK_FORMAT_BC2_UNORM = 0x00000064,
462 VK_FORMAT_BC2_SRGB = 0x00000065,
463 VK_FORMAT_BC3_UNORM = 0x00000066,
464 VK_FORMAT_BC3_SRGB = 0x00000067,
465 VK_FORMAT_BC4_UNORM = 0x00000068,
466 VK_FORMAT_BC4_SNORM = 0x00000069,
467 VK_FORMAT_BC5_UNORM = 0x0000006A,
468 VK_FORMAT_BC5_SNORM = 0x0000006B,
469 VK_FORMAT_BC6H_UFLOAT = 0x0000006C,
470 VK_FORMAT_BC6H_SFLOAT = 0x0000006D,
471 VK_FORMAT_BC7_UNORM = 0x0000006E,
472 VK_FORMAT_BC7_SRGB = 0x0000006F,
473 VK_FORMAT_ETC2_R8G8B8_UNORM = 0x00000070,
474 VK_FORMAT_ETC2_R8G8B8_SRGB = 0x00000071,
475 VK_FORMAT_ETC2_R8G8B8A1_UNORM = 0x00000072,
476 VK_FORMAT_ETC2_R8G8B8A1_SRGB = 0x00000073,
477 VK_FORMAT_ETC2_R8G8B8A8_UNORM = 0x00000074,
478 VK_FORMAT_ETC2_R8G8B8A8_SRGB = 0x00000075,
479 VK_FORMAT_EAC_R11_UNORM = 0x00000076,
480 VK_FORMAT_EAC_R11_SNORM = 0x00000077,
481 VK_FORMAT_EAC_R11G11_UNORM = 0x00000078,
482 VK_FORMAT_EAC_R11G11_SNORM = 0x00000079,
483 VK_FORMAT_ASTC_4x4_UNORM = 0x0000007A,
484 VK_FORMAT_ASTC_4x4_SRGB = 0x0000007B,
485 VK_FORMAT_ASTC_5x4_UNORM = 0x0000007C,
486 VK_FORMAT_ASTC_5x4_SRGB = 0x0000007D,
487 VK_FORMAT_ASTC_5x5_UNORM = 0x0000007E,
488 VK_FORMAT_ASTC_5x5_SRGB = 0x0000007F,
489 VK_FORMAT_ASTC_6x5_UNORM = 0x00000080,
490 VK_FORMAT_ASTC_6x5_SRGB = 0x00000081,
491 VK_FORMAT_ASTC_6x6_UNORM = 0x00000082,
492 VK_FORMAT_ASTC_6x6_SRGB = 0x00000083,
493 VK_FORMAT_ASTC_8x5_UNORM = 0x00000084,
494 VK_FORMAT_ASTC_8x5_SRGB = 0x00000085,
495 VK_FORMAT_ASTC_8x6_UNORM = 0x00000086,
496 VK_FORMAT_ASTC_8x6_SRGB = 0x00000087,
497 VK_FORMAT_ASTC_8x8_UNORM = 0x00000088,
498 VK_FORMAT_ASTC_8x8_SRGB = 0x00000089,
499 VK_FORMAT_ASTC_10x5_UNORM = 0x0000008A,
500 VK_FORMAT_ASTC_10x5_SRGB = 0x0000008B,
501 VK_FORMAT_ASTC_10x6_UNORM = 0x0000008C,
502 VK_FORMAT_ASTC_10x6_SRGB = 0x0000008D,
503 VK_FORMAT_ASTC_10x8_UNORM = 0x0000008E,
504 VK_FORMAT_ASTC_10x8_SRGB = 0x0000008F,
505 VK_FORMAT_ASTC_10x10_UNORM = 0x00000090,
506 VK_FORMAT_ASTC_10x10_SRGB = 0x00000091,
507 VK_FORMAT_ASTC_12x10_UNORM = 0x00000092,
508 VK_FORMAT_ASTC_12x10_SRGB = 0x00000093,
509 VK_FORMAT_ASTC_12x12_UNORM = 0x00000094,
510 VK_FORMAT_ASTC_12x12_SRGB = 0x00000095,
511 VK_FORMAT_B4G4R4A4_UNORM = 0x00000096,
512 VK_FORMAT_B5G5R5A1_UNORM = 0x00000097,
513 VK_FORMAT_B5G6R5_UNORM = 0x00000098,
514 VK_FORMAT_B5G6R5_USCALED = 0x00000099,
515 VK_FORMAT_B8G8R8_UNORM = 0x0000009A,
516 VK_FORMAT_B8G8R8_SNORM = 0x0000009B,
517 VK_FORMAT_B8G8R8_USCALED = 0x0000009C,
518 VK_FORMAT_B8G8R8_SSCALED = 0x0000009D,
519 VK_FORMAT_B8G8R8_UINT = 0x0000009E,
520 VK_FORMAT_B8G8R8_SINT = 0x0000009F,
521 VK_FORMAT_B8G8R8_SRGB = 0x000000A0,
522 VK_FORMAT_B8G8R8A8_UNORM = 0x000000A1,
523 VK_FORMAT_B8G8R8A8_SNORM = 0x000000A2,
524 VK_FORMAT_B8G8R8A8_USCALED = 0x000000A3,
525 VK_FORMAT_B8G8R8A8_SSCALED = 0x000000A4,
526 VK_FORMAT_B8G8R8A8_UINT = 0x000000A5,
527 VK_FORMAT_B8G8R8A8_SINT = 0x000000A6,
528 VK_FORMAT_B8G8R8A8_SRGB = 0x000000A7,
529 VK_FORMAT_B10G10R10A2_UNORM = 0x000000A8,
530 VK_FORMAT_B10G10R10A2_SNORM = 0x000000A9,
531 VK_FORMAT_B10G10R10A2_USCALED = 0x000000AA,
532 VK_FORMAT_B10G10R10A2_SSCALED = 0x000000AB,
533 VK_FORMAT_B10G10R10A2_UINT = 0x000000AC,
534 VK_FORMAT_B10G10R10A2_SINT = 0x000000AD,
535}
536
537/// Shader stage enumerant
538enum VkShaderStage {
539 VK_SHADER_STAGE_VERTEX = 0x00000000,
540 VK_SHADER_STAGE_TESS_CONTROL = 0x00000001,
541 VK_SHADER_STAGE_TESS_EVALUATION = 0x00000002,
542 VK_SHADER_STAGE_GEOMETRY = 0x00000003,
543 VK_SHADER_STAGE_FRAGMENT = 0x00000004,
544 VK_SHADER_STAGE_COMPUTE = 0x00000005,
545}
546
547/// Structure type enumerant
548enum VkStructureType {
549 VK_STRUCTURE_TYPE_APPLICATION_INFO = 0,
550 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 1,
551 VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO = 2,
552 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 3,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700553 VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 4,
554 VK_STRUCTURE_TYPE_SHADER_CREATE_INFO = 5,
555 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 6,
556 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 7,
557 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 8,
558 VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO = 9,
559 VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10,
560 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 11,
561 VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 12,
562 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 13,
563 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 14,
564 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 15,
565 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 16,
566 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 17,
567 VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 18,
568 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 19,
569 VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO = 20,
570 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 21,
571 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 22,
572 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 23,
573 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 24,
574 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 25,
575 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 26,
576 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 27,
577 VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO = 28,
578 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 29,
579 VK_STRUCTURE_TYPE_MEMORY_BARRIER = 30,
580 VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 31,
581 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 32,
582 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33,
583 VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 34,
584 VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 35,
585 VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 36,
586 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 37,
587 VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 38,
588 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 39,
589 VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION = 40,
590 VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION = 41,
591 VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY = 42,
592 VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43,
593 VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO = 44,
594 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 45,
595 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 46,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700596}
597
598enum VkRenderPassContents {
599 VK_RENDER_PASS_CONTENTS_INLINE = 0x00000000,
600 VK_RENDER_PASS_CONTENTS_SECONDARY_CMD_BUFFERS = 0x00000001,
601}
602
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700603@lastUnused(-8)
Jesse Halld27f6aa2015-08-15 17:58:48 -0700604/// Error and return codes
605enum VkResult {
606 // Return codes for successful operation execution (positive values)
607 VK_SUCCESS = 0x00000000,
608 VK_UNSUPPORTED = 0x00000001,
609 VK_NOT_READY = 0x00000002,
610 VK_TIMEOUT = 0x00000003,
611 VK_EVENT_SET = 0x00000004,
612 VK_EVENT_RESET = 0x00000005,
613 VK_INCOMPLETE = 0x00000006,
614
615 // Error codes (negative values)
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700616 VK_ERROR_OUT_OF_HOST_MEMORY = 0xFFFFFFFF,
617 VK_ERROR_OUT_OF_DEVICE_MEMORY = 0xFFFFFFFE,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700618 VK_ERROR_INITIALIZATION_FAILED = 0xFFFFFFFD,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700619 VK_ERROR_DEVICE_LOST = 0xFFFFFFFC,
620 VK_ERROR_MEMORY_MAP_FAILED = 0xFFFFFFFB,
621 VK_ERROR_LAYER_NOT_PRESENT = 0xFFFFFFFA,
622 VK_ERROR_EXTENSION_NOT_PRESENT = 0xFFFFFFF9,
623 VK_ERROR_INCOMPATIBLE_DRIVER = 0xFFFFFFF8,
624}
625
626enum VkDynamicState {
627 VK_DYNAMIC_STATE_VIEWPORT = 0x00000000,
628 VK_DYNAMIC_STATE_SCISSOR = 0x00000001,
629 VK_DYNAMIC_STATE_LINE_WIDTH = 0x00000002,
630 VK_DYNAMIC_STATE_DEPTH_BIAS = 0x00000003,
631 VK_DYNAMIC_STATE_BLEND_CONSTANTS = 0x00000004,
632 VK_DYNAMIC_STATE_DEPTH_BOUNDS = 0x00000005,
633 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 0x00000006,
634 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 0x00000007,
635 VK_DYNAMIC_STATE_STENCIL_REFERENCE = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700636}
637
638
639/////////////////
640// Bitfields //
641/////////////////
642
Jesse Halld27f6aa2015-08-15 17:58:48 -0700643/// Queue capabilities
644bitfield VkQueueFlags {
645 VK_QUEUE_GRAPHICS_BIT = 0x00000001, /// Queue supports graphics operations
646 VK_QUEUE_COMPUTE_BIT = 0x00000002, /// Queue supports compute operations
647 VK_QUEUE_DMA_BIT = 0x00000004, /// Queue supports DMA operations
648 VK_QUEUE_SPARSE_MEMMGR_BIT = 0x00000008, /// Queue supports sparse resource memory management operations
649 VK_QUEUE_EXTENDED_BIT = 0x40000000, /// Extended queue
650}
651
652/// Memory properties passed into vkAllocMemory().
653bitfield VkMemoryPropertyFlags {
654 VK_MEMORY_PROPERTY_DEVICE_ONLY = 0x00000000, /// If otherwise stated, then allocate memory on device
655 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000001, /// Memory should be mappable by host
656 VK_MEMORY_PROPERTY_HOST_NON_COHERENT_BIT = 0x00000002, /// Memory may not have i/o coherency so vkFlushMappedMemoryRanges and vkInvalidateMappedMemoryRanges must be used flush/invalidate host cache
657 /// vkInvalidateMappedMemoryRanges must be used flush/invalidate host cache
658 VK_MEMORY_PROPERTY_HOST_UNCACHED_BIT = 0x00000004, /// Memory should not be cached by the host
659 VK_MEMORY_PROPERTY_HOST_WRITE_COMBINED_BIT = 0x00000008, /// Memory should support host write combining
660 VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, /// Memory may be allocated by the driver when it is required
661}
662
663/// Memory heap flags
664bitfield VkMemoryHeapFlags {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700665 VK_MEMORY_HEAP_HOST_LOCAL_BIT = 0x00000001, /// If set, heap represents host memory
Jesse Halld27f6aa2015-08-15 17:58:48 -0700666}
667
668/// Memory output flags passed to resource transition commands
669bitfield VkMemoryOutputFlags {
670 VK_MEMORY_OUTPUT_HOST_WRITE_BIT = 0x00000001, /// Controls output coherency of host writes
671 VK_MEMORY_OUTPUT_SHADER_WRITE_BIT = 0x00000002, /// Controls output coherency of generic shader writes
672 VK_MEMORY_OUTPUT_COLOR_ATTACHMENT_BIT = 0x00000004, /// Controls output coherency of color attachment writes
673 VK_MEMORY_OUTPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000008, /// Controls output coherency of depth/stencil attachment writes
674 VK_MEMORY_OUTPUT_TRANSFER_BIT = 0x00000010, /// Controls output coherency of transfer operations
675}
676
677/// Memory input flags passed to resource transition commands
678bitfield VkMemoryInputFlags {
679 VK_MEMORY_INPUT_HOST_READ_BIT = 0x00000001, /// Controls input coherency of host reads
680 VK_MEMORY_INPUT_INDIRECT_COMMAND_BIT = 0x00000002, /// Controls input coherency of indirect command reads
681 VK_MEMORY_INPUT_INDEX_FETCH_BIT = 0x00000004, /// Controls input coherency of index fetches
682 VK_MEMORY_INPUT_VERTEX_ATTRIBUTE_FETCH_BIT = 0x00000008, /// Controls input coherency of vertex attribute fetches
683 VK_MEMORY_INPUT_UNIFORM_READ_BIT = 0x00000010, /// Controls input coherency of uniform buffer reads
684 VK_MEMORY_INPUT_SHADER_READ_BIT = 0x00000020, /// Controls input coherency of generic shader reads
685 VK_MEMORY_INPUT_COLOR_ATTACHMENT_BIT = 0x00000040, /// Controls input coherency of color attachment reads
686 VK_MEMORY_INPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000080, /// Controls input coherency of depth/stencil attachment reads
687 VK_MEMORY_INPUT_INPUT_ATTACHMENT_BIT = 0x00000100, /// Controls input coherency of input attachment reads
688 VK_MEMORY_INPUT_TRANSFER_BIT = 0x00000200, /// Controls input coherency of transfer operations
689}
690
691/// Buffer usage flags
692bitfield VkBufferUsageFlags {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700693 VK_BUFFER_USAGE_TRANSFER_SOURCE_BIT = 0x00000001, /// Can be used as a source of transfer operations
694 VK_BUFFER_USAGE_TRANSFER_DESTINATION_BIT = 0x00000002, /// Can be used as a destination of transfer operations
695 VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, /// Can be used as TBO
696 VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, /// Can be used as IBO
697 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, /// Can be used as UBO
698 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, /// Can be used as SSBO
699 VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, /// Can be used as source of fixed function index fetch (index buffer)
700 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, /// Can be used as source of fixed function vertex fetch (VBO)
701 VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, /// Can be the source of indirect parameters (e.g. indirect buffer, parameter buffer)
702}
703
704/// Buffer creation flags
705bitfield VkBufferCreateFlags {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700706 VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Buffer should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700707 VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Buffer should support sparse backing with partial residency
708 VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Buffer should support constent data access to physical memory blocks mapped into multiple locations of sparse buffers
709}
710
711/// Shader stage flags
712bitfield VkShaderStageFlags {
713 VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
714 VK_SHADER_STAGE_TESS_CONTROL_BIT = 0x00000002,
715 VK_SHADER_STAGE_TESS_EVALUATION_BIT = 0x00000004,
716 VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
717 VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
718 VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
719
720 VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
721}
722
723/// Image usage flags
724bitfield VkImageUsageFlags {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700725 VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT = 0x00000001, /// Can be used as a source of transfer operations
726 VK_IMAGE_USAGE_TRANSFER_DESTINATION_BIT = 0x00000002, /// Can be used as a destination of transfer operations
727 VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, /// Can be sampled from (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
728 VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, /// Can be used as storage image (STORAGE_IMAGE descriptor type)
729 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, /// Can be used as framebuffer color attachment
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700730 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment
Jesse Halld27f6aa2015-08-15 17:58:48 -0700731 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering
732 VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment
733}
734
735/// Image creation flags
736bitfield VkImageCreateFlags {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700737 VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Image should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700738 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Image should support sparse backing with partial residency
739 VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Image should support constent data access to physical memory blocks mapped into multiple locations of sparse images
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700740 VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, /// Allows image views to have different format than the base image
741 VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, /// Allows creating image views with cube type from the created image
Jesse Halld27f6aa2015-08-15 17:58:48 -0700742}
743
744/// Framebuffer attachment view creation flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700745bitfield VkImageViewCreateFlags {
746 VK_IMAGE_VIEW_CREATE_READ_ONLY_DEPTH_BIT = 0x00000001,
747 VK_IMAGE_VIEW_CREATE_READ_ONLY_STENCIL_BIT = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700748}
749
750/// Pipeline creation flags
751bitfield VkPipelineCreateFlags {
752 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
753 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
754 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
755}
756
757/// Channel flags
758bitfield VkChannelFlags {
759 VK_CHANNEL_R_BIT = 0x00000001,
760 VK_CHANNEL_G_BIT = 0x00000002,
761 VK_CHANNEL_B_BIT = 0x00000004,
762 VK_CHANNEL_A_BIT = 0x00000008,
763}
764
765/// Fence creation flags
766bitfield VkFenceCreateFlags {
767 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
768}
769
770/// Semaphore creation flags
771bitfield VkSemaphoreCreateFlags {
772}
773
774/// Format capability flags
775bitfield VkFormatFeatureFlags {
776 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
777 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type)
778 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images
779 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs)
780 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs)
781 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers
782 VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs)
783 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images
784 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images
785 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700786 VK_FORMAT_FEATURE_BLIT_SOURCE_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCmdBlitImage
787 VK_FORMAT_FEATURE_BLIT_DESTINATION_BIT = 0x00000800, /// Format can be used as the destination image of blits with vkCmdBlitImage
Jesse Halld27f6aa2015-08-15 17:58:48 -0700788}
789
790/// Query control flags
791bitfield VkQueryControlFlags {
792 VK_QUERY_CONTROL_CONSERVATIVE_BIT = 0x00000001, /// Allow conservative results to be collected by the query
793}
794
795/// Query result flags
796bitfield VkQueryResultFlags {
797 VK_QUERY_RESULT_DEFAULT = 0x00000000, /// Results of the queries are immediately written to the destination buffer as 32-bit values
798 VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values
799 VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy
800 VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written
801 VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available
802}
803
804/// Shader module creation flags
805bitfield VkShaderModuleCreateFlags {
806}
807
808/// Shader creation flags
809bitfield VkShaderCreateFlags {
810}
811
812/// Event creation flags
813bitfield VkEventCreateFlags {
814}
815
816/// Command buffer creation flags
817bitfield VkCmdBufferCreateFlags {
818}
819
820/// Command buffer optimization flags
821bitfield VkCmdBufferOptimizeFlags {
822 VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT = 0x00000001,
823 VK_CMD_BUFFER_OPTIMIZE_PIPELINE_SWITCH_BIT = 0x00000002,
824 VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT = 0x00000004,
825 VK_CMD_BUFFER_OPTIMIZE_DESCRIPTOR_SET_SWITCH_BIT = 0x00000008,
826 VK_CMD_BUFFER_OPTIMIZE_NO_SIMULTANEOUS_USE_BIT = 0x00000010, /// Only one call to the secondary command buffer will exist at any given time
827}
828
829/// Pipeline statistics flags
830bitfield VkQueryPipelineStatisticFlags {
831 VK_QUERY_PIPELINE_STATISTIC_IA_VERTICES_BIT = 0x00000001, /// Optional
832 VK_QUERY_PIPELINE_STATISTIC_IA_PRIMITIVES_BIT = 0x00000002, /// Optional
833 VK_QUERY_PIPELINE_STATISTIC_VS_INVOCATIONS_BIT = 0x00000004, /// Optional
834 VK_QUERY_PIPELINE_STATISTIC_GS_INVOCATIONS_BIT = 0x00000008, /// Optional
835 VK_QUERY_PIPELINE_STATISTIC_GS_PRIMITIVES_BIT = 0x00000010, /// Optional
836 VK_QUERY_PIPELINE_STATISTIC_C_INVOCATIONS_BIT = 0x00000020, /// Optional
837 VK_QUERY_PIPELINE_STATISTIC_C_PRIMITIVES_BIT = 0x00000040, /// Optional
838 VK_QUERY_PIPELINE_STATISTIC_FS_INVOCATIONS_BIT = 0x00000080, /// Optional
839 VK_QUERY_PIPELINE_STATISTIC_TCS_PATCHES_BIT = 0x00000100, /// Optional
840 VK_QUERY_PIPELINE_STATISTIC_TES_INVOCATIONS_BIT = 0x00000200, /// Optional
841 VK_QUERY_PIPELINE_STATISTIC_CS_INVOCATIONS_BIT = 0x00000400, /// Optional
842}
843
844/// Memory mapping flags
845bitfield VkMemoryMapFlags {
846}
847
848/// Bitfield of image aspects
849bitfield VkImageAspectFlags {
850 VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
851 VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
852 VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
853 VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
854}
855
856/// Sparse memory bind flags
857bitfield VkSparseMemoryBindFlags {
858 VK_SPARSE_MEMORY_BIND_REPLICATE_64KIB_BLOCK_BIT = 0x00000001, /// Replicate the first 64 KiB memory block to the entire bind rage
859}
860
861/// Sparse image memory requirements flags
862bitfield VkSparseImageFormatFlags {
863 VK_SPARSE_IMAGE_FMT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices
864 VK_SPARSE_IMAGE_FMT_ALIGNED_MIP_SIZE_BIT = 0x00000002, /// Image requires mip levels to be an exact multiple of the sparse iamge block size for non-mip-tail levels.
865 VK_SPARSE_IMAGE_FMT_NONSTD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size
866}
867
868/// Pipeline stages
869bitfield VkPipelineStageFlags {
870 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed
871 VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch
872 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch
873 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading
874 VK_PIPELINE_STAGE_TESS_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading
875 VK_PIPELINE_STAGE_TESS_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading
876 VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading
877 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading
878 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests
879 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests
880 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes
881 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading
882 VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700883 VK_PIPELINE_STAGE_HOST_BIT = 0x00002000, /// Indicates host (CPU) is a source/sink of the dependency
Jesse Halld27f6aa2015-08-15 17:58:48 -0700884
885 VK_PIPELINE_STAGE_ALL_GRAPHICS = 0x000007FF, /// All stages of the graphics pipeline
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700886 VK_PIPELINE_STAGE_ALL_GPU_COMMANDS = 0x00001FFF, /// All graphics, compute, copy, and transition commands
887}
888
889/// Render pass attachment description flags
890bitfield VkAttachmentDescriptionFlags {
891 VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001, /// The attachment may alias physical memory of another attachment in the same renderpass
Jesse Halld27f6aa2015-08-15 17:58:48 -0700892}
893
894/// Subpass description flags
895bitfield VkSubpassDescriptionFlags {
896 VK_SUBPASS_DESCRIPTION_NO_OVERDRAW_BIT = 0x00000001,
897}
898
899/// Command pool creation flags
900bitfield VkCmdPoolCreateFlags {
901 VK_CMD_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime
902 VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually
903}
904
905/// Command pool reset flags
906bitfield VkCmdPoolResetFlags {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700907 VK_CMD_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool
Jesse Halld27f6aa2015-08-15 17:58:48 -0700908}
909
910bitfield VkCmdBufferResetFlags {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700911 VK_CMD_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer
912}
913
914bitfield VkSampleCountFlags {
915 VK_SAMPLE_COUNT_1_BIT = 0x00000001,
916 VK_SAMPLE_COUNT_2_BIT = 0x00000002,
917 VK_SAMPLE_COUNT_4_BIT = 0x00000004,
918 VK_SAMPLE_COUNT_8_BIT = 0x00000008,
919 VK_SAMPLE_COUNT_16_BIT = 0x00000010,
920 VK_SAMPLE_COUNT_32_BIT = 0x00000020,
921 VK_SAMPLE_COUNT_64_BIT = 0x00000040,
922}
923
924bitfield VkStencilFaceFlags {
925 VK_STENCIL_FACE_NONE = 0x00000000, /// No faces
926 VK_STENCIL_FACE_FRONT_BIT = 0x00000001, /// Front face
927 VK_STENCIL_FACE_BACK_BIT = 0x00000002, /// Back face
Jesse Halld27f6aa2015-08-15 17:58:48 -0700928}
929
930
931//////////////////
932// Structures //
933//////////////////
934
935class VkOffset2D {
936 s32 x
937 s32 y
938}
939
940class VkOffset3D {
941 s32 x
942 s32 y
943 s32 z
944}
945
946class VkExtent2D {
947 s32 width
948 s32 height
949}
950
951class VkExtent3D {
952 s32 width
953 s32 height
954 s32 depth
955}
956
957class VkViewport {
958 f32 originX
959 f32 originY
960 f32 width
961 f32 height
962 f32 minDepth
963 f32 maxDepth
964}
965
966class VkRect2D {
967 VkOffset2D offset
968 VkExtent2D extent
969}
970
971class VkRect3D {
972 VkOffset3D offset
973 VkExtent3D extent
974}
975
976class VkChannelMapping {
977 VkChannelSwizzle r
978 VkChannelSwizzle g
979 VkChannelSwizzle b
980 VkChannelSwizzle a
981}
982
983class VkPhysicalDeviceProperties {
984 u32 apiVersion
985 u32 driverVersion
986 u32 vendorId
987 u32 deviceId
988 VkPhysicalDeviceType deviceType
989 char[VK_MAX_PHYSICAL_DEVICE_NAME] deviceName
990 u8[VK_UUID_LENGTH] pipelineCacheUUID
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700991 VkPhysicalDeviceLimits limits
992 VkPhysicalDeviceSparseProperties sparseProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -0700993}
994
995class VkExtensionProperties {
996 char[VK_MAX_EXTENSION_NAME] extName /// extension name
997 u32 specVersion /// version of the extension specification implemented
998}
999
1000class VkLayerProperties {
1001 char[VK_MAX_EXTENSION_NAME] layerName /// layer name
1002 u32 specVersion /// version of the layer specification implemented
1003 u32 implVersion /// build or release version of the layer's library
Jesse Hallf09c6b12015-08-15 19:54:28 -07001004 char[VK_MAX_DESCRIPTION] description /// Free-form description of the layer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001005}
1006
1007class VkApplicationInfo {
1008 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO
1009 const void* pNext /// Next structure in chain
1010 const char* pAppName
1011 u32 appVersion
1012 const char* pEngineName
1013 u32 engineVersion
1014 u32 apiVersion
1015}
1016
1017class VkAllocCallbacks {
1018 void* pUserData
1019 PFN_vkAllocFunction pfnAlloc
1020 PFN_vkFreeFunction pfnFree
1021}
1022
1023class VkDeviceQueueCreateInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001024 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
1025 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001026 u32 queueFamilyIndex
1027 u32 queueCount
1028}
1029
1030class VkDeviceCreateInfo {
1031 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
1032 const void* pNext /// Pointer to next structure
1033 u32 queueRecordCount
1034 const VkDeviceQueueCreateInfo* pRequestedQueues
1035 u32 layerCount
1036 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
1037 u32 extensionCount
1038 const char* const* ppEnabledExtensionNames
1039 const VkPhysicalDeviceFeatures* pEnabledFeatures
Jesse Halld27f6aa2015-08-15 17:58:48 -07001040}
1041
1042class VkInstanceCreateInfo {
1043 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
1044 const void* pNext /// Pointer to next structure
1045 const VkApplicationInfo* pAppInfo
1046 const VkAllocCallbacks* pAllocCb
1047 u32 layerCount
1048 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
1049 u32 extensionCount
1050 const char* const* ppEnabledExtensionNames /// Extension names to be enabled
1051}
1052
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001053class VkQueueFamilyProperties {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001054 VkQueueFlags queueFlags /// Queue flags
1055 u32 queueCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001056 VkBool32 supportsTimestamps
Jesse Halld27f6aa2015-08-15 17:58:48 -07001057}
1058
1059class VkPhysicalDeviceMemoryProperties {
1060 u32 memoryTypeCount
1061 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes
1062 u32 memoryHeapCount
1063 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps
1064}
1065
1066class VkMemoryAllocInfo {
1067 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO
1068 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001069 VkDeviceSize allocationSize /// Size of memory allocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001070 u32 memoryTypeIndex /// Index of the of the memory type to allocate from
1071}
1072
1073class VkMemoryRequirements {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001074 VkDeviceSize size /// Specified in bytes
1075 VkDeviceSize alignment /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001076 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object
1077}
1078
1079class VkSparseImageFormatProperties {
1080 VkImageAspect aspect
1081 VkExtent3D imageGranularity
1082 VkSparseImageFormatFlags flags
1083}
1084
1085class VkSparseImageMemoryRequirements {
1086 VkSparseImageFormatProperties formatProps
1087 u32 imageMipTailStartLOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001088 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment
1089 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment
1090 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07001091}
1092
1093class VkMemoryType {
1094 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type
1095 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from
1096}
1097
1098class VkMemoryHeap {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001099 VkDeviceSize size /// Available memory in the heap
Jesse Halld27f6aa2015-08-15 17:58:48 -07001100 VkMemoryHeapFlags flags /// Flags for the heap
1101}
1102
1103class VkMappedMemoryRange {
1104 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
1105 const void* pNext /// Pointer to next structure
1106 VkDeviceMemory mem /// Mapped memory object
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001107 VkDeviceSize offset /// Offset within the mapped memory the range starts from
1108 VkDeviceSize size /// Size of the range within the mapped memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07001109}
1110
1111class VkFormatProperties {
1112 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling
1113 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001114 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001115}
1116
1117class VkImageFormatProperties {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001118 VkExtent3D maxExtent /// max image dimensions for this resource type
1119 u32 maxMipLevels /// max number of mipmap levels for this resource type
1120 u32 maxArraySize /// max array size for this resource type
1121 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type
1122 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type
1123}
1124
1125class VkDescriptorBufferInfo {
1126 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC]
1127 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set.
1128 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001129}
1130
1131class VkDescriptorInfo {
1132 VkBufferView bufferView /// Buffer view to write to the descriptor (in case it's a buffer descriptor, otherwise should be VK_NULL_HANDLE)
1133 VkSampler sampler /// Sampler to write to the descriptor (in case it's a SAMPLER or COMBINED_IMAGE_SAMPLER descriptor, otherwise should be VK_NULL_HANDLE)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001134 VkImageView imageView /// Image view to write to the descriptor (in case it's a SAMPLED_IMAGE, STORAGE_IMAGE, COMBINED_IMAGE_SAMPLER, or INPUT_ATTACHMENT descriptor, otherwise should be VK_NULL_HANDLE)
1135 VkImageLayout imageLayout /// Layout the image is expected to be in when accessed using this descriptor (only used if imageView is not VK_NULL_HANDLE)
1136 VkDescriptorBufferInfo bufferInfo /// Raw buffer, size and offset for UNIFORM_BUFFER[_DYNAMIC] or STORAGE_BUFFER[_DYNAMIC] descriptor types. Ignored otherwise.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001137}
1138
1139class VkWriteDescriptorSet {
1140 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
1141 const void* pNext /// Pointer to next structure
1142 VkDescriptorSet destSet /// Destination descriptor set
1143 u32 destBinding /// Binding within the destination descriptor set to write
1144 u32 destArrayElement /// Array element within the destination binding to write
1145 u32 count /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>)
1146 VkDescriptorType descriptorType /// Descriptor type to write (determines which fields of the array pointed by <pDescriptors> are going to be used)
1147 const VkDescriptorInfo* pDescriptors /// Array of info structures describing the descriptors to write
1148}
1149
1150class VkCopyDescriptorSet {
1151 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
1152 const void* pNext /// Pointer to next structure
1153 VkDescriptorSet srcSet /// Source descriptor set
1154 u32 srcBinding /// Binding within the source descriptor set to copy from
1155 u32 srcArrayElement /// Array element within the source binding to copy from
1156 VkDescriptorSet destSet /// Destination descriptor set
1157 u32 destBinding /// Binding within the destination descriptor set to copy to
1158 u32 destArrayElement /// Array element within the destination binding to copy to
1159 u32 count /// Number of descriptors to copy
1160}
1161
1162class VkBufferCreateInfo {
1163 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
1164 const void* pNext /// Pointer to next structure.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001165 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001166 VkBufferUsageFlags usage /// Buffer usage flags
1167 VkBufferCreateFlags flags /// Buffer creation flags
1168 VkSharingMode sharingMode
1169 u32 queueFamilyCount
1170 const u32* pQueueFamilyIndices
1171}
1172
1173class VkBufferViewCreateInfo {
1174 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
1175 const void* pNext /// Pointer to next structure.
1176 VkBuffer buffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001177 VkFormat format /// Optionally specifies format of elements
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001178 VkDeviceSize offset /// Specified in bytes
1179 VkDeviceSize range /// View size specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001180}
1181
1182class VkImageSubresource {
1183 VkImageAspect aspect
1184 u32 mipLevel
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001185 u32 arrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001186}
1187
1188class VkImageSubresourceRange {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001189 VkImageAspectFlags aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001190 u32 baseMipLevel
1191 u32 mipLevels
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001192 u32 baseArrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001193 u32 arraySize
1194}
1195
1196class VkMemoryBarrier {
1197 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER
1198 const void* pNext /// Pointer to next structure.
1199 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1200 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1201}
1202
1203class VkBufferMemoryBarrier {
1204 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
1205 const void* pNext /// Pointer to next structure.
1206 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1207 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1208 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
1209 u32 destQueueFamilyIndex /// Queue family to transition ownership to
1210 VkBuffer buffer /// Buffer to sync
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001211 VkDeviceSize offset /// Offset within the buffer to sync
1212 VkDeviceSize size /// Amount of bytes to sync
Jesse Halld27f6aa2015-08-15 17:58:48 -07001213}
1214
1215class VkImageMemoryBarrier {
1216 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
1217 const void* pNext /// Pointer to next structure.
1218 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1219 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1220 VkImageLayout oldLayout /// Current layout of the image
1221 VkImageLayout newLayout /// New layout to transition the image to
1222 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
1223 u32 destQueueFamilyIndex /// Queue family to transition ownership to
1224 VkImage image /// Image to sync
1225 VkImageSubresourceRange subresourceRange /// Subresource range to sync
1226}
1227
1228class VkImageCreateInfo {
1229 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
1230 const void* pNext /// Pointer to next structure.
1231 VkImageType imageType
1232 VkFormat format
1233 VkExtent3D extent
1234 u32 mipLevels
1235 u32 arraySize
1236 u32 samples
1237 VkImageTiling tiling
1238 VkImageUsageFlags usage /// Image usage flags
1239 VkImageCreateFlags flags /// Image creation flags
1240 VkSharingMode sharingMode /// Cross-queue-family sharing mode
1241 u32 queueFamilyCount /// Number of queue families to share across
1242 const u32* pQueueFamilyIndices /// Array of queue family indices to share across
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001243 VkImageLayout initialLayout /// Initial image layout for all subresources
Jesse Halld27f6aa2015-08-15 17:58:48 -07001244}
1245
1246class VkSubresourceLayout {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001247 VkDeviceSize offset /// Specified in bytes
1248 VkDeviceSize size /// Specified in bytes
1249 VkDeviceSize rowPitch /// Specified in bytes
1250 VkDeviceSize depthPitch /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001251}
1252
1253class VkImageViewCreateInfo {
1254 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
1255 const void* pNext /// Pointer to next structure
1256 VkImage image
1257 VkImageViewType viewType
1258 VkFormat format
1259 VkChannelMapping channels
1260 VkImageSubresourceRange subresourceRange
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001261 VkImageViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001262}
1263
1264class VkBufferCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001265 VkDeviceSize srcOffset /// Specified in bytes
1266 VkDeviceSize destOffset /// Specified in bytes
1267 VkDeviceSize copySize /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001268}
1269
1270class VkSparseMemoryBindInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001271 VkDeviceSize rangeOffset /// Specified in bytes
1272 VkDeviceSize rangeSize /// Specified in bytes
1273 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001274 VkDeviceMemory mem
1275 VkSparseMemoryBindFlags flags
1276}
1277
1278class VkSparseImageMemoryBindInfo {
1279 VkImageSubresource subresource
1280 VkOffset3D offset
1281 VkExtent3D extent
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001282 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001283 VkDeviceMemory mem
1284 VkSparseMemoryBindFlags flags
1285}
1286
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001287class VkImageSubresourceCopy {
1288 VkImageAspect aspect
1289 u32 mipLevel
1290 u32 arrayLayer
1291 u32 arraySize
1292}
1293
Jesse Halld27f6aa2015-08-15 17:58:48 -07001294class VkImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001295 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001296 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001297 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001298 VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images
1299 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images
1300}
1301
1302class VkImageBlit {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001303 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001304 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
1305 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001306 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001307 VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images
1308 VkExtent3D destExtent /// Specified in pixels for both compressed and uncompressed images
1309}
1310
1311class VkBufferImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001312 VkDeviceSize bufferOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001313 u32 bufferRowLength /// Specified in texels
1314 u32 bufferImageHeight
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001315 VkImageSubresourceCopy imageSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001316 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images
1317 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images
1318}
1319
1320class VkImageResolve {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001321 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001322 VkOffset3D srcOffset
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001323 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001324 VkOffset3D destOffset
1325 VkExtent3D extent
1326}
1327
1328class VkShaderModuleCreateInfo {
1329 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
1330 const void* pNext /// Pointer to next structure
1331 platform.size_t codeSize /// Specified in bytes
1332 const void* pCode /// Binary code of size codeSize
1333 VkShaderModuleCreateFlags flags /// Reserved
1334}
1335
1336class VkShaderCreateInfo {
1337 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
1338 const void* pNext /// Pointer to next structure
1339 VkShaderModule module /// Module containing entry point
1340 const char* pName /// Null-terminated entry point name
1341 VkShaderCreateFlags flags /// Reserved
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001342 VkShaderStage stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001343}
1344
1345class VkDescriptorSetLayoutBinding {
1346 VkDescriptorType descriptorType /// Type of the descriptors in this binding
1347 u32 arraySize /// Number of descriptors in this binding
1348 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to
1349 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements)
1350}
1351
1352class VkDescriptorSetLayoutCreateInfo {
1353 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
1354 const void* pNext /// Pointer to next structure
1355 u32 count /// Number of bindings in the descriptor set layout
1356 const VkDescriptorSetLayoutBinding* pBinding /// Array of descriptor set layout bindings
1357}
1358
1359class VkDescriptorTypeCount {
1360 VkDescriptorType type
1361 u32 count
1362}
1363
1364class VkDescriptorPoolCreateInfo {
1365 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
1366 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001367 VkDescriptorPoolUsage poolUsage
1368 u32 maxSets
Jesse Halld27f6aa2015-08-15 17:58:48 -07001369 u32 count
1370 const VkDescriptorTypeCount* pTypeCount
1371}
1372
1373class VkSpecializationMapEntry {
1374 u32 constantId /// The SpecConstant ID specified in the BIL
1375 platform.size_t size /// Size in bytes of the SpecConstant
1376 u32 offset /// Offset of the value in the data block
1377}
1378
1379class VkSpecializationInfo {
1380 u32 mapEntryCount /// Number of entries in the map
1381 const VkSpecializationMapEntry* pMap /// Array of map entries
1382 platform.size_t dataSize /// Size in bytes of pData
1383 const void* pData /// Pointer to SpecConstant data
1384}
1385
1386class VkPipelineShaderStageCreateInfo {
1387 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
1388 const void* pNext /// Pointer to next structure
1389 VkShaderStage stage
1390 VkShader shader
1391 const VkSpecializationInfo* pSpecializationInfo
1392}
1393
1394class VkComputePipelineCreateInfo {
1395 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
1396 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001397 VkPipelineShaderStageCreateInfo stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001398 VkPipelineCreateFlags flags /// Pipeline creation flags
1399 VkPipelineLayout layout /// Interface layout of the pipeline
1400 VkPipeline basePipelineHandle /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of
1401 s32 basePipelineIndex /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of
1402}
1403
1404class VkVertexInputBindingDescription {
1405 u32 binding /// Vertex buffer binding id
1406 u32 strideInBytes /// Distance between vertices in bytes (0 = no advancement)
1407 VkVertexInputStepRate stepRate /// Rate at which binding is incremented
1408}
1409
1410class VkVertexInputAttributeDescription {
1411 u32 location /// location of the shader vertex attrib
1412 u32 binding /// Vertex buffer binding id
1413 VkFormat format /// format of source data
1414 u32 offsetInBytes /// Offset of first element in bytes from base of vertex
1415}
1416
1417class VkPipelineVertexInputStateCreateInfo {
1418 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
1419 const void* pNext /// Pointer to next structure
1420 u32 bindingCount /// number of bindings
1421 const VkVertexInputBindingDescription* pVertexBindingDescriptions
1422 u32 attributeCount /// number of attributes
1423 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
1424}
1425
1426class VkPipelineInputAssemblyStateCreateInfo {
1427 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
1428 const void* pNext /// Pointer to next structure
1429 VkPrimitiveTopology topology
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001430 VkBool32 primitiveRestartEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001431}
1432
1433class VkPipelineTessellationStateCreateInfo {
1434 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
1435 const void* pNext /// Pointer to next structure
1436 u32 patchControlPoints
1437}
1438
1439class VkPipelineViewportStateCreateInfo {
1440 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
1441 const void* pNext /// Pointer to next structure
1442 u32 viewportCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001443 const VkViewport* pViewports
1444 u32 scissorCount
1445 const VkRect2D* pScissors
Jesse Halld27f6aa2015-08-15 17:58:48 -07001446}
1447
1448class VkPipelineRasterStateCreateInfo {
1449 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO
1450 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001451 VkBool32 depthClipEnable
1452 VkBool32 rasterizerDiscardEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001453 VkFillMode fillMode /// optional (GL45)
1454 VkCullMode cullMode
1455 VkFrontFace frontFace
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001456 VkBool32 depthBiasEnable
1457 f32 depthBias
1458 f32 depthBiasClamp
1459 f32 slopeScaledDepthBias
1460 f32 lineWidth
Jesse Halld27f6aa2015-08-15 17:58:48 -07001461}
1462
1463class VkPipelineMultisampleStateCreateInfo {
1464 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
1465 const void* pNext /// Pointer to next structure
1466 u32 rasterSamples /// Number of samples used for rasterization
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001467 VkBool32 sampleShadingEnable /// optional (GL45)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001468 f32 minSampleShading /// optional (GL45)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001469 const VkSampleMask* pSampleMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001470}
1471
1472class VkPipelineColorBlendAttachmentState {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001473 VkBool32 blendEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001474 VkBlend srcBlendColor
1475 VkBlend destBlendColor
1476 VkBlendOp blendOpColor
1477 VkBlend srcBlendAlpha
1478 VkBlend destBlendAlpha
1479 VkBlendOp blendOpAlpha
1480 VkChannelFlags channelWriteMask
1481}
1482
1483class VkPipelineColorBlendStateCreateInfo {
1484 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
1485 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001486 VkBool32 alphaToCoverageEnable
1487 VkBool32 alphaToOneEnable
1488 VkBool32 logicOpEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001489 VkLogicOp logicOp
1490 u32 attachmentCount /// # of pAttachments
1491 const VkPipelineColorBlendAttachmentState* pAttachments
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001492 f32[4] blendConst
Jesse Halld27f6aa2015-08-15 17:58:48 -07001493}
1494
1495class VkStencilOpState {
1496 VkStencilOp stencilFailOp
1497 VkStencilOp stencilPassOp
1498 VkStencilOp stencilDepthFailOp
1499 VkCompareOp stencilCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001500 u32 stencilCompareMask
1501 u32 stencilWriteMask
1502 u32 stencilReference
Jesse Halld27f6aa2015-08-15 17:58:48 -07001503}
1504
1505class VkPipelineDepthStencilStateCreateInfo {
1506 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
1507 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001508 VkBool32 depthTestEnable
1509 VkBool32 depthWriteEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001510 VkCompareOp depthCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001511 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test)
1512 VkBool32 stencilTestEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001513 VkStencilOpState front
1514 VkStencilOpState back
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001515 f32 minDepthBounds
1516 f32 maxDepthBounds
1517}
1518
1519class VkPipelineDynamicStateCreateInfo {
1520 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
1521 const void* pNext /// Pointer to next structure
1522 u32 dynamicStateCount
1523 const VkDynamicState* pDynamicStates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001524}
1525
1526class VkGraphicsPipelineCreateInfo {
1527 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
1528 const void* pNext /// Pointer to next structure
1529 u32 stageCount
1530 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage
1531 const VkPipelineVertexInputStateCreateInfo* pVertexInputState
1532 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
1533 const VkPipelineTessellationStateCreateInfo* pTessellationState
1534 const VkPipelineViewportStateCreateInfo* pViewportState
1535 const VkPipelineRasterStateCreateInfo* pRasterState
1536 const VkPipelineMultisampleStateCreateInfo* pMultisampleState
1537 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState
1538 const VkPipelineColorBlendStateCreateInfo* pColorBlendState
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001539 const VkPipelineDynamicStateCreateInfo* pDynamicState
Jesse Halld27f6aa2015-08-15 17:58:48 -07001540 VkPipelineCreateFlags flags /// Pipeline creation flags
1541 VkPipelineLayout layout /// Interface layout of the pipeline
1542 VkRenderPass renderPass
1543 u32 subpass
1544 VkPipeline basePipelineHandle /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of
1545 s32 basePipelineIndex /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of
1546}
1547
1548class VkPipelineCacheCreateInfo {
1549 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
1550 const void* pNext /// Pointer to next structure
1551 platform.size_t initialSize /// Size of initial data to populate cache, in bytes
1552 const void* initialData /// Initial data to populate cache
1553 platform.size_t maxSize /// Maximum size cache can grow to, in bytes. If zero, then the cache may grow without bound.
1554}
1555
1556class VkPushConstantRange {
1557 VkShaderStageFlags stageFlags /// Which stages use the range
1558 u32 start /// Start of the range, in bytes
1559 u32 length /// Length of the range, in bytes
1560}
1561
1562class VkPipelineLayoutCreateInfo {
1563 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
1564 const void* pNext /// Pointer to next structure
1565 u32 descriptorSetCount /// Number of descriptor sets interfaced by the pipeline
1566 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the
1567 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline
1568 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages
1569}
1570
1571class VkSamplerCreateInfo {
1572 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
1573 const void* pNext /// Pointer to next structure
1574 VkTexFilter magFilter /// Filter mode for magnification
1575 VkTexFilter minFilter /// Filter mode for minifiation
1576 VkTexMipmapMode mipMode /// Mipmap selection mode
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001577 VkTexAddressMode addressModeU
1578 VkTexAddressMode addressModeV
1579 VkTexAddressMode addressModeW
Jesse Halld27f6aa2015-08-15 17:58:48 -07001580 f32 mipLodBias
1581 f32 maxAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001582 VkBool32 compareEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001583 VkCompareOp compareOp
1584 f32 minLod
1585 f32 maxLod
1586 VkBorderColor borderColor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001587 VkBool32 unnormalizedCoordinates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001588}
1589
1590class VkCmdPoolCreateInfo {
1591 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO
1592 const void* pNext /// Pointer to next structure
1593 u32 queueFamilyIndex
1594 VkCmdPoolCreateFlags flags /// Command pool creation flags
1595}
1596
1597class VkCmdBufferCreateInfo {
1598 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO
1599 const void* pNext /// Pointer to next structure
1600 VkCmdPool cmdPool
1601 VkCmdBufferLevel level
1602 VkCmdBufferCreateFlags flags /// Command buffer creation flags
1603}
1604
1605class VkCmdBufferBeginInfo {
1606 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO
1607 const void* pNext /// Pointer to next structure
1608 VkCmdBufferOptimizeFlags flags /// Command buffer optimization flags
1609 VkRenderPass renderPass /// Render pass for secondary command buffers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001610 u32 subpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07001611 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers
1612}
1613
1614class VkRenderPassBeginInfo {
1615 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
1616 const void* pNext /// Pointer to next structure
1617 VkRenderPass renderPass
1618 VkFramebuffer framebuffer
1619 VkRect2D renderArea
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001620 u32 clearValueCount
1621 const VkClearValue* pClearValues
Jesse Halld27f6aa2015-08-15 17:58:48 -07001622}
1623
1624@union
1625/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared.
1626class VkClearColorValue {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001627 f32[4] float32
1628 s32[4] int32
1629 u32[4] uint32
Jesse Halld27f6aa2015-08-15 17:58:48 -07001630}
1631
1632class VkClearDepthStencilValue {
1633 f32 depth
1634 u32 stencil
1635}
1636
1637@union
1638/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared.
1639class VkClearValue {
1640 VkClearColorValue color
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001641 VkClearDepthStencilValue depthStencil
Jesse Halld27f6aa2015-08-15 17:58:48 -07001642}
1643
1644class VkAttachmentDescription {
1645 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION
1646 const void* pNext /// Pointer to next structure
1647 VkFormat format
1648 u32 samples
1649 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1650 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1651 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1652 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1653 VkImageLayout initialLayout
1654 VkImageLayout finalLayout
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001655 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001656}
1657
1658class VkAttachmentReference {
1659 u32 attachment
1660 VkImageLayout layout
1661}
1662
1663class VkSubpassDescription {
1664 VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DESCRIPTION
1665 const void* pNext /// Pointer to next structure
1666 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
1667 VkSubpassDescriptionFlags flags
1668 u32 inputCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001669 const VkAttachmentReference* pInputAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07001670 u32 colorCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001671 const VkAttachmentReference* pColorAttachments
1672 const VkAttachmentReference* pResolveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07001673 VkAttachmentReference depthStencilAttachment
1674 u32 preserveCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001675 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07001676}
1677
1678class VkSubpassDependency {
1679 VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DEPENDENCY
1680 const void* pNext /// Pointer to next structure
1681 u32 srcSubpass
1682 u32 destSubpass
1683 VkPipelineStageFlags srcStageMask
1684 VkPipelineStageFlags destStageMask
1685 VkMemoryOutputFlags outputMask
1686 VkMemoryInputFlags inputMask
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001687 VkBool32 byRegion
Jesse Halld27f6aa2015-08-15 17:58:48 -07001688}
1689
1690class VkRenderPassCreateInfo {
1691 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
1692 const void* pNext /// Pointer to next structure
1693 u32 attachmentCount
1694 const VkAttachmentDescription* pAttachments
1695 u32 subpassCount
1696 const VkSubpassDescription* pSubpasses
1697 u32 dependencyCount
1698 const VkSubpassDependency* pDependencies
1699}
1700
1701class VkEventCreateInfo {
1702 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
1703 const void* pNext /// Pointer to next structure
1704 VkEventCreateFlags flags /// Event creation flags
1705}
1706
1707class VkFenceCreateInfo {
1708 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
1709 const void* pNext /// Pointer to next structure
1710 VkFenceCreateFlags flags /// Fence creation flags
1711}
1712
1713class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001714 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
1715 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
1716 VkBool32 imageCubeArray /// image views which are arrays of cube maps
1717 VkBool32 independentBlend /// blending operations are controlled per-attachment
1718 VkBool32 geometryShader /// geometry stage
1719 VkBool32 tessellationShader /// tessellation control and evaluation stage
1720 VkBool32 sampleRateShading /// per-sample shading and interpolation
1721 VkBool32 dualSourceBlend /// blend operations which take two sources
1722 VkBool32 logicOp /// logic operations
1723 VkBool32 multiDrawIndirect /// multi draw indirect
1724 VkBool32 depthClip /// depth clipping
1725 VkBool32 depthBiasClamp /// depth bias clamping
1726 VkBool32 fillModeNonSolid /// point and wireframe fill modes
1727 VkBool32 depthBounds /// depth bounds test
1728 VkBool32 wideLines /// lines with width greater than 1
1729 VkBool32 largePoints /// points with size greater than 1
1730 VkBool32 textureCompressionETC2 /// ETC texture compression formats
1731 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
1732 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
1733 VkBool32 occlusionQueryNonConservative /// non-conservative (exact) occlusion queries
1734 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
1735 VkBool32 vertexSideEffects /// storage buffers and images in vertex stage
1736 VkBool32 tessellationSideEffects /// storage buffers and images in tessellation stage
1737 VkBool32 geometrySideEffects /// storage buffers and images in geometry stage
1738 VkBool32 fragmentSideEffects /// storage buffers and images in fragment stage
1739 VkBool32 shaderTessellationPointSize /// tessellation stage can export point size
1740 VkBool32 shaderGeometryPointSize /// geometry stage can export point size
1741 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
1742 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
1743 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
1744 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
1745 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
1746 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
1747 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
1748 VkBool32 shaderClipDistance /// clip distance in shaders
1749 VkBool32 shaderCullDistance /// cull distance in shaders
1750 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
1751 VkBool32 shaderInt64 /// 64-bit integers in shaders
1752 VkBool32 shaderInt16 /// 16-bit integers in shaders
1753 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
1754 VkBool32 shaderResourceMinLOD /// shader can use texture operations that specify minimum resource LOD
1755 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
1756 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
1757 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
1758 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
1759 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
1760 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
1761 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
1762 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
1763 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
1764 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001765}
1766
1767class VkPhysicalDeviceLimits {
1768 /// resource maximum sizes
1769 u32 maxImageDimension1D /// max 1D image dimension
1770 u32 maxImageDimension2D /// max 2D image dimension
1771 u32 maxImageDimension3D /// max 3D image dimension
1772 u32 maxImageDimensionCube /// max cubemap image dimension
1773 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001774 VkSampleCountFlags sampleCounts /// sample counts supported for all images supporting rendering and sampling
Jesse Halld27f6aa2015-08-15 17:58:48 -07001775 u32 maxTexelBufferSize /// max texel buffer size (bytes)
1776 u32 maxUniformBufferSize /// max uniform buffer size (bytes)
1777 u32 maxStorageBufferSize /// max storage buffer size (bytes)
1778 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
1779 /// memory limits
1780 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001781 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
1782 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001783 /// descriptor set limits
1784 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
1785 u32 maxDescriptorSets /// max number of allocated descriptor sets
1786 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
1787 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
1788 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
1789 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
1790 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
1791 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
1792 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001793 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07001794 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001795 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07001796 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
1797 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
1798 /// vertex stage limits
1799 u32 maxVertexInputAttributes /// max num of vertex input attribute slots
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001800 u32 maxVertexInputBindings /// max num of vertex input binding slots
Jesse Halld27f6aa2015-08-15 17:58:48 -07001801 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset
1802 u32 maxVertexInputBindingStride /// max vertex input binding stride
1803 u32 maxVertexOutputComponents /// max num of output components written by vertex shader
1804 /// tessellation control stage limits
1805 u32 maxTessGenLevel /// max level supported by tess primitive generator
1806 u32 maxTessPatchSize /// max patch size (vertices)
1807 u32 maxTessControlPerVertexInputComponents /// max num of input components per-vertex in TCS
1808 u32 maxTessControlPerVertexOutputComponents /// max num of output components per-vertex in TCS
1809 u32 maxTessControlPerPatchOutputComponents /// max num of output components per-patch in TCS
1810 u32 maxTessControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS
1811 u32 maxTessEvaluationInputComponents /// max num of input components per vertex in TES
1812 u32 maxTessEvaluationOutputComponents /// max num of output components per vertex in TES
1813 /// geometry stage limits
1814 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader
1815 u32 maxGeometryInputComponents /// max num of input components read in geometry stage
1816 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage
1817 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage
1818 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage
1819 /// fragment stage limits
1820 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage
1821 u32 maxFragmentOutputBuffers /// max num of output buffers written in fragment stage
1822 u32 maxFragmentDualSourceBuffers /// max num of output buffers written when using dual source blending
1823 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers
1824 /// compute stage limits
1825 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes)
1826 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z)
1827 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group
1828 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z)
1829
1830 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y
1831 u32 subTexelPrecisionBits /// num bits of subtexel precision
1832 u32 mipmapPrecisionBits /// num bits of mipmap precision
1833
1834 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices)
1835 u32 maxDrawIndirectInstanceCount /// max instance count for indirect draw calls
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001836 VkBool32 primitiveRestartForPatches /// is primitive restart supported for PATCHES
Jesse Halld27f6aa2015-08-15 17:58:48 -07001837
1838 f32 maxSamplerLodBias /// max absolute sampler level of detail bias
1839 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy
1840
1841 u32 maxViewports /// max number of active viewports
Jesse Halld27f6aa2015-08-15 17:58:48 -07001842 u32[2] maxViewportDimensions /// max viewport dimensions (x,y)
1843 f32[2] viewportBoundsRange /// viewport bounds range (min,max)
1844 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport
1845
1846 u32 minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes)
Jesse Hallf09c6b12015-08-15 19:54:28 -07001847 u32 minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001848 u32 minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes)
1849 u32 minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes)
1850
1851 u32 minTexelOffset /// min texel offset for OpTextureSampleOffset
1852 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset
1853 u32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset
1854 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset
1855 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset
1856 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset
1857 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset
1858
1859 u32 maxFramebufferWidth /// max width for a framebuffer
1860 u32 maxFramebufferHeight /// max height for a framebuffer
1861 u32 maxFramebufferLayers /// max layer count for a layered framebuffer
1862 u32 maxFramebufferColorSamples /// max color sample count for a framebuffer
1863 u32 maxFramebufferDepthSamples /// max depth sample count for a framebuffer
1864 u32 maxFramebufferStencilSamples /// max stencil sample count for a framebuffer
1865 u32 maxColorAttachments /// max num of framebuffer color attachments
1866
1867 u32 maxSampledImageColorSamples /// max num of color samples for a non-integer sampled image
1868 u32 maxSampledImageDepthSamples /// max num of depth/stencil samples for a sampled image
1869 u32 maxSampledImageIntegerSamples /// max num of samples supported for an integer image
1870 u32 maxStorageImageSamples /// max num of samples for a storage image
1871 u32 maxSampleMaskWords /// max num of sample mask words
1872
1873 u64 timestampFrequency /// 1/clock_tick_granularity for timestamp queries
1874
1875 u32 maxClipDistances /// max number of clip distances
1876 u32 maxCullDistances /// max number of cull distances
1877 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
1878
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001879 f32[2] pointSizeRange /// range (min,max) of supported point sizes
1880 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07001881 f32 pointSizeGranularity /// granularity of supported point sizes
1882 f32 lineWidthGranularity /// granularity of supported line widths
1883}
1884
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001885class VkPhysicalDeviceSparseProperties {
1886 VkBool32 residencyStandard2DBlockShape /// Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard block shapes (based on pixel format)
1887 VkBool32 residencyStandard2DMSBlockShape /// Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard block shapes (based on pixel format)
1888 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
1889 VkBool32 residencyAlignedMipSize /// Sparse resources support: Images with mip-level dimensions that are NOT a multiple of the block size will be placed in the mip tail
1890 VkBool32 residencyNonResident /// Sparse resources support: GPU can safely access non-resident regions of a resource, read values from read-write resources are undefined
1891 VkBool32 residencyNonResidentStrict /// Sparse resources support: GPU can safely access non-resident regions of a resource, all reads return as if data is 0, writes are discarded
1892}
1893
Jesse Halld27f6aa2015-08-15 17:58:48 -07001894class VkSemaphoreCreateInfo {
1895 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
1896 const void* pNext /// Pointer to next structure
1897 VkSemaphoreCreateFlags flags /// Semaphore creation flags
1898}
1899
1900class VkQueryPoolCreateInfo {
1901 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
1902 const void* pNext /// Pointer to next structure
1903 VkQueryType queryType
1904 u32 slots
1905 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
1906}
1907
1908class VkFramebufferCreateInfo {
1909 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
1910 const void* pNext /// Pointer to next structure
1911 VkRenderPass renderPass
1912 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001913 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07001914 u32 width
1915 u32 height
1916 u32 layers
1917}
1918
1919class VkDrawIndirectCmd {
1920 u32 vertexCount
1921 u32 instanceCount
1922 u32 firstVertex
1923 u32 firstInstance
1924}
1925
1926class VkDrawIndexedIndirectCmd {
1927 u32 indexCount
1928 u32 instanceCount
1929 u32 firstIndex
1930 s32 vertexOffset
1931 u32 firstInstance
1932}
1933
1934class VkDispatchIndirectCmd {
1935 u32 x
1936 u32 y
1937 u32 z
1938}
1939
1940
1941////////////////
1942// Commands //
1943////////////////
1944
1945// Function pointers. TODO: add support for function pointers.
1946
1947@external type void* PFN_vkVoidFunction
1948@pfn cmd void vkVoidFunction() {
1949}
1950
1951@external type void* PFN_vkAllocFunction
1952@pfn cmd void* vkAllocFunction(
1953 void* pUserData,
1954 platform.size_t size,
1955 platform.size_t alignment,
1956 VkSystemAllocType allocType) {
1957 return ?
1958}
1959
1960@external type void* PFN_vkFreeFunction
1961@pfn cmd void vkFreeFunction(
1962 void* pUserData,
1963 void* pMem) {
1964}
1965
1966
1967// Global functions
1968
1969@threadSafety("system")
1970cmd VkResult vkCreateInstance(
1971 const VkInstanceCreateInfo* pCreateInfo,
1972 VkInstance* pInstance) {
1973 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
1974
1975 instance := ?
1976 pInstance[0] = instance
1977 State.Instances[instance] = new!InstanceObject()
1978
1979 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.layerCount]
1980 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.extensionCount]
1981
1982 return ?
1983}
1984
1985@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001986cmd void vkDestroyInstance(
Jesse Halld27f6aa2015-08-15 17:58:48 -07001987 VkInstance instance) {
1988 instanceObject := GetInstance(instance)
1989
1990 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07001991}
1992
1993@threadSafety("system")
1994cmd VkResult vkEnumeratePhysicalDevices(
1995 VkInstance instance,
1996 u32* pPhysicalDeviceCount,
1997 VkPhysicalDevice* pPhysicalDevices) {
1998 instanceObject := GetInstance(instance)
1999
2000 physicalDeviceCount := as!u32(?)
2001 pPhysicalDeviceCount[0] = physicalDeviceCount
2002 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2003
2004 for i in (0 .. physicalDeviceCount) {
2005 physicalDevice := ?
2006 physicalDevices[i] = physicalDevice
2007 if !(physicalDevice in State.PhysicalDevices) {
2008 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2009 }
2010 }
2011
2012 return ?
2013}
2014
2015cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2016 VkDevice device,
2017 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002018 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002019 device := GetDevice(device)
2020 }
2021
2022 return ?
2023}
2024
2025cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2026 VkInstance instance,
2027 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002028 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002029 instanceObject := GetInstance(instance)
2030 }
2031
2032 return ?
2033}
2034
2035cmd VkResult vkGetPhysicalDeviceProperties(
2036 VkPhysicalDevice physicalDevice,
2037 VkPhysicalDeviceProperties* pProperties) {
2038 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2039
2040 properties := ?
2041 pProperties[0] = properties
2042
2043 return ?
2044}
2045
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002046cmd VkResult vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002047 VkPhysicalDevice physicalDevice,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002048 u32* pCount,
2049 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002050 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002051 // TODO: Figure out how to express fetch-count-or-properties
2052 // This version fails 'apic validate' with 'fence not allowed in
2053 // *semantic.Branch'. Other attempts have failed with the same or other
2054 // errors.
2055 // if pQueueFamilyProperties != null {
2056 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2057 // for i in (0 .. pCount[0]) {
2058 // queueProperties := as!VkQueueFamilyProperties(?)
2059 // queuesProperties[i] = queueProperties
2060 // }
2061 // } else {
2062 // count := ?
2063 // pCount[0] = count
2064 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002065 return ?
2066}
2067
2068cmd VkResult vkGetPhysicalDeviceMemoryProperties(
2069 VkPhysicalDevice physicalDevice,
2070 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2071 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2072
2073 memoryProperties := ?
2074 pMemoryProperties[0] = memoryProperties
2075
2076 return ?
2077}
2078
2079cmd VkResult vkGetPhysicalDeviceFeatures(
2080 VkPhysicalDevice physicalDevice,
2081 VkPhysicalDeviceFeatures* pFeatures) {
2082 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2083
2084 features := ?
2085 pFeatures[0] = features
2086
2087 return ?
2088}
2089
2090cmd VkResult vkGetPhysicalDeviceFormatProperties(
2091 VkPhysicalDevice physicalDevice,
2092 VkFormat format,
2093 VkFormatProperties* pFormatProperties) {
2094 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2095
2096 formatProperties := ?
2097 pFormatProperties[0] = formatProperties
2098
2099 return ?
2100}
2101
2102cmd VkResult vkGetPhysicalDeviceImageFormatProperties(
2103 VkPhysicalDevice physicalDevice,
2104 VkFormat format,
2105 VkImageType type,
2106 VkImageTiling tiling,
2107 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002108 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002109 VkImageFormatProperties* pImageFormatProperties) {
2110 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2111
2112 imageFormatProperties := ?
2113 pImageFormatProperties[0] = imageFormatProperties
2114
2115 return ?
2116}
2117
Jesse Halld27f6aa2015-08-15 17:58:48 -07002118
2119// Device functions
2120
2121@threadSafety("system")
2122cmd VkResult vkCreateDevice(
2123 VkPhysicalDevice physicalDevice,
2124 const VkDeviceCreateInfo* pCreateInfo,
2125 VkDevice* pDevice) {
2126 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2127 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2128
2129 device := ?
2130 pDevice[0] = device
2131 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2132
2133 return ?
2134}
2135
2136@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002137cmd void vkDestroyDevice(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002138 VkDevice device) {
2139 deviceObject := GetDevice(device)
2140
2141 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002142}
2143
2144
2145// Extension discovery functions
2146
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002147cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002148 u32* pCount,
2149 VkLayerProperties* pProperties) {
2150 count := as!u32(?)
2151 pCount[0] = count
2152
2153 properties := pProperties[0:count]
2154 for i in (0 .. count) {
2155 property := ?
2156 properties[i] = property
2157 }
2158
2159 return ?
2160}
2161
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002162cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002163 const char* pLayerName,
2164 u32* pCount,
2165 VkExtensionProperties* pProperties) {
2166 count := as!u32(?)
2167 pCount[0] = count
2168
2169 properties := pProperties[0:count]
2170 for i in (0 .. count) {
2171 property := ?
2172 properties[i] = property
2173 }
2174
2175 return ?
2176}
2177
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002178cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002179 VkPhysicalDevice physicalDevice,
2180 u32* pCount,
2181 VkLayerProperties* pProperties) {
2182 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2183 count := as!u32(?)
2184 pCount[0] = count
2185
2186 properties := pProperties[0:count]
2187 for i in (0 .. count) {
2188 property := ?
2189 properties[i] = property
2190 }
2191
2192 return ?
2193}
2194
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002195cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002196 VkPhysicalDevice physicalDevice,
2197 const char* pLayerName,
2198 u32* pCount,
2199 VkExtensionProperties* pProperties) {
2200 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2201
2202 count := as!u32(?)
2203 pCount[0] = count
2204
2205 properties := pProperties[0:count]
2206 for i in (0 .. count) {
2207 property := ?
2208 properties[i] = property
2209 }
2210
2211 return ?
2212}
2213
2214
2215// Queue functions
2216
2217@threadSafety("system")
2218cmd VkResult vkGetDeviceQueue(
2219 VkDevice device,
2220 u32 queueFamilyIndex,
2221 u32 queueIndex,
2222 VkQueue* pQueue) {
2223 deviceObject := GetDevice(device)
2224
2225 queue := ?
2226 pQueue[0] = queue
2227
2228 if !(queue in State.Queues) {
2229 State.Queues[queue] = new!QueueObject(device: device)
2230 }
2231
2232 return ?
2233}
2234
2235@threadSafety("app")
2236cmd VkResult vkQueueSubmit(
2237 VkQueue queue,
2238 u32 cmdBufferCount,
2239 const VkCmdBuffer* pCmdBuffers,
2240 VkFence fence) {
2241 queueObject := GetQueue(queue)
2242
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002243 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002244 fenceObject := GetFence(fence)
2245 assert(fenceObject.device == queueObject.device)
2246 }
2247
2248 cmdBuffers := pCmdBuffers[0:cmdBufferCount]
2249 for i in (0 .. cmdBufferCount) {
2250 cmdBuffer := cmdBuffers[i]
2251 cmdBufferObject := GetCmdBuffer(cmdBuffer)
2252 assert(cmdBufferObject.device == queueObject.device)
2253
2254 validate("QueueCheck", cmdBufferObject.queueFlags in queueObject.flags,
2255 "vkQueueSubmit: enqueued cmdBuffer requires missing queue capabilities.")
2256 }
2257
2258 return ?
2259}
2260
2261@threadSafety("system")
2262cmd VkResult vkQueueWaitIdle(
2263 VkQueue queue) {
2264 queueObject := GetQueue(queue)
2265
2266 return ?
2267}
2268
2269@threadSafety("system")
2270cmd VkResult vkDeviceWaitIdle(
2271 VkDevice device) {
2272 deviceObject := GetDevice(device)
2273
2274 return ?
2275}
2276
2277
2278// Memory functions
2279
2280@threadSafety("system")
2281cmd VkResult vkAllocMemory(
2282 VkDevice device,
2283 const VkMemoryAllocInfo* pAllocInfo,
2284 VkDeviceMemory* pMem) {
2285 assert(pAllocInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO)
2286 deviceObject := GetDevice(device)
2287
2288 mem := ?
2289 pMem[0] = mem
2290 State.DeviceMemories[mem] = new!DeviceMemoryObject(
2291 device: device,
2292 allocationSize: pAllocInfo[0].allocationSize)
2293
2294 return ?
2295}
2296
2297@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002298cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002299 VkDevice device,
2300 VkDeviceMemory mem) {
2301 deviceObject := GetDevice(device)
2302 memObject := GetDeviceMemory(mem)
2303 assert(memObject.device == device)
2304
2305 // Check that no objects are still bound before freeing.
2306 validate("MemoryCheck", len(memObject.boundObjects) == 0,
2307 "vkFreeMemory: objects still bound")
2308 validate("MemoryCheck", len(memObject.boundCommandBuffers) == 0,
2309 "vkFreeMemory: cmdBuffers still bound")
2310 State.DeviceMemories[mem] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002311}
2312
2313@threadSafety("app")
2314cmd VkResult vkMapMemory(
2315 VkDevice device,
2316 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002317 VkDeviceSize offset,
2318 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002319 VkMemoryMapFlags flags,
2320 void** ppData) {
2321 deviceObject := GetDevice(device)
2322 memObject := GetDeviceMemory(mem)
2323 assert(memObject.device == device)
2324
2325 assert(flags == as!VkMemoryMapFlags(0))
2326 assert((offset + size) <= memObject.allocationSize)
2327
2328 return ?
2329}
2330
2331@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002332cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002333 VkDevice device,
2334 VkDeviceMemory mem) {
2335 deviceObject := GetDevice(device)
2336 memObject := GetDeviceMemory(mem)
2337 assert(memObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002338}
2339
2340cmd VkResult vkFlushMappedMemoryRanges(
2341 VkDevice device,
2342 u32 memRangeCount
2343 const VkMappedMemoryRange* pMemRanges) {
2344 deviceObject := GetDevice(device)
2345
2346 memRanges := pMemRanges[0:memRangeCount]
2347 for i in (0 .. memRangeCount) {
2348 memRange := memRanges[i]
2349 memObject := GetDeviceMemory(memRange.mem)
2350 assert(memObject.device == device)
2351 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2352 }
2353
2354 return ?
2355}
2356
2357cmd VkResult vkInvalidateMappedMemoryRanges(
2358 VkDevice device,
2359 u32 memRangeCount,
2360 const VkMappedMemoryRange* pMemRanges) {
2361 deviceObject := GetDevice(device)
2362
2363 memRanges := pMemRanges[0:memRangeCount]
2364 for i in (0 .. memRangeCount) {
2365 memRange := memRanges[i]
2366 memObject := GetDeviceMemory(memRange.mem)
2367 assert(memObject.device == device)
2368 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2369 }
2370
2371 return ?
2372}
2373
2374
2375// Memory management API functions
2376
2377cmd VkResult vkGetDeviceMemoryCommitment(
2378 VkDevice device,
2379 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002380 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002381 deviceObject := GetDevice(device)
2382
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002383 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002384 memoryObject := GetDeviceMemory(memory)
2385 assert(memoryObject.device == device)
2386 }
2387
2388 committedMemoryInBytes := ?
2389 pCommittedMemoryInBytes[0] = committedMemoryInBytes
2390
2391 return ?
2392}
2393
2394cmd VkResult vkGetBufferMemoryRequirements(
2395 VkDevice device,
2396 VkBuffer buffer,
2397 VkMemoryRequirements* pMemoryRequirements) {
2398 deviceObject := GetDevice(device)
2399 bufferObject := GetBuffer(buffer)
2400 assert(bufferObject.device == device)
2401
2402 return ?
2403}
2404
2405cmd VkResult vkBindBufferMemory(
2406 VkDevice device,
2407 VkBuffer buffer,
2408 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002409 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002410 deviceObject := GetDevice(device)
2411 bufferObject := GetBuffer(buffer)
2412 assert(bufferObject.device == device)
2413
2414 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002415 if bufferObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002416 memObject := GetDeviceMemory(bufferObject.mem)
2417 memObject.boundObjects[as!u64(buffer)] = null
2418 }
2419
2420 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002421 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002422 memObject := GetDeviceMemory(mem)
2423 assert(memObject.device == device)
2424 memObject.boundObjects[as!u64(buffer)] = memOffset
2425 }
2426 bufferObject.mem = mem
2427 bufferObject.memOffset = memOffset
2428
2429 return ?
2430}
2431
2432cmd VkResult vkGetImageMemoryRequirements(
2433 VkDevice device,
2434 VkImage image,
2435 VkMemoryRequirements* pMemoryRequirements) {
2436 deviceObject := GetDevice(device)
2437 imageObject := GetImage(image)
2438 assert(imageObject.device == device)
2439
2440 return ?
2441}
2442
2443cmd VkResult vkBindImageMemory(
2444 VkDevice device,
2445 VkImage image,
2446 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002447 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002448 deviceObject := GetDevice(device)
2449 imageObject := GetImage(image)
2450 assert(imageObject.device == device)
2451
2452 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002453 if imageObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002454 memObject := GetDeviceMemory(imageObject.mem)
2455 memObject.boundObjects[as!u64(image)] = null
2456 }
2457
2458 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002459 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002460 memObject := GetDeviceMemory(mem)
2461 assert(memObject.device == device)
2462 memObject.boundObjects[as!u64(image)] = memOffset
2463 }
2464 imageObject.mem = mem
2465 imageObject.memOffset = memOffset
2466
2467 return ?
2468}
2469
2470cmd VkResult vkGetImageSparseMemoryRequirements(
2471 VkDevice device,
2472 VkImage image,
2473 u32* pNumRequirements,
2474 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2475 deviceObject := GetDevice(device)
2476 imageObject := GetImage(image)
2477 assert(imageObject.device == device)
2478
2479 return ?
2480}
2481
2482cmd VkResult vkGetPhysicalDeviceSparseImageFormatProperties(
2483 VkPhysicalDevice physicalDevice,
2484 VkFormat format,
2485 VkImageType type,
2486 u32 samples,
2487 VkImageUsageFlags usage,
2488 VkImageTiling tiling,
2489 u32* pNumProperties,
2490 VkSparseImageFormatProperties* pProperties) {
2491 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2492
2493 return ?
2494}
2495
2496cmd VkResult vkQueueBindSparseBufferMemory(
2497 VkQueue queue,
2498 VkBuffer buffer,
2499 u32 numBindings,
2500 const VkSparseMemoryBindInfo* pBindInfo) {
2501 queueObject := GetQueue(queue)
2502 bufferObject := GetBuffer(buffer)
2503 assert(bufferObject.device == queueObject.device)
2504
2505 return ?
2506}
2507
2508cmd VkResult vkQueueBindSparseImageOpaqueMemory(
2509 VkQueue queue,
2510 VkImage image,
2511 u32 numBindings,
2512 const VkSparseMemoryBindInfo* pBindInfo) {
2513 queueObject := GetQueue(queue)
2514 imageObject := GetImage(image)
2515 assert(imageObject.device == queueObject.device)
2516
2517 return ?
2518}
2519
2520
2521cmd VkResult vkQueueBindSparseImageMemory(
2522 VkQueue queue,
2523 VkImage image,
2524 u32 numBindings,
2525 const VkSparseImageMemoryBindInfo* pBindInfo) {
2526 queueObject := GetQueue(queue)
2527 imageObject := GetImage(image)
2528
2529 return ?
2530}
2531
2532
2533// Fence functions
2534
2535@threadSafety("system")
2536cmd VkResult vkCreateFence(
2537 VkDevice device,
2538 const VkFenceCreateInfo* pCreateInfo,
2539 VkFence* pFence) {
2540 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
2541 deviceObject := GetDevice(device)
2542
2543 fence := ?
2544 pFence[0] = fence
2545 State.Fences[fence] = new!FenceObject(
2546 device: device, signaled: (pCreateInfo.flags == VK_FENCE_CREATE_SIGNALED_BIT))
2547
2548 return ?
2549}
2550
2551@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002552cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002553 VkDevice device,
2554 VkFence fence) {
2555 deviceObject := GetDevice(device)
2556 fenceObject := GetFence(fence)
2557 assert(fenceObject.device == device)
2558
2559 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002560}
2561
2562@threadSafety("system")
2563cmd VkResult vkResetFences(
2564 VkDevice device,
2565 u32 fenceCount,
2566 const VkFence* pFences) {
2567 deviceObject := GetDevice(device)
2568
2569 fences := pFences[0:fenceCount]
2570 for i in (0 .. fenceCount) {
2571 fence := fences[i]
2572 fenceObject := GetFence(fence)
2573 assert(fenceObject.device == device)
2574 fenceObject.signaled = false
2575 }
2576
2577 return ?
2578}
2579
2580@threadSafety("system")
2581cmd VkResult vkGetFenceStatus(
2582 VkDevice device,
2583 VkFence fence) {
2584 deviceObject := GetDevice(device)
2585 fenceObject := GetFence(fence)
2586 assert(fenceObject.device == device)
2587
2588 return ?
2589}
2590
2591@threadSafety("system")
2592cmd VkResult vkWaitForFences(
2593 VkDevice device,
2594 u32 fenceCount,
2595 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002596 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002597 u64 timeout) { /// timeout in nanoseconds
2598 deviceObject := GetDevice(device)
2599
2600 fences := pFences[0:fenceCount]
2601 for i in (0 .. fenceCount) {
2602 fence := fences[i]
2603 fenceObject := GetFence(fence)
2604 assert(fenceObject.device == device)
2605 }
2606
2607 return ?
2608}
2609
2610
2611// Queue semaphore functions
2612
2613@threadSafety("system")
2614cmd VkResult vkCreateSemaphore(
2615 VkDevice device,
2616 const VkSemaphoreCreateInfo* pCreateInfo,
2617 VkSemaphore* pSemaphore) {
2618 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
2619 deviceObject := GetDevice(device)
2620
2621 semaphore := ?
2622 pSemaphore[0] = semaphore
2623 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
2624
2625 return ?
2626}
2627
2628@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002629cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002630 VkDevice device,
2631 VkSemaphore semaphore) {
2632 deviceObject := GetDevice(device)
2633 semaphoreObject := GetSemaphore(semaphore)
2634 assert(semaphoreObject.device == device)
2635
2636 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002637}
2638
2639@threadSafety("app")
2640cmd VkResult vkQueueSignalSemaphore(
2641 VkQueue queue,
2642 VkSemaphore semaphore) {
2643 queueObject := GetQueue(queue)
2644 semaphoreObject := GetSemaphore(semaphore)
2645 assert(queueObject.device == semaphoreObject.device)
2646
2647 return ?
2648}
2649
2650@threadSafety("system")
2651cmd VkResult vkQueueWaitSemaphore(
2652 VkQueue queue,
2653 VkSemaphore semaphore) {
2654 queueObject := GetQueue(queue)
2655 semaphoreObject := GetSemaphore(semaphore)
2656 assert(queueObject.device == semaphoreObject.device)
2657
2658 return ?
2659}
2660
2661
2662// Event functions
2663
2664@threadSafety("system")
2665cmd VkResult vkCreateEvent(
2666 VkDevice device,
2667 const VkEventCreateInfo* pCreateInfo,
2668 VkEvent* pEvent) {
2669 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
2670 deviceObject := GetDevice(device)
2671
2672 event := ?
2673 pEvent[0] = event
2674 State.Events[event] = new!EventObject(device: device)
2675
2676 return ?
2677}
2678
2679@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002680cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002681 VkDevice device,
2682 VkEvent event) {
2683 deviceObject := GetDevice(device)
2684 eventObject := GetEvent(event)
2685 assert(eventObject.device == device)
2686
2687 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002688}
2689
2690@threadSafety("system")
2691cmd VkResult vkGetEventStatus(
2692 VkDevice device,
2693 VkEvent event) {
2694 deviceObject := GetDevice(device)
2695 eventObject := GetEvent(event)
2696 assert(eventObject.device == device)
2697
2698 return ?
2699}
2700
2701@threadSafety("system")
2702cmd VkResult vkSetEvent(
2703 VkDevice device,
2704 VkEvent event) {
2705 deviceObject := GetDevice(device)
2706 eventObject := GetEvent(event)
2707 assert(eventObject.device == device)
2708
2709 return ?
2710}
2711
2712@threadSafety("system")
2713cmd VkResult vkResetEvent(
2714 VkDevice device,
2715 VkEvent event) {
2716 deviceObject := GetDevice(device)
2717 eventObject := GetEvent(event)
2718 assert(eventObject.device == device)
2719
2720 return ?
2721}
2722
2723
2724// Query functions
2725
2726@threadSafety("system")
2727cmd VkResult vkCreateQueryPool(
2728 VkDevice device,
2729 const VkQueryPoolCreateInfo* pCreateInfo,
2730 VkQueryPool* pQueryPool) {
2731 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
2732 deviceObject := GetDevice(device)
2733
2734 queryPool := ?
2735 pQueryPool[0] = queryPool
2736 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
2737
2738 return ?
2739}
2740
2741@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002742cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002743 VkDevice device,
2744 VkQueryPool queryPool) {
2745 deviceObject := GetDevice(device)
2746 queryPoolObject := GetQueryPool(queryPool)
2747 assert(queryPoolObject.device == device)
2748
2749 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002750}
2751
2752@threadSafety("system")
2753cmd VkResult vkGetQueryPoolResults(
2754 VkDevice device,
2755 VkQueryPool queryPool,
2756 u32 startQuery,
2757 u32 queryCount,
2758 platform.size_t* pDataSize,
2759 void* pData,
2760 VkQueryResultFlags flags) {
2761 deviceObject := GetDevice(device)
2762 queryPoolObject := GetQueryPool(queryPool)
2763 assert(queryPoolObject.device == device)
2764
2765 dataSize := ?
2766 pDataSize[0] = dataSize
2767 data := pData[0:dataSize]
2768
2769 return ?
2770}
2771
2772// Buffer functions
2773
2774@threadSafety("system")
2775cmd VkResult vkCreateBuffer(
2776 VkDevice device,
2777 const VkBufferCreateInfo* pCreateInfo,
2778 VkBuffer* pBuffer) {
2779 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
2780 deviceObject := GetDevice(device)
2781
2782 buffer := ?
2783 pBuffer[0] = buffer
2784 State.Buffers[buffer] = new!BufferObject(device: device)
2785
2786 return ?
2787}
2788
2789@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002790cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002791 VkDevice device,
2792 VkBuffer buffer) {
2793 deviceObject := GetDevice(device)
2794 bufferObject := GetBuffer(buffer)
2795 assert(bufferObject.device == device)
2796
2797 assert(bufferObject.mem == 0)
2798 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002799}
2800
2801
2802// Buffer view functions
2803
2804@threadSafety("system")
2805cmd VkResult vkCreateBufferView(
2806 VkDevice device,
2807 const VkBufferViewCreateInfo* pCreateInfo,
2808 VkBufferView* pView) {
2809 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
2810 deviceObject := GetDevice(device)
2811
2812 bufferObject := GetBuffer(pCreateInfo.buffer)
2813 assert(bufferObject.device == device)
2814
2815 view := ?
2816 pView[0] = view
2817 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
2818
2819 return ?
2820}
2821
2822@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002823cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002824 VkDevice device,
2825 VkBufferView bufferView) {
2826 deviceObject := GetDevice(device)
2827 bufferViewObject := GetBufferView(bufferView)
2828 assert(bufferViewObject.device == device)
2829
2830 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002831}
2832
2833
2834// Image functions
2835
2836@threadSafety("system")
2837cmd VkResult vkCreateImage(
2838 VkDevice device,
2839 const VkImageCreateInfo* pCreateInfo,
2840 VkImage* pImage) {
2841 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
2842 deviceObject := GetDevice(device)
2843
2844 image := ?
2845 pImage[0] = image
2846 State.Images[image] = new!ImageObject(device: device)
2847
2848 return ?
2849}
2850
2851@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002852cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002853 VkDevice device,
2854 VkImage image) {
2855 deviceObject := GetDevice(device)
2856 imageObject := GetImage(image)
2857 assert(imageObject.device == device)
2858
2859 assert(imageObject.mem == 0)
2860 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002861}
2862
2863cmd VkResult vkGetImageSubresourceLayout(
2864 VkDevice device,
2865 VkImage image,
2866 const VkImageSubresource* pSubresource,
2867 VkSubresourceLayout* pLayout) {
2868 deviceObject := GetDevice(device)
2869 imageObject := GetImage(image)
2870 assert(imageObject.device == device)
2871
2872 return ?
2873}
2874
2875
2876// Image view functions
2877
2878@threadSafety("system")
2879cmd VkResult vkCreateImageView(
2880 VkDevice device,
2881 const VkImageViewCreateInfo* pCreateInfo,
2882 VkImageView* pView) {
2883 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
2884 deviceObject := GetDevice(device)
2885
2886 imageObject := GetImage(pCreateInfo.image)
2887 assert(imageObject.device == device)
2888
2889 view := ?
2890 pView[0] = view
2891 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
2892
2893 return ?
2894}
2895
2896@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002897cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002898 VkDevice device,
2899 VkImageView imageView) {
2900 deviceObject := GetDevice(device)
2901 imageViewObject := GetImageView(imageView)
2902 assert(imageViewObject.device == device)
2903
2904 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002905}
2906
2907
2908// Shader functions
2909
2910cmd VkResult vkCreateShaderModule(
2911 VkDevice device,
2912 const VkShaderModuleCreateInfo* pCreateInfo,
2913 VkShaderModule* pShaderModule) {
2914 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
2915 deviceObject := GetDevice(device)
2916
2917 shaderModule := ?
2918 pShaderModule[0] = shaderModule
2919 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
2920
2921 return ?
2922}
2923
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002924cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002925 VkDevice device,
2926 VkShaderModule shaderModule) {
2927 deviceObject := GetDevice(device)
2928 shaderModuleObject := GetShaderModule(shaderModule)
2929 assert(shaderModuleObject.device == device)
2930
2931 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002932}
2933
2934@threadSafety("system")
2935cmd VkResult vkCreateShader(
2936 VkDevice device,
2937 const VkShaderCreateInfo* pCreateInfo,
2938 VkShader* pShader) {
2939 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO)
2940 deviceObject := GetDevice(device)
2941
2942 shader := ?
2943 pShader[0] = shader
2944 State.Shaders[shader] = new!ShaderObject(device: device)
2945
2946 return ?
2947}
2948
2949@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002950cmd void vkDestroyShader(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002951 VkDevice device,
2952 VkShader shader) {
2953 deviceObject := GetDevice(device)
2954 shaderObject := GetShader(shader)
2955 assert(shaderObject.device == device)
2956
2957 State.Shaders[shader] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002958}
2959
2960
2961// Pipeline functions
2962
2963cmd VkResult vkCreatePipelineCache(
2964 VkDevice device,
2965 const VkPipelineCacheCreateInfo* pCreateInfo,
2966 VkPipelineCache* pPipelineCache) {
2967 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
2968 deviceObject := GetDevice(device)
2969
2970 pipelineCache := ?
2971 pPipelineCache[0] = pipelineCache
2972 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
2973
2974 return ?
2975}
2976
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002977cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002978 VkDevice device,
2979 VkPipelineCache pipelineCache) {
2980 deviceObject := GetDevice(device)
2981 pipelineCacheObject := GetPipelineCache(pipelineCache)
2982 assert(pipelineCacheObject.device == device)
2983
2984 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002985}
2986
2987cmd platform.size_t vkGetPipelineCacheSize(
2988 VkDevice device,
2989 VkPipelineCache pipelineCache) {
2990 deviceObject := GetDevice(device)
2991 pipelineCacheObject := GetPipelineCache(pipelineCache)
2992 assert(pipelineCacheObject.device == device)
2993
2994 return ?
2995}
2996
2997cmd VkResult vkGetPipelineCacheData(
2998 VkDevice device,
2999 VkPipelineCache pipelineCache,
3000 void* pData) {
3001 deviceObject := GetDevice(device)
3002 pipelineCacheObject := GetPipelineCache(pipelineCache)
3003 assert(pipelineCacheObject.device == device)
3004
3005 return ?
3006}
3007
3008cmd VkResult vkMergePipelineCaches(
3009 VkDevice device,
3010 VkPipelineCache destCache,
3011 u32 srcCacheCount,
3012 const VkPipelineCache* pSrcCaches) {
3013 deviceObject := GetDevice(device)
3014 destCacheObject := GetPipelineCache(destCache)
3015 assert(destCacheObject.device == device)
3016
3017 srcCaches := pSrcCaches[0:srcCacheCount]
3018 for i in (0 .. srcCacheCount) {
3019 srcCache := srcCaches[i]
3020 srcCacheObject := GetPipelineCache(srcCache)
3021 assert(srcCacheObject.device == device)
3022 }
3023
3024 return ?
3025}
3026
3027cmd VkResult vkCreateGraphicsPipelines(
3028 VkDevice device,
3029 VkPipelineCache pipelineCache,
3030 u32 count,
3031 const VkGraphicsPipelineCreateInfo* pCreateInfos,
3032 VkPipeline* pPipelines) {
3033 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003034 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003035 pipelineCacheObject := GetPipelineCache(pipelineCache)
3036 assert(pipelineCacheObject.device == device)
3037 }
3038
3039 createInfos := pCreateInfos[0:count]
3040 pipelines := pPipelines[0:count]
3041 for i in (0 .. count) {
3042 pipeline := ?
3043 pipelines[i] = pipeline
3044 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3045 }
3046
3047 return ?
3048}
3049
3050cmd VkResult vkCreateComputePipelines(
3051 VkDevice device,
3052 VkPipelineCache pipelineCache,
3053 u32 count,
3054 const VkComputePipelineCreateInfo* pCreateInfos,
3055 VkPipeline* pPipelines) {
3056 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003057 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003058 pipelineCacheObject := GetPipelineCache(pipelineCache)
3059 assert(pipelineCacheObject.device == device)
3060 }
3061
3062 createInfos := pCreateInfos[0:count]
3063 pipelines := pPipelines[0:count]
3064 for i in (0 .. count) {
3065 pipeline := ?
3066 pipelines[i] = pipeline
3067 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3068 }
3069
3070 return ?
3071}
3072
3073@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003074cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003075 VkDevice device,
3076 VkPipeline pipeline) {
3077 deviceObject := GetDevice(device)
3078 pipelineObjects := GetPipeline(pipeline)
3079 assert(pipelineObjects.device == device)
3080
3081 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003082}
3083
3084
3085// Pipeline layout functions
3086
3087@threadSafety("system")
3088cmd VkResult vkCreatePipelineLayout(
3089 VkDevice device,
3090 const VkPipelineLayoutCreateInfo* pCreateInfo,
3091 VkPipelineLayout* pPipelineLayout) {
3092 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3093 deviceObject := GetDevice(device)
3094
3095 pipelineLayout := ?
3096 pPipelineLayout[0] = pipelineLayout
3097 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3098
3099 return ?
3100}
3101
3102@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003103cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003104 VkDevice device,
3105 VkPipelineLayout pipelineLayout) {
3106 deviceObject := GetDevice(device)
3107 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3108 assert(pipelineLayoutObjects.device == device)
3109
3110 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003111}
3112
3113
3114// Sampler functions
3115
3116@threadSafety("system")
3117cmd VkResult vkCreateSampler(
3118 VkDevice device,
3119 const VkSamplerCreateInfo* pCreateInfo,
3120 VkSampler* pSampler) {
3121 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3122 deviceObject := GetDevice(device)
3123
3124 sampler := ?
3125 pSampler[0] = sampler
3126 State.Samplers[sampler] = new!SamplerObject(device: device)
3127
3128 return ?
3129}
3130
3131@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003132cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003133 VkDevice device,
3134 VkSampler sampler) {
3135 deviceObject := GetDevice(device)
3136 samplerObject := GetSampler(sampler)
3137 assert(samplerObject.device == device)
3138
3139 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003140}
3141
3142
3143// Descriptor set functions
3144
3145@threadSafety("system")
3146cmd VkResult vkCreateDescriptorSetLayout(
3147 VkDevice device,
3148 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
3149 VkDescriptorSetLayout* pSetLayout) {
3150 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3151 deviceObject := GetDevice(device)
3152
3153 setLayout := ?
3154 pSetLayout[0] = setLayout
3155 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3156
3157 return ?
3158}
3159
3160@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003161cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003162 VkDevice device,
3163 VkDescriptorSetLayout descriptorSetLayout) {
3164 deviceObject := GetDevice(device)
3165 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3166 assert(descriptorSetLayoutObject.device == device)
3167
3168 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003169}
3170
3171@threadSafety("system")
3172cmd VkResult vkCreateDescriptorPool(
3173 VkDevice device,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003174 const VkDescriptorPoolCreateInfo* pCreateInfo
Jesse Halld27f6aa2015-08-15 17:58:48 -07003175 VkDescriptorPool* pDescriptorPool) {
3176 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3177 deviceObject := GetDevice(device)
3178
3179 descriptorPool := ?
3180 pDescriptorPool[0] = descriptorPool
3181 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3182
3183 return ?
3184}
3185
3186@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003187cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003188 VkDevice device,
3189 VkDescriptorPool descriptorPool) {
3190 deviceObject := GetDevice(device)
3191 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3192 assert(descriptorPoolObject.device == device)
3193
3194 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003195}
3196
3197@threadSafety("app")
3198cmd VkResult vkResetDescriptorPool(
3199 VkDevice device,
3200 VkDescriptorPool descriptorPool) {
3201 deviceObject := GetDevice(device)
3202 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3203 assert(descriptorPoolObject.device == device)
3204
3205 return ?
3206}
3207
3208@threadSafety("app")
3209cmd VkResult vkAllocDescriptorSets(
3210 VkDevice device,
3211 VkDescriptorPool descriptorPool,
3212 VkDescriptorSetUsage setUsage,
3213 u32 count,
3214 const VkDescriptorSetLayout* pSetLayouts,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003215 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003216 deviceObject := GetDevice(device)
3217 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3218
3219 setLayouts := pSetLayouts[0:count]
3220 for i in (0 .. count) {
3221 setLayout := setLayouts[i]
3222 setLayoutObject := GetDescriptorSetLayout(setLayout)
3223 assert(setLayoutObject.device == device)
3224 }
3225
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003226 descriptorSets := pDescriptorSets[0:count]
3227 for i in (0 .. count) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003228 descriptorSet := ?
3229 descriptorSets[i] = descriptorSet
3230 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3231 }
3232
3233 return ?
3234}
3235
Jesse Hallf09c6b12015-08-15 19:54:28 -07003236cmd VkResult vkFreeDescriptorSets(
3237 VkDevice device,
3238 VkDescriptorPool descriptorPool,
3239 u32 count,
3240 const VkDescriptorSet* pDescriptorSets) {
3241 deviceObject := GetDevice(device)
3242 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3243
3244 descriptorSets := pDescriptorSets[0:count]
3245 for i in (0 .. count) {
3246 descriptorSet := descriptorSets[i]
3247 descriptorSetObject := GetDescriptorSet(descriptorSet)
3248 assert(descriptorSetObject.device == device)
3249 State.DescriptorSets[descriptorSet] = null
3250 }
3251
3252 return ?
3253}
3254
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003255cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003256 VkDevice device,
3257 u32 writeCount,
3258 const VkWriteDescriptorSet* pDescriptorWrites,
3259 u32 copyCount,
3260 const VkCopyDescriptorSet* pDescriptorCopies) {
3261 deviceObject := GetDevice(device)
3262
3263 descriptorWrites := pDescriptorWrites[0:writeCount]
3264 for i in (0 .. writeCount) {
3265 descriptorWrite := descriptorWrites[i]
3266 descriptorWriteObject := GetDescriptorSet(descriptorWrite.destSet)
3267 assert(descriptorWriteObject.device == device)
3268 }
3269
3270 descriptorCopies := pDescriptorCopies[0:copyCount]
3271 for i in (0 .. copyCount) {
3272 descriptorCopy := descriptorCopies[i]
3273 descriptorCopyObject := GetDescriptorSet(descriptorCopy.destSet)
3274 assert(descriptorCopyObject.device == device)
3275 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003276}
3277
3278
3279// Framebuffer functions
3280
3281@threadSafety("system")
3282cmd VkResult vkCreateFramebuffer(
3283 VkDevice device,
3284 const VkFramebufferCreateInfo* pCreateInfo,
3285 VkFramebuffer* pFramebuffer) {
3286 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3287 deviceObject := GetDevice(device)
3288
3289 framebuffer := ?
3290 pFramebuffer[0] = framebuffer
3291 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3292
3293 return ?
3294}
3295
3296@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003297cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003298 VkDevice device,
3299 VkFramebuffer framebuffer) {
3300 deviceObject := GetDevice(device)
3301 framebufferObject := GetFramebuffer(framebuffer)
3302 assert(framebufferObject.device == device)
3303
3304 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003305}
3306
3307
3308// Renderpass functions
3309
3310@threadSafety("system")
3311cmd VkResult vkCreateRenderPass(
3312 VkDevice device,
3313 const VkRenderPassCreateInfo* pCreateInfo,
3314 VkRenderPass* pRenderPass) {
3315 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3316 deviceObject := GetDevice(device)
3317
3318 renderpass := ?
3319 pRenderPass[0] = renderpass
3320 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3321
3322 return ?
3323}
3324
3325@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003326cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003327 VkDevice device,
3328 VkRenderPass renderPass) {
3329 deviceObject := GetDevice(device)
3330 renderPassObject := GetRenderPass(renderPass)
3331 assert(renderPassObject.device == device)
3332
3333 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003334}
3335
3336cmd VkResult vkGetRenderAreaGranularity(
3337 VkDevice device,
3338 VkRenderPass renderPass,
3339 VkExtent2D* pGranularity) {
3340 deviceObject := GetDevice(device)
3341 renderPassObject := GetRenderPass(renderPass)
3342
3343 granularity := ?
3344 pGranularity[0] = granularity
3345
3346 return ?
3347}
3348
3349// Command pool functions
3350
3351cmd VkResult vkCreateCommandPool(
3352 VkDevice device,
3353 const VkCmdPoolCreateInfo* pCreateInfo,
3354 VkCmdPool* pCmdPool) {
3355 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO)
3356 deviceObject := GetDevice(device)
3357
3358 cmdPool := ?
3359 pCmdPool[0] = cmdPool
3360 State.CmdPools[cmdPool] = new!CmdPoolObject(device: device)
3361
3362 return ?
3363}
3364
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003365cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003366 VkDevice device,
3367 VkCmdPool cmdPool) {
3368 deviceObject := GetDevice(device)
3369 cmdPoolObject := GetCmdPool(cmdPool)
3370 assert(cmdPoolObject.device == device)
3371
3372 State.CmdPools[cmdPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003373}
3374
3375cmd VkResult vkResetCommandPool(
3376 VkDevice device,
3377 VkCmdPool cmdPool,
3378 VkCmdPoolResetFlags flags) {
3379 deviceObject := GetDevice(device)
3380 cmdPoolObject := GetCmdPool(cmdPool)
3381 assert(cmdPoolObject.device == device)
3382
3383 return ?
3384}
3385
3386// Command buffer functions
3387
3388macro void bindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3389 memoryObject := GetDeviceMemory(mem)
3390 memoryObject.boundCommandBuffers[cmdBuffer] = cmdBuffer
3391
3392 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3393 cmdBufferObject.boundObjects[as!u64(obj)] = mem
3394}
3395
3396macro void unbindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3397 memoryObject := GetDeviceMemory(mem)
3398 memoryObject.boundCommandBuffers[cmdBuffer] = null
3399
3400 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3401 cmdBufferObject.boundObjects[as!u64(obj)] = null
3402}
3403
3404@threadSafety("system")
3405cmd VkResult vkCreateCommandBuffer(
3406 VkDevice device,
3407 const VkCmdBufferCreateInfo* pCreateInfo,
3408 VkCmdBuffer* pCmdBuffer) {
3409 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO)
3410
3411 cmdBuffer := ?
3412 pCmdBuffer[0] = cmdBuffer
3413 State.CmdBuffers[cmdBuffer] = new!CmdBufferObject(device: device)
3414
3415 return ?
3416}
3417
3418@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003419cmd void vkDestroyCommandBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003420 VkDevice device,
3421 VkCmdBuffer commandBuffer) {
3422 deviceObject := GetDevice(device)
3423 cmdBufferObject := GetCmdBuffer(commandBuffer)
3424 assert(cmdBufferObject.device == device)
3425
3426 // TODO: iterate over boundObjects and clear memory bindings
3427 State.CmdBuffers[commandBuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003428}
3429
3430@threadSafety("app")
3431cmd VkResult vkBeginCommandBuffer(
3432 VkCmdBuffer cmdBuffer,
3433 const VkCmdBufferBeginInfo* pBeginInfo) {
3434 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO)
3435 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3436
3437 // TODO: iterate over boundObjects and clear memory bindings
3438
3439 return ?
3440}
3441
3442@threadSafety("app")
3443cmd VkResult vkEndCommandBuffer(
3444 VkCmdBuffer cmdBuffer) {
3445 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3446
3447 return ?
3448}
3449
3450@threadSafety("app")
3451cmd VkResult vkResetCommandBuffer(
3452 VkCmdBuffer cmdBuffer,
3453 VkCmdBufferResetFlags flags) {
3454 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3455
3456 // TODO: iterate over boundObjects and clear memory bindings
3457
3458 return ?
3459}
3460
3461
3462// Command buffer building functions
3463
3464@threadSafety("app")
3465cmd void vkCmdBindPipeline(
3466 VkCmdBuffer cmdBuffer,
3467 VkPipelineBindPoint pipelineBindPoint,
3468 VkPipeline pipeline) {
3469 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3470 pipelineObject := GetPipeline(pipeline)
3471 assert(cmdBufferObject.device == pipelineObject.device)
3472
3473 queueFlags := cmdBufferObject.queueFlags | switch (pipelineBindPoint) {
3474 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3475 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3476 }
3477 cmdBufferObject.queueFlags = queueFlags
3478}
3479
3480@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003481cmd void vkCmdSetViewport(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003482 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003483 u32 viewportCount,
3484 const VkViewport* pViewports) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003485 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003486 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3487 cmdBufferObject.queueFlags = queueFlags
3488}
3489
3490@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003491cmd void vkCmdSetScissor(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003492 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003493 u32 scissorCount,
3494 const VkRect2D* pScissors) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003495 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003496 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3497 cmdBufferObject.queueFlags = queueFlags
3498}
3499
3500@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003501cmd void vkCmdSetLineWidth(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003502 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003503 f32 lineWidth) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003504 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003505 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3506 cmdBufferObject.queueFlags = queueFlags
3507}
3508
3509@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003510cmd void vkCmdSetDepthBias(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003511 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003512 f32 depthBias,
3513 f32 depthBiasClamp,
3514 f32 slopeScaledDepthBias) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003515 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003516 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3517 cmdBufferObject.queueFlags = queueFlags
3518}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003519
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003520@threadSafety("app")
3521cmd void vkCmdSetBlendConstants(
3522 VkCmdBuffer cmdBuffer,
3523 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3524 // an annotation as a quick hack to pass this to the template without
3525 // having to modify the AST and semantic model.
3526 @readonly f32[4] blendConst) {
3527 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3528 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3529 cmdBufferObject.queueFlags = queueFlags
3530}
3531
3532@threadSafety("app")
3533cmd void vkCmdSetDepthBounds(
3534 VkCmdBuffer cmdBuffer,
3535 f32 minDepthBounds,
3536 f32 maxDepthBounds) {
3537 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3538 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3539 cmdBufferObject.queueFlags = queueFlags
3540}
3541
3542@threadSafety("app")
3543cmd void vkCmdSetStencilCompareMask(
3544 VkCmdBuffer cmdBuffer,
3545 VkStencilFaceFlags faceMask,
3546 u32 stencilCompareMask) {
3547 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3548 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3549 cmdBufferObject.queueFlags = queueFlags
3550}
3551
3552@threadSafety("app")
3553cmd void vkCmdSetStencilWriteMask(
3554 VkCmdBuffer cmdBuffer,
3555 VkStencilFaceFlags faceMask,
3556 u32 stencilWriteMask) {
3557 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3558 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3559 cmdBufferObject.queueFlags = queueFlags
3560}
3561
3562@threadSafety("app")
3563cmd void vkCmdSetStencilReference(
3564 VkCmdBuffer cmdBuffer,
3565 VkStencilFaceFlags faceMask,
3566 u32 stencilReference) {
3567 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003568 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3569 cmdBufferObject.queueFlags = queueFlags
3570}
3571
3572@threadSafety("app")
3573cmd void vkCmdBindDescriptorSets(
3574 VkCmdBuffer cmdBuffer,
3575 VkPipelineBindPoint pipelineBindPoint,
3576 VkPipelineLayout layout,
3577 u32 firstSet,
3578 u32 setCount,
3579 const VkDescriptorSet* pDescriptorSets,
3580 u32 dynamicOffsetCount,
3581 const u32* pDynamicOffsets) {
3582 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3583
3584 descriptorSets := pDescriptorSets[0:setCount]
3585 for i in (0 .. setCount) {
3586 descriptorSet := descriptorSets[i]
3587 descriptorSetObject := GetDescriptorSet(descriptorSet)
3588 assert(cmdBufferObject.device == descriptorSetObject.device)
3589 }
3590
3591 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
3592 for i in (0 .. dynamicOffsetCount) {
3593 dynamicOffset := dynamicOffsets[i]
3594 }
3595
3596 queueFlags := cmdBufferObject.queueFlags | switch (pipelineBindPoint) {
3597 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3598 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3599 }
3600 cmdBufferObject.queueFlags = queueFlags
3601}
3602
3603@threadSafety("app")
3604cmd void vkCmdBindIndexBuffer(
3605 VkCmdBuffer cmdBuffer,
3606 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003607 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003608 VkIndexType indexType) {
3609 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3610 bufferObject := GetBuffer(buffer)
3611 assert(cmdBufferObject.device == bufferObject.device)
3612
3613 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
3614
3615 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3616 cmdBufferObject.queueFlags = queueFlags
3617}
3618
3619@threadSafety("app")
3620cmd void vkCmdBindVertexBuffers(
3621 VkCmdBuffer cmdBuffer,
3622 u32 startBinding,
3623 u32 bindingCount,
3624 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003625 const VkDeviceSize* pOffsets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003626 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3627
3628 // TODO: check if not [startBinding:startBinding+bindingCount]
3629 buffers := pBuffers[0:bindingCount]
3630 offsets := pOffsets[0:bindingCount]
3631 for i in (0 .. bindingCount) {
3632 buffer := buffers[i]
3633 offset := offsets[i]
3634 bufferObject := GetBuffer(buffer)
3635 assert(cmdBufferObject.device == bufferObject.device)
3636
3637 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
3638 }
3639
3640 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3641 cmdBufferObject.queueFlags = queueFlags
3642}
3643
3644@threadSafety("app")
3645cmd void vkCmdDraw(
3646 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003647 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003648 u32 instanceCount,
3649 u32 firstVertex,
3650 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003651 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3652
3653 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3654 cmdBufferObject.queueFlags = queueFlags
3655}
3656
3657@threadSafety("app")
3658cmd void vkCmdDrawIndexed(
3659 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003660 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003661 u32 instanceCount,
3662 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003663 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003664 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003665 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3666
3667 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3668 cmdBufferObject.queueFlags = queueFlags
3669}
3670
3671@threadSafety("app")
3672cmd void vkCmdDrawIndirect(
3673 VkCmdBuffer cmdBuffer,
3674 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003675 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003676 u32 count,
3677 u32 stride) {
3678 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3679 bufferObject := GetBuffer(buffer)
3680 assert(cmdBufferObject.device == bufferObject.device)
3681
3682 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
3683
3684 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3685 cmdBufferObject.queueFlags = queueFlags
3686}
3687
3688@threadSafety("app")
3689cmd void vkCmdDrawIndexedIndirect(
3690 VkCmdBuffer cmdBuffer,
3691 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003692 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003693 u32 count,
3694 u32 stride) {
3695 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3696 bufferObject := GetBuffer(buffer)
3697 assert(cmdBufferObject.device == bufferObject.device)
3698
3699 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
3700
3701 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3702 cmdBufferObject.queueFlags = queueFlags
3703}
3704
3705@threadSafety("app")
3706cmd void vkCmdDispatch(
3707 VkCmdBuffer cmdBuffer,
3708 u32 x,
3709 u32 y,
3710 u32 z) {
3711 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3712
3713 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_COMPUTE_BIT
3714 cmdBufferObject.queueFlags = queueFlags
3715}
3716
3717@threadSafety("app")
3718cmd void vkCmdDispatchIndirect(
3719 VkCmdBuffer cmdBuffer,
3720 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003721 VkDeviceSize offset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003722 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3723 bufferObject := GetBuffer(buffer)
3724 assert(cmdBufferObject.device == bufferObject.device)
3725
3726 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
3727
3728 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_COMPUTE_BIT
3729 cmdBufferObject.queueFlags = queueFlags
3730}
3731
3732@threadSafety("app")
3733cmd void vkCmdCopyBuffer(
3734 VkCmdBuffer cmdBuffer,
3735 VkBuffer srcBuffer,
3736 VkBuffer destBuffer,
3737 u32 regionCount,
3738 const VkBufferCopy* pRegions) {
3739 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3740 srcBufferObject := GetBuffer(srcBuffer)
3741 destBufferObject := GetBuffer(destBuffer)
3742 assert(cmdBufferObject.device == srcBufferObject.device)
3743 assert(cmdBufferObject.device == destBufferObject.device)
3744
3745 regions := pRegions[0:regionCount]
3746 for i in (0 .. regionCount) {
3747 region := regions[i]
3748 }
3749
3750 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
3751 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
3752
3753 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT
3754 cmdBufferObject.queueFlags = queueFlags
3755}
3756
3757@threadSafety("app")
3758cmd void vkCmdCopyImage(
3759 VkCmdBuffer cmdBuffer,
3760 VkImage srcImage,
3761 VkImageLayout srcImageLayout,
3762 VkImage destImage,
3763 VkImageLayout destImageLayout,
3764 u32 regionCount,
3765 const VkImageCopy* pRegions) {
3766 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3767 srcImageObject := GetImage(srcImage)
3768 destImageObject := GetImage(destImage)
3769 assert(cmdBufferObject.device == srcImageObject.device)
3770 assert(cmdBufferObject.device == destImageObject.device)
3771
3772 regions := pRegions[0:regionCount]
3773 for i in (0 .. regionCount) {
3774 region := regions[i]
3775 }
3776
3777 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
3778 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
3779
3780 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT
3781 cmdBufferObject.queueFlags = queueFlags
3782}
3783
3784@threadSafety("app")
3785cmd void vkCmdBlitImage(
3786 VkCmdBuffer cmdBuffer,
3787 VkImage srcImage,
3788 VkImageLayout srcImageLayout,
3789 VkImage destImage,
3790 VkImageLayout destImageLayout,
3791 u32 regionCount,
3792 const VkImageBlit* pRegions,
3793 VkTexFilter filter) {
3794 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3795 srcImageObject := GetImage(srcImage)
3796 destImageObject := GetImage(destImage)
3797 assert(cmdBufferObject.device == srcImageObject.device)
3798 assert(cmdBufferObject.device == destImageObject.device)
3799
3800 regions := pRegions[0:regionCount]
3801 for i in (0 .. regionCount) {
3802 region := regions[i]
3803 }
3804
3805 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
3806 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
3807
3808 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3809 cmdBufferObject.queueFlags = queueFlags
3810}
3811
3812@threadSafety("app")
3813cmd void vkCmdCopyBufferToImage(
3814 VkCmdBuffer cmdBuffer,
3815 VkBuffer srcBuffer,
3816 VkImage destImage,
3817 VkImageLayout destImageLayout,
3818 u32 regionCount,
3819 const VkBufferImageCopy* pRegions) {
3820 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3821 srcBufferObject := GetBuffer(srcBuffer)
3822 destImageObject := GetImage(destImage)
3823 assert(cmdBufferObject.device == srcBufferObject.device)
3824 assert(cmdBufferObject.device == destImageObject.device)
3825
3826 regions := pRegions[0:regionCount]
3827 for i in (0 .. regionCount) {
3828 region := regions[i]
3829 }
3830
3831 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
3832 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
3833
3834 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT
3835 cmdBufferObject.queueFlags = queueFlags
3836}
3837
3838@threadSafety("app")
3839cmd void vkCmdCopyImageToBuffer(
3840 VkCmdBuffer cmdBuffer,
3841 VkImage srcImage,
3842 VkImageLayout srcImageLayout,
3843 VkBuffer destBuffer,
3844 u32 regionCount,
3845 const VkBufferImageCopy* pRegions) {
3846 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3847 srcImageObject := GetImage(srcImage)
3848 destBufferObject := GetBuffer(destBuffer)
3849 assert(cmdBufferObject.device == srcImageObject.device)
3850 assert(cmdBufferObject.device == destBufferObject.device)
3851
3852 regions := pRegions[0:regionCount]
3853 for i in (0 .. regionCount) {
3854 region := regions[i]
3855 }
3856
3857 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
3858 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
3859
3860 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT
3861 cmdBufferObject.queueFlags = queueFlags
3862}
3863
3864@threadSafety("app")
3865cmd void vkCmdUpdateBuffer(
3866 VkCmdBuffer cmdBuffer,
3867 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003868 VkDeviceSize destOffset,
3869 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003870 const u32* pData) {
3871 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3872 destBufferObject := GetBuffer(destBuffer)
3873 assert(cmdBufferObject.device == destBufferObject.device)
3874
3875 data := pData[0:dataSize]
3876
3877 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
3878
3879 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT
3880 cmdBufferObject.queueFlags = queueFlags
3881}
3882
3883@threadSafety("app")
3884cmd void vkCmdFillBuffer(
3885 VkCmdBuffer cmdBuffer,
3886 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003887 VkDeviceSize destOffset,
3888 VkDeviceSize fillSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003889 u32 data) {
3890 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3891 destBufferObject := GetBuffer(destBuffer)
3892 assert(cmdBufferObject.device == destBufferObject.device)
3893
3894 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT
3895 cmdBufferObject.queueFlags = queueFlags
3896}
3897
3898@threadSafety("app")
3899cmd void vkCmdClearColorImage(
3900 VkCmdBuffer cmdBuffer,
3901 VkImage image,
3902 VkImageLayout imageLayout,
3903 const VkClearColorValue* pColor,
3904 u32 rangeCount,
3905 const VkImageSubresourceRange* pRanges) {
3906 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3907 imageObject := GetImage(image)
3908 assert(cmdBufferObject.device == imageObject.device)
3909
3910 ranges := pRanges[0:rangeCount]
3911 for i in (0 .. rangeCount) {
3912 range := ranges[i]
3913 }
3914
3915 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
3916
3917 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3918 cmdBufferObject.queueFlags = queueFlags
3919}
3920
3921@threadSafety("app")
3922cmd void vkCmdClearDepthStencilImage(
3923 VkCmdBuffer cmdBuffer,
3924 VkImage image,
3925 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003926 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003927 u32 rangeCount,
3928 const VkImageSubresourceRange* pRanges) {
3929 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3930 imageObject := GetImage(image)
3931 assert(cmdBufferObject.device == imageObject.device)
3932
3933 ranges := pRanges[0:rangeCount]
3934 for i in (0 .. rangeCount) {
3935 range := ranges[i]
3936 }
3937
3938 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
3939
3940 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3941 cmdBufferObject.queueFlags = queueFlags
3942}
3943
3944@threadSafety("app")
3945cmd void vkCmdClearColorAttachment(
3946 VkCmdBuffer cmdBuffer,
3947 u32 colorAttachment,
3948 VkImageLayout imageLayout,
3949 const VkClearColorValue* pColor,
3950 u32 rectCount,
3951 const VkRect3D* pRects) {
3952 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3953
3954 rects := pRects[0:rectCount]
3955 for i in (0 .. rectCount) {
3956 rect := rects[i]
3957 }
3958
3959 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3960 cmdBufferObject.queueFlags = queueFlags
3961}
3962
3963@threadSafety("app")
3964cmd void vkCmdClearDepthStencilAttachment(
3965 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003966 VkImageAspectFlags aspectMask,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003967 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003968 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003969 u32 rectCount,
3970 const VkRect3D* pRects) {
3971 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3972
3973 rects := pRects[0:rectCount]
3974 for i in (0 .. rectCount) {
3975 rect := rects[i]
3976 }
3977
3978 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
3979 cmdBufferObject.queueFlags = queueFlags
3980}
3981
3982@threadSafety("app")
3983cmd void vkCmdResolveImage(
3984 VkCmdBuffer cmdBuffer,
3985 VkImage srcImage,
3986 VkImageLayout srcImageLayout,
3987 VkImage destImage,
3988 VkImageLayout destImageLayout,
3989 u32 regionCount,
3990 const VkImageResolve* pRegions) {
3991 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3992 srcImageObject := GetImage(srcImage)
3993 destImageObject := GetImage(destImage)
3994 assert(cmdBufferObject.device == srcImageObject.device)
3995 assert(cmdBufferObject.device == destImageObject.device)
3996
3997 regions := pRegions[0:regionCount]
3998 for i in (0 .. regionCount) {
3999 region := regions[i]
4000 }
4001
4002 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4003 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4004
4005 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
4006 cmdBufferObject.queueFlags = queueFlags
4007}
4008
4009@threadSafety("app")
4010cmd void vkCmdSetEvent(
4011 VkCmdBuffer cmdBuffer,
4012 VkEvent event,
4013 VkPipelineStageFlags stageMask) {
4014 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4015 eventObject := GetEvent(event)
4016 assert(cmdBufferObject.device == eventObject.device)
4017}
4018
4019@threadSafety("app")
4020cmd void vkCmdResetEvent(
4021 VkCmdBuffer cmdBuffer,
4022 VkEvent event,
4023 VkPipelineStageFlags stageMask) {
4024 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4025 eventObject := GetEvent(event)
4026 assert(cmdBufferObject.device == eventObject.device)
4027}
4028
4029@threadSafety("app")
4030cmd void vkCmdWaitEvents(
4031 VkCmdBuffer cmdBuffer,
4032 u32 eventCount,
4033 const VkEvent* pEvents,
4034 VkPipelineStageFlags srcStageMask,
4035 VkPipelineStageFlags destStageMask,
4036 u32 memBarrierCount,
4037 const void* const* ppMemBarriers) {
4038 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4039
4040 events := pEvents[0:eventCount]
4041 for i in (0 .. eventCount) {
4042 event := events[i]
4043 eventObject := GetEvent(event)
4044 assert(cmdBufferObject.device == eventObject.device)
4045 }
4046
4047 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4048 for i in (0 .. memBarrierCount) {
4049 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4050 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4051 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4052 }
4053 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4054 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4055 imageObject := GetImage(imageMemBarrier.image)
4056 assert(imageObject.device == cmdBufferObject.device)
4057 }
4058 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4059 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4060 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4061 assert(bufferObject.device == cmdBufferObject.device)
4062 }
4063 }
4064 }
4065}
4066
4067@threadSafety("app")
4068cmd void vkCmdPipelineBarrier(
4069 VkCmdBuffer cmdBuffer,
4070 VkPipelineStageFlags srcStageMask,
4071 VkPipelineStageFlags destStageMask,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004072 VkBool32 byRegion,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004073 u32 memBarrierCount,
4074 const void* const* ppMemBarriers) {
4075 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4076
4077 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4078 for i in (0 .. memBarrierCount) {
4079 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4080 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4081 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4082 }
4083 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4084 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4085 imageObject := GetImage(imageMemBarrier.image)
4086 assert(imageObject.device == cmdBufferObject.device)
4087 }
4088 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4089 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4090 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4091 assert(bufferObject.device == cmdBufferObject.device)
4092 }
4093 }
4094 }
4095}
4096
4097@threadSafety("app")
4098cmd void vkCmdBeginQuery(
4099 VkCmdBuffer cmdBuffer,
4100 VkQueryPool queryPool,
4101 u32 slot,
4102 VkQueryControlFlags flags) {
4103 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4104 queryPoolObject := GetQueryPool(queryPool)
4105 assert(cmdBufferObject.device == queryPoolObject.device)
4106}
4107
4108@threadSafety("app")
4109cmd void vkCmdEndQuery(
4110 VkCmdBuffer cmdBuffer,
4111 VkQueryPool queryPool,
4112 u32 slot) {
4113 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4114 queryPoolObject := GetQueryPool(queryPool)
4115 assert(cmdBufferObject.device == queryPoolObject.device)
4116}
4117
4118@threadSafety("app")
4119cmd void vkCmdResetQueryPool(
4120 VkCmdBuffer cmdBuffer,
4121 VkQueryPool queryPool,
4122 u32 startQuery,
4123 u32 queryCount) {
4124 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4125 queryPoolObject := GetQueryPool(queryPool)
4126 assert(cmdBufferObject.device == queryPoolObject.device)
4127}
4128
4129@threadSafety("app")
4130cmd void vkCmdWriteTimestamp(
4131 VkCmdBuffer cmdBuffer,
4132 VkTimestampType timestampType,
4133 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004134 VkDeviceSize destOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004135 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4136 destBufferObject := GetBuffer(destBuffer)
4137 assert(cmdBufferObject.device == destBufferObject.device)
4138}
4139
4140@threadSafety("app")
4141cmd void vkCmdCopyQueryPoolResults(
4142 VkCmdBuffer cmdBuffer,
4143 VkQueryPool queryPool,
4144 u32 startQuery,
4145 u32 queryCount,
4146 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004147 VkDeviceSize destOffset,
4148 VkDeviceSize destStride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004149 VkQueryResultFlags flags) {
4150 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4151 queryPoolObject := GetQueryPool(queryPool)
4152 destBufferObject := GetBuffer(destBuffer)
4153 assert(cmdBufferObject.device == queryPoolObject.device)
4154 assert(cmdBufferObject.device == destBufferObject.device)
4155}
4156
4157cmd void vkCmdPushConstants(
4158 VkCmdBuffer cmdBuffer,
4159 VkPipelineLayout layout,
4160 VkShaderStageFlags stageFlags,
4161 u32 start,
4162 u32 length,
4163 const void* values) {
4164 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4165 layoutObject := GetPipelineLayout(layout)
4166 assert(cmdBufferObject.device == layoutObject.device)
4167}
4168
4169@threadSafety("app")
4170cmd void vkCmdBeginRenderPass(
4171 VkCmdBuffer cmdBuffer,
4172 const VkRenderPassBeginInfo* pRenderPassBegin,
4173 VkRenderPassContents contents) {
4174 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4175 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4176 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
4177 assert(cmdBufferObject.device == renderPassObject.device)
4178 assert(cmdBufferObject.device == framebufferObject.device)
4179
4180 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
4181 cmdBufferObject.queueFlags = queueFlags
4182}
4183
4184cmd void vkCmdNextSubpass(
4185 VkCmdBuffer cmdBuffer,
4186 VkRenderPassContents contents) {
4187 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4188}
4189
4190@threadSafety("app")
4191cmd void vkCmdEndRenderPass(
4192 VkCmdBuffer cmdBuffer) {
4193 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4194
4195 queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT
4196 cmdBufferObject.queueFlags = queueFlags
4197}
4198
4199cmd void vkCmdExecuteCommands(
4200 VkCmdBuffer cmdBuffer,
4201 u32 cmdBuffersCount,
4202 const VkCmdBuffer* pCmdBuffers) {
4203 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4204
4205 cmdBuffers := pCmdBuffers[0:cmdBuffersCount]
4206 for i in (0 .. cmdBuffersCount) {
4207 secondaryCmdBuffer := cmdBuffers[i]
4208 secondaryCmdBufferObject := GetCmdBuffer(secondaryCmdBuffer)
4209 assert(cmdBufferObject.device == secondaryCmdBufferObject.device)
4210 }
4211}
4212
4213
4214////////////////
4215// Validation //
4216////////////////
4217
4218extern void validate(string layerName, bool condition, string message)
4219
4220
4221/////////////////////////////
4222// Internal State Tracking //
4223/////////////////////////////
4224
4225StateObject State
4226
4227@internal class StateObject {
4228 // Dispatchable objects.
4229 map!(VkInstance, ref!InstanceObject) Instances
4230 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4231 map!(VkDevice, ref!DeviceObject) Devices
4232 map!(VkQueue, ref!QueueObject) Queues
4233 map!(VkCmdBuffer, ref!CmdBufferObject) CmdBuffers
4234
4235 // Non-dispatchable objects.
4236 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4237 map!(VkBuffer, ref!BufferObject) Buffers
4238 map!(VkBufferView, ref!BufferViewObject) BufferViews
4239 map!(VkImage, ref!ImageObject) Images
4240 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004241 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
4242 map!(VkShader, ref!ShaderObject) Shaders
4243 map!(VkPipeline, ref!PipelineObject) Pipelines
4244 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4245 map!(VkSampler, ref!SamplerObject) Samplers
4246 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4247 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4248 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004249 map!(VkFence, ref!FenceObject) Fences
4250 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4251 map!(VkEvent, ref!EventObject) Events
4252 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4253 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4254 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4255 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
4256 map!(VkCmdPool, ref!CmdPoolObject) CmdPools
4257}
4258
4259@internal class InstanceObject {
4260}
4261
4262@internal class PhysicalDeviceObject {
4263 VkInstance instance
4264}
4265
4266@internal class DeviceObject {
4267 VkPhysicalDevice physicalDevice
4268}
4269
4270@internal class QueueObject {
4271 VkDevice device
4272 VkQueueFlags flags
4273}
4274
4275@internal class CmdBufferObject {
4276 VkDevice device
4277 map!(u64, VkDeviceMemory) boundObjects
4278 VkQueueFlags queueFlags
4279}
4280
4281@internal class DeviceMemoryObject {
4282 VkDevice device
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004283 VkDeviceSize allocationSize
4284 map!(u64, VkDeviceSize ) boundObjects
Jesse Halld27f6aa2015-08-15 17:58:48 -07004285 map!(VkCmdBuffer, VkCmdBuffer) boundCommandBuffers
4286}
4287
4288@internal class BufferObject {
4289 VkDevice device
4290 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004291 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07004292}
4293
4294@internal class BufferViewObject {
4295 VkDevice device
4296 VkBuffer buffer
4297}
4298
4299@internal class ImageObject {
4300 VkDevice device
4301 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004302 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07004303}
4304
4305@internal class ImageViewObject {
4306 VkDevice device
4307 VkImage image
4308}
4309
Jesse Halld27f6aa2015-08-15 17:58:48 -07004310@internal class ShaderObject {
4311 VkDevice device
4312}
4313
4314@internal class ShaderModuleObject {
4315 VkDevice device
4316}
4317
4318@internal class PipelineObject {
4319 VkDevice device
4320}
4321
4322@internal class PipelineLayoutObject {
4323 VkDevice device
4324}
4325
4326@internal class SamplerObject {
4327 VkDevice device
4328}
4329
4330@internal class DescriptorSetObject {
4331 VkDevice device
4332}
4333
4334@internal class DescriptorSetLayoutObject {
4335 VkDevice device
4336}
4337
4338@internal class DescriptorPoolObject {
4339 VkDevice device
4340}
4341
Jesse Halld27f6aa2015-08-15 17:58:48 -07004342@internal class FenceObject {
4343 VkDevice device
4344 bool signaled
4345}
4346
4347@internal class SemaphoreObject {
4348 VkDevice device
4349}
4350
4351@internal class EventObject {
4352 VkDevice device
4353}
4354
4355@internal class QueryPoolObject {
4356 VkDevice device
4357}
4358
4359@internal class FramebufferObject {
4360 VkDevice device
4361}
4362
4363@internal class RenderPassObject {
4364 VkDevice device
4365}
4366
4367@internal class PipelineCacheObject {
4368 VkDevice device
4369}
4370
4371@internal class CmdPoolObject {
4372 VkDevice device
4373}
4374
4375macro ref!InstanceObject GetInstance(VkInstance instance) {
4376 assert(instance in State.Instances)
4377 return State.Instances[instance]
4378}
4379
4380macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
4381 assert(physicalDevice in State.PhysicalDevices)
4382 return State.PhysicalDevices[physicalDevice]
4383}
4384
4385macro ref!DeviceObject GetDevice(VkDevice device) {
4386 assert(device in State.Devices)
4387 return State.Devices[device]
4388}
4389
4390macro ref!QueueObject GetQueue(VkQueue queue) {
4391 assert(queue in State.Queues)
4392 return State.Queues[queue]
4393}
4394
4395macro ref!CmdBufferObject GetCmdBuffer(VkCmdBuffer cmdBuffer) {
4396 assert(cmdBuffer in State.CmdBuffers)
4397 return State.CmdBuffers[cmdBuffer]
4398}
4399
4400macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory mem) {
4401 assert(mem in State.DeviceMemories)
4402 return State.DeviceMemories[mem]
4403}
4404
4405macro ref!BufferObject GetBuffer(VkBuffer buffer) {
4406 assert(buffer in State.Buffers)
4407 return State.Buffers[buffer]
4408}
4409
4410macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
4411 assert(bufferView in State.BufferViews)
4412 return State.BufferViews[bufferView]
4413}
4414
4415macro ref!ImageObject GetImage(VkImage image) {
4416 assert(image in State.Images)
4417 return State.Images[image]
4418}
4419
4420macro ref!ImageViewObject GetImageView(VkImageView imageView) {
4421 assert(imageView in State.ImageViews)
4422 return State.ImageViews[imageView]
4423}
4424
Jesse Halld27f6aa2015-08-15 17:58:48 -07004425macro ref!ShaderObject GetShader(VkShader shader) {
4426 assert(shader in State.Shaders)
4427 return State.Shaders[shader]
4428}
4429
4430macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
4431 assert(shaderModule in State.ShaderModules)
4432 return State.ShaderModules[shaderModule]
4433}
4434
4435macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
4436 assert(pipeline in State.Pipelines)
4437 return State.Pipelines[pipeline]
4438}
4439
4440macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
4441 assert(pipelineLayout in State.PipelineLayouts)
4442 return State.PipelineLayouts[pipelineLayout]
4443}
4444
4445macro ref!SamplerObject GetSampler(VkSampler sampler) {
4446 assert(sampler in State.Samplers)
4447 return State.Samplers[sampler]
4448}
4449
4450macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
4451 assert(descriptorSet in State.DescriptorSets)
4452 return State.DescriptorSets[descriptorSet]
4453}
4454
4455macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
4456 assert(descriptorSetLayout in State.DescriptorSetLayouts)
4457 return State.DescriptorSetLayouts[descriptorSetLayout]
4458}
4459
4460macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
4461 assert(descriptorPool in State.DescriptorPools)
4462 return State.DescriptorPools[descriptorPool]
4463}
4464
Jesse Halld27f6aa2015-08-15 17:58:48 -07004465macro ref!FenceObject GetFence(VkFence fence) {
4466 assert(fence in State.Fences)
4467 return State.Fences[fence]
4468}
4469
4470macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
4471 assert(semaphore in State.Semaphores)
4472 return State.Semaphores[semaphore]
4473}
4474
4475macro ref!EventObject GetEvent(VkEvent event) {
4476 assert(event in State.Events)
4477 return State.Events[event]
4478}
4479
4480macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
4481 assert(queryPool in State.QueryPools)
4482 return State.QueryPools[queryPool]
4483}
4484
4485macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
4486 assert(framebuffer in State.Framebuffers)
4487 return State.Framebuffers[framebuffer]
4488}
4489
4490macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
4491 assert(renderPass in State.RenderPasses)
4492 return State.RenderPasses[renderPass]
4493}
4494
4495macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
4496 assert(pipelineCache in State.PipelineCaches)
4497 return State.PipelineCaches[pipelineCache]
4498}
4499
4500macro ref!CmdPoolObject GetCmdPool(VkCmdPool cmdPool) {
4501 assert(cmdPool in State.CmdPools)
4502 return State.CmdPools[cmdPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07004503}