blob: 418318aa49d8e5d0d9183de4166f62bcdc492af2 [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 Hallc7467b72015-11-29 21:05:26 -080030define VERSION_MINOR 194
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 Halla6429252015-11-29 18:59:42 -080048@extension("VK_EXT_KHR_surface") define VK_EXT_KHR_SURFACE_REVISION 20
Jesse Hall1356b0d2015-11-23 17:24:58 -080049@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
Jesse Halla6429252015-11-29 18:59:42 -080052@extension("VK_EXT_KHR_swapchain") define VK_EXT_KHR_SWAPCHAIN_REVISION 62
Jesse Hall1356b0d2015-11-23 17:24:58 -080053@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
Jesse Halla6429252015-11-29 18:59:42 -080056@extension("VK_EXT_KHR_display") define VK_EXT_KHR_DISPLAY_REVISION 17
Jesse Hall1356b0d2015-11-23 17:24:58 -080057@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
Jesse Halla6429252015-11-29 18:59:42 -080060@extension("VK_EXT_KHR_display_swapchain") define VK_EXT_KHR_DISPLAY_REVISION 6
Jesse Hall1356b0d2015-11-23 17:24:58 -080061@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
Jesse Halla6429252015-11-29 18:59:42 -080064@extension("VK_EXT_KHR_xlib_surface") define VK_EXT_KHR_XLIB_SURFACE_REVISION 3
65@extension("VK_EXT_KHR_xlib_surface") define VK_EXT_KHR_XLIB_SURFACE_NUMBER 5
66@extension("VK_EXT_KHR_xlib_surface") define VK_EXT_KHR_XLIB_SURFACE_NAME "VK_EXT_KHR_xlib_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080067
Jesse Halla6429252015-11-29 18:59:42 -080068@extension("VK_EXT_KHR_xcb_surface") define VK_EXT_KHR_XCB_SURFACE_REVISION 3
Jesse Hall1356b0d2015-11-23 17:24:58 -080069@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
Jesse Halla6429252015-11-29 18:59:42 -080072@extension("VK_EXT_KHR_wayland_surface") define VK_EXT_KHR_WAYLAND_SURFACE_REVISION 2
Jesse Hall1356b0d2015-11-23 17:24:58 -080073@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
Jesse Halla6429252015-11-29 18:59:42 -080076@extension("VK_EXT_KHR_mir_surface") define VK_EXT_KHR_MIR_SURFACE_REVISION 2
Jesse Hall1356b0d2015-11-23 17:24:58 -080077@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
Jesse Halla6429252015-11-29 18:59:42 -080084@extension("VK_EXT_KHR_win32_surface") define VK_EXT_KHR_WIN32_SURFACE_REVISION 2
Jesse Hall1356b0d2015-11-23 17:24:58 -080085@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 {
Jesse Hallc7467b72015-11-29 21:05:26 -0800173 VK_IMAGE_TILING_OPTIMAL = 0x00000000,
174 VK_IMAGE_TILING_LINEAR = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700175}
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 {
Jesse Hallc7467b72015-11-29 21:05:26 -0800193 VK_CHANNEL_SWIZZLE_IDENTITY = 0x00000000,
194 VK_CHANNEL_SWIZZLE_ZERO = 0x00000001,
195 VK_CHANNEL_SWIZZLE_ONE = 0x00000002,
196 VK_CHANNEL_SWIZZLE_R = 0x00000003,
197 VK_CHANNEL_SWIZZLE_G = 0x00000004,
198 VK_CHANNEL_SWIZZLE_B = 0x00000005,
199 VK_CHANNEL_SWIZZLE_A = 0x00000006,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700200}
201
202enum VkDescriptorType {
203 VK_DESCRIPTOR_TYPE_SAMPLER = 0x00000000,
204 VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 0x00000001,
205 VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 0x00000002,
206 VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 0x00000003,
207 VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 0x00000004,
208 VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 0x00000005,
209 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 0x00000006,
210 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 0x00000007,
211 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 0x00000008,
212 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 0x00000009,
213 VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 0x0000000a,
214}
215
Jesse Halld27f6aa2015-08-15 17:58:48 -0700216enum VkQueryType {
217 VK_QUERY_TYPE_OCCLUSION = 0x00000000,
218 VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, /// Optional
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800219 VK_QUERY_TYPE_TIMESTAMP = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700220}
221
Jesse Halld27f6aa2015-08-15 17:58:48 -0700222enum VkBorderColor {
223 VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0x00000000,
224 VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 0x00000001,
225 VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 0x00000002,
226 VK_BORDER_COLOR_INT_OPAQUE_BLACK = 0x00000003,
227 VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 0x00000004,
228 VK_BORDER_COLOR_INT_OPAQUE_WHITE = 0x00000005,
229}
230
231enum VkPipelineBindPoint {
Jesse Hallc7467b72015-11-29 21:05:26 -0800232 VK_PIPELINE_BIND_POINT_GRAPHICS = 0x00000000,
233 VK_PIPELINE_BIND_POINT_COMPUTE = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700234}
235
236enum VkPrimitiveTopology {
237 VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0x00000000,
238 VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 0x00000001,
239 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 0x00000002,
240 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 0x00000003,
241 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 0x00000004,
242 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 0x00000005,
243 VK_PRIMITIVE_TOPOLOGY_LINE_LIST_ADJ = 0x00000006,
244 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_ADJ = 0x00000007,
245 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ = 0x00000008,
246 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJ = 0x00000009,
247 VK_PRIMITIVE_TOPOLOGY_PATCH = 0x0000000a,
248}
249
250enum VkSharingMode {
251 VK_SHARING_MODE_EXCLUSIVE = 0x00000000,
252 VK_SHARING_MODE_CONCURRENT = 0x00000001,
253}
254
255enum VkIndexType {
256 VK_INDEX_TYPE_UINT16 = 0x00000000,
257 VK_INDEX_TYPE_UINT32 = 0x00000001,
258}
259
Jesse Hall23ff73f2015-11-29 14:36:39 -0800260enum VkFilter {
261 VK_FILTER_NEAREST = 0x00000000,
262 VK_FILTER_LINEAR = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700263}
264
Jesse Hall23ff73f2015-11-29 14:36:39 -0800265enum VkSamplerMipmapMode {
266 VK_SAMPLER_MIPMAP_MODE_BASE = 0x00000000, /// Always choose base level
267 VK_SAMPLER_MIPMAP_MODE_NEAREST = 0x00000001, /// Choose nearest mip level
268 VK_SAMPLER_MIPMAP_MODE_LINEAR = 0x00000002, /// Linear filter between mip levels
Jesse Halld27f6aa2015-08-15 17:58:48 -0700269}
270
Jesse Hall23ff73f2015-11-29 14:36:39 -0800271enum VkSamplerAddressMode {
Jesse Hallc7467b72015-11-29 21:05:26 -0800272 VK_SAMPLER_ADDRESS_MODE_REPEAT = 0x00000000,
273 VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 0x00000001,
274 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 0x00000002,
275 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 0x00000003,
276 VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700277}
278
279enum VkCompareOp {
280 VK_COMPARE_OP_NEVER = 0x00000000,
281 VK_COMPARE_OP_LESS = 0x00000001,
282 VK_COMPARE_OP_EQUAL = 0x00000002,
283 VK_COMPARE_OP_LESS_EQUAL = 0x00000003,
284 VK_COMPARE_OP_GREATER = 0x00000004,
285 VK_COMPARE_OP_NOT_EQUAL = 0x00000005,
286 VK_COMPARE_OP_GREATER_EQUAL = 0x00000006,
287 VK_COMPARE_OP_ALWAYS = 0x00000007,
288}
289
290enum VkFillMode {
Jesse Hallc7467b72015-11-29 21:05:26 -0800291 VK_FILL_MODE_SOLID = 0x00000000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700292 VK_FILL_MODE_WIREFRAME = 0x00000001,
Jesse Hallc7467b72015-11-29 21:05:26 -0800293 VK_FILL_MODE_POINTS = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700294}
295
296enum VkFrontFace {
297 VK_FRONT_FACE_CCW = 0x00000000,
298 VK_FRONT_FACE_CW = 0x00000001,
299}
300
301enum VkBlend {
302 VK_BLEND_ZERO = 0x00000000,
303 VK_BLEND_ONE = 0x00000001,
304 VK_BLEND_SRC_COLOR = 0x00000002,
305 VK_BLEND_ONE_MINUS_SRC_COLOR = 0x00000003,
306 VK_BLEND_DEST_COLOR = 0x00000004,
307 VK_BLEND_ONE_MINUS_DEST_COLOR = 0x00000005,
308 VK_BLEND_SRC_ALPHA = 0x00000006,
309 VK_BLEND_ONE_MINUS_SRC_ALPHA = 0x00000007,
310 VK_BLEND_DEST_ALPHA = 0x00000008,
311 VK_BLEND_ONE_MINUS_DEST_ALPHA = 0x00000009,
312 VK_BLEND_CONSTANT_COLOR = 0x0000000a,
313 VK_BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0000000b,
314 VK_BLEND_CONSTANT_ALPHA = 0x0000000c,
315 VK_BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x0000000d,
316 VK_BLEND_SRC_ALPHA_SATURATE = 0x0000000e,
317 VK_BLEND_SRC1_COLOR = 0x0000000f,
318 VK_BLEND_ONE_MINUS_SRC1_COLOR = 0x00000010,
319 VK_BLEND_SRC1_ALPHA = 0x00000011,
320 VK_BLEND_ONE_MINUS_SRC1_ALPHA = 0x00000012,
321}
322
323enum VkBlendOp {
324 VK_BLEND_OP_ADD = 0x00000000,
325 VK_BLEND_OP_SUBTRACT = 0x00000001,
326 VK_BLEND_OP_REVERSE_SUBTRACT = 0x00000002,
327 VK_BLEND_OP_MIN = 0x00000003,
328 VK_BLEND_OP_MAX = 0x00000004,
329}
330
331enum VkStencilOp {
332 VK_STENCIL_OP_KEEP = 0x00000000,
333 VK_STENCIL_OP_ZERO = 0x00000001,
334 VK_STENCIL_OP_REPLACE = 0x00000002,
335 VK_STENCIL_OP_INC_CLAMP = 0x00000003,
336 VK_STENCIL_OP_DEC_CLAMP = 0x00000004,
337 VK_STENCIL_OP_INVERT = 0x00000005,
338 VK_STENCIL_OP_INC_WRAP = 0x00000006,
339 VK_STENCIL_OP_DEC_WRAP = 0x00000007,
340}
341
342enum VkLogicOp {
343 VK_LOGIC_OP_CLEAR = 0x00000000,
344 VK_LOGIC_OP_AND = 0x00000001,
345 VK_LOGIC_OP_AND_REVERSE = 0x00000002,
346 VK_LOGIC_OP_COPY = 0x00000003,
347 VK_LOGIC_OP_AND_INVERTED = 0x00000004,
348 VK_LOGIC_OP_NOOP = 0x00000005,
349 VK_LOGIC_OP_XOR = 0x00000006,
350 VK_LOGIC_OP_OR = 0x00000007,
351 VK_LOGIC_OP_NOR = 0x00000008,
352 VK_LOGIC_OP_EQUIV = 0x00000009,
353 VK_LOGIC_OP_INVERT = 0x0000000a,
354 VK_LOGIC_OP_OR_REVERSE = 0x0000000b,
355 VK_LOGIC_OP_COPY_INVERTED = 0x0000000c,
356 VK_LOGIC_OP_OR_INVERTED = 0x0000000d,
357 VK_LOGIC_OP_NAND = 0x0000000e,
358 VK_LOGIC_OP_SET = 0x0000000f,
359}
360
Jesse Hall03b6fe12015-11-24 12:44:21 -0800361enum VkSystemAllocScope {
362 VK_SYSTEM_ALLOC_SCOPE_FUNCTION = 0x00000000,
363 VK_SYSTEM_ALLOC_SCOPE_OBJECT = 0x00000001,
364 VK_SYSTEM_ALLOC_SCOPE_CACHE = 0x00000002,
365 VK_SYSTEM_ALLOC_SCOPE_DEVICE = 0x00000003,
366 VK_SYSTEM_ALLOC_SCOPE_INSTANCE = 0x00000004,
367}
368
369enum VkInternalAllocType {
370 VK_INTERNAL_ALLOC_TYPE_EXECUTABLE = 0x00000000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700371}
372
373enum VkPhysicalDeviceType {
374 VK_PHYSICAL_DEVICE_TYPE_OTHER = 0x00000000,
375 VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 0x00000001,
376 VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 0x00000002,
377 VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 0x00000003,
378 VK_PHYSICAL_DEVICE_TYPE_CPU = 0x00000004,
379}
380
381enum VkVertexInputStepRate {
382 VK_VERTEX_INPUT_STEP_RATE_VERTEX = 0x00000000,
383 VK_VERTEX_INPUT_STEP_RATE_INSTANCE = 0x00000001,
384}
385
386/// Vulkan format definitions
387enum VkFormat {
388 VK_FORMAT_UNDEFINED = 0x00000000,
389 VK_FORMAT_R4G4_UNORM = 0x00000001,
390 VK_FORMAT_R4G4_USCALED = 0x00000002,
391 VK_FORMAT_R4G4B4A4_UNORM = 0x00000003,
392 VK_FORMAT_R4G4B4A4_USCALED = 0x00000004,
393 VK_FORMAT_R5G6B5_UNORM = 0x00000005,
394 VK_FORMAT_R5G6B5_USCALED = 0x00000006,
395 VK_FORMAT_R5G5B5A1_UNORM = 0x00000007,
396 VK_FORMAT_R5G5B5A1_USCALED = 0x00000008,
397 VK_FORMAT_R8_UNORM = 0x00000009,
398 VK_FORMAT_R8_SNORM = 0x0000000A,
399 VK_FORMAT_R8_USCALED = 0x0000000B,
400 VK_FORMAT_R8_SSCALED = 0x0000000C,
401 VK_FORMAT_R8_UINT = 0x0000000D,
402 VK_FORMAT_R8_SINT = 0x0000000E,
403 VK_FORMAT_R8_SRGB = 0x0000000F,
404 VK_FORMAT_R8G8_UNORM = 0x00000010,
405 VK_FORMAT_R8G8_SNORM = 0x00000011,
406 VK_FORMAT_R8G8_USCALED = 0x00000012,
407 VK_FORMAT_R8G8_SSCALED = 0x00000013,
408 VK_FORMAT_R8G8_UINT = 0x00000014,
409 VK_FORMAT_R8G8_SINT = 0x00000015,
410 VK_FORMAT_R8G8_SRGB = 0x00000016,
411 VK_FORMAT_R8G8B8_UNORM = 0x00000017,
412 VK_FORMAT_R8G8B8_SNORM = 0x00000018,
413 VK_FORMAT_R8G8B8_USCALED = 0x00000019,
414 VK_FORMAT_R8G8B8_SSCALED = 0x0000001A,
415 VK_FORMAT_R8G8B8_UINT = 0x0000001B,
416 VK_FORMAT_R8G8B8_SINT = 0x0000001C,
417 VK_FORMAT_R8G8B8_SRGB = 0x0000001D,
418 VK_FORMAT_R8G8B8A8_UNORM = 0x0000001E,
419 VK_FORMAT_R8G8B8A8_SNORM = 0x0000001F,
420 VK_FORMAT_R8G8B8A8_USCALED = 0x00000020,
421 VK_FORMAT_R8G8B8A8_SSCALED = 0x00000021,
422 VK_FORMAT_R8G8B8A8_UINT = 0x00000022,
423 VK_FORMAT_R8G8B8A8_SINT = 0x00000023,
424 VK_FORMAT_R8G8B8A8_SRGB = 0x00000024,
425 VK_FORMAT_R10G10B10A2_UNORM = 0x00000025,
426 VK_FORMAT_R10G10B10A2_SNORM = 0x00000026,
427 VK_FORMAT_R10G10B10A2_USCALED = 0x00000027,
428 VK_FORMAT_R10G10B10A2_SSCALED = 0x00000028,
429 VK_FORMAT_R10G10B10A2_UINT = 0x00000029,
430 VK_FORMAT_R10G10B10A2_SINT = 0x0000002A,
431 VK_FORMAT_R16_UNORM = 0x0000002B,
432 VK_FORMAT_R16_SNORM = 0x0000002C,
433 VK_FORMAT_R16_USCALED = 0x0000002D,
434 VK_FORMAT_R16_SSCALED = 0x0000002E,
435 VK_FORMAT_R16_UINT = 0x0000002F,
436 VK_FORMAT_R16_SINT = 0x00000030,
437 VK_FORMAT_R16_SFLOAT = 0x00000031,
438 VK_FORMAT_R16G16_UNORM = 0x00000032,
439 VK_FORMAT_R16G16_SNORM = 0x00000033,
440 VK_FORMAT_R16G16_USCALED = 0x00000034,
441 VK_FORMAT_R16G16_SSCALED = 0x00000035,
442 VK_FORMAT_R16G16_UINT = 0x00000036,
443 VK_FORMAT_R16G16_SINT = 0x00000037,
444 VK_FORMAT_R16G16_SFLOAT = 0x00000038,
445 VK_FORMAT_R16G16B16_UNORM = 0x00000039,
446 VK_FORMAT_R16G16B16_SNORM = 0x0000003A,
447 VK_FORMAT_R16G16B16_USCALED = 0x0000003B,
448 VK_FORMAT_R16G16B16_SSCALED = 0x0000003C,
449 VK_FORMAT_R16G16B16_UINT = 0x0000003D,
450 VK_FORMAT_R16G16B16_SINT = 0x0000003E,
451 VK_FORMAT_R16G16B16_SFLOAT = 0x0000003F,
452 VK_FORMAT_R16G16B16A16_UNORM = 0x00000040,
453 VK_FORMAT_R16G16B16A16_SNORM = 0x00000041,
454 VK_FORMAT_R16G16B16A16_USCALED = 0x00000042,
455 VK_FORMAT_R16G16B16A16_SSCALED = 0x00000043,
456 VK_FORMAT_R16G16B16A16_UINT = 0x00000044,
457 VK_FORMAT_R16G16B16A16_SINT = 0x00000045,
458 VK_FORMAT_R16G16B16A16_SFLOAT = 0x00000046,
459 VK_FORMAT_R32_UINT = 0x00000047,
460 VK_FORMAT_R32_SINT = 0x00000048,
461 VK_FORMAT_R32_SFLOAT = 0x00000049,
462 VK_FORMAT_R32G32_UINT = 0x0000004A,
463 VK_FORMAT_R32G32_SINT = 0x0000004B,
464 VK_FORMAT_R32G32_SFLOAT = 0x0000004C,
465 VK_FORMAT_R32G32B32_UINT = 0x0000004D,
466 VK_FORMAT_R32G32B32_SINT = 0x0000004E,
467 VK_FORMAT_R32G32B32_SFLOAT = 0x0000004F,
468 VK_FORMAT_R32G32B32A32_UINT = 0x00000050,
469 VK_FORMAT_R32G32B32A32_SINT = 0x00000051,
470 VK_FORMAT_R32G32B32A32_SFLOAT = 0x00000052,
471 VK_FORMAT_R64_SFLOAT = 0x00000053,
472 VK_FORMAT_R64G64_SFLOAT = 0x00000054,
473 VK_FORMAT_R64G64B64_SFLOAT = 0x00000055,
474 VK_FORMAT_R64G64B64A64_SFLOAT = 0x00000056,
475 VK_FORMAT_R11G11B10_UFLOAT = 0x00000057,
476 VK_FORMAT_R9G9B9E5_UFLOAT = 0x00000058,
477 VK_FORMAT_D16_UNORM = 0x00000059,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700478 VK_FORMAT_D24_UNORM_X8 = 0x0000005A,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700479 VK_FORMAT_D32_SFLOAT = 0x0000005B,
480 VK_FORMAT_S8_UINT = 0x0000005C,
481 VK_FORMAT_D16_UNORM_S8_UINT = 0x0000005D,
482 VK_FORMAT_D24_UNORM_S8_UINT = 0x0000005E,
483 VK_FORMAT_D32_SFLOAT_S8_UINT = 0x0000005F,
484 VK_FORMAT_BC1_RGB_UNORM = 0x00000060,
485 VK_FORMAT_BC1_RGB_SRGB = 0x00000061,
486 VK_FORMAT_BC1_RGBA_UNORM = 0x00000062,
487 VK_FORMAT_BC1_RGBA_SRGB = 0x00000063,
488 VK_FORMAT_BC2_UNORM = 0x00000064,
489 VK_FORMAT_BC2_SRGB = 0x00000065,
490 VK_FORMAT_BC3_UNORM = 0x00000066,
491 VK_FORMAT_BC3_SRGB = 0x00000067,
492 VK_FORMAT_BC4_UNORM = 0x00000068,
493 VK_FORMAT_BC4_SNORM = 0x00000069,
494 VK_FORMAT_BC5_UNORM = 0x0000006A,
495 VK_FORMAT_BC5_SNORM = 0x0000006B,
496 VK_FORMAT_BC6H_UFLOAT = 0x0000006C,
497 VK_FORMAT_BC6H_SFLOAT = 0x0000006D,
498 VK_FORMAT_BC7_UNORM = 0x0000006E,
499 VK_FORMAT_BC7_SRGB = 0x0000006F,
500 VK_FORMAT_ETC2_R8G8B8_UNORM = 0x00000070,
501 VK_FORMAT_ETC2_R8G8B8_SRGB = 0x00000071,
502 VK_FORMAT_ETC2_R8G8B8A1_UNORM = 0x00000072,
503 VK_FORMAT_ETC2_R8G8B8A1_SRGB = 0x00000073,
504 VK_FORMAT_ETC2_R8G8B8A8_UNORM = 0x00000074,
505 VK_FORMAT_ETC2_R8G8B8A8_SRGB = 0x00000075,
506 VK_FORMAT_EAC_R11_UNORM = 0x00000076,
507 VK_FORMAT_EAC_R11_SNORM = 0x00000077,
508 VK_FORMAT_EAC_R11G11_UNORM = 0x00000078,
509 VK_FORMAT_EAC_R11G11_SNORM = 0x00000079,
510 VK_FORMAT_ASTC_4x4_UNORM = 0x0000007A,
511 VK_FORMAT_ASTC_4x4_SRGB = 0x0000007B,
512 VK_FORMAT_ASTC_5x4_UNORM = 0x0000007C,
513 VK_FORMAT_ASTC_5x4_SRGB = 0x0000007D,
514 VK_FORMAT_ASTC_5x5_UNORM = 0x0000007E,
515 VK_FORMAT_ASTC_5x5_SRGB = 0x0000007F,
516 VK_FORMAT_ASTC_6x5_UNORM = 0x00000080,
517 VK_FORMAT_ASTC_6x5_SRGB = 0x00000081,
518 VK_FORMAT_ASTC_6x6_UNORM = 0x00000082,
519 VK_FORMAT_ASTC_6x6_SRGB = 0x00000083,
520 VK_FORMAT_ASTC_8x5_UNORM = 0x00000084,
521 VK_FORMAT_ASTC_8x5_SRGB = 0x00000085,
522 VK_FORMAT_ASTC_8x6_UNORM = 0x00000086,
523 VK_FORMAT_ASTC_8x6_SRGB = 0x00000087,
524 VK_FORMAT_ASTC_8x8_UNORM = 0x00000088,
525 VK_FORMAT_ASTC_8x8_SRGB = 0x00000089,
526 VK_FORMAT_ASTC_10x5_UNORM = 0x0000008A,
527 VK_FORMAT_ASTC_10x5_SRGB = 0x0000008B,
528 VK_FORMAT_ASTC_10x6_UNORM = 0x0000008C,
529 VK_FORMAT_ASTC_10x6_SRGB = 0x0000008D,
530 VK_FORMAT_ASTC_10x8_UNORM = 0x0000008E,
531 VK_FORMAT_ASTC_10x8_SRGB = 0x0000008F,
532 VK_FORMAT_ASTC_10x10_UNORM = 0x00000090,
533 VK_FORMAT_ASTC_10x10_SRGB = 0x00000091,
534 VK_FORMAT_ASTC_12x10_UNORM = 0x00000092,
535 VK_FORMAT_ASTC_12x10_SRGB = 0x00000093,
536 VK_FORMAT_ASTC_12x12_UNORM = 0x00000094,
537 VK_FORMAT_ASTC_12x12_SRGB = 0x00000095,
538 VK_FORMAT_B4G4R4A4_UNORM = 0x00000096,
539 VK_FORMAT_B5G5R5A1_UNORM = 0x00000097,
540 VK_FORMAT_B5G6R5_UNORM = 0x00000098,
541 VK_FORMAT_B5G6R5_USCALED = 0x00000099,
542 VK_FORMAT_B8G8R8_UNORM = 0x0000009A,
543 VK_FORMAT_B8G8R8_SNORM = 0x0000009B,
544 VK_FORMAT_B8G8R8_USCALED = 0x0000009C,
545 VK_FORMAT_B8G8R8_SSCALED = 0x0000009D,
546 VK_FORMAT_B8G8R8_UINT = 0x0000009E,
547 VK_FORMAT_B8G8R8_SINT = 0x0000009F,
548 VK_FORMAT_B8G8R8_SRGB = 0x000000A0,
549 VK_FORMAT_B8G8R8A8_UNORM = 0x000000A1,
550 VK_FORMAT_B8G8R8A8_SNORM = 0x000000A2,
551 VK_FORMAT_B8G8R8A8_USCALED = 0x000000A3,
552 VK_FORMAT_B8G8R8A8_SSCALED = 0x000000A4,
553 VK_FORMAT_B8G8R8A8_UINT = 0x000000A5,
554 VK_FORMAT_B8G8R8A8_SINT = 0x000000A6,
555 VK_FORMAT_B8G8R8A8_SRGB = 0x000000A7,
556 VK_FORMAT_B10G10R10A2_UNORM = 0x000000A8,
557 VK_FORMAT_B10G10R10A2_SNORM = 0x000000A9,
558 VK_FORMAT_B10G10R10A2_USCALED = 0x000000AA,
559 VK_FORMAT_B10G10R10A2_SSCALED = 0x000000AB,
560 VK_FORMAT_B10G10R10A2_UINT = 0x000000AC,
561 VK_FORMAT_B10G10R10A2_SINT = 0x000000AD,
562}
563
Jesse Halld27f6aa2015-08-15 17:58:48 -0700564/// Structure type enumerant
565enum VkStructureType {
566 VK_STRUCTURE_TYPE_APPLICATION_INFO = 0,
Jesse Hallc7467b72015-11-29 21:05:26 -0800567 VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1,
568 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2,
569 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3,
570 VK_STRUCTURE_TYPE_SUBMIT_INFO = 4,
571 VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO = 5,
572 VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6,
573 VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7,
574 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8,
575 VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700576 VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10,
Jesse Hallc7467b72015-11-29 21:05:26 -0800577 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11,
578 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12,
579 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13,
580 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14,
581 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15,
582 VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16,
583 VK_STRUCTURE_TYPE_SHADER_CREATE_INFO = 17,
584 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 18,
585 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 19,
586 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 20,
587 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 21,
588 VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 22,
589 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 23,
590 VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO = 24,
591 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 25,
592 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 26,
593 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 27,
594 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 28,
595 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 29,
596 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 30,
597 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 31,
598 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 32,
599 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 33,
600 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 34,
601 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO = 35,
602 VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 36,
603 VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 37,
604 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 38,
605 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 39,
606 VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO = 40,
607 VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO = 41,
608 VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO = 42,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700609 VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43,
Jesse Hallc7467b72015-11-29 21:05:26 -0800610 VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44,
611 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45,
612 VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46,
613 VK_STRUCTURE_TYPE_LAYER_INSTANCE_CREATE_INFO = 47,
614 VK_STRUCTURE_TYPE_LAYER_DEVICE_CREATE_INFO = 48,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800615
616 //@extension("VK_EXT_KHR_swapchain")
617 VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 0xc0000801,
618
619 //@extension("VK_EXT_KHR_display")
620 VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 0xc0000c00,
Jesse Halla6429252015-11-29 18:59:42 -0800621 VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 0xc0000c01,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800622
623 //@extension("VK_EXT_KHR_display_swapchain")
624 VK_STRUCTURE_TYPE_DISPLAY_SWAPCHAIN_CREATE_INFO_KHR = 0xc0001000,
625 VK_STRUCTURE_TYPE_DISPLAY_DISPLAY_PRESENT_INFO_KHR = 0xc0001001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700626}
627
628enum VkRenderPassContents {
629 VK_RENDER_PASS_CONTENTS_INLINE = 0x00000000,
630 VK_RENDER_PASS_CONTENTS_SECONDARY_CMD_BUFFERS = 0x00000001,
631}
632
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700633@lastUnused(-8)
Jesse Halld27f6aa2015-08-15 17:58:48 -0700634/// Error and return codes
635enum VkResult {
636 // Return codes for successful operation execution (positive values)
637 VK_SUCCESS = 0x00000000,
Jesse Halla15a4bf2015-11-19 22:48:02 -0800638 VK_NOT_READY = 0x00000001,
639 VK_TIMEOUT = 0x00000002,
640 VK_EVENT_SET = 0x00000003,
641 VK_EVENT_RESET = 0x00000004,
642 VK_INCOMPLETE = 0x00000005,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700643
Jesse Hall1356b0d2015-11-23 17:24:58 -0800644 //@extension("VK_EXT_KHR_swapchain")
645 VK_SUBOPTIMAL_KHR = 0x40000403,
646
Jesse Halld27f6aa2015-08-15 17:58:48 -0700647 // Error codes (negative values)
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700648 VK_ERROR_OUT_OF_HOST_MEMORY = 0xFFFFFFFF,
649 VK_ERROR_OUT_OF_DEVICE_MEMORY = 0xFFFFFFFE,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700650 VK_ERROR_INITIALIZATION_FAILED = 0xFFFFFFFD,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700651 VK_ERROR_DEVICE_LOST = 0xFFFFFFFC,
652 VK_ERROR_MEMORY_MAP_FAILED = 0xFFFFFFFB,
653 VK_ERROR_LAYER_NOT_PRESENT = 0xFFFFFFFA,
654 VK_ERROR_EXTENSION_NOT_PRESENT = 0xFFFFFFF9,
Jesse Hall606a54e2015-11-19 22:17:28 -0800655 VK_ERROR_FEATURE_NOT_PRESENT = 0xFFFFFFF8,
656 VK_ERROR_INCOMPATIBLE_DRIVER = 0xFFFFFFF7,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800657
Jesse Halla6429252015-11-29 18:59:42 -0800658 //@extension("VK_EXT_KHR_surface")
659 VK_ERROR_SURFACE_LOST_KHR = 0xC0000400,
660
Jesse Hall1356b0d2015-11-23 17:24:58 -0800661 //@extension("VK_EXT_KHR_swapchain")
662 VK_ERROR_OUT_OF_DATE_KHR = 0xC0000804,
663
664 //@extension("VK_EXT_KHR_display_swapchain")
665 VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = 0xC0001002,
666
667 //@extension("VK_EXT_KHR_android_surface")
668 VK_ERROR_INVALID_ANDROID_WINDOW_KHR = 0xC002400,
669 VK_ERROR_ANDROID_WINDOW_IN_USE_KHR = 0xC002401,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700670}
671
672enum VkDynamicState {
673 VK_DYNAMIC_STATE_VIEWPORT = 0x00000000,
674 VK_DYNAMIC_STATE_SCISSOR = 0x00000001,
675 VK_DYNAMIC_STATE_LINE_WIDTH = 0x00000002,
676 VK_DYNAMIC_STATE_DEPTH_BIAS = 0x00000003,
677 VK_DYNAMIC_STATE_BLEND_CONSTANTS = 0x00000004,
678 VK_DYNAMIC_STATE_DEPTH_BOUNDS = 0x00000005,
679 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 0x00000006,
680 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 0x00000007,
681 VK_DYNAMIC_STATE_STENCIL_REFERENCE = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700682}
683
Jesse Hall1356b0d2015-11-23 17:24:58 -0800684@extension("VK_EXT_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -0800685enum VkSurfaceTransformKHR {
686 VK_SURFACE_TRANSFORM_NONE_KHR = 0x00000000,
687 VK_SURFACE_TRANSFORM_ROT90_KHR = 0x00000001,
688 VK_SURFACE_TRANSFORM_ROT180_KHR = 0x00000002,
689 VK_SURFACE_TRANSFORM_ROT270_KHR = 0x00000003,
690 VK_SURFACE_TRANSFORM_HMIRROR_KHR = 0x00000004,
691 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_KHR = 0x00000005,
692 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_KHR = 0x00000006,
693 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_KHR = 0x00000007,
694 VK_SURFACE_TRANSFORM_INHERIT_KHR = 0x00000008,
695}
696
697@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -0800698enum VkPresentModeKHR {
699 VK_PRESENT_MODE_IMMEDIATE_KHR = 0x00000000,
700 VK_PRESENT_MODE_MAILBOX_KHR = 0x00000001,
701 VK_PRESENT_MODE_FIFO_KHR = 0x00000002,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800702 VK_PRESENT_MODE_FIFO_RELAXED_KHR = 0x00000003,
Michael Lentine88594d72015-11-12 12:49:45 -0800703}
704
Jesse Hall1356b0d2015-11-23 17:24:58 -0800705@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -0800706enum VkColorSpaceKHR {
707 VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000,
708}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700709
710/////////////////
711// Bitfields //
712/////////////////
713
Jesse Halld27f6aa2015-08-15 17:58:48 -0700714/// Queue capabilities
Jesse Halld8bade02015-11-24 10:24:18 -0800715type VkFlags VkQueueFlags
716bitfield VkQueueFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700717 VK_QUEUE_GRAPHICS_BIT = 0x00000001, /// Queue supports graphics operations
718 VK_QUEUE_COMPUTE_BIT = 0x00000002, /// Queue supports compute operations
719 VK_QUEUE_DMA_BIT = 0x00000004, /// Queue supports DMA operations
Jesse Hallb00daad2015-11-29 19:46:20 -0800720 VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, /// Queue supports sparse resource memory management operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700721}
722
723/// Memory properties passed into vkAllocMemory().
Jesse Halld8bade02015-11-24 10:24:18 -0800724type VkFlags VkMemoryPropertyFlags
725bitfield VkMemoryPropertyFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700726 VK_MEMORY_PROPERTY_DEVICE_ONLY = 0x00000000, /// If otherwise stated, then allocate memory on device
727 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000001, /// Memory should be mappable by host
728 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
729 /// vkInvalidateMappedMemoryRanges must be used flush/invalidate host cache
730 VK_MEMORY_PROPERTY_HOST_UNCACHED_BIT = 0x00000004, /// Memory should not be cached by the host
Jesse Hallacfa5342015-11-19 21:51:33 -0800731 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 -0700732}
733
734/// Memory heap flags
Jesse Halld8bade02015-11-24 10:24:18 -0800735type VkFlags VkMemoryHeapFlags
736bitfield VkMemoryHeapFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700737 VK_MEMORY_HEAP_HOST_LOCAL_BIT = 0x00000001, /// If set, heap represents host memory
Jesse Halld27f6aa2015-08-15 17:58:48 -0700738}
739
740/// Memory output flags passed to resource transition commands
Jesse Halld8bade02015-11-24 10:24:18 -0800741type VkFlags VkMemoryOutputFlags
742bitfield VkMemoryOutputFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700743 VK_MEMORY_OUTPUT_HOST_WRITE_BIT = 0x00000001, /// Controls output coherency of host writes
744 VK_MEMORY_OUTPUT_SHADER_WRITE_BIT = 0x00000002, /// Controls output coherency of generic shader writes
745 VK_MEMORY_OUTPUT_COLOR_ATTACHMENT_BIT = 0x00000004, /// Controls output coherency of color attachment writes
746 VK_MEMORY_OUTPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000008, /// Controls output coherency of depth/stencil attachment writes
747 VK_MEMORY_OUTPUT_TRANSFER_BIT = 0x00000010, /// Controls output coherency of transfer operations
748}
749
750/// Memory input flags passed to resource transition commands
Jesse Halld8bade02015-11-24 10:24:18 -0800751type VkFlags VkMemoryInputFlags
752bitfield VkMemoryInputFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700753 VK_MEMORY_INPUT_HOST_READ_BIT = 0x00000001, /// Controls input coherency of host reads
754 VK_MEMORY_INPUT_INDIRECT_COMMAND_BIT = 0x00000002, /// Controls input coherency of indirect command reads
755 VK_MEMORY_INPUT_INDEX_FETCH_BIT = 0x00000004, /// Controls input coherency of index fetches
756 VK_MEMORY_INPUT_VERTEX_ATTRIBUTE_FETCH_BIT = 0x00000008, /// Controls input coherency of vertex attribute fetches
757 VK_MEMORY_INPUT_UNIFORM_READ_BIT = 0x00000010, /// Controls input coherency of uniform buffer reads
758 VK_MEMORY_INPUT_SHADER_READ_BIT = 0x00000020, /// Controls input coherency of generic shader reads
759 VK_MEMORY_INPUT_COLOR_ATTACHMENT_BIT = 0x00000040, /// Controls input coherency of color attachment reads
760 VK_MEMORY_INPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000080, /// Controls input coherency of depth/stencil attachment reads
761 VK_MEMORY_INPUT_INPUT_ATTACHMENT_BIT = 0x00000100, /// Controls input coherency of input attachment reads
762 VK_MEMORY_INPUT_TRANSFER_BIT = 0x00000200, /// Controls input coherency of transfer operations
763}
764
765/// Buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800766type VkFlags VkBufferUsageFlags
767bitfield VkBufferUsageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700768 VK_BUFFER_USAGE_TRANSFER_SOURCE_BIT = 0x00000001, /// Can be used as a source of transfer operations
769 VK_BUFFER_USAGE_TRANSFER_DESTINATION_BIT = 0x00000002, /// Can be used as a destination of transfer operations
770 VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, /// Can be used as TBO
771 VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, /// Can be used as IBO
772 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, /// Can be used as UBO
773 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, /// Can be used as SSBO
774 VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, /// Can be used as source of fixed function index fetch (index buffer)
775 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, /// Can be used as source of fixed function vertex fetch (VBO)
776 VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, /// Can be the source of indirect parameters (e.g. indirect buffer, parameter buffer)
777}
778
779/// Buffer creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800780type VkFlags VkBufferCreateFlags
781bitfield VkBufferCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700782 VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Buffer should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700783 VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Buffer should support sparse backing with partial residency
784 VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Buffer should support constent data access to physical memory blocks mapped into multiple locations of sparse buffers
785}
786
787/// Shader stage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800788type VkFlags VkShaderStageFlags
789bitfield VkShaderStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700790 VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
Jesse Hallae38f732015-11-19 21:32:50 -0800791 VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
792 VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700793 VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
794 VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
795 VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
Jesse Hallc7467b72015-11-29 21:05:26 -0800796 VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700797
798 VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
799}
800
Jesse Hallfbf97b02015-11-20 14:17:03 -0800801/// Descriptor pool create flags
Jesse Halld8bade02015-11-24 10:24:18 -0800802type VkFlags VkDescriptorPoolCreateFlags
803bitfield VkDescriptorPoolCreateFlagBits {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800804 VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
805}
806
807/// Descriptor pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -0800808type VkFlags VkDescriptorPoolResetFlags
Jesse Halla6429252015-11-29 18:59:42 -0800809//bitfield VkDescriptorPoolResetFlagBits {
810//}
Jesse Hallfbf97b02015-11-20 14:17:03 -0800811
Jesse Halld27f6aa2015-08-15 17:58:48 -0700812/// Image usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800813type VkFlags VkImageUsageFlags
814bitfield VkImageUsageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700815 VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT = 0x00000001, /// Can be used as a source of transfer operations
816 VK_IMAGE_USAGE_TRANSFER_DESTINATION_BIT = 0x00000002, /// Can be used as a destination of transfer operations
817 VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, /// Can be sampled from (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
818 VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, /// Can be used as storage image (STORAGE_IMAGE descriptor type)
819 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, /// Can be used as framebuffer color attachment
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700820 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment
Jesse Halld27f6aa2015-08-15 17:58:48 -0700821 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering
822 VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment
823}
824
825/// Image creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800826type VkFlags VkImageCreateFlags
827bitfield VkImageCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700828 VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Image should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700829 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Image should support sparse backing with partial residency
830 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 -0700831 VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, /// Allows image views to have different format than the base image
832 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 -0700833}
834
Jesse Hallb00daad2015-11-29 19:46:20 -0800835/// Image view creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800836type VkFlags VkImageViewCreateFlags
Jesse Hallb00daad2015-11-29 19:46:20 -0800837//bitfield VkImageViewCreateFlagBits {
838//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700839
840/// Pipeline creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800841type VkFlags VkPipelineCreateFlags
842bitfield VkPipelineCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700843 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
844 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
845 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
846}
847
848/// Channel flags
Jesse Halld8bade02015-11-24 10:24:18 -0800849type VkFlags VkChannelFlags
850bitfield VkChannelFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700851 VK_CHANNEL_R_BIT = 0x00000001,
852 VK_CHANNEL_G_BIT = 0x00000002,
853 VK_CHANNEL_B_BIT = 0x00000004,
854 VK_CHANNEL_A_BIT = 0x00000008,
855}
856
857/// Fence creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800858type VkFlags VkFenceCreateFlags
859bitfield VkFenceCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700860 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
861}
862
863/// Semaphore creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800864type VkFlags VkSemaphoreCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800865//bitfield VkSemaphoreCreateFlagBits {
866//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700867
868/// Format capability flags
Jesse Halld8bade02015-11-24 10:24:18 -0800869type VkFlags VkFormatFeatureFlags
870bitfield VkFormatFeatureFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700871 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
872 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type)
873 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images
874 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs)
875 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs)
876 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers
877 VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs)
878 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images
879 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images
880 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700881 VK_FORMAT_FEATURE_BLIT_SOURCE_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCmdBlitImage
882 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 -0700883}
884
885/// Query control flags
Jesse Halld8bade02015-11-24 10:24:18 -0800886type VkFlags VkQueryControlFlags
887bitfield VkQueryControlFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700888 VK_QUERY_CONTROL_CONSERVATIVE_BIT = 0x00000001, /// Allow conservative results to be collected by the query
889}
890
891/// Query result flags
Jesse Halld8bade02015-11-24 10:24:18 -0800892type VkFlags VkQueryResultFlags
893bitfield VkQueryResultFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700894 VK_QUERY_RESULT_DEFAULT = 0x00000000, /// Results of the queries are immediately written to the destination buffer as 32-bit values
895 VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values
896 VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy
897 VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written
898 VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available
899}
900
901/// Shader module creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800902type VkFlags VkShaderModuleCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800903//bitfield VkShaderModuleCreateFlagBits {
904//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700905
906/// Shader creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800907type VkFlags VkShaderCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800908//bitfield VkShaderCreateFlagBits {
909//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700910
911/// Event creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800912type VkFlags VkEventCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800913//bitfield VkEventCreateFlagBits {
914//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700915
Jesse Halla15a4bf2015-11-19 22:48:02 -0800916/// Command buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800917type VkFlags VkCmdBufferUsageFlags
918bitfield VkCmdBufferUsageFlagBits {
Jesse Halla15a4bf2015-11-19 22:48:02 -0800919 VK_CMD_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
920 VK_CMD_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
921 VK_CMD_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700922}
923
924/// Pipeline statistics flags
Jesse Halld8bade02015-11-24 10:24:18 -0800925type VkFlags VkQueryPipelineStatisticFlags
926bitfield VkQueryPipelineStatisticFlagBits {
Jesse Hallae38f732015-11-19 21:32:50 -0800927 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, /// Optional
928 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, /// Optional
929 VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, /// Optional
930 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, /// Optional
931 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, /// Optional
932 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, /// Optional
933 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, /// Optional
934 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, /// Optional
935 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, /// Optional
936 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, /// Optional
937 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, /// Optional
Jesse Halld27f6aa2015-08-15 17:58:48 -0700938}
939
940/// Memory mapping flags
Jesse Halld8bade02015-11-24 10:24:18 -0800941type VkFlags VkMemoryMapFlags
Jesse Halla6429252015-11-29 18:59:42 -0800942//bitfield VkMemoryMapFlagBits {
943//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700944
945/// Bitfield of image aspects
Jesse Halld8bade02015-11-24 10:24:18 -0800946type VkFlags VkImageAspectFlags
947bitfield VkImageAspectFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700948 VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
949 VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
950 VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
951 VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
952}
953
954/// Sparse memory bind flags
Jesse Halld8bade02015-11-24 10:24:18 -0800955type VkFlags VkSparseMemoryBindFlags
956bitfield VkSparseMemoryBindFlagBits {
Jesse Halla9bb62b2015-11-21 19:31:56 -0800957 VK_SPARSE_MEMORY_BIND_REPLICATE_BLOCK_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700958}
959
960/// Sparse image memory requirements flags
Jesse Halld8bade02015-11-24 10:24:18 -0800961type VkFlags VkSparseImageFormatFlags
962bitfield VkSparseImageFormatFlagBits {
Jesse Hallb00daad2015-11-29 19:46:20 -0800963 VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices
964 VK_SPARSE_IMAGE_FORMAT_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.
965 VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size
Jesse Halld27f6aa2015-08-15 17:58:48 -0700966}
967
968/// Pipeline stages
Jesse Halld8bade02015-11-24 10:24:18 -0800969type VkFlags VkPipelineStageFlags
970bitfield VkPipelineStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700971 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed
972 VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch
973 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch
974 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading
Jesse Hallae38f732015-11-19 21:32:50 -0800975 VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading
976 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading
Jesse Halld27f6aa2015-08-15 17:58:48 -0700977 VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading
978 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading
979 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests
980 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests
981 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes
982 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading
983 VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700984 VK_PIPELINE_STAGE_HOST_BIT = 0x00002000, /// Indicates host (CPU) is a source/sink of the dependency
Jesse Halld27f6aa2015-08-15 17:58:48 -0700985
986 VK_PIPELINE_STAGE_ALL_GRAPHICS = 0x000007FF, /// All stages of the graphics pipeline
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700987 VK_PIPELINE_STAGE_ALL_GPU_COMMANDS = 0x00001FFF, /// All graphics, compute, copy, and transition commands
988}
989
990/// Render pass attachment description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800991type VkFlags VkAttachmentDescriptionFlags
992bitfield VkAttachmentDescriptionFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700993 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 -0700994}
995
996/// Subpass description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800997type VkFlags VkSubpassDescriptionFlags
998bitfield VkSubpassDescriptionFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700999}
1000
1001/// Command pool creation flags
Jesse Halld8bade02015-11-24 10:24:18 -08001002type VkFlags VkCmdPoolCreateFlags
1003bitfield VkCmdPoolCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001004 VK_CMD_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime
1005 VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually
1006}
1007
1008/// Command pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -08001009type VkFlags VkCmdPoolResetFlags
1010bitfield VkCmdPoolResetFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001011 VK_CMD_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool
Jesse Halld27f6aa2015-08-15 17:58:48 -07001012}
1013
Jesse Halld8bade02015-11-24 10:24:18 -08001014type VkFlags VkCmdBufferResetFlags
1015bitfield VkCmdBufferResetFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001016 VK_CMD_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer
1017}
1018
Jesse Halld8bade02015-11-24 10:24:18 -08001019type VkFlags VkSampleCountFlags
1020bitfield VkSampleCountFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001021 VK_SAMPLE_COUNT_1_BIT = 0x00000001,
1022 VK_SAMPLE_COUNT_2_BIT = 0x00000002,
1023 VK_SAMPLE_COUNT_4_BIT = 0x00000004,
1024 VK_SAMPLE_COUNT_8_BIT = 0x00000008,
1025 VK_SAMPLE_COUNT_16_BIT = 0x00000010,
1026 VK_SAMPLE_COUNT_32_BIT = 0x00000020,
1027 VK_SAMPLE_COUNT_64_BIT = 0x00000040,
1028}
1029
Jesse Halld8bade02015-11-24 10:24:18 -08001030type VkFlags VkStencilFaceFlags
1031bitfield VkStencilFaceFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001032 VK_STENCIL_FACE_NONE = 0x00000000, /// No faces
1033 VK_STENCIL_FACE_FRONT_BIT = 0x00000001, /// Front face
1034 VK_STENCIL_FACE_BACK_BIT = 0x00000002, /// Back face
Jesse Hallc7467b72015-11-29 21:05:26 -08001035 VK_STENCIL_FRONT_AND_BACK = 0x00000003,
Jesse Halld27f6aa2015-08-15 17:58:48 -07001036}
1037
Jesse Halla6429252015-11-29 18:59:42 -08001038/// Instance creation flags
1039type VkFlags VkInstanceCreateFlags
1040//bitfield VkInstanceCreateFlagBits {
1041//}
1042
1043/// Device creation flags
1044type VkFlags VkDeviceCreateFlags
1045//bitfield VkDeviceCreateFlagBits {
1046//}
1047
1048/// Device queue creation flags
1049type VkFlags VkDeviceQueueCreateFlags
1050//bitfield VkDeviceQueueCreateFlagBits {
1051//}
1052
1053/// Query pool creation flags
1054type VkFlags VkQueryPoolCreateFlags
1055//bitfield VkQueryPoolCreateFlagBits {
1056//}
1057
1058/// Buffer view creation flags
1059type VkFlags VkBufferViewCreateFlags
1060//bitfield VkBufferViewCreateFlagBits {
1061//}
1062
1063/// Pipeline cache creation flags
1064type VkFlags VkPipelineCacheCreateFlags
1065//bitfield VkPipelineCacheCreateFlagBits {
1066//}
1067
1068/// Pipeline shader stage creation flags
1069type VkFlags VkPipelineShaderStageCreateFlags
1070//bitfield VkPipelineShaderStageCreateFlagBits {
1071//}
1072
1073/// Descriptor set layout creation flags
1074type VkFlags VkDescriptorSetLayoutCreateFlags
1075//bitfield VkDescriptorSetLayoutCreateFlagBits {
1076//}
1077
1078/// Pipeline vertex input state creation flags
1079type VkFlags VkPipelineVertexInputStateCreateFlags
1080//bitfield VkPipelineVertexInputStateCreateFlagBits {
1081//}
1082
1083/// Pipeline input assembly state creation flags
1084type VkFlags VkPipelineInputAssemblyStateCreateFlags
1085//bitfield VkPipelineInputAssemblyStateCreateFlagBits {
1086//}
1087
1088/// Tessellation state creation flags
1089type VkFlags VkPipelineTessellationStateCreateFlags
1090//bitfield VkPipelineTessellationStateCreateFlagBits {
1091//}
1092
1093/// Viewport state creation flags
1094type VkFlags VkPipelineViewportStateCreateFlags
1095//bitfield VkPipelineViewportStateCreateFlagBits {
1096//}
1097
1098/// Raster state creation flags
1099type VkFlags VkPipelineRasterStateCreateFlags
1100//bitfield VkPipelineRasterStateCreateFlagBits {
1101//}
1102
1103/// Multisample state creation flags
1104type VkFlags VkPipelineMultisampleStateCreateFlags
1105//bitfield VkPipelineMultisampleStateCreateFlagBits {
1106//}
1107
1108/// Color blend state creation flags
1109type VkFlags VkPipelineColorBlendStateCreateFlags
1110//bitfield VkPipelineColorBlendStateCreateFlagBits {
1111//}
1112
1113/// Depth/stencil state creation flags
1114type VkFlags VkPipelineDepthStencilStateCreateFlags
1115//bitfield VkPipelineDepthStencilStateCreateFlagBits {
1116//}
1117
1118/// Dynamic state creation flags
1119type VkFlags VkPipelineDynamicStateCreateFlags
1120//bitfield VkPipelineDynamicStateCreateFlagBits {
1121//}
1122
1123/// Pipeline layout creation flags
1124type VkFlags VkPipelineLayoutCreateFlags
1125//bitfield VkPipelineLayoutCreateFlagBits {
1126//}
1127
1128/// Sampler creation flags
1129type VkFlags VkSamplerCreateFlags
1130//bitfield VkSamplerCreateFlagBits {
1131//}
1132
1133/// Render pass creation flags
1134type VkFlags VkRenderPassCreateFlags
1135//bitfield VkRenderPassCreateFlagBits {
1136//}
1137
1138/// Framebuffer creation flags
1139type VkFlags VkFramebufferCreateFlags
1140//bitfield VkFramebufferCreateFlagBits {
1141//}
1142
Jesse Halldc6d36c2015-11-29 19:12:15 -08001143/// Dependency flags
1144type VkFlags VkDependencyFlags
1145bitfield VkDependencyFlagBits {
1146 VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
1147}
1148
Jesse Hallc7467b72015-11-29 21:05:26 -08001149/// Cull mode flags
1150type VkFlags VkCullModeFlags
1151bitfield VkCullModeFlagBits {
1152 VK_CULL_MODE_NONE = 0x00000000,
1153 VK_CULL_MODE_FRONT_BIT = 0x00000001,
1154 VK_CULL_MODE_BACK_BIT = 0x00000002,
1155 VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
1156}
1157
Michael Lentine88594d72015-11-12 12:49:45 -08001158@extension("VK_EXT_KHR_swapchain")
Jesse Halld8bade02015-11-24 10:24:18 -08001159type VkFlags VkSurfaceTransformFlagsKHR
1160@extension("VK_EXT_KHR_swapchain")
1161bitfield VkSurfaceTransformFlagBitsKHR {
Michael Lentine88594d72015-11-12 12:49:45 -08001162 VK_SURFACE_TRANSFORM_NONE_BIT_KHR = 0x00000001,
1163 VK_SURFACE_TRANSFORM_ROT90_BIT_KHR = 0x00000002,
1164 VK_SURFACE_TRANSFORM_ROT180_BIT_KHR = 0x00000004,
1165 VK_SURFACE_TRANSFORM_ROT270_BIT_KHR = 0x00000008,
1166 VK_SURFACE_TRANSFORM_HMIRROR_BIT_KHR = 0x00000010,
1167 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_BIT_KHR = 0x00000020,
1168 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_BIT_KHR = 0x00000040,
1169 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_BIT_KHR = 0x00000080,
1170 VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
1171}
Jesse Halld27f6aa2015-08-15 17:58:48 -07001172
Jesse Halla6429252015-11-29 18:59:42 -08001173@extension("VK_EXT_KHR_swapchain")
1174type VkFlags VkCompositeAlphaFlagsKHR
1175@extension("VK_EXT_KHR_swapchain")
1176bitfield VkCompositeAlphaFlagBitsKHR {
1177 VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
1178 VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
1179 VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
1180 VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
1181}
1182
Jesse Hall1356b0d2015-11-23 17:24:58 -08001183@extension("VK_EXT_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001184type VkFlags VkDisplayPlaneAlphaFlagsKHR
1185@extension("VK_EXT_KHR_display")
1186bitfield VkDisplayPlaneAlphaFlagBitsKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08001187 VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000001,
1188 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000002,
1189 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000004,
1190}
1191
1192
Jesse Halld27f6aa2015-08-15 17:58:48 -07001193//////////////////
1194// Structures //
1195//////////////////
1196
1197class VkOffset2D {
1198 s32 x
1199 s32 y
1200}
1201
1202class VkOffset3D {
1203 s32 x
1204 s32 y
1205 s32 z
1206}
1207
1208class VkExtent2D {
1209 s32 width
1210 s32 height
1211}
1212
1213class VkExtent3D {
1214 s32 width
1215 s32 height
1216 s32 depth
1217}
1218
1219class VkViewport {
1220 f32 originX
1221 f32 originY
1222 f32 width
1223 f32 height
1224 f32 minDepth
1225 f32 maxDepth
1226}
1227
1228class VkRect2D {
1229 VkOffset2D offset
1230 VkExtent2D extent
1231}
1232
Jesse Halla15a4bf2015-11-19 22:48:02 -08001233class VkClearRect {
1234 VkRect2D rect
1235 u32 baseArrayLayer
1236 u32 numLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001237}
1238
1239class VkChannelMapping {
1240 VkChannelSwizzle r
1241 VkChannelSwizzle g
1242 VkChannelSwizzle b
1243 VkChannelSwizzle a
1244}
1245
1246class VkPhysicalDeviceProperties {
1247 u32 apiVersion
1248 u32 driverVersion
1249 u32 vendorId
1250 u32 deviceId
1251 VkPhysicalDeviceType deviceType
1252 char[VK_MAX_PHYSICAL_DEVICE_NAME] deviceName
1253 u8[VK_UUID_LENGTH] pipelineCacheUUID
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001254 VkPhysicalDeviceLimits limits
1255 VkPhysicalDeviceSparseProperties sparseProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001256}
1257
1258class VkExtensionProperties {
1259 char[VK_MAX_EXTENSION_NAME] extName /// extension name
1260 u32 specVersion /// version of the extension specification implemented
1261}
1262
1263class VkLayerProperties {
1264 char[VK_MAX_EXTENSION_NAME] layerName /// layer name
1265 u32 specVersion /// version of the layer specification implemented
1266 u32 implVersion /// build or release version of the layer's library
Jesse Hallf09c6b12015-08-15 19:54:28 -07001267 char[VK_MAX_DESCRIPTION] description /// Free-form description of the layer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001268}
1269
Jesse Halla366a512015-11-19 22:30:07 -08001270class VkSubmitInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001271 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_SUBMIT_INFO
1272 const void* pNext /// Next structure in chain
1273 u32 waitSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001274 const VkSemaphore* pWaitSemaphores
Jesse Hall03b6fe12015-11-24 12:44:21 -08001275 u32 commandBufferCount
Jesse Halla366a512015-11-19 22:30:07 -08001276 const VkCmdBuffer* pCommandBuffers
Jesse Hall03b6fe12015-11-24 12:44:21 -08001277 u32 signalSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001278 const VkSemaphore* pSignalSemaphores
1279}
1280
Jesse Halld27f6aa2015-08-15 17:58:48 -07001281class VkApplicationInfo {
1282 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO
1283 const void* pNext /// Next structure in chain
1284 const char* pAppName
1285 u32 appVersion
1286 const char* pEngineName
1287 u32 engineVersion
1288 u32 apiVersion
1289}
1290
1291class VkAllocCallbacks {
1292 void* pUserData
1293 PFN_vkAllocFunction pfnAlloc
Jesse Hall03b6fe12015-11-24 12:44:21 -08001294 PFN_vkReallocFunction pfnRealloc
Jesse Halld27f6aa2015-08-15 17:58:48 -07001295 PFN_vkFreeFunction pfnFree
Jesse Hall03b6fe12015-11-24 12:44:21 -08001296 PFN_vkInternalAllocNotification pfnInternalAlloc
1297 PFN_vkInternalFreeNotification pfnInternalFree
Jesse Halld27f6aa2015-08-15 17:58:48 -07001298}
1299
1300class VkDeviceQueueCreateInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001301 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
1302 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001303 VkDeviceQueueCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001304 u32 queueFamilyIndex
Jesse Hall03b6fe12015-11-24 12:44:21 -08001305 u32 queuePriorityCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001306 const f32* pQueuePriorities
Jesse Halld27f6aa2015-08-15 17:58:48 -07001307}
1308
1309class VkDeviceCreateInfo {
1310 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
1311 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001312 VkDeviceCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001313 u32 requestedQueueRecordCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001314 const VkDeviceQueueCreateInfo* pRequestedQueues
Jesse Hall03b6fe12015-11-24 12:44:21 -08001315 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001316 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001317 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001318 const char* const* ppEnabledExtensionNames
1319 const VkPhysicalDeviceFeatures* pEnabledFeatures
Jesse Halld27f6aa2015-08-15 17:58:48 -07001320}
1321
1322class VkInstanceCreateInfo {
1323 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
1324 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001325 VkInstanceCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001326 const VkApplicationInfo* pAppInfo
Jesse Hall03b6fe12015-11-24 12:44:21 -08001327 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001328 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001329 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001330 const char* const* ppEnabledExtensionNames /// Extension names to be enabled
1331}
1332
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001333class VkQueueFamilyProperties {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001334 VkQueueFlags queueFlags /// Queue flags
1335 u32 queueCount
Jesse Hallacfa5342015-11-19 21:51:33 -08001336 u32 timestampValidBits
Jesse Halld27f6aa2015-08-15 17:58:48 -07001337}
1338
1339class VkPhysicalDeviceMemoryProperties {
1340 u32 memoryTypeCount
1341 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes
1342 u32 memoryHeapCount
1343 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps
1344}
1345
1346class VkMemoryAllocInfo {
1347 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO
1348 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001349 VkDeviceSize allocationSize /// Size of memory allocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001350 u32 memoryTypeIndex /// Index of the of the memory type to allocate from
1351}
1352
1353class VkMemoryRequirements {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001354 VkDeviceSize size /// Specified in bytes
1355 VkDeviceSize alignment /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001356 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object
1357}
1358
1359class VkSparseImageFormatProperties {
Jesse Halld8bade02015-11-24 10:24:18 -08001360 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001361 VkExtent3D imageGranularity
1362 VkSparseImageFormatFlags flags
1363}
1364
1365class VkSparseImageMemoryRequirements {
Jesse Hallb00daad2015-11-29 19:46:20 -08001366 VkSparseImageFormatProperties formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001367 u32 imageMipTailStartLOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001368 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment
1369 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment
1370 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07001371}
1372
1373class VkMemoryType {
1374 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type
1375 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from
1376}
1377
1378class VkMemoryHeap {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001379 VkDeviceSize size /// Available memory in the heap
Jesse Halld27f6aa2015-08-15 17:58:48 -07001380 VkMemoryHeapFlags flags /// Flags for the heap
1381}
1382
1383class VkMappedMemoryRange {
1384 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
1385 const void* pNext /// Pointer to next structure
1386 VkDeviceMemory mem /// Mapped memory object
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001387 VkDeviceSize offset /// Offset within the mapped memory the range starts from
1388 VkDeviceSize size /// Size of the range within the mapped memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07001389}
1390
1391class VkFormatProperties {
1392 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling
1393 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001394 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001395}
1396
1397class VkImageFormatProperties {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001398 VkExtent3D maxExtent /// max image dimensions for this resource type
1399 u32 maxMipLevels /// max number of mipmap levels for this resource type
Jesse Halla15a4bf2015-11-19 22:48:02 -08001400 u32 maxArrayLayers /// max array layers for this resource type
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001401 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type
1402 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type
1403}
1404
Jesse Halla15a4bf2015-11-19 22:48:02 -08001405class VkDescriptorImageInfo {
1406 VkSampler sampler
1407 VkImageView imageView
1408 VkImageLayout imageLayout
1409}
1410
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001411class VkDescriptorBufferInfo {
1412 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC]
1413 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set.
1414 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001415}
1416
Jesse Halld27f6aa2015-08-15 17:58:48 -07001417class VkWriteDescriptorSet {
1418 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
1419 const void* pNext /// Pointer to next structure
1420 VkDescriptorSet destSet /// Destination descriptor set
1421 u32 destBinding /// Binding within the destination descriptor set to write
1422 u32 destArrayElement /// Array element within the destination binding to write
Jesse Hall03b6fe12015-11-24 12:44:21 -08001423 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001424 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 -08001425 const VkDescriptorImageInfo* pImageInfo
1426 const VkDescriptorBufferInfo* pBufferInfo
1427 const VkBufferView* pTexelBufferView
Jesse Halld27f6aa2015-08-15 17:58:48 -07001428}
1429
1430class VkCopyDescriptorSet {
1431 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
1432 const void* pNext /// Pointer to next structure
1433 VkDescriptorSet srcSet /// Source descriptor set
1434 u32 srcBinding /// Binding within the source descriptor set to copy from
1435 u32 srcArrayElement /// Array element within the source binding to copy from
1436 VkDescriptorSet destSet /// Destination descriptor set
1437 u32 destBinding /// Binding within the destination descriptor set to copy to
1438 u32 destArrayElement /// Array element within the destination binding to copy to
Jesse Hall03b6fe12015-11-24 12:44:21 -08001439 u32 descriptorCount /// Number of descriptors to copy
Jesse Halld27f6aa2015-08-15 17:58:48 -07001440}
1441
1442class VkBufferCreateInfo {
1443 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
1444 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001445 VkBufferCreateFlags flags /// Buffer creation flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001446 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001447 VkBufferUsageFlags usage /// Buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001448 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001449 u32 queueFamilyIndexCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001450 const u32* pQueueFamilyIndices
1451}
1452
1453class VkBufferViewCreateInfo {
1454 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
1455 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001456 VkBufferViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001457 VkBuffer buffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001458 VkFormat format /// Optionally specifies format of elements
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001459 VkDeviceSize offset /// Specified in bytes
1460 VkDeviceSize range /// View size specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001461}
1462
1463class VkImageSubresource {
Jesse Halld8bade02015-11-24 10:24:18 -08001464 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001465 u32 mipLevel
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001466 u32 arrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001467}
1468
1469class VkImageSubresourceRange {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001470 VkImageAspectFlags aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001471 u32 baseMipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001472 u32 numLevels
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001473 u32 baseArrayLayer
Jesse Halla15a4bf2015-11-19 22:48:02 -08001474 u32 numLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001475}
1476
1477class VkMemoryBarrier {
1478 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER
1479 const void* pNext /// Pointer to next structure.
1480 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1481 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1482}
1483
1484class VkBufferMemoryBarrier {
1485 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
1486 const void* pNext /// Pointer to next structure.
1487 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1488 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1489 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
1490 u32 destQueueFamilyIndex /// Queue family to transition ownership to
1491 VkBuffer buffer /// Buffer to sync
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001492 VkDeviceSize offset /// Offset within the buffer to sync
1493 VkDeviceSize size /// Amount of bytes to sync
Jesse Halld27f6aa2015-08-15 17:58:48 -07001494}
1495
1496class VkImageMemoryBarrier {
1497 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
1498 const void* pNext /// Pointer to next structure.
1499 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1500 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1501 VkImageLayout oldLayout /// Current layout of the image
1502 VkImageLayout newLayout /// New layout to transition the image to
1503 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
1504 u32 destQueueFamilyIndex /// Queue family to transition ownership to
1505 VkImage image /// Image to sync
1506 VkImageSubresourceRange subresourceRange /// Subresource range to sync
1507}
1508
1509class VkImageCreateInfo {
1510 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
1511 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001512 VkImageCreateFlags flags /// Image creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001513 VkImageType imageType
1514 VkFormat format
1515 VkExtent3D extent
1516 u32 mipLevels
Jesse Halla15a4bf2015-11-19 22:48:02 -08001517 u32 arrayLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001518 u32 samples
1519 VkImageTiling tiling
1520 VkImageUsageFlags usage /// Image usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001521 VkSharingMode sharingMode /// Cross-queue-family sharing mode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001522 u32 queueFamilyIndexCount /// Number of queue families to share across
Jesse Halld27f6aa2015-08-15 17:58:48 -07001523 const u32* pQueueFamilyIndices /// Array of queue family indices to share across
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001524 VkImageLayout initialLayout /// Initial image layout for all subresources
Jesse Halld27f6aa2015-08-15 17:58:48 -07001525}
1526
1527class VkSubresourceLayout {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001528 VkDeviceSize offset /// Specified in bytes
1529 VkDeviceSize size /// Specified in bytes
1530 VkDeviceSize rowPitch /// Specified in bytes
1531 VkDeviceSize depthPitch /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001532}
1533
1534class VkImageViewCreateInfo {
1535 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
1536 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001537 VkImageViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001538 VkImage image
1539 VkImageViewType viewType
1540 VkFormat format
1541 VkChannelMapping channels
1542 VkImageSubresourceRange subresourceRange
Jesse Halld27f6aa2015-08-15 17:58:48 -07001543}
1544
1545class VkBufferCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001546 VkDeviceSize srcOffset /// Specified in bytes
1547 VkDeviceSize destOffset /// Specified in bytes
Jesse Hallb00daad2015-11-29 19:46:20 -08001548 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001549}
1550
Jesse Halla6429252015-11-29 18:59:42 -08001551class VkSparseMemoryBind {
Jesse Hallb00daad2015-11-29 19:46:20 -08001552 VkDeviceSize resourceOffset /// Specified in bytes
1553 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001554 VkDeviceMemory mem
Jesse Hallb00daad2015-11-29 19:46:20 -08001555 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001556 VkSparseMemoryBindFlags flags
1557}
1558
Jesse Halla6429252015-11-29 18:59:42 -08001559class VkSparseImageMemoryBind {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001560 VkImageSubresource subresource
1561 VkOffset3D offset
1562 VkExtent3D extent
Jesse Halld27f6aa2015-08-15 17:58:48 -07001563 VkDeviceMemory mem
Jesse Hallb00daad2015-11-29 19:46:20 -08001564 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001565 VkSparseMemoryBindFlags flags
1566}
1567
Jesse Halla6429252015-11-29 18:59:42 -08001568class VkSparseBufferMemoryBindInfo {
1569 VkBuffer buffer
1570 u32 bindCount
1571 const VkSparseMemoryBind* pBinds
1572}
1573
1574class VkSparseImageOpaqueMemoryBindInfo {
1575 VkImage image
1576 u32 bindCount
1577 const VkSparseMemoryBind* pBinds
1578}
1579
1580class VkSparseImageMemoryBindInfo {
1581 VkImage image
1582 u32 bindCount
1583 const VkSparseMemoryBind* pBinds
1584}
1585
1586class VkBindSparseInfo {
1587 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
1588 const void* pNext
1589 u32 waitSemaphoreCount
1590 const VkSemaphore* pWaitSemaphores
1591 u32 numBufferBinds
1592 const VkSparseBufferMemoryBindInfo* pBufferBinds
1593 u32 numImageOpaqueBinds
1594 const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds
1595 u32 numImageBinds
1596 const VkSparseImageMemoryBindInfo* pImageBinds
1597 u32 signalSemaphoreCount
1598 const VkSemaphore* pSignalSemaphores
1599}
1600
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001601class VkImageSubresourceCopy {
Jesse Halla15a4bf2015-11-19 22:48:02 -08001602 VkImageAspectFlags aspect
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001603 u32 mipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001604 u32 baseArrayLayer
1605 u32 numLayers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001606}
1607
Jesse Halld27f6aa2015-08-15 17:58:48 -07001608class VkImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001609 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001610 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001611 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001612 VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images
1613 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images
1614}
1615
1616class VkImageBlit {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001617 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001618 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
1619 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001620 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001621 VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images
1622 VkExtent3D destExtent /// Specified in pixels for both compressed and uncompressed images
1623}
1624
1625class VkBufferImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001626 VkDeviceSize bufferOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001627 u32 bufferRowLength /// Specified in texels
1628 u32 bufferImageHeight
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001629 VkImageSubresourceCopy imageSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001630 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images
1631 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images
1632}
1633
1634class VkImageResolve {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001635 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001636 VkOffset3D srcOffset
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001637 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001638 VkOffset3D destOffset
1639 VkExtent3D extent
1640}
1641
1642class VkShaderModuleCreateInfo {
1643 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
1644 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001645 VkShaderModuleCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001646 platform.size_t codeSize /// Specified in bytes
Jesse Halla9bb62b2015-11-21 19:31:56 -08001647 const u32* pCode /// Binary code of size codeSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07001648}
1649
1650class VkShaderCreateInfo {
1651 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
1652 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001653 VkShaderCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001654 VkShaderModule module /// Module containing entry point
1655 const char* pName /// Null-terminated entry point name
Jesse Halld8bade02015-11-24 10:24:18 -08001656 VkShaderStageFlagBits stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001657}
1658
1659class VkDescriptorSetLayoutBinding {
1660 VkDescriptorType descriptorType /// Type of the descriptors in this binding
1661 u32 arraySize /// Number of descriptors in this binding
1662 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to
1663 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements)
1664}
1665
1666class VkDescriptorSetLayoutCreateInfo {
1667 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
1668 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001669 VkDescriptorSetLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001670 u32 bindingCount /// Number of bindings in the descriptor set layout
1671 const VkDescriptorSetLayoutBinding* pBindings /// Array of descriptor set layout bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001672}
1673
1674class VkDescriptorTypeCount {
1675 VkDescriptorType type
Jesse Hall03b6fe12015-11-24 12:44:21 -08001676 u32 descriptorCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001677}
1678
1679class VkDescriptorPoolCreateInfo {
1680 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
1681 const void* pNext /// Pointer to next structure
Jesse Hallfbf97b02015-11-20 14:17:03 -08001682 VkDescriptorPoolCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001683 u32 maxSets
Jesse Hall03b6fe12015-11-24 12:44:21 -08001684 u32 typeCount
1685 const VkDescriptorTypeCount* pTypeCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07001686}
1687
Jesse Hallfbf97b02015-11-20 14:17:03 -08001688class VkDescriptorSetAllocInfo {
1689 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO
1690 const void* pNext /// Pointer to next structure
1691 VkDescriptorPool descriptorPool
Jesse Hall03b6fe12015-11-24 12:44:21 -08001692 u32 setCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001693 const VkDescriptorSetLayout* pSetLayouts
1694}
1695
Jesse Halld27f6aa2015-08-15 17:58:48 -07001696class VkSpecializationMapEntry {
1697 u32 constantId /// The SpecConstant ID specified in the BIL
Jesse Halld27f6aa2015-08-15 17:58:48 -07001698 u32 offset /// Offset of the value in the data block
Jesse Hallb00daad2015-11-29 19:46:20 -08001699 platform.size_t size /// Size in bytes of the SpecConstant
Jesse Halld27f6aa2015-08-15 17:58:48 -07001700}
1701
1702class VkSpecializationInfo {
1703 u32 mapEntryCount /// Number of entries in the map
Jesse Hallb00daad2015-11-29 19:46:20 -08001704 const VkSpecializationMapEntry* pMapEntries /// Array of map entries
Jesse Halld27f6aa2015-08-15 17:58:48 -07001705 platform.size_t dataSize /// Size in bytes of pData
1706 const void* pData /// Pointer to SpecConstant data
1707}
1708
1709class VkPipelineShaderStageCreateInfo {
1710 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
1711 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001712 VkPipelineShaderStageCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001713 VkShader shader
1714 const VkSpecializationInfo* pSpecializationInfo
1715}
1716
1717class VkComputePipelineCreateInfo {
1718 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
1719 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001720 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001721 VkPipelineShaderStageCreateInfo stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001722 VkPipelineLayout layout /// Interface layout of the pipeline
1723 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
1724 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
1725}
1726
1727class VkVertexInputBindingDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001728 u32 binding /// Vertex buffer binding id
1729 u32 stride /// Distance between vertices in bytes (0 = no advancement)
1730 VkVertexInputStepRate stepRate /// Rate at which binding is incremented
Jesse Halld27f6aa2015-08-15 17:58:48 -07001731}
1732
1733class VkVertexInputAttributeDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001734 u32 location /// location of the shader vertex attrib
1735 u32 binding /// Vertex buffer binding id
1736 VkFormat format /// format of source data
1737 u32 offset /// Offset of first element in bytes from base of vertex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001738}
1739
1740class VkPipelineVertexInputStateCreateInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001741 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
1742 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001743 VkPipelineVertexInputStateCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001744 u32 vertexBindingDescriptionCount /// number of bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001745 const VkVertexInputBindingDescription* pVertexBindingDescriptions
Jesse Hall03b6fe12015-11-24 12:44:21 -08001746 u32 vertexAttributeDescriptionCount /// number of attributes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001747 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
1748}
1749
1750class VkPipelineInputAssemblyStateCreateInfo {
1751 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
1752 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001753 VkPipelineInputAssemblyStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001754 VkPrimitiveTopology topology
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001755 VkBool32 primitiveRestartEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001756}
1757
1758class VkPipelineTessellationStateCreateInfo {
1759 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
1760 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001761 VkPipelineTessellationStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001762 u32 patchControlPoints
1763}
1764
1765class VkPipelineViewportStateCreateInfo {
1766 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
1767 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001768 VkPipelineViewportStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001769 u32 viewportCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001770 const VkViewport* pViewports
1771 u32 scissorCount
1772 const VkRect2D* pScissors
Jesse Halld27f6aa2015-08-15 17:58:48 -07001773}
1774
1775class VkPipelineRasterStateCreateInfo {
1776 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO
1777 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001778 VkPipelineRasterStateCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001779 VkBool32 depthClampEnable
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001780 VkBool32 rasterizerDiscardEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001781 VkFillMode fillMode /// optional (GL45)
Jesse Hallc7467b72015-11-29 21:05:26 -08001782 VkCullModeFlags cullMode
Jesse Halld27f6aa2015-08-15 17:58:48 -07001783 VkFrontFace frontFace
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001784 VkBool32 depthBiasEnable
Jesse Halla9bb62b2015-11-21 19:31:56 -08001785 f32 depthBiasConstantFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001786 f32 depthBiasClamp
Jesse Halla9bb62b2015-11-21 19:31:56 -08001787 f32 depthBiasSlopeFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001788 f32 lineWidth
Jesse Halld27f6aa2015-08-15 17:58:48 -07001789}
1790
1791class VkPipelineMultisampleStateCreateInfo {
1792 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
1793 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001794 VkPipelineMultisampleStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001795 u32 rasterSamples /// Number of samples used for rasterization
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001796 VkBool32 sampleShadingEnable /// optional (GL45)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001797 f32 minSampleShading /// optional (GL45)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001798 const VkSampleMask* pSampleMask
Jesse Hallacfa5342015-11-19 21:51:33 -08001799 VkBool32 alphaToCoverageEnable
1800 VkBool32 alphaToOneEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001801}
1802
1803class VkPipelineColorBlendAttachmentState {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001804 VkBool32 blendEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001805 VkBlend srcBlendColor
1806 VkBlend destBlendColor
1807 VkBlendOp blendOpColor
1808 VkBlend srcBlendAlpha
1809 VkBlend destBlendAlpha
1810 VkBlendOp blendOpAlpha
1811 VkChannelFlags channelWriteMask
1812}
1813
1814class VkPipelineColorBlendStateCreateInfo {
1815 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
1816 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001817 VkPipelineColorBlendStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001818 VkBool32 logicOpEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001819 VkLogicOp logicOp
1820 u32 attachmentCount /// # of pAttachments
1821 const VkPipelineColorBlendAttachmentState* pAttachments
Jesse Hallb00daad2015-11-29 19:46:20 -08001822 f32[4] blendConstants
Jesse Halld27f6aa2015-08-15 17:58:48 -07001823}
1824
1825class VkStencilOpState {
1826 VkStencilOp stencilFailOp
1827 VkStencilOp stencilPassOp
1828 VkStencilOp stencilDepthFailOp
1829 VkCompareOp stencilCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001830 u32 stencilCompareMask
1831 u32 stencilWriteMask
1832 u32 stencilReference
Jesse Halld27f6aa2015-08-15 17:58:48 -07001833}
1834
1835class VkPipelineDepthStencilStateCreateInfo {
1836 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
1837 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001838 VkPipelineDepthStencilStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001839 VkBool32 depthTestEnable
1840 VkBool32 depthWriteEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001841 VkCompareOp depthCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001842 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test)
1843 VkBool32 stencilTestEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001844 VkStencilOpState front
1845 VkStencilOpState back
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001846 f32 minDepthBounds
1847 f32 maxDepthBounds
1848}
1849
1850class VkPipelineDynamicStateCreateInfo {
1851 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
1852 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001853 VkPipelineDynamicStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001854 u32 dynamicStateCount
1855 const VkDynamicState* pDynamicStates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001856}
1857
1858class VkGraphicsPipelineCreateInfo {
Jesse Halla6429252015-11-29 18:59:42 -08001859 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
1860 const void* pNext /// Pointer to next structure
1861 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001862 u32 stageCount
Jesse Halla6429252015-11-29 18:59:42 -08001863 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001864 const VkPipelineVertexInputStateCreateInfo* pVertexInputState
1865 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
1866 const VkPipelineTessellationStateCreateInfo* pTessellationState
1867 const VkPipelineViewportStateCreateInfo* pViewportState
1868 const VkPipelineRasterStateCreateInfo* pRasterState
1869 const VkPipelineMultisampleStateCreateInfo* pMultisampleState
1870 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState
1871 const VkPipelineColorBlendStateCreateInfo* pColorBlendState
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001872 const VkPipelineDynamicStateCreateInfo* pDynamicState
Jesse Halla6429252015-11-29 18:59:42 -08001873 VkPipelineLayout layout /// Interface layout of the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001874 VkRenderPass renderPass
1875 u32 subpass
Jesse Halla6429252015-11-29 18:59:42 -08001876 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
1877 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
Jesse Halld27f6aa2015-08-15 17:58:48 -07001878}
1879
1880class VkPipelineCacheCreateInfo {
Jesse Hallb00daad2015-11-29 19:46:20 -08001881 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
1882 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001883 VkPipelineCacheCreateFlags flags
Jesse Hallb00daad2015-11-29 19:46:20 -08001884 platform.size_t initialDataSize /// Size of initial data to populate cache, in bytes
1885 const void* pInitialData /// Initial data to populate cache
1886 platform.size_t maxSize /// Maximum size cache can grow to, in bytes. If zero, then the cache may grow without bound.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001887}
1888
1889class VkPushConstantRange {
1890 VkShaderStageFlags stageFlags /// Which stages use the range
Jesse Hall03b6fe12015-11-24 12:44:21 -08001891 u32 offset /// Start of the range, in bytes
1892 u32 size /// Length of the range, in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001893}
1894
1895class VkPipelineLayoutCreateInfo {
1896 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
1897 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001898 VkPipelineLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001899 u32 setLayoutCount /// Number of descriptor sets interfaced by the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001900 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the
1901 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline
1902 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages
1903}
1904
1905class VkSamplerCreateInfo {
1906 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
1907 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001908 VkSamplerCreateFlags flags
Jesse Hall23ff73f2015-11-29 14:36:39 -08001909 VkFilter magFilter /// Filter mode for magnification
1910 VkFilter minFilter /// Filter mode for minifiation
1911 VkSamplerMipmapMode mipmapMode /// Mipmap selection mode
1912 VkSamplerAddressMode addressModeU
1913 VkSamplerAddressMode addressModeV
1914 VkSamplerAddressMode addressModeW
Jesse Halld27f6aa2015-08-15 17:58:48 -07001915 f32 mipLodBias
1916 f32 maxAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001917 VkBool32 compareEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001918 VkCompareOp compareOp
1919 f32 minLod
1920 f32 maxLod
1921 VkBorderColor borderColor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001922 VkBool32 unnormalizedCoordinates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001923}
1924
1925class VkCmdPoolCreateInfo {
1926 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO
1927 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001928 VkCmdPoolCreateFlags flags /// Command pool creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001929 u32 queueFamilyIndex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001930}
1931
Jesse Hallfbf97b02015-11-20 14:17:03 -08001932class VkCmdBufferAllocInfo {
1933 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001934 const void* pNext /// Pointer to next structure
1935 VkCmdPool cmdPool
1936 VkCmdBufferLevel level
Jesse Hall03b6fe12015-11-24 12:44:21 -08001937 u32 bufferCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001938}
1939
1940class VkCmdBufferBeginInfo {
1941 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO
1942 const void* pNext /// Pointer to next structure
Jesse Halla15a4bf2015-11-19 22:48:02 -08001943 VkCmdBufferUsageFlags flags /// Command buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001944 VkRenderPass renderPass /// Render pass for secondary command buffers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001945 u32 subpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07001946 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers
1947}
1948
1949class VkRenderPassBeginInfo {
1950 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
1951 const void* pNext /// Pointer to next structure
1952 VkRenderPass renderPass
1953 VkFramebuffer framebuffer
1954 VkRect2D renderArea
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001955 u32 clearValueCount
1956 const VkClearValue* pClearValues
Jesse Halld27f6aa2015-08-15 17:58:48 -07001957}
1958
1959@union
1960/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared.
1961class VkClearColorValue {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001962 f32[4] float32
1963 s32[4] int32
1964 u32[4] uint32
Jesse Halld27f6aa2015-08-15 17:58:48 -07001965}
1966
1967class VkClearDepthStencilValue {
1968 f32 depth
1969 u32 stencil
1970}
1971
1972@union
1973/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared.
1974class VkClearValue {
1975 VkClearColorValue color
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001976 VkClearDepthStencilValue depthStencil
Jesse Halld27f6aa2015-08-15 17:58:48 -07001977}
1978
Jesse Hallae38f732015-11-19 21:32:50 -08001979class VkClearAttachment {
1980 VkImageAspectFlags aspectMask
1981 u32 colorAttachment
1982 VkClearValue clearValue
1983}
1984
Jesse Halld27f6aa2015-08-15 17:58:48 -07001985class VkAttachmentDescription {
Jesse Halla6429252015-11-29 18:59:42 -08001986 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001987 VkFormat format
1988 u32 samples
1989 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1990 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1991 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1992 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1993 VkImageLayout initialLayout
1994 VkImageLayout finalLayout
1995}
1996
1997class VkAttachmentReference {
1998 u32 attachment
1999 VkImageLayout layout
2000}
2001
2002class VkSubpassDescription {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002003 VkSubpassDescriptionFlags flags
Jesse Halla6429252015-11-29 18:59:42 -08002004 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
Jesse Hall03b6fe12015-11-24 12:44:21 -08002005 u32 inputAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002006 const VkAttachmentReference* pInputAttachments
Jesse Hall03b6fe12015-11-24 12:44:21 -08002007 u32 colorAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002008 const VkAttachmentReference* pColorAttachments
2009 const VkAttachmentReference* pResolveAttachments
Jesse Hallc7467b72015-11-29 21:05:26 -08002010 const VkAttachmentReference* pDepthStencilAttachment
Jesse Hall03b6fe12015-11-24 12:44:21 -08002011 u32 preserveAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002012 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002013}
2014
2015class VkSubpassDependency {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002016 u32 srcSubpass
2017 u32 destSubpass
2018 VkPipelineStageFlags srcStageMask
2019 VkPipelineStageFlags destStageMask
2020 VkMemoryOutputFlags outputMask
2021 VkMemoryInputFlags inputMask
Jesse Halldc6d36c2015-11-29 19:12:15 -08002022 VkDependencyFlags dependencyFlags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002023}
2024
2025class VkRenderPassCreateInfo {
2026 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
2027 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002028 VkRenderPassCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002029 u32 attachmentCount
2030 const VkAttachmentDescription* pAttachments
2031 u32 subpassCount
2032 const VkSubpassDescription* pSubpasses
2033 u32 dependencyCount
2034 const VkSubpassDependency* pDependencies
2035}
2036
2037class VkEventCreateInfo {
2038 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
2039 const void* pNext /// Pointer to next structure
2040 VkEventCreateFlags flags /// Event creation flags
2041}
2042
2043class VkFenceCreateInfo {
2044 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
2045 const void* pNext /// Pointer to next structure
2046 VkFenceCreateFlags flags /// Fence creation flags
2047}
2048
2049class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002050 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
2051 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
2052 VkBool32 imageCubeArray /// image views which are arrays of cube maps
2053 VkBool32 independentBlend /// blending operations are controlled per-attachment
2054 VkBool32 geometryShader /// geometry stage
2055 VkBool32 tessellationShader /// tessellation control and evaluation stage
2056 VkBool32 sampleRateShading /// per-sample shading and interpolation
2057 VkBool32 dualSourceBlend /// blend operations which take two sources
2058 VkBool32 logicOp /// logic operations
2059 VkBool32 multiDrawIndirect /// multi draw indirect
Jesse Hallae38f732015-11-19 21:32:50 -08002060 VkBool32 depthClamp /// depth clamping
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002061 VkBool32 depthBiasClamp /// depth bias clamping
2062 VkBool32 fillModeNonSolid /// point and wireframe fill modes
2063 VkBool32 depthBounds /// depth bounds test
2064 VkBool32 wideLines /// lines with width greater than 1
2065 VkBool32 largePoints /// points with size greater than 1
Jesse Hallfbf97b02015-11-20 14:17:03 -08002066 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
2067 VkBool32 multiViewport
2068 VkBool32 samplerAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002069 VkBool32 textureCompressionETC2 /// ETC texture compression formats
2070 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
2071 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
2072 VkBool32 occlusionQueryNonConservative /// non-conservative (exact) occlusion queries
2073 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
Jesse Halldc6d36c2015-11-29 19:12:15 -08002074 VkBool32 vertexPipelineStoresAndAtomics
2075 VkBool32 fragmentStoresAndAtomics
2076 VkBool32 shaderTessellationAndGeometryPointSize
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002077 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
2078 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
2079 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
2080 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
2081 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
2082 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
2083 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
2084 VkBool32 shaderClipDistance /// clip distance in shaders
2085 VkBool32 shaderCullDistance /// cull distance in shaders
2086 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
2087 VkBool32 shaderInt64 /// 64-bit integers in shaders
2088 VkBool32 shaderInt16 /// 16-bit integers in shaders
2089 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
2090 VkBool32 shaderResourceMinLOD /// shader can use texture operations that specify minimum resource LOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002091 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
2092 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
2093 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
2094 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
2095 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
2096 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
2097 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
2098 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
2099 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002100}
2101
2102class VkPhysicalDeviceLimits {
2103 /// resource maximum sizes
2104 u32 maxImageDimension1D /// max 1D image dimension
2105 u32 maxImageDimension2D /// max 2D image dimension
2106 u32 maxImageDimension3D /// max 3D image dimension
2107 u32 maxImageDimensionCube /// max cubemap image dimension
2108 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002109 VkSampleCountFlags sampleCounts /// sample counts supported for all images supporting rendering and sampling
Jesse Hallb00daad2015-11-29 19:46:20 -08002110 u32 maxTexelBufferElements
Jesse Hallfbf97b02015-11-20 14:17:03 -08002111 u32 maxUniformBufferRange /// max uniform buffer size (bytes)
2112 u32 maxStorageBufferRange /// max storage buffer size (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002113 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
2114 /// memory limits
2115 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002116 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
2117 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002118 /// descriptor set limits
2119 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07002120 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
2121 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
2122 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
2123 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
2124 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
2125 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
2126 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002127 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002128 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002129 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002130 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
2131 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
2132 /// vertex stage limits
2133 u32 maxVertexInputAttributes /// max num of vertex input attribute slots
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002134 u32 maxVertexInputBindings /// max num of vertex input binding slots
Jesse Halld27f6aa2015-08-15 17:58:48 -07002135 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset
2136 u32 maxVertexInputBindingStride /// max vertex input binding stride
2137 u32 maxVertexOutputComponents /// max num of output components written by vertex shader
2138 /// tessellation control stage limits
Jesse Hallae38f732015-11-19 21:32:50 -08002139 u32 maxTessellationGenLevel /// max level supported by tess primitive generator
2140 u32 maxTessellationPatchSize /// max patch size (vertices)
2141 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS
2142 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS
2143 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS
2144 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS
2145 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES
2146 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES
Jesse Halld27f6aa2015-08-15 17:58:48 -07002147 /// geometry stage limits
2148 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader
2149 u32 maxGeometryInputComponents /// max num of input components read in geometry stage
2150 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage
2151 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage
2152 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage
2153 /// fragment stage limits
2154 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage
Jesse Hallfbf97b02015-11-20 14:17:03 -08002155 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage
2156 u32 maxFragmentDualSourceAttachments /// max num of output attachments written when using dual source blending
Jesse Halld27f6aa2015-08-15 17:58:48 -07002157 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers
2158 /// compute stage limits
2159 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes)
2160 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z)
2161 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group
2162 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z)
2163
2164 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y
2165 u32 subTexelPrecisionBits /// num bits of subtexel precision
2166 u32 mipmapPrecisionBits /// num bits of mipmap precision
2167
2168 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices)
2169 u32 maxDrawIndirectInstanceCount /// max instance count for indirect draw calls
Jesse Halld27f6aa2015-08-15 17:58:48 -07002170
2171 f32 maxSamplerLodBias /// max absolute sampler level of detail bias
2172 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy
2173
2174 u32 maxViewports /// max number of active viewports
Jesse Halld27f6aa2015-08-15 17:58:48 -07002175 u32[2] maxViewportDimensions /// max viewport dimensions (x,y)
2176 f32[2] viewportBoundsRange /// viewport bounds range (min,max)
2177 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport
2178
Jesse Halldc6d36c2015-11-29 19:12:15 -08002179 platform.size_t minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes)
2180 VkDeviceSize minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes)
2181 VkDeviceSize minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes)
2182 VkDeviceSize minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002183
Jesse Hallfbf97b02015-11-20 14:17:03 -08002184 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002185 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset
Jesse Hallfbf97b02015-11-20 14:17:03 -08002186 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002187 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset
2188 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset
2189 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset
2190 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset
2191
2192 u32 maxFramebufferWidth /// max width for a framebuffer
2193 u32 maxFramebufferHeight /// max height for a framebuffer
2194 u32 maxFramebufferLayers /// max layer count for a layered framebuffer
2195 u32 maxFramebufferColorSamples /// max color sample count for a framebuffer
2196 u32 maxFramebufferDepthSamples /// max depth sample count for a framebuffer
2197 u32 maxFramebufferStencilSamples /// max stencil sample count for a framebuffer
2198 u32 maxColorAttachments /// max num of framebuffer color attachments
2199
2200 u32 maxSampledImageColorSamples /// max num of color samples for a non-integer sampled image
Jesse Hallc7467b72015-11-29 21:05:26 -08002201 u32 maxSampledImageDepthSamples /// max num of depth samples for a sampled image
2202 u32 maxSampledImageStencilSamples /// max num of stencil samples for a sampled image
Jesse Halld27f6aa2015-08-15 17:58:48 -07002203 u32 maxSampledImageIntegerSamples /// max num of samples supported for an integer image
2204 u32 maxStorageImageSamples /// max num of samples for a storage image
2205 u32 maxSampleMaskWords /// max num of sample mask words
2206
Jesse Halla9bb62b2015-11-21 19:31:56 -08002207 f32 timestampPeriod
Jesse Halld27f6aa2015-08-15 17:58:48 -07002208
2209 u32 maxClipDistances /// max number of clip distances
2210 u32 maxCullDistances /// max number of cull distances
2211 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
2212
Jesse Hallfbf97b02015-11-20 14:17:03 -08002213 u32 discreteQueuePriorities
2214
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002215 f32[2] pointSizeRange /// range (min,max) of supported point sizes
2216 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07002217 f32 pointSizeGranularity /// granularity of supported point sizes
2218 f32 lineWidthGranularity /// granularity of supported line widths
Jesse Hall03b6fe12015-11-24 12:44:21 -08002219 VkBool32 strictLines
Jesse Halla9bb62b2015-11-21 19:31:56 -08002220
Jesse Halldc6d36c2015-11-29 19:12:15 -08002221 VkDeviceSize recommendedBufferCopyOffsetAlignment
2222 VkDeviceSize recommendedBufferCopyRowPitchAlignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07002223}
2224
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002225class VkPhysicalDeviceSparseProperties {
2226 VkBool32 residencyStandard2DBlockShape /// Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard block shapes (based on pixel format)
Jesse Hallb00daad2015-11-29 19:46:20 -08002227 VkBool32 residencyStandard2DMultisampleBlockShape /// Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard block shapes (based on pixel format)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002228 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
2229 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
2230 VkBool32 residencyNonResident /// Sparse resources support: GPU can safely access non-resident regions of a resource, read values from read-write resources are undefined
2231 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
2232}
2233
Jesse Halld27f6aa2015-08-15 17:58:48 -07002234class VkSemaphoreCreateInfo {
2235 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
2236 const void* pNext /// Pointer to next structure
2237 VkSemaphoreCreateFlags flags /// Semaphore creation flags
2238}
2239
2240class VkQueryPoolCreateInfo {
2241 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
2242 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002243 VkQueryPoolCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002244 VkQueryType queryType
2245 u32 slots
2246 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
2247}
2248
2249class VkFramebufferCreateInfo {
2250 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
2251 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002252 VkFramebufferCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002253 VkRenderPass renderPass
2254 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002255 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002256 u32 width
2257 u32 height
2258 u32 layers
2259}
2260
2261class VkDrawIndirectCmd {
2262 u32 vertexCount
2263 u32 instanceCount
2264 u32 firstVertex
2265 u32 firstInstance
2266}
2267
2268class VkDrawIndexedIndirectCmd {
2269 u32 indexCount
2270 u32 instanceCount
2271 u32 firstIndex
2272 s32 vertexOffset
2273 u32 firstInstance
2274}
2275
2276class VkDispatchIndirectCmd {
2277 u32 x
2278 u32 y
2279 u32 z
2280}
2281
Jesse Hallb00daad2015-11-29 19:46:20 -08002282@extension("VK_EXT_KHR_surface")
2283class VkSurfaceCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002284 u32 minImageCount
2285 u32 maxImageCount
2286 VkExtent2D currentExtent
2287 VkExtent2D minImageExtent
2288 VkExtent2D maxImageExtent
2289 VkSurfaceTransformFlagsKHR supportedTransforms
2290 VkSurfaceTransformKHR currentTransform
Jesse Halla6429252015-11-29 18:59:42 -08002291 VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002292 u32 maxImageArraySize
2293 VkImageUsageFlags supportedUsageFlags
Michael Lentine88594d72015-11-12 12:49:45 -08002294}
2295
Jesse Hallb00daad2015-11-29 19:46:20 -08002296@extension("VK_EXT_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -08002297class VkSurfaceFormatKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002298 VkFormat format
2299 VkColorSpaceKHR colorSpace
Michael Lentine88594d72015-11-12 12:49:45 -08002300}
2301
Jesse Hall1356b0d2015-11-23 17:24:58 -08002302@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002303class VkSwapchainCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002304 VkStructureType sType
2305 const void* pNext
2306 VkSurfaceKHR surface
2307 u32 minImageCount
2308 VkFormat imageFormat
2309 VkColorSpaceKHR imageColorSpace
2310 VkExtent2D imageExtent
2311 VkImageUsageFlags imageUsageFlags
2312 VkSurfaceTransformKHR preTransform
Jesse Halla6429252015-11-29 18:59:42 -08002313 VkCompositeAlphaFlagBitsKHR compositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002314 u32 imageArraySize
2315 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08002316 u32 queueFamilyIndexCount
Jesse Hall1356b0d2015-11-23 17:24:58 -08002317 const u32* pQueueFamilyIndices
2318 VkPresentModeKHR presentMode
2319 VkSwapchainKHR oldSwapchain
2320 VkBool32 clipped
Michael Lentine88594d72015-11-12 12:49:45 -08002321}
2322
Jesse Hall1356b0d2015-11-23 17:24:58 -08002323@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002324class VkPresentInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002325 VkStructureType sType
2326 const void* pNext
Jesse Hallb00daad2015-11-29 19:46:20 -08002327 u32 waitSemaphoreCount
2328 const VkSemaphore* pWaitSemaphores
Jesse Hall1356b0d2015-11-23 17:24:58 -08002329 u32 swapchainCount
Jesse Hall03b6fe12015-11-24 12:44:21 -08002330 const VkSwapchainKHR* pSwapchains
Jesse Hall1356b0d2015-11-23 17:24:58 -08002331 const u32* imageIndices
Michael Lentine88594d72015-11-12 12:49:45 -08002332}
2333
Jesse Hall1356b0d2015-11-23 17:24:58 -08002334@extension("VK_EXT_KHR_display")
2335class VkDisplayPropertiesKHR {
2336 VkDisplayKHR display
2337 const char* displayName
2338 VkExtent2D physicalDimensions
2339 VkExtent2D physicalResolution
2340 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hall1356b0d2015-11-23 17:24:58 -08002341 VkBool32 planeReorderPossible
Jesse Halla6429252015-11-29 18:59:42 -08002342 VkBool32 persistentContent
Michael Lentine88594d72015-11-12 12:49:45 -08002343}
2344
Jesse Hall1356b0d2015-11-23 17:24:58 -08002345@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002346class VkDisplayModeParametersKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002347 VkExtent2D visibleRegion
Jesse Halla6429252015-11-29 18:59:42 -08002348 u32 refreshRate
Michael Lentine88594d72015-11-12 12:49:45 -08002349}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002350
Jesse Hall1356b0d2015-11-23 17:24:58 -08002351@extension("VK_EXT_KHR_display")
2352class VkDisplayModePropertiesKHR {
2353 VkDisplayModeKHR displayMode
Jesse Halla6429252015-11-29 18:59:42 -08002354 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002355}
2356
2357@extension("VK_EXT_KHR_display")
2358class VkDisplayModeCreateInfoKHR {
2359 VkStructureType sType
2360 const void* pNext
Jesse Halla6429252015-11-29 18:59:42 -08002361 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002362}
2363
2364@extension("VK_EXT_KHR_display")
2365class VkDisplayPlanePropertiesKHR {
Jesse Halla6429252015-11-29 18:59:42 -08002366 VkDisplayKHR currentDisplay
2367 u32 currentStackIndex
2368}
2369
2370@extension("VK_EXT_KHR_display")
2371class VkDisplayPlaneCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002372 VkDisplayPlaneAlphaFlagsKHR supportedAlpha
2373 VkOffset2D minSrcPosition
2374 VkOffset2D maxSrcPosition
2375 VkExtent2D minSrcExtent
2376 VkExtent2D maxSrcExtent
2377 VkOffset2D minDstPosition
2378 VkOffset2D maxDstPosition
2379 VkExtent2D minDstExtent
2380 VkExtent2D maxDstExtent
2381}
2382
2383@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002384class VkDisplaySurfaceCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002385 VkStructureType sType
2386 const void* pNext
2387 VkDisplayModeKHR displayMode
2388 u32 planeIndex
2389 u32 planeStackIndex
2390 VkSurfaceTransformKHR transform
2391 f32 globalAlpha
2392 VkDisplayPlaneAlphaFlagsKHR alphaMode
2393 VkExtent2D imageSize
2394}
2395
2396@extension("VK_EXT_KHR_display_swapchain")
2397class VkDisplaySwapchainCreateInfoKHR {
2398 VkStructureType sType
2399 const void* pNext
2400 const VkSwapchainCreateInfoKHR* pNextSwapchainCreateInfo
2401}
2402
2403@extension("VK_EXT_KHR_display_swapchain")
2404class VkDisplayPresentInfoKHR {
2405 VkStructureType sType
2406 const void* pNext
2407 VkRect2D srcRect
2408 VkRect2D dstRect
Jesse Halla6429252015-11-29 18:59:42 -08002409 VkBool32 persistent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002410}
2411
2412
Jesse Halld27f6aa2015-08-15 17:58:48 -07002413////////////////
2414// Commands //
2415////////////////
2416
2417// Function pointers. TODO: add support for function pointers.
2418
2419@external type void* PFN_vkVoidFunction
2420@pfn cmd void vkVoidFunction() {
2421}
2422
2423@external type void* PFN_vkAllocFunction
2424@pfn cmd void* vkAllocFunction(
2425 void* pUserData,
2426 platform.size_t size,
2427 platform.size_t alignment,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002428 VkSystemAllocScope allocScope) {
2429 return ?
2430}
2431
2432@external type void* PFN_vkReallocFunction
2433@pfn cmd void* vkReallocFunction(
2434 void* pUserData,
2435 void* pOriginal,
2436 platform.size_t size,
2437 platform.size_t alignment,
2438 VkSystemAllocScope allocScope) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002439 return ?
2440}
2441
2442@external type void* PFN_vkFreeFunction
2443@pfn cmd void vkFreeFunction(
2444 void* pUserData,
2445 void* pMem) {
2446}
2447
Jesse Hall03b6fe12015-11-24 12:44:21 -08002448@external type void* PFN_vkInternalAllocNotification
2449@pfn cmd void vkInternalAllocNotification(
2450 void* pUserData,
2451 platform.size_t size,
2452 VkInternalAllocType allocType,
2453 VkSystemAllocScope allocScope) {
2454}
2455
2456@external type void* PFN_vkInternalFreeNotification
2457@pfn cmd void vkInternalFreeNotification(
2458 void* pUserData,
2459 platform.size_t size,
2460 VkInternalAllocType allocType,
2461 VkSystemAllocScope allocScope) {
2462}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002463
2464// Global functions
2465
2466@threadSafety("system")
2467cmd VkResult vkCreateInstance(
2468 const VkInstanceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002469 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002470 VkInstance* pInstance) {
2471 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
2472
2473 instance := ?
2474 pInstance[0] = instance
2475 State.Instances[instance] = new!InstanceObject()
2476
Jesse Hall03b6fe12015-11-24 12:44:21 -08002477 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount]
2478 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount]
Jesse Halld27f6aa2015-08-15 17:58:48 -07002479
2480 return ?
2481}
2482
2483@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002484cmd void vkDestroyInstance(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002485 VkInstance instance,
2486 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002487 instanceObject := GetInstance(instance)
2488
2489 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002490}
2491
2492@threadSafety("system")
2493cmd VkResult vkEnumeratePhysicalDevices(
2494 VkInstance instance,
2495 u32* pPhysicalDeviceCount,
2496 VkPhysicalDevice* pPhysicalDevices) {
2497 instanceObject := GetInstance(instance)
2498
2499 physicalDeviceCount := as!u32(?)
2500 pPhysicalDeviceCount[0] = physicalDeviceCount
2501 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2502
2503 for i in (0 .. physicalDeviceCount) {
2504 physicalDevice := ?
2505 physicalDevices[i] = physicalDevice
2506 if !(physicalDevice in State.PhysicalDevices) {
2507 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2508 }
2509 }
2510
2511 return ?
2512}
2513
2514cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2515 VkDevice device,
2516 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002517 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002518 device := GetDevice(device)
2519 }
2520
2521 return ?
2522}
2523
2524cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2525 VkInstance instance,
2526 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002527 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002528 instanceObject := GetInstance(instance)
2529 }
2530
2531 return ?
2532}
2533
Jesse Hall606a54e2015-11-19 22:17:28 -08002534cmd void vkGetPhysicalDeviceProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002535 VkPhysicalDevice physicalDevice,
2536 VkPhysicalDeviceProperties* pProperties) {
2537 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2538
2539 properties := ?
2540 pProperties[0] = properties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002541}
2542
Jesse Hall606a54e2015-11-19 22:17:28 -08002543cmd void vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002544 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002545 u32* pQueueFamilyPropertyCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002546 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002547 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002548 // TODO: Figure out how to express fetch-count-or-properties
2549 // This version fails 'apic validate' with 'fence not allowed in
2550 // *semantic.Branch'. Other attempts have failed with the same or other
2551 // errors.
2552 // if pQueueFamilyProperties != null {
2553 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2554 // for i in (0 .. pCount[0]) {
2555 // queueProperties := as!VkQueueFamilyProperties(?)
2556 // queuesProperties[i] = queueProperties
2557 // }
2558 // } else {
2559 // count := ?
2560 // pCount[0] = count
2561 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002562}
2563
Jesse Hall606a54e2015-11-19 22:17:28 -08002564cmd void vkGetPhysicalDeviceMemoryProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002565 VkPhysicalDevice physicalDevice,
2566 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2567 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2568
2569 memoryProperties := ?
2570 pMemoryProperties[0] = memoryProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002571}
2572
Jesse Hall606a54e2015-11-19 22:17:28 -08002573cmd void vkGetPhysicalDeviceFeatures(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002574 VkPhysicalDevice physicalDevice,
2575 VkPhysicalDeviceFeatures* pFeatures) {
2576 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2577
2578 features := ?
2579 pFeatures[0] = features
Jesse Halld27f6aa2015-08-15 17:58:48 -07002580}
2581
Jesse Hall606a54e2015-11-19 22:17:28 -08002582cmd void vkGetPhysicalDeviceFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002583 VkPhysicalDevice physicalDevice,
2584 VkFormat format,
2585 VkFormatProperties* pFormatProperties) {
2586 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2587
2588 formatProperties := ?
2589 pFormatProperties[0] = formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002590}
2591
Jesse Hall606a54e2015-11-19 22:17:28 -08002592cmd void vkGetPhysicalDeviceImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002593 VkPhysicalDevice physicalDevice,
2594 VkFormat format,
2595 VkImageType type,
2596 VkImageTiling tiling,
2597 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002598 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002599 VkImageFormatProperties* pImageFormatProperties) {
2600 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2601
2602 imageFormatProperties := ?
2603 pImageFormatProperties[0] = imageFormatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002604}
2605
Jesse Halld27f6aa2015-08-15 17:58:48 -07002606
2607// Device functions
2608
2609@threadSafety("system")
2610cmd VkResult vkCreateDevice(
2611 VkPhysicalDevice physicalDevice,
2612 const VkDeviceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002613 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002614 VkDevice* pDevice) {
2615 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2616 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2617
2618 device := ?
2619 pDevice[0] = device
2620 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2621
2622 return ?
2623}
2624
2625@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002626cmd void vkDestroyDevice(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002627 VkDevice device,
2628 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002629 deviceObject := GetDevice(device)
2630
2631 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002632}
2633
2634
2635// Extension discovery functions
2636
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002637cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002638 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002639 VkLayerProperties* pProperties) {
2640 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002641 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002642
2643 properties := pProperties[0:count]
2644 for i in (0 .. count) {
2645 property := ?
2646 properties[i] = property
2647 }
2648
2649 return ?
2650}
2651
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002652cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002653 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002654 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002655 VkExtensionProperties* pProperties) {
2656 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002657 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002658
2659 properties := pProperties[0:count]
2660 for i in (0 .. count) {
2661 property := ?
2662 properties[i] = property
2663 }
2664
2665 return ?
2666}
2667
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002668cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002669 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002670 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002671 VkLayerProperties* pProperties) {
2672 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2673 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002674 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002675
2676 properties := pProperties[0:count]
2677 for i in (0 .. count) {
2678 property := ?
2679 properties[i] = property
2680 }
2681
2682 return ?
2683}
2684
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002685cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002686 VkPhysicalDevice physicalDevice,
2687 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002688 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002689 VkExtensionProperties* pProperties) {
2690 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2691
2692 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002693 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002694
2695 properties := pProperties[0:count]
2696 for i in (0 .. count) {
2697 property := ?
2698 properties[i] = property
2699 }
2700
2701 return ?
2702}
2703
2704
2705// Queue functions
2706
2707@threadSafety("system")
Jesse Hall606a54e2015-11-19 22:17:28 -08002708cmd void vkGetDeviceQueue(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002709 VkDevice device,
2710 u32 queueFamilyIndex,
2711 u32 queueIndex,
2712 VkQueue* pQueue) {
2713 deviceObject := GetDevice(device)
2714
2715 queue := ?
2716 pQueue[0] = queue
2717
2718 if !(queue in State.Queues) {
2719 State.Queues[queue] = new!QueueObject(device: device)
2720 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002721}
2722
2723@threadSafety("app")
2724cmd VkResult vkQueueSubmit(
2725 VkQueue queue,
Jesse Halla366a512015-11-19 22:30:07 -08002726 u32 submitCount,
Jesse Hallb00daad2015-11-29 19:46:20 -08002727 const VkSubmitInfo* pSubmits,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002728 VkFence fence) {
2729 queueObject := GetQueue(queue)
2730
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002731 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002732 fenceObject := GetFence(fence)
2733 assert(fenceObject.device == queueObject.device)
2734 }
2735
Jesse Halla366a512015-11-19 22:30:07 -08002736 // cmdBuffers := pCmdBuffers[0:cmdBufferCount]
2737 // for i in (0 .. cmdBufferCount) {
2738 // cmdBuffer := cmdBuffers[i]
2739 // cmdBufferObject := GetCmdBuffer(cmdBuffer)
2740 // assert(cmdBufferObject.device == queueObject.device)
2741 //
2742 // validate("QueueCheck", cmdBufferObject.queueFlags in queueObject.flags,
2743 // "vkQueueSubmit: enqueued cmdBuffer requires missing queue capabilities.")
2744 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002745
2746 return ?
2747}
2748
2749@threadSafety("system")
2750cmd VkResult vkQueueWaitIdle(
2751 VkQueue queue) {
2752 queueObject := GetQueue(queue)
2753
2754 return ?
2755}
2756
2757@threadSafety("system")
2758cmd VkResult vkDeviceWaitIdle(
2759 VkDevice device) {
2760 deviceObject := GetDevice(device)
2761
2762 return ?
2763}
2764
2765
2766// Memory functions
2767
2768@threadSafety("system")
2769cmd VkResult vkAllocMemory(
2770 VkDevice device,
2771 const VkMemoryAllocInfo* pAllocInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002772 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002773 VkDeviceMemory* pMem) {
2774 assert(pAllocInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO)
2775 deviceObject := GetDevice(device)
2776
2777 mem := ?
2778 pMem[0] = mem
2779 State.DeviceMemories[mem] = new!DeviceMemoryObject(
2780 device: device,
2781 allocationSize: pAllocInfo[0].allocationSize)
2782
2783 return ?
2784}
2785
2786@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002787cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002788 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002789 VkDeviceMemory mem,
2790 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002791 deviceObject := GetDevice(device)
2792 memObject := GetDeviceMemory(mem)
2793 assert(memObject.device == device)
2794
2795 // Check that no objects are still bound before freeing.
2796 validate("MemoryCheck", len(memObject.boundObjects) == 0,
2797 "vkFreeMemory: objects still bound")
2798 validate("MemoryCheck", len(memObject.boundCommandBuffers) == 0,
2799 "vkFreeMemory: cmdBuffers still bound")
2800 State.DeviceMemories[mem] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002801}
2802
2803@threadSafety("app")
2804cmd VkResult vkMapMemory(
2805 VkDevice device,
2806 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002807 VkDeviceSize offset,
2808 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002809 VkMemoryMapFlags flags,
2810 void** ppData) {
2811 deviceObject := GetDevice(device)
2812 memObject := GetDeviceMemory(mem)
2813 assert(memObject.device == device)
2814
2815 assert(flags == as!VkMemoryMapFlags(0))
2816 assert((offset + size) <= memObject.allocationSize)
2817
2818 return ?
2819}
2820
2821@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002822cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002823 VkDevice device,
2824 VkDeviceMemory mem) {
2825 deviceObject := GetDevice(device)
2826 memObject := GetDeviceMemory(mem)
2827 assert(memObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002828}
2829
2830cmd VkResult vkFlushMappedMemoryRanges(
2831 VkDevice device,
2832 u32 memRangeCount
2833 const VkMappedMemoryRange* pMemRanges) {
2834 deviceObject := GetDevice(device)
2835
2836 memRanges := pMemRanges[0:memRangeCount]
2837 for i in (0 .. memRangeCount) {
2838 memRange := memRanges[i]
2839 memObject := GetDeviceMemory(memRange.mem)
2840 assert(memObject.device == device)
2841 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2842 }
2843
2844 return ?
2845}
2846
2847cmd VkResult vkInvalidateMappedMemoryRanges(
2848 VkDevice device,
2849 u32 memRangeCount,
2850 const VkMappedMemoryRange* pMemRanges) {
2851 deviceObject := GetDevice(device)
2852
2853 memRanges := pMemRanges[0:memRangeCount]
2854 for i in (0 .. memRangeCount) {
2855 memRange := memRanges[i]
2856 memObject := GetDeviceMemory(memRange.mem)
2857 assert(memObject.device == device)
2858 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2859 }
2860
2861 return ?
2862}
2863
2864
2865// Memory management API functions
2866
Jesse Hall606a54e2015-11-19 22:17:28 -08002867cmd void vkGetDeviceMemoryCommitment(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002868 VkDevice device,
2869 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002870 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002871 deviceObject := GetDevice(device)
2872
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002873 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002874 memoryObject := GetDeviceMemory(memory)
2875 assert(memoryObject.device == device)
2876 }
2877
2878 committedMemoryInBytes := ?
2879 pCommittedMemoryInBytes[0] = committedMemoryInBytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07002880}
2881
Jesse Hall606a54e2015-11-19 22:17:28 -08002882cmd void vkGetBufferMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002883 VkDevice device,
2884 VkBuffer buffer,
2885 VkMemoryRequirements* pMemoryRequirements) {
2886 deviceObject := GetDevice(device)
2887 bufferObject := GetBuffer(buffer)
2888 assert(bufferObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002889}
2890
2891cmd VkResult vkBindBufferMemory(
2892 VkDevice device,
2893 VkBuffer buffer,
2894 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002895 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002896 deviceObject := GetDevice(device)
2897 bufferObject := GetBuffer(buffer)
2898 assert(bufferObject.device == device)
2899
2900 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002901 if bufferObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002902 memObject := GetDeviceMemory(bufferObject.mem)
2903 memObject.boundObjects[as!u64(buffer)] = null
2904 }
2905
2906 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002907 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002908 memObject := GetDeviceMemory(mem)
2909 assert(memObject.device == device)
2910 memObject.boundObjects[as!u64(buffer)] = memOffset
2911 }
2912 bufferObject.mem = mem
2913 bufferObject.memOffset = memOffset
2914
2915 return ?
2916}
2917
Jesse Hall606a54e2015-11-19 22:17:28 -08002918cmd void vkGetImageMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002919 VkDevice device,
2920 VkImage image,
2921 VkMemoryRequirements* pMemoryRequirements) {
2922 deviceObject := GetDevice(device)
2923 imageObject := GetImage(image)
2924 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002925}
2926
2927cmd VkResult vkBindImageMemory(
2928 VkDevice device,
2929 VkImage image,
2930 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002931 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002932 deviceObject := GetDevice(device)
2933 imageObject := GetImage(image)
2934 assert(imageObject.device == device)
2935
2936 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002937 if imageObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002938 memObject := GetDeviceMemory(imageObject.mem)
2939 memObject.boundObjects[as!u64(image)] = null
2940 }
2941
2942 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002943 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002944 memObject := GetDeviceMemory(mem)
2945 assert(memObject.device == device)
2946 memObject.boundObjects[as!u64(image)] = memOffset
2947 }
2948 imageObject.mem = mem
2949 imageObject.memOffset = memOffset
2950
2951 return ?
2952}
2953
Jesse Hall606a54e2015-11-19 22:17:28 -08002954cmd void vkGetImageSparseMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002955 VkDevice device,
2956 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002957 u32* pSparseMemoryRequirementCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002958 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2959 deviceObject := GetDevice(device)
2960 imageObject := GetImage(image)
2961 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002962}
2963
Jesse Hall606a54e2015-11-19 22:17:28 -08002964cmd void vkGetPhysicalDeviceSparseImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002965 VkPhysicalDevice physicalDevice,
2966 VkFormat format,
2967 VkImageType type,
2968 u32 samples,
2969 VkImageUsageFlags usage,
2970 VkImageTiling tiling,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002971 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002972 VkSparseImageFormatProperties* pProperties) {
2973 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002974}
2975
Jesse Halla6429252015-11-29 18:59:42 -08002976cmd VkResult vkQueueBindSparse(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002977 VkQueue queue,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002978 u32 bindInfoCount,
Jesse Halla6429252015-11-29 18:59:42 -08002979 const VkBindSparseInfo* pBindInfo,
2980 VkFence fence) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002981 queueObject := GetQueue(queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002982
2983 return ?
2984}
2985
2986
2987// Fence functions
2988
2989@threadSafety("system")
2990cmd VkResult vkCreateFence(
2991 VkDevice device,
2992 const VkFenceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002993 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002994 VkFence* pFence) {
2995 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
2996 deviceObject := GetDevice(device)
2997
2998 fence := ?
2999 pFence[0] = fence
3000 State.Fences[fence] = new!FenceObject(
Jesse Halld8bade02015-11-24 10:24:18 -08003001 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT)))
Jesse Halld27f6aa2015-08-15 17:58:48 -07003002
3003 return ?
3004}
3005
3006@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003007cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003008 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003009 VkFence fence,
3010 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003011 deviceObject := GetDevice(device)
3012 fenceObject := GetFence(fence)
3013 assert(fenceObject.device == device)
3014
3015 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003016}
3017
3018@threadSafety("system")
3019cmd VkResult vkResetFences(
3020 VkDevice device,
3021 u32 fenceCount,
3022 const VkFence* pFences) {
3023 deviceObject := GetDevice(device)
3024
3025 fences := pFences[0:fenceCount]
3026 for i in (0 .. fenceCount) {
3027 fence := fences[i]
3028 fenceObject := GetFence(fence)
3029 assert(fenceObject.device == device)
3030 fenceObject.signaled = false
3031 }
3032
3033 return ?
3034}
3035
3036@threadSafety("system")
3037cmd VkResult vkGetFenceStatus(
3038 VkDevice device,
3039 VkFence fence) {
3040 deviceObject := GetDevice(device)
3041 fenceObject := GetFence(fence)
3042 assert(fenceObject.device == device)
3043
3044 return ?
3045}
3046
3047@threadSafety("system")
3048cmd VkResult vkWaitForFences(
3049 VkDevice device,
3050 u32 fenceCount,
3051 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003052 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003053 u64 timeout) { /// timeout in nanoseconds
3054 deviceObject := GetDevice(device)
3055
3056 fences := pFences[0:fenceCount]
3057 for i in (0 .. fenceCount) {
3058 fence := fences[i]
3059 fenceObject := GetFence(fence)
3060 assert(fenceObject.device == device)
3061 }
3062
3063 return ?
3064}
3065
3066
3067// Queue semaphore functions
3068
3069@threadSafety("system")
3070cmd VkResult vkCreateSemaphore(
3071 VkDevice device,
3072 const VkSemaphoreCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003073 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003074 VkSemaphore* pSemaphore) {
3075 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
3076 deviceObject := GetDevice(device)
3077
3078 semaphore := ?
3079 pSemaphore[0] = semaphore
3080 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
3081
3082 return ?
3083}
3084
3085@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003086cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003087 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003088 VkSemaphore semaphore,
3089 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003090 deviceObject := GetDevice(device)
3091 semaphoreObject := GetSemaphore(semaphore)
3092 assert(semaphoreObject.device == device)
3093
3094 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003095}
3096
Jesse Halld27f6aa2015-08-15 17:58:48 -07003097
3098// Event functions
3099
3100@threadSafety("system")
3101cmd VkResult vkCreateEvent(
3102 VkDevice device,
3103 const VkEventCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003104 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003105 VkEvent* pEvent) {
3106 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
3107 deviceObject := GetDevice(device)
3108
3109 event := ?
3110 pEvent[0] = event
3111 State.Events[event] = new!EventObject(device: device)
3112
3113 return ?
3114}
3115
3116@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003117cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003118 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003119 VkEvent event,
3120 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003121 deviceObject := GetDevice(device)
3122 eventObject := GetEvent(event)
3123 assert(eventObject.device == device)
3124
3125 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003126}
3127
3128@threadSafety("system")
3129cmd VkResult vkGetEventStatus(
3130 VkDevice device,
3131 VkEvent event) {
3132 deviceObject := GetDevice(device)
3133 eventObject := GetEvent(event)
3134 assert(eventObject.device == device)
3135
3136 return ?
3137}
3138
3139@threadSafety("system")
3140cmd VkResult vkSetEvent(
3141 VkDevice device,
3142 VkEvent event) {
3143 deviceObject := GetDevice(device)
3144 eventObject := GetEvent(event)
3145 assert(eventObject.device == device)
3146
3147 return ?
3148}
3149
3150@threadSafety("system")
3151cmd VkResult vkResetEvent(
3152 VkDevice device,
3153 VkEvent event) {
3154 deviceObject := GetDevice(device)
3155 eventObject := GetEvent(event)
3156 assert(eventObject.device == device)
3157
3158 return ?
3159}
3160
3161
3162// Query functions
3163
3164@threadSafety("system")
3165cmd VkResult vkCreateQueryPool(
3166 VkDevice device,
3167 const VkQueryPoolCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003168 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003169 VkQueryPool* pQueryPool) {
3170 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
3171 deviceObject := GetDevice(device)
3172
3173 queryPool := ?
3174 pQueryPool[0] = queryPool
3175 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
3176
3177 return ?
3178}
3179
3180@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003181cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003182 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003183 VkQueryPool queryPool,
3184 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003185 deviceObject := GetDevice(device)
3186 queryPoolObject := GetQueryPool(queryPool)
3187 assert(queryPoolObject.device == device)
3188
3189 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003190}
3191
3192@threadSafety("system")
3193cmd VkResult vkGetQueryPoolResults(
3194 VkDevice device,
3195 VkQueryPool queryPool,
3196 u32 startQuery,
3197 u32 queryCount,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003198 platform.size_t dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003199 void* pData,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003200 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003201 VkQueryResultFlags flags) {
3202 deviceObject := GetDevice(device)
3203 queryPoolObject := GetQueryPool(queryPool)
3204 assert(queryPoolObject.device == device)
3205
Jesse Halld27f6aa2015-08-15 17:58:48 -07003206 data := pData[0:dataSize]
3207
3208 return ?
3209}
3210
3211// Buffer functions
3212
3213@threadSafety("system")
3214cmd VkResult vkCreateBuffer(
3215 VkDevice device,
3216 const VkBufferCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003217 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003218 VkBuffer* pBuffer) {
3219 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
3220 deviceObject := GetDevice(device)
3221
3222 buffer := ?
3223 pBuffer[0] = buffer
3224 State.Buffers[buffer] = new!BufferObject(device: device)
3225
3226 return ?
3227}
3228
3229@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003230cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003231 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003232 VkBuffer buffer,
3233 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003234 deviceObject := GetDevice(device)
3235 bufferObject := GetBuffer(buffer)
3236 assert(bufferObject.device == device)
3237
3238 assert(bufferObject.mem == 0)
3239 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003240}
3241
3242
3243// Buffer view functions
3244
3245@threadSafety("system")
3246cmd VkResult vkCreateBufferView(
3247 VkDevice device,
3248 const VkBufferViewCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003249 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003250 VkBufferView* pView) {
3251 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
3252 deviceObject := GetDevice(device)
3253
3254 bufferObject := GetBuffer(pCreateInfo.buffer)
3255 assert(bufferObject.device == device)
3256
3257 view := ?
3258 pView[0] = view
3259 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
3260
3261 return ?
3262}
3263
3264@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003265cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003266 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003267 VkBufferView bufferView,
3268 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003269 deviceObject := GetDevice(device)
3270 bufferViewObject := GetBufferView(bufferView)
3271 assert(bufferViewObject.device == device)
3272
3273 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003274}
3275
3276
3277// Image functions
3278
3279@threadSafety("system")
3280cmd VkResult vkCreateImage(
3281 VkDevice device,
3282 const VkImageCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003283 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003284 VkImage* pImage) {
3285 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
3286 deviceObject := GetDevice(device)
3287
3288 image := ?
3289 pImage[0] = image
3290 State.Images[image] = new!ImageObject(device: device)
3291
3292 return ?
3293}
3294
3295@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003296cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003297 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003298 VkImage image,
3299 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003300 deviceObject := GetDevice(device)
3301 imageObject := GetImage(image)
3302 assert(imageObject.device == device)
3303
3304 assert(imageObject.mem == 0)
3305 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003306}
3307
Jesse Hall606a54e2015-11-19 22:17:28 -08003308cmd void vkGetImageSubresourceLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003309 VkDevice device,
3310 VkImage image,
3311 const VkImageSubresource* pSubresource,
3312 VkSubresourceLayout* pLayout) {
3313 deviceObject := GetDevice(device)
3314 imageObject := GetImage(image)
3315 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003316}
3317
3318
3319// Image view functions
3320
3321@threadSafety("system")
3322cmd VkResult vkCreateImageView(
3323 VkDevice device,
3324 const VkImageViewCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003325 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003326 VkImageView* pView) {
3327 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
3328 deviceObject := GetDevice(device)
3329
3330 imageObject := GetImage(pCreateInfo.image)
3331 assert(imageObject.device == device)
3332
3333 view := ?
3334 pView[0] = view
3335 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
3336
3337 return ?
3338}
3339
3340@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003341cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003342 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003343 VkImageView imageView,
3344 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003345 deviceObject := GetDevice(device)
3346 imageViewObject := GetImageView(imageView)
3347 assert(imageViewObject.device == device)
3348
3349 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003350}
3351
3352
3353// Shader functions
3354
3355cmd VkResult vkCreateShaderModule(
3356 VkDevice device,
3357 const VkShaderModuleCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003358 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003359 VkShaderModule* pShaderModule) {
3360 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
3361 deviceObject := GetDevice(device)
3362
3363 shaderModule := ?
3364 pShaderModule[0] = shaderModule
3365 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
3366
3367 return ?
3368}
3369
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003370cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003371 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003372 VkShaderModule shaderModule,
3373 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003374 deviceObject := GetDevice(device)
3375 shaderModuleObject := GetShaderModule(shaderModule)
3376 assert(shaderModuleObject.device == device)
3377
3378 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003379}
3380
3381@threadSafety("system")
3382cmd VkResult vkCreateShader(
3383 VkDevice device,
3384 const VkShaderCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003385 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003386 VkShader* pShader) {
3387 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO)
3388 deviceObject := GetDevice(device)
3389
3390 shader := ?
3391 pShader[0] = shader
3392 State.Shaders[shader] = new!ShaderObject(device: device)
3393
3394 return ?
3395}
3396
3397@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003398cmd void vkDestroyShader(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003399 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003400 VkShader shader,
3401 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003402 deviceObject := GetDevice(device)
3403 shaderObject := GetShader(shader)
3404 assert(shaderObject.device == device)
3405
3406 State.Shaders[shader] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003407}
3408
3409
3410// Pipeline functions
3411
3412cmd VkResult vkCreatePipelineCache(
3413 VkDevice device,
3414 const VkPipelineCacheCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003415 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003416 VkPipelineCache* pPipelineCache) {
3417 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
3418 deviceObject := GetDevice(device)
3419
3420 pipelineCache := ?
3421 pPipelineCache[0] = pipelineCache
3422 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
3423
3424 return ?
3425}
3426
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003427cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003428 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003429 VkPipelineCache pipelineCache,
3430 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003431 deviceObject := GetDevice(device)
3432 pipelineCacheObject := GetPipelineCache(pipelineCache)
3433 assert(pipelineCacheObject.device == device)
3434
3435 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003436}
3437
Jesse Halld27f6aa2015-08-15 17:58:48 -07003438cmd VkResult vkGetPipelineCacheData(
3439 VkDevice device,
3440 VkPipelineCache pipelineCache,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003441 platform.size_t* pDataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003442 void* pData) {
3443 deviceObject := GetDevice(device)
3444 pipelineCacheObject := GetPipelineCache(pipelineCache)
3445 assert(pipelineCacheObject.device == device)
3446
3447 return ?
3448}
3449
3450cmd VkResult vkMergePipelineCaches(
3451 VkDevice device,
3452 VkPipelineCache destCache,
3453 u32 srcCacheCount,
3454 const VkPipelineCache* pSrcCaches) {
3455 deviceObject := GetDevice(device)
3456 destCacheObject := GetPipelineCache(destCache)
3457 assert(destCacheObject.device == device)
3458
3459 srcCaches := pSrcCaches[0:srcCacheCount]
3460 for i in (0 .. srcCacheCount) {
3461 srcCache := srcCaches[i]
3462 srcCacheObject := GetPipelineCache(srcCache)
3463 assert(srcCacheObject.device == device)
3464 }
3465
3466 return ?
3467}
3468
3469cmd VkResult vkCreateGraphicsPipelines(
3470 VkDevice device,
3471 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003472 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003473 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003474 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003475 VkPipeline* pPipelines) {
3476 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003477 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003478 pipelineCacheObject := GetPipelineCache(pipelineCache)
3479 assert(pipelineCacheObject.device == device)
3480 }
3481
Jesse Hall03b6fe12015-11-24 12:44:21 -08003482 createInfos := pCreateInfos[0:createInfoCount]
3483 pipelines := pPipelines[0:createInfoCount]
3484 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003485 pipeline := ?
3486 pipelines[i] = pipeline
3487 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3488 }
3489
3490 return ?
3491}
3492
3493cmd VkResult vkCreateComputePipelines(
3494 VkDevice device,
3495 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003496 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003497 const VkComputePipelineCreateInfo* pCreateInfos,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003498 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003499 VkPipeline* pPipelines) {
3500 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003501 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003502 pipelineCacheObject := GetPipelineCache(pipelineCache)
3503 assert(pipelineCacheObject.device == device)
3504 }
3505
Jesse Hall03b6fe12015-11-24 12:44:21 -08003506 createInfos := pCreateInfos[0:createInfoCount]
3507 pipelines := pPipelines[0:createInfoCount]
3508 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003509 pipeline := ?
3510 pipelines[i] = pipeline
3511 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3512 }
3513
3514 return ?
3515}
3516
3517@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003518cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003519 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003520 VkPipeline pipeline,
3521 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003522 deviceObject := GetDevice(device)
3523 pipelineObjects := GetPipeline(pipeline)
3524 assert(pipelineObjects.device == device)
3525
3526 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003527}
3528
3529
3530// Pipeline layout functions
3531
3532@threadSafety("system")
3533cmd VkResult vkCreatePipelineLayout(
3534 VkDevice device,
3535 const VkPipelineLayoutCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003536 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003537 VkPipelineLayout* pPipelineLayout) {
3538 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3539 deviceObject := GetDevice(device)
3540
3541 pipelineLayout := ?
3542 pPipelineLayout[0] = pipelineLayout
3543 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3544
3545 return ?
3546}
3547
3548@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003549cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003550 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003551 VkPipelineLayout pipelineLayout,
3552 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003553 deviceObject := GetDevice(device)
3554 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3555 assert(pipelineLayoutObjects.device == device)
3556
3557 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003558}
3559
3560
3561// Sampler functions
3562
3563@threadSafety("system")
3564cmd VkResult vkCreateSampler(
3565 VkDevice device,
3566 const VkSamplerCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003567 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003568 VkSampler* pSampler) {
3569 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3570 deviceObject := GetDevice(device)
3571
3572 sampler := ?
3573 pSampler[0] = sampler
3574 State.Samplers[sampler] = new!SamplerObject(device: device)
3575
3576 return ?
3577}
3578
3579@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003580cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003581 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003582 VkSampler sampler,
3583 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003584 deviceObject := GetDevice(device)
3585 samplerObject := GetSampler(sampler)
3586 assert(samplerObject.device == device)
3587
3588 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003589}
3590
3591
3592// Descriptor set functions
3593
3594@threadSafety("system")
3595cmd VkResult vkCreateDescriptorSetLayout(
3596 VkDevice device,
3597 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003598 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003599 VkDescriptorSetLayout* pSetLayout) {
3600 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3601 deviceObject := GetDevice(device)
3602
3603 setLayout := ?
3604 pSetLayout[0] = setLayout
3605 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3606
3607 return ?
3608}
3609
3610@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003611cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003612 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003613 VkDescriptorSetLayout descriptorSetLayout,
3614 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003615 deviceObject := GetDevice(device)
3616 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3617 assert(descriptorSetLayoutObject.device == device)
3618
3619 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003620}
3621
3622@threadSafety("system")
3623cmd VkResult vkCreateDescriptorPool(
3624 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003625 const VkDescriptorPoolCreateInfo* pCreateInfo,
3626 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003627 VkDescriptorPool* pDescriptorPool) {
3628 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3629 deviceObject := GetDevice(device)
3630
3631 descriptorPool := ?
3632 pDescriptorPool[0] = descriptorPool
3633 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3634
3635 return ?
3636}
3637
3638@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003639cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003640 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003641 VkDescriptorPool descriptorPool,
3642 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003643 deviceObject := GetDevice(device)
3644 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3645 assert(descriptorPoolObject.device == device)
3646
3647 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003648}
3649
3650@threadSafety("app")
3651cmd VkResult vkResetDescriptorPool(
3652 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003653 VkDescriptorPool descriptorPool,
3654 VkDescriptorPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003655 deviceObject := GetDevice(device)
3656 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3657 assert(descriptorPoolObject.device == device)
3658
3659 return ?
3660}
3661
3662@threadSafety("app")
3663cmd VkResult vkAllocDescriptorSets(
3664 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003665 const VkDescriptorSetAllocInfo* pAllocInfo,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003666 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003667 deviceObject := GetDevice(device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003668 allocInfo := pAllocInfo[0]
3669 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003670
Jesse Hall03b6fe12015-11-24 12:44:21 -08003671 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount]
3672 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003673 setLayout := setLayouts[i]
3674 setLayoutObject := GetDescriptorSetLayout(setLayout)
3675 assert(setLayoutObject.device == device)
3676 }
3677
Jesse Hall03b6fe12015-11-24 12:44:21 -08003678 descriptorSets := pDescriptorSets[0:allocInfo.setCount]
3679 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003680 descriptorSet := ?
3681 descriptorSets[i] = descriptorSet
3682 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3683 }
3684
3685 return ?
3686}
3687
Jesse Hallf09c6b12015-08-15 19:54:28 -07003688cmd VkResult vkFreeDescriptorSets(
3689 VkDevice device,
3690 VkDescriptorPool descriptorPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003691 u32 descriptorSetCount,
Jesse Hallf09c6b12015-08-15 19:54:28 -07003692 const VkDescriptorSet* pDescriptorSets) {
3693 deviceObject := GetDevice(device)
3694 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3695
Jesse Hall03b6fe12015-11-24 12:44:21 -08003696 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3697 for i in (0 .. descriptorSetCount) {
Jesse Hallf09c6b12015-08-15 19:54:28 -07003698 descriptorSet := descriptorSets[i]
3699 descriptorSetObject := GetDescriptorSet(descriptorSet)
3700 assert(descriptorSetObject.device == device)
3701 State.DescriptorSets[descriptorSet] = null
3702 }
3703
3704 return ?
3705}
3706
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003707cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003708 VkDevice device,
Jesse Hallb00daad2015-11-29 19:46:20 -08003709 u32 descriptorWriteCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003710 const VkWriteDescriptorSet* pDescriptorWrites,
Jesse Hallb00daad2015-11-29 19:46:20 -08003711 u32 descriptorCopyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003712 const VkCopyDescriptorSet* pDescriptorCopies) {
3713 deviceObject := GetDevice(device)
3714
Jesse Hallb00daad2015-11-29 19:46:20 -08003715 descriptorWrites := pDescriptorWrites[0:descriptorWriteCount]
3716 for i in (0 .. descriptorWriteCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003717 descriptorWrite := descriptorWrites[i]
3718 descriptorWriteObject := GetDescriptorSet(descriptorWrite.destSet)
3719 assert(descriptorWriteObject.device == device)
3720 }
3721
Jesse Hallb00daad2015-11-29 19:46:20 -08003722 descriptorCopies := pDescriptorCopies[0:descriptorCopyCount]
3723 for i in (0 .. descriptorCopyCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003724 descriptorCopy := descriptorCopies[i]
3725 descriptorCopyObject := GetDescriptorSet(descriptorCopy.destSet)
3726 assert(descriptorCopyObject.device == device)
3727 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003728}
3729
3730
3731// Framebuffer functions
3732
3733@threadSafety("system")
3734cmd VkResult vkCreateFramebuffer(
3735 VkDevice device,
3736 const VkFramebufferCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003737 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003738 VkFramebuffer* pFramebuffer) {
3739 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3740 deviceObject := GetDevice(device)
3741
3742 framebuffer := ?
3743 pFramebuffer[0] = framebuffer
3744 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3745
3746 return ?
3747}
3748
3749@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003750cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003751 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003752 VkFramebuffer framebuffer,
3753 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003754 deviceObject := GetDevice(device)
3755 framebufferObject := GetFramebuffer(framebuffer)
3756 assert(framebufferObject.device == device)
3757
3758 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003759}
3760
3761
3762// Renderpass functions
3763
3764@threadSafety("system")
3765cmd VkResult vkCreateRenderPass(
3766 VkDevice device,
3767 const VkRenderPassCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003768 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003769 VkRenderPass* pRenderPass) {
3770 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3771 deviceObject := GetDevice(device)
3772
3773 renderpass := ?
3774 pRenderPass[0] = renderpass
3775 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3776
3777 return ?
3778}
3779
3780@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003781cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003782 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003783 VkRenderPass renderPass,
3784 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003785 deviceObject := GetDevice(device)
3786 renderPassObject := GetRenderPass(renderPass)
3787 assert(renderPassObject.device == device)
3788
3789 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003790}
3791
Jesse Hall606a54e2015-11-19 22:17:28 -08003792cmd void vkGetRenderAreaGranularity(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003793 VkDevice device,
3794 VkRenderPass renderPass,
3795 VkExtent2D* pGranularity) {
3796 deviceObject := GetDevice(device)
3797 renderPassObject := GetRenderPass(renderPass)
3798
3799 granularity := ?
3800 pGranularity[0] = granularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07003801}
3802
3803// Command pool functions
3804
3805cmd VkResult vkCreateCommandPool(
3806 VkDevice device,
3807 const VkCmdPoolCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003808 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003809 VkCmdPool* pCmdPool) {
3810 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO)
3811 deviceObject := GetDevice(device)
3812
3813 cmdPool := ?
3814 pCmdPool[0] = cmdPool
3815 State.CmdPools[cmdPool] = new!CmdPoolObject(device: device)
3816
3817 return ?
3818}
3819
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003820cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003821 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003822 VkCmdPool cmdPool,
3823 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003824 deviceObject := GetDevice(device)
3825 cmdPoolObject := GetCmdPool(cmdPool)
3826 assert(cmdPoolObject.device == device)
3827
3828 State.CmdPools[cmdPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003829}
3830
3831cmd VkResult vkResetCommandPool(
3832 VkDevice device,
3833 VkCmdPool cmdPool,
3834 VkCmdPoolResetFlags flags) {
3835 deviceObject := GetDevice(device)
3836 cmdPoolObject := GetCmdPool(cmdPool)
3837 assert(cmdPoolObject.device == device)
3838
3839 return ?
3840}
3841
3842// Command buffer functions
3843
3844macro void bindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3845 memoryObject := GetDeviceMemory(mem)
3846 memoryObject.boundCommandBuffers[cmdBuffer] = cmdBuffer
3847
3848 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3849 cmdBufferObject.boundObjects[as!u64(obj)] = mem
3850}
3851
3852macro void unbindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3853 memoryObject := GetDeviceMemory(mem)
3854 memoryObject.boundCommandBuffers[cmdBuffer] = null
3855
3856 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3857 cmdBufferObject.boundObjects[as!u64(obj)] = null
3858}
3859
3860@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003861cmd VkResult vkAllocCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003862 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003863 const VkCmdBufferAllocInfo* pAllocInfo,
3864 VkCmdBuffer* pCmdBuffers) {
3865 assert(pAllocInfo[0].sType == VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003866
Jesse Hall03b6fe12015-11-24 12:44:21 -08003867 count := pAllocInfo[0].bufferCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08003868 cmdBuffers := pCmdBuffers[0:count]
3869 for i in (0 .. count) {
3870 cmdBuffer := ?
3871 cmdBuffers[i] = cmdBuffer
3872 State.CmdBuffers[cmdBuffer] = new!CmdBufferObject(device: device)
3873 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003874
3875 return ?
3876}
3877
3878@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003879cmd void vkFreeCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003880 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003881 VkCmdPool cmdPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003882 u32 commandBufferCount,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003883 const VkCmdBuffer* pCommandBuffers) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003884 deviceObject := GetDevice(device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003885
Jesse Hall03b6fe12015-11-24 12:44:21 -08003886 cmdBuffers := pCommandBuffers[0:commandBufferCount]
3887 for i in (0 .. commandBufferCount) {
Jesse Hallfbf97b02015-11-20 14:17:03 -08003888 cmdBufferObject := GetCmdBuffer(cmdBuffers[i])
3889 assert(cmdBufferObject.device == device)
3890 // TODO: iterate over boundObjects and clear memory bindings
3891 State.CmdBuffers[cmdBuffers[i]] = null
3892 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003893}
3894
3895@threadSafety("app")
3896cmd VkResult vkBeginCommandBuffer(
3897 VkCmdBuffer cmdBuffer,
3898 const VkCmdBufferBeginInfo* pBeginInfo) {
3899 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO)
3900 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3901
3902 // TODO: iterate over boundObjects and clear memory bindings
3903
3904 return ?
3905}
3906
3907@threadSafety("app")
3908cmd VkResult vkEndCommandBuffer(
3909 VkCmdBuffer cmdBuffer) {
3910 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3911
3912 return ?
3913}
3914
3915@threadSafety("app")
3916cmd VkResult vkResetCommandBuffer(
3917 VkCmdBuffer cmdBuffer,
3918 VkCmdBufferResetFlags flags) {
3919 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3920
3921 // TODO: iterate over boundObjects and clear memory bindings
3922
3923 return ?
3924}
3925
3926
3927// Command buffer building functions
3928
3929@threadSafety("app")
3930cmd void vkCmdBindPipeline(
3931 VkCmdBuffer cmdBuffer,
3932 VkPipelineBindPoint pipelineBindPoint,
3933 VkPipeline pipeline) {
3934 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3935 pipelineObject := GetPipeline(pipeline)
3936 assert(cmdBufferObject.device == pipelineObject.device)
3937
Jesse Halld8bade02015-11-24 10:24:18 -08003938 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003939 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3940 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3941 }
Jesse Halld8bade02015-11-24 10:24:18 -08003942 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003943}
3944
3945@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003946cmd void vkCmdSetViewport(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003947 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003948 u32 viewportCount,
3949 const VkViewport* pViewports) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003950 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003951 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003952}
3953
3954@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003955cmd void vkCmdSetScissor(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003956 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003957 u32 scissorCount,
3958 const VkRect2D* pScissors) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003959 cmdBufferObject := GetCmdBuffer(cmdBuffer)
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")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003964cmd void vkCmdSetLineWidth(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003965 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003966 f32 lineWidth) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003967 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003968 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003969}
3970
3971@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003972cmd void vkCmdSetDepthBias(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003973 VkCmdBuffer cmdBuffer,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003974 f32 depthBiasConstantFactor,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003975 f32 depthBiasClamp,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003976 f32 depthBiasSlopeFactor) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003977 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003978 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003979}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003980
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003981@threadSafety("app")
3982cmd void vkCmdSetBlendConstants(
3983 VkCmdBuffer cmdBuffer,
3984 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3985 // an annotation as a quick hack to pass this to the template without
3986 // having to modify the AST and semantic model.
Jesse Hallb00daad2015-11-29 19:46:20 -08003987 @readonly f32[4] blendConstants) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003988 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003989 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003990}
3991
3992@threadSafety("app")
3993cmd void vkCmdSetDepthBounds(
3994 VkCmdBuffer cmdBuffer,
3995 f32 minDepthBounds,
3996 f32 maxDepthBounds) {
3997 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003998 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003999}
4000
4001@threadSafety("app")
4002cmd void vkCmdSetStencilCompareMask(
4003 VkCmdBuffer cmdBuffer,
4004 VkStencilFaceFlags faceMask,
4005 u32 stencilCompareMask) {
4006 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004007 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004008}
4009
4010@threadSafety("app")
4011cmd void vkCmdSetStencilWriteMask(
4012 VkCmdBuffer cmdBuffer,
4013 VkStencilFaceFlags faceMask,
4014 u32 stencilWriteMask) {
4015 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004016 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004017}
4018
4019@threadSafety("app")
4020cmd void vkCmdSetStencilReference(
4021 VkCmdBuffer cmdBuffer,
4022 VkStencilFaceFlags faceMask,
4023 u32 stencilReference) {
4024 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004025 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004026}
4027
4028@threadSafety("app")
4029cmd void vkCmdBindDescriptorSets(
4030 VkCmdBuffer cmdBuffer,
4031 VkPipelineBindPoint pipelineBindPoint,
4032 VkPipelineLayout layout,
4033 u32 firstSet,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004034 u32 descriptorSetCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004035 const VkDescriptorSet* pDescriptorSets,
4036 u32 dynamicOffsetCount,
4037 const u32* pDynamicOffsets) {
4038 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4039
Jesse Hall03b6fe12015-11-24 12:44:21 -08004040 descriptorSets := pDescriptorSets[0:descriptorSetCount]
4041 for i in (0 .. descriptorSetCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004042 descriptorSet := descriptorSets[i]
4043 descriptorSetObject := GetDescriptorSet(descriptorSet)
4044 assert(cmdBufferObject.device == descriptorSetObject.device)
4045 }
4046
4047 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
4048 for i in (0 .. dynamicOffsetCount) {
4049 dynamicOffset := dynamicOffsets[i]
4050 }
4051
Jesse Halld8bade02015-11-24 10:24:18 -08004052 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004053 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
4054 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
4055 }
Jesse Halld8bade02015-11-24 10:24:18 -08004056 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004057}
4058
4059@threadSafety("app")
4060cmd void vkCmdBindIndexBuffer(
4061 VkCmdBuffer cmdBuffer,
4062 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004063 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004064 VkIndexType indexType) {
4065 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4066 bufferObject := GetBuffer(buffer)
4067 assert(cmdBufferObject.device == bufferObject.device)
4068
4069 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4070
Jesse Halld8bade02015-11-24 10:24:18 -08004071 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004072}
4073
4074@threadSafety("app")
4075cmd void vkCmdBindVertexBuffers(
4076 VkCmdBuffer cmdBuffer,
4077 u32 startBinding,
4078 u32 bindingCount,
4079 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004080 const VkDeviceSize* pOffsets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004081 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4082
4083 // TODO: check if not [startBinding:startBinding+bindingCount]
4084 buffers := pBuffers[0:bindingCount]
4085 offsets := pOffsets[0:bindingCount]
4086 for i in (0 .. bindingCount) {
4087 buffer := buffers[i]
4088 offset := offsets[i]
4089 bufferObject := GetBuffer(buffer)
4090 assert(cmdBufferObject.device == bufferObject.device)
4091
4092 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4093 }
4094
Jesse Halld8bade02015-11-24 10:24:18 -08004095 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004096}
4097
4098@threadSafety("app")
4099cmd void vkCmdDraw(
4100 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004101 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004102 u32 instanceCount,
4103 u32 firstVertex,
4104 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004105 cmdBufferObject := GetCmdBuffer(cmdBuffer)
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 vkCmdDrawIndexed(
4112 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004113 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004114 u32 instanceCount,
4115 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004116 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004117 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004118 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4119
Jesse Halld8bade02015-11-24 10:24:18 -08004120 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004121}
4122
4123@threadSafety("app")
4124cmd void vkCmdDrawIndirect(
4125 VkCmdBuffer cmdBuffer,
4126 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004127 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004128 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004129 u32 stride) {
4130 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4131 bufferObject := GetBuffer(buffer)
4132 assert(cmdBufferObject.device == bufferObject.device)
4133
4134 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4135
Jesse Halld8bade02015-11-24 10:24:18 -08004136 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004137}
4138
4139@threadSafety("app")
4140cmd void vkCmdDrawIndexedIndirect(
4141 VkCmdBuffer cmdBuffer,
4142 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004143 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004144 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004145 u32 stride) {
4146 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4147 bufferObject := GetBuffer(buffer)
4148 assert(cmdBufferObject.device == bufferObject.device)
4149
4150 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4151
Jesse Halld8bade02015-11-24 10:24:18 -08004152 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004153}
4154
4155@threadSafety("app")
4156cmd void vkCmdDispatch(
4157 VkCmdBuffer cmdBuffer,
4158 u32 x,
4159 u32 y,
4160 u32 z) {
4161 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4162
Jesse Halld8bade02015-11-24 10:24:18 -08004163 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004164}
4165
4166@threadSafety("app")
4167cmd void vkCmdDispatchIndirect(
4168 VkCmdBuffer cmdBuffer,
4169 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004170 VkDeviceSize offset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004171 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4172 bufferObject := GetBuffer(buffer)
4173 assert(cmdBufferObject.device == bufferObject.device)
4174
4175 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4176
Jesse Halld8bade02015-11-24 10:24:18 -08004177 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004178}
4179
4180@threadSafety("app")
4181cmd void vkCmdCopyBuffer(
4182 VkCmdBuffer cmdBuffer,
4183 VkBuffer srcBuffer,
4184 VkBuffer destBuffer,
4185 u32 regionCount,
4186 const VkBufferCopy* pRegions) {
4187 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4188 srcBufferObject := GetBuffer(srcBuffer)
4189 destBufferObject := GetBuffer(destBuffer)
4190 assert(cmdBufferObject.device == srcBufferObject.device)
4191 assert(cmdBufferObject.device == destBufferObject.device)
4192
4193 regions := pRegions[0:regionCount]
4194 for i in (0 .. regionCount) {
4195 region := regions[i]
4196 }
4197
4198 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
4199 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4200
Jesse Halld8bade02015-11-24 10:24:18 -08004201 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004202}
4203
4204@threadSafety("app")
4205cmd void vkCmdCopyImage(
4206 VkCmdBuffer cmdBuffer,
4207 VkImage srcImage,
4208 VkImageLayout srcImageLayout,
4209 VkImage destImage,
4210 VkImageLayout destImageLayout,
4211 u32 regionCount,
4212 const VkImageCopy* pRegions) {
4213 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4214 srcImageObject := GetImage(srcImage)
4215 destImageObject := GetImage(destImage)
4216 assert(cmdBufferObject.device == srcImageObject.device)
4217 assert(cmdBufferObject.device == destImageObject.device)
4218
4219 regions := pRegions[0:regionCount]
4220 for i in (0 .. regionCount) {
4221 region := regions[i]
4222 }
4223
4224 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4225 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4226
Jesse Halld8bade02015-11-24 10:24:18 -08004227 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004228}
4229
4230@threadSafety("app")
4231cmd void vkCmdBlitImage(
4232 VkCmdBuffer cmdBuffer,
4233 VkImage srcImage,
4234 VkImageLayout srcImageLayout,
4235 VkImage destImage,
4236 VkImageLayout destImageLayout,
4237 u32 regionCount,
4238 const VkImageBlit* pRegions,
Jesse Hall23ff73f2015-11-29 14:36:39 -08004239 VkFilter filter) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004240 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4241 srcImageObject := GetImage(srcImage)
4242 destImageObject := GetImage(destImage)
4243 assert(cmdBufferObject.device == srcImageObject.device)
4244 assert(cmdBufferObject.device == destImageObject.device)
4245
4246 regions := pRegions[0:regionCount]
4247 for i in (0 .. regionCount) {
4248 region := regions[i]
4249 }
4250
4251 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4252 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4253
Jesse Halld8bade02015-11-24 10:24:18 -08004254 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004255}
4256
4257@threadSafety("app")
4258cmd void vkCmdCopyBufferToImage(
4259 VkCmdBuffer cmdBuffer,
4260 VkBuffer srcBuffer,
4261 VkImage destImage,
4262 VkImageLayout destImageLayout,
4263 u32 regionCount,
4264 const VkBufferImageCopy* pRegions) {
4265 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4266 srcBufferObject := GetBuffer(srcBuffer)
4267 destImageObject := GetImage(destImage)
4268 assert(cmdBufferObject.device == srcBufferObject.device)
4269 assert(cmdBufferObject.device == destImageObject.device)
4270
4271 regions := pRegions[0:regionCount]
4272 for i in (0 .. regionCount) {
4273 region := regions[i]
4274 }
4275
4276 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
4277 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4278
Jesse Halld8bade02015-11-24 10:24:18 -08004279 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004280}
4281
4282@threadSafety("app")
4283cmd void vkCmdCopyImageToBuffer(
4284 VkCmdBuffer cmdBuffer,
4285 VkImage srcImage,
4286 VkImageLayout srcImageLayout,
4287 VkBuffer destBuffer,
4288 u32 regionCount,
4289 const VkBufferImageCopy* pRegions) {
4290 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4291 srcImageObject := GetImage(srcImage)
4292 destBufferObject := GetBuffer(destBuffer)
4293 assert(cmdBufferObject.device == srcImageObject.device)
4294 assert(cmdBufferObject.device == destBufferObject.device)
4295
4296 regions := pRegions[0:regionCount]
4297 for i in (0 .. regionCount) {
4298 region := regions[i]
4299 }
4300
4301 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4302 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4303
Jesse Halld8bade02015-11-24 10:24:18 -08004304 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004305}
4306
4307@threadSafety("app")
4308cmd void vkCmdUpdateBuffer(
4309 VkCmdBuffer cmdBuffer,
4310 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004311 VkDeviceSize destOffset,
4312 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004313 const u32* pData) {
4314 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4315 destBufferObject := GetBuffer(destBuffer)
4316 assert(cmdBufferObject.device == destBufferObject.device)
4317
4318 data := pData[0:dataSize]
4319
4320 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4321
Jesse Halld8bade02015-11-24 10:24:18 -08004322 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004323}
4324
4325@threadSafety("app")
4326cmd void vkCmdFillBuffer(
4327 VkCmdBuffer cmdBuffer,
4328 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004329 VkDeviceSize destOffset,
Jesse Hallb00daad2015-11-29 19:46:20 -08004330 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004331 u32 data) {
4332 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4333 destBufferObject := GetBuffer(destBuffer)
4334 assert(cmdBufferObject.device == destBufferObject.device)
4335
Jesse Halld8bade02015-11-24 10:24:18 -08004336 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004337}
4338
4339@threadSafety("app")
4340cmd void vkCmdClearColorImage(
4341 VkCmdBuffer cmdBuffer,
4342 VkImage image,
4343 VkImageLayout imageLayout,
4344 const VkClearColorValue* pColor,
4345 u32 rangeCount,
4346 const VkImageSubresourceRange* pRanges) {
4347 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4348 imageObject := GetImage(image)
4349 assert(cmdBufferObject.device == imageObject.device)
4350
4351 ranges := pRanges[0:rangeCount]
4352 for i in (0 .. rangeCount) {
4353 range := ranges[i]
4354 }
4355
4356 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
4357
Jesse Halld8bade02015-11-24 10:24:18 -08004358 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004359}
4360
4361@threadSafety("app")
4362cmd void vkCmdClearDepthStencilImage(
4363 VkCmdBuffer cmdBuffer,
4364 VkImage image,
4365 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004366 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004367 u32 rangeCount,
4368 const VkImageSubresourceRange* pRanges) {
4369 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4370 imageObject := GetImage(image)
4371 assert(cmdBufferObject.device == imageObject.device)
4372
4373 ranges := pRanges[0:rangeCount]
4374 for i in (0 .. rangeCount) {
4375 range := ranges[i]
4376 }
4377
4378 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
4379
Jesse Halld8bade02015-11-24 10:24:18 -08004380 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004381}
4382
4383@threadSafety("app")
Jesse Hallae38f732015-11-19 21:32:50 -08004384cmd void vkCmdClearAttachments(
Jesse Halld27f6aa2015-08-15 17:58:48 -07004385 VkCmdBuffer cmdBuffer,
Jesse Hallae38f732015-11-19 21:32:50 -08004386 u32 attachmentCount,
4387 const VkClearAttachment* pAttachments,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004388 u32 rectCount,
Jesse Halla15a4bf2015-11-19 22:48:02 -08004389 const VkClearRect* pRects) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004390 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4391
4392 rects := pRects[0:rectCount]
4393 for i in (0 .. rectCount) {
4394 rect := rects[i]
4395 }
4396
Jesse Halld8bade02015-11-24 10:24:18 -08004397 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004398}
4399
4400@threadSafety("app")
4401cmd void vkCmdResolveImage(
4402 VkCmdBuffer cmdBuffer,
4403 VkImage srcImage,
4404 VkImageLayout srcImageLayout,
4405 VkImage destImage,
4406 VkImageLayout destImageLayout,
4407 u32 regionCount,
4408 const VkImageResolve* pRegions) {
4409 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4410 srcImageObject := GetImage(srcImage)
4411 destImageObject := GetImage(destImage)
4412 assert(cmdBufferObject.device == srcImageObject.device)
4413 assert(cmdBufferObject.device == destImageObject.device)
4414
4415 regions := pRegions[0:regionCount]
4416 for i in (0 .. regionCount) {
4417 region := regions[i]
4418 }
4419
4420 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4421 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4422
Jesse Halld8bade02015-11-24 10:24:18 -08004423 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004424}
4425
4426@threadSafety("app")
4427cmd void vkCmdSetEvent(
4428 VkCmdBuffer cmdBuffer,
4429 VkEvent event,
4430 VkPipelineStageFlags stageMask) {
4431 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4432 eventObject := GetEvent(event)
4433 assert(cmdBufferObject.device == eventObject.device)
4434}
4435
4436@threadSafety("app")
4437cmd void vkCmdResetEvent(
4438 VkCmdBuffer cmdBuffer,
4439 VkEvent event,
4440 VkPipelineStageFlags stageMask) {
4441 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4442 eventObject := GetEvent(event)
4443 assert(cmdBufferObject.device == eventObject.device)
4444}
4445
4446@threadSafety("app")
4447cmd void vkCmdWaitEvents(
4448 VkCmdBuffer cmdBuffer,
4449 u32 eventCount,
4450 const VkEvent* pEvents,
4451 VkPipelineStageFlags srcStageMask,
4452 VkPipelineStageFlags destStageMask,
4453 u32 memBarrierCount,
4454 const void* const* ppMemBarriers) {
4455 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4456
4457 events := pEvents[0:eventCount]
4458 for i in (0 .. eventCount) {
4459 event := events[i]
4460 eventObject := GetEvent(event)
4461 assert(cmdBufferObject.device == eventObject.device)
4462 }
4463
4464 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4465 for i in (0 .. memBarrierCount) {
4466 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4467 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4468 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4469 }
4470 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4471 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4472 imageObject := GetImage(imageMemBarrier.image)
4473 assert(imageObject.device == cmdBufferObject.device)
4474 }
4475 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4476 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4477 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4478 assert(bufferObject.device == cmdBufferObject.device)
4479 }
4480 }
4481 }
4482}
4483
4484@threadSafety("app")
4485cmd void vkCmdPipelineBarrier(
4486 VkCmdBuffer cmdBuffer,
4487 VkPipelineStageFlags srcStageMask,
4488 VkPipelineStageFlags destStageMask,
Jesse Halldc6d36c2015-11-29 19:12:15 -08004489 VkDependencyFlags dependencyFlags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004490 u32 memBarrierCount,
4491 const void* const* ppMemBarriers) {
4492 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4493
4494 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4495 for i in (0 .. memBarrierCount) {
4496 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4497 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4498 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4499 }
4500 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4501 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4502 imageObject := GetImage(imageMemBarrier.image)
4503 assert(imageObject.device == cmdBufferObject.device)
4504 }
4505 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4506 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4507 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4508 assert(bufferObject.device == cmdBufferObject.device)
4509 }
4510 }
4511 }
4512}
4513
4514@threadSafety("app")
4515cmd void vkCmdBeginQuery(
4516 VkCmdBuffer cmdBuffer,
4517 VkQueryPool queryPool,
4518 u32 slot,
4519 VkQueryControlFlags flags) {
4520 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4521 queryPoolObject := GetQueryPool(queryPool)
4522 assert(cmdBufferObject.device == queryPoolObject.device)
4523}
4524
4525@threadSafety("app")
4526cmd void vkCmdEndQuery(
4527 VkCmdBuffer cmdBuffer,
4528 VkQueryPool queryPool,
4529 u32 slot) {
4530 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4531 queryPoolObject := GetQueryPool(queryPool)
4532 assert(cmdBufferObject.device == queryPoolObject.device)
4533}
4534
4535@threadSafety("app")
4536cmd void vkCmdResetQueryPool(
4537 VkCmdBuffer cmdBuffer,
4538 VkQueryPool queryPool,
4539 u32 startQuery,
4540 u32 queryCount) {
4541 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4542 queryPoolObject := GetQueryPool(queryPool)
4543 assert(cmdBufferObject.device == queryPoolObject.device)
4544}
4545
4546@threadSafety("app")
4547cmd void vkCmdWriteTimestamp(
4548 VkCmdBuffer cmdBuffer,
Jesse Hall6f39a6d2015-11-24 11:08:36 -08004549 VkPipelineStageFlagBits pipelineStage,
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004550 VkQueryPool queryPool,
4551 u32 slot) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004552 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004553 queryPoolObject := GetQueryPool(queryPool)
4554 assert(cmdBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004555}
4556
4557@threadSafety("app")
4558cmd void vkCmdCopyQueryPoolResults(
4559 VkCmdBuffer cmdBuffer,
4560 VkQueryPool queryPool,
4561 u32 startQuery,
4562 u32 queryCount,
4563 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004564 VkDeviceSize destOffset,
Jesse Halla9bb62b2015-11-21 19:31:56 -08004565 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004566 VkQueryResultFlags flags) {
4567 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4568 queryPoolObject := GetQueryPool(queryPool)
4569 destBufferObject := GetBuffer(destBuffer)
4570 assert(cmdBufferObject.device == queryPoolObject.device)
4571 assert(cmdBufferObject.device == destBufferObject.device)
4572}
4573
4574cmd void vkCmdPushConstants(
4575 VkCmdBuffer cmdBuffer,
4576 VkPipelineLayout layout,
4577 VkShaderStageFlags stageFlags,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004578 u32 offset,
4579 u32 size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004580 const void* values) {
4581 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4582 layoutObject := GetPipelineLayout(layout)
4583 assert(cmdBufferObject.device == layoutObject.device)
4584}
4585
4586@threadSafety("app")
4587cmd void vkCmdBeginRenderPass(
4588 VkCmdBuffer cmdBuffer,
4589 const VkRenderPassBeginInfo* pRenderPassBegin,
4590 VkRenderPassContents contents) {
4591 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4592 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4593 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
4594 assert(cmdBufferObject.device == renderPassObject.device)
4595 assert(cmdBufferObject.device == framebufferObject.device)
4596
Jesse Halld8bade02015-11-24 10:24:18 -08004597 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004598}
4599
4600cmd void vkCmdNextSubpass(
4601 VkCmdBuffer cmdBuffer,
4602 VkRenderPassContents contents) {
4603 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4604}
4605
4606@threadSafety("app")
4607cmd void vkCmdEndRenderPass(
4608 VkCmdBuffer cmdBuffer) {
4609 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4610
Jesse Halld8bade02015-11-24 10:24:18 -08004611 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004612}
4613
4614cmd void vkCmdExecuteCommands(
4615 VkCmdBuffer cmdBuffer,
4616 u32 cmdBuffersCount,
4617 const VkCmdBuffer* pCmdBuffers) {
4618 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4619
4620 cmdBuffers := pCmdBuffers[0:cmdBuffersCount]
4621 for i in (0 .. cmdBuffersCount) {
4622 secondaryCmdBuffer := cmdBuffers[i]
4623 secondaryCmdBufferObject := GetCmdBuffer(secondaryCmdBuffer)
4624 assert(cmdBufferObject.device == secondaryCmdBufferObject.device)
4625 }
4626}
4627
Jesse Hall1356b0d2015-11-23 17:24:58 -08004628@extension("VK_EXT_KHR_surface")
4629cmd void vkDestroySurfaceKHR(
4630 VkInstance instance,
4631 VkSurfaceKHR surface) {
4632 instanceObject := GetInstance(instance)
4633 surfaceObject := GetSurface(surface)
4634 assert(surfaceObject.instance == instance)
Michael Lentine88594d72015-11-12 12:49:45 -08004635
Jesse Hall1356b0d2015-11-23 17:24:58 -08004636 State.Surfaces[surface] = null
Jesse Hall2818f932015-11-19 21:19:17 -08004637}
4638
Jesse Hall1356b0d2015-11-23 17:24:58 -08004639@extension("VK_EXT_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004640cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004641 VkPhysicalDevice physicalDevice,
4642 u32 queueFamilyIndex,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004643 VkSurfaceKHR surface,
Jesse Hallb00daad2015-11-29 19:46:20 -08004644 VkBool32* pSupported) {
4645 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004646
4647 return ?
4648}
4649
Jesse Hallb00daad2015-11-29 19:46:20 -08004650@extension("VK_EXT_KHR_surface")
4651cmd VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
4652 VkPhysicalDevice physicalDevice,
4653 VkSurfaceKHR surface,
4654 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
4655 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4656
4657 surfaceCapabilities := ?
4658 pSurfaceCapabilities[0] = surfaceCapabilities
4659
4660 return ?
4661}
4662
4663@extension("VK_EXT_KHR_surface")
4664cmd VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(
4665 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004666 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004667 u32* pSurfaceFormatCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004668 VkSurfaceFormatKHR* pSurfaceFormats) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004669 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004670
4671 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004672 pSurfaceFormatCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004673 surfaceFormats := pSurfaceFormats[0:count]
4674
4675 for i in (0 .. count) {
4676 surfaceFormat := ?
4677 surfaceFormats[i] = surfaceFormat
4678 }
4679
4680 return ?
4681}
4682
Jesse Hallb00daad2015-11-29 19:46:20 -08004683@extension("VK_EXT_KHR_surface")
4684cmd VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(
4685 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004686 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004687 u32* pPresentModeCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004688 VkPresentModeKHR* pPresentModes) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004689 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004690
4691 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004692 pPresentModeCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004693 presentModes := pPresentModes[0:count]
4694
4695 for i in (0 .. count) {
4696 presentMode := ?
4697 presentModes[i] = presentMode
4698 }
4699
4700 return ?
4701}
4702
Jesse Hall1356b0d2015-11-23 17:24:58 -08004703@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004704cmd VkResult vkCreateSwapchainKHR(
4705 VkDevice device,
4706 const VkSwapchainCreateInfoKHR* pCreateInfo,
4707 VkSwapchainKHR* pSwapchain) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004708 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
Michael Lentine88594d72015-11-12 12:49:45 -08004709 deviceObject := GetDevice(device)
4710
4711 swapchain := ?
4712 pSwapchain[0] = swapchain
4713 State.Swapchains[swapchain] = new!SwapchainObject(device: device)
4714
4715 return ?
4716}
4717
Jesse Hall1356b0d2015-11-23 17:24:58 -08004718@extension("VK_EXT_KHR_swapchain")
4719cmd void vkDestroySwapchainKHR(
Michael Lentine88594d72015-11-12 12:49:45 -08004720 VkDevice device,
4721 VkSwapchainKHR swapchain) {
4722 deviceObject := GetDevice(device)
4723 swapchainObject := GetSwapchain(swapchain)
4724 assert(swapchainObject.device == device)
4725
4726 State.Swapchains[swapchain] = null
Michael Lentine88594d72015-11-12 12:49:45 -08004727}
4728
Jesse Hall1356b0d2015-11-23 17:24:58 -08004729@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004730cmd VkResult vkGetSwapchainImagesKHR(
4731 VkDevice device,
4732 VkSwapchainKHR swapchain,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004733 u32* pSwapchainImageCount,
Michael Lentine88594d72015-11-12 12:49:45 -08004734 VkImage* pSwapchainImages) {
4735 deviceObject := GetDevice(device)
4736
4737 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004738 pSwapchainImageCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004739 swapchainImages := pSwapchainImages[0:count]
4740
4741 for i in (0 .. count) {
4742 swapchainImage := ?
4743 swapchainImages[i] = swapchainImage
Jesse Hall1356b0d2015-11-23 17:24:58 -08004744 State.Images[swapchainImage] = new!ImageObject(device: device)
Michael Lentine88594d72015-11-12 12:49:45 -08004745 }
4746
4747 return ?
4748}
4749
Jesse Hall1356b0d2015-11-23 17:24:58 -08004750@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004751cmd VkResult vkAcquireNextImageKHR(
4752 VkDevice device,
4753 VkSwapchainKHR swapchain,
4754 u64 timeout,
4755 VkSemaphore semaphore,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004756 VkFence fence,
Michael Lentine88594d72015-11-12 12:49:45 -08004757 u32* pImageIndex) {
4758 deviceObject := GetDevice(device)
4759 swapchainObject := GetSwapchain(swapchain)
4760
4761 imageIndex := ?
4762 pImageIndex[0] = imageIndex
4763
4764 return ?
4765}
4766
Jesse Hall1356b0d2015-11-23 17:24:58 -08004767@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004768cmd VkResult vkQueuePresentKHR(
4769 VkQueue queue,
4770 VkPresentInfoKHR* pPresentInfo) {
4771 queueObject := GetQueue(queue)
4772
4773 presentInfo := ?
4774 pPresentInfo[0] = presentInfo
4775
4776 return ?
4777}
4778
Jesse Hall1356b0d2015-11-23 17:24:58 -08004779@extension("VK_EXT_KHR_display")
4780cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
4781 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004782 u32* pPropertyCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004783 VkDisplayPropertiesKHR* pProperties) {
4784 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4785 return ?
4786}
4787
4788@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004789cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
4790 VkPhysicalDevice physicalDevice,
4791 u32* pPropertyCount,
4792 VkDisplayPlanePropertiesKHR* pProperties) {
4793 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4794 return ?
4795}
4796
4797@extension("VK_EXT_KHR_display")
4798cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR(
4799 VkPhysicalDevice physicalDevice,
4800 u32* pPropertyCount,
4801 VkDisplayKHR* pProperties) {
4802 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4803 return ?
4804}
4805
4806@extension("VK_EXT_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004807cmd VkResult vkGetDisplayModePropertiesKHR(
4808 VkPhysicalDevice physicalDevice,
4809 VkDisplayKHR display,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004810 u32* pPropertyCount,
4811 VkDisplayModePropertiesKHR* pProperties) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004812 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4813 return ?
4814}
4815
4816@extension("VK_EXT_KHR_display")
4817cmd VkResult vkCreateDisplayModeKHR(
4818 VkPhysicalDevice physicalDevice,
4819 VkDisplayKHR display,
4820 const VkDisplayModeCreateInfoKHR* pCreateInfo,
4821 VkDisplayModeKHR* pMode) {
4822 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4823 return ?
4824}
4825
4826@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004827cmd VkResult vkGetDisplayPlaneCapabilitiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004828 VkPhysicalDevice physicalDevice,
Jesse Halla6429252015-11-29 18:59:42 -08004829 VkDisplayModeCreateInfoKHR mode,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004830 u32 planeIndex,
Jesse Halla6429252015-11-29 18:59:42 -08004831 VkDisplayPlaneCapabilitiesKHR* pCapabilities) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004832 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4833 return ?
4834}
4835
Jesse Halla6429252015-11-29 18:59:42 -08004836@extension("VK_EXT_KHR_display")
4837cmd VkResult vkCreateDisplayPlaneSurfaceKHR(
4838 VkInstance instance,
4839 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
4840 VkSurfaceKHR* pSurface) {
4841 return ?
4842}
4843
4844@extension("VK_EXT_KHR_xlib_surface")
4845cmd VkResult vkCreateXlibSurfaceKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004846 VkInstance instance,
4847 platform.Display* dpy,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004848 platform.Window window,
4849 VkSurfaceKHR* pSurface) {
4850 instanceObject := GetInstance(instance)
4851 return ?
4852}
4853
Jesse Halla6429252015-11-29 18:59:42 -08004854@extension("VK_EXT_KHR_xlib_surface")
4855cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
4856 VkPhysicalDevice physicalDevice,
4857 u32 queueFamilyIndex,
4858 platform.Display* dpy,
4859 platform.VisualID visualId) {
4860 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4861 return ?
4862}
4863
Jesse Hall1356b0d2015-11-23 17:24:58 -08004864@extension("VK_EXT_KHR_xcb_surface")
4865cmd VkResult vkCreateXCBSurfaceKHR(
4866 VkInstance instance,
4867 platform.xcb_connection_t* connection,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004868 platform.xcb_window_t window,
4869 VkSurfaceKHR* pSurface) {
4870 instanceObject := GetInstance(instance)
4871 return ?
4872}
4873
Jesse Halla6429252015-11-29 18:59:42 -08004874@extension("VK_EXT_KHR_xlib_surface")
4875cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
4876 VkPhysicalDevice physicalDevice,
4877 u32 queueFamilyIndex,
4878 platform.xcb_connection_t* connection,
4879 platform.xcb_visualid_t visual_id) {
4880 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4881 return ?
4882}
4883
Jesse Hall1356b0d2015-11-23 17:24:58 -08004884@extension("VK_EXT_KHR_wayland_surface")
4885cmd VkResult vkCreateWaylandSurfaceKHR(
4886 VkInstance instance,
4887 platform.wl_display* display,
4888 platform.wl_surface* surface,
4889 VkSurfaceKHR* pSurface) {
4890 instanceObject := GetInstance(instance)
4891 return ?
4892}
4893
Jesse Halla6429252015-11-29 18:59:42 -08004894@extension("VK_EXT_KHR_wayland_surface")
4895cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
4896 VkPhysicalDevice physicalDevice,
4897 u32 queueFamilyIndex,
4898 platform.wl_display* display) {
4899 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4900 return ?
4901}
4902
Jesse Hall1356b0d2015-11-23 17:24:58 -08004903@extension("VK_EXT_KHR_mir_surface")
4904cmd VkResult vkCreateMirSurfaceKHR(
4905 VkInstance instance,
4906 platform.MirConnection* connection,
4907 platform.MirSurface* mirSurface,
4908 VkSurfaceKHR* pSurface) {
4909 instanceObject := GetInstance(instance)
4910 return ?
4911}
4912
Jesse Halla6429252015-11-29 18:59:42 -08004913@extension("VK_EXT_KHR_mir_surface")
4914cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR(
4915 VkPhysicalDevice physicalDevice,
4916 u32 queueFamilyIndex,
4917 platform.MirConnection* connection) {
4918 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4919 return ?
4920}
4921
Jesse Hall1356b0d2015-11-23 17:24:58 -08004922@extension("VK_EXT_KHR_android_surface")
4923cmd VkResult vkCreateAndroidSurfaceKHR(
4924 VkInstance instance,
4925 platform.ANativeWindow* window
4926 VkSurfaceKHR* pSurface) {
4927 instanceObject := GetInstance(instance)
4928 return ?
4929}
4930
4931@extension("VK_EXT_KHR_win32_surface")
4932cmd VkResult vkCreateWin32SurfaceKHR(
4933 VkInstance instance,
4934 platform.HINSTANCE hinstance,
4935 platform.HWND hwnd,
4936 VkSurfaceKHR* pSurface) {
4937 instanceObject := GetInstance(instance)
4938 return ?
4939}
4940
Jesse Halla6429252015-11-29 18:59:42 -08004941@extension("VK_EXT_KHR_win32_surface")
4942cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR(
4943 VkPhysicalDevice physicalDevice,
4944 u32 queueFamilyIndex) {
4945 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4946 return ?
4947}
4948
Jesse Halld27f6aa2015-08-15 17:58:48 -07004949
4950////////////////
4951// Validation //
4952////////////////
4953
4954extern void validate(string layerName, bool condition, string message)
4955
4956
4957/////////////////////////////
4958// Internal State Tracking //
4959/////////////////////////////
4960
4961StateObject State
4962
4963@internal class StateObject {
4964 // Dispatchable objects.
4965 map!(VkInstance, ref!InstanceObject) Instances
4966 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4967 map!(VkDevice, ref!DeviceObject) Devices
4968 map!(VkQueue, ref!QueueObject) Queues
4969 map!(VkCmdBuffer, ref!CmdBufferObject) CmdBuffers
4970
4971 // Non-dispatchable objects.
4972 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4973 map!(VkBuffer, ref!BufferObject) Buffers
4974 map!(VkBufferView, ref!BufferViewObject) BufferViews
4975 map!(VkImage, ref!ImageObject) Images
4976 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004977 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
4978 map!(VkShader, ref!ShaderObject) Shaders
4979 map!(VkPipeline, ref!PipelineObject) Pipelines
4980 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4981 map!(VkSampler, ref!SamplerObject) Samplers
4982 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4983 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4984 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004985 map!(VkFence, ref!FenceObject) Fences
4986 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4987 map!(VkEvent, ref!EventObject) Events
4988 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4989 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4990 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4991 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
4992 map!(VkCmdPool, ref!CmdPoolObject) CmdPools
Jesse Hall1356b0d2015-11-23 17:24:58 -08004993 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces
Michael Lentine88594d72015-11-12 12:49:45 -08004994 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains
Jesse Halld27f6aa2015-08-15 17:58:48 -07004995}
4996
4997@internal class InstanceObject {
4998}
4999
5000@internal class PhysicalDeviceObject {
5001 VkInstance instance
5002}
5003
5004@internal class DeviceObject {
5005 VkPhysicalDevice physicalDevice
5006}
5007
5008@internal class QueueObject {
5009 VkDevice device
5010 VkQueueFlags flags
5011}
5012
5013@internal class CmdBufferObject {
5014 VkDevice device
5015 map!(u64, VkDeviceMemory) boundObjects
5016 VkQueueFlags queueFlags
5017}
5018
5019@internal class DeviceMemoryObject {
5020 VkDevice device
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005021 VkDeviceSize allocationSize
5022 map!(u64, VkDeviceSize ) boundObjects
Jesse Halld27f6aa2015-08-15 17:58:48 -07005023 map!(VkCmdBuffer, VkCmdBuffer) boundCommandBuffers
5024}
5025
5026@internal class BufferObject {
5027 VkDevice device
5028 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005029 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005030}
5031
5032@internal class BufferViewObject {
5033 VkDevice device
5034 VkBuffer buffer
5035}
5036
5037@internal class ImageObject {
5038 VkDevice device
5039 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005040 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005041}
5042
5043@internal class ImageViewObject {
5044 VkDevice device
5045 VkImage image
5046}
5047
Jesse Halld27f6aa2015-08-15 17:58:48 -07005048@internal class ShaderObject {
5049 VkDevice device
5050}
5051
5052@internal class ShaderModuleObject {
5053 VkDevice device
5054}
5055
5056@internal class PipelineObject {
5057 VkDevice device
5058}
5059
5060@internal class PipelineLayoutObject {
5061 VkDevice device
5062}
5063
5064@internal class SamplerObject {
5065 VkDevice device
5066}
5067
5068@internal class DescriptorSetObject {
5069 VkDevice device
5070}
5071
5072@internal class DescriptorSetLayoutObject {
5073 VkDevice device
5074}
5075
5076@internal class DescriptorPoolObject {
5077 VkDevice device
5078}
5079
Jesse Halld27f6aa2015-08-15 17:58:48 -07005080@internal class FenceObject {
5081 VkDevice device
5082 bool signaled
5083}
5084
5085@internal class SemaphoreObject {
5086 VkDevice device
5087}
5088
5089@internal class EventObject {
5090 VkDevice device
5091}
5092
5093@internal class QueryPoolObject {
5094 VkDevice device
5095}
5096
5097@internal class FramebufferObject {
5098 VkDevice device
5099}
5100
5101@internal class RenderPassObject {
5102 VkDevice device
5103}
5104
5105@internal class PipelineCacheObject {
5106 VkDevice device
5107}
5108
5109@internal class CmdPoolObject {
5110 VkDevice device
5111}
5112
Jesse Hall1356b0d2015-11-23 17:24:58 -08005113@internal class SurfaceObject {
5114 VkInstance instance
5115}
5116
Michael Lentine88594d72015-11-12 12:49:45 -08005117@internal class SwapchainObject {
5118 VkDevice device
5119}
5120
Jesse Halld27f6aa2015-08-15 17:58:48 -07005121macro ref!InstanceObject GetInstance(VkInstance instance) {
5122 assert(instance in State.Instances)
5123 return State.Instances[instance]
5124}
5125
5126macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
5127 assert(physicalDevice in State.PhysicalDevices)
5128 return State.PhysicalDevices[physicalDevice]
5129}
5130
5131macro ref!DeviceObject GetDevice(VkDevice device) {
5132 assert(device in State.Devices)
5133 return State.Devices[device]
5134}
5135
5136macro ref!QueueObject GetQueue(VkQueue queue) {
5137 assert(queue in State.Queues)
5138 return State.Queues[queue]
5139}
5140
5141macro ref!CmdBufferObject GetCmdBuffer(VkCmdBuffer cmdBuffer) {
5142 assert(cmdBuffer in State.CmdBuffers)
5143 return State.CmdBuffers[cmdBuffer]
5144}
5145
5146macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory mem) {
5147 assert(mem in State.DeviceMemories)
5148 return State.DeviceMemories[mem]
5149}
5150
5151macro ref!BufferObject GetBuffer(VkBuffer buffer) {
5152 assert(buffer in State.Buffers)
5153 return State.Buffers[buffer]
5154}
5155
5156macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
5157 assert(bufferView in State.BufferViews)
5158 return State.BufferViews[bufferView]
5159}
5160
5161macro ref!ImageObject GetImage(VkImage image) {
5162 assert(image in State.Images)
5163 return State.Images[image]
5164}
5165
5166macro ref!ImageViewObject GetImageView(VkImageView imageView) {
5167 assert(imageView in State.ImageViews)
5168 return State.ImageViews[imageView]
5169}
5170
Jesse Halld27f6aa2015-08-15 17:58:48 -07005171macro ref!ShaderObject GetShader(VkShader shader) {
5172 assert(shader in State.Shaders)
5173 return State.Shaders[shader]
5174}
5175
5176macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
5177 assert(shaderModule in State.ShaderModules)
5178 return State.ShaderModules[shaderModule]
5179}
5180
5181macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
5182 assert(pipeline in State.Pipelines)
5183 return State.Pipelines[pipeline]
5184}
5185
5186macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
5187 assert(pipelineLayout in State.PipelineLayouts)
5188 return State.PipelineLayouts[pipelineLayout]
5189}
5190
5191macro ref!SamplerObject GetSampler(VkSampler sampler) {
5192 assert(sampler in State.Samplers)
5193 return State.Samplers[sampler]
5194}
5195
5196macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
5197 assert(descriptorSet in State.DescriptorSets)
5198 return State.DescriptorSets[descriptorSet]
5199}
5200
5201macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
5202 assert(descriptorSetLayout in State.DescriptorSetLayouts)
5203 return State.DescriptorSetLayouts[descriptorSetLayout]
5204}
5205
5206macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
5207 assert(descriptorPool in State.DescriptorPools)
5208 return State.DescriptorPools[descriptorPool]
5209}
5210
Jesse Halld27f6aa2015-08-15 17:58:48 -07005211macro ref!FenceObject GetFence(VkFence fence) {
5212 assert(fence in State.Fences)
5213 return State.Fences[fence]
5214}
5215
5216macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
5217 assert(semaphore in State.Semaphores)
5218 return State.Semaphores[semaphore]
5219}
5220
5221macro ref!EventObject GetEvent(VkEvent event) {
5222 assert(event in State.Events)
5223 return State.Events[event]
5224}
5225
5226macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
5227 assert(queryPool in State.QueryPools)
5228 return State.QueryPools[queryPool]
5229}
5230
5231macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
5232 assert(framebuffer in State.Framebuffers)
5233 return State.Framebuffers[framebuffer]
5234}
5235
5236macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
5237 assert(renderPass in State.RenderPasses)
5238 return State.RenderPasses[renderPass]
5239}
5240
5241macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
5242 assert(pipelineCache in State.PipelineCaches)
5243 return State.PipelineCaches[pipelineCache]
5244}
5245
5246macro ref!CmdPoolObject GetCmdPool(VkCmdPool cmdPool) {
5247 assert(cmdPool in State.CmdPools)
5248 return State.CmdPools[cmdPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07005249}
Michael Lentine88594d72015-11-12 12:49:45 -08005250
Jesse Hall1356b0d2015-11-23 17:24:58 -08005251macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) {
5252 assert(surface in State.Surfaces)
5253 return State.Surfaces[surface]
5254}
5255
Michael Lentine88594d72015-11-12 12:49:45 -08005256macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) {
5257 assert(swapchain in State.Swapchains)
5258 return State.Swapchains[swapchain]
5259}
Jesse Halld8bade02015-11-24 10:24:18 -08005260
5261macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) {
5262 return as!VkQueueFlags(as!u32(flags) | as!u32(bit))
5263}