blob: b95c96e7fa47d0565db8f62576ccbe739c896817 [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 Hall03b6fe12015-11-24 12:44:21 -080030define VERSION_MINOR 188
Jesse Hallae38f732015-11-19 21:32:50 -080031define VERSION_PATCH 0
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
Jesse Hall1356b0d2015-11-23 17:24:58 -080048@extension("VK_EXT_KHR_surface") define VK_EXT_KHR_SURFACE_REVISION 19
49@extension("VK_EXT_KHR_surface") define VK_EXT_KHR_SURFACE_EXTENSION_NUMBER 1
50@extension("VK_EXT_KHR_surface") define VK_EXT_KHR_SURFACE_EXTENSION_NAME "VK_EXT_KHR_surface"
51
52@extension("VK_EXT_KHR_swapchain") define VK_EXT_KHR_SWAPCHAIN_REVISION 59
53@extension("VK_EXT_KHR_swapchain") define VK_EXT_KHR_SWAPCHAIN_EXTENSION_NUMBER 2
54@extension("VK_EXT_KHR_swapchain") define VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME "VK_EXT_KHR_swapchain"
55
56@extension("VK_EXT_KHR_display") define VK_EXT_KHR_DISPLAY_REVISION 16
57@extension("VK_EXT_KHR_display") define VK_EXT_KHR_DISPLAY_EXTENSION_NUMBER 3
58@extension("VK_EXT_KHR_display") define VK_EXT_KHR_DISPLAY_EXTENSION_NAME "VK_EXT_KHR_display"
59
60@extension("VK_EXT_KHR_display_swapchain") define VK_EXT_KHR_DISPLAY_REVISION 14
61@extension("VK_EXT_KHR_display_swapchain") define VK_EXT_KHR_DISPLAY_EXTENSION_NUMBER 4
62@extension("VK_EXT_KHR_display_swapchain") define VK_EXT_KHR_DISPLAY_EXTENSION_NAME "VK_EXT_KHR_display_swapchain"
63
64@extension("VK_EXT_KHR_x11_surface") define VK_EXT_KHR_X11_SURFACE_REVISION 1
65@extension("VK_EXT_KHR_x11_surface") define VK_EXT_KHR_X11_SURFACE_NUMBER 4
66@extension("VK_EXT_KHR_x11_surface") define VK_EXT_KHR_X11_SURFACE_NAME "VK_EXT_KHR_x11_surface"
67
68@extension("VK_EXT_KHR_xcb_surface") define VK_EXT_KHR_XCB_SURFACE_REVISION 1
69@extension("VK_EXT_KHR_xcb_surface") define VK_EXT_KHR_XCB_SURFACE_NUMBER 6
70@extension("VK_EXT_KHR_xcb_surface") define VK_EXT_KHR_XCB_SURFACE_NAME "VK_EXT_KHR_xcb_surface"
71
72@extension("VK_EXT_KHR_wayland_surface") define VK_EXT_KHR_WAYLAND_SURFACE_REVISION 1
73@extension("VK_EXT_KHR_wayland_surface") define VK_EXT_KHR_WAYLAND_SURFACE_NUMBER 7
74@extension("VK_EXT_KHR_wayland_surface") define VK_EXT_KHR_WAYLAND_SURFACE_NAME "VK_EXT_KHR_wayland_surface"
75
76@extension("VK_EXT_KHR_mir_surface") define VK_EXT_KHR_MIR_SURFACE_REVISION 1
77@extension("VK_EXT_KHR_mir_surface") define VK_EXT_KHR_MIR_SURFACE_NUMBER 8
78@extension("VK_EXT_KHR_mir_surface") define VK_EXT_KHR_MIR_SURFACE_NAME "VK_EXT_KHR_mir_surface"
79
80@extension("VK_EXT_KHR_android_surface") define VK_EXT_KHR_ANDROID_SURFACE_REVISION 1
81@extension("VK_EXT_KHR_android_surface") define VK_EXT_KHR_ANDROID_SURFACE_NUMBER 8
82@extension("VK_EXT_KHR_android_surface") define VK_EXT_KHR_ANDROID_SURFACE_NAME "VK_EXT_KHR_android_surface"
83
84@extension("VK_EXT_KHR_win32_surface") define VK_EXT_KHR_WIN32_SURFACE_REVISION 1
85@extension("VK_EXT_KHR_win32_surface") define VK_EXT_KHR_WIN32_SURFACE_NUMBER 9
86@extension("VK_EXT_KHR_win32_surface") define VK_EXT_KHR_WIN32_SURFACE_NAME "VK_EXT_KHR_win32_surface"
87
Jesse Halld27f6aa2015-08-15 17:58:48 -070088
89/////////////
90// Types //
91/////////////
92
Jesse Hall5ae3abb2015-10-08 14:00:22 -070093type u32 VkBool32
94type u32 VkFlags
95type u64 VkDeviceSize
96type u32 VkSampleMask
97
Jesse Halld27f6aa2015-08-15 17:58:48 -070098/// Dispatchable handle types.
99@dispatchHandle type u64 VkInstance
100@dispatchHandle type u64 VkPhysicalDevice
101@dispatchHandle type u64 VkDevice
102@dispatchHandle type u64 VkQueue
103@dispatchHandle type u64 VkCmdBuffer
104
105/// Non dispatchable handle types.
106@nonDispatchHandle type u64 VkDeviceMemory
107@nonDispatchHandle type u64 VkCmdPool
108@nonDispatchHandle type u64 VkBuffer
109@nonDispatchHandle type u64 VkBufferView
110@nonDispatchHandle type u64 VkImage
111@nonDispatchHandle type u64 VkImageView
Jesse Halld27f6aa2015-08-15 17:58:48 -0700112@nonDispatchHandle type u64 VkShaderModule
113@nonDispatchHandle type u64 VkShader
114@nonDispatchHandle type u64 VkPipeline
115@nonDispatchHandle type u64 VkPipelineLayout
116@nonDispatchHandle type u64 VkSampler
117@nonDispatchHandle type u64 VkDescriptorSet
118@nonDispatchHandle type u64 VkDescriptorSetLayout
119@nonDispatchHandle type u64 VkDescriptorPool
Jesse Halld27f6aa2015-08-15 17:58:48 -0700120@nonDispatchHandle type u64 VkFence
121@nonDispatchHandle type u64 VkSemaphore
122@nonDispatchHandle type u64 VkEvent
123@nonDispatchHandle type u64 VkQueryPool
124@nonDispatchHandle type u64 VkFramebuffer
125@nonDispatchHandle type u64 VkRenderPass
126@nonDispatchHandle type u64 VkPipelineCache
Jesse Hall1356b0d2015-11-23 17:24:58 -0800127
128@extension("VK_EXT_KHR_surface") @nonDispatchHandle type u64 VkSurfaceKHR
129
130@extension("VK_EXT_KHR_swapchain") @nonDispatchHandle type u64 VkSwapchainKHR
131
132@extension("VK_EXT_KHR_display") @nonDispatchHandle type u64 VkDisplayKHR
133@extension("VK_EXT_KHR_display") @nonDispatchHandle type u64 VkDisplayModeKHR
Jesse Halld27f6aa2015-08-15 17:58:48 -0700134
135
136/////////////
137// Enums //
138/////////////
139
140enum VkImageLayout {
141 VK_IMAGE_LAYOUT_UNDEFINED = 0x00000000, /// Implicit layout an image is when its contents are undefined due to various reasons (e.g. right after creation)
142 VK_IMAGE_LAYOUT_GENERAL = 0x00000001, /// General layout when image can be used for any kind of access
143 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 0x00000002, /// Optimal layout when image is only used for color attachment read/write
144 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 0x00000003, /// Optimal layout when image is only used for depth/stencil attachment read/write
145 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 0x00000004, /// Optimal layout when image is used for read only depth/stencil attachment and shader access
146 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 0x00000005, /// Optimal layout when image is used for read only shader access
147 VK_IMAGE_LAYOUT_TRANSFER_SOURCE_OPTIMAL = 0x00000006, /// Optimal layout when image is used only as source of transfer operations
148 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 -0700149 VK_IMAGE_LAYOUT_PREINITIALIZED = 0x00000008, /// Initial layout used when the data is populated by the CPU
Jesse Hall1356b0d2015-11-23 17:24:58 -0800150
151 //@extension("VK_EXT_KHR_swapchain")
152 VK_IMAGE_LAYOUT_PRESENT_SOURCE_KHR = 0xc0000802,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700153}
154
155enum VkAttachmentLoadOp {
156 VK_ATTACHMENT_LOAD_OP_LOAD = 0x00000000,
157 VK_ATTACHMENT_LOAD_OP_CLEAR = 0x00000001,
158 VK_ATTACHMENT_LOAD_OP_DONT_CARE = 0x00000002,
159}
160
161enum VkAttachmentStoreOp {
162 VK_ATTACHMENT_STORE_OP_STORE = 0x00000000,
163 VK_ATTACHMENT_STORE_OP_DONT_CARE = 0x00000001,
164}
165
166enum VkImageType {
167 VK_IMAGE_TYPE_1D = 0x00000000,
168 VK_IMAGE_TYPE_2D = 0x00000001,
169 VK_IMAGE_TYPE_3D = 0x00000002,
170}
171
172enum VkImageTiling {
173 VK_IMAGE_TILING_LINEAR = 0x00000000,
174 VK_IMAGE_TILING_OPTIMAL = 0x00000001,
175}
176
177enum VkImageViewType {
178 VK_IMAGE_VIEW_TYPE_1D = 0x00000000,
179 VK_IMAGE_VIEW_TYPE_2D = 0x00000001,
180 VK_IMAGE_VIEW_TYPE_3D = 0x00000002,
181 VK_IMAGE_VIEW_TYPE_CUBE = 0x00000003,
182 VK_IMAGE_VIEW_TYPE_1D_ARRAY = 0x00000004,
183 VK_IMAGE_VIEW_TYPE_2D_ARRAY = 0x00000005,
184 VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 0x00000006,
185}
186
Jesse Halld27f6aa2015-08-15 17:58:48 -0700187enum VkCmdBufferLevel {
188 VK_CMD_BUFFER_LEVEL_PRIMARY = 0x00000000,
189 VK_CMD_BUFFER_LEVEL_SECONDARY = 0x00000001,
190}
191
192enum VkChannelSwizzle {
193 VK_CHANNEL_SWIZZLE_ZERO = 0x00000000,
194 VK_CHANNEL_SWIZZLE_ONE = 0x00000001,
195 VK_CHANNEL_SWIZZLE_R = 0x00000002,
196 VK_CHANNEL_SWIZZLE_G = 0x00000003,
197 VK_CHANNEL_SWIZZLE_B = 0x00000004,
198 VK_CHANNEL_SWIZZLE_A = 0x00000005,
199}
200
201enum VkDescriptorType {
202 VK_DESCRIPTOR_TYPE_SAMPLER = 0x00000000,
203 VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 0x00000001,
204 VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 0x00000002,
205 VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 0x00000003,
206 VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 0x00000004,
207 VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 0x00000005,
208 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 0x00000006,
209 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 0x00000007,
210 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 0x00000008,
211 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 0x00000009,
212 VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 0x0000000a,
213}
214
Jesse Halld27f6aa2015-08-15 17:58:48 -0700215enum VkQueryType {
216 VK_QUERY_TYPE_OCCLUSION = 0x00000000,
217 VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, /// Optional
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800218 VK_QUERY_TYPE_TIMESTAMP = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700219}
220
Jesse Halld27f6aa2015-08-15 17:58:48 -0700221enum VkBorderColor {
222 VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0x00000000,
223 VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 0x00000001,
224 VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 0x00000002,
225 VK_BORDER_COLOR_INT_OPAQUE_BLACK = 0x00000003,
226 VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 0x00000004,
227 VK_BORDER_COLOR_INT_OPAQUE_WHITE = 0x00000005,
228}
229
230enum VkPipelineBindPoint {
231 VK_PIPELINE_BIND_POINT_COMPUTE = 0x00000000,
232 VK_PIPELINE_BIND_POINT_GRAPHICS = 0x00000001,
233}
234
235enum VkPrimitiveTopology {
236 VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0x00000000,
237 VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 0x00000001,
238 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 0x00000002,
239 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 0x00000003,
240 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 0x00000004,
241 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 0x00000005,
242 VK_PRIMITIVE_TOPOLOGY_LINE_LIST_ADJ = 0x00000006,
243 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_ADJ = 0x00000007,
244 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ = 0x00000008,
245 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJ = 0x00000009,
246 VK_PRIMITIVE_TOPOLOGY_PATCH = 0x0000000a,
247}
248
249enum VkSharingMode {
250 VK_SHARING_MODE_EXCLUSIVE = 0x00000000,
251 VK_SHARING_MODE_CONCURRENT = 0x00000001,
252}
253
254enum VkIndexType {
255 VK_INDEX_TYPE_UINT16 = 0x00000000,
256 VK_INDEX_TYPE_UINT32 = 0x00000001,
257}
258
259enum VkTexFilter {
260 VK_TEX_FILTER_NEAREST = 0x00000000,
261 VK_TEX_FILTER_LINEAR = 0x00000001,
262}
263
264enum VkTexMipmapMode {
265 VK_TEX_MIPMAP_MODE_BASE = 0x00000000, /// Always choose base level
266 VK_TEX_MIPMAP_MODE_NEAREST = 0x00000001, /// Choose nearest mip level
267 VK_TEX_MIPMAP_MODE_LINEAR = 0x00000002, /// Linear filter between mip levels
268}
269
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700270enum VkTexAddressMode {
271 VK_TEX_ADDRESS_MODE_WRAP = 0x00000000,
272 VK_TEX_ADDRESS_MODE_MIRROR = 0x00000001,
273 VK_TEX_ADDRESS_MODE_CLAMP = 0x00000002,
274 VK_TEX_ADDRESS_MODE_MIRROR_ONCE = 0x00000003,
275 VK_TEX_ADDRESS_MODE_CLAMP_BORDER = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700276}
277
278enum VkCompareOp {
279 VK_COMPARE_OP_NEVER = 0x00000000,
280 VK_COMPARE_OP_LESS = 0x00000001,
281 VK_COMPARE_OP_EQUAL = 0x00000002,
282 VK_COMPARE_OP_LESS_EQUAL = 0x00000003,
283 VK_COMPARE_OP_GREATER = 0x00000004,
284 VK_COMPARE_OP_NOT_EQUAL = 0x00000005,
285 VK_COMPARE_OP_GREATER_EQUAL = 0x00000006,
286 VK_COMPARE_OP_ALWAYS = 0x00000007,
287}
288
289enum VkFillMode {
290 VK_FILL_MODE_POINTS = 0x00000000,
291 VK_FILL_MODE_WIREFRAME = 0x00000001,
292 VK_FILL_MODE_SOLID = 0x00000002,
293}
294
295enum VkCullMode {
296 VK_CULL_MODE_NONE = 0x00000000,
297 VK_CULL_MODE_FRONT = 0x00000001,
298 VK_CULL_MODE_BACK = 0x00000002,
299 VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
300}
301
302enum VkFrontFace {
303 VK_FRONT_FACE_CCW = 0x00000000,
304 VK_FRONT_FACE_CW = 0x00000001,
305}
306
307enum VkBlend {
308 VK_BLEND_ZERO = 0x00000000,
309 VK_BLEND_ONE = 0x00000001,
310 VK_BLEND_SRC_COLOR = 0x00000002,
311 VK_BLEND_ONE_MINUS_SRC_COLOR = 0x00000003,
312 VK_BLEND_DEST_COLOR = 0x00000004,
313 VK_BLEND_ONE_MINUS_DEST_COLOR = 0x00000005,
314 VK_BLEND_SRC_ALPHA = 0x00000006,
315 VK_BLEND_ONE_MINUS_SRC_ALPHA = 0x00000007,
316 VK_BLEND_DEST_ALPHA = 0x00000008,
317 VK_BLEND_ONE_MINUS_DEST_ALPHA = 0x00000009,
318 VK_BLEND_CONSTANT_COLOR = 0x0000000a,
319 VK_BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0000000b,
320 VK_BLEND_CONSTANT_ALPHA = 0x0000000c,
321 VK_BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x0000000d,
322 VK_BLEND_SRC_ALPHA_SATURATE = 0x0000000e,
323 VK_BLEND_SRC1_COLOR = 0x0000000f,
324 VK_BLEND_ONE_MINUS_SRC1_COLOR = 0x00000010,
325 VK_BLEND_SRC1_ALPHA = 0x00000011,
326 VK_BLEND_ONE_MINUS_SRC1_ALPHA = 0x00000012,
327}
328
329enum VkBlendOp {
330 VK_BLEND_OP_ADD = 0x00000000,
331 VK_BLEND_OP_SUBTRACT = 0x00000001,
332 VK_BLEND_OP_REVERSE_SUBTRACT = 0x00000002,
333 VK_BLEND_OP_MIN = 0x00000003,
334 VK_BLEND_OP_MAX = 0x00000004,
335}
336
337enum VkStencilOp {
338 VK_STENCIL_OP_KEEP = 0x00000000,
339 VK_STENCIL_OP_ZERO = 0x00000001,
340 VK_STENCIL_OP_REPLACE = 0x00000002,
341 VK_STENCIL_OP_INC_CLAMP = 0x00000003,
342 VK_STENCIL_OP_DEC_CLAMP = 0x00000004,
343 VK_STENCIL_OP_INVERT = 0x00000005,
344 VK_STENCIL_OP_INC_WRAP = 0x00000006,
345 VK_STENCIL_OP_DEC_WRAP = 0x00000007,
346}
347
348enum VkLogicOp {
349 VK_LOGIC_OP_CLEAR = 0x00000000,
350 VK_LOGIC_OP_AND = 0x00000001,
351 VK_LOGIC_OP_AND_REVERSE = 0x00000002,
352 VK_LOGIC_OP_COPY = 0x00000003,
353 VK_LOGIC_OP_AND_INVERTED = 0x00000004,
354 VK_LOGIC_OP_NOOP = 0x00000005,
355 VK_LOGIC_OP_XOR = 0x00000006,
356 VK_LOGIC_OP_OR = 0x00000007,
357 VK_LOGIC_OP_NOR = 0x00000008,
358 VK_LOGIC_OP_EQUIV = 0x00000009,
359 VK_LOGIC_OP_INVERT = 0x0000000a,
360 VK_LOGIC_OP_OR_REVERSE = 0x0000000b,
361 VK_LOGIC_OP_COPY_INVERTED = 0x0000000c,
362 VK_LOGIC_OP_OR_INVERTED = 0x0000000d,
363 VK_LOGIC_OP_NAND = 0x0000000e,
364 VK_LOGIC_OP_SET = 0x0000000f,
365}
366
Jesse Hall03b6fe12015-11-24 12:44:21 -0800367enum VkSystemAllocScope {
368 VK_SYSTEM_ALLOC_SCOPE_FUNCTION = 0x00000000,
369 VK_SYSTEM_ALLOC_SCOPE_OBJECT = 0x00000001,
370 VK_SYSTEM_ALLOC_SCOPE_CACHE = 0x00000002,
371 VK_SYSTEM_ALLOC_SCOPE_DEVICE = 0x00000003,
372 VK_SYSTEM_ALLOC_SCOPE_INSTANCE = 0x00000004,
373}
374
375enum VkInternalAllocType {
376 VK_INTERNAL_ALLOC_TYPE_EXECUTABLE = 0x00000000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700377}
378
379enum VkPhysicalDeviceType {
380 VK_PHYSICAL_DEVICE_TYPE_OTHER = 0x00000000,
381 VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 0x00000001,
382 VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 0x00000002,
383 VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 0x00000003,
384 VK_PHYSICAL_DEVICE_TYPE_CPU = 0x00000004,
385}
386
387enum VkVertexInputStepRate {
388 VK_VERTEX_INPUT_STEP_RATE_VERTEX = 0x00000000,
389 VK_VERTEX_INPUT_STEP_RATE_INSTANCE = 0x00000001,
390}
391
392/// Vulkan format definitions
393enum VkFormat {
394 VK_FORMAT_UNDEFINED = 0x00000000,
395 VK_FORMAT_R4G4_UNORM = 0x00000001,
396 VK_FORMAT_R4G4_USCALED = 0x00000002,
397 VK_FORMAT_R4G4B4A4_UNORM = 0x00000003,
398 VK_FORMAT_R4G4B4A4_USCALED = 0x00000004,
399 VK_FORMAT_R5G6B5_UNORM = 0x00000005,
400 VK_FORMAT_R5G6B5_USCALED = 0x00000006,
401 VK_FORMAT_R5G5B5A1_UNORM = 0x00000007,
402 VK_FORMAT_R5G5B5A1_USCALED = 0x00000008,
403 VK_FORMAT_R8_UNORM = 0x00000009,
404 VK_FORMAT_R8_SNORM = 0x0000000A,
405 VK_FORMAT_R8_USCALED = 0x0000000B,
406 VK_FORMAT_R8_SSCALED = 0x0000000C,
407 VK_FORMAT_R8_UINT = 0x0000000D,
408 VK_FORMAT_R8_SINT = 0x0000000E,
409 VK_FORMAT_R8_SRGB = 0x0000000F,
410 VK_FORMAT_R8G8_UNORM = 0x00000010,
411 VK_FORMAT_R8G8_SNORM = 0x00000011,
412 VK_FORMAT_R8G8_USCALED = 0x00000012,
413 VK_FORMAT_R8G8_SSCALED = 0x00000013,
414 VK_FORMAT_R8G8_UINT = 0x00000014,
415 VK_FORMAT_R8G8_SINT = 0x00000015,
416 VK_FORMAT_R8G8_SRGB = 0x00000016,
417 VK_FORMAT_R8G8B8_UNORM = 0x00000017,
418 VK_FORMAT_R8G8B8_SNORM = 0x00000018,
419 VK_FORMAT_R8G8B8_USCALED = 0x00000019,
420 VK_FORMAT_R8G8B8_SSCALED = 0x0000001A,
421 VK_FORMAT_R8G8B8_UINT = 0x0000001B,
422 VK_FORMAT_R8G8B8_SINT = 0x0000001C,
423 VK_FORMAT_R8G8B8_SRGB = 0x0000001D,
424 VK_FORMAT_R8G8B8A8_UNORM = 0x0000001E,
425 VK_FORMAT_R8G8B8A8_SNORM = 0x0000001F,
426 VK_FORMAT_R8G8B8A8_USCALED = 0x00000020,
427 VK_FORMAT_R8G8B8A8_SSCALED = 0x00000021,
428 VK_FORMAT_R8G8B8A8_UINT = 0x00000022,
429 VK_FORMAT_R8G8B8A8_SINT = 0x00000023,
430 VK_FORMAT_R8G8B8A8_SRGB = 0x00000024,
431 VK_FORMAT_R10G10B10A2_UNORM = 0x00000025,
432 VK_FORMAT_R10G10B10A2_SNORM = 0x00000026,
433 VK_FORMAT_R10G10B10A2_USCALED = 0x00000027,
434 VK_FORMAT_R10G10B10A2_SSCALED = 0x00000028,
435 VK_FORMAT_R10G10B10A2_UINT = 0x00000029,
436 VK_FORMAT_R10G10B10A2_SINT = 0x0000002A,
437 VK_FORMAT_R16_UNORM = 0x0000002B,
438 VK_FORMAT_R16_SNORM = 0x0000002C,
439 VK_FORMAT_R16_USCALED = 0x0000002D,
440 VK_FORMAT_R16_SSCALED = 0x0000002E,
441 VK_FORMAT_R16_UINT = 0x0000002F,
442 VK_FORMAT_R16_SINT = 0x00000030,
443 VK_FORMAT_R16_SFLOAT = 0x00000031,
444 VK_FORMAT_R16G16_UNORM = 0x00000032,
445 VK_FORMAT_R16G16_SNORM = 0x00000033,
446 VK_FORMAT_R16G16_USCALED = 0x00000034,
447 VK_FORMAT_R16G16_SSCALED = 0x00000035,
448 VK_FORMAT_R16G16_UINT = 0x00000036,
449 VK_FORMAT_R16G16_SINT = 0x00000037,
450 VK_FORMAT_R16G16_SFLOAT = 0x00000038,
451 VK_FORMAT_R16G16B16_UNORM = 0x00000039,
452 VK_FORMAT_R16G16B16_SNORM = 0x0000003A,
453 VK_FORMAT_R16G16B16_USCALED = 0x0000003B,
454 VK_FORMAT_R16G16B16_SSCALED = 0x0000003C,
455 VK_FORMAT_R16G16B16_UINT = 0x0000003D,
456 VK_FORMAT_R16G16B16_SINT = 0x0000003E,
457 VK_FORMAT_R16G16B16_SFLOAT = 0x0000003F,
458 VK_FORMAT_R16G16B16A16_UNORM = 0x00000040,
459 VK_FORMAT_R16G16B16A16_SNORM = 0x00000041,
460 VK_FORMAT_R16G16B16A16_USCALED = 0x00000042,
461 VK_FORMAT_R16G16B16A16_SSCALED = 0x00000043,
462 VK_FORMAT_R16G16B16A16_UINT = 0x00000044,
463 VK_FORMAT_R16G16B16A16_SINT = 0x00000045,
464 VK_FORMAT_R16G16B16A16_SFLOAT = 0x00000046,
465 VK_FORMAT_R32_UINT = 0x00000047,
466 VK_FORMAT_R32_SINT = 0x00000048,
467 VK_FORMAT_R32_SFLOAT = 0x00000049,
468 VK_FORMAT_R32G32_UINT = 0x0000004A,
469 VK_FORMAT_R32G32_SINT = 0x0000004B,
470 VK_FORMAT_R32G32_SFLOAT = 0x0000004C,
471 VK_FORMAT_R32G32B32_UINT = 0x0000004D,
472 VK_FORMAT_R32G32B32_SINT = 0x0000004E,
473 VK_FORMAT_R32G32B32_SFLOAT = 0x0000004F,
474 VK_FORMAT_R32G32B32A32_UINT = 0x00000050,
475 VK_FORMAT_R32G32B32A32_SINT = 0x00000051,
476 VK_FORMAT_R32G32B32A32_SFLOAT = 0x00000052,
477 VK_FORMAT_R64_SFLOAT = 0x00000053,
478 VK_FORMAT_R64G64_SFLOAT = 0x00000054,
479 VK_FORMAT_R64G64B64_SFLOAT = 0x00000055,
480 VK_FORMAT_R64G64B64A64_SFLOAT = 0x00000056,
481 VK_FORMAT_R11G11B10_UFLOAT = 0x00000057,
482 VK_FORMAT_R9G9B9E5_UFLOAT = 0x00000058,
483 VK_FORMAT_D16_UNORM = 0x00000059,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700484 VK_FORMAT_D24_UNORM_X8 = 0x0000005A,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700485 VK_FORMAT_D32_SFLOAT = 0x0000005B,
486 VK_FORMAT_S8_UINT = 0x0000005C,
487 VK_FORMAT_D16_UNORM_S8_UINT = 0x0000005D,
488 VK_FORMAT_D24_UNORM_S8_UINT = 0x0000005E,
489 VK_FORMAT_D32_SFLOAT_S8_UINT = 0x0000005F,
490 VK_FORMAT_BC1_RGB_UNORM = 0x00000060,
491 VK_FORMAT_BC1_RGB_SRGB = 0x00000061,
492 VK_FORMAT_BC1_RGBA_UNORM = 0x00000062,
493 VK_FORMAT_BC1_RGBA_SRGB = 0x00000063,
494 VK_FORMAT_BC2_UNORM = 0x00000064,
495 VK_FORMAT_BC2_SRGB = 0x00000065,
496 VK_FORMAT_BC3_UNORM = 0x00000066,
497 VK_FORMAT_BC3_SRGB = 0x00000067,
498 VK_FORMAT_BC4_UNORM = 0x00000068,
499 VK_FORMAT_BC4_SNORM = 0x00000069,
500 VK_FORMAT_BC5_UNORM = 0x0000006A,
501 VK_FORMAT_BC5_SNORM = 0x0000006B,
502 VK_FORMAT_BC6H_UFLOAT = 0x0000006C,
503 VK_FORMAT_BC6H_SFLOAT = 0x0000006D,
504 VK_FORMAT_BC7_UNORM = 0x0000006E,
505 VK_FORMAT_BC7_SRGB = 0x0000006F,
506 VK_FORMAT_ETC2_R8G8B8_UNORM = 0x00000070,
507 VK_FORMAT_ETC2_R8G8B8_SRGB = 0x00000071,
508 VK_FORMAT_ETC2_R8G8B8A1_UNORM = 0x00000072,
509 VK_FORMAT_ETC2_R8G8B8A1_SRGB = 0x00000073,
510 VK_FORMAT_ETC2_R8G8B8A8_UNORM = 0x00000074,
511 VK_FORMAT_ETC2_R8G8B8A8_SRGB = 0x00000075,
512 VK_FORMAT_EAC_R11_UNORM = 0x00000076,
513 VK_FORMAT_EAC_R11_SNORM = 0x00000077,
514 VK_FORMAT_EAC_R11G11_UNORM = 0x00000078,
515 VK_FORMAT_EAC_R11G11_SNORM = 0x00000079,
516 VK_FORMAT_ASTC_4x4_UNORM = 0x0000007A,
517 VK_FORMAT_ASTC_4x4_SRGB = 0x0000007B,
518 VK_FORMAT_ASTC_5x4_UNORM = 0x0000007C,
519 VK_FORMAT_ASTC_5x4_SRGB = 0x0000007D,
520 VK_FORMAT_ASTC_5x5_UNORM = 0x0000007E,
521 VK_FORMAT_ASTC_5x5_SRGB = 0x0000007F,
522 VK_FORMAT_ASTC_6x5_UNORM = 0x00000080,
523 VK_FORMAT_ASTC_6x5_SRGB = 0x00000081,
524 VK_FORMAT_ASTC_6x6_UNORM = 0x00000082,
525 VK_FORMAT_ASTC_6x6_SRGB = 0x00000083,
526 VK_FORMAT_ASTC_8x5_UNORM = 0x00000084,
527 VK_FORMAT_ASTC_8x5_SRGB = 0x00000085,
528 VK_FORMAT_ASTC_8x6_UNORM = 0x00000086,
529 VK_FORMAT_ASTC_8x6_SRGB = 0x00000087,
530 VK_FORMAT_ASTC_8x8_UNORM = 0x00000088,
531 VK_FORMAT_ASTC_8x8_SRGB = 0x00000089,
532 VK_FORMAT_ASTC_10x5_UNORM = 0x0000008A,
533 VK_FORMAT_ASTC_10x5_SRGB = 0x0000008B,
534 VK_FORMAT_ASTC_10x6_UNORM = 0x0000008C,
535 VK_FORMAT_ASTC_10x6_SRGB = 0x0000008D,
536 VK_FORMAT_ASTC_10x8_UNORM = 0x0000008E,
537 VK_FORMAT_ASTC_10x8_SRGB = 0x0000008F,
538 VK_FORMAT_ASTC_10x10_UNORM = 0x00000090,
539 VK_FORMAT_ASTC_10x10_SRGB = 0x00000091,
540 VK_FORMAT_ASTC_12x10_UNORM = 0x00000092,
541 VK_FORMAT_ASTC_12x10_SRGB = 0x00000093,
542 VK_FORMAT_ASTC_12x12_UNORM = 0x00000094,
543 VK_FORMAT_ASTC_12x12_SRGB = 0x00000095,
544 VK_FORMAT_B4G4R4A4_UNORM = 0x00000096,
545 VK_FORMAT_B5G5R5A1_UNORM = 0x00000097,
546 VK_FORMAT_B5G6R5_UNORM = 0x00000098,
547 VK_FORMAT_B5G6R5_USCALED = 0x00000099,
548 VK_FORMAT_B8G8R8_UNORM = 0x0000009A,
549 VK_FORMAT_B8G8R8_SNORM = 0x0000009B,
550 VK_FORMAT_B8G8R8_USCALED = 0x0000009C,
551 VK_FORMAT_B8G8R8_SSCALED = 0x0000009D,
552 VK_FORMAT_B8G8R8_UINT = 0x0000009E,
553 VK_FORMAT_B8G8R8_SINT = 0x0000009F,
554 VK_FORMAT_B8G8R8_SRGB = 0x000000A0,
555 VK_FORMAT_B8G8R8A8_UNORM = 0x000000A1,
556 VK_FORMAT_B8G8R8A8_SNORM = 0x000000A2,
557 VK_FORMAT_B8G8R8A8_USCALED = 0x000000A3,
558 VK_FORMAT_B8G8R8A8_SSCALED = 0x000000A4,
559 VK_FORMAT_B8G8R8A8_UINT = 0x000000A5,
560 VK_FORMAT_B8G8R8A8_SINT = 0x000000A6,
561 VK_FORMAT_B8G8R8A8_SRGB = 0x000000A7,
562 VK_FORMAT_B10G10R10A2_UNORM = 0x000000A8,
563 VK_FORMAT_B10G10R10A2_SNORM = 0x000000A9,
564 VK_FORMAT_B10G10R10A2_USCALED = 0x000000AA,
565 VK_FORMAT_B10G10R10A2_SSCALED = 0x000000AB,
566 VK_FORMAT_B10G10R10A2_UINT = 0x000000AC,
567 VK_FORMAT_B10G10R10A2_SINT = 0x000000AD,
568}
569
Jesse Halld27f6aa2015-08-15 17:58:48 -0700570/// Structure type enumerant
571enum VkStructureType {
572 VK_STRUCTURE_TYPE_APPLICATION_INFO = 0,
573 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 1,
574 VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO = 2,
575 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 3,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700576 VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 4,
577 VK_STRUCTURE_TYPE_SHADER_CREATE_INFO = 5,
578 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 6,
579 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 7,
580 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 8,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800581 VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO = 9,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700582 VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10,
583 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 11,
584 VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 12,
585 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 13,
586 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 14,
587 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 15,
588 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 16,
589 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 17,
590 VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 18,
591 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 19,
592 VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO = 20,
593 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 21,
594 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 22,
595 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 23,
596 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 24,
597 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 25,
598 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 26,
599 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 27,
600 VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO = 28,
601 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 29,
602 VK_STRUCTURE_TYPE_MEMORY_BARRIER = 30,
603 VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 31,
604 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 32,
605 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33,
606 VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 34,
607 VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 35,
608 VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 36,
609 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 37,
610 VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 38,
611 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 39,
612 VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION = 40,
613 VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION = 41,
614 VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY = 42,
615 VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43,
616 VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO = 44,
617 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 45,
618 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 46,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800619 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO = 47,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800620 VK_STRUCTURE_TYPE_SUBMIT_INFO = 48,
621 VK_STRUCTURE_TYPE_LAYER_INSTANCE_CREATE_INFO = 49,
622 VK_STRUCTURE_TYPE_LAYER_DEVICE_CREATE_INFO = 50,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800623
624 //@extension("VK_EXT_KHR_swapchain")
625 VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 0xc0000801,
626
627 //@extension("VK_EXT_KHR_display")
628 VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 0xc0000c00,
629 VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_DISPLAY_PLAN_KHR = 0xc0000c01,
630
631 //@extension("VK_EXT_KHR_display_swapchain")
632 VK_STRUCTURE_TYPE_DISPLAY_SWAPCHAIN_CREATE_INFO_KHR = 0xc0001000,
633 VK_STRUCTURE_TYPE_DISPLAY_DISPLAY_PRESENT_INFO_KHR = 0xc0001001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700634}
635
636enum VkRenderPassContents {
637 VK_RENDER_PASS_CONTENTS_INLINE = 0x00000000,
638 VK_RENDER_PASS_CONTENTS_SECONDARY_CMD_BUFFERS = 0x00000001,
639}
640
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700641@lastUnused(-8)
Jesse Halld27f6aa2015-08-15 17:58:48 -0700642/// Error and return codes
643enum VkResult {
644 // Return codes for successful operation execution (positive values)
645 VK_SUCCESS = 0x00000000,
Jesse Halla15a4bf2015-11-19 22:48:02 -0800646 VK_NOT_READY = 0x00000001,
647 VK_TIMEOUT = 0x00000002,
648 VK_EVENT_SET = 0x00000003,
649 VK_EVENT_RESET = 0x00000004,
650 VK_INCOMPLETE = 0x00000005,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700651
Jesse Hall1356b0d2015-11-23 17:24:58 -0800652 //@extension("VK_EXT_KHR_swapchain")
653 VK_SUBOPTIMAL_KHR = 0x40000403,
654
Jesse Halld27f6aa2015-08-15 17:58:48 -0700655 // Error codes (negative values)
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700656 VK_ERROR_OUT_OF_HOST_MEMORY = 0xFFFFFFFF,
657 VK_ERROR_OUT_OF_DEVICE_MEMORY = 0xFFFFFFFE,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700658 VK_ERROR_INITIALIZATION_FAILED = 0xFFFFFFFD,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700659 VK_ERROR_DEVICE_LOST = 0xFFFFFFFC,
660 VK_ERROR_MEMORY_MAP_FAILED = 0xFFFFFFFB,
661 VK_ERROR_LAYER_NOT_PRESENT = 0xFFFFFFFA,
662 VK_ERROR_EXTENSION_NOT_PRESENT = 0xFFFFFFF9,
Jesse Hall606a54e2015-11-19 22:17:28 -0800663 VK_ERROR_FEATURE_NOT_PRESENT = 0xFFFFFFF8,
664 VK_ERROR_INCOMPATIBLE_DRIVER = 0xFFFFFFF7,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800665
666 //@extension("VK_EXT_KHR_swapchain")
667 VK_ERROR_OUT_OF_DATE_KHR = 0xC0000804,
668
669 //@extension("VK_EXT_KHR_display_swapchain")
670 VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = 0xC0001002,
671
672 //@extension("VK_EXT_KHR_android_surface")
673 VK_ERROR_INVALID_ANDROID_WINDOW_KHR = 0xC002400,
674 VK_ERROR_ANDROID_WINDOW_IN_USE_KHR = 0xC002401,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700675}
676
677enum VkDynamicState {
678 VK_DYNAMIC_STATE_VIEWPORT = 0x00000000,
679 VK_DYNAMIC_STATE_SCISSOR = 0x00000001,
680 VK_DYNAMIC_STATE_LINE_WIDTH = 0x00000002,
681 VK_DYNAMIC_STATE_DEPTH_BIAS = 0x00000003,
682 VK_DYNAMIC_STATE_BLEND_CONSTANTS = 0x00000004,
683 VK_DYNAMIC_STATE_DEPTH_BOUNDS = 0x00000005,
684 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 0x00000006,
685 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 0x00000007,
686 VK_DYNAMIC_STATE_STENCIL_REFERENCE = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700687}
688
Jesse Hall1356b0d2015-11-23 17:24:58 -0800689@extension("VK_EXT_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -0800690enum VkSurfaceTransformKHR {
691 VK_SURFACE_TRANSFORM_NONE_KHR = 0x00000000,
692 VK_SURFACE_TRANSFORM_ROT90_KHR = 0x00000001,
693 VK_SURFACE_TRANSFORM_ROT180_KHR = 0x00000002,
694 VK_SURFACE_TRANSFORM_ROT270_KHR = 0x00000003,
695 VK_SURFACE_TRANSFORM_HMIRROR_KHR = 0x00000004,
696 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_KHR = 0x00000005,
697 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_KHR = 0x00000006,
698 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_KHR = 0x00000007,
699 VK_SURFACE_TRANSFORM_INHERIT_KHR = 0x00000008,
700}
701
702@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -0800703enum VkPresentModeKHR {
704 VK_PRESENT_MODE_IMMEDIATE_KHR = 0x00000000,
705 VK_PRESENT_MODE_MAILBOX_KHR = 0x00000001,
706 VK_PRESENT_MODE_FIFO_KHR = 0x00000002,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800707 VK_PRESENT_MODE_FIFO_RELAXED_KHR = 0x00000003,
Michael Lentine88594d72015-11-12 12:49:45 -0800708}
709
Jesse Hall1356b0d2015-11-23 17:24:58 -0800710@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -0800711enum VkColorSpaceKHR {
712 VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000,
713}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700714
715/////////////////
716// Bitfields //
717/////////////////
718
Jesse Halld27f6aa2015-08-15 17:58:48 -0700719/// Queue capabilities
Jesse Halld8bade02015-11-24 10:24:18 -0800720type VkFlags VkQueueFlags
721bitfield VkQueueFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700722 VK_QUEUE_GRAPHICS_BIT = 0x00000001, /// Queue supports graphics operations
723 VK_QUEUE_COMPUTE_BIT = 0x00000002, /// Queue supports compute operations
724 VK_QUEUE_DMA_BIT = 0x00000004, /// Queue supports DMA operations
725 VK_QUEUE_SPARSE_MEMMGR_BIT = 0x00000008, /// Queue supports sparse resource memory management operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700726}
727
728/// Memory properties passed into vkAllocMemory().
Jesse Halld8bade02015-11-24 10:24:18 -0800729type VkFlags VkMemoryPropertyFlags
730bitfield VkMemoryPropertyFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700731 VK_MEMORY_PROPERTY_DEVICE_ONLY = 0x00000000, /// If otherwise stated, then allocate memory on device
732 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000001, /// Memory should be mappable by host
733 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
734 /// vkInvalidateMappedMemoryRanges must be used flush/invalidate host cache
735 VK_MEMORY_PROPERTY_HOST_UNCACHED_BIT = 0x00000004, /// Memory should not be cached by the host
Jesse Hallacfa5342015-11-19 21:51:33 -0800736 VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000008, /// Memory may be allocated by the driver when it is required
Jesse Halld27f6aa2015-08-15 17:58:48 -0700737}
738
739/// Memory heap flags
Jesse Halld8bade02015-11-24 10:24:18 -0800740type VkFlags VkMemoryHeapFlags
741bitfield VkMemoryHeapFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700742 VK_MEMORY_HEAP_HOST_LOCAL_BIT = 0x00000001, /// If set, heap represents host memory
Jesse Halld27f6aa2015-08-15 17:58:48 -0700743}
744
745/// Memory output flags passed to resource transition commands
Jesse Halld8bade02015-11-24 10:24:18 -0800746type VkFlags VkMemoryOutputFlags
747bitfield VkMemoryOutputFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700748 VK_MEMORY_OUTPUT_HOST_WRITE_BIT = 0x00000001, /// Controls output coherency of host writes
749 VK_MEMORY_OUTPUT_SHADER_WRITE_BIT = 0x00000002, /// Controls output coherency of generic shader writes
750 VK_MEMORY_OUTPUT_COLOR_ATTACHMENT_BIT = 0x00000004, /// Controls output coherency of color attachment writes
751 VK_MEMORY_OUTPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000008, /// Controls output coherency of depth/stencil attachment writes
752 VK_MEMORY_OUTPUT_TRANSFER_BIT = 0x00000010, /// Controls output coherency of transfer operations
753}
754
755/// Memory input flags passed to resource transition commands
Jesse Halld8bade02015-11-24 10:24:18 -0800756type VkFlags VkMemoryInputFlags
757bitfield VkMemoryInputFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700758 VK_MEMORY_INPUT_HOST_READ_BIT = 0x00000001, /// Controls input coherency of host reads
759 VK_MEMORY_INPUT_INDIRECT_COMMAND_BIT = 0x00000002, /// Controls input coherency of indirect command reads
760 VK_MEMORY_INPUT_INDEX_FETCH_BIT = 0x00000004, /// Controls input coherency of index fetches
761 VK_MEMORY_INPUT_VERTEX_ATTRIBUTE_FETCH_BIT = 0x00000008, /// Controls input coherency of vertex attribute fetches
762 VK_MEMORY_INPUT_UNIFORM_READ_BIT = 0x00000010, /// Controls input coherency of uniform buffer reads
763 VK_MEMORY_INPUT_SHADER_READ_BIT = 0x00000020, /// Controls input coherency of generic shader reads
764 VK_MEMORY_INPUT_COLOR_ATTACHMENT_BIT = 0x00000040, /// Controls input coherency of color attachment reads
765 VK_MEMORY_INPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000080, /// Controls input coherency of depth/stencil attachment reads
766 VK_MEMORY_INPUT_INPUT_ATTACHMENT_BIT = 0x00000100, /// Controls input coherency of input attachment reads
767 VK_MEMORY_INPUT_TRANSFER_BIT = 0x00000200, /// Controls input coherency of transfer operations
768}
769
770/// Buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800771type VkFlags VkBufferUsageFlags
772bitfield VkBufferUsageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700773 VK_BUFFER_USAGE_TRANSFER_SOURCE_BIT = 0x00000001, /// Can be used as a source of transfer operations
774 VK_BUFFER_USAGE_TRANSFER_DESTINATION_BIT = 0x00000002, /// Can be used as a destination of transfer operations
775 VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, /// Can be used as TBO
776 VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, /// Can be used as IBO
777 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, /// Can be used as UBO
778 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, /// Can be used as SSBO
779 VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, /// Can be used as source of fixed function index fetch (index buffer)
780 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, /// Can be used as source of fixed function vertex fetch (VBO)
781 VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, /// Can be the source of indirect parameters (e.g. indirect buffer, parameter buffer)
782}
783
784/// Buffer creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800785type VkFlags VkBufferCreateFlags
786bitfield VkBufferCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700787 VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Buffer should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700788 VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Buffer should support sparse backing with partial residency
789 VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Buffer should support constent data access to physical memory blocks mapped into multiple locations of sparse buffers
790}
791
792/// Shader stage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800793type VkFlags VkShaderStageFlags
794bitfield VkShaderStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700795 VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
Jesse Hallae38f732015-11-19 21:32:50 -0800796 VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
797 VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700798 VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
799 VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
800 VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
801
802 VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
803}
804
Jesse Hallfbf97b02015-11-20 14:17:03 -0800805/// Descriptor pool create flags
Jesse Halld8bade02015-11-24 10:24:18 -0800806type VkFlags VkDescriptorPoolCreateFlags
807bitfield VkDescriptorPoolCreateFlagBits {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800808 VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
809}
810
811/// Descriptor pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -0800812type VkFlags VkDescriptorPoolResetFlags
813bitfield VkDescriptorPoolResetFlagBits {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800814}
815
Jesse Halld27f6aa2015-08-15 17:58:48 -0700816/// Image usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800817type VkFlags VkImageUsageFlags
818bitfield VkImageUsageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700819 VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT = 0x00000001, /// Can be used as a source of transfer operations
820 VK_IMAGE_USAGE_TRANSFER_DESTINATION_BIT = 0x00000002, /// Can be used as a destination of transfer operations
821 VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, /// Can be sampled from (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
822 VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, /// Can be used as storage image (STORAGE_IMAGE descriptor type)
823 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, /// Can be used as framebuffer color attachment
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700824 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment
Jesse Halld27f6aa2015-08-15 17:58:48 -0700825 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering
826 VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment
827}
828
829/// Image creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800830type VkFlags VkImageCreateFlags
831bitfield VkImageCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700832 VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Image should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700833 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Image should support sparse backing with partial residency
834 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 -0700835 VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, /// Allows image views to have different format than the base image
836 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 -0700837}
838
839/// Framebuffer attachment view creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800840type VkFlags VkImageViewCreateFlags
841bitfield VkImageViewCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700842 VK_IMAGE_VIEW_CREATE_READ_ONLY_DEPTH_BIT = 0x00000001,
843 VK_IMAGE_VIEW_CREATE_READ_ONLY_STENCIL_BIT = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700844}
845
846/// Pipeline creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800847type VkFlags VkPipelineCreateFlags
848bitfield VkPipelineCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700849 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
850 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
851 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
852}
853
854/// Channel flags
Jesse Halld8bade02015-11-24 10:24:18 -0800855type VkFlags VkChannelFlags
856bitfield VkChannelFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700857 VK_CHANNEL_R_BIT = 0x00000001,
858 VK_CHANNEL_G_BIT = 0x00000002,
859 VK_CHANNEL_B_BIT = 0x00000004,
860 VK_CHANNEL_A_BIT = 0x00000008,
861}
862
863/// Fence creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800864type VkFlags VkFenceCreateFlags
865bitfield VkFenceCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700866 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
867}
868
869/// Semaphore creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800870type VkFlags VkSemaphoreCreateFlags
871bitfield VkSemaphoreCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700872}
873
874/// Format capability flags
Jesse Halld8bade02015-11-24 10:24:18 -0800875type VkFlags VkFormatFeatureFlags
876bitfield VkFormatFeatureFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700877 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
878 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type)
879 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images
880 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs)
881 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs)
882 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers
883 VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs)
884 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images
885 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images
886 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700887 VK_FORMAT_FEATURE_BLIT_SOURCE_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCmdBlitImage
888 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 -0700889}
890
891/// Query control flags
Jesse Halld8bade02015-11-24 10:24:18 -0800892type VkFlags VkQueryControlFlags
893bitfield VkQueryControlFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700894 VK_QUERY_CONTROL_CONSERVATIVE_BIT = 0x00000001, /// Allow conservative results to be collected by the query
895}
896
897/// Query result flags
Jesse Halld8bade02015-11-24 10:24:18 -0800898type VkFlags VkQueryResultFlags
899bitfield VkQueryResultFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700900 VK_QUERY_RESULT_DEFAULT = 0x00000000, /// Results of the queries are immediately written to the destination buffer as 32-bit values
901 VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values
902 VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy
903 VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written
904 VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available
905}
906
907/// Shader module creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800908type VkFlags VkShaderModuleCreateFlags
909bitfield VkShaderModuleCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700910}
911
912/// Shader creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800913type VkFlags VkShaderCreateFlags
914bitfield VkShaderCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700915}
916
917/// Event creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800918type VkFlags VkEventCreateFlags
919bitfield VkEventCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700920}
921
Jesse Halla15a4bf2015-11-19 22:48:02 -0800922/// Command buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800923type VkFlags VkCmdBufferUsageFlags
924bitfield VkCmdBufferUsageFlagBits {
Jesse Halla15a4bf2015-11-19 22:48:02 -0800925 VK_CMD_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
926 VK_CMD_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
927 VK_CMD_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700928}
929
930/// Pipeline statistics flags
Jesse Halld8bade02015-11-24 10:24:18 -0800931type VkFlags VkQueryPipelineStatisticFlags
932bitfield VkQueryPipelineStatisticFlagBits {
Jesse Hallae38f732015-11-19 21:32:50 -0800933 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, /// Optional
934 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, /// Optional
935 VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, /// Optional
936 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, /// Optional
937 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, /// Optional
938 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, /// Optional
939 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, /// Optional
940 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, /// Optional
941 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, /// Optional
942 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, /// Optional
943 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, /// Optional
Jesse Halld27f6aa2015-08-15 17:58:48 -0700944}
945
946/// Memory mapping flags
Jesse Halld8bade02015-11-24 10:24:18 -0800947type VkFlags VkMemoryMapFlags
948bitfield VkMemoryMapFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700949}
950
951/// Bitfield of image aspects
Jesse Halld8bade02015-11-24 10:24:18 -0800952type VkFlags VkImageAspectFlags
953bitfield VkImageAspectFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700954 VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
955 VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
956 VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
957 VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
958}
959
960/// Sparse memory bind flags
Jesse Halld8bade02015-11-24 10:24:18 -0800961type VkFlags VkSparseMemoryBindFlags
962bitfield VkSparseMemoryBindFlagBits {
Jesse Halla9bb62b2015-11-21 19:31:56 -0800963 VK_SPARSE_MEMORY_BIND_REPLICATE_BLOCK_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700964}
965
966/// Sparse image memory requirements flags
Jesse Halld8bade02015-11-24 10:24:18 -0800967type VkFlags VkSparseImageFormatFlags
968bitfield VkSparseImageFormatFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700969 VK_SPARSE_IMAGE_FMT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices
970 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.
971 VK_SPARSE_IMAGE_FMT_NONSTD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size
972}
973
974/// Pipeline stages
Jesse Halld8bade02015-11-24 10:24:18 -0800975type VkFlags VkPipelineStageFlags
976bitfield VkPipelineStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700977 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed
978 VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch
979 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch
980 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading
Jesse Hallae38f732015-11-19 21:32:50 -0800981 VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading
982 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading
Jesse Halld27f6aa2015-08-15 17:58:48 -0700983 VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading
984 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading
985 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests
986 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests
987 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes
988 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading
989 VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700990 VK_PIPELINE_STAGE_HOST_BIT = 0x00002000, /// Indicates host (CPU) is a source/sink of the dependency
Jesse Halld27f6aa2015-08-15 17:58:48 -0700991
992 VK_PIPELINE_STAGE_ALL_GRAPHICS = 0x000007FF, /// All stages of the graphics pipeline
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700993 VK_PIPELINE_STAGE_ALL_GPU_COMMANDS = 0x00001FFF, /// All graphics, compute, copy, and transition commands
994}
995
996/// Render pass attachment description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800997type VkFlags VkAttachmentDescriptionFlags
998bitfield VkAttachmentDescriptionFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700999 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 -07001000}
1001
1002/// Subpass description flags
Jesse Halld8bade02015-11-24 10:24:18 -08001003type VkFlags VkSubpassDescriptionFlags
1004bitfield VkSubpassDescriptionFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001005}
1006
1007/// Command pool creation flags
Jesse Halld8bade02015-11-24 10:24:18 -08001008type VkFlags VkCmdPoolCreateFlags
1009bitfield VkCmdPoolCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001010 VK_CMD_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime
1011 VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually
1012}
1013
1014/// Command pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -08001015type VkFlags VkCmdPoolResetFlags
1016bitfield VkCmdPoolResetFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001017 VK_CMD_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool
Jesse Halld27f6aa2015-08-15 17:58:48 -07001018}
1019
Jesse Halld8bade02015-11-24 10:24:18 -08001020type VkFlags VkCmdBufferResetFlags
1021bitfield VkCmdBufferResetFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001022 VK_CMD_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer
1023}
1024
Jesse Halld8bade02015-11-24 10:24:18 -08001025type VkFlags VkSampleCountFlags
1026bitfield VkSampleCountFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001027 VK_SAMPLE_COUNT_1_BIT = 0x00000001,
1028 VK_SAMPLE_COUNT_2_BIT = 0x00000002,
1029 VK_SAMPLE_COUNT_4_BIT = 0x00000004,
1030 VK_SAMPLE_COUNT_8_BIT = 0x00000008,
1031 VK_SAMPLE_COUNT_16_BIT = 0x00000010,
1032 VK_SAMPLE_COUNT_32_BIT = 0x00000020,
1033 VK_SAMPLE_COUNT_64_BIT = 0x00000040,
1034}
1035
Jesse Halld8bade02015-11-24 10:24:18 -08001036type VkFlags VkStencilFaceFlags
1037bitfield VkStencilFaceFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001038 VK_STENCIL_FACE_NONE = 0x00000000, /// No faces
1039 VK_STENCIL_FACE_FRONT_BIT = 0x00000001, /// Front face
1040 VK_STENCIL_FACE_BACK_BIT = 0x00000002, /// Back face
Jesse Halld27f6aa2015-08-15 17:58:48 -07001041}
1042
Michael Lentine88594d72015-11-12 12:49:45 -08001043@extension("VK_EXT_KHR_swapchain")
Jesse Halld8bade02015-11-24 10:24:18 -08001044type VkFlags VkSurfaceTransformFlagsKHR
1045@extension("VK_EXT_KHR_swapchain")
1046bitfield VkSurfaceTransformFlagBitsKHR {
Michael Lentine88594d72015-11-12 12:49:45 -08001047 VK_SURFACE_TRANSFORM_NONE_BIT_KHR = 0x00000001,
1048 VK_SURFACE_TRANSFORM_ROT90_BIT_KHR = 0x00000002,
1049 VK_SURFACE_TRANSFORM_ROT180_BIT_KHR = 0x00000004,
1050 VK_SURFACE_TRANSFORM_ROT270_BIT_KHR = 0x00000008,
1051 VK_SURFACE_TRANSFORM_HMIRROR_BIT_KHR = 0x00000010,
1052 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_BIT_KHR = 0x00000020,
1053 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_BIT_KHR = 0x00000040,
1054 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_BIT_KHR = 0x00000080,
1055 VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
1056}
Jesse Halld27f6aa2015-08-15 17:58:48 -07001057
Jesse Hall1356b0d2015-11-23 17:24:58 -08001058@extension("VK_EXT_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001059type VkFlags VkDisplayPlaneAlphaFlagsKHR
1060@extension("VK_EXT_KHR_display")
1061bitfield VkDisplayPlaneAlphaFlagBitsKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08001062 VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000001,
1063 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000002,
1064 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000004,
1065}
1066
1067
Jesse Halld27f6aa2015-08-15 17:58:48 -07001068//////////////////
1069// Structures //
1070//////////////////
1071
1072class VkOffset2D {
1073 s32 x
1074 s32 y
1075}
1076
1077class VkOffset3D {
1078 s32 x
1079 s32 y
1080 s32 z
1081}
1082
1083class VkExtent2D {
1084 s32 width
1085 s32 height
1086}
1087
1088class VkExtent3D {
1089 s32 width
1090 s32 height
1091 s32 depth
1092}
1093
1094class VkViewport {
1095 f32 originX
1096 f32 originY
1097 f32 width
1098 f32 height
1099 f32 minDepth
1100 f32 maxDepth
1101}
1102
1103class VkRect2D {
1104 VkOffset2D offset
1105 VkExtent2D extent
1106}
1107
Jesse Halla15a4bf2015-11-19 22:48:02 -08001108class VkClearRect {
1109 VkRect2D rect
1110 u32 baseArrayLayer
1111 u32 numLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001112}
1113
1114class VkChannelMapping {
1115 VkChannelSwizzle r
1116 VkChannelSwizzle g
1117 VkChannelSwizzle b
1118 VkChannelSwizzle a
1119}
1120
1121class VkPhysicalDeviceProperties {
1122 u32 apiVersion
1123 u32 driverVersion
1124 u32 vendorId
1125 u32 deviceId
1126 VkPhysicalDeviceType deviceType
1127 char[VK_MAX_PHYSICAL_DEVICE_NAME] deviceName
1128 u8[VK_UUID_LENGTH] pipelineCacheUUID
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001129 VkPhysicalDeviceLimits limits
1130 VkPhysicalDeviceSparseProperties sparseProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001131}
1132
1133class VkExtensionProperties {
1134 char[VK_MAX_EXTENSION_NAME] extName /// extension name
1135 u32 specVersion /// version of the extension specification implemented
1136}
1137
1138class VkLayerProperties {
1139 char[VK_MAX_EXTENSION_NAME] layerName /// layer name
1140 u32 specVersion /// version of the layer specification implemented
1141 u32 implVersion /// build or release version of the layer's library
Jesse Hallf09c6b12015-08-15 19:54:28 -07001142 char[VK_MAX_DESCRIPTION] description /// Free-form description of the layer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001143}
1144
Jesse Halla366a512015-11-19 22:30:07 -08001145class VkSubmitInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001146 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_SUBMIT_INFO
1147 const void* pNext /// Next structure in chain
1148 u32 waitSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001149 const VkSemaphore* pWaitSemaphores
Jesse Hall03b6fe12015-11-24 12:44:21 -08001150 u32 commandBufferCount
Jesse Halla366a512015-11-19 22:30:07 -08001151 const VkCmdBuffer* pCommandBuffers
Jesse Hall03b6fe12015-11-24 12:44:21 -08001152 u32 signalSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001153 const VkSemaphore* pSignalSemaphores
1154}
1155
Jesse Halld27f6aa2015-08-15 17:58:48 -07001156class VkApplicationInfo {
1157 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO
1158 const void* pNext /// Next structure in chain
1159 const char* pAppName
1160 u32 appVersion
1161 const char* pEngineName
1162 u32 engineVersion
1163 u32 apiVersion
1164}
1165
1166class VkAllocCallbacks {
1167 void* pUserData
1168 PFN_vkAllocFunction pfnAlloc
Jesse Hall03b6fe12015-11-24 12:44:21 -08001169 PFN_vkReallocFunction pfnRealloc
Jesse Halld27f6aa2015-08-15 17:58:48 -07001170 PFN_vkFreeFunction pfnFree
Jesse Hall03b6fe12015-11-24 12:44:21 -08001171 PFN_vkInternalAllocNotification pfnInternalAlloc
1172 PFN_vkInternalFreeNotification pfnInternalFree
Jesse Halld27f6aa2015-08-15 17:58:48 -07001173}
1174
1175class VkDeviceQueueCreateInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001176 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
1177 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001178 u32 queueFamilyIndex
Jesse Hall03b6fe12015-11-24 12:44:21 -08001179 u32 queuePriorityCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001180 const f32* pQueuePriorities
Jesse Halld27f6aa2015-08-15 17:58:48 -07001181}
1182
1183class VkDeviceCreateInfo {
1184 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
1185 const void* pNext /// Pointer to next structure
Jesse Hallae38f732015-11-19 21:32:50 -08001186 u32 requestedQueueRecordCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001187 const VkDeviceQueueCreateInfo* pRequestedQueues
Jesse Hall03b6fe12015-11-24 12:44:21 -08001188 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001189 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001190 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001191 const char* const* ppEnabledExtensionNames
1192 const VkPhysicalDeviceFeatures* pEnabledFeatures
Jesse Halld27f6aa2015-08-15 17:58:48 -07001193}
1194
1195class VkInstanceCreateInfo {
1196 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
1197 const void* pNext /// Pointer to next structure
1198 const VkApplicationInfo* pAppInfo
Jesse Hall03b6fe12015-11-24 12:44:21 -08001199 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001200 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001201 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001202 const char* const* ppEnabledExtensionNames /// Extension names to be enabled
1203}
1204
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001205class VkQueueFamilyProperties {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001206 VkQueueFlags queueFlags /// Queue flags
1207 u32 queueCount
Jesse Hallacfa5342015-11-19 21:51:33 -08001208 u32 timestampValidBits
Jesse Halld27f6aa2015-08-15 17:58:48 -07001209}
1210
1211class VkPhysicalDeviceMemoryProperties {
1212 u32 memoryTypeCount
1213 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes
1214 u32 memoryHeapCount
1215 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps
1216}
1217
1218class VkMemoryAllocInfo {
1219 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO
1220 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001221 VkDeviceSize allocationSize /// Size of memory allocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001222 u32 memoryTypeIndex /// Index of the of the memory type to allocate from
1223}
1224
1225class VkMemoryRequirements {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001226 VkDeviceSize size /// Specified in bytes
1227 VkDeviceSize alignment /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001228 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object
1229}
1230
1231class VkSparseImageFormatProperties {
Jesse Halld8bade02015-11-24 10:24:18 -08001232 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001233 VkExtent3D imageGranularity
1234 VkSparseImageFormatFlags flags
1235}
1236
1237class VkSparseImageMemoryRequirements {
1238 VkSparseImageFormatProperties formatProps
1239 u32 imageMipTailStartLOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001240 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment
1241 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment
1242 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07001243}
1244
1245class VkMemoryType {
1246 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type
1247 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from
1248}
1249
1250class VkMemoryHeap {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001251 VkDeviceSize size /// Available memory in the heap
Jesse Halld27f6aa2015-08-15 17:58:48 -07001252 VkMemoryHeapFlags flags /// Flags for the heap
1253}
1254
1255class VkMappedMemoryRange {
1256 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
1257 const void* pNext /// Pointer to next structure
1258 VkDeviceMemory mem /// Mapped memory object
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001259 VkDeviceSize offset /// Offset within the mapped memory the range starts from
1260 VkDeviceSize size /// Size of the range within the mapped memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07001261}
1262
1263class VkFormatProperties {
1264 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling
1265 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001266 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001267}
1268
1269class VkImageFormatProperties {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001270 VkExtent3D maxExtent /// max image dimensions for this resource type
1271 u32 maxMipLevels /// max number of mipmap levels for this resource type
Jesse Halla15a4bf2015-11-19 22:48:02 -08001272 u32 maxArrayLayers /// max array layers for this resource type
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001273 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type
1274 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type
1275}
1276
Jesse Halla15a4bf2015-11-19 22:48:02 -08001277class VkDescriptorImageInfo {
1278 VkSampler sampler
1279 VkImageView imageView
1280 VkImageLayout imageLayout
1281}
1282
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001283class VkDescriptorBufferInfo {
1284 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC]
1285 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set.
1286 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001287}
1288
Jesse Halld27f6aa2015-08-15 17:58:48 -07001289class VkWriteDescriptorSet {
1290 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
1291 const void* pNext /// Pointer to next structure
1292 VkDescriptorSet destSet /// Destination descriptor set
1293 u32 destBinding /// Binding within the destination descriptor set to write
1294 u32 destArrayElement /// Array element within the destination binding to write
Jesse Hall03b6fe12015-11-24 12:44:21 -08001295 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001296 VkDescriptorType descriptorType /// Descriptor type to write (determines which fields of the array pointed by <pDescriptors> are going to be used)
Jesse Hallfbf97b02015-11-20 14:17:03 -08001297 const VkDescriptorImageInfo* pImageInfo
1298 const VkDescriptorBufferInfo* pBufferInfo
1299 const VkBufferView* pTexelBufferView
Jesse Halld27f6aa2015-08-15 17:58:48 -07001300}
1301
1302class VkCopyDescriptorSet {
1303 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
1304 const void* pNext /// Pointer to next structure
1305 VkDescriptorSet srcSet /// Source descriptor set
1306 u32 srcBinding /// Binding within the source descriptor set to copy from
1307 u32 srcArrayElement /// Array element within the source binding to copy from
1308 VkDescriptorSet destSet /// Destination descriptor set
1309 u32 destBinding /// Binding within the destination descriptor set to copy to
1310 u32 destArrayElement /// Array element within the destination binding to copy to
Jesse Hall03b6fe12015-11-24 12:44:21 -08001311 u32 descriptorCount /// Number of descriptors to copy
Jesse Halld27f6aa2015-08-15 17:58:48 -07001312}
1313
1314class VkBufferCreateInfo {
1315 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
1316 const void* pNext /// Pointer to next structure.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001317 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001318 VkBufferUsageFlags usage /// Buffer usage flags
1319 VkBufferCreateFlags flags /// Buffer creation flags
1320 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001321 u32 queueFamilyIndexCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001322 const u32* pQueueFamilyIndices
1323}
1324
1325class VkBufferViewCreateInfo {
1326 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
1327 const void* pNext /// Pointer to next structure.
1328 VkBuffer buffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001329 VkFormat format /// Optionally specifies format of elements
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001330 VkDeviceSize offset /// Specified in bytes
1331 VkDeviceSize range /// View size specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001332}
1333
1334class VkImageSubresource {
Jesse Halld8bade02015-11-24 10:24:18 -08001335 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001336 u32 mipLevel
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001337 u32 arrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001338}
1339
1340class VkImageSubresourceRange {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001341 VkImageAspectFlags aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001342 u32 baseMipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001343 u32 numLevels
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001344 u32 baseArrayLayer
Jesse Halla15a4bf2015-11-19 22:48:02 -08001345 u32 numLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001346}
1347
1348class VkMemoryBarrier {
1349 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER
1350 const void* pNext /// Pointer to next structure.
1351 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1352 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1353}
1354
1355class VkBufferMemoryBarrier {
1356 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
1357 const void* pNext /// Pointer to next structure.
1358 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1359 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1360 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
1361 u32 destQueueFamilyIndex /// Queue family to transition ownership to
1362 VkBuffer buffer /// Buffer to sync
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001363 VkDeviceSize offset /// Offset within the buffer to sync
1364 VkDeviceSize size /// Amount of bytes to sync
Jesse Halld27f6aa2015-08-15 17:58:48 -07001365}
1366
1367class VkImageMemoryBarrier {
1368 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
1369 const void* pNext /// Pointer to next structure.
1370 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1371 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1372 VkImageLayout oldLayout /// Current layout of the image
1373 VkImageLayout newLayout /// New layout to transition the image to
1374 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
1375 u32 destQueueFamilyIndex /// Queue family to transition ownership to
1376 VkImage image /// Image to sync
1377 VkImageSubresourceRange subresourceRange /// Subresource range to sync
1378}
1379
1380class VkImageCreateInfo {
1381 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
1382 const void* pNext /// Pointer to next structure.
1383 VkImageType imageType
1384 VkFormat format
1385 VkExtent3D extent
1386 u32 mipLevels
Jesse Halla15a4bf2015-11-19 22:48:02 -08001387 u32 arrayLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001388 u32 samples
1389 VkImageTiling tiling
1390 VkImageUsageFlags usage /// Image usage flags
1391 VkImageCreateFlags flags /// Image creation flags
1392 VkSharingMode sharingMode /// Cross-queue-family sharing mode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001393 u32 queueFamilyIndexCount /// Number of queue families to share across
Jesse Halld27f6aa2015-08-15 17:58:48 -07001394 const u32* pQueueFamilyIndices /// Array of queue family indices to share across
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001395 VkImageLayout initialLayout /// Initial image layout for all subresources
Jesse Halld27f6aa2015-08-15 17:58:48 -07001396}
1397
1398class VkSubresourceLayout {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001399 VkDeviceSize offset /// Specified in bytes
1400 VkDeviceSize size /// Specified in bytes
1401 VkDeviceSize rowPitch /// Specified in bytes
1402 VkDeviceSize depthPitch /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001403}
1404
1405class VkImageViewCreateInfo {
1406 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
1407 const void* pNext /// Pointer to next structure
1408 VkImage image
1409 VkImageViewType viewType
1410 VkFormat format
1411 VkChannelMapping channels
1412 VkImageSubresourceRange subresourceRange
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001413 VkImageViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001414}
1415
1416class VkBufferCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001417 VkDeviceSize srcOffset /// Specified in bytes
1418 VkDeviceSize destOffset /// Specified in bytes
1419 VkDeviceSize copySize /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001420}
1421
1422class VkSparseMemoryBindInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001423 VkDeviceSize rangeOffset /// Specified in bytes
1424 VkDeviceSize rangeSize /// Specified in bytes
1425 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001426 VkDeviceMemory mem
1427 VkSparseMemoryBindFlags flags
1428}
1429
1430class VkSparseImageMemoryBindInfo {
1431 VkImageSubresource subresource
1432 VkOffset3D offset
1433 VkExtent3D extent
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001434 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001435 VkDeviceMemory mem
1436 VkSparseMemoryBindFlags flags
1437}
1438
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001439class VkImageSubresourceCopy {
Jesse Halla15a4bf2015-11-19 22:48:02 -08001440 VkImageAspectFlags aspect
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001441 u32 mipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001442 u32 baseArrayLayer
1443 u32 numLayers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001444}
1445
Jesse Halld27f6aa2015-08-15 17:58:48 -07001446class VkImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001447 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001448 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001449 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001450 VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images
1451 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images
1452}
1453
1454class VkImageBlit {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001455 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001456 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
1457 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001458 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001459 VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images
1460 VkExtent3D destExtent /// Specified in pixels for both compressed and uncompressed images
1461}
1462
1463class VkBufferImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001464 VkDeviceSize bufferOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001465 u32 bufferRowLength /// Specified in texels
1466 u32 bufferImageHeight
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001467 VkImageSubresourceCopy imageSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001468 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images
1469 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images
1470}
1471
1472class VkImageResolve {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001473 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001474 VkOffset3D srcOffset
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001475 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001476 VkOffset3D destOffset
1477 VkExtent3D extent
1478}
1479
1480class VkShaderModuleCreateInfo {
1481 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
1482 const void* pNext /// Pointer to next structure
1483 platform.size_t codeSize /// Specified in bytes
Jesse Halla9bb62b2015-11-21 19:31:56 -08001484 const u32* pCode /// Binary code of size codeSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07001485 VkShaderModuleCreateFlags flags /// Reserved
1486}
1487
1488class VkShaderCreateInfo {
1489 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
1490 const void* pNext /// Pointer to next structure
1491 VkShaderModule module /// Module containing entry point
1492 const char* pName /// Null-terminated entry point name
1493 VkShaderCreateFlags flags /// Reserved
Jesse Halld8bade02015-11-24 10:24:18 -08001494 VkShaderStageFlagBits stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001495}
1496
1497class VkDescriptorSetLayoutBinding {
1498 VkDescriptorType descriptorType /// Type of the descriptors in this binding
1499 u32 arraySize /// Number of descriptors in this binding
1500 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to
1501 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements)
1502}
1503
1504class VkDescriptorSetLayoutCreateInfo {
1505 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
1506 const void* pNext /// Pointer to next structure
Jesse Hall03b6fe12015-11-24 12:44:21 -08001507 u32 bindingCount /// Number of bindings in the descriptor set layout
1508 const VkDescriptorSetLayoutBinding* pBindings /// Array of descriptor set layout bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001509}
1510
1511class VkDescriptorTypeCount {
1512 VkDescriptorType type
Jesse Hall03b6fe12015-11-24 12:44:21 -08001513 u32 descriptorCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001514}
1515
1516class VkDescriptorPoolCreateInfo {
1517 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
1518 const void* pNext /// Pointer to next structure
Jesse Hallfbf97b02015-11-20 14:17:03 -08001519 VkDescriptorPoolCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001520 u32 maxSets
Jesse Hall03b6fe12015-11-24 12:44:21 -08001521 u32 typeCount
1522 const VkDescriptorTypeCount* pTypeCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07001523}
1524
Jesse Hallfbf97b02015-11-20 14:17:03 -08001525class VkDescriptorSetAllocInfo {
1526 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO
1527 const void* pNext /// Pointer to next structure
1528 VkDescriptorPool descriptorPool
Jesse Hall03b6fe12015-11-24 12:44:21 -08001529 u32 setCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001530 const VkDescriptorSetLayout* pSetLayouts
1531}
1532
Jesse Halld27f6aa2015-08-15 17:58:48 -07001533class VkSpecializationMapEntry {
1534 u32 constantId /// The SpecConstant ID specified in the BIL
1535 platform.size_t size /// Size in bytes of the SpecConstant
1536 u32 offset /// Offset of the value in the data block
1537}
1538
1539class VkSpecializationInfo {
1540 u32 mapEntryCount /// Number of entries in the map
1541 const VkSpecializationMapEntry* pMap /// Array of map entries
1542 platform.size_t dataSize /// Size in bytes of pData
1543 const void* pData /// Pointer to SpecConstant data
1544}
1545
1546class VkPipelineShaderStageCreateInfo {
1547 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
1548 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001549 VkShader shader
1550 const VkSpecializationInfo* pSpecializationInfo
1551}
1552
1553class VkComputePipelineCreateInfo {
1554 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
1555 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001556 VkPipelineShaderStageCreateInfo stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001557 VkPipelineCreateFlags flags /// Pipeline creation flags
1558 VkPipelineLayout layout /// Interface layout of the pipeline
1559 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
1560 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
1561}
1562
1563class VkVertexInputBindingDescription {
1564 u32 binding /// Vertex buffer binding id
1565 u32 strideInBytes /// Distance between vertices in bytes (0 = no advancement)
1566 VkVertexInputStepRate stepRate /// Rate at which binding is incremented
1567}
1568
1569class VkVertexInputAttributeDescription {
1570 u32 location /// location of the shader vertex attrib
1571 u32 binding /// Vertex buffer binding id
1572 VkFormat format /// format of source data
1573 u32 offsetInBytes /// Offset of first element in bytes from base of vertex
1574}
1575
1576class VkPipelineVertexInputStateCreateInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001577 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
1578 const void* pNext /// Pointer to next structure
1579 u32 vertexBindingDescriptionCount /// number of bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001580 const VkVertexInputBindingDescription* pVertexBindingDescriptions
Jesse Hall03b6fe12015-11-24 12:44:21 -08001581 u32 vertexAttributeDescriptionCount /// number of attributes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001582 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
1583}
1584
1585class VkPipelineInputAssemblyStateCreateInfo {
1586 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
1587 const void* pNext /// Pointer to next structure
1588 VkPrimitiveTopology topology
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001589 VkBool32 primitiveRestartEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001590}
1591
1592class VkPipelineTessellationStateCreateInfo {
1593 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
1594 const void* pNext /// Pointer to next structure
1595 u32 patchControlPoints
1596}
1597
1598class VkPipelineViewportStateCreateInfo {
1599 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
1600 const void* pNext /// Pointer to next structure
1601 u32 viewportCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001602 const VkViewport* pViewports
1603 u32 scissorCount
1604 const VkRect2D* pScissors
Jesse Halld27f6aa2015-08-15 17:58:48 -07001605}
1606
1607class VkPipelineRasterStateCreateInfo {
1608 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO
1609 const void* pNext /// Pointer to next structure
Jesse Hallae38f732015-11-19 21:32:50 -08001610 VkBool32 depthClampEnable
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001611 VkBool32 rasterizerDiscardEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001612 VkFillMode fillMode /// optional (GL45)
1613 VkCullMode cullMode
1614 VkFrontFace frontFace
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001615 VkBool32 depthBiasEnable
Jesse Halla9bb62b2015-11-21 19:31:56 -08001616 f32 depthBiasConstantFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001617 f32 depthBiasClamp
Jesse Halla9bb62b2015-11-21 19:31:56 -08001618 f32 depthBiasSlopeFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001619 f32 lineWidth
Jesse Halld27f6aa2015-08-15 17:58:48 -07001620}
1621
1622class VkPipelineMultisampleStateCreateInfo {
1623 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
1624 const void* pNext /// Pointer to next structure
1625 u32 rasterSamples /// Number of samples used for rasterization
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001626 VkBool32 sampleShadingEnable /// optional (GL45)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001627 f32 minSampleShading /// optional (GL45)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001628 const VkSampleMask* pSampleMask
Jesse Hallacfa5342015-11-19 21:51:33 -08001629 VkBool32 alphaToCoverageEnable
1630 VkBool32 alphaToOneEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001631}
1632
1633class VkPipelineColorBlendAttachmentState {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001634 VkBool32 blendEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001635 VkBlend srcBlendColor
1636 VkBlend destBlendColor
1637 VkBlendOp blendOpColor
1638 VkBlend srcBlendAlpha
1639 VkBlend destBlendAlpha
1640 VkBlendOp blendOpAlpha
1641 VkChannelFlags channelWriteMask
1642}
1643
1644class VkPipelineColorBlendStateCreateInfo {
1645 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
1646 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001647 VkBool32 logicOpEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001648 VkLogicOp logicOp
1649 u32 attachmentCount /// # of pAttachments
1650 const VkPipelineColorBlendAttachmentState* pAttachments
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001651 f32[4] blendConst
Jesse Halld27f6aa2015-08-15 17:58:48 -07001652}
1653
1654class VkStencilOpState {
1655 VkStencilOp stencilFailOp
1656 VkStencilOp stencilPassOp
1657 VkStencilOp stencilDepthFailOp
1658 VkCompareOp stencilCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001659 u32 stencilCompareMask
1660 u32 stencilWriteMask
1661 u32 stencilReference
Jesse Halld27f6aa2015-08-15 17:58:48 -07001662}
1663
1664class VkPipelineDepthStencilStateCreateInfo {
1665 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
1666 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001667 VkBool32 depthTestEnable
1668 VkBool32 depthWriteEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001669 VkCompareOp depthCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001670 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test)
1671 VkBool32 stencilTestEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001672 VkStencilOpState front
1673 VkStencilOpState back
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001674 f32 minDepthBounds
1675 f32 maxDepthBounds
1676}
1677
1678class VkPipelineDynamicStateCreateInfo {
1679 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
1680 const void* pNext /// Pointer to next structure
1681 u32 dynamicStateCount
1682 const VkDynamicState* pDynamicStates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001683}
1684
1685class VkGraphicsPipelineCreateInfo {
1686 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
1687 const void* pNext /// Pointer to next structure
1688 u32 stageCount
1689 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage
1690 const VkPipelineVertexInputStateCreateInfo* pVertexInputState
1691 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
1692 const VkPipelineTessellationStateCreateInfo* pTessellationState
1693 const VkPipelineViewportStateCreateInfo* pViewportState
1694 const VkPipelineRasterStateCreateInfo* pRasterState
1695 const VkPipelineMultisampleStateCreateInfo* pMultisampleState
1696 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState
1697 const VkPipelineColorBlendStateCreateInfo* pColorBlendState
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001698 const VkPipelineDynamicStateCreateInfo* pDynamicState
Jesse Halld27f6aa2015-08-15 17:58:48 -07001699 VkPipelineCreateFlags flags /// Pipeline creation flags
1700 VkPipelineLayout layout /// Interface layout of the pipeline
1701 VkRenderPass renderPass
1702 u32 subpass
1703 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
1704 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
1705}
1706
1707class VkPipelineCacheCreateInfo {
1708 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
1709 const void* pNext /// Pointer to next structure
1710 platform.size_t initialSize /// Size of initial data to populate cache, in bytes
1711 const void* initialData /// Initial data to populate cache
1712 platform.size_t maxSize /// Maximum size cache can grow to, in bytes. If zero, then the cache may grow without bound.
1713}
1714
1715class VkPushConstantRange {
1716 VkShaderStageFlags stageFlags /// Which stages use the range
Jesse Hall03b6fe12015-11-24 12:44:21 -08001717 u32 offset /// Start of the range, in bytes
1718 u32 size /// Length of the range, in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001719}
1720
1721class VkPipelineLayoutCreateInfo {
1722 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
1723 const void* pNext /// Pointer to next structure
Jesse Hall03b6fe12015-11-24 12:44:21 -08001724 u32 setLayoutCount /// Number of descriptor sets interfaced by the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001725 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the
1726 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline
1727 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages
1728}
1729
1730class VkSamplerCreateInfo {
1731 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
1732 const void* pNext /// Pointer to next structure
1733 VkTexFilter magFilter /// Filter mode for magnification
1734 VkTexFilter minFilter /// Filter mode for minifiation
1735 VkTexMipmapMode mipMode /// Mipmap selection mode
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001736 VkTexAddressMode addressModeU
1737 VkTexAddressMode addressModeV
1738 VkTexAddressMode addressModeW
Jesse Halld27f6aa2015-08-15 17:58:48 -07001739 f32 mipLodBias
1740 f32 maxAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001741 VkBool32 compareEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001742 VkCompareOp compareOp
1743 f32 minLod
1744 f32 maxLod
1745 VkBorderColor borderColor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001746 VkBool32 unnormalizedCoordinates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001747}
1748
1749class VkCmdPoolCreateInfo {
1750 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO
1751 const void* pNext /// Pointer to next structure
1752 u32 queueFamilyIndex
1753 VkCmdPoolCreateFlags flags /// Command pool creation flags
1754}
1755
Jesse Hallfbf97b02015-11-20 14:17:03 -08001756class VkCmdBufferAllocInfo {
1757 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001758 const void* pNext /// Pointer to next structure
1759 VkCmdPool cmdPool
1760 VkCmdBufferLevel level
Jesse Hall03b6fe12015-11-24 12:44:21 -08001761 u32 bufferCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001762}
1763
1764class VkCmdBufferBeginInfo {
1765 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO
1766 const void* pNext /// Pointer to next structure
Jesse Halla15a4bf2015-11-19 22:48:02 -08001767 VkCmdBufferUsageFlags flags /// Command buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001768 VkRenderPass renderPass /// Render pass for secondary command buffers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001769 u32 subpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07001770 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers
1771}
1772
1773class VkRenderPassBeginInfo {
1774 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
1775 const void* pNext /// Pointer to next structure
1776 VkRenderPass renderPass
1777 VkFramebuffer framebuffer
1778 VkRect2D renderArea
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001779 u32 clearValueCount
1780 const VkClearValue* pClearValues
Jesse Halld27f6aa2015-08-15 17:58:48 -07001781}
1782
1783@union
1784/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared.
1785class VkClearColorValue {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001786 f32[4] float32
1787 s32[4] int32
1788 u32[4] uint32
Jesse Halld27f6aa2015-08-15 17:58:48 -07001789}
1790
1791class VkClearDepthStencilValue {
1792 f32 depth
1793 u32 stencil
1794}
1795
1796@union
1797/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared.
1798class VkClearValue {
1799 VkClearColorValue color
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001800 VkClearDepthStencilValue depthStencil
Jesse Halld27f6aa2015-08-15 17:58:48 -07001801}
1802
Jesse Hallae38f732015-11-19 21:32:50 -08001803class VkClearAttachment {
1804 VkImageAspectFlags aspectMask
1805 u32 colorAttachment
1806 VkClearValue clearValue
1807}
1808
Jesse Halld27f6aa2015-08-15 17:58:48 -07001809class VkAttachmentDescription {
1810 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION
1811 const void* pNext /// Pointer to next structure
1812 VkFormat format
1813 u32 samples
1814 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1815 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1816 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1817 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1818 VkImageLayout initialLayout
1819 VkImageLayout finalLayout
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001820 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001821}
1822
1823class VkAttachmentReference {
1824 u32 attachment
1825 VkImageLayout layout
1826}
1827
1828class VkSubpassDescription {
1829 VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DESCRIPTION
1830 const void* pNext /// Pointer to next structure
1831 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
1832 VkSubpassDescriptionFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001833 u32 inputAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001834 const VkAttachmentReference* pInputAttachments
Jesse Hall03b6fe12015-11-24 12:44:21 -08001835 u32 colorAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001836 const VkAttachmentReference* pColorAttachments
1837 const VkAttachmentReference* pResolveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07001838 VkAttachmentReference depthStencilAttachment
Jesse Hall03b6fe12015-11-24 12:44:21 -08001839 u32 preserveAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001840 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07001841}
1842
1843class VkSubpassDependency {
1844 VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DEPENDENCY
1845 const void* pNext /// Pointer to next structure
1846 u32 srcSubpass
1847 u32 destSubpass
1848 VkPipelineStageFlags srcStageMask
1849 VkPipelineStageFlags destStageMask
1850 VkMemoryOutputFlags outputMask
1851 VkMemoryInputFlags inputMask
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001852 VkBool32 byRegion
Jesse Halld27f6aa2015-08-15 17:58:48 -07001853}
1854
1855class VkRenderPassCreateInfo {
1856 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
1857 const void* pNext /// Pointer to next structure
1858 u32 attachmentCount
1859 const VkAttachmentDescription* pAttachments
1860 u32 subpassCount
1861 const VkSubpassDescription* pSubpasses
1862 u32 dependencyCount
1863 const VkSubpassDependency* pDependencies
1864}
1865
1866class VkEventCreateInfo {
1867 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
1868 const void* pNext /// Pointer to next structure
1869 VkEventCreateFlags flags /// Event creation flags
1870}
1871
1872class VkFenceCreateInfo {
1873 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
1874 const void* pNext /// Pointer to next structure
1875 VkFenceCreateFlags flags /// Fence creation flags
1876}
1877
1878class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001879 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
1880 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
1881 VkBool32 imageCubeArray /// image views which are arrays of cube maps
1882 VkBool32 independentBlend /// blending operations are controlled per-attachment
1883 VkBool32 geometryShader /// geometry stage
1884 VkBool32 tessellationShader /// tessellation control and evaluation stage
1885 VkBool32 sampleRateShading /// per-sample shading and interpolation
1886 VkBool32 dualSourceBlend /// blend operations which take two sources
1887 VkBool32 logicOp /// logic operations
1888 VkBool32 multiDrawIndirect /// multi draw indirect
Jesse Hallae38f732015-11-19 21:32:50 -08001889 VkBool32 depthClamp /// depth clamping
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001890 VkBool32 depthBiasClamp /// depth bias clamping
1891 VkBool32 fillModeNonSolid /// point and wireframe fill modes
1892 VkBool32 depthBounds /// depth bounds test
1893 VkBool32 wideLines /// lines with width greater than 1
1894 VkBool32 largePoints /// points with size greater than 1
Jesse Hallfbf97b02015-11-20 14:17:03 -08001895 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
1896 VkBool32 multiViewport
1897 VkBool32 samplerAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001898 VkBool32 textureCompressionETC2 /// ETC texture compression formats
1899 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
1900 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
1901 VkBool32 occlusionQueryNonConservative /// non-conservative (exact) occlusion queries
1902 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
1903 VkBool32 vertexSideEffects /// storage buffers and images in vertex stage
1904 VkBool32 tessellationSideEffects /// storage buffers and images in tessellation stage
1905 VkBool32 geometrySideEffects /// storage buffers and images in geometry stage
1906 VkBool32 fragmentSideEffects /// storage buffers and images in fragment stage
1907 VkBool32 shaderTessellationPointSize /// tessellation stage can export point size
1908 VkBool32 shaderGeometryPointSize /// geometry stage can export point size
1909 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
1910 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
1911 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
1912 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
1913 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
1914 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
1915 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
1916 VkBool32 shaderClipDistance /// clip distance in shaders
1917 VkBool32 shaderCullDistance /// cull distance in shaders
1918 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
1919 VkBool32 shaderInt64 /// 64-bit integers in shaders
1920 VkBool32 shaderInt16 /// 16-bit integers in shaders
1921 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
1922 VkBool32 shaderResourceMinLOD /// shader can use texture operations that specify minimum resource LOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001923 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
1924 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
1925 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
1926 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
1927 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
1928 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
1929 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
1930 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
1931 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001932}
1933
1934class VkPhysicalDeviceLimits {
1935 /// resource maximum sizes
1936 u32 maxImageDimension1D /// max 1D image dimension
1937 u32 maxImageDimension2D /// max 2D image dimension
1938 u32 maxImageDimension3D /// max 3D image dimension
1939 u32 maxImageDimensionCube /// max cubemap image dimension
1940 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001941 VkSampleCountFlags sampleCounts /// sample counts supported for all images supporting rendering and sampling
Jesse Halld27f6aa2015-08-15 17:58:48 -07001942 u32 maxTexelBufferSize /// max texel buffer size (bytes)
Jesse Hallfbf97b02015-11-20 14:17:03 -08001943 u32 maxUniformBufferRange /// max uniform buffer size (bytes)
1944 u32 maxStorageBufferRange /// max storage buffer size (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001945 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
1946 /// memory limits
1947 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001948 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
1949 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001950 /// descriptor set limits
1951 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001952 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
1953 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
1954 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
1955 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
1956 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
1957 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
1958 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001959 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07001960 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001961 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07001962 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
1963 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
1964 /// vertex stage limits
1965 u32 maxVertexInputAttributes /// max num of vertex input attribute slots
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001966 u32 maxVertexInputBindings /// max num of vertex input binding slots
Jesse Halld27f6aa2015-08-15 17:58:48 -07001967 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset
1968 u32 maxVertexInputBindingStride /// max vertex input binding stride
1969 u32 maxVertexOutputComponents /// max num of output components written by vertex shader
1970 /// tessellation control stage limits
Jesse Hallae38f732015-11-19 21:32:50 -08001971 u32 maxTessellationGenLevel /// max level supported by tess primitive generator
1972 u32 maxTessellationPatchSize /// max patch size (vertices)
1973 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS
1974 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS
1975 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS
1976 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS
1977 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES
1978 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES
Jesse Halld27f6aa2015-08-15 17:58:48 -07001979 /// geometry stage limits
1980 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader
1981 u32 maxGeometryInputComponents /// max num of input components read in geometry stage
1982 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage
1983 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage
1984 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage
1985 /// fragment stage limits
1986 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage
Jesse Hallfbf97b02015-11-20 14:17:03 -08001987 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage
1988 u32 maxFragmentDualSourceAttachments /// max num of output attachments written when using dual source blending
Jesse Halld27f6aa2015-08-15 17:58:48 -07001989 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers
1990 /// compute stage limits
1991 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes)
1992 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z)
1993 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group
1994 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z)
1995
1996 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y
1997 u32 subTexelPrecisionBits /// num bits of subtexel precision
1998 u32 mipmapPrecisionBits /// num bits of mipmap precision
1999
2000 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices)
2001 u32 maxDrawIndirectInstanceCount /// max instance count for indirect draw calls
Jesse Halld27f6aa2015-08-15 17:58:48 -07002002
2003 f32 maxSamplerLodBias /// max absolute sampler level of detail bias
2004 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy
2005
2006 u32 maxViewports /// max number of active viewports
Jesse Halld27f6aa2015-08-15 17:58:48 -07002007 u32[2] maxViewportDimensions /// max viewport dimensions (x,y)
2008 f32[2] viewportBoundsRange /// viewport bounds range (min,max)
2009 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport
2010
2011 u32 minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes)
Jesse Hallf09c6b12015-08-15 19:54:28 -07002012 u32 minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002013 u32 minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes)
2014 u32 minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes)
2015
Jesse Hallfbf97b02015-11-20 14:17:03 -08002016 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002017 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset
Jesse Hallfbf97b02015-11-20 14:17:03 -08002018 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002019 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset
2020 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset
2021 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset
2022 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset
2023
2024 u32 maxFramebufferWidth /// max width for a framebuffer
2025 u32 maxFramebufferHeight /// max height for a framebuffer
2026 u32 maxFramebufferLayers /// max layer count for a layered framebuffer
2027 u32 maxFramebufferColorSamples /// max color sample count for a framebuffer
2028 u32 maxFramebufferDepthSamples /// max depth sample count for a framebuffer
2029 u32 maxFramebufferStencilSamples /// max stencil sample count for a framebuffer
2030 u32 maxColorAttachments /// max num of framebuffer color attachments
2031
2032 u32 maxSampledImageColorSamples /// max num of color samples for a non-integer sampled image
2033 u32 maxSampledImageDepthSamples /// max num of depth/stencil samples for a sampled image
2034 u32 maxSampledImageIntegerSamples /// max num of samples supported for an integer image
2035 u32 maxStorageImageSamples /// max num of samples for a storage image
2036 u32 maxSampleMaskWords /// max num of sample mask words
2037
Jesse Halla9bb62b2015-11-21 19:31:56 -08002038 f32 timestampPeriod
Jesse Halld27f6aa2015-08-15 17:58:48 -07002039
2040 u32 maxClipDistances /// max number of clip distances
2041 u32 maxCullDistances /// max number of cull distances
2042 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
2043
Jesse Hallfbf97b02015-11-20 14:17:03 -08002044 u32 discreteQueuePriorities
2045
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002046 f32[2] pointSizeRange /// range (min,max) of supported point sizes
2047 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07002048 f32 pointSizeGranularity /// granularity of supported point sizes
2049 f32 lineWidthGranularity /// granularity of supported line widths
Jesse Hall03b6fe12015-11-24 12:44:21 -08002050 VkBool32 strictLines
Jesse Halla9bb62b2015-11-21 19:31:56 -08002051
2052 u32 recommendedBufferCopyOffsetAlignment
2053 u32 recommendedBufferCopyRowPitchAlignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07002054}
2055
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002056class VkPhysicalDeviceSparseProperties {
2057 VkBool32 residencyStandard2DBlockShape /// Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard block shapes (based on pixel format)
2058 VkBool32 residencyStandard2DMSBlockShape /// Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard block shapes (based on pixel format)
2059 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
2060 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
2061 VkBool32 residencyNonResident /// Sparse resources support: GPU can safely access non-resident regions of a resource, read values from read-write resources are undefined
2062 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
2063}
2064
Jesse Halld27f6aa2015-08-15 17:58:48 -07002065class VkSemaphoreCreateInfo {
2066 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
2067 const void* pNext /// Pointer to next structure
2068 VkSemaphoreCreateFlags flags /// Semaphore creation flags
2069}
2070
2071class VkQueryPoolCreateInfo {
2072 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
2073 const void* pNext /// Pointer to next structure
2074 VkQueryType queryType
2075 u32 slots
2076 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
2077}
2078
2079class VkFramebufferCreateInfo {
2080 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
2081 const void* pNext /// Pointer to next structure
2082 VkRenderPass renderPass
2083 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002084 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002085 u32 width
2086 u32 height
2087 u32 layers
2088}
2089
2090class VkDrawIndirectCmd {
2091 u32 vertexCount
2092 u32 instanceCount
2093 u32 firstVertex
2094 u32 firstInstance
2095}
2096
2097class VkDrawIndexedIndirectCmd {
2098 u32 indexCount
2099 u32 instanceCount
2100 u32 firstIndex
2101 s32 vertexOffset
2102 u32 firstInstance
2103}
2104
2105class VkDispatchIndirectCmd {
2106 u32 x
2107 u32 y
2108 u32 z
2109}
2110
Jesse Hall1356b0d2015-11-23 17:24:58 -08002111@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002112class VkSurfacePropertiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002113 u32 minImageCount
2114 u32 maxImageCount
2115 VkExtent2D currentExtent
2116 VkExtent2D minImageExtent
2117 VkExtent2D maxImageExtent
2118 VkSurfaceTransformFlagsKHR supportedTransforms
2119 VkSurfaceTransformKHR currentTransform
2120 u32 maxImageArraySize
2121 VkImageUsageFlags supportedUsageFlags
Michael Lentine88594d72015-11-12 12:49:45 -08002122}
2123
Jesse Hall1356b0d2015-11-23 17:24:58 -08002124@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002125class VkSurfaceFormatKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002126 VkFormat format
2127 VkColorSpaceKHR colorSpace
Michael Lentine88594d72015-11-12 12:49:45 -08002128}
2129
Jesse Hall1356b0d2015-11-23 17:24:58 -08002130@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002131class VkSwapchainCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002132 VkStructureType sType
2133 const void* pNext
2134 VkSurfaceKHR surface
2135 u32 minImageCount
2136 VkFormat imageFormat
2137 VkColorSpaceKHR imageColorSpace
2138 VkExtent2D imageExtent
2139 VkImageUsageFlags imageUsageFlags
2140 VkSurfaceTransformKHR preTransform
2141 u32 imageArraySize
2142 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08002143 u32 queueFamilyIndexCount
Jesse Hall1356b0d2015-11-23 17:24:58 -08002144 const u32* pQueueFamilyIndices
2145 VkPresentModeKHR presentMode
2146 VkSwapchainKHR oldSwapchain
2147 VkBool32 clipped
Michael Lentine88594d72015-11-12 12:49:45 -08002148}
2149
Jesse Hall1356b0d2015-11-23 17:24:58 -08002150@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002151class VkPresentInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002152 VkStructureType sType
2153 const void* pNext
2154 u32 swapchainCount
Jesse Hall03b6fe12015-11-24 12:44:21 -08002155 const VkSwapchainKHR* pSwapchains
Jesse Hall1356b0d2015-11-23 17:24:58 -08002156 const u32* imageIndices
Michael Lentine88594d72015-11-12 12:49:45 -08002157}
2158
Jesse Hall1356b0d2015-11-23 17:24:58 -08002159@extension("VK_EXT_KHR_display")
2160class VkDisplayPropertiesKHR {
2161 VkDisplayKHR display
2162 const char* displayName
2163 VkExtent2D physicalDimensions
2164 VkExtent2D physicalResolution
2165 VkSurfaceTransformFlagsKHR supportedTransforms
2166 u32 planeCount
2167 VkBool32 planeReorderPossible
Michael Lentine88594d72015-11-12 12:49:45 -08002168}
2169
Jesse Hall1356b0d2015-11-23 17:24:58 -08002170@extension("VK_EXT_KHR_display")
2171class VkDisplayTimingKHR {
2172 u32 pixelClock
2173 VkExtent2D visibleRegion
2174 VkExtent2D totalRegion
2175 VkExtent2D physicalDimensions
2176 u32 hSyncStart
2177 u32 hSyncEnd
2178 u32 vSyncStart
2179 u32 vSyncEnd
2180 VkBool32 interlaced
2181 VkBool32 doublescan
2182 VkBool32 hSyncPos
2183 VkBool32 vSyncPos
Michael Lentine88594d72015-11-12 12:49:45 -08002184}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002185
Jesse Hall1356b0d2015-11-23 17:24:58 -08002186@extension("VK_EXT_KHR_display")
2187class VkDisplayModePropertiesKHR {
2188 VkDisplayModeKHR displayMode
2189 VkDisplayTimingKHR timing
2190}
2191
2192@extension("VK_EXT_KHR_display")
2193class VkDisplayModeCreateInfoKHR {
2194 VkStructureType sType
2195 const void* pNext
2196 VkDisplayTimingKHR timing
2197}
2198
2199@extension("VK_EXT_KHR_display")
2200class VkDisplayPlanePropertiesKHR {
2201 VkDisplayPlaneAlphaFlagsKHR supportedAlpha
2202 VkOffset2D minSrcPosition
2203 VkOffset2D maxSrcPosition
2204 VkExtent2D minSrcExtent
2205 VkExtent2D maxSrcExtent
2206 VkOffset2D minDstPosition
2207 VkOffset2D maxDstPosition
2208 VkExtent2D minDstExtent
2209 VkExtent2D maxDstExtent
2210}
2211
2212@extension("VK_EXT_KHR_display")
2213class VkSurfaceDescriptionDisplayPlaneKHR {
2214 VkStructureType sType
2215 const void* pNext
2216 VkDisplayModeKHR displayMode
2217 u32 planeIndex
2218 u32 planeStackIndex
2219 VkSurfaceTransformKHR transform
2220 f32 globalAlpha
2221 VkDisplayPlaneAlphaFlagsKHR alphaMode
2222 VkExtent2D imageSize
2223}
2224
2225@extension("VK_EXT_KHR_display_swapchain")
2226class VkDisplaySwapchainCreateInfoKHR {
2227 VkStructureType sType
2228 const void* pNext
2229 const VkSwapchainCreateInfoKHR* pNextSwapchainCreateInfo
2230}
2231
2232@extension("VK_EXT_KHR_display_swapchain")
2233class VkDisplayPresentInfoKHR {
2234 VkStructureType sType
2235 const void* pNext
2236 VkRect2D srcRect
2237 VkRect2D dstRect
2238}
2239
2240
Jesse Halld27f6aa2015-08-15 17:58:48 -07002241////////////////
2242// Commands //
2243////////////////
2244
2245// Function pointers. TODO: add support for function pointers.
2246
2247@external type void* PFN_vkVoidFunction
2248@pfn cmd void vkVoidFunction() {
2249}
2250
2251@external type void* PFN_vkAllocFunction
2252@pfn cmd void* vkAllocFunction(
2253 void* pUserData,
2254 platform.size_t size,
2255 platform.size_t alignment,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002256 VkSystemAllocScope allocScope) {
2257 return ?
2258}
2259
2260@external type void* PFN_vkReallocFunction
2261@pfn cmd void* vkReallocFunction(
2262 void* pUserData,
2263 void* pOriginal,
2264 platform.size_t size,
2265 platform.size_t alignment,
2266 VkSystemAllocScope allocScope) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002267 return ?
2268}
2269
2270@external type void* PFN_vkFreeFunction
2271@pfn cmd void vkFreeFunction(
2272 void* pUserData,
2273 void* pMem) {
2274}
2275
Jesse Hall03b6fe12015-11-24 12:44:21 -08002276@external type void* PFN_vkInternalAllocNotification
2277@pfn cmd void vkInternalAllocNotification(
2278 void* pUserData,
2279 platform.size_t size,
2280 VkInternalAllocType allocType,
2281 VkSystemAllocScope allocScope) {
2282}
2283
2284@external type void* PFN_vkInternalFreeNotification
2285@pfn cmd void vkInternalFreeNotification(
2286 void* pUserData,
2287 platform.size_t size,
2288 VkInternalAllocType allocType,
2289 VkSystemAllocScope allocScope) {
2290}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002291
2292// Global functions
2293
2294@threadSafety("system")
2295cmd VkResult vkCreateInstance(
2296 const VkInstanceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002297 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002298 VkInstance* pInstance) {
2299 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
2300
2301 instance := ?
2302 pInstance[0] = instance
2303 State.Instances[instance] = new!InstanceObject()
2304
Jesse Hall03b6fe12015-11-24 12:44:21 -08002305 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount]
2306 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount]
Jesse Halld27f6aa2015-08-15 17:58:48 -07002307
2308 return ?
2309}
2310
2311@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002312cmd void vkDestroyInstance(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002313 VkInstance instance,
2314 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002315 instanceObject := GetInstance(instance)
2316
2317 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002318}
2319
2320@threadSafety("system")
2321cmd VkResult vkEnumeratePhysicalDevices(
2322 VkInstance instance,
2323 u32* pPhysicalDeviceCount,
2324 VkPhysicalDevice* pPhysicalDevices) {
2325 instanceObject := GetInstance(instance)
2326
2327 physicalDeviceCount := as!u32(?)
2328 pPhysicalDeviceCount[0] = physicalDeviceCount
2329 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2330
2331 for i in (0 .. physicalDeviceCount) {
2332 physicalDevice := ?
2333 physicalDevices[i] = physicalDevice
2334 if !(physicalDevice in State.PhysicalDevices) {
2335 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2336 }
2337 }
2338
2339 return ?
2340}
2341
2342cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2343 VkDevice device,
2344 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002345 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002346 device := GetDevice(device)
2347 }
2348
2349 return ?
2350}
2351
2352cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2353 VkInstance instance,
2354 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002355 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002356 instanceObject := GetInstance(instance)
2357 }
2358
2359 return ?
2360}
2361
Jesse Hall606a54e2015-11-19 22:17:28 -08002362cmd void vkGetPhysicalDeviceProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002363 VkPhysicalDevice physicalDevice,
2364 VkPhysicalDeviceProperties* pProperties) {
2365 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2366
2367 properties := ?
2368 pProperties[0] = properties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002369}
2370
Jesse Hall606a54e2015-11-19 22:17:28 -08002371cmd void vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002372 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002373 u32* pQueueFamilyPropertyCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002374 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002375 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002376 // TODO: Figure out how to express fetch-count-or-properties
2377 // This version fails 'apic validate' with 'fence not allowed in
2378 // *semantic.Branch'. Other attempts have failed with the same or other
2379 // errors.
2380 // if pQueueFamilyProperties != null {
2381 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2382 // for i in (0 .. pCount[0]) {
2383 // queueProperties := as!VkQueueFamilyProperties(?)
2384 // queuesProperties[i] = queueProperties
2385 // }
2386 // } else {
2387 // count := ?
2388 // pCount[0] = count
2389 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002390}
2391
Jesse Hall606a54e2015-11-19 22:17:28 -08002392cmd void vkGetPhysicalDeviceMemoryProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002393 VkPhysicalDevice physicalDevice,
2394 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2395 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2396
2397 memoryProperties := ?
2398 pMemoryProperties[0] = memoryProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002399}
2400
Jesse Hall606a54e2015-11-19 22:17:28 -08002401cmd void vkGetPhysicalDeviceFeatures(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002402 VkPhysicalDevice physicalDevice,
2403 VkPhysicalDeviceFeatures* pFeatures) {
2404 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2405
2406 features := ?
2407 pFeatures[0] = features
Jesse Halld27f6aa2015-08-15 17:58:48 -07002408}
2409
Jesse Hall606a54e2015-11-19 22:17:28 -08002410cmd void vkGetPhysicalDeviceFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002411 VkPhysicalDevice physicalDevice,
2412 VkFormat format,
2413 VkFormatProperties* pFormatProperties) {
2414 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2415
2416 formatProperties := ?
2417 pFormatProperties[0] = formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002418}
2419
Jesse Hall606a54e2015-11-19 22:17:28 -08002420cmd void vkGetPhysicalDeviceImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002421 VkPhysicalDevice physicalDevice,
2422 VkFormat format,
2423 VkImageType type,
2424 VkImageTiling tiling,
2425 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002426 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002427 VkImageFormatProperties* pImageFormatProperties) {
2428 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2429
2430 imageFormatProperties := ?
2431 pImageFormatProperties[0] = imageFormatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002432}
2433
Jesse Halld27f6aa2015-08-15 17:58:48 -07002434
2435// Device functions
2436
2437@threadSafety("system")
2438cmd VkResult vkCreateDevice(
2439 VkPhysicalDevice physicalDevice,
2440 const VkDeviceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002441 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002442 VkDevice* pDevice) {
2443 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2444 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2445
2446 device := ?
2447 pDevice[0] = device
2448 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2449
2450 return ?
2451}
2452
2453@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002454cmd void vkDestroyDevice(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002455 VkDevice device,
2456 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002457 deviceObject := GetDevice(device)
2458
2459 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002460}
2461
2462
2463// Extension discovery functions
2464
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002465cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002466 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002467 VkLayerProperties* pProperties) {
2468 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002469 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002470
2471 properties := pProperties[0:count]
2472 for i in (0 .. count) {
2473 property := ?
2474 properties[i] = property
2475 }
2476
2477 return ?
2478}
2479
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002480cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002481 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002482 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002483 VkExtensionProperties* pProperties) {
2484 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002485 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002486
2487 properties := pProperties[0:count]
2488 for i in (0 .. count) {
2489 property := ?
2490 properties[i] = property
2491 }
2492
2493 return ?
2494}
2495
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002496cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002497 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002498 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002499 VkLayerProperties* pProperties) {
2500 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2501 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002502 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002503
2504 properties := pProperties[0:count]
2505 for i in (0 .. count) {
2506 property := ?
2507 properties[i] = property
2508 }
2509
2510 return ?
2511}
2512
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002513cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002514 VkPhysicalDevice physicalDevice,
2515 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002516 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002517 VkExtensionProperties* pProperties) {
2518 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2519
2520 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002521 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002522
2523 properties := pProperties[0:count]
2524 for i in (0 .. count) {
2525 property := ?
2526 properties[i] = property
2527 }
2528
2529 return ?
2530}
2531
2532
2533// Queue functions
2534
2535@threadSafety("system")
Jesse Hall606a54e2015-11-19 22:17:28 -08002536cmd void vkGetDeviceQueue(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002537 VkDevice device,
2538 u32 queueFamilyIndex,
2539 u32 queueIndex,
2540 VkQueue* pQueue) {
2541 deviceObject := GetDevice(device)
2542
2543 queue := ?
2544 pQueue[0] = queue
2545
2546 if !(queue in State.Queues) {
2547 State.Queues[queue] = new!QueueObject(device: device)
2548 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002549}
2550
2551@threadSafety("app")
2552cmd VkResult vkQueueSubmit(
2553 VkQueue queue,
Jesse Halla366a512015-11-19 22:30:07 -08002554 u32 submitCount,
2555 const VkSubmitInfo* pSubmitInfo,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002556 VkFence fence) {
2557 queueObject := GetQueue(queue)
2558
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002559 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002560 fenceObject := GetFence(fence)
2561 assert(fenceObject.device == queueObject.device)
2562 }
2563
Jesse Halla366a512015-11-19 22:30:07 -08002564 // cmdBuffers := pCmdBuffers[0:cmdBufferCount]
2565 // for i in (0 .. cmdBufferCount) {
2566 // cmdBuffer := cmdBuffers[i]
2567 // cmdBufferObject := GetCmdBuffer(cmdBuffer)
2568 // assert(cmdBufferObject.device == queueObject.device)
2569 //
2570 // validate("QueueCheck", cmdBufferObject.queueFlags in queueObject.flags,
2571 // "vkQueueSubmit: enqueued cmdBuffer requires missing queue capabilities.")
2572 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002573
2574 return ?
2575}
2576
2577@threadSafety("system")
2578cmd VkResult vkQueueWaitIdle(
2579 VkQueue queue) {
2580 queueObject := GetQueue(queue)
2581
2582 return ?
2583}
2584
2585@threadSafety("system")
2586cmd VkResult vkDeviceWaitIdle(
2587 VkDevice device) {
2588 deviceObject := GetDevice(device)
2589
2590 return ?
2591}
2592
2593
2594// Memory functions
2595
2596@threadSafety("system")
2597cmd VkResult vkAllocMemory(
2598 VkDevice device,
2599 const VkMemoryAllocInfo* pAllocInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002600 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002601 VkDeviceMemory* pMem) {
2602 assert(pAllocInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO)
2603 deviceObject := GetDevice(device)
2604
2605 mem := ?
2606 pMem[0] = mem
2607 State.DeviceMemories[mem] = new!DeviceMemoryObject(
2608 device: device,
2609 allocationSize: pAllocInfo[0].allocationSize)
2610
2611 return ?
2612}
2613
2614@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002615cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002616 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002617 VkDeviceMemory mem,
2618 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002619 deviceObject := GetDevice(device)
2620 memObject := GetDeviceMemory(mem)
2621 assert(memObject.device == device)
2622
2623 // Check that no objects are still bound before freeing.
2624 validate("MemoryCheck", len(memObject.boundObjects) == 0,
2625 "vkFreeMemory: objects still bound")
2626 validate("MemoryCheck", len(memObject.boundCommandBuffers) == 0,
2627 "vkFreeMemory: cmdBuffers still bound")
2628 State.DeviceMemories[mem] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002629}
2630
2631@threadSafety("app")
2632cmd VkResult vkMapMemory(
2633 VkDevice device,
2634 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002635 VkDeviceSize offset,
2636 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002637 VkMemoryMapFlags flags,
2638 void** ppData) {
2639 deviceObject := GetDevice(device)
2640 memObject := GetDeviceMemory(mem)
2641 assert(memObject.device == device)
2642
2643 assert(flags == as!VkMemoryMapFlags(0))
2644 assert((offset + size) <= memObject.allocationSize)
2645
2646 return ?
2647}
2648
2649@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002650cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002651 VkDevice device,
2652 VkDeviceMemory mem) {
2653 deviceObject := GetDevice(device)
2654 memObject := GetDeviceMemory(mem)
2655 assert(memObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002656}
2657
2658cmd VkResult vkFlushMappedMemoryRanges(
2659 VkDevice device,
2660 u32 memRangeCount
2661 const VkMappedMemoryRange* pMemRanges) {
2662 deviceObject := GetDevice(device)
2663
2664 memRanges := pMemRanges[0:memRangeCount]
2665 for i in (0 .. memRangeCount) {
2666 memRange := memRanges[i]
2667 memObject := GetDeviceMemory(memRange.mem)
2668 assert(memObject.device == device)
2669 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2670 }
2671
2672 return ?
2673}
2674
2675cmd VkResult vkInvalidateMappedMemoryRanges(
2676 VkDevice device,
2677 u32 memRangeCount,
2678 const VkMappedMemoryRange* pMemRanges) {
2679 deviceObject := GetDevice(device)
2680
2681 memRanges := pMemRanges[0:memRangeCount]
2682 for i in (0 .. memRangeCount) {
2683 memRange := memRanges[i]
2684 memObject := GetDeviceMemory(memRange.mem)
2685 assert(memObject.device == device)
2686 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2687 }
2688
2689 return ?
2690}
2691
2692
2693// Memory management API functions
2694
Jesse Hall606a54e2015-11-19 22:17:28 -08002695cmd void vkGetDeviceMemoryCommitment(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002696 VkDevice device,
2697 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002698 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002699 deviceObject := GetDevice(device)
2700
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002701 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002702 memoryObject := GetDeviceMemory(memory)
2703 assert(memoryObject.device == device)
2704 }
2705
2706 committedMemoryInBytes := ?
2707 pCommittedMemoryInBytes[0] = committedMemoryInBytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07002708}
2709
Jesse Hall606a54e2015-11-19 22:17:28 -08002710cmd void vkGetBufferMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002711 VkDevice device,
2712 VkBuffer buffer,
2713 VkMemoryRequirements* pMemoryRequirements) {
2714 deviceObject := GetDevice(device)
2715 bufferObject := GetBuffer(buffer)
2716 assert(bufferObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002717}
2718
2719cmd VkResult vkBindBufferMemory(
2720 VkDevice device,
2721 VkBuffer buffer,
2722 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002723 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002724 deviceObject := GetDevice(device)
2725 bufferObject := GetBuffer(buffer)
2726 assert(bufferObject.device == device)
2727
2728 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002729 if bufferObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002730 memObject := GetDeviceMemory(bufferObject.mem)
2731 memObject.boundObjects[as!u64(buffer)] = null
2732 }
2733
2734 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002735 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002736 memObject := GetDeviceMemory(mem)
2737 assert(memObject.device == device)
2738 memObject.boundObjects[as!u64(buffer)] = memOffset
2739 }
2740 bufferObject.mem = mem
2741 bufferObject.memOffset = memOffset
2742
2743 return ?
2744}
2745
Jesse Hall606a54e2015-11-19 22:17:28 -08002746cmd void vkGetImageMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002747 VkDevice device,
2748 VkImage image,
2749 VkMemoryRequirements* pMemoryRequirements) {
2750 deviceObject := GetDevice(device)
2751 imageObject := GetImage(image)
2752 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002753}
2754
2755cmd VkResult vkBindImageMemory(
2756 VkDevice device,
2757 VkImage image,
2758 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002759 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002760 deviceObject := GetDevice(device)
2761 imageObject := GetImage(image)
2762 assert(imageObject.device == device)
2763
2764 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002765 if imageObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002766 memObject := GetDeviceMemory(imageObject.mem)
2767 memObject.boundObjects[as!u64(image)] = null
2768 }
2769
2770 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002771 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002772 memObject := GetDeviceMemory(mem)
2773 assert(memObject.device == device)
2774 memObject.boundObjects[as!u64(image)] = memOffset
2775 }
2776 imageObject.mem = mem
2777 imageObject.memOffset = memOffset
2778
2779 return ?
2780}
2781
Jesse Hall606a54e2015-11-19 22:17:28 -08002782cmd void vkGetImageSparseMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002783 VkDevice device,
2784 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002785 u32* pSparseMemoryRequirementCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002786 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2787 deviceObject := GetDevice(device)
2788 imageObject := GetImage(image)
2789 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002790}
2791
Jesse Hall606a54e2015-11-19 22:17:28 -08002792cmd void vkGetPhysicalDeviceSparseImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002793 VkPhysicalDevice physicalDevice,
2794 VkFormat format,
2795 VkImageType type,
2796 u32 samples,
2797 VkImageUsageFlags usage,
2798 VkImageTiling tiling,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002799 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002800 VkSparseImageFormatProperties* pProperties) {
2801 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002802}
2803
2804cmd VkResult vkQueueBindSparseBufferMemory(
2805 VkQueue queue,
2806 VkBuffer buffer,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002807 u32 bindInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002808 const VkSparseMemoryBindInfo* pBindInfo) {
2809 queueObject := GetQueue(queue)
2810 bufferObject := GetBuffer(buffer)
2811 assert(bufferObject.device == queueObject.device)
2812
2813 return ?
2814}
2815
2816cmd VkResult vkQueueBindSparseImageOpaqueMemory(
2817 VkQueue queue,
2818 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002819 u32 bindInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002820 const VkSparseMemoryBindInfo* pBindInfo) {
2821 queueObject := GetQueue(queue)
2822 imageObject := GetImage(image)
2823 assert(imageObject.device == queueObject.device)
2824
2825 return ?
2826}
2827
Jesse Halld27f6aa2015-08-15 17:58:48 -07002828cmd VkResult vkQueueBindSparseImageMemory(
2829 VkQueue queue,
2830 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002831 u32 bindInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002832 const VkSparseImageMemoryBindInfo* pBindInfo) {
2833 queueObject := GetQueue(queue)
2834 imageObject := GetImage(image)
2835
2836 return ?
2837}
2838
2839
2840// Fence functions
2841
2842@threadSafety("system")
2843cmd VkResult vkCreateFence(
2844 VkDevice device,
2845 const VkFenceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002846 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002847 VkFence* pFence) {
2848 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
2849 deviceObject := GetDevice(device)
2850
2851 fence := ?
2852 pFence[0] = fence
2853 State.Fences[fence] = new!FenceObject(
Jesse Halld8bade02015-11-24 10:24:18 -08002854 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT)))
Jesse Halld27f6aa2015-08-15 17:58:48 -07002855
2856 return ?
2857}
2858
2859@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002860cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002861 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002862 VkFence fence,
2863 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002864 deviceObject := GetDevice(device)
2865 fenceObject := GetFence(fence)
2866 assert(fenceObject.device == device)
2867
2868 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002869}
2870
2871@threadSafety("system")
2872cmd VkResult vkResetFences(
2873 VkDevice device,
2874 u32 fenceCount,
2875 const VkFence* pFences) {
2876 deviceObject := GetDevice(device)
2877
2878 fences := pFences[0:fenceCount]
2879 for i in (0 .. fenceCount) {
2880 fence := fences[i]
2881 fenceObject := GetFence(fence)
2882 assert(fenceObject.device == device)
2883 fenceObject.signaled = false
2884 }
2885
2886 return ?
2887}
2888
2889@threadSafety("system")
2890cmd VkResult vkGetFenceStatus(
2891 VkDevice device,
2892 VkFence fence) {
2893 deviceObject := GetDevice(device)
2894 fenceObject := GetFence(fence)
2895 assert(fenceObject.device == device)
2896
2897 return ?
2898}
2899
2900@threadSafety("system")
2901cmd VkResult vkWaitForFences(
2902 VkDevice device,
2903 u32 fenceCount,
2904 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002905 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002906 u64 timeout) { /// timeout in nanoseconds
2907 deviceObject := GetDevice(device)
2908
2909 fences := pFences[0:fenceCount]
2910 for i in (0 .. fenceCount) {
2911 fence := fences[i]
2912 fenceObject := GetFence(fence)
2913 assert(fenceObject.device == device)
2914 }
2915
2916 return ?
2917}
2918
2919
2920// Queue semaphore functions
2921
2922@threadSafety("system")
2923cmd VkResult vkCreateSemaphore(
2924 VkDevice device,
2925 const VkSemaphoreCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002926 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002927 VkSemaphore* pSemaphore) {
2928 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
2929 deviceObject := GetDevice(device)
2930
2931 semaphore := ?
2932 pSemaphore[0] = semaphore
2933 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
2934
2935 return ?
2936}
2937
2938@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002939cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002940 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002941 VkSemaphore semaphore,
2942 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002943 deviceObject := GetDevice(device)
2944 semaphoreObject := GetSemaphore(semaphore)
2945 assert(semaphoreObject.device == device)
2946
2947 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002948}
2949
Jesse Halld27f6aa2015-08-15 17:58:48 -07002950
2951// Event functions
2952
2953@threadSafety("system")
2954cmd VkResult vkCreateEvent(
2955 VkDevice device,
2956 const VkEventCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002957 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002958 VkEvent* pEvent) {
2959 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
2960 deviceObject := GetDevice(device)
2961
2962 event := ?
2963 pEvent[0] = event
2964 State.Events[event] = new!EventObject(device: device)
2965
2966 return ?
2967}
2968
2969@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002970cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002971 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002972 VkEvent event,
2973 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002974 deviceObject := GetDevice(device)
2975 eventObject := GetEvent(event)
2976 assert(eventObject.device == device)
2977
2978 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002979}
2980
2981@threadSafety("system")
2982cmd VkResult vkGetEventStatus(
2983 VkDevice device,
2984 VkEvent event) {
2985 deviceObject := GetDevice(device)
2986 eventObject := GetEvent(event)
2987 assert(eventObject.device == device)
2988
2989 return ?
2990}
2991
2992@threadSafety("system")
2993cmd VkResult vkSetEvent(
2994 VkDevice device,
2995 VkEvent event) {
2996 deviceObject := GetDevice(device)
2997 eventObject := GetEvent(event)
2998 assert(eventObject.device == device)
2999
3000 return ?
3001}
3002
3003@threadSafety("system")
3004cmd VkResult vkResetEvent(
3005 VkDevice device,
3006 VkEvent event) {
3007 deviceObject := GetDevice(device)
3008 eventObject := GetEvent(event)
3009 assert(eventObject.device == device)
3010
3011 return ?
3012}
3013
3014
3015// Query functions
3016
3017@threadSafety("system")
3018cmd VkResult vkCreateQueryPool(
3019 VkDevice device,
3020 const VkQueryPoolCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003021 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003022 VkQueryPool* pQueryPool) {
3023 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
3024 deviceObject := GetDevice(device)
3025
3026 queryPool := ?
3027 pQueryPool[0] = queryPool
3028 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
3029
3030 return ?
3031}
3032
3033@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003034cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003035 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003036 VkQueryPool queryPool,
3037 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003038 deviceObject := GetDevice(device)
3039 queryPoolObject := GetQueryPool(queryPool)
3040 assert(queryPoolObject.device == device)
3041
3042 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003043}
3044
3045@threadSafety("system")
3046cmd VkResult vkGetQueryPoolResults(
3047 VkDevice device,
3048 VkQueryPool queryPool,
3049 u32 startQuery,
3050 u32 queryCount,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003051 platform.size_t dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003052 void* pData,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003053 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003054 VkQueryResultFlags flags) {
3055 deviceObject := GetDevice(device)
3056 queryPoolObject := GetQueryPool(queryPool)
3057 assert(queryPoolObject.device == device)
3058
Jesse Halld27f6aa2015-08-15 17:58:48 -07003059 data := pData[0:dataSize]
3060
3061 return ?
3062}
3063
3064// Buffer functions
3065
3066@threadSafety("system")
3067cmd VkResult vkCreateBuffer(
3068 VkDevice device,
3069 const VkBufferCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003070 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003071 VkBuffer* pBuffer) {
3072 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
3073 deviceObject := GetDevice(device)
3074
3075 buffer := ?
3076 pBuffer[0] = buffer
3077 State.Buffers[buffer] = new!BufferObject(device: device)
3078
3079 return ?
3080}
3081
3082@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003083cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003084 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003085 VkBuffer buffer,
3086 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003087 deviceObject := GetDevice(device)
3088 bufferObject := GetBuffer(buffer)
3089 assert(bufferObject.device == device)
3090
3091 assert(bufferObject.mem == 0)
3092 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003093}
3094
3095
3096// Buffer view functions
3097
3098@threadSafety("system")
3099cmd VkResult vkCreateBufferView(
3100 VkDevice device,
3101 const VkBufferViewCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003102 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003103 VkBufferView* pView) {
3104 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
3105 deviceObject := GetDevice(device)
3106
3107 bufferObject := GetBuffer(pCreateInfo.buffer)
3108 assert(bufferObject.device == device)
3109
3110 view := ?
3111 pView[0] = view
3112 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
3113
3114 return ?
3115}
3116
3117@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003118cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003119 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003120 VkBufferView bufferView,
3121 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003122 deviceObject := GetDevice(device)
3123 bufferViewObject := GetBufferView(bufferView)
3124 assert(bufferViewObject.device == device)
3125
3126 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003127}
3128
3129
3130// Image functions
3131
3132@threadSafety("system")
3133cmd VkResult vkCreateImage(
3134 VkDevice device,
3135 const VkImageCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003136 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003137 VkImage* pImage) {
3138 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
3139 deviceObject := GetDevice(device)
3140
3141 image := ?
3142 pImage[0] = image
3143 State.Images[image] = new!ImageObject(device: device)
3144
3145 return ?
3146}
3147
3148@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003149cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003150 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003151 VkImage image,
3152 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003153 deviceObject := GetDevice(device)
3154 imageObject := GetImage(image)
3155 assert(imageObject.device == device)
3156
3157 assert(imageObject.mem == 0)
3158 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003159}
3160
Jesse Hall606a54e2015-11-19 22:17:28 -08003161cmd void vkGetImageSubresourceLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003162 VkDevice device,
3163 VkImage image,
3164 const VkImageSubresource* pSubresource,
3165 VkSubresourceLayout* pLayout) {
3166 deviceObject := GetDevice(device)
3167 imageObject := GetImage(image)
3168 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003169}
3170
3171
3172// Image view functions
3173
3174@threadSafety("system")
3175cmd VkResult vkCreateImageView(
3176 VkDevice device,
3177 const VkImageViewCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003178 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003179 VkImageView* pView) {
3180 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
3181 deviceObject := GetDevice(device)
3182
3183 imageObject := GetImage(pCreateInfo.image)
3184 assert(imageObject.device == device)
3185
3186 view := ?
3187 pView[0] = view
3188 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
3189
3190 return ?
3191}
3192
3193@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003194cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003195 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003196 VkImageView imageView,
3197 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003198 deviceObject := GetDevice(device)
3199 imageViewObject := GetImageView(imageView)
3200 assert(imageViewObject.device == device)
3201
3202 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003203}
3204
3205
3206// Shader functions
3207
3208cmd VkResult vkCreateShaderModule(
3209 VkDevice device,
3210 const VkShaderModuleCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003211 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003212 VkShaderModule* pShaderModule) {
3213 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
3214 deviceObject := GetDevice(device)
3215
3216 shaderModule := ?
3217 pShaderModule[0] = shaderModule
3218 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
3219
3220 return ?
3221}
3222
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003223cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003224 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003225 VkShaderModule shaderModule,
3226 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003227 deviceObject := GetDevice(device)
3228 shaderModuleObject := GetShaderModule(shaderModule)
3229 assert(shaderModuleObject.device == device)
3230
3231 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003232}
3233
3234@threadSafety("system")
3235cmd VkResult vkCreateShader(
3236 VkDevice device,
3237 const VkShaderCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003238 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003239 VkShader* pShader) {
3240 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO)
3241 deviceObject := GetDevice(device)
3242
3243 shader := ?
3244 pShader[0] = shader
3245 State.Shaders[shader] = new!ShaderObject(device: device)
3246
3247 return ?
3248}
3249
3250@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003251cmd void vkDestroyShader(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003252 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003253 VkShader shader,
3254 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003255 deviceObject := GetDevice(device)
3256 shaderObject := GetShader(shader)
3257 assert(shaderObject.device == device)
3258
3259 State.Shaders[shader] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003260}
3261
3262
3263// Pipeline functions
3264
3265cmd VkResult vkCreatePipelineCache(
3266 VkDevice device,
3267 const VkPipelineCacheCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003268 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003269 VkPipelineCache* pPipelineCache) {
3270 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
3271 deviceObject := GetDevice(device)
3272
3273 pipelineCache := ?
3274 pPipelineCache[0] = pipelineCache
3275 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
3276
3277 return ?
3278}
3279
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003280cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003281 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003282 VkPipelineCache pipelineCache,
3283 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003284 deviceObject := GetDevice(device)
3285 pipelineCacheObject := GetPipelineCache(pipelineCache)
3286 assert(pipelineCacheObject.device == device)
3287
3288 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003289}
3290
Jesse Halld27f6aa2015-08-15 17:58:48 -07003291cmd VkResult vkGetPipelineCacheData(
3292 VkDevice device,
3293 VkPipelineCache pipelineCache,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003294 platform.size_t* pDataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003295 void* pData) {
3296 deviceObject := GetDevice(device)
3297 pipelineCacheObject := GetPipelineCache(pipelineCache)
3298 assert(pipelineCacheObject.device == device)
3299
3300 return ?
3301}
3302
3303cmd VkResult vkMergePipelineCaches(
3304 VkDevice device,
3305 VkPipelineCache destCache,
3306 u32 srcCacheCount,
3307 const VkPipelineCache* pSrcCaches) {
3308 deviceObject := GetDevice(device)
3309 destCacheObject := GetPipelineCache(destCache)
3310 assert(destCacheObject.device == device)
3311
3312 srcCaches := pSrcCaches[0:srcCacheCount]
3313 for i in (0 .. srcCacheCount) {
3314 srcCache := srcCaches[i]
3315 srcCacheObject := GetPipelineCache(srcCache)
3316 assert(srcCacheObject.device == device)
3317 }
3318
3319 return ?
3320}
3321
3322cmd VkResult vkCreateGraphicsPipelines(
3323 VkDevice device,
3324 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003325 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003326 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003327 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003328 VkPipeline* pPipelines) {
3329 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003330 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003331 pipelineCacheObject := GetPipelineCache(pipelineCache)
3332 assert(pipelineCacheObject.device == device)
3333 }
3334
Jesse Hall03b6fe12015-11-24 12:44:21 -08003335 createInfos := pCreateInfos[0:createInfoCount]
3336 pipelines := pPipelines[0:createInfoCount]
3337 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003338 pipeline := ?
3339 pipelines[i] = pipeline
3340 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3341 }
3342
3343 return ?
3344}
3345
3346cmd VkResult vkCreateComputePipelines(
3347 VkDevice device,
3348 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003349 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003350 const VkComputePipelineCreateInfo* pCreateInfos,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003351 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003352 VkPipeline* pPipelines) {
3353 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003354 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003355 pipelineCacheObject := GetPipelineCache(pipelineCache)
3356 assert(pipelineCacheObject.device == device)
3357 }
3358
Jesse Hall03b6fe12015-11-24 12:44:21 -08003359 createInfos := pCreateInfos[0:createInfoCount]
3360 pipelines := pPipelines[0:createInfoCount]
3361 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003362 pipeline := ?
3363 pipelines[i] = pipeline
3364 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3365 }
3366
3367 return ?
3368}
3369
3370@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003371cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003372 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003373 VkPipeline pipeline,
3374 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003375 deviceObject := GetDevice(device)
3376 pipelineObjects := GetPipeline(pipeline)
3377 assert(pipelineObjects.device == device)
3378
3379 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003380}
3381
3382
3383// Pipeline layout functions
3384
3385@threadSafety("system")
3386cmd VkResult vkCreatePipelineLayout(
3387 VkDevice device,
3388 const VkPipelineLayoutCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003389 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003390 VkPipelineLayout* pPipelineLayout) {
3391 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3392 deviceObject := GetDevice(device)
3393
3394 pipelineLayout := ?
3395 pPipelineLayout[0] = pipelineLayout
3396 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3397
3398 return ?
3399}
3400
3401@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003402cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003403 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003404 VkPipelineLayout pipelineLayout,
3405 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003406 deviceObject := GetDevice(device)
3407 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3408 assert(pipelineLayoutObjects.device == device)
3409
3410 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003411}
3412
3413
3414// Sampler functions
3415
3416@threadSafety("system")
3417cmd VkResult vkCreateSampler(
3418 VkDevice device,
3419 const VkSamplerCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003420 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003421 VkSampler* pSampler) {
3422 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3423 deviceObject := GetDevice(device)
3424
3425 sampler := ?
3426 pSampler[0] = sampler
3427 State.Samplers[sampler] = new!SamplerObject(device: device)
3428
3429 return ?
3430}
3431
3432@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003433cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003434 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003435 VkSampler sampler,
3436 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003437 deviceObject := GetDevice(device)
3438 samplerObject := GetSampler(sampler)
3439 assert(samplerObject.device == device)
3440
3441 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003442}
3443
3444
3445// Descriptor set functions
3446
3447@threadSafety("system")
3448cmd VkResult vkCreateDescriptorSetLayout(
3449 VkDevice device,
3450 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003451 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003452 VkDescriptorSetLayout* pSetLayout) {
3453 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3454 deviceObject := GetDevice(device)
3455
3456 setLayout := ?
3457 pSetLayout[0] = setLayout
3458 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3459
3460 return ?
3461}
3462
3463@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003464cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003465 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003466 VkDescriptorSetLayout descriptorSetLayout,
3467 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003468 deviceObject := GetDevice(device)
3469 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3470 assert(descriptorSetLayoutObject.device == device)
3471
3472 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003473}
3474
3475@threadSafety("system")
3476cmd VkResult vkCreateDescriptorPool(
3477 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003478 const VkDescriptorPoolCreateInfo* pCreateInfo,
3479 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003480 VkDescriptorPool* pDescriptorPool) {
3481 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3482 deviceObject := GetDevice(device)
3483
3484 descriptorPool := ?
3485 pDescriptorPool[0] = descriptorPool
3486 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3487
3488 return ?
3489}
3490
3491@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003492cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003493 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003494 VkDescriptorPool descriptorPool,
3495 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003496 deviceObject := GetDevice(device)
3497 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3498 assert(descriptorPoolObject.device == device)
3499
3500 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003501}
3502
3503@threadSafety("app")
3504cmd VkResult vkResetDescriptorPool(
3505 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003506 VkDescriptorPool descriptorPool,
3507 VkDescriptorPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003508 deviceObject := GetDevice(device)
3509 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3510 assert(descriptorPoolObject.device == device)
3511
3512 return ?
3513}
3514
3515@threadSafety("app")
3516cmd VkResult vkAllocDescriptorSets(
3517 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003518 const VkDescriptorSetAllocInfo* pAllocInfo,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003519 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003520 deviceObject := GetDevice(device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003521 allocInfo := pAllocInfo[0]
3522 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003523
Jesse Hall03b6fe12015-11-24 12:44:21 -08003524 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount]
3525 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003526 setLayout := setLayouts[i]
3527 setLayoutObject := GetDescriptorSetLayout(setLayout)
3528 assert(setLayoutObject.device == device)
3529 }
3530
Jesse Hall03b6fe12015-11-24 12:44:21 -08003531 descriptorSets := pDescriptorSets[0:allocInfo.setCount]
3532 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003533 descriptorSet := ?
3534 descriptorSets[i] = descriptorSet
3535 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3536 }
3537
3538 return ?
3539}
3540
Jesse Hallf09c6b12015-08-15 19:54:28 -07003541cmd VkResult vkFreeDescriptorSets(
3542 VkDevice device,
3543 VkDescriptorPool descriptorPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003544 u32 descriptorSetCount,
Jesse Hallf09c6b12015-08-15 19:54:28 -07003545 const VkDescriptorSet* pDescriptorSets) {
3546 deviceObject := GetDevice(device)
3547 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3548
Jesse Hall03b6fe12015-11-24 12:44:21 -08003549 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3550 for i in (0 .. descriptorSetCount) {
Jesse Hallf09c6b12015-08-15 19:54:28 -07003551 descriptorSet := descriptorSets[i]
3552 descriptorSetObject := GetDescriptorSet(descriptorSet)
3553 assert(descriptorSetObject.device == device)
3554 State.DescriptorSets[descriptorSet] = null
3555 }
3556
3557 return ?
3558}
3559
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003560cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003561 VkDevice device,
3562 u32 writeCount,
3563 const VkWriteDescriptorSet* pDescriptorWrites,
3564 u32 copyCount,
3565 const VkCopyDescriptorSet* pDescriptorCopies) {
3566 deviceObject := GetDevice(device)
3567
3568 descriptorWrites := pDescriptorWrites[0:writeCount]
3569 for i in (0 .. writeCount) {
3570 descriptorWrite := descriptorWrites[i]
3571 descriptorWriteObject := GetDescriptorSet(descriptorWrite.destSet)
3572 assert(descriptorWriteObject.device == device)
3573 }
3574
3575 descriptorCopies := pDescriptorCopies[0:copyCount]
3576 for i in (0 .. copyCount) {
3577 descriptorCopy := descriptorCopies[i]
3578 descriptorCopyObject := GetDescriptorSet(descriptorCopy.destSet)
3579 assert(descriptorCopyObject.device == device)
3580 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003581}
3582
3583
3584// Framebuffer functions
3585
3586@threadSafety("system")
3587cmd VkResult vkCreateFramebuffer(
3588 VkDevice device,
3589 const VkFramebufferCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003590 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003591 VkFramebuffer* pFramebuffer) {
3592 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3593 deviceObject := GetDevice(device)
3594
3595 framebuffer := ?
3596 pFramebuffer[0] = framebuffer
3597 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3598
3599 return ?
3600}
3601
3602@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003603cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003604 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003605 VkFramebuffer framebuffer,
3606 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003607 deviceObject := GetDevice(device)
3608 framebufferObject := GetFramebuffer(framebuffer)
3609 assert(framebufferObject.device == device)
3610
3611 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003612}
3613
3614
3615// Renderpass functions
3616
3617@threadSafety("system")
3618cmd VkResult vkCreateRenderPass(
3619 VkDevice device,
3620 const VkRenderPassCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003621 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003622 VkRenderPass* pRenderPass) {
3623 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3624 deviceObject := GetDevice(device)
3625
3626 renderpass := ?
3627 pRenderPass[0] = renderpass
3628 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3629
3630 return ?
3631}
3632
3633@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003634cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003635 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003636 VkRenderPass renderPass,
3637 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003638 deviceObject := GetDevice(device)
3639 renderPassObject := GetRenderPass(renderPass)
3640 assert(renderPassObject.device == device)
3641
3642 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003643}
3644
Jesse Hall606a54e2015-11-19 22:17:28 -08003645cmd void vkGetRenderAreaGranularity(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003646 VkDevice device,
3647 VkRenderPass renderPass,
3648 VkExtent2D* pGranularity) {
3649 deviceObject := GetDevice(device)
3650 renderPassObject := GetRenderPass(renderPass)
3651
3652 granularity := ?
3653 pGranularity[0] = granularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07003654}
3655
3656// Command pool functions
3657
3658cmd VkResult vkCreateCommandPool(
3659 VkDevice device,
3660 const VkCmdPoolCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003661 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003662 VkCmdPool* pCmdPool) {
3663 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO)
3664 deviceObject := GetDevice(device)
3665
3666 cmdPool := ?
3667 pCmdPool[0] = cmdPool
3668 State.CmdPools[cmdPool] = new!CmdPoolObject(device: device)
3669
3670 return ?
3671}
3672
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003673cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003674 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003675 VkCmdPool cmdPool,
3676 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003677 deviceObject := GetDevice(device)
3678 cmdPoolObject := GetCmdPool(cmdPool)
3679 assert(cmdPoolObject.device == device)
3680
3681 State.CmdPools[cmdPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003682}
3683
3684cmd VkResult vkResetCommandPool(
3685 VkDevice device,
3686 VkCmdPool cmdPool,
3687 VkCmdPoolResetFlags flags) {
3688 deviceObject := GetDevice(device)
3689 cmdPoolObject := GetCmdPool(cmdPool)
3690 assert(cmdPoolObject.device == device)
3691
3692 return ?
3693}
3694
3695// Command buffer functions
3696
3697macro void bindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3698 memoryObject := GetDeviceMemory(mem)
3699 memoryObject.boundCommandBuffers[cmdBuffer] = cmdBuffer
3700
3701 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3702 cmdBufferObject.boundObjects[as!u64(obj)] = mem
3703}
3704
3705macro void unbindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3706 memoryObject := GetDeviceMemory(mem)
3707 memoryObject.boundCommandBuffers[cmdBuffer] = null
3708
3709 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3710 cmdBufferObject.boundObjects[as!u64(obj)] = null
3711}
3712
3713@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003714cmd VkResult vkAllocCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003715 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003716 const VkCmdBufferAllocInfo* pAllocInfo,
3717 VkCmdBuffer* pCmdBuffers) {
3718 assert(pAllocInfo[0].sType == VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003719
Jesse Hall03b6fe12015-11-24 12:44:21 -08003720 count := pAllocInfo[0].bufferCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08003721 cmdBuffers := pCmdBuffers[0:count]
3722 for i in (0 .. count) {
3723 cmdBuffer := ?
3724 cmdBuffers[i] = cmdBuffer
3725 State.CmdBuffers[cmdBuffer] = new!CmdBufferObject(device: device)
3726 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003727
3728 return ?
3729}
3730
3731@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003732cmd void vkFreeCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003733 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003734 VkCmdPool cmdPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003735 u32 commandBufferCount,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003736 const VkCmdBuffer* pCommandBuffers) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003737 deviceObject := GetDevice(device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003738
Jesse Hall03b6fe12015-11-24 12:44:21 -08003739 cmdBuffers := pCommandBuffers[0:commandBufferCount]
3740 for i in (0 .. commandBufferCount) {
Jesse Hallfbf97b02015-11-20 14:17:03 -08003741 cmdBufferObject := GetCmdBuffer(cmdBuffers[i])
3742 assert(cmdBufferObject.device == device)
3743 // TODO: iterate over boundObjects and clear memory bindings
3744 State.CmdBuffers[cmdBuffers[i]] = null
3745 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003746}
3747
3748@threadSafety("app")
3749cmd VkResult vkBeginCommandBuffer(
3750 VkCmdBuffer cmdBuffer,
3751 const VkCmdBufferBeginInfo* pBeginInfo) {
3752 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO)
3753 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3754
3755 // TODO: iterate over boundObjects and clear memory bindings
3756
3757 return ?
3758}
3759
3760@threadSafety("app")
3761cmd VkResult vkEndCommandBuffer(
3762 VkCmdBuffer cmdBuffer) {
3763 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3764
3765 return ?
3766}
3767
3768@threadSafety("app")
3769cmd VkResult vkResetCommandBuffer(
3770 VkCmdBuffer cmdBuffer,
3771 VkCmdBufferResetFlags flags) {
3772 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3773
3774 // TODO: iterate over boundObjects and clear memory bindings
3775
3776 return ?
3777}
3778
3779
3780// Command buffer building functions
3781
3782@threadSafety("app")
3783cmd void vkCmdBindPipeline(
3784 VkCmdBuffer cmdBuffer,
3785 VkPipelineBindPoint pipelineBindPoint,
3786 VkPipeline pipeline) {
3787 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3788 pipelineObject := GetPipeline(pipeline)
3789 assert(cmdBufferObject.device == pipelineObject.device)
3790
Jesse Halld8bade02015-11-24 10:24:18 -08003791 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003792 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3793 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3794 }
Jesse Halld8bade02015-11-24 10:24:18 -08003795 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003796}
3797
3798@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003799cmd void vkCmdSetViewport(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003800 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003801 u32 viewportCount,
3802 const VkViewport* pViewports) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003803 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003804 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003805}
3806
3807@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003808cmd void vkCmdSetScissor(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003809 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003810 u32 scissorCount,
3811 const VkRect2D* pScissors) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003812 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003813 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003814}
3815
3816@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003817cmd void vkCmdSetLineWidth(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003818 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003819 f32 lineWidth) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003820 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003821 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003822}
3823
3824@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003825cmd void vkCmdSetDepthBias(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003826 VkCmdBuffer cmdBuffer,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003827 f32 depthBiasConstantFactor,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003828 f32 depthBiasClamp,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003829 f32 depthBiasSlopeFactor) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003830 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003831 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003832}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003833
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003834@threadSafety("app")
3835cmd void vkCmdSetBlendConstants(
3836 VkCmdBuffer cmdBuffer,
3837 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3838 // an annotation as a quick hack to pass this to the template without
3839 // having to modify the AST and semantic model.
3840 @readonly f32[4] blendConst) {
3841 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003842 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003843}
3844
3845@threadSafety("app")
3846cmd void vkCmdSetDepthBounds(
3847 VkCmdBuffer cmdBuffer,
3848 f32 minDepthBounds,
3849 f32 maxDepthBounds) {
3850 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003851 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003852}
3853
3854@threadSafety("app")
3855cmd void vkCmdSetStencilCompareMask(
3856 VkCmdBuffer cmdBuffer,
3857 VkStencilFaceFlags faceMask,
3858 u32 stencilCompareMask) {
3859 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003860 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003861}
3862
3863@threadSafety("app")
3864cmd void vkCmdSetStencilWriteMask(
3865 VkCmdBuffer cmdBuffer,
3866 VkStencilFaceFlags faceMask,
3867 u32 stencilWriteMask) {
3868 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003869 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003870}
3871
3872@threadSafety("app")
3873cmd void vkCmdSetStencilReference(
3874 VkCmdBuffer cmdBuffer,
3875 VkStencilFaceFlags faceMask,
3876 u32 stencilReference) {
3877 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003878 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003879}
3880
3881@threadSafety("app")
3882cmd void vkCmdBindDescriptorSets(
3883 VkCmdBuffer cmdBuffer,
3884 VkPipelineBindPoint pipelineBindPoint,
3885 VkPipelineLayout layout,
3886 u32 firstSet,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003887 u32 descriptorSetCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003888 const VkDescriptorSet* pDescriptorSets,
3889 u32 dynamicOffsetCount,
3890 const u32* pDynamicOffsets) {
3891 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3892
Jesse Hall03b6fe12015-11-24 12:44:21 -08003893 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3894 for i in (0 .. descriptorSetCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003895 descriptorSet := descriptorSets[i]
3896 descriptorSetObject := GetDescriptorSet(descriptorSet)
3897 assert(cmdBufferObject.device == descriptorSetObject.device)
3898 }
3899
3900 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
3901 for i in (0 .. dynamicOffsetCount) {
3902 dynamicOffset := dynamicOffsets[i]
3903 }
3904
Jesse Halld8bade02015-11-24 10:24:18 -08003905 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003906 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3907 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3908 }
Jesse Halld8bade02015-11-24 10:24:18 -08003909 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003910}
3911
3912@threadSafety("app")
3913cmd void vkCmdBindIndexBuffer(
3914 VkCmdBuffer cmdBuffer,
3915 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003916 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003917 VkIndexType indexType) {
3918 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3919 bufferObject := GetBuffer(buffer)
3920 assert(cmdBufferObject.device == bufferObject.device)
3921
3922 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
3923
Jesse Halld8bade02015-11-24 10:24:18 -08003924 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003925}
3926
3927@threadSafety("app")
3928cmd void vkCmdBindVertexBuffers(
3929 VkCmdBuffer cmdBuffer,
3930 u32 startBinding,
3931 u32 bindingCount,
3932 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003933 const VkDeviceSize* pOffsets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003934 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3935
3936 // TODO: check if not [startBinding:startBinding+bindingCount]
3937 buffers := pBuffers[0:bindingCount]
3938 offsets := pOffsets[0:bindingCount]
3939 for i in (0 .. bindingCount) {
3940 buffer := buffers[i]
3941 offset := offsets[i]
3942 bufferObject := GetBuffer(buffer)
3943 assert(cmdBufferObject.device == bufferObject.device)
3944
3945 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
3946 }
3947
Jesse Halld8bade02015-11-24 10:24:18 -08003948 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003949}
3950
3951@threadSafety("app")
3952cmd void vkCmdDraw(
3953 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003954 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003955 u32 instanceCount,
3956 u32 firstVertex,
3957 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003958 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3959
Jesse Halld8bade02015-11-24 10:24:18 -08003960 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003961}
3962
3963@threadSafety("app")
3964cmd void vkCmdDrawIndexed(
3965 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003966 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003967 u32 instanceCount,
3968 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003969 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003970 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003971 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3972
Jesse Halld8bade02015-11-24 10:24:18 -08003973 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003974}
3975
3976@threadSafety("app")
3977cmd void vkCmdDrawIndirect(
3978 VkCmdBuffer cmdBuffer,
3979 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003980 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003981 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003982 u32 stride) {
3983 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3984 bufferObject := GetBuffer(buffer)
3985 assert(cmdBufferObject.device == bufferObject.device)
3986
3987 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
3988
Jesse Halld8bade02015-11-24 10:24:18 -08003989 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003990}
3991
3992@threadSafety("app")
3993cmd void vkCmdDrawIndexedIndirect(
3994 VkCmdBuffer cmdBuffer,
3995 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003996 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003997 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003998 u32 stride) {
3999 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4000 bufferObject := GetBuffer(buffer)
4001 assert(cmdBufferObject.device == bufferObject.device)
4002
4003 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4004
Jesse Halld8bade02015-11-24 10:24:18 -08004005 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004006}
4007
4008@threadSafety("app")
4009cmd void vkCmdDispatch(
4010 VkCmdBuffer cmdBuffer,
4011 u32 x,
4012 u32 y,
4013 u32 z) {
4014 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4015
Jesse Halld8bade02015-11-24 10:24:18 -08004016 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004017}
4018
4019@threadSafety("app")
4020cmd void vkCmdDispatchIndirect(
4021 VkCmdBuffer cmdBuffer,
4022 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004023 VkDeviceSize offset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004024 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4025 bufferObject := GetBuffer(buffer)
4026 assert(cmdBufferObject.device == bufferObject.device)
4027
4028 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4029
Jesse Halld8bade02015-11-24 10:24:18 -08004030 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004031}
4032
4033@threadSafety("app")
4034cmd void vkCmdCopyBuffer(
4035 VkCmdBuffer cmdBuffer,
4036 VkBuffer srcBuffer,
4037 VkBuffer destBuffer,
4038 u32 regionCount,
4039 const VkBufferCopy* pRegions) {
4040 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4041 srcBufferObject := GetBuffer(srcBuffer)
4042 destBufferObject := GetBuffer(destBuffer)
4043 assert(cmdBufferObject.device == srcBufferObject.device)
4044 assert(cmdBufferObject.device == destBufferObject.device)
4045
4046 regions := pRegions[0:regionCount]
4047 for i in (0 .. regionCount) {
4048 region := regions[i]
4049 }
4050
4051 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
4052 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4053
Jesse Halld8bade02015-11-24 10:24:18 -08004054 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004055}
4056
4057@threadSafety("app")
4058cmd void vkCmdCopyImage(
4059 VkCmdBuffer cmdBuffer,
4060 VkImage srcImage,
4061 VkImageLayout srcImageLayout,
4062 VkImage destImage,
4063 VkImageLayout destImageLayout,
4064 u32 regionCount,
4065 const VkImageCopy* pRegions) {
4066 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4067 srcImageObject := GetImage(srcImage)
4068 destImageObject := GetImage(destImage)
4069 assert(cmdBufferObject.device == srcImageObject.device)
4070 assert(cmdBufferObject.device == destImageObject.device)
4071
4072 regions := pRegions[0:regionCount]
4073 for i in (0 .. regionCount) {
4074 region := regions[i]
4075 }
4076
4077 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4078 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4079
Jesse Halld8bade02015-11-24 10:24:18 -08004080 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004081}
4082
4083@threadSafety("app")
4084cmd void vkCmdBlitImage(
4085 VkCmdBuffer cmdBuffer,
4086 VkImage srcImage,
4087 VkImageLayout srcImageLayout,
4088 VkImage destImage,
4089 VkImageLayout destImageLayout,
4090 u32 regionCount,
4091 const VkImageBlit* pRegions,
4092 VkTexFilter filter) {
4093 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4094 srcImageObject := GetImage(srcImage)
4095 destImageObject := GetImage(destImage)
4096 assert(cmdBufferObject.device == srcImageObject.device)
4097 assert(cmdBufferObject.device == destImageObject.device)
4098
4099 regions := pRegions[0:regionCount]
4100 for i in (0 .. regionCount) {
4101 region := regions[i]
4102 }
4103
4104 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4105 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4106
Jesse Halld8bade02015-11-24 10:24:18 -08004107 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004108}
4109
4110@threadSafety("app")
4111cmd void vkCmdCopyBufferToImage(
4112 VkCmdBuffer cmdBuffer,
4113 VkBuffer srcBuffer,
4114 VkImage destImage,
4115 VkImageLayout destImageLayout,
4116 u32 regionCount,
4117 const VkBufferImageCopy* pRegions) {
4118 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4119 srcBufferObject := GetBuffer(srcBuffer)
4120 destImageObject := GetImage(destImage)
4121 assert(cmdBufferObject.device == srcBufferObject.device)
4122 assert(cmdBufferObject.device == destImageObject.device)
4123
4124 regions := pRegions[0:regionCount]
4125 for i in (0 .. regionCount) {
4126 region := regions[i]
4127 }
4128
4129 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
4130 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4131
Jesse Halld8bade02015-11-24 10:24:18 -08004132 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004133}
4134
4135@threadSafety("app")
4136cmd void vkCmdCopyImageToBuffer(
4137 VkCmdBuffer cmdBuffer,
4138 VkImage srcImage,
4139 VkImageLayout srcImageLayout,
4140 VkBuffer destBuffer,
4141 u32 regionCount,
4142 const VkBufferImageCopy* pRegions) {
4143 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4144 srcImageObject := GetImage(srcImage)
4145 destBufferObject := GetBuffer(destBuffer)
4146 assert(cmdBufferObject.device == srcImageObject.device)
4147 assert(cmdBufferObject.device == destBufferObject.device)
4148
4149 regions := pRegions[0:regionCount]
4150 for i in (0 .. regionCount) {
4151 region := regions[i]
4152 }
4153
4154 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4155 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4156
Jesse Halld8bade02015-11-24 10:24:18 -08004157 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004158}
4159
4160@threadSafety("app")
4161cmd void vkCmdUpdateBuffer(
4162 VkCmdBuffer cmdBuffer,
4163 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004164 VkDeviceSize destOffset,
4165 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004166 const u32* pData) {
4167 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4168 destBufferObject := GetBuffer(destBuffer)
4169 assert(cmdBufferObject.device == destBufferObject.device)
4170
4171 data := pData[0:dataSize]
4172
4173 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4174
Jesse Halld8bade02015-11-24 10:24:18 -08004175 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004176}
4177
4178@threadSafety("app")
4179cmd void vkCmdFillBuffer(
4180 VkCmdBuffer cmdBuffer,
4181 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004182 VkDeviceSize destOffset,
4183 VkDeviceSize fillSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004184 u32 data) {
4185 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4186 destBufferObject := GetBuffer(destBuffer)
4187 assert(cmdBufferObject.device == destBufferObject.device)
4188
Jesse Halld8bade02015-11-24 10:24:18 -08004189 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004190}
4191
4192@threadSafety("app")
4193cmd void vkCmdClearColorImage(
4194 VkCmdBuffer cmdBuffer,
4195 VkImage image,
4196 VkImageLayout imageLayout,
4197 const VkClearColorValue* pColor,
4198 u32 rangeCount,
4199 const VkImageSubresourceRange* pRanges) {
4200 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4201 imageObject := GetImage(image)
4202 assert(cmdBufferObject.device == imageObject.device)
4203
4204 ranges := pRanges[0:rangeCount]
4205 for i in (0 .. rangeCount) {
4206 range := ranges[i]
4207 }
4208
4209 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
4210
Jesse Halld8bade02015-11-24 10:24:18 -08004211 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004212}
4213
4214@threadSafety("app")
4215cmd void vkCmdClearDepthStencilImage(
4216 VkCmdBuffer cmdBuffer,
4217 VkImage image,
4218 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004219 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004220 u32 rangeCount,
4221 const VkImageSubresourceRange* pRanges) {
4222 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4223 imageObject := GetImage(image)
4224 assert(cmdBufferObject.device == imageObject.device)
4225
4226 ranges := pRanges[0:rangeCount]
4227 for i in (0 .. rangeCount) {
4228 range := ranges[i]
4229 }
4230
4231 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
4232
Jesse Halld8bade02015-11-24 10:24:18 -08004233 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004234}
4235
4236@threadSafety("app")
Jesse Hallae38f732015-11-19 21:32:50 -08004237cmd void vkCmdClearAttachments(
Jesse Halld27f6aa2015-08-15 17:58:48 -07004238 VkCmdBuffer cmdBuffer,
Jesse Hallae38f732015-11-19 21:32:50 -08004239 u32 attachmentCount,
4240 const VkClearAttachment* pAttachments,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004241 u32 rectCount,
Jesse Halla15a4bf2015-11-19 22:48:02 -08004242 const VkClearRect* pRects) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004243 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4244
4245 rects := pRects[0:rectCount]
4246 for i in (0 .. rectCount) {
4247 rect := rects[i]
4248 }
4249
Jesse Halld8bade02015-11-24 10:24:18 -08004250 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004251}
4252
4253@threadSafety("app")
4254cmd void vkCmdResolveImage(
4255 VkCmdBuffer cmdBuffer,
4256 VkImage srcImage,
4257 VkImageLayout srcImageLayout,
4258 VkImage destImage,
4259 VkImageLayout destImageLayout,
4260 u32 regionCount,
4261 const VkImageResolve* pRegions) {
4262 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4263 srcImageObject := GetImage(srcImage)
4264 destImageObject := GetImage(destImage)
4265 assert(cmdBufferObject.device == srcImageObject.device)
4266 assert(cmdBufferObject.device == destImageObject.device)
4267
4268 regions := pRegions[0:regionCount]
4269 for i in (0 .. regionCount) {
4270 region := regions[i]
4271 }
4272
4273 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4274 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4275
Jesse Halld8bade02015-11-24 10:24:18 -08004276 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004277}
4278
4279@threadSafety("app")
4280cmd void vkCmdSetEvent(
4281 VkCmdBuffer cmdBuffer,
4282 VkEvent event,
4283 VkPipelineStageFlags stageMask) {
4284 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4285 eventObject := GetEvent(event)
4286 assert(cmdBufferObject.device == eventObject.device)
4287}
4288
4289@threadSafety("app")
4290cmd void vkCmdResetEvent(
4291 VkCmdBuffer cmdBuffer,
4292 VkEvent event,
4293 VkPipelineStageFlags stageMask) {
4294 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4295 eventObject := GetEvent(event)
4296 assert(cmdBufferObject.device == eventObject.device)
4297}
4298
4299@threadSafety("app")
4300cmd void vkCmdWaitEvents(
4301 VkCmdBuffer cmdBuffer,
4302 u32 eventCount,
4303 const VkEvent* pEvents,
4304 VkPipelineStageFlags srcStageMask,
4305 VkPipelineStageFlags destStageMask,
4306 u32 memBarrierCount,
4307 const void* const* ppMemBarriers) {
4308 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4309
4310 events := pEvents[0:eventCount]
4311 for i in (0 .. eventCount) {
4312 event := events[i]
4313 eventObject := GetEvent(event)
4314 assert(cmdBufferObject.device == eventObject.device)
4315 }
4316
4317 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4318 for i in (0 .. memBarrierCount) {
4319 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4320 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4321 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4322 }
4323 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4324 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4325 imageObject := GetImage(imageMemBarrier.image)
4326 assert(imageObject.device == cmdBufferObject.device)
4327 }
4328 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4329 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4330 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4331 assert(bufferObject.device == cmdBufferObject.device)
4332 }
4333 }
4334 }
4335}
4336
4337@threadSafety("app")
4338cmd void vkCmdPipelineBarrier(
4339 VkCmdBuffer cmdBuffer,
4340 VkPipelineStageFlags srcStageMask,
4341 VkPipelineStageFlags destStageMask,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004342 VkBool32 byRegion,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004343 u32 memBarrierCount,
4344 const void* const* ppMemBarriers) {
4345 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4346
4347 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4348 for i in (0 .. memBarrierCount) {
4349 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4350 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4351 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4352 }
4353 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4354 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4355 imageObject := GetImage(imageMemBarrier.image)
4356 assert(imageObject.device == cmdBufferObject.device)
4357 }
4358 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4359 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4360 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4361 assert(bufferObject.device == cmdBufferObject.device)
4362 }
4363 }
4364 }
4365}
4366
4367@threadSafety("app")
4368cmd void vkCmdBeginQuery(
4369 VkCmdBuffer cmdBuffer,
4370 VkQueryPool queryPool,
4371 u32 slot,
4372 VkQueryControlFlags flags) {
4373 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4374 queryPoolObject := GetQueryPool(queryPool)
4375 assert(cmdBufferObject.device == queryPoolObject.device)
4376}
4377
4378@threadSafety("app")
4379cmd void vkCmdEndQuery(
4380 VkCmdBuffer cmdBuffer,
4381 VkQueryPool queryPool,
4382 u32 slot) {
4383 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4384 queryPoolObject := GetQueryPool(queryPool)
4385 assert(cmdBufferObject.device == queryPoolObject.device)
4386}
4387
4388@threadSafety("app")
4389cmd void vkCmdResetQueryPool(
4390 VkCmdBuffer cmdBuffer,
4391 VkQueryPool queryPool,
4392 u32 startQuery,
4393 u32 queryCount) {
4394 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4395 queryPoolObject := GetQueryPool(queryPool)
4396 assert(cmdBufferObject.device == queryPoolObject.device)
4397}
4398
4399@threadSafety("app")
4400cmd void vkCmdWriteTimestamp(
4401 VkCmdBuffer cmdBuffer,
Jesse Hall6f39a6d2015-11-24 11:08:36 -08004402 VkPipelineStageFlagBits pipelineStage,
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004403 VkQueryPool queryPool,
4404 u32 slot) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004405 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004406 queryPoolObject := GetQueryPool(queryPool)
4407 assert(cmdBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004408}
4409
4410@threadSafety("app")
4411cmd void vkCmdCopyQueryPoolResults(
4412 VkCmdBuffer cmdBuffer,
4413 VkQueryPool queryPool,
4414 u32 startQuery,
4415 u32 queryCount,
4416 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004417 VkDeviceSize destOffset,
Jesse Halla9bb62b2015-11-21 19:31:56 -08004418 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004419 VkQueryResultFlags flags) {
4420 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4421 queryPoolObject := GetQueryPool(queryPool)
4422 destBufferObject := GetBuffer(destBuffer)
4423 assert(cmdBufferObject.device == queryPoolObject.device)
4424 assert(cmdBufferObject.device == destBufferObject.device)
4425}
4426
4427cmd void vkCmdPushConstants(
4428 VkCmdBuffer cmdBuffer,
4429 VkPipelineLayout layout,
4430 VkShaderStageFlags stageFlags,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004431 u32 offset,
4432 u32 size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004433 const void* values) {
4434 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4435 layoutObject := GetPipelineLayout(layout)
4436 assert(cmdBufferObject.device == layoutObject.device)
4437}
4438
4439@threadSafety("app")
4440cmd void vkCmdBeginRenderPass(
4441 VkCmdBuffer cmdBuffer,
4442 const VkRenderPassBeginInfo* pRenderPassBegin,
4443 VkRenderPassContents contents) {
4444 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4445 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4446 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
4447 assert(cmdBufferObject.device == renderPassObject.device)
4448 assert(cmdBufferObject.device == framebufferObject.device)
4449
Jesse Halld8bade02015-11-24 10:24:18 -08004450 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004451}
4452
4453cmd void vkCmdNextSubpass(
4454 VkCmdBuffer cmdBuffer,
4455 VkRenderPassContents contents) {
4456 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4457}
4458
4459@threadSafety("app")
4460cmd void vkCmdEndRenderPass(
4461 VkCmdBuffer cmdBuffer) {
4462 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4463
Jesse Halld8bade02015-11-24 10:24:18 -08004464 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004465}
4466
4467cmd void vkCmdExecuteCommands(
4468 VkCmdBuffer cmdBuffer,
4469 u32 cmdBuffersCount,
4470 const VkCmdBuffer* pCmdBuffers) {
4471 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4472
4473 cmdBuffers := pCmdBuffers[0:cmdBuffersCount]
4474 for i in (0 .. cmdBuffersCount) {
4475 secondaryCmdBuffer := cmdBuffers[i]
4476 secondaryCmdBufferObject := GetCmdBuffer(secondaryCmdBuffer)
4477 assert(cmdBufferObject.device == secondaryCmdBufferObject.device)
4478 }
4479}
4480
Jesse Hall1356b0d2015-11-23 17:24:58 -08004481@extension("VK_EXT_KHR_surface")
4482cmd void vkDestroySurfaceKHR(
4483 VkInstance instance,
4484 VkSurfaceKHR surface) {
4485 instanceObject := GetInstance(instance)
4486 surfaceObject := GetSurface(surface)
4487 assert(surfaceObject.instance == instance)
Michael Lentine88594d72015-11-12 12:49:45 -08004488
Jesse Hall1356b0d2015-11-23 17:24:58 -08004489 State.Surfaces[surface] = null
Jesse Hall2818f932015-11-19 21:19:17 -08004490}
4491
Jesse Hall1356b0d2015-11-23 17:24:58 -08004492@extension("VK_EXT_KHR_surface")
4493cmd VkBool32 vkGetPhysicalDeviceSurfaceSupportKHR(
4494 VkPhysicalDevice physicalDevice,
4495 u32 queueFamilyIndex,
4496 VkSurfaceKHR surface) {
4497 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4498
4499 //supported := ?
4500
4501 return ?//supported
4502}
4503
4504@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004505cmd VkResult vkGetSurfacePropertiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004506 VkDevice device,
4507 VkSurfaceKHR surface,
4508 VkSurfacePropertiesKHR* pSurfaceProperties) {
Michael Lentine88594d72015-11-12 12:49:45 -08004509 deviceObject := GetDevice(device)
4510
4511 surfaceProperties := ?
4512 pSurfaceProperties[0] = surfaceProperties
4513
4514 return ?
4515}
4516
Jesse Hall1356b0d2015-11-23 17:24:58 -08004517@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004518cmd VkResult vkGetSurfaceFormatsKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004519 VkDevice device,
4520 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004521 u32* pSurfaceFormatCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004522 VkSurfaceFormatKHR* pSurfaceFormats) {
Michael Lentine88594d72015-11-12 12:49:45 -08004523 deviceObject := GetDevice(device)
4524
4525 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004526 pSurfaceFormatCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004527 surfaceFormats := pSurfaceFormats[0:count]
4528
4529 for i in (0 .. count) {
4530 surfaceFormat := ?
4531 surfaceFormats[i] = surfaceFormat
4532 }
4533
4534 return ?
4535}
4536
Jesse Hall1356b0d2015-11-23 17:24:58 -08004537@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004538cmd VkResult vkGetSurfacePresentModesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004539 VkDevice device,
4540 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004541 u32* pPresentModeCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004542 VkPresentModeKHR* pPresentModes) {
Michael Lentine88594d72015-11-12 12:49:45 -08004543 deviceObject := GetDevice(device)
4544
4545 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004546 pPresentModeCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004547 presentModes := pPresentModes[0:count]
4548
4549 for i in (0 .. count) {
4550 presentMode := ?
4551 presentModes[i] = presentMode
4552 }
4553
4554 return ?
4555}
4556
Jesse Hall1356b0d2015-11-23 17:24:58 -08004557@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004558cmd VkResult vkCreateSwapchainKHR(
4559 VkDevice device,
4560 const VkSwapchainCreateInfoKHR* pCreateInfo,
4561 VkSwapchainKHR* pSwapchain) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004562 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
Michael Lentine88594d72015-11-12 12:49:45 -08004563 deviceObject := GetDevice(device)
4564
4565 swapchain := ?
4566 pSwapchain[0] = swapchain
4567 State.Swapchains[swapchain] = new!SwapchainObject(device: device)
4568
4569 return ?
4570}
4571
Jesse Hall1356b0d2015-11-23 17:24:58 -08004572@extension("VK_EXT_KHR_swapchain")
4573cmd void vkDestroySwapchainKHR(
Michael Lentine88594d72015-11-12 12:49:45 -08004574 VkDevice device,
4575 VkSwapchainKHR swapchain) {
4576 deviceObject := GetDevice(device)
4577 swapchainObject := GetSwapchain(swapchain)
4578 assert(swapchainObject.device == device)
4579
4580 State.Swapchains[swapchain] = null
Michael Lentine88594d72015-11-12 12:49:45 -08004581}
4582
Jesse Hall1356b0d2015-11-23 17:24:58 -08004583@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004584cmd VkResult vkGetSwapchainImagesKHR(
4585 VkDevice device,
4586 VkSwapchainKHR swapchain,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004587 u32* pSwapchainImageCount,
Michael Lentine88594d72015-11-12 12:49:45 -08004588 VkImage* pSwapchainImages) {
4589 deviceObject := GetDevice(device)
4590
4591 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004592 pSwapchainImageCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004593 swapchainImages := pSwapchainImages[0:count]
4594
4595 for i in (0 .. count) {
4596 swapchainImage := ?
4597 swapchainImages[i] = swapchainImage
Jesse Hall1356b0d2015-11-23 17:24:58 -08004598 State.Images[swapchainImage] = new!ImageObject(device: device)
Michael Lentine88594d72015-11-12 12:49:45 -08004599 }
4600
4601 return ?
4602}
4603
Jesse Hall1356b0d2015-11-23 17:24:58 -08004604@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004605cmd VkResult vkAcquireNextImageKHR(
4606 VkDevice device,
4607 VkSwapchainKHR swapchain,
4608 u64 timeout,
4609 VkSemaphore semaphore,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004610 VkFence fence,
Michael Lentine88594d72015-11-12 12:49:45 -08004611 u32* pImageIndex) {
4612 deviceObject := GetDevice(device)
4613 swapchainObject := GetSwapchain(swapchain)
4614
4615 imageIndex := ?
4616 pImageIndex[0] = imageIndex
4617
4618 return ?
4619}
4620
Jesse Hall1356b0d2015-11-23 17:24:58 -08004621@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004622cmd VkResult vkQueuePresentKHR(
4623 VkQueue queue,
4624 VkPresentInfoKHR* pPresentInfo) {
4625 queueObject := GetQueue(queue)
4626
4627 presentInfo := ?
4628 pPresentInfo[0] = presentInfo
4629
4630 return ?
4631}
4632
Jesse Hall1356b0d2015-11-23 17:24:58 -08004633@extension("VK_EXT_KHR_display")
4634cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
4635 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004636 u32* pPropertyCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004637 VkDisplayPropertiesKHR* pProperties) {
4638 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4639 return ?
4640}
4641
4642@extension("VK_EXT_KHR_display")
4643cmd VkResult vkGetDisplayModePropertiesKHR(
4644 VkPhysicalDevice physicalDevice,
4645 VkDisplayKHR display,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004646 u32* pPropertyCount,
4647 VkDisplayModePropertiesKHR* pProperties) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004648 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4649 return ?
4650}
4651
4652@extension("VK_EXT_KHR_display")
4653cmd VkResult vkCreateDisplayModeKHR(
4654 VkPhysicalDevice physicalDevice,
4655 VkDisplayKHR display,
4656 const VkDisplayModeCreateInfoKHR* pCreateInfo,
4657 VkDisplayModeKHR* pMode) {
4658 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4659 return ?
4660}
4661
4662@extension("VK_EXT_KHR_display")
4663cmd VkResult vkGetDisplayPlanePropertiesKHR(
4664 VkPhysicalDevice physicalDevice,
4665 VkDisplayKHR display,
4666 VkDisplayModeKHR mode,
4667 u32 planeIndex,
4668 VkDisplayPlanePropertiesKHR* pProperties) {
4669 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4670 return ?
4671}
4672
4673@extension("VK_EXT_KHR_x11_surface")
4674cmd VkResult vkCreateX11SurfaceKHR(
4675 VkInstance instance,
4676 platform.Display* dpy,
4677 platform.Window root,
4678 platform.Window window,
4679 VkSurfaceKHR* pSurface) {
4680 instanceObject := GetInstance(instance)
4681 return ?
4682}
4683
4684@extension("VK_EXT_KHR_xcb_surface")
4685cmd VkResult vkCreateXCBSurfaceKHR(
4686 VkInstance instance,
4687 platform.xcb_connection_t* connection,
4688 platform.xcb_window_t root,
4689 platform.xcb_window_t window,
4690 VkSurfaceKHR* pSurface) {
4691 instanceObject := GetInstance(instance)
4692 return ?
4693}
4694
4695@extension("VK_EXT_KHR_wayland_surface")
4696cmd VkResult vkCreateWaylandSurfaceKHR(
4697 VkInstance instance,
4698 platform.wl_display* display,
4699 platform.wl_surface* surface,
4700 VkSurfaceKHR* pSurface) {
4701 instanceObject := GetInstance(instance)
4702 return ?
4703}
4704
4705@extension("VK_EXT_KHR_mir_surface")
4706cmd VkResult vkCreateMirSurfaceKHR(
4707 VkInstance instance,
4708 platform.MirConnection* connection,
4709 platform.MirSurface* mirSurface,
4710 VkSurfaceKHR* pSurface) {
4711 instanceObject := GetInstance(instance)
4712 return ?
4713}
4714
4715@extension("VK_EXT_KHR_android_surface")
4716cmd VkResult vkCreateAndroidSurfaceKHR(
4717 VkInstance instance,
4718 platform.ANativeWindow* window
4719 VkSurfaceKHR* pSurface) {
4720 instanceObject := GetInstance(instance)
4721 return ?
4722}
4723
4724@extension("VK_EXT_KHR_win32_surface")
4725cmd VkResult vkCreateWin32SurfaceKHR(
4726 VkInstance instance,
4727 platform.HINSTANCE hinstance,
4728 platform.HWND hwnd,
4729 VkSurfaceKHR* pSurface) {
4730 instanceObject := GetInstance(instance)
4731 return ?
4732}
4733
Jesse Halld27f6aa2015-08-15 17:58:48 -07004734
4735////////////////
4736// Validation //
4737////////////////
4738
4739extern void validate(string layerName, bool condition, string message)
4740
4741
4742/////////////////////////////
4743// Internal State Tracking //
4744/////////////////////////////
4745
4746StateObject State
4747
4748@internal class StateObject {
4749 // Dispatchable objects.
4750 map!(VkInstance, ref!InstanceObject) Instances
4751 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4752 map!(VkDevice, ref!DeviceObject) Devices
4753 map!(VkQueue, ref!QueueObject) Queues
4754 map!(VkCmdBuffer, ref!CmdBufferObject) CmdBuffers
4755
4756 // Non-dispatchable objects.
4757 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4758 map!(VkBuffer, ref!BufferObject) Buffers
4759 map!(VkBufferView, ref!BufferViewObject) BufferViews
4760 map!(VkImage, ref!ImageObject) Images
4761 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004762 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
4763 map!(VkShader, ref!ShaderObject) Shaders
4764 map!(VkPipeline, ref!PipelineObject) Pipelines
4765 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4766 map!(VkSampler, ref!SamplerObject) Samplers
4767 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4768 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4769 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004770 map!(VkFence, ref!FenceObject) Fences
4771 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4772 map!(VkEvent, ref!EventObject) Events
4773 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4774 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4775 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4776 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
4777 map!(VkCmdPool, ref!CmdPoolObject) CmdPools
Jesse Hall1356b0d2015-11-23 17:24:58 -08004778 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces
Michael Lentine88594d72015-11-12 12:49:45 -08004779 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains
Jesse Halld27f6aa2015-08-15 17:58:48 -07004780}
4781
4782@internal class InstanceObject {
4783}
4784
4785@internal class PhysicalDeviceObject {
4786 VkInstance instance
4787}
4788
4789@internal class DeviceObject {
4790 VkPhysicalDevice physicalDevice
4791}
4792
4793@internal class QueueObject {
4794 VkDevice device
4795 VkQueueFlags flags
4796}
4797
4798@internal class CmdBufferObject {
4799 VkDevice device
4800 map!(u64, VkDeviceMemory) boundObjects
4801 VkQueueFlags queueFlags
4802}
4803
4804@internal class DeviceMemoryObject {
4805 VkDevice device
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004806 VkDeviceSize allocationSize
4807 map!(u64, VkDeviceSize ) boundObjects
Jesse Halld27f6aa2015-08-15 17:58:48 -07004808 map!(VkCmdBuffer, VkCmdBuffer) boundCommandBuffers
4809}
4810
4811@internal class BufferObject {
4812 VkDevice device
4813 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004814 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07004815}
4816
4817@internal class BufferViewObject {
4818 VkDevice device
4819 VkBuffer buffer
4820}
4821
4822@internal class ImageObject {
4823 VkDevice device
4824 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004825 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07004826}
4827
4828@internal class ImageViewObject {
4829 VkDevice device
4830 VkImage image
4831}
4832
Jesse Halld27f6aa2015-08-15 17:58:48 -07004833@internal class ShaderObject {
4834 VkDevice device
4835}
4836
4837@internal class ShaderModuleObject {
4838 VkDevice device
4839}
4840
4841@internal class PipelineObject {
4842 VkDevice device
4843}
4844
4845@internal class PipelineLayoutObject {
4846 VkDevice device
4847}
4848
4849@internal class SamplerObject {
4850 VkDevice device
4851}
4852
4853@internal class DescriptorSetObject {
4854 VkDevice device
4855}
4856
4857@internal class DescriptorSetLayoutObject {
4858 VkDevice device
4859}
4860
4861@internal class DescriptorPoolObject {
4862 VkDevice device
4863}
4864
Jesse Halld27f6aa2015-08-15 17:58:48 -07004865@internal class FenceObject {
4866 VkDevice device
4867 bool signaled
4868}
4869
4870@internal class SemaphoreObject {
4871 VkDevice device
4872}
4873
4874@internal class EventObject {
4875 VkDevice device
4876}
4877
4878@internal class QueryPoolObject {
4879 VkDevice device
4880}
4881
4882@internal class FramebufferObject {
4883 VkDevice device
4884}
4885
4886@internal class RenderPassObject {
4887 VkDevice device
4888}
4889
4890@internal class PipelineCacheObject {
4891 VkDevice device
4892}
4893
4894@internal class CmdPoolObject {
4895 VkDevice device
4896}
4897
Jesse Hall1356b0d2015-11-23 17:24:58 -08004898@internal class SurfaceObject {
4899 VkInstance instance
4900}
4901
Michael Lentine88594d72015-11-12 12:49:45 -08004902@internal class SwapchainObject {
4903 VkDevice device
4904}
4905
Jesse Halld27f6aa2015-08-15 17:58:48 -07004906macro ref!InstanceObject GetInstance(VkInstance instance) {
4907 assert(instance in State.Instances)
4908 return State.Instances[instance]
4909}
4910
4911macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
4912 assert(physicalDevice in State.PhysicalDevices)
4913 return State.PhysicalDevices[physicalDevice]
4914}
4915
4916macro ref!DeviceObject GetDevice(VkDevice device) {
4917 assert(device in State.Devices)
4918 return State.Devices[device]
4919}
4920
4921macro ref!QueueObject GetQueue(VkQueue queue) {
4922 assert(queue in State.Queues)
4923 return State.Queues[queue]
4924}
4925
4926macro ref!CmdBufferObject GetCmdBuffer(VkCmdBuffer cmdBuffer) {
4927 assert(cmdBuffer in State.CmdBuffers)
4928 return State.CmdBuffers[cmdBuffer]
4929}
4930
4931macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory mem) {
4932 assert(mem in State.DeviceMemories)
4933 return State.DeviceMemories[mem]
4934}
4935
4936macro ref!BufferObject GetBuffer(VkBuffer buffer) {
4937 assert(buffer in State.Buffers)
4938 return State.Buffers[buffer]
4939}
4940
4941macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
4942 assert(bufferView in State.BufferViews)
4943 return State.BufferViews[bufferView]
4944}
4945
4946macro ref!ImageObject GetImage(VkImage image) {
4947 assert(image in State.Images)
4948 return State.Images[image]
4949}
4950
4951macro ref!ImageViewObject GetImageView(VkImageView imageView) {
4952 assert(imageView in State.ImageViews)
4953 return State.ImageViews[imageView]
4954}
4955
Jesse Halld27f6aa2015-08-15 17:58:48 -07004956macro ref!ShaderObject GetShader(VkShader shader) {
4957 assert(shader in State.Shaders)
4958 return State.Shaders[shader]
4959}
4960
4961macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
4962 assert(shaderModule in State.ShaderModules)
4963 return State.ShaderModules[shaderModule]
4964}
4965
4966macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
4967 assert(pipeline in State.Pipelines)
4968 return State.Pipelines[pipeline]
4969}
4970
4971macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
4972 assert(pipelineLayout in State.PipelineLayouts)
4973 return State.PipelineLayouts[pipelineLayout]
4974}
4975
4976macro ref!SamplerObject GetSampler(VkSampler sampler) {
4977 assert(sampler in State.Samplers)
4978 return State.Samplers[sampler]
4979}
4980
4981macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
4982 assert(descriptorSet in State.DescriptorSets)
4983 return State.DescriptorSets[descriptorSet]
4984}
4985
4986macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
4987 assert(descriptorSetLayout in State.DescriptorSetLayouts)
4988 return State.DescriptorSetLayouts[descriptorSetLayout]
4989}
4990
4991macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
4992 assert(descriptorPool in State.DescriptorPools)
4993 return State.DescriptorPools[descriptorPool]
4994}
4995
Jesse Halld27f6aa2015-08-15 17:58:48 -07004996macro ref!FenceObject GetFence(VkFence fence) {
4997 assert(fence in State.Fences)
4998 return State.Fences[fence]
4999}
5000
5001macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
5002 assert(semaphore in State.Semaphores)
5003 return State.Semaphores[semaphore]
5004}
5005
5006macro ref!EventObject GetEvent(VkEvent event) {
5007 assert(event in State.Events)
5008 return State.Events[event]
5009}
5010
5011macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
5012 assert(queryPool in State.QueryPools)
5013 return State.QueryPools[queryPool]
5014}
5015
5016macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
5017 assert(framebuffer in State.Framebuffers)
5018 return State.Framebuffers[framebuffer]
5019}
5020
5021macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
5022 assert(renderPass in State.RenderPasses)
5023 return State.RenderPasses[renderPass]
5024}
5025
5026macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
5027 assert(pipelineCache in State.PipelineCaches)
5028 return State.PipelineCaches[pipelineCache]
5029}
5030
5031macro ref!CmdPoolObject GetCmdPool(VkCmdPool cmdPool) {
5032 assert(cmdPool in State.CmdPools)
5033 return State.CmdPools[cmdPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07005034}
Michael Lentine88594d72015-11-12 12:49:45 -08005035
Jesse Hall1356b0d2015-11-23 17:24:58 -08005036macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) {
5037 assert(surface in State.Surfaces)
5038 return State.Surfaces[surface]
5039}
5040
Michael Lentine88594d72015-11-12 12:49:45 -08005041macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) {
5042 assert(swapchain in State.Swapchains)
5043 return State.Swapchains[swapchain]
5044}
Jesse Halld8bade02015-11-24 10:24:18 -08005045
5046macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) {
5047 return as!VkQueueFlags(as!u32(flags) | as!u32(bit))
5048}