blob: d2a15b527237122ccb5497e8bc09747ec8cb89f9 [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 Halldc6d36c2015-11-29 19:12:15 -080030define VERSION_MINOR 192
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 {
173 VK_IMAGE_TILING_LINEAR = 0x00000000,
174 VK_IMAGE_TILING_OPTIMAL = 0x00000001,
175}
176
177enum VkImageViewType {
178 VK_IMAGE_VIEW_TYPE_1D = 0x00000000,
179 VK_IMAGE_VIEW_TYPE_2D = 0x00000001,
180 VK_IMAGE_VIEW_TYPE_3D = 0x00000002,
181 VK_IMAGE_VIEW_TYPE_CUBE = 0x00000003,
182 VK_IMAGE_VIEW_TYPE_1D_ARRAY = 0x00000004,
183 VK_IMAGE_VIEW_TYPE_2D_ARRAY = 0x00000005,
184 VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 0x00000006,
185}
186
Jesse Halld27f6aa2015-08-15 17:58:48 -0700187enum VkCmdBufferLevel {
188 VK_CMD_BUFFER_LEVEL_PRIMARY = 0x00000000,
189 VK_CMD_BUFFER_LEVEL_SECONDARY = 0x00000001,
190}
191
192enum VkChannelSwizzle {
193 VK_CHANNEL_SWIZZLE_ZERO = 0x00000000,
194 VK_CHANNEL_SWIZZLE_ONE = 0x00000001,
195 VK_CHANNEL_SWIZZLE_R = 0x00000002,
196 VK_CHANNEL_SWIZZLE_G = 0x00000003,
197 VK_CHANNEL_SWIZZLE_B = 0x00000004,
198 VK_CHANNEL_SWIZZLE_A = 0x00000005,
199}
200
201enum VkDescriptorType {
202 VK_DESCRIPTOR_TYPE_SAMPLER = 0x00000000,
203 VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 0x00000001,
204 VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 0x00000002,
205 VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 0x00000003,
206 VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 0x00000004,
207 VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 0x00000005,
208 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 0x00000006,
209 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 0x00000007,
210 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 0x00000008,
211 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 0x00000009,
212 VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 0x0000000a,
213}
214
Jesse Halld27f6aa2015-08-15 17:58:48 -0700215enum VkQueryType {
216 VK_QUERY_TYPE_OCCLUSION = 0x00000000,
217 VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, /// Optional
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800218 VK_QUERY_TYPE_TIMESTAMP = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700219}
220
Jesse Halld27f6aa2015-08-15 17:58:48 -0700221enum VkBorderColor {
222 VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0x00000000,
223 VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 0x00000001,
224 VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 0x00000002,
225 VK_BORDER_COLOR_INT_OPAQUE_BLACK = 0x00000003,
226 VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 0x00000004,
227 VK_BORDER_COLOR_INT_OPAQUE_WHITE = 0x00000005,
228}
229
230enum VkPipelineBindPoint {
231 VK_PIPELINE_BIND_POINT_COMPUTE = 0x00000000,
232 VK_PIPELINE_BIND_POINT_GRAPHICS = 0x00000001,
233}
234
235enum VkPrimitiveTopology {
236 VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0x00000000,
237 VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 0x00000001,
238 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 0x00000002,
239 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 0x00000003,
240 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 0x00000004,
241 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 0x00000005,
242 VK_PRIMITIVE_TOPOLOGY_LINE_LIST_ADJ = 0x00000006,
243 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_ADJ = 0x00000007,
244 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ = 0x00000008,
245 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJ = 0x00000009,
246 VK_PRIMITIVE_TOPOLOGY_PATCH = 0x0000000a,
247}
248
249enum VkSharingMode {
250 VK_SHARING_MODE_EXCLUSIVE = 0x00000000,
251 VK_SHARING_MODE_CONCURRENT = 0x00000001,
252}
253
254enum VkIndexType {
255 VK_INDEX_TYPE_UINT16 = 0x00000000,
256 VK_INDEX_TYPE_UINT32 = 0x00000001,
257}
258
Jesse Hall23ff73f2015-11-29 14:36:39 -0800259enum VkFilter {
260 VK_FILTER_NEAREST = 0x00000000,
261 VK_FILTER_LINEAR = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700262}
263
Jesse Hall23ff73f2015-11-29 14:36:39 -0800264enum VkSamplerMipmapMode {
265 VK_SAMPLER_MIPMAP_MODE_BASE = 0x00000000, /// Always choose base level
266 VK_SAMPLER_MIPMAP_MODE_NEAREST = 0x00000001, /// Choose nearest mip level
267 VK_SAMPLER_MIPMAP_MODE_LINEAR = 0x00000002, /// Linear filter between mip levels
Jesse Halld27f6aa2015-08-15 17:58:48 -0700268}
269
Jesse Hall23ff73f2015-11-29 14:36:39 -0800270enum VkSamplerAddressMode {
271 VK_SAMPLER_ADDRESS_MODE_WRAP = 0x00000000,
272 VK_SAMPLER_ADDRESS_MODE_MIRROR = 0x00000001,
273 VK_SAMPLER_ADDRESS_MODE_CLAMP = 0x00000002,
274 VK_SAMPLER_ADDRESS_MODE_MIRROR_ONCE = 0x00000003,
275 VK_SAMPLER_ADDRESS_MODE_CLAMP_BORDER = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700276}
277
278enum VkCompareOp {
279 VK_COMPARE_OP_NEVER = 0x00000000,
280 VK_COMPARE_OP_LESS = 0x00000001,
281 VK_COMPARE_OP_EQUAL = 0x00000002,
282 VK_COMPARE_OP_LESS_EQUAL = 0x00000003,
283 VK_COMPARE_OP_GREATER = 0x00000004,
284 VK_COMPARE_OP_NOT_EQUAL = 0x00000005,
285 VK_COMPARE_OP_GREATER_EQUAL = 0x00000006,
286 VK_COMPARE_OP_ALWAYS = 0x00000007,
287}
288
289enum VkFillMode {
290 VK_FILL_MODE_POINTS = 0x00000000,
291 VK_FILL_MODE_WIREFRAME = 0x00000001,
292 VK_FILL_MODE_SOLID = 0x00000002,
293}
294
295enum VkCullMode {
296 VK_CULL_MODE_NONE = 0x00000000,
297 VK_CULL_MODE_FRONT = 0x00000001,
298 VK_CULL_MODE_BACK = 0x00000002,
299 VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
300}
301
302enum VkFrontFace {
303 VK_FRONT_FACE_CCW = 0x00000000,
304 VK_FRONT_FACE_CW = 0x00000001,
305}
306
307enum VkBlend {
308 VK_BLEND_ZERO = 0x00000000,
309 VK_BLEND_ONE = 0x00000001,
310 VK_BLEND_SRC_COLOR = 0x00000002,
311 VK_BLEND_ONE_MINUS_SRC_COLOR = 0x00000003,
312 VK_BLEND_DEST_COLOR = 0x00000004,
313 VK_BLEND_ONE_MINUS_DEST_COLOR = 0x00000005,
314 VK_BLEND_SRC_ALPHA = 0x00000006,
315 VK_BLEND_ONE_MINUS_SRC_ALPHA = 0x00000007,
316 VK_BLEND_DEST_ALPHA = 0x00000008,
317 VK_BLEND_ONE_MINUS_DEST_ALPHA = 0x00000009,
318 VK_BLEND_CONSTANT_COLOR = 0x0000000a,
319 VK_BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0000000b,
320 VK_BLEND_CONSTANT_ALPHA = 0x0000000c,
321 VK_BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x0000000d,
322 VK_BLEND_SRC_ALPHA_SATURATE = 0x0000000e,
323 VK_BLEND_SRC1_COLOR = 0x0000000f,
324 VK_BLEND_ONE_MINUS_SRC1_COLOR = 0x00000010,
325 VK_BLEND_SRC1_ALPHA = 0x00000011,
326 VK_BLEND_ONE_MINUS_SRC1_ALPHA = 0x00000012,
327}
328
329enum VkBlendOp {
330 VK_BLEND_OP_ADD = 0x00000000,
331 VK_BLEND_OP_SUBTRACT = 0x00000001,
332 VK_BLEND_OP_REVERSE_SUBTRACT = 0x00000002,
333 VK_BLEND_OP_MIN = 0x00000003,
334 VK_BLEND_OP_MAX = 0x00000004,
335}
336
337enum VkStencilOp {
338 VK_STENCIL_OP_KEEP = 0x00000000,
339 VK_STENCIL_OP_ZERO = 0x00000001,
340 VK_STENCIL_OP_REPLACE = 0x00000002,
341 VK_STENCIL_OP_INC_CLAMP = 0x00000003,
342 VK_STENCIL_OP_DEC_CLAMP = 0x00000004,
343 VK_STENCIL_OP_INVERT = 0x00000005,
344 VK_STENCIL_OP_INC_WRAP = 0x00000006,
345 VK_STENCIL_OP_DEC_WRAP = 0x00000007,
346}
347
348enum VkLogicOp {
349 VK_LOGIC_OP_CLEAR = 0x00000000,
350 VK_LOGIC_OP_AND = 0x00000001,
351 VK_LOGIC_OP_AND_REVERSE = 0x00000002,
352 VK_LOGIC_OP_COPY = 0x00000003,
353 VK_LOGIC_OP_AND_INVERTED = 0x00000004,
354 VK_LOGIC_OP_NOOP = 0x00000005,
355 VK_LOGIC_OP_XOR = 0x00000006,
356 VK_LOGIC_OP_OR = 0x00000007,
357 VK_LOGIC_OP_NOR = 0x00000008,
358 VK_LOGIC_OP_EQUIV = 0x00000009,
359 VK_LOGIC_OP_INVERT = 0x0000000a,
360 VK_LOGIC_OP_OR_REVERSE = 0x0000000b,
361 VK_LOGIC_OP_COPY_INVERTED = 0x0000000c,
362 VK_LOGIC_OP_OR_INVERTED = 0x0000000d,
363 VK_LOGIC_OP_NAND = 0x0000000e,
364 VK_LOGIC_OP_SET = 0x0000000f,
365}
366
Jesse Hall03b6fe12015-11-24 12:44:21 -0800367enum VkSystemAllocScope {
368 VK_SYSTEM_ALLOC_SCOPE_FUNCTION = 0x00000000,
369 VK_SYSTEM_ALLOC_SCOPE_OBJECT = 0x00000001,
370 VK_SYSTEM_ALLOC_SCOPE_CACHE = 0x00000002,
371 VK_SYSTEM_ALLOC_SCOPE_DEVICE = 0x00000003,
372 VK_SYSTEM_ALLOC_SCOPE_INSTANCE = 0x00000004,
373}
374
375enum VkInternalAllocType {
376 VK_INTERNAL_ALLOC_TYPE_EXECUTABLE = 0x00000000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700377}
378
379enum VkPhysicalDeviceType {
380 VK_PHYSICAL_DEVICE_TYPE_OTHER = 0x00000000,
381 VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 0x00000001,
382 VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 0x00000002,
383 VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 0x00000003,
384 VK_PHYSICAL_DEVICE_TYPE_CPU = 0x00000004,
385}
386
387enum VkVertexInputStepRate {
388 VK_VERTEX_INPUT_STEP_RATE_VERTEX = 0x00000000,
389 VK_VERTEX_INPUT_STEP_RATE_INSTANCE = 0x00000001,
390}
391
392/// Vulkan format definitions
393enum VkFormat {
394 VK_FORMAT_UNDEFINED = 0x00000000,
395 VK_FORMAT_R4G4_UNORM = 0x00000001,
396 VK_FORMAT_R4G4_USCALED = 0x00000002,
397 VK_FORMAT_R4G4B4A4_UNORM = 0x00000003,
398 VK_FORMAT_R4G4B4A4_USCALED = 0x00000004,
399 VK_FORMAT_R5G6B5_UNORM = 0x00000005,
400 VK_FORMAT_R5G6B5_USCALED = 0x00000006,
401 VK_FORMAT_R5G5B5A1_UNORM = 0x00000007,
402 VK_FORMAT_R5G5B5A1_USCALED = 0x00000008,
403 VK_FORMAT_R8_UNORM = 0x00000009,
404 VK_FORMAT_R8_SNORM = 0x0000000A,
405 VK_FORMAT_R8_USCALED = 0x0000000B,
406 VK_FORMAT_R8_SSCALED = 0x0000000C,
407 VK_FORMAT_R8_UINT = 0x0000000D,
408 VK_FORMAT_R8_SINT = 0x0000000E,
409 VK_FORMAT_R8_SRGB = 0x0000000F,
410 VK_FORMAT_R8G8_UNORM = 0x00000010,
411 VK_FORMAT_R8G8_SNORM = 0x00000011,
412 VK_FORMAT_R8G8_USCALED = 0x00000012,
413 VK_FORMAT_R8G8_SSCALED = 0x00000013,
414 VK_FORMAT_R8G8_UINT = 0x00000014,
415 VK_FORMAT_R8G8_SINT = 0x00000015,
416 VK_FORMAT_R8G8_SRGB = 0x00000016,
417 VK_FORMAT_R8G8B8_UNORM = 0x00000017,
418 VK_FORMAT_R8G8B8_SNORM = 0x00000018,
419 VK_FORMAT_R8G8B8_USCALED = 0x00000019,
420 VK_FORMAT_R8G8B8_SSCALED = 0x0000001A,
421 VK_FORMAT_R8G8B8_UINT = 0x0000001B,
422 VK_FORMAT_R8G8B8_SINT = 0x0000001C,
423 VK_FORMAT_R8G8B8_SRGB = 0x0000001D,
424 VK_FORMAT_R8G8B8A8_UNORM = 0x0000001E,
425 VK_FORMAT_R8G8B8A8_SNORM = 0x0000001F,
426 VK_FORMAT_R8G8B8A8_USCALED = 0x00000020,
427 VK_FORMAT_R8G8B8A8_SSCALED = 0x00000021,
428 VK_FORMAT_R8G8B8A8_UINT = 0x00000022,
429 VK_FORMAT_R8G8B8A8_SINT = 0x00000023,
430 VK_FORMAT_R8G8B8A8_SRGB = 0x00000024,
431 VK_FORMAT_R10G10B10A2_UNORM = 0x00000025,
432 VK_FORMAT_R10G10B10A2_SNORM = 0x00000026,
433 VK_FORMAT_R10G10B10A2_USCALED = 0x00000027,
434 VK_FORMAT_R10G10B10A2_SSCALED = 0x00000028,
435 VK_FORMAT_R10G10B10A2_UINT = 0x00000029,
436 VK_FORMAT_R10G10B10A2_SINT = 0x0000002A,
437 VK_FORMAT_R16_UNORM = 0x0000002B,
438 VK_FORMAT_R16_SNORM = 0x0000002C,
439 VK_FORMAT_R16_USCALED = 0x0000002D,
440 VK_FORMAT_R16_SSCALED = 0x0000002E,
441 VK_FORMAT_R16_UINT = 0x0000002F,
442 VK_FORMAT_R16_SINT = 0x00000030,
443 VK_FORMAT_R16_SFLOAT = 0x00000031,
444 VK_FORMAT_R16G16_UNORM = 0x00000032,
445 VK_FORMAT_R16G16_SNORM = 0x00000033,
446 VK_FORMAT_R16G16_USCALED = 0x00000034,
447 VK_FORMAT_R16G16_SSCALED = 0x00000035,
448 VK_FORMAT_R16G16_UINT = 0x00000036,
449 VK_FORMAT_R16G16_SINT = 0x00000037,
450 VK_FORMAT_R16G16_SFLOAT = 0x00000038,
451 VK_FORMAT_R16G16B16_UNORM = 0x00000039,
452 VK_FORMAT_R16G16B16_SNORM = 0x0000003A,
453 VK_FORMAT_R16G16B16_USCALED = 0x0000003B,
454 VK_FORMAT_R16G16B16_SSCALED = 0x0000003C,
455 VK_FORMAT_R16G16B16_UINT = 0x0000003D,
456 VK_FORMAT_R16G16B16_SINT = 0x0000003E,
457 VK_FORMAT_R16G16B16_SFLOAT = 0x0000003F,
458 VK_FORMAT_R16G16B16A16_UNORM = 0x00000040,
459 VK_FORMAT_R16G16B16A16_SNORM = 0x00000041,
460 VK_FORMAT_R16G16B16A16_USCALED = 0x00000042,
461 VK_FORMAT_R16G16B16A16_SSCALED = 0x00000043,
462 VK_FORMAT_R16G16B16A16_UINT = 0x00000044,
463 VK_FORMAT_R16G16B16A16_SINT = 0x00000045,
464 VK_FORMAT_R16G16B16A16_SFLOAT = 0x00000046,
465 VK_FORMAT_R32_UINT = 0x00000047,
466 VK_FORMAT_R32_SINT = 0x00000048,
467 VK_FORMAT_R32_SFLOAT = 0x00000049,
468 VK_FORMAT_R32G32_UINT = 0x0000004A,
469 VK_FORMAT_R32G32_SINT = 0x0000004B,
470 VK_FORMAT_R32G32_SFLOAT = 0x0000004C,
471 VK_FORMAT_R32G32B32_UINT = 0x0000004D,
472 VK_FORMAT_R32G32B32_SINT = 0x0000004E,
473 VK_FORMAT_R32G32B32_SFLOAT = 0x0000004F,
474 VK_FORMAT_R32G32B32A32_UINT = 0x00000050,
475 VK_FORMAT_R32G32B32A32_SINT = 0x00000051,
476 VK_FORMAT_R32G32B32A32_SFLOAT = 0x00000052,
477 VK_FORMAT_R64_SFLOAT = 0x00000053,
478 VK_FORMAT_R64G64_SFLOAT = 0x00000054,
479 VK_FORMAT_R64G64B64_SFLOAT = 0x00000055,
480 VK_FORMAT_R64G64B64A64_SFLOAT = 0x00000056,
481 VK_FORMAT_R11G11B10_UFLOAT = 0x00000057,
482 VK_FORMAT_R9G9B9E5_UFLOAT = 0x00000058,
483 VK_FORMAT_D16_UNORM = 0x00000059,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700484 VK_FORMAT_D24_UNORM_X8 = 0x0000005A,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700485 VK_FORMAT_D32_SFLOAT = 0x0000005B,
486 VK_FORMAT_S8_UINT = 0x0000005C,
487 VK_FORMAT_D16_UNORM_S8_UINT = 0x0000005D,
488 VK_FORMAT_D24_UNORM_S8_UINT = 0x0000005E,
489 VK_FORMAT_D32_SFLOAT_S8_UINT = 0x0000005F,
490 VK_FORMAT_BC1_RGB_UNORM = 0x00000060,
491 VK_FORMAT_BC1_RGB_SRGB = 0x00000061,
492 VK_FORMAT_BC1_RGBA_UNORM = 0x00000062,
493 VK_FORMAT_BC1_RGBA_SRGB = 0x00000063,
494 VK_FORMAT_BC2_UNORM = 0x00000064,
495 VK_FORMAT_BC2_SRGB = 0x00000065,
496 VK_FORMAT_BC3_UNORM = 0x00000066,
497 VK_FORMAT_BC3_SRGB = 0x00000067,
498 VK_FORMAT_BC4_UNORM = 0x00000068,
499 VK_FORMAT_BC4_SNORM = 0x00000069,
500 VK_FORMAT_BC5_UNORM = 0x0000006A,
501 VK_FORMAT_BC5_SNORM = 0x0000006B,
502 VK_FORMAT_BC6H_UFLOAT = 0x0000006C,
503 VK_FORMAT_BC6H_SFLOAT = 0x0000006D,
504 VK_FORMAT_BC7_UNORM = 0x0000006E,
505 VK_FORMAT_BC7_SRGB = 0x0000006F,
506 VK_FORMAT_ETC2_R8G8B8_UNORM = 0x00000070,
507 VK_FORMAT_ETC2_R8G8B8_SRGB = 0x00000071,
508 VK_FORMAT_ETC2_R8G8B8A1_UNORM = 0x00000072,
509 VK_FORMAT_ETC2_R8G8B8A1_SRGB = 0x00000073,
510 VK_FORMAT_ETC2_R8G8B8A8_UNORM = 0x00000074,
511 VK_FORMAT_ETC2_R8G8B8A8_SRGB = 0x00000075,
512 VK_FORMAT_EAC_R11_UNORM = 0x00000076,
513 VK_FORMAT_EAC_R11_SNORM = 0x00000077,
514 VK_FORMAT_EAC_R11G11_UNORM = 0x00000078,
515 VK_FORMAT_EAC_R11G11_SNORM = 0x00000079,
516 VK_FORMAT_ASTC_4x4_UNORM = 0x0000007A,
517 VK_FORMAT_ASTC_4x4_SRGB = 0x0000007B,
518 VK_FORMAT_ASTC_5x4_UNORM = 0x0000007C,
519 VK_FORMAT_ASTC_5x4_SRGB = 0x0000007D,
520 VK_FORMAT_ASTC_5x5_UNORM = 0x0000007E,
521 VK_FORMAT_ASTC_5x5_SRGB = 0x0000007F,
522 VK_FORMAT_ASTC_6x5_UNORM = 0x00000080,
523 VK_FORMAT_ASTC_6x5_SRGB = 0x00000081,
524 VK_FORMAT_ASTC_6x6_UNORM = 0x00000082,
525 VK_FORMAT_ASTC_6x6_SRGB = 0x00000083,
526 VK_FORMAT_ASTC_8x5_UNORM = 0x00000084,
527 VK_FORMAT_ASTC_8x5_SRGB = 0x00000085,
528 VK_FORMAT_ASTC_8x6_UNORM = 0x00000086,
529 VK_FORMAT_ASTC_8x6_SRGB = 0x00000087,
530 VK_FORMAT_ASTC_8x8_UNORM = 0x00000088,
531 VK_FORMAT_ASTC_8x8_SRGB = 0x00000089,
532 VK_FORMAT_ASTC_10x5_UNORM = 0x0000008A,
533 VK_FORMAT_ASTC_10x5_SRGB = 0x0000008B,
534 VK_FORMAT_ASTC_10x6_UNORM = 0x0000008C,
535 VK_FORMAT_ASTC_10x6_SRGB = 0x0000008D,
536 VK_FORMAT_ASTC_10x8_UNORM = 0x0000008E,
537 VK_FORMAT_ASTC_10x8_SRGB = 0x0000008F,
538 VK_FORMAT_ASTC_10x10_UNORM = 0x00000090,
539 VK_FORMAT_ASTC_10x10_SRGB = 0x00000091,
540 VK_FORMAT_ASTC_12x10_UNORM = 0x00000092,
541 VK_FORMAT_ASTC_12x10_SRGB = 0x00000093,
542 VK_FORMAT_ASTC_12x12_UNORM = 0x00000094,
543 VK_FORMAT_ASTC_12x12_SRGB = 0x00000095,
544 VK_FORMAT_B4G4R4A4_UNORM = 0x00000096,
545 VK_FORMAT_B5G5R5A1_UNORM = 0x00000097,
546 VK_FORMAT_B5G6R5_UNORM = 0x00000098,
547 VK_FORMAT_B5G6R5_USCALED = 0x00000099,
548 VK_FORMAT_B8G8R8_UNORM = 0x0000009A,
549 VK_FORMAT_B8G8R8_SNORM = 0x0000009B,
550 VK_FORMAT_B8G8R8_USCALED = 0x0000009C,
551 VK_FORMAT_B8G8R8_SSCALED = 0x0000009D,
552 VK_FORMAT_B8G8R8_UINT = 0x0000009E,
553 VK_FORMAT_B8G8R8_SINT = 0x0000009F,
554 VK_FORMAT_B8G8R8_SRGB = 0x000000A0,
555 VK_FORMAT_B8G8R8A8_UNORM = 0x000000A1,
556 VK_FORMAT_B8G8R8A8_SNORM = 0x000000A2,
557 VK_FORMAT_B8G8R8A8_USCALED = 0x000000A3,
558 VK_FORMAT_B8G8R8A8_SSCALED = 0x000000A4,
559 VK_FORMAT_B8G8R8A8_UINT = 0x000000A5,
560 VK_FORMAT_B8G8R8A8_SINT = 0x000000A6,
561 VK_FORMAT_B8G8R8A8_SRGB = 0x000000A7,
562 VK_FORMAT_B10G10R10A2_UNORM = 0x000000A8,
563 VK_FORMAT_B10G10R10A2_SNORM = 0x000000A9,
564 VK_FORMAT_B10G10R10A2_USCALED = 0x000000AA,
565 VK_FORMAT_B10G10R10A2_SSCALED = 0x000000AB,
566 VK_FORMAT_B10G10R10A2_UINT = 0x000000AC,
567 VK_FORMAT_B10G10R10A2_SINT = 0x000000AD,
568}
569
Jesse Halld27f6aa2015-08-15 17:58:48 -0700570/// Structure type enumerant
571enum VkStructureType {
572 VK_STRUCTURE_TYPE_APPLICATION_INFO = 0,
573 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 1,
574 VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO = 2,
575 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 3,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700576 VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 4,
577 VK_STRUCTURE_TYPE_SHADER_CREATE_INFO = 5,
578 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 6,
579 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 7,
580 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 8,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800581 VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO = 9,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700582 VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10,
583 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 11,
584 VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 12,
585 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 13,
586 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 14,
587 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 15,
588 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 16,
589 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 17,
590 VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 18,
591 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 19,
592 VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO = 20,
593 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 21,
594 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 22,
595 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 23,
596 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 24,
597 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 25,
598 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 26,
599 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 27,
600 VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO = 28,
601 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 29,
602 VK_STRUCTURE_TYPE_MEMORY_BARRIER = 30,
603 VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 31,
604 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 32,
605 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33,
606 VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 34,
607 VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 35,
608 VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 36,
609 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 37,
610 VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 38,
611 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 39,
612 VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION = 40,
613 VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION = 41,
614 VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY = 42,
615 VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43,
616 VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO = 44,
617 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 45,
618 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 46,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800619 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO = 47,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800620 VK_STRUCTURE_TYPE_SUBMIT_INFO = 48,
621 VK_STRUCTURE_TYPE_LAYER_INSTANCE_CREATE_INFO = 49,
622 VK_STRUCTURE_TYPE_LAYER_DEVICE_CREATE_INFO = 50,
Jesse Halla6429252015-11-29 18:59:42 -0800623 VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 51,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800624
625 //@extension("VK_EXT_KHR_swapchain")
626 VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 0xc0000801,
627
628 //@extension("VK_EXT_KHR_display")
629 VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 0xc0000c00,
Jesse Halla6429252015-11-29 18:59:42 -0800630 VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 0xc0000c01,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800631
632 //@extension("VK_EXT_KHR_display_swapchain")
633 VK_STRUCTURE_TYPE_DISPLAY_SWAPCHAIN_CREATE_INFO_KHR = 0xc0001000,
634 VK_STRUCTURE_TYPE_DISPLAY_DISPLAY_PRESENT_INFO_KHR = 0xc0001001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700635}
636
637enum VkRenderPassContents {
638 VK_RENDER_PASS_CONTENTS_INLINE = 0x00000000,
639 VK_RENDER_PASS_CONTENTS_SECONDARY_CMD_BUFFERS = 0x00000001,
640}
641
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700642@lastUnused(-8)
Jesse Halld27f6aa2015-08-15 17:58:48 -0700643/// Error and return codes
644enum VkResult {
645 // Return codes for successful operation execution (positive values)
646 VK_SUCCESS = 0x00000000,
Jesse Halla15a4bf2015-11-19 22:48:02 -0800647 VK_NOT_READY = 0x00000001,
648 VK_TIMEOUT = 0x00000002,
649 VK_EVENT_SET = 0x00000003,
650 VK_EVENT_RESET = 0x00000004,
651 VK_INCOMPLETE = 0x00000005,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700652
Jesse Hall1356b0d2015-11-23 17:24:58 -0800653 //@extension("VK_EXT_KHR_swapchain")
654 VK_SUBOPTIMAL_KHR = 0x40000403,
655
Jesse Halld27f6aa2015-08-15 17:58:48 -0700656 // Error codes (negative values)
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700657 VK_ERROR_OUT_OF_HOST_MEMORY = 0xFFFFFFFF,
658 VK_ERROR_OUT_OF_DEVICE_MEMORY = 0xFFFFFFFE,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700659 VK_ERROR_INITIALIZATION_FAILED = 0xFFFFFFFD,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700660 VK_ERROR_DEVICE_LOST = 0xFFFFFFFC,
661 VK_ERROR_MEMORY_MAP_FAILED = 0xFFFFFFFB,
662 VK_ERROR_LAYER_NOT_PRESENT = 0xFFFFFFFA,
663 VK_ERROR_EXTENSION_NOT_PRESENT = 0xFFFFFFF9,
Jesse Hall606a54e2015-11-19 22:17:28 -0800664 VK_ERROR_FEATURE_NOT_PRESENT = 0xFFFFFFF8,
665 VK_ERROR_INCOMPATIBLE_DRIVER = 0xFFFFFFF7,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800666
Jesse Halla6429252015-11-29 18:59:42 -0800667 //@extension("VK_EXT_KHR_surface")
668 VK_ERROR_SURFACE_LOST_KHR = 0xC0000400,
669
Jesse Hall1356b0d2015-11-23 17:24:58 -0800670 //@extension("VK_EXT_KHR_swapchain")
671 VK_ERROR_OUT_OF_DATE_KHR = 0xC0000804,
672
673 //@extension("VK_EXT_KHR_display_swapchain")
674 VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = 0xC0001002,
675
676 //@extension("VK_EXT_KHR_android_surface")
677 VK_ERROR_INVALID_ANDROID_WINDOW_KHR = 0xC002400,
678 VK_ERROR_ANDROID_WINDOW_IN_USE_KHR = 0xC002401,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700679}
680
681enum VkDynamicState {
682 VK_DYNAMIC_STATE_VIEWPORT = 0x00000000,
683 VK_DYNAMIC_STATE_SCISSOR = 0x00000001,
684 VK_DYNAMIC_STATE_LINE_WIDTH = 0x00000002,
685 VK_DYNAMIC_STATE_DEPTH_BIAS = 0x00000003,
686 VK_DYNAMIC_STATE_BLEND_CONSTANTS = 0x00000004,
687 VK_DYNAMIC_STATE_DEPTH_BOUNDS = 0x00000005,
688 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 0x00000006,
689 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 0x00000007,
690 VK_DYNAMIC_STATE_STENCIL_REFERENCE = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700691}
692
Jesse Hall1356b0d2015-11-23 17:24:58 -0800693@extension("VK_EXT_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -0800694enum VkSurfaceTransformKHR {
695 VK_SURFACE_TRANSFORM_NONE_KHR = 0x00000000,
696 VK_SURFACE_TRANSFORM_ROT90_KHR = 0x00000001,
697 VK_SURFACE_TRANSFORM_ROT180_KHR = 0x00000002,
698 VK_SURFACE_TRANSFORM_ROT270_KHR = 0x00000003,
699 VK_SURFACE_TRANSFORM_HMIRROR_KHR = 0x00000004,
700 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_KHR = 0x00000005,
701 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_KHR = 0x00000006,
702 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_KHR = 0x00000007,
703 VK_SURFACE_TRANSFORM_INHERIT_KHR = 0x00000008,
704}
705
706@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -0800707enum VkPresentModeKHR {
708 VK_PRESENT_MODE_IMMEDIATE_KHR = 0x00000000,
709 VK_PRESENT_MODE_MAILBOX_KHR = 0x00000001,
710 VK_PRESENT_MODE_FIFO_KHR = 0x00000002,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800711 VK_PRESENT_MODE_FIFO_RELAXED_KHR = 0x00000003,
Michael Lentine88594d72015-11-12 12:49:45 -0800712}
713
Jesse Hall1356b0d2015-11-23 17:24:58 -0800714@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -0800715enum VkColorSpaceKHR {
716 VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000,
717}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700718
719/////////////////
720// Bitfields //
721/////////////////
722
Jesse Halld27f6aa2015-08-15 17:58:48 -0700723/// Queue capabilities
Jesse Halld8bade02015-11-24 10:24:18 -0800724type VkFlags VkQueueFlags
725bitfield VkQueueFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700726 VK_QUEUE_GRAPHICS_BIT = 0x00000001, /// Queue supports graphics operations
727 VK_QUEUE_COMPUTE_BIT = 0x00000002, /// Queue supports compute operations
728 VK_QUEUE_DMA_BIT = 0x00000004, /// Queue supports DMA operations
729 VK_QUEUE_SPARSE_MEMMGR_BIT = 0x00000008, /// Queue supports sparse resource memory management operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700730}
731
732/// Memory properties passed into vkAllocMemory().
Jesse Halld8bade02015-11-24 10:24:18 -0800733type VkFlags VkMemoryPropertyFlags
734bitfield VkMemoryPropertyFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700735 VK_MEMORY_PROPERTY_DEVICE_ONLY = 0x00000000, /// If otherwise stated, then allocate memory on device
736 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000001, /// Memory should be mappable by host
737 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
738 /// vkInvalidateMappedMemoryRanges must be used flush/invalidate host cache
739 VK_MEMORY_PROPERTY_HOST_UNCACHED_BIT = 0x00000004, /// Memory should not be cached by the host
Jesse Hallacfa5342015-11-19 21:51:33 -0800740 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 -0700741}
742
743/// Memory heap flags
Jesse Halld8bade02015-11-24 10:24:18 -0800744type VkFlags VkMemoryHeapFlags
745bitfield VkMemoryHeapFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700746 VK_MEMORY_HEAP_HOST_LOCAL_BIT = 0x00000001, /// If set, heap represents host memory
Jesse Halld27f6aa2015-08-15 17:58:48 -0700747}
748
749/// Memory output flags passed to resource transition commands
Jesse Halld8bade02015-11-24 10:24:18 -0800750type VkFlags VkMemoryOutputFlags
751bitfield VkMemoryOutputFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700752 VK_MEMORY_OUTPUT_HOST_WRITE_BIT = 0x00000001, /// Controls output coherency of host writes
753 VK_MEMORY_OUTPUT_SHADER_WRITE_BIT = 0x00000002, /// Controls output coherency of generic shader writes
754 VK_MEMORY_OUTPUT_COLOR_ATTACHMENT_BIT = 0x00000004, /// Controls output coherency of color attachment writes
755 VK_MEMORY_OUTPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000008, /// Controls output coherency of depth/stencil attachment writes
756 VK_MEMORY_OUTPUT_TRANSFER_BIT = 0x00000010, /// Controls output coherency of transfer operations
757}
758
759/// Memory input flags passed to resource transition commands
Jesse Halld8bade02015-11-24 10:24:18 -0800760type VkFlags VkMemoryInputFlags
761bitfield VkMemoryInputFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700762 VK_MEMORY_INPUT_HOST_READ_BIT = 0x00000001, /// Controls input coherency of host reads
763 VK_MEMORY_INPUT_INDIRECT_COMMAND_BIT = 0x00000002, /// Controls input coherency of indirect command reads
764 VK_MEMORY_INPUT_INDEX_FETCH_BIT = 0x00000004, /// Controls input coherency of index fetches
765 VK_MEMORY_INPUT_VERTEX_ATTRIBUTE_FETCH_BIT = 0x00000008, /// Controls input coherency of vertex attribute fetches
766 VK_MEMORY_INPUT_UNIFORM_READ_BIT = 0x00000010, /// Controls input coherency of uniform buffer reads
767 VK_MEMORY_INPUT_SHADER_READ_BIT = 0x00000020, /// Controls input coherency of generic shader reads
768 VK_MEMORY_INPUT_COLOR_ATTACHMENT_BIT = 0x00000040, /// Controls input coherency of color attachment reads
769 VK_MEMORY_INPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000080, /// Controls input coherency of depth/stencil attachment reads
770 VK_MEMORY_INPUT_INPUT_ATTACHMENT_BIT = 0x00000100, /// Controls input coherency of input attachment reads
771 VK_MEMORY_INPUT_TRANSFER_BIT = 0x00000200, /// Controls input coherency of transfer operations
772}
773
774/// Buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800775type VkFlags VkBufferUsageFlags
776bitfield VkBufferUsageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700777 VK_BUFFER_USAGE_TRANSFER_SOURCE_BIT = 0x00000001, /// Can be used as a source of transfer operations
778 VK_BUFFER_USAGE_TRANSFER_DESTINATION_BIT = 0x00000002, /// Can be used as a destination of transfer operations
779 VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, /// Can be used as TBO
780 VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, /// Can be used as IBO
781 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, /// Can be used as UBO
782 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, /// Can be used as SSBO
783 VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, /// Can be used as source of fixed function index fetch (index buffer)
784 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, /// Can be used as source of fixed function vertex fetch (VBO)
785 VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, /// Can be the source of indirect parameters (e.g. indirect buffer, parameter buffer)
786}
787
788/// Buffer creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800789type VkFlags VkBufferCreateFlags
790bitfield VkBufferCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700791 VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Buffer should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700792 VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Buffer should support sparse backing with partial residency
793 VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Buffer should support constent data access to physical memory blocks mapped into multiple locations of sparse buffers
794}
795
796/// Shader stage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800797type VkFlags VkShaderStageFlags
798bitfield VkShaderStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700799 VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
Jesse Hallae38f732015-11-19 21:32:50 -0800800 VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
801 VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700802 VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
803 VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
804 VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
805
806 VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
807}
808
Jesse Hallfbf97b02015-11-20 14:17:03 -0800809/// Descriptor pool create flags
Jesse Halld8bade02015-11-24 10:24:18 -0800810type VkFlags VkDescriptorPoolCreateFlags
811bitfield VkDescriptorPoolCreateFlagBits {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800812 VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
813}
814
815/// Descriptor pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -0800816type VkFlags VkDescriptorPoolResetFlags
Jesse Halla6429252015-11-29 18:59:42 -0800817//bitfield VkDescriptorPoolResetFlagBits {
818//}
Jesse Hallfbf97b02015-11-20 14:17:03 -0800819
Jesse Halld27f6aa2015-08-15 17:58:48 -0700820/// Image usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800821type VkFlags VkImageUsageFlags
822bitfield VkImageUsageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700823 VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT = 0x00000001, /// Can be used as a source of transfer operations
824 VK_IMAGE_USAGE_TRANSFER_DESTINATION_BIT = 0x00000002, /// Can be used as a destination of transfer operations
825 VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, /// Can be sampled from (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
826 VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, /// Can be used as storage image (STORAGE_IMAGE descriptor type)
827 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, /// Can be used as framebuffer color attachment
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700828 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment
Jesse Halld27f6aa2015-08-15 17:58:48 -0700829 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering
830 VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment
831}
832
833/// Image creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800834type VkFlags VkImageCreateFlags
835bitfield VkImageCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700836 VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Image should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700837 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Image should support sparse backing with partial residency
838 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 -0700839 VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, /// Allows image views to have different format than the base image
840 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 -0700841}
842
843/// Framebuffer attachment view creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800844type VkFlags VkImageViewCreateFlags
845bitfield VkImageViewCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700846 VK_IMAGE_VIEW_CREATE_READ_ONLY_DEPTH_BIT = 0x00000001,
847 VK_IMAGE_VIEW_CREATE_READ_ONLY_STENCIL_BIT = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700848}
849
850/// Pipeline creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800851type VkFlags VkPipelineCreateFlags
852bitfield VkPipelineCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700853 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
854 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
855 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
856}
857
858/// Channel flags
Jesse Halld8bade02015-11-24 10:24:18 -0800859type VkFlags VkChannelFlags
860bitfield VkChannelFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700861 VK_CHANNEL_R_BIT = 0x00000001,
862 VK_CHANNEL_G_BIT = 0x00000002,
863 VK_CHANNEL_B_BIT = 0x00000004,
864 VK_CHANNEL_A_BIT = 0x00000008,
865}
866
867/// Fence creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800868type VkFlags VkFenceCreateFlags
869bitfield VkFenceCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700870 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
871}
872
873/// Semaphore creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800874type VkFlags VkSemaphoreCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800875//bitfield VkSemaphoreCreateFlagBits {
876//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700877
878/// Format capability flags
Jesse Halld8bade02015-11-24 10:24:18 -0800879type VkFlags VkFormatFeatureFlags
880bitfield VkFormatFeatureFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700881 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
882 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type)
883 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images
884 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs)
885 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs)
886 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers
887 VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs)
888 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images
889 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images
890 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700891 VK_FORMAT_FEATURE_BLIT_SOURCE_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCmdBlitImage
892 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 -0700893}
894
895/// Query control flags
Jesse Halld8bade02015-11-24 10:24:18 -0800896type VkFlags VkQueryControlFlags
897bitfield VkQueryControlFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700898 VK_QUERY_CONTROL_CONSERVATIVE_BIT = 0x00000001, /// Allow conservative results to be collected by the query
899}
900
901/// Query result flags
Jesse Halld8bade02015-11-24 10:24:18 -0800902type VkFlags VkQueryResultFlags
903bitfield VkQueryResultFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700904 VK_QUERY_RESULT_DEFAULT = 0x00000000, /// Results of the queries are immediately written to the destination buffer as 32-bit values
905 VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values
906 VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy
907 VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written
908 VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available
909}
910
911/// Shader module creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800912type VkFlags VkShaderModuleCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800913//bitfield VkShaderModuleCreateFlagBits {
914//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700915
916/// Shader creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800917type VkFlags VkShaderCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800918//bitfield VkShaderCreateFlagBits {
919//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700920
921/// Event creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800922type VkFlags VkEventCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800923//bitfield VkEventCreateFlagBits {
924//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700925
Jesse Halla15a4bf2015-11-19 22:48:02 -0800926/// Command buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800927type VkFlags VkCmdBufferUsageFlags
928bitfield VkCmdBufferUsageFlagBits {
Jesse Halla15a4bf2015-11-19 22:48:02 -0800929 VK_CMD_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
930 VK_CMD_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
931 VK_CMD_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700932}
933
934/// Pipeline statistics flags
Jesse Halld8bade02015-11-24 10:24:18 -0800935type VkFlags VkQueryPipelineStatisticFlags
936bitfield VkQueryPipelineStatisticFlagBits {
Jesse Hallae38f732015-11-19 21:32:50 -0800937 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, /// Optional
938 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, /// Optional
939 VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, /// Optional
940 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, /// Optional
941 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, /// Optional
942 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, /// Optional
943 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, /// Optional
944 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, /// Optional
945 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, /// Optional
946 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, /// Optional
947 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, /// Optional
Jesse Halld27f6aa2015-08-15 17:58:48 -0700948}
949
950/// Memory mapping flags
Jesse Halld8bade02015-11-24 10:24:18 -0800951type VkFlags VkMemoryMapFlags
Jesse Halla6429252015-11-29 18:59:42 -0800952//bitfield VkMemoryMapFlagBits {
953//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700954
955/// Bitfield of image aspects
Jesse Halld8bade02015-11-24 10:24:18 -0800956type VkFlags VkImageAspectFlags
957bitfield VkImageAspectFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700958 VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
959 VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
960 VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
961 VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
962}
963
964/// Sparse memory bind flags
Jesse Halld8bade02015-11-24 10:24:18 -0800965type VkFlags VkSparseMemoryBindFlags
966bitfield VkSparseMemoryBindFlagBits {
Jesse Halla9bb62b2015-11-21 19:31:56 -0800967 VK_SPARSE_MEMORY_BIND_REPLICATE_BLOCK_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700968}
969
970/// Sparse image memory requirements flags
Jesse Halld8bade02015-11-24 10:24:18 -0800971type VkFlags VkSparseImageFormatFlags
972bitfield VkSparseImageFormatFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700973 VK_SPARSE_IMAGE_FMT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices
974 VK_SPARSE_IMAGE_FMT_ALIGNED_MIP_SIZE_BIT = 0x00000002, /// Image requires mip levels to be an exact multiple of the sparse iamge block size for non-mip-tail levels.
975 VK_SPARSE_IMAGE_FMT_NONSTD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size
976}
977
978/// Pipeline stages
Jesse Halld8bade02015-11-24 10:24:18 -0800979type VkFlags VkPipelineStageFlags
980bitfield VkPipelineStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700981 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed
982 VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch
983 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch
984 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading
Jesse Hallae38f732015-11-19 21:32:50 -0800985 VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading
986 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading
Jesse Halld27f6aa2015-08-15 17:58:48 -0700987 VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading
988 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading
989 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests
990 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests
991 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes
992 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading
993 VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700994 VK_PIPELINE_STAGE_HOST_BIT = 0x00002000, /// Indicates host (CPU) is a source/sink of the dependency
Jesse Halld27f6aa2015-08-15 17:58:48 -0700995
996 VK_PIPELINE_STAGE_ALL_GRAPHICS = 0x000007FF, /// All stages of the graphics pipeline
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700997 VK_PIPELINE_STAGE_ALL_GPU_COMMANDS = 0x00001FFF, /// All graphics, compute, copy, and transition commands
998}
999
1000/// Render pass attachment description flags
Jesse Halld8bade02015-11-24 10:24:18 -08001001type VkFlags VkAttachmentDescriptionFlags
1002bitfield VkAttachmentDescriptionFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001003 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 -07001004}
1005
1006/// Subpass description flags
Jesse Halld8bade02015-11-24 10:24:18 -08001007type VkFlags VkSubpassDescriptionFlags
1008bitfield VkSubpassDescriptionFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001009}
1010
1011/// Command pool creation flags
Jesse Halld8bade02015-11-24 10:24:18 -08001012type VkFlags VkCmdPoolCreateFlags
1013bitfield VkCmdPoolCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001014 VK_CMD_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime
1015 VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually
1016}
1017
1018/// Command pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -08001019type VkFlags VkCmdPoolResetFlags
1020bitfield VkCmdPoolResetFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001021 VK_CMD_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool
Jesse Halld27f6aa2015-08-15 17:58:48 -07001022}
1023
Jesse Halld8bade02015-11-24 10:24:18 -08001024type VkFlags VkCmdBufferResetFlags
1025bitfield VkCmdBufferResetFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001026 VK_CMD_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer
1027}
1028
Jesse Halld8bade02015-11-24 10:24:18 -08001029type VkFlags VkSampleCountFlags
1030bitfield VkSampleCountFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001031 VK_SAMPLE_COUNT_1_BIT = 0x00000001,
1032 VK_SAMPLE_COUNT_2_BIT = 0x00000002,
1033 VK_SAMPLE_COUNT_4_BIT = 0x00000004,
1034 VK_SAMPLE_COUNT_8_BIT = 0x00000008,
1035 VK_SAMPLE_COUNT_16_BIT = 0x00000010,
1036 VK_SAMPLE_COUNT_32_BIT = 0x00000020,
1037 VK_SAMPLE_COUNT_64_BIT = 0x00000040,
1038}
1039
Jesse Halld8bade02015-11-24 10:24:18 -08001040type VkFlags VkStencilFaceFlags
1041bitfield VkStencilFaceFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001042 VK_STENCIL_FACE_NONE = 0x00000000, /// No faces
1043 VK_STENCIL_FACE_FRONT_BIT = 0x00000001, /// Front face
1044 VK_STENCIL_FACE_BACK_BIT = 0x00000002, /// Back face
Jesse Halld27f6aa2015-08-15 17:58:48 -07001045}
1046
Jesse Halla6429252015-11-29 18:59:42 -08001047/// Instance creation flags
1048type VkFlags VkInstanceCreateFlags
1049//bitfield VkInstanceCreateFlagBits {
1050//}
1051
1052/// Device creation flags
1053type VkFlags VkDeviceCreateFlags
1054//bitfield VkDeviceCreateFlagBits {
1055//}
1056
1057/// Device queue creation flags
1058type VkFlags VkDeviceQueueCreateFlags
1059//bitfield VkDeviceQueueCreateFlagBits {
1060//}
1061
1062/// Query pool creation flags
1063type VkFlags VkQueryPoolCreateFlags
1064//bitfield VkQueryPoolCreateFlagBits {
1065//}
1066
1067/// Buffer view creation flags
1068type VkFlags VkBufferViewCreateFlags
1069//bitfield VkBufferViewCreateFlagBits {
1070//}
1071
1072/// Pipeline cache creation flags
1073type VkFlags VkPipelineCacheCreateFlags
1074//bitfield VkPipelineCacheCreateFlagBits {
1075//}
1076
1077/// Pipeline shader stage creation flags
1078type VkFlags VkPipelineShaderStageCreateFlags
1079//bitfield VkPipelineShaderStageCreateFlagBits {
1080//}
1081
1082/// Descriptor set layout creation flags
1083type VkFlags VkDescriptorSetLayoutCreateFlags
1084//bitfield VkDescriptorSetLayoutCreateFlagBits {
1085//}
1086
1087/// Pipeline vertex input state creation flags
1088type VkFlags VkPipelineVertexInputStateCreateFlags
1089//bitfield VkPipelineVertexInputStateCreateFlagBits {
1090//}
1091
1092/// Pipeline input assembly state creation flags
1093type VkFlags VkPipelineInputAssemblyStateCreateFlags
1094//bitfield VkPipelineInputAssemblyStateCreateFlagBits {
1095//}
1096
1097/// Tessellation state creation flags
1098type VkFlags VkPipelineTessellationStateCreateFlags
1099//bitfield VkPipelineTessellationStateCreateFlagBits {
1100//}
1101
1102/// Viewport state creation flags
1103type VkFlags VkPipelineViewportStateCreateFlags
1104//bitfield VkPipelineViewportStateCreateFlagBits {
1105//}
1106
1107/// Raster state creation flags
1108type VkFlags VkPipelineRasterStateCreateFlags
1109//bitfield VkPipelineRasterStateCreateFlagBits {
1110//}
1111
1112/// Multisample state creation flags
1113type VkFlags VkPipelineMultisampleStateCreateFlags
1114//bitfield VkPipelineMultisampleStateCreateFlagBits {
1115//}
1116
1117/// Color blend state creation flags
1118type VkFlags VkPipelineColorBlendStateCreateFlags
1119//bitfield VkPipelineColorBlendStateCreateFlagBits {
1120//}
1121
1122/// Depth/stencil state creation flags
1123type VkFlags VkPipelineDepthStencilStateCreateFlags
1124//bitfield VkPipelineDepthStencilStateCreateFlagBits {
1125//}
1126
1127/// Dynamic state creation flags
1128type VkFlags VkPipelineDynamicStateCreateFlags
1129//bitfield VkPipelineDynamicStateCreateFlagBits {
1130//}
1131
1132/// Pipeline layout creation flags
1133type VkFlags VkPipelineLayoutCreateFlags
1134//bitfield VkPipelineLayoutCreateFlagBits {
1135//}
1136
1137/// Sampler creation flags
1138type VkFlags VkSamplerCreateFlags
1139//bitfield VkSamplerCreateFlagBits {
1140//}
1141
1142/// Render pass creation flags
1143type VkFlags VkRenderPassCreateFlags
1144//bitfield VkRenderPassCreateFlagBits {
1145//}
1146
1147/// Framebuffer creation flags
1148type VkFlags VkFramebufferCreateFlags
1149//bitfield VkFramebufferCreateFlagBits {
1150//}
1151
Jesse Halldc6d36c2015-11-29 19:12:15 -08001152/// Dependency flags
1153type VkFlags VkDependencyFlags
1154bitfield VkDependencyFlagBits {
1155 VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
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 {
1366 VkSparseImageFormatProperties formatProps
1367 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
1548 VkDeviceSize copySize /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001549}
1550
Jesse Halla6429252015-11-29 18:59:42 -08001551class VkSparseMemoryBind {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001552 VkDeviceSize rangeOffset /// Specified in bytes
1553 VkDeviceSize rangeSize /// Specified in bytes
1554 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001555 VkDeviceMemory mem
1556 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 Hall5ae3abb2015-10-08 14:00:22 -07001563 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001564 VkDeviceMemory mem
1565 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
1698 platform.size_t size /// Size in bytes of the SpecConstant
1699 u32 offset /// Offset of the value in the data block
1700}
1701
1702class VkSpecializationInfo {
1703 u32 mapEntryCount /// Number of entries in the map
1704 const VkSpecializationMapEntry* pMap /// Array of map entries
1705 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 {
1728 u32 binding /// Vertex buffer binding id
1729 u32 strideInBytes /// Distance between vertices in bytes (0 = no advancement)
1730 VkVertexInputStepRate stepRate /// Rate at which binding is incremented
1731}
1732
1733class VkVertexInputAttributeDescription {
1734 u32 location /// location of the shader vertex attrib
1735 u32 binding /// Vertex buffer binding id
1736 VkFormat format /// format of source data
1737 u32 offsetInBytes /// Offset of first element in bytes from base of vertex
1738}
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)
1782 VkCullMode cullMode
1783 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 Hall5ae3abb2015-10-08 14:00:22 -07001822 f32[4] blendConst
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 {
1881 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 Halld27f6aa2015-08-15 17:58:48 -07001884 platform.size_t initialSize /// Size of initial data to populate cache, in bytes
1885 const void* initialData /// 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.
1887}
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 {
1986 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION
1987 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001988 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001989 VkFormat format
1990 u32 samples
1991 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1992 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1993 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1994 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1995 VkImageLayout initialLayout
1996 VkImageLayout finalLayout
1997}
1998
1999class VkAttachmentReference {
2000 u32 attachment
2001 VkImageLayout layout
2002}
2003
2004class VkSubpassDescription {
2005 VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DESCRIPTION
2006 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07002007 VkSubpassDescriptionFlags flags
Jesse Halla6429252015-11-29 18:59:42 -08002008 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
Jesse Hall03b6fe12015-11-24 12:44:21 -08002009 u32 inputAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002010 const VkAttachmentReference* pInputAttachments
Jesse Hall03b6fe12015-11-24 12:44:21 -08002011 u32 colorAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002012 const VkAttachmentReference* pColorAttachments
2013 const VkAttachmentReference* pResolveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002014 VkAttachmentReference depthStencilAttachment
Jesse Hall03b6fe12015-11-24 12:44:21 -08002015 u32 preserveAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002016 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002017}
2018
2019class VkSubpassDependency {
2020 VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DEPENDENCY
2021 const void* pNext /// Pointer to next structure
2022 u32 srcSubpass
2023 u32 destSubpass
2024 VkPipelineStageFlags srcStageMask
2025 VkPipelineStageFlags destStageMask
2026 VkMemoryOutputFlags outputMask
2027 VkMemoryInputFlags inputMask
Jesse Halldc6d36c2015-11-29 19:12:15 -08002028 VkDependencyFlags dependencyFlags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002029}
2030
2031class VkRenderPassCreateInfo {
2032 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
2033 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002034 VkRenderPassCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002035 u32 attachmentCount
2036 const VkAttachmentDescription* pAttachments
2037 u32 subpassCount
2038 const VkSubpassDescription* pSubpasses
2039 u32 dependencyCount
2040 const VkSubpassDependency* pDependencies
2041}
2042
2043class VkEventCreateInfo {
2044 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
2045 const void* pNext /// Pointer to next structure
2046 VkEventCreateFlags flags /// Event creation flags
2047}
2048
2049class VkFenceCreateInfo {
2050 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
2051 const void* pNext /// Pointer to next structure
2052 VkFenceCreateFlags flags /// Fence creation flags
2053}
2054
2055class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002056 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
2057 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
2058 VkBool32 imageCubeArray /// image views which are arrays of cube maps
2059 VkBool32 independentBlend /// blending operations are controlled per-attachment
2060 VkBool32 geometryShader /// geometry stage
2061 VkBool32 tessellationShader /// tessellation control and evaluation stage
2062 VkBool32 sampleRateShading /// per-sample shading and interpolation
2063 VkBool32 dualSourceBlend /// blend operations which take two sources
2064 VkBool32 logicOp /// logic operations
2065 VkBool32 multiDrawIndirect /// multi draw indirect
Jesse Hallae38f732015-11-19 21:32:50 -08002066 VkBool32 depthClamp /// depth clamping
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002067 VkBool32 depthBiasClamp /// depth bias clamping
2068 VkBool32 fillModeNonSolid /// point and wireframe fill modes
2069 VkBool32 depthBounds /// depth bounds test
2070 VkBool32 wideLines /// lines with width greater than 1
2071 VkBool32 largePoints /// points with size greater than 1
Jesse Hallfbf97b02015-11-20 14:17:03 -08002072 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
2073 VkBool32 multiViewport
2074 VkBool32 samplerAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002075 VkBool32 textureCompressionETC2 /// ETC texture compression formats
2076 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
2077 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
2078 VkBool32 occlusionQueryNonConservative /// non-conservative (exact) occlusion queries
2079 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
Jesse Halldc6d36c2015-11-29 19:12:15 -08002080 VkBool32 vertexPipelineStoresAndAtomics
2081 VkBool32 fragmentStoresAndAtomics
2082 VkBool32 shaderTessellationAndGeometryPointSize
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002083 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
2084 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
2085 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
2086 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
2087 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
2088 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
2089 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
2090 VkBool32 shaderClipDistance /// clip distance in shaders
2091 VkBool32 shaderCullDistance /// cull distance in shaders
2092 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
2093 VkBool32 shaderInt64 /// 64-bit integers in shaders
2094 VkBool32 shaderInt16 /// 16-bit integers in shaders
2095 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
2096 VkBool32 shaderResourceMinLOD /// shader can use texture operations that specify minimum resource LOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002097 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
2098 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
2099 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
2100 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
2101 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
2102 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
2103 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
2104 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
2105 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002106}
2107
2108class VkPhysicalDeviceLimits {
2109 /// resource maximum sizes
2110 u32 maxImageDimension1D /// max 1D image dimension
2111 u32 maxImageDimension2D /// max 2D image dimension
2112 u32 maxImageDimension3D /// max 3D image dimension
2113 u32 maxImageDimensionCube /// max cubemap image dimension
2114 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002115 VkSampleCountFlags sampleCounts /// sample counts supported for all images supporting rendering and sampling
Jesse Halld27f6aa2015-08-15 17:58:48 -07002116 u32 maxTexelBufferSize /// max texel buffer size (bytes)
Jesse Hallfbf97b02015-11-20 14:17:03 -08002117 u32 maxUniformBufferRange /// max uniform buffer size (bytes)
2118 u32 maxStorageBufferRange /// max storage buffer size (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002119 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
2120 /// memory limits
2121 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002122 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
2123 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002124 /// descriptor set limits
2125 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07002126 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
2127 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
2128 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
2129 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
2130 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
2131 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
2132 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002133 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002134 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002135 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002136 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
2137 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
2138 /// vertex stage limits
2139 u32 maxVertexInputAttributes /// max num of vertex input attribute slots
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002140 u32 maxVertexInputBindings /// max num of vertex input binding slots
Jesse Halld27f6aa2015-08-15 17:58:48 -07002141 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset
2142 u32 maxVertexInputBindingStride /// max vertex input binding stride
2143 u32 maxVertexOutputComponents /// max num of output components written by vertex shader
2144 /// tessellation control stage limits
Jesse Hallae38f732015-11-19 21:32:50 -08002145 u32 maxTessellationGenLevel /// max level supported by tess primitive generator
2146 u32 maxTessellationPatchSize /// max patch size (vertices)
2147 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS
2148 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS
2149 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS
2150 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS
2151 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES
2152 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES
Jesse Halld27f6aa2015-08-15 17:58:48 -07002153 /// geometry stage limits
2154 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader
2155 u32 maxGeometryInputComponents /// max num of input components read in geometry stage
2156 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage
2157 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage
2158 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage
2159 /// fragment stage limits
2160 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage
Jesse Hallfbf97b02015-11-20 14:17:03 -08002161 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage
2162 u32 maxFragmentDualSourceAttachments /// max num of output attachments written when using dual source blending
Jesse Halld27f6aa2015-08-15 17:58:48 -07002163 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers
2164 /// compute stage limits
2165 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes)
2166 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z)
2167 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group
2168 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z)
2169
2170 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y
2171 u32 subTexelPrecisionBits /// num bits of subtexel precision
2172 u32 mipmapPrecisionBits /// num bits of mipmap precision
2173
2174 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices)
2175 u32 maxDrawIndirectInstanceCount /// max instance count for indirect draw calls
Jesse Halld27f6aa2015-08-15 17:58:48 -07002176
2177 f32 maxSamplerLodBias /// max absolute sampler level of detail bias
2178 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy
2179
2180 u32 maxViewports /// max number of active viewports
Jesse Halld27f6aa2015-08-15 17:58:48 -07002181 u32[2] maxViewportDimensions /// max viewport dimensions (x,y)
2182 f32[2] viewportBoundsRange /// viewport bounds range (min,max)
2183 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport
2184
Jesse Halldc6d36c2015-11-29 19:12:15 -08002185 platform.size_t minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes)
2186 VkDeviceSize minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes)
2187 VkDeviceSize minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes)
2188 VkDeviceSize minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002189
Jesse Hallfbf97b02015-11-20 14:17:03 -08002190 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002191 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset
Jesse Hallfbf97b02015-11-20 14:17:03 -08002192 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002193 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset
2194 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset
2195 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset
2196 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset
2197
2198 u32 maxFramebufferWidth /// max width for a framebuffer
2199 u32 maxFramebufferHeight /// max height for a framebuffer
2200 u32 maxFramebufferLayers /// max layer count for a layered framebuffer
2201 u32 maxFramebufferColorSamples /// max color sample count for a framebuffer
2202 u32 maxFramebufferDepthSamples /// max depth sample count for a framebuffer
2203 u32 maxFramebufferStencilSamples /// max stencil sample count for a framebuffer
2204 u32 maxColorAttachments /// max num of framebuffer color attachments
2205
2206 u32 maxSampledImageColorSamples /// max num of color samples for a non-integer sampled image
2207 u32 maxSampledImageDepthSamples /// max num of depth/stencil samples for a sampled image
2208 u32 maxSampledImageIntegerSamples /// max num of samples supported for an integer image
2209 u32 maxStorageImageSamples /// max num of samples for a storage image
2210 u32 maxSampleMaskWords /// max num of sample mask words
2211
Jesse Halla9bb62b2015-11-21 19:31:56 -08002212 f32 timestampPeriod
Jesse Halld27f6aa2015-08-15 17:58:48 -07002213
2214 u32 maxClipDistances /// max number of clip distances
2215 u32 maxCullDistances /// max number of cull distances
2216 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
2217
Jesse Hallfbf97b02015-11-20 14:17:03 -08002218 u32 discreteQueuePriorities
2219
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002220 f32[2] pointSizeRange /// range (min,max) of supported point sizes
2221 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07002222 f32 pointSizeGranularity /// granularity of supported point sizes
2223 f32 lineWidthGranularity /// granularity of supported line widths
Jesse Hall03b6fe12015-11-24 12:44:21 -08002224 VkBool32 strictLines
Jesse Halla9bb62b2015-11-21 19:31:56 -08002225
Jesse Halldc6d36c2015-11-29 19:12:15 -08002226 VkDeviceSize recommendedBufferCopyOffsetAlignment
2227 VkDeviceSize recommendedBufferCopyRowPitchAlignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07002228}
2229
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002230class VkPhysicalDeviceSparseProperties {
2231 VkBool32 residencyStandard2DBlockShape /// Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard block shapes (based on pixel format)
2232 VkBool32 residencyStandard2DMSBlockShape /// Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard block shapes (based on pixel format)
2233 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
2234 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
2235 VkBool32 residencyNonResident /// Sparse resources support: GPU can safely access non-resident regions of a resource, read values from read-write resources are undefined
2236 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
2237}
2238
Jesse Halld27f6aa2015-08-15 17:58:48 -07002239class VkSemaphoreCreateInfo {
2240 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
2241 const void* pNext /// Pointer to next structure
2242 VkSemaphoreCreateFlags flags /// Semaphore creation flags
2243}
2244
2245class VkQueryPoolCreateInfo {
2246 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
2247 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002248 VkQueryPoolCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002249 VkQueryType queryType
2250 u32 slots
2251 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
2252}
2253
2254class VkFramebufferCreateInfo {
2255 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
2256 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002257 VkFramebufferCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002258 VkRenderPass renderPass
2259 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002260 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002261 u32 width
2262 u32 height
2263 u32 layers
2264}
2265
2266class VkDrawIndirectCmd {
2267 u32 vertexCount
2268 u32 instanceCount
2269 u32 firstVertex
2270 u32 firstInstance
2271}
2272
2273class VkDrawIndexedIndirectCmd {
2274 u32 indexCount
2275 u32 instanceCount
2276 u32 firstIndex
2277 s32 vertexOffset
2278 u32 firstInstance
2279}
2280
2281class VkDispatchIndirectCmd {
2282 u32 x
2283 u32 y
2284 u32 z
2285}
2286
Jesse Hall1356b0d2015-11-23 17:24:58 -08002287@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002288class VkSurfacePropertiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002289 u32 minImageCount
2290 u32 maxImageCount
2291 VkExtent2D currentExtent
2292 VkExtent2D minImageExtent
2293 VkExtent2D maxImageExtent
2294 VkSurfaceTransformFlagsKHR supportedTransforms
2295 VkSurfaceTransformKHR currentTransform
Jesse Halla6429252015-11-29 18:59:42 -08002296 VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002297 u32 maxImageArraySize
2298 VkImageUsageFlags supportedUsageFlags
Michael Lentine88594d72015-11-12 12:49:45 -08002299}
2300
Jesse Hall1356b0d2015-11-23 17:24:58 -08002301@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002302class VkSurfaceFormatKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002303 VkFormat format
2304 VkColorSpaceKHR colorSpace
Michael Lentine88594d72015-11-12 12:49:45 -08002305}
2306
Jesse Hall1356b0d2015-11-23 17:24:58 -08002307@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002308class VkSwapchainCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002309 VkStructureType sType
2310 const void* pNext
2311 VkSurfaceKHR surface
2312 u32 minImageCount
2313 VkFormat imageFormat
2314 VkColorSpaceKHR imageColorSpace
2315 VkExtent2D imageExtent
2316 VkImageUsageFlags imageUsageFlags
2317 VkSurfaceTransformKHR preTransform
Jesse Halla6429252015-11-29 18:59:42 -08002318 VkCompositeAlphaFlagBitsKHR compositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002319 u32 imageArraySize
2320 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08002321 u32 queueFamilyIndexCount
Jesse Hall1356b0d2015-11-23 17:24:58 -08002322 const u32* pQueueFamilyIndices
2323 VkPresentModeKHR presentMode
2324 VkSwapchainKHR oldSwapchain
2325 VkBool32 clipped
Michael Lentine88594d72015-11-12 12:49:45 -08002326}
2327
Jesse Hall1356b0d2015-11-23 17:24:58 -08002328@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002329class VkPresentInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002330 VkStructureType sType
2331 const void* pNext
2332 u32 swapchainCount
Jesse Hall03b6fe12015-11-24 12:44:21 -08002333 const VkSwapchainKHR* pSwapchains
Jesse Hall1356b0d2015-11-23 17:24:58 -08002334 const u32* imageIndices
Michael Lentine88594d72015-11-12 12:49:45 -08002335}
2336
Jesse Hall1356b0d2015-11-23 17:24:58 -08002337@extension("VK_EXT_KHR_display")
2338class VkDisplayPropertiesKHR {
2339 VkDisplayKHR display
2340 const char* displayName
2341 VkExtent2D physicalDimensions
2342 VkExtent2D physicalResolution
2343 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hall1356b0d2015-11-23 17:24:58 -08002344 VkBool32 planeReorderPossible
Jesse Halla6429252015-11-29 18:59:42 -08002345 VkBool32 persistentContent
Michael Lentine88594d72015-11-12 12:49:45 -08002346}
2347
Jesse Hall1356b0d2015-11-23 17:24:58 -08002348@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002349class VkDisplayModeParametersKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002350 VkExtent2D visibleRegion
Jesse Halla6429252015-11-29 18:59:42 -08002351 u32 refreshRate
Michael Lentine88594d72015-11-12 12:49:45 -08002352}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002353
Jesse Hall1356b0d2015-11-23 17:24:58 -08002354@extension("VK_EXT_KHR_display")
2355class VkDisplayModePropertiesKHR {
2356 VkDisplayModeKHR displayMode
Jesse Halla6429252015-11-29 18:59:42 -08002357 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002358}
2359
2360@extension("VK_EXT_KHR_display")
2361class VkDisplayModeCreateInfoKHR {
2362 VkStructureType sType
2363 const void* pNext
Jesse Halla6429252015-11-29 18:59:42 -08002364 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002365}
2366
2367@extension("VK_EXT_KHR_display")
2368class VkDisplayPlanePropertiesKHR {
Jesse Halla6429252015-11-29 18:59:42 -08002369 VkDisplayKHR currentDisplay
2370 u32 currentStackIndex
2371}
2372
2373@extension("VK_EXT_KHR_display")
2374class VkDisplayPlaneCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002375 VkDisplayPlaneAlphaFlagsKHR supportedAlpha
2376 VkOffset2D minSrcPosition
2377 VkOffset2D maxSrcPosition
2378 VkExtent2D minSrcExtent
2379 VkExtent2D maxSrcExtent
2380 VkOffset2D minDstPosition
2381 VkOffset2D maxDstPosition
2382 VkExtent2D minDstExtent
2383 VkExtent2D maxDstExtent
2384}
2385
2386@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002387class VkDisplaySurfaceCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002388 VkStructureType sType
2389 const void* pNext
2390 VkDisplayModeKHR displayMode
2391 u32 planeIndex
2392 u32 planeStackIndex
2393 VkSurfaceTransformKHR transform
2394 f32 globalAlpha
2395 VkDisplayPlaneAlphaFlagsKHR alphaMode
2396 VkExtent2D imageSize
2397}
2398
2399@extension("VK_EXT_KHR_display_swapchain")
2400class VkDisplaySwapchainCreateInfoKHR {
2401 VkStructureType sType
2402 const void* pNext
2403 const VkSwapchainCreateInfoKHR* pNextSwapchainCreateInfo
2404}
2405
2406@extension("VK_EXT_KHR_display_swapchain")
2407class VkDisplayPresentInfoKHR {
2408 VkStructureType sType
2409 const void* pNext
2410 VkRect2D srcRect
2411 VkRect2D dstRect
Jesse Halla6429252015-11-29 18:59:42 -08002412 VkBool32 persistent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002413}
2414
2415
Jesse Halld27f6aa2015-08-15 17:58:48 -07002416////////////////
2417// Commands //
2418////////////////
2419
2420// Function pointers. TODO: add support for function pointers.
2421
2422@external type void* PFN_vkVoidFunction
2423@pfn cmd void vkVoidFunction() {
2424}
2425
2426@external type void* PFN_vkAllocFunction
2427@pfn cmd void* vkAllocFunction(
2428 void* pUserData,
2429 platform.size_t size,
2430 platform.size_t alignment,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002431 VkSystemAllocScope allocScope) {
2432 return ?
2433}
2434
2435@external type void* PFN_vkReallocFunction
2436@pfn cmd void* vkReallocFunction(
2437 void* pUserData,
2438 void* pOriginal,
2439 platform.size_t size,
2440 platform.size_t alignment,
2441 VkSystemAllocScope allocScope) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002442 return ?
2443}
2444
2445@external type void* PFN_vkFreeFunction
2446@pfn cmd void vkFreeFunction(
2447 void* pUserData,
2448 void* pMem) {
2449}
2450
Jesse Hall03b6fe12015-11-24 12:44:21 -08002451@external type void* PFN_vkInternalAllocNotification
2452@pfn cmd void vkInternalAllocNotification(
2453 void* pUserData,
2454 platform.size_t size,
2455 VkInternalAllocType allocType,
2456 VkSystemAllocScope allocScope) {
2457}
2458
2459@external type void* PFN_vkInternalFreeNotification
2460@pfn cmd void vkInternalFreeNotification(
2461 void* pUserData,
2462 platform.size_t size,
2463 VkInternalAllocType allocType,
2464 VkSystemAllocScope allocScope) {
2465}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002466
2467// Global functions
2468
2469@threadSafety("system")
2470cmd VkResult vkCreateInstance(
2471 const VkInstanceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002472 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002473 VkInstance* pInstance) {
2474 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
2475
2476 instance := ?
2477 pInstance[0] = instance
2478 State.Instances[instance] = new!InstanceObject()
2479
Jesse Hall03b6fe12015-11-24 12:44:21 -08002480 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount]
2481 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount]
Jesse Halld27f6aa2015-08-15 17:58:48 -07002482
2483 return ?
2484}
2485
2486@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002487cmd void vkDestroyInstance(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002488 VkInstance instance,
2489 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002490 instanceObject := GetInstance(instance)
2491
2492 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002493}
2494
2495@threadSafety("system")
2496cmd VkResult vkEnumeratePhysicalDevices(
2497 VkInstance instance,
2498 u32* pPhysicalDeviceCount,
2499 VkPhysicalDevice* pPhysicalDevices) {
2500 instanceObject := GetInstance(instance)
2501
2502 physicalDeviceCount := as!u32(?)
2503 pPhysicalDeviceCount[0] = physicalDeviceCount
2504 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2505
2506 for i in (0 .. physicalDeviceCount) {
2507 physicalDevice := ?
2508 physicalDevices[i] = physicalDevice
2509 if !(physicalDevice in State.PhysicalDevices) {
2510 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2511 }
2512 }
2513
2514 return ?
2515}
2516
2517cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2518 VkDevice device,
2519 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002520 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002521 device := GetDevice(device)
2522 }
2523
2524 return ?
2525}
2526
2527cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2528 VkInstance instance,
2529 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002530 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002531 instanceObject := GetInstance(instance)
2532 }
2533
2534 return ?
2535}
2536
Jesse Hall606a54e2015-11-19 22:17:28 -08002537cmd void vkGetPhysicalDeviceProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002538 VkPhysicalDevice physicalDevice,
2539 VkPhysicalDeviceProperties* pProperties) {
2540 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2541
2542 properties := ?
2543 pProperties[0] = properties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002544}
2545
Jesse Hall606a54e2015-11-19 22:17:28 -08002546cmd void vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002547 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002548 u32* pQueueFamilyPropertyCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002549 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002550 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002551 // TODO: Figure out how to express fetch-count-or-properties
2552 // This version fails 'apic validate' with 'fence not allowed in
2553 // *semantic.Branch'. Other attempts have failed with the same or other
2554 // errors.
2555 // if pQueueFamilyProperties != null {
2556 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2557 // for i in (0 .. pCount[0]) {
2558 // queueProperties := as!VkQueueFamilyProperties(?)
2559 // queuesProperties[i] = queueProperties
2560 // }
2561 // } else {
2562 // count := ?
2563 // pCount[0] = count
2564 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002565}
2566
Jesse Hall606a54e2015-11-19 22:17:28 -08002567cmd void vkGetPhysicalDeviceMemoryProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002568 VkPhysicalDevice physicalDevice,
2569 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2570 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2571
2572 memoryProperties := ?
2573 pMemoryProperties[0] = memoryProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002574}
2575
Jesse Hall606a54e2015-11-19 22:17:28 -08002576cmd void vkGetPhysicalDeviceFeatures(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002577 VkPhysicalDevice physicalDevice,
2578 VkPhysicalDeviceFeatures* pFeatures) {
2579 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2580
2581 features := ?
2582 pFeatures[0] = features
Jesse Halld27f6aa2015-08-15 17:58:48 -07002583}
2584
Jesse Hall606a54e2015-11-19 22:17:28 -08002585cmd void vkGetPhysicalDeviceFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002586 VkPhysicalDevice physicalDevice,
2587 VkFormat format,
2588 VkFormatProperties* pFormatProperties) {
2589 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2590
2591 formatProperties := ?
2592 pFormatProperties[0] = formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002593}
2594
Jesse Hall606a54e2015-11-19 22:17:28 -08002595cmd void vkGetPhysicalDeviceImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002596 VkPhysicalDevice physicalDevice,
2597 VkFormat format,
2598 VkImageType type,
2599 VkImageTiling tiling,
2600 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002601 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002602 VkImageFormatProperties* pImageFormatProperties) {
2603 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2604
2605 imageFormatProperties := ?
2606 pImageFormatProperties[0] = imageFormatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002607}
2608
Jesse Halld27f6aa2015-08-15 17:58:48 -07002609
2610// Device functions
2611
2612@threadSafety("system")
2613cmd VkResult vkCreateDevice(
2614 VkPhysicalDevice physicalDevice,
2615 const VkDeviceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002616 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002617 VkDevice* pDevice) {
2618 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2619 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2620
2621 device := ?
2622 pDevice[0] = device
2623 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2624
2625 return ?
2626}
2627
2628@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002629cmd void vkDestroyDevice(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002630 VkDevice device,
2631 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002632 deviceObject := GetDevice(device)
2633
2634 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002635}
2636
2637
2638// Extension discovery functions
2639
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002640cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002641 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002642 VkLayerProperties* pProperties) {
2643 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002644 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002645
2646 properties := pProperties[0:count]
2647 for i in (0 .. count) {
2648 property := ?
2649 properties[i] = property
2650 }
2651
2652 return ?
2653}
2654
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002655cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002656 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002657 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002658 VkExtensionProperties* pProperties) {
2659 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002660 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002661
2662 properties := pProperties[0:count]
2663 for i in (0 .. count) {
2664 property := ?
2665 properties[i] = property
2666 }
2667
2668 return ?
2669}
2670
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002671cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002672 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002673 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002674 VkLayerProperties* pProperties) {
2675 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2676 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002677 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002678
2679 properties := pProperties[0:count]
2680 for i in (0 .. count) {
2681 property := ?
2682 properties[i] = property
2683 }
2684
2685 return ?
2686}
2687
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002688cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002689 VkPhysicalDevice physicalDevice,
2690 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002691 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002692 VkExtensionProperties* pProperties) {
2693 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2694
2695 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002696 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002697
2698 properties := pProperties[0:count]
2699 for i in (0 .. count) {
2700 property := ?
2701 properties[i] = property
2702 }
2703
2704 return ?
2705}
2706
2707
2708// Queue functions
2709
2710@threadSafety("system")
Jesse Hall606a54e2015-11-19 22:17:28 -08002711cmd void vkGetDeviceQueue(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002712 VkDevice device,
2713 u32 queueFamilyIndex,
2714 u32 queueIndex,
2715 VkQueue* pQueue) {
2716 deviceObject := GetDevice(device)
2717
2718 queue := ?
2719 pQueue[0] = queue
2720
2721 if !(queue in State.Queues) {
2722 State.Queues[queue] = new!QueueObject(device: device)
2723 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002724}
2725
2726@threadSafety("app")
2727cmd VkResult vkQueueSubmit(
2728 VkQueue queue,
Jesse Halla366a512015-11-19 22:30:07 -08002729 u32 submitCount,
2730 const VkSubmitInfo* pSubmitInfo,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002731 VkFence fence) {
2732 queueObject := GetQueue(queue)
2733
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002734 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002735 fenceObject := GetFence(fence)
2736 assert(fenceObject.device == queueObject.device)
2737 }
2738
Jesse Halla366a512015-11-19 22:30:07 -08002739 // cmdBuffers := pCmdBuffers[0:cmdBufferCount]
2740 // for i in (0 .. cmdBufferCount) {
2741 // cmdBuffer := cmdBuffers[i]
2742 // cmdBufferObject := GetCmdBuffer(cmdBuffer)
2743 // assert(cmdBufferObject.device == queueObject.device)
2744 //
2745 // validate("QueueCheck", cmdBufferObject.queueFlags in queueObject.flags,
2746 // "vkQueueSubmit: enqueued cmdBuffer requires missing queue capabilities.")
2747 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002748
2749 return ?
2750}
2751
2752@threadSafety("system")
2753cmd VkResult vkQueueWaitIdle(
2754 VkQueue queue) {
2755 queueObject := GetQueue(queue)
2756
2757 return ?
2758}
2759
2760@threadSafety("system")
2761cmd VkResult vkDeviceWaitIdle(
2762 VkDevice device) {
2763 deviceObject := GetDevice(device)
2764
2765 return ?
2766}
2767
2768
2769// Memory functions
2770
2771@threadSafety("system")
2772cmd VkResult vkAllocMemory(
2773 VkDevice device,
2774 const VkMemoryAllocInfo* pAllocInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002775 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002776 VkDeviceMemory* pMem) {
2777 assert(pAllocInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO)
2778 deviceObject := GetDevice(device)
2779
2780 mem := ?
2781 pMem[0] = mem
2782 State.DeviceMemories[mem] = new!DeviceMemoryObject(
2783 device: device,
2784 allocationSize: pAllocInfo[0].allocationSize)
2785
2786 return ?
2787}
2788
2789@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002790cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002791 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002792 VkDeviceMemory mem,
2793 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002794 deviceObject := GetDevice(device)
2795 memObject := GetDeviceMemory(mem)
2796 assert(memObject.device == device)
2797
2798 // Check that no objects are still bound before freeing.
2799 validate("MemoryCheck", len(memObject.boundObjects) == 0,
2800 "vkFreeMemory: objects still bound")
2801 validate("MemoryCheck", len(memObject.boundCommandBuffers) == 0,
2802 "vkFreeMemory: cmdBuffers still bound")
2803 State.DeviceMemories[mem] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002804}
2805
2806@threadSafety("app")
2807cmd VkResult vkMapMemory(
2808 VkDevice device,
2809 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002810 VkDeviceSize offset,
2811 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002812 VkMemoryMapFlags flags,
2813 void** ppData) {
2814 deviceObject := GetDevice(device)
2815 memObject := GetDeviceMemory(mem)
2816 assert(memObject.device == device)
2817
2818 assert(flags == as!VkMemoryMapFlags(0))
2819 assert((offset + size) <= memObject.allocationSize)
2820
2821 return ?
2822}
2823
2824@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002825cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002826 VkDevice device,
2827 VkDeviceMemory mem) {
2828 deviceObject := GetDevice(device)
2829 memObject := GetDeviceMemory(mem)
2830 assert(memObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002831}
2832
2833cmd VkResult vkFlushMappedMemoryRanges(
2834 VkDevice device,
2835 u32 memRangeCount
2836 const VkMappedMemoryRange* pMemRanges) {
2837 deviceObject := GetDevice(device)
2838
2839 memRanges := pMemRanges[0:memRangeCount]
2840 for i in (0 .. memRangeCount) {
2841 memRange := memRanges[i]
2842 memObject := GetDeviceMemory(memRange.mem)
2843 assert(memObject.device == device)
2844 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2845 }
2846
2847 return ?
2848}
2849
2850cmd VkResult vkInvalidateMappedMemoryRanges(
2851 VkDevice device,
2852 u32 memRangeCount,
2853 const VkMappedMemoryRange* pMemRanges) {
2854 deviceObject := GetDevice(device)
2855
2856 memRanges := pMemRanges[0:memRangeCount]
2857 for i in (0 .. memRangeCount) {
2858 memRange := memRanges[i]
2859 memObject := GetDeviceMemory(memRange.mem)
2860 assert(memObject.device == device)
2861 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2862 }
2863
2864 return ?
2865}
2866
2867
2868// Memory management API functions
2869
Jesse Hall606a54e2015-11-19 22:17:28 -08002870cmd void vkGetDeviceMemoryCommitment(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002871 VkDevice device,
2872 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002873 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002874 deviceObject := GetDevice(device)
2875
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002876 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002877 memoryObject := GetDeviceMemory(memory)
2878 assert(memoryObject.device == device)
2879 }
2880
2881 committedMemoryInBytes := ?
2882 pCommittedMemoryInBytes[0] = committedMemoryInBytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07002883}
2884
Jesse Hall606a54e2015-11-19 22:17:28 -08002885cmd void vkGetBufferMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002886 VkDevice device,
2887 VkBuffer buffer,
2888 VkMemoryRequirements* pMemoryRequirements) {
2889 deviceObject := GetDevice(device)
2890 bufferObject := GetBuffer(buffer)
2891 assert(bufferObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002892}
2893
2894cmd VkResult vkBindBufferMemory(
2895 VkDevice device,
2896 VkBuffer buffer,
2897 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002898 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002899 deviceObject := GetDevice(device)
2900 bufferObject := GetBuffer(buffer)
2901 assert(bufferObject.device == device)
2902
2903 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002904 if bufferObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002905 memObject := GetDeviceMemory(bufferObject.mem)
2906 memObject.boundObjects[as!u64(buffer)] = null
2907 }
2908
2909 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002910 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002911 memObject := GetDeviceMemory(mem)
2912 assert(memObject.device == device)
2913 memObject.boundObjects[as!u64(buffer)] = memOffset
2914 }
2915 bufferObject.mem = mem
2916 bufferObject.memOffset = memOffset
2917
2918 return ?
2919}
2920
Jesse Hall606a54e2015-11-19 22:17:28 -08002921cmd void vkGetImageMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002922 VkDevice device,
2923 VkImage image,
2924 VkMemoryRequirements* pMemoryRequirements) {
2925 deviceObject := GetDevice(device)
2926 imageObject := GetImage(image)
2927 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002928}
2929
2930cmd VkResult vkBindImageMemory(
2931 VkDevice device,
2932 VkImage image,
2933 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002934 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002935 deviceObject := GetDevice(device)
2936 imageObject := GetImage(image)
2937 assert(imageObject.device == device)
2938
2939 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002940 if imageObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002941 memObject := GetDeviceMemory(imageObject.mem)
2942 memObject.boundObjects[as!u64(image)] = null
2943 }
2944
2945 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002946 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002947 memObject := GetDeviceMemory(mem)
2948 assert(memObject.device == device)
2949 memObject.boundObjects[as!u64(image)] = memOffset
2950 }
2951 imageObject.mem = mem
2952 imageObject.memOffset = memOffset
2953
2954 return ?
2955}
2956
Jesse Hall606a54e2015-11-19 22:17:28 -08002957cmd void vkGetImageSparseMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002958 VkDevice device,
2959 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002960 u32* pSparseMemoryRequirementCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002961 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2962 deviceObject := GetDevice(device)
2963 imageObject := GetImage(image)
2964 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002965}
2966
Jesse Hall606a54e2015-11-19 22:17:28 -08002967cmd void vkGetPhysicalDeviceSparseImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002968 VkPhysicalDevice physicalDevice,
2969 VkFormat format,
2970 VkImageType type,
2971 u32 samples,
2972 VkImageUsageFlags usage,
2973 VkImageTiling tiling,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002974 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002975 VkSparseImageFormatProperties* pProperties) {
2976 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002977}
2978
Jesse Halla6429252015-11-29 18:59:42 -08002979cmd VkResult vkQueueBindSparse(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002980 VkQueue queue,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002981 u32 bindInfoCount,
Jesse Halla6429252015-11-29 18:59:42 -08002982 const VkBindSparseInfo* pBindInfo,
2983 VkFence fence) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002984 queueObject := GetQueue(queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002985
2986 return ?
2987}
2988
2989
2990// Fence functions
2991
2992@threadSafety("system")
2993cmd VkResult vkCreateFence(
2994 VkDevice device,
2995 const VkFenceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002996 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002997 VkFence* pFence) {
2998 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
2999 deviceObject := GetDevice(device)
3000
3001 fence := ?
3002 pFence[0] = fence
3003 State.Fences[fence] = new!FenceObject(
Jesse Halld8bade02015-11-24 10:24:18 -08003004 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT)))
Jesse Halld27f6aa2015-08-15 17:58:48 -07003005
3006 return ?
3007}
3008
3009@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003010cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003011 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003012 VkFence fence,
3013 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003014 deviceObject := GetDevice(device)
3015 fenceObject := GetFence(fence)
3016 assert(fenceObject.device == device)
3017
3018 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003019}
3020
3021@threadSafety("system")
3022cmd VkResult vkResetFences(
3023 VkDevice device,
3024 u32 fenceCount,
3025 const VkFence* pFences) {
3026 deviceObject := GetDevice(device)
3027
3028 fences := pFences[0:fenceCount]
3029 for i in (0 .. fenceCount) {
3030 fence := fences[i]
3031 fenceObject := GetFence(fence)
3032 assert(fenceObject.device == device)
3033 fenceObject.signaled = false
3034 }
3035
3036 return ?
3037}
3038
3039@threadSafety("system")
3040cmd VkResult vkGetFenceStatus(
3041 VkDevice device,
3042 VkFence fence) {
3043 deviceObject := GetDevice(device)
3044 fenceObject := GetFence(fence)
3045 assert(fenceObject.device == device)
3046
3047 return ?
3048}
3049
3050@threadSafety("system")
3051cmd VkResult vkWaitForFences(
3052 VkDevice device,
3053 u32 fenceCount,
3054 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003055 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003056 u64 timeout) { /// timeout in nanoseconds
3057 deviceObject := GetDevice(device)
3058
3059 fences := pFences[0:fenceCount]
3060 for i in (0 .. fenceCount) {
3061 fence := fences[i]
3062 fenceObject := GetFence(fence)
3063 assert(fenceObject.device == device)
3064 }
3065
3066 return ?
3067}
3068
3069
3070// Queue semaphore functions
3071
3072@threadSafety("system")
3073cmd VkResult vkCreateSemaphore(
3074 VkDevice device,
3075 const VkSemaphoreCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003076 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003077 VkSemaphore* pSemaphore) {
3078 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
3079 deviceObject := GetDevice(device)
3080
3081 semaphore := ?
3082 pSemaphore[0] = semaphore
3083 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
3084
3085 return ?
3086}
3087
3088@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003089cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003090 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003091 VkSemaphore semaphore,
3092 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003093 deviceObject := GetDevice(device)
3094 semaphoreObject := GetSemaphore(semaphore)
3095 assert(semaphoreObject.device == device)
3096
3097 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003098}
3099
Jesse Halld27f6aa2015-08-15 17:58:48 -07003100
3101// Event functions
3102
3103@threadSafety("system")
3104cmd VkResult vkCreateEvent(
3105 VkDevice device,
3106 const VkEventCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003107 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003108 VkEvent* pEvent) {
3109 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
3110 deviceObject := GetDevice(device)
3111
3112 event := ?
3113 pEvent[0] = event
3114 State.Events[event] = new!EventObject(device: device)
3115
3116 return ?
3117}
3118
3119@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003120cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003121 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003122 VkEvent event,
3123 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003124 deviceObject := GetDevice(device)
3125 eventObject := GetEvent(event)
3126 assert(eventObject.device == device)
3127
3128 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003129}
3130
3131@threadSafety("system")
3132cmd VkResult vkGetEventStatus(
3133 VkDevice device,
3134 VkEvent event) {
3135 deviceObject := GetDevice(device)
3136 eventObject := GetEvent(event)
3137 assert(eventObject.device == device)
3138
3139 return ?
3140}
3141
3142@threadSafety("system")
3143cmd VkResult vkSetEvent(
3144 VkDevice device,
3145 VkEvent event) {
3146 deviceObject := GetDevice(device)
3147 eventObject := GetEvent(event)
3148 assert(eventObject.device == device)
3149
3150 return ?
3151}
3152
3153@threadSafety("system")
3154cmd VkResult vkResetEvent(
3155 VkDevice device,
3156 VkEvent event) {
3157 deviceObject := GetDevice(device)
3158 eventObject := GetEvent(event)
3159 assert(eventObject.device == device)
3160
3161 return ?
3162}
3163
3164
3165// Query functions
3166
3167@threadSafety("system")
3168cmd VkResult vkCreateQueryPool(
3169 VkDevice device,
3170 const VkQueryPoolCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003171 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003172 VkQueryPool* pQueryPool) {
3173 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
3174 deviceObject := GetDevice(device)
3175
3176 queryPool := ?
3177 pQueryPool[0] = queryPool
3178 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
3179
3180 return ?
3181}
3182
3183@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003184cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003185 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003186 VkQueryPool queryPool,
3187 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003188 deviceObject := GetDevice(device)
3189 queryPoolObject := GetQueryPool(queryPool)
3190 assert(queryPoolObject.device == device)
3191
3192 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003193}
3194
3195@threadSafety("system")
3196cmd VkResult vkGetQueryPoolResults(
3197 VkDevice device,
3198 VkQueryPool queryPool,
3199 u32 startQuery,
3200 u32 queryCount,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003201 platform.size_t dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003202 void* pData,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003203 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003204 VkQueryResultFlags flags) {
3205 deviceObject := GetDevice(device)
3206 queryPoolObject := GetQueryPool(queryPool)
3207 assert(queryPoolObject.device == device)
3208
Jesse Halld27f6aa2015-08-15 17:58:48 -07003209 data := pData[0:dataSize]
3210
3211 return ?
3212}
3213
3214// Buffer functions
3215
3216@threadSafety("system")
3217cmd VkResult vkCreateBuffer(
3218 VkDevice device,
3219 const VkBufferCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003220 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003221 VkBuffer* pBuffer) {
3222 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
3223 deviceObject := GetDevice(device)
3224
3225 buffer := ?
3226 pBuffer[0] = buffer
3227 State.Buffers[buffer] = new!BufferObject(device: device)
3228
3229 return ?
3230}
3231
3232@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003233cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003234 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003235 VkBuffer buffer,
3236 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003237 deviceObject := GetDevice(device)
3238 bufferObject := GetBuffer(buffer)
3239 assert(bufferObject.device == device)
3240
3241 assert(bufferObject.mem == 0)
3242 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003243}
3244
3245
3246// Buffer view functions
3247
3248@threadSafety("system")
3249cmd VkResult vkCreateBufferView(
3250 VkDevice device,
3251 const VkBufferViewCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003252 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003253 VkBufferView* pView) {
3254 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
3255 deviceObject := GetDevice(device)
3256
3257 bufferObject := GetBuffer(pCreateInfo.buffer)
3258 assert(bufferObject.device == device)
3259
3260 view := ?
3261 pView[0] = view
3262 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
3263
3264 return ?
3265}
3266
3267@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003268cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003269 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003270 VkBufferView bufferView,
3271 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003272 deviceObject := GetDevice(device)
3273 bufferViewObject := GetBufferView(bufferView)
3274 assert(bufferViewObject.device == device)
3275
3276 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003277}
3278
3279
3280// Image functions
3281
3282@threadSafety("system")
3283cmd VkResult vkCreateImage(
3284 VkDevice device,
3285 const VkImageCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003286 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003287 VkImage* pImage) {
3288 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
3289 deviceObject := GetDevice(device)
3290
3291 image := ?
3292 pImage[0] = image
3293 State.Images[image] = new!ImageObject(device: device)
3294
3295 return ?
3296}
3297
3298@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003299cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003300 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003301 VkImage image,
3302 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003303 deviceObject := GetDevice(device)
3304 imageObject := GetImage(image)
3305 assert(imageObject.device == device)
3306
3307 assert(imageObject.mem == 0)
3308 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003309}
3310
Jesse Hall606a54e2015-11-19 22:17:28 -08003311cmd void vkGetImageSubresourceLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003312 VkDevice device,
3313 VkImage image,
3314 const VkImageSubresource* pSubresource,
3315 VkSubresourceLayout* pLayout) {
3316 deviceObject := GetDevice(device)
3317 imageObject := GetImage(image)
3318 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003319}
3320
3321
3322// Image view functions
3323
3324@threadSafety("system")
3325cmd VkResult vkCreateImageView(
3326 VkDevice device,
3327 const VkImageViewCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003328 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003329 VkImageView* pView) {
3330 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
3331 deviceObject := GetDevice(device)
3332
3333 imageObject := GetImage(pCreateInfo.image)
3334 assert(imageObject.device == device)
3335
3336 view := ?
3337 pView[0] = view
3338 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
3339
3340 return ?
3341}
3342
3343@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003344cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003345 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003346 VkImageView imageView,
3347 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003348 deviceObject := GetDevice(device)
3349 imageViewObject := GetImageView(imageView)
3350 assert(imageViewObject.device == device)
3351
3352 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003353}
3354
3355
3356// Shader functions
3357
3358cmd VkResult vkCreateShaderModule(
3359 VkDevice device,
3360 const VkShaderModuleCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003361 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003362 VkShaderModule* pShaderModule) {
3363 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
3364 deviceObject := GetDevice(device)
3365
3366 shaderModule := ?
3367 pShaderModule[0] = shaderModule
3368 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
3369
3370 return ?
3371}
3372
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003373cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003374 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003375 VkShaderModule shaderModule,
3376 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003377 deviceObject := GetDevice(device)
3378 shaderModuleObject := GetShaderModule(shaderModule)
3379 assert(shaderModuleObject.device == device)
3380
3381 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003382}
3383
3384@threadSafety("system")
3385cmd VkResult vkCreateShader(
3386 VkDevice device,
3387 const VkShaderCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003388 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003389 VkShader* pShader) {
3390 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO)
3391 deviceObject := GetDevice(device)
3392
3393 shader := ?
3394 pShader[0] = shader
3395 State.Shaders[shader] = new!ShaderObject(device: device)
3396
3397 return ?
3398}
3399
3400@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003401cmd void vkDestroyShader(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003402 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003403 VkShader shader,
3404 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003405 deviceObject := GetDevice(device)
3406 shaderObject := GetShader(shader)
3407 assert(shaderObject.device == device)
3408
3409 State.Shaders[shader] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003410}
3411
3412
3413// Pipeline functions
3414
3415cmd VkResult vkCreatePipelineCache(
3416 VkDevice device,
3417 const VkPipelineCacheCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003418 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003419 VkPipelineCache* pPipelineCache) {
3420 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
3421 deviceObject := GetDevice(device)
3422
3423 pipelineCache := ?
3424 pPipelineCache[0] = pipelineCache
3425 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
3426
3427 return ?
3428}
3429
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003430cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003431 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003432 VkPipelineCache pipelineCache,
3433 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003434 deviceObject := GetDevice(device)
3435 pipelineCacheObject := GetPipelineCache(pipelineCache)
3436 assert(pipelineCacheObject.device == device)
3437
3438 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003439}
3440
Jesse Halld27f6aa2015-08-15 17:58:48 -07003441cmd VkResult vkGetPipelineCacheData(
3442 VkDevice device,
3443 VkPipelineCache pipelineCache,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003444 platform.size_t* pDataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003445 void* pData) {
3446 deviceObject := GetDevice(device)
3447 pipelineCacheObject := GetPipelineCache(pipelineCache)
3448 assert(pipelineCacheObject.device == device)
3449
3450 return ?
3451}
3452
3453cmd VkResult vkMergePipelineCaches(
3454 VkDevice device,
3455 VkPipelineCache destCache,
3456 u32 srcCacheCount,
3457 const VkPipelineCache* pSrcCaches) {
3458 deviceObject := GetDevice(device)
3459 destCacheObject := GetPipelineCache(destCache)
3460 assert(destCacheObject.device == device)
3461
3462 srcCaches := pSrcCaches[0:srcCacheCount]
3463 for i in (0 .. srcCacheCount) {
3464 srcCache := srcCaches[i]
3465 srcCacheObject := GetPipelineCache(srcCache)
3466 assert(srcCacheObject.device == device)
3467 }
3468
3469 return ?
3470}
3471
3472cmd VkResult vkCreateGraphicsPipelines(
3473 VkDevice device,
3474 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003475 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003476 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003477 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003478 VkPipeline* pPipelines) {
3479 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003480 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003481 pipelineCacheObject := GetPipelineCache(pipelineCache)
3482 assert(pipelineCacheObject.device == device)
3483 }
3484
Jesse Hall03b6fe12015-11-24 12:44:21 -08003485 createInfos := pCreateInfos[0:createInfoCount]
3486 pipelines := pPipelines[0:createInfoCount]
3487 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003488 pipeline := ?
3489 pipelines[i] = pipeline
3490 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3491 }
3492
3493 return ?
3494}
3495
3496cmd VkResult vkCreateComputePipelines(
3497 VkDevice device,
3498 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003499 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003500 const VkComputePipelineCreateInfo* pCreateInfos,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003501 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003502 VkPipeline* pPipelines) {
3503 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003504 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003505 pipelineCacheObject := GetPipelineCache(pipelineCache)
3506 assert(pipelineCacheObject.device == device)
3507 }
3508
Jesse Hall03b6fe12015-11-24 12:44:21 -08003509 createInfos := pCreateInfos[0:createInfoCount]
3510 pipelines := pPipelines[0:createInfoCount]
3511 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003512 pipeline := ?
3513 pipelines[i] = pipeline
3514 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3515 }
3516
3517 return ?
3518}
3519
3520@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003521cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003522 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003523 VkPipeline pipeline,
3524 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003525 deviceObject := GetDevice(device)
3526 pipelineObjects := GetPipeline(pipeline)
3527 assert(pipelineObjects.device == device)
3528
3529 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003530}
3531
3532
3533// Pipeline layout functions
3534
3535@threadSafety("system")
3536cmd VkResult vkCreatePipelineLayout(
3537 VkDevice device,
3538 const VkPipelineLayoutCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003539 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003540 VkPipelineLayout* pPipelineLayout) {
3541 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3542 deviceObject := GetDevice(device)
3543
3544 pipelineLayout := ?
3545 pPipelineLayout[0] = pipelineLayout
3546 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3547
3548 return ?
3549}
3550
3551@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003552cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003553 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003554 VkPipelineLayout pipelineLayout,
3555 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003556 deviceObject := GetDevice(device)
3557 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3558 assert(pipelineLayoutObjects.device == device)
3559
3560 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003561}
3562
3563
3564// Sampler functions
3565
3566@threadSafety("system")
3567cmd VkResult vkCreateSampler(
3568 VkDevice device,
3569 const VkSamplerCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003570 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003571 VkSampler* pSampler) {
3572 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3573 deviceObject := GetDevice(device)
3574
3575 sampler := ?
3576 pSampler[0] = sampler
3577 State.Samplers[sampler] = new!SamplerObject(device: device)
3578
3579 return ?
3580}
3581
3582@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003583cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003584 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003585 VkSampler sampler,
3586 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003587 deviceObject := GetDevice(device)
3588 samplerObject := GetSampler(sampler)
3589 assert(samplerObject.device == device)
3590
3591 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003592}
3593
3594
3595// Descriptor set functions
3596
3597@threadSafety("system")
3598cmd VkResult vkCreateDescriptorSetLayout(
3599 VkDevice device,
3600 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003601 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003602 VkDescriptorSetLayout* pSetLayout) {
3603 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3604 deviceObject := GetDevice(device)
3605
3606 setLayout := ?
3607 pSetLayout[0] = setLayout
3608 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3609
3610 return ?
3611}
3612
3613@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003614cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003615 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003616 VkDescriptorSetLayout descriptorSetLayout,
3617 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003618 deviceObject := GetDevice(device)
3619 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3620 assert(descriptorSetLayoutObject.device == device)
3621
3622 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003623}
3624
3625@threadSafety("system")
3626cmd VkResult vkCreateDescriptorPool(
3627 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003628 const VkDescriptorPoolCreateInfo* pCreateInfo,
3629 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003630 VkDescriptorPool* pDescriptorPool) {
3631 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3632 deviceObject := GetDevice(device)
3633
3634 descriptorPool := ?
3635 pDescriptorPool[0] = descriptorPool
3636 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3637
3638 return ?
3639}
3640
3641@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003642cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003643 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003644 VkDescriptorPool descriptorPool,
3645 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003646 deviceObject := GetDevice(device)
3647 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3648 assert(descriptorPoolObject.device == device)
3649
3650 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003651}
3652
3653@threadSafety("app")
3654cmd VkResult vkResetDescriptorPool(
3655 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003656 VkDescriptorPool descriptorPool,
3657 VkDescriptorPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003658 deviceObject := GetDevice(device)
3659 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3660 assert(descriptorPoolObject.device == device)
3661
3662 return ?
3663}
3664
3665@threadSafety("app")
3666cmd VkResult vkAllocDescriptorSets(
3667 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003668 const VkDescriptorSetAllocInfo* pAllocInfo,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003669 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003670 deviceObject := GetDevice(device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003671 allocInfo := pAllocInfo[0]
3672 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003673
Jesse Hall03b6fe12015-11-24 12:44:21 -08003674 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount]
3675 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003676 setLayout := setLayouts[i]
3677 setLayoutObject := GetDescriptorSetLayout(setLayout)
3678 assert(setLayoutObject.device == device)
3679 }
3680
Jesse Hall03b6fe12015-11-24 12:44:21 -08003681 descriptorSets := pDescriptorSets[0:allocInfo.setCount]
3682 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003683 descriptorSet := ?
3684 descriptorSets[i] = descriptorSet
3685 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3686 }
3687
3688 return ?
3689}
3690
Jesse Hallf09c6b12015-08-15 19:54:28 -07003691cmd VkResult vkFreeDescriptorSets(
3692 VkDevice device,
3693 VkDescriptorPool descriptorPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003694 u32 descriptorSetCount,
Jesse Hallf09c6b12015-08-15 19:54:28 -07003695 const VkDescriptorSet* pDescriptorSets) {
3696 deviceObject := GetDevice(device)
3697 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3698
Jesse Hall03b6fe12015-11-24 12:44:21 -08003699 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3700 for i in (0 .. descriptorSetCount) {
Jesse Hallf09c6b12015-08-15 19:54:28 -07003701 descriptorSet := descriptorSets[i]
3702 descriptorSetObject := GetDescriptorSet(descriptorSet)
3703 assert(descriptorSetObject.device == device)
3704 State.DescriptorSets[descriptorSet] = null
3705 }
3706
3707 return ?
3708}
3709
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003710cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003711 VkDevice device,
3712 u32 writeCount,
3713 const VkWriteDescriptorSet* pDescriptorWrites,
3714 u32 copyCount,
3715 const VkCopyDescriptorSet* pDescriptorCopies) {
3716 deviceObject := GetDevice(device)
3717
3718 descriptorWrites := pDescriptorWrites[0:writeCount]
3719 for i in (0 .. writeCount) {
3720 descriptorWrite := descriptorWrites[i]
3721 descriptorWriteObject := GetDescriptorSet(descriptorWrite.destSet)
3722 assert(descriptorWriteObject.device == device)
3723 }
3724
3725 descriptorCopies := pDescriptorCopies[0:copyCount]
3726 for i in (0 .. copyCount) {
3727 descriptorCopy := descriptorCopies[i]
3728 descriptorCopyObject := GetDescriptorSet(descriptorCopy.destSet)
3729 assert(descriptorCopyObject.device == device)
3730 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003731}
3732
3733
3734// Framebuffer functions
3735
3736@threadSafety("system")
3737cmd VkResult vkCreateFramebuffer(
3738 VkDevice device,
3739 const VkFramebufferCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003740 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003741 VkFramebuffer* pFramebuffer) {
3742 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3743 deviceObject := GetDevice(device)
3744
3745 framebuffer := ?
3746 pFramebuffer[0] = framebuffer
3747 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3748
3749 return ?
3750}
3751
3752@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003753cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003754 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003755 VkFramebuffer framebuffer,
3756 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003757 deviceObject := GetDevice(device)
3758 framebufferObject := GetFramebuffer(framebuffer)
3759 assert(framebufferObject.device == device)
3760
3761 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003762}
3763
3764
3765// Renderpass functions
3766
3767@threadSafety("system")
3768cmd VkResult vkCreateRenderPass(
3769 VkDevice device,
3770 const VkRenderPassCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003771 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003772 VkRenderPass* pRenderPass) {
3773 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3774 deviceObject := GetDevice(device)
3775
3776 renderpass := ?
3777 pRenderPass[0] = renderpass
3778 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3779
3780 return ?
3781}
3782
3783@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003784cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003785 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003786 VkRenderPass renderPass,
3787 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003788 deviceObject := GetDevice(device)
3789 renderPassObject := GetRenderPass(renderPass)
3790 assert(renderPassObject.device == device)
3791
3792 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003793}
3794
Jesse Hall606a54e2015-11-19 22:17:28 -08003795cmd void vkGetRenderAreaGranularity(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003796 VkDevice device,
3797 VkRenderPass renderPass,
3798 VkExtent2D* pGranularity) {
3799 deviceObject := GetDevice(device)
3800 renderPassObject := GetRenderPass(renderPass)
3801
3802 granularity := ?
3803 pGranularity[0] = granularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07003804}
3805
3806// Command pool functions
3807
3808cmd VkResult vkCreateCommandPool(
3809 VkDevice device,
3810 const VkCmdPoolCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003811 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003812 VkCmdPool* pCmdPool) {
3813 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO)
3814 deviceObject := GetDevice(device)
3815
3816 cmdPool := ?
3817 pCmdPool[0] = cmdPool
3818 State.CmdPools[cmdPool] = new!CmdPoolObject(device: device)
3819
3820 return ?
3821}
3822
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003823cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003824 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003825 VkCmdPool cmdPool,
3826 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003827 deviceObject := GetDevice(device)
3828 cmdPoolObject := GetCmdPool(cmdPool)
3829 assert(cmdPoolObject.device == device)
3830
3831 State.CmdPools[cmdPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003832}
3833
3834cmd VkResult vkResetCommandPool(
3835 VkDevice device,
3836 VkCmdPool cmdPool,
3837 VkCmdPoolResetFlags flags) {
3838 deviceObject := GetDevice(device)
3839 cmdPoolObject := GetCmdPool(cmdPool)
3840 assert(cmdPoolObject.device == device)
3841
3842 return ?
3843}
3844
3845// Command buffer functions
3846
3847macro void bindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3848 memoryObject := GetDeviceMemory(mem)
3849 memoryObject.boundCommandBuffers[cmdBuffer] = cmdBuffer
3850
3851 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3852 cmdBufferObject.boundObjects[as!u64(obj)] = mem
3853}
3854
3855macro void unbindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3856 memoryObject := GetDeviceMemory(mem)
3857 memoryObject.boundCommandBuffers[cmdBuffer] = null
3858
3859 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3860 cmdBufferObject.boundObjects[as!u64(obj)] = null
3861}
3862
3863@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003864cmd VkResult vkAllocCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003865 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003866 const VkCmdBufferAllocInfo* pAllocInfo,
3867 VkCmdBuffer* pCmdBuffers) {
3868 assert(pAllocInfo[0].sType == VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003869
Jesse Hall03b6fe12015-11-24 12:44:21 -08003870 count := pAllocInfo[0].bufferCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08003871 cmdBuffers := pCmdBuffers[0:count]
3872 for i in (0 .. count) {
3873 cmdBuffer := ?
3874 cmdBuffers[i] = cmdBuffer
3875 State.CmdBuffers[cmdBuffer] = new!CmdBufferObject(device: device)
3876 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003877
3878 return ?
3879}
3880
3881@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003882cmd void vkFreeCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003883 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003884 VkCmdPool cmdPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003885 u32 commandBufferCount,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003886 const VkCmdBuffer* pCommandBuffers) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003887 deviceObject := GetDevice(device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003888
Jesse Hall03b6fe12015-11-24 12:44:21 -08003889 cmdBuffers := pCommandBuffers[0:commandBufferCount]
3890 for i in (0 .. commandBufferCount) {
Jesse Hallfbf97b02015-11-20 14:17:03 -08003891 cmdBufferObject := GetCmdBuffer(cmdBuffers[i])
3892 assert(cmdBufferObject.device == device)
3893 // TODO: iterate over boundObjects and clear memory bindings
3894 State.CmdBuffers[cmdBuffers[i]] = null
3895 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003896}
3897
3898@threadSafety("app")
3899cmd VkResult vkBeginCommandBuffer(
3900 VkCmdBuffer cmdBuffer,
3901 const VkCmdBufferBeginInfo* pBeginInfo) {
3902 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO)
3903 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3904
3905 // TODO: iterate over boundObjects and clear memory bindings
3906
3907 return ?
3908}
3909
3910@threadSafety("app")
3911cmd VkResult vkEndCommandBuffer(
3912 VkCmdBuffer cmdBuffer) {
3913 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3914
3915 return ?
3916}
3917
3918@threadSafety("app")
3919cmd VkResult vkResetCommandBuffer(
3920 VkCmdBuffer cmdBuffer,
3921 VkCmdBufferResetFlags flags) {
3922 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3923
3924 // TODO: iterate over boundObjects and clear memory bindings
3925
3926 return ?
3927}
3928
3929
3930// Command buffer building functions
3931
3932@threadSafety("app")
3933cmd void vkCmdBindPipeline(
3934 VkCmdBuffer cmdBuffer,
3935 VkPipelineBindPoint pipelineBindPoint,
3936 VkPipeline pipeline) {
3937 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3938 pipelineObject := GetPipeline(pipeline)
3939 assert(cmdBufferObject.device == pipelineObject.device)
3940
Jesse Halld8bade02015-11-24 10:24:18 -08003941 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003942 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3943 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3944 }
Jesse Halld8bade02015-11-24 10:24:18 -08003945 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003946}
3947
3948@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003949cmd void vkCmdSetViewport(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003950 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003951 u32 viewportCount,
3952 const VkViewport* pViewports) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003953 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003954 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003955}
3956
3957@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003958cmd void vkCmdSetScissor(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003959 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003960 u32 scissorCount,
3961 const VkRect2D* pScissors) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003962 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003963 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003964}
3965
3966@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003967cmd void vkCmdSetLineWidth(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003968 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003969 f32 lineWidth) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003970 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003971 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003972}
3973
3974@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003975cmd void vkCmdSetDepthBias(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003976 VkCmdBuffer cmdBuffer,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003977 f32 depthBiasConstantFactor,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003978 f32 depthBiasClamp,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003979 f32 depthBiasSlopeFactor) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003980 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003981 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003982}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003983
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003984@threadSafety("app")
3985cmd void vkCmdSetBlendConstants(
3986 VkCmdBuffer cmdBuffer,
3987 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3988 // an annotation as a quick hack to pass this to the template without
3989 // having to modify the AST and semantic model.
3990 @readonly f32[4] blendConst) {
3991 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003992 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003993}
3994
3995@threadSafety("app")
3996cmd void vkCmdSetDepthBounds(
3997 VkCmdBuffer cmdBuffer,
3998 f32 minDepthBounds,
3999 f32 maxDepthBounds) {
4000 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004001 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004002}
4003
4004@threadSafety("app")
4005cmd void vkCmdSetStencilCompareMask(
4006 VkCmdBuffer cmdBuffer,
4007 VkStencilFaceFlags faceMask,
4008 u32 stencilCompareMask) {
4009 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004010 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004011}
4012
4013@threadSafety("app")
4014cmd void vkCmdSetStencilWriteMask(
4015 VkCmdBuffer cmdBuffer,
4016 VkStencilFaceFlags faceMask,
4017 u32 stencilWriteMask) {
4018 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004019 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004020}
4021
4022@threadSafety("app")
4023cmd void vkCmdSetStencilReference(
4024 VkCmdBuffer cmdBuffer,
4025 VkStencilFaceFlags faceMask,
4026 u32 stencilReference) {
4027 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004028 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004029}
4030
4031@threadSafety("app")
4032cmd void vkCmdBindDescriptorSets(
4033 VkCmdBuffer cmdBuffer,
4034 VkPipelineBindPoint pipelineBindPoint,
4035 VkPipelineLayout layout,
4036 u32 firstSet,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004037 u32 descriptorSetCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004038 const VkDescriptorSet* pDescriptorSets,
4039 u32 dynamicOffsetCount,
4040 const u32* pDynamicOffsets) {
4041 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4042
Jesse Hall03b6fe12015-11-24 12:44:21 -08004043 descriptorSets := pDescriptorSets[0:descriptorSetCount]
4044 for i in (0 .. descriptorSetCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004045 descriptorSet := descriptorSets[i]
4046 descriptorSetObject := GetDescriptorSet(descriptorSet)
4047 assert(cmdBufferObject.device == descriptorSetObject.device)
4048 }
4049
4050 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
4051 for i in (0 .. dynamicOffsetCount) {
4052 dynamicOffset := dynamicOffsets[i]
4053 }
4054
Jesse Halld8bade02015-11-24 10:24:18 -08004055 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004056 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
4057 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
4058 }
Jesse Halld8bade02015-11-24 10:24:18 -08004059 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004060}
4061
4062@threadSafety("app")
4063cmd void vkCmdBindIndexBuffer(
4064 VkCmdBuffer cmdBuffer,
4065 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004066 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004067 VkIndexType indexType) {
4068 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4069 bufferObject := GetBuffer(buffer)
4070 assert(cmdBufferObject.device == bufferObject.device)
4071
4072 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4073
Jesse Halld8bade02015-11-24 10:24:18 -08004074 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004075}
4076
4077@threadSafety("app")
4078cmd void vkCmdBindVertexBuffers(
4079 VkCmdBuffer cmdBuffer,
4080 u32 startBinding,
4081 u32 bindingCount,
4082 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004083 const VkDeviceSize* pOffsets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004084 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4085
4086 // TODO: check if not [startBinding:startBinding+bindingCount]
4087 buffers := pBuffers[0:bindingCount]
4088 offsets := pOffsets[0:bindingCount]
4089 for i in (0 .. bindingCount) {
4090 buffer := buffers[i]
4091 offset := offsets[i]
4092 bufferObject := GetBuffer(buffer)
4093 assert(cmdBufferObject.device == bufferObject.device)
4094
4095 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4096 }
4097
Jesse Halld8bade02015-11-24 10:24:18 -08004098 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004099}
4100
4101@threadSafety("app")
4102cmd void vkCmdDraw(
4103 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004104 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004105 u32 instanceCount,
4106 u32 firstVertex,
4107 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004108 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4109
Jesse Halld8bade02015-11-24 10:24:18 -08004110 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004111}
4112
4113@threadSafety("app")
4114cmd void vkCmdDrawIndexed(
4115 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004116 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004117 u32 instanceCount,
4118 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004119 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004120 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004121 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4122
Jesse Halld8bade02015-11-24 10:24:18 -08004123 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004124}
4125
4126@threadSafety("app")
4127cmd void vkCmdDrawIndirect(
4128 VkCmdBuffer cmdBuffer,
4129 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004130 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004131 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004132 u32 stride) {
4133 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4134 bufferObject := GetBuffer(buffer)
4135 assert(cmdBufferObject.device == bufferObject.device)
4136
4137 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4138
Jesse Halld8bade02015-11-24 10:24:18 -08004139 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004140}
4141
4142@threadSafety("app")
4143cmd void vkCmdDrawIndexedIndirect(
4144 VkCmdBuffer cmdBuffer,
4145 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004146 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004147 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004148 u32 stride) {
4149 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4150 bufferObject := GetBuffer(buffer)
4151 assert(cmdBufferObject.device == bufferObject.device)
4152
4153 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4154
Jesse Halld8bade02015-11-24 10:24:18 -08004155 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004156}
4157
4158@threadSafety("app")
4159cmd void vkCmdDispatch(
4160 VkCmdBuffer cmdBuffer,
4161 u32 x,
4162 u32 y,
4163 u32 z) {
4164 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4165
Jesse Halld8bade02015-11-24 10:24:18 -08004166 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004167}
4168
4169@threadSafety("app")
4170cmd void vkCmdDispatchIndirect(
4171 VkCmdBuffer cmdBuffer,
4172 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004173 VkDeviceSize offset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004174 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4175 bufferObject := GetBuffer(buffer)
4176 assert(cmdBufferObject.device == bufferObject.device)
4177
4178 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4179
Jesse Halld8bade02015-11-24 10:24:18 -08004180 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004181}
4182
4183@threadSafety("app")
4184cmd void vkCmdCopyBuffer(
4185 VkCmdBuffer cmdBuffer,
4186 VkBuffer srcBuffer,
4187 VkBuffer destBuffer,
4188 u32 regionCount,
4189 const VkBufferCopy* pRegions) {
4190 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4191 srcBufferObject := GetBuffer(srcBuffer)
4192 destBufferObject := GetBuffer(destBuffer)
4193 assert(cmdBufferObject.device == srcBufferObject.device)
4194 assert(cmdBufferObject.device == destBufferObject.device)
4195
4196 regions := pRegions[0:regionCount]
4197 for i in (0 .. regionCount) {
4198 region := regions[i]
4199 }
4200
4201 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
4202 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4203
Jesse Halld8bade02015-11-24 10:24:18 -08004204 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004205}
4206
4207@threadSafety("app")
4208cmd void vkCmdCopyImage(
4209 VkCmdBuffer cmdBuffer,
4210 VkImage srcImage,
4211 VkImageLayout srcImageLayout,
4212 VkImage destImage,
4213 VkImageLayout destImageLayout,
4214 u32 regionCount,
4215 const VkImageCopy* pRegions) {
4216 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4217 srcImageObject := GetImage(srcImage)
4218 destImageObject := GetImage(destImage)
4219 assert(cmdBufferObject.device == srcImageObject.device)
4220 assert(cmdBufferObject.device == destImageObject.device)
4221
4222 regions := pRegions[0:regionCount]
4223 for i in (0 .. regionCount) {
4224 region := regions[i]
4225 }
4226
4227 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4228 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4229
Jesse Halld8bade02015-11-24 10:24:18 -08004230 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004231}
4232
4233@threadSafety("app")
4234cmd void vkCmdBlitImage(
4235 VkCmdBuffer cmdBuffer,
4236 VkImage srcImage,
4237 VkImageLayout srcImageLayout,
4238 VkImage destImage,
4239 VkImageLayout destImageLayout,
4240 u32 regionCount,
4241 const VkImageBlit* pRegions,
Jesse Hall23ff73f2015-11-29 14:36:39 -08004242 VkFilter filter) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004243 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4244 srcImageObject := GetImage(srcImage)
4245 destImageObject := GetImage(destImage)
4246 assert(cmdBufferObject.device == srcImageObject.device)
4247 assert(cmdBufferObject.device == destImageObject.device)
4248
4249 regions := pRegions[0:regionCount]
4250 for i in (0 .. regionCount) {
4251 region := regions[i]
4252 }
4253
4254 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4255 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4256
Jesse Halld8bade02015-11-24 10:24:18 -08004257 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004258}
4259
4260@threadSafety("app")
4261cmd void vkCmdCopyBufferToImage(
4262 VkCmdBuffer cmdBuffer,
4263 VkBuffer srcBuffer,
4264 VkImage destImage,
4265 VkImageLayout destImageLayout,
4266 u32 regionCount,
4267 const VkBufferImageCopy* pRegions) {
4268 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4269 srcBufferObject := GetBuffer(srcBuffer)
4270 destImageObject := GetImage(destImage)
4271 assert(cmdBufferObject.device == srcBufferObject.device)
4272 assert(cmdBufferObject.device == destImageObject.device)
4273
4274 regions := pRegions[0:regionCount]
4275 for i in (0 .. regionCount) {
4276 region := regions[i]
4277 }
4278
4279 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
4280 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4281
Jesse Halld8bade02015-11-24 10:24:18 -08004282 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004283}
4284
4285@threadSafety("app")
4286cmd void vkCmdCopyImageToBuffer(
4287 VkCmdBuffer cmdBuffer,
4288 VkImage srcImage,
4289 VkImageLayout srcImageLayout,
4290 VkBuffer destBuffer,
4291 u32 regionCount,
4292 const VkBufferImageCopy* pRegions) {
4293 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4294 srcImageObject := GetImage(srcImage)
4295 destBufferObject := GetBuffer(destBuffer)
4296 assert(cmdBufferObject.device == srcImageObject.device)
4297 assert(cmdBufferObject.device == destBufferObject.device)
4298
4299 regions := pRegions[0:regionCount]
4300 for i in (0 .. regionCount) {
4301 region := regions[i]
4302 }
4303
4304 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4305 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4306
Jesse Halld8bade02015-11-24 10:24:18 -08004307 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004308}
4309
4310@threadSafety("app")
4311cmd void vkCmdUpdateBuffer(
4312 VkCmdBuffer cmdBuffer,
4313 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004314 VkDeviceSize destOffset,
4315 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004316 const u32* pData) {
4317 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4318 destBufferObject := GetBuffer(destBuffer)
4319 assert(cmdBufferObject.device == destBufferObject.device)
4320
4321 data := pData[0:dataSize]
4322
4323 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4324
Jesse Halld8bade02015-11-24 10:24:18 -08004325 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004326}
4327
4328@threadSafety("app")
4329cmd void vkCmdFillBuffer(
4330 VkCmdBuffer cmdBuffer,
4331 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004332 VkDeviceSize destOffset,
4333 VkDeviceSize fillSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004334 u32 data) {
4335 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4336 destBufferObject := GetBuffer(destBuffer)
4337 assert(cmdBufferObject.device == destBufferObject.device)
4338
Jesse Halld8bade02015-11-24 10:24:18 -08004339 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004340}
4341
4342@threadSafety("app")
4343cmd void vkCmdClearColorImage(
4344 VkCmdBuffer cmdBuffer,
4345 VkImage image,
4346 VkImageLayout imageLayout,
4347 const VkClearColorValue* pColor,
4348 u32 rangeCount,
4349 const VkImageSubresourceRange* pRanges) {
4350 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4351 imageObject := GetImage(image)
4352 assert(cmdBufferObject.device == imageObject.device)
4353
4354 ranges := pRanges[0:rangeCount]
4355 for i in (0 .. rangeCount) {
4356 range := ranges[i]
4357 }
4358
4359 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
4360
Jesse Halld8bade02015-11-24 10:24:18 -08004361 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004362}
4363
4364@threadSafety("app")
4365cmd void vkCmdClearDepthStencilImage(
4366 VkCmdBuffer cmdBuffer,
4367 VkImage image,
4368 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004369 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004370 u32 rangeCount,
4371 const VkImageSubresourceRange* pRanges) {
4372 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4373 imageObject := GetImage(image)
4374 assert(cmdBufferObject.device == imageObject.device)
4375
4376 ranges := pRanges[0:rangeCount]
4377 for i in (0 .. rangeCount) {
4378 range := ranges[i]
4379 }
4380
4381 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
4382
Jesse Halld8bade02015-11-24 10:24:18 -08004383 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004384}
4385
4386@threadSafety("app")
Jesse Hallae38f732015-11-19 21:32:50 -08004387cmd void vkCmdClearAttachments(
Jesse Halld27f6aa2015-08-15 17:58:48 -07004388 VkCmdBuffer cmdBuffer,
Jesse Hallae38f732015-11-19 21:32:50 -08004389 u32 attachmentCount,
4390 const VkClearAttachment* pAttachments,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004391 u32 rectCount,
Jesse Halla15a4bf2015-11-19 22:48:02 -08004392 const VkClearRect* pRects) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004393 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4394
4395 rects := pRects[0:rectCount]
4396 for i in (0 .. rectCount) {
4397 rect := rects[i]
4398 }
4399
Jesse Halld8bade02015-11-24 10:24:18 -08004400 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004401}
4402
4403@threadSafety("app")
4404cmd void vkCmdResolveImage(
4405 VkCmdBuffer cmdBuffer,
4406 VkImage srcImage,
4407 VkImageLayout srcImageLayout,
4408 VkImage destImage,
4409 VkImageLayout destImageLayout,
4410 u32 regionCount,
4411 const VkImageResolve* pRegions) {
4412 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4413 srcImageObject := GetImage(srcImage)
4414 destImageObject := GetImage(destImage)
4415 assert(cmdBufferObject.device == srcImageObject.device)
4416 assert(cmdBufferObject.device == destImageObject.device)
4417
4418 regions := pRegions[0:regionCount]
4419 for i in (0 .. regionCount) {
4420 region := regions[i]
4421 }
4422
4423 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4424 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4425
Jesse Halld8bade02015-11-24 10:24:18 -08004426 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004427}
4428
4429@threadSafety("app")
4430cmd void vkCmdSetEvent(
4431 VkCmdBuffer cmdBuffer,
4432 VkEvent event,
4433 VkPipelineStageFlags stageMask) {
4434 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4435 eventObject := GetEvent(event)
4436 assert(cmdBufferObject.device == eventObject.device)
4437}
4438
4439@threadSafety("app")
4440cmd void vkCmdResetEvent(
4441 VkCmdBuffer cmdBuffer,
4442 VkEvent event,
4443 VkPipelineStageFlags stageMask) {
4444 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4445 eventObject := GetEvent(event)
4446 assert(cmdBufferObject.device == eventObject.device)
4447}
4448
4449@threadSafety("app")
4450cmd void vkCmdWaitEvents(
4451 VkCmdBuffer cmdBuffer,
4452 u32 eventCount,
4453 const VkEvent* pEvents,
4454 VkPipelineStageFlags srcStageMask,
4455 VkPipelineStageFlags destStageMask,
4456 u32 memBarrierCount,
4457 const void* const* ppMemBarriers) {
4458 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4459
4460 events := pEvents[0:eventCount]
4461 for i in (0 .. eventCount) {
4462 event := events[i]
4463 eventObject := GetEvent(event)
4464 assert(cmdBufferObject.device == eventObject.device)
4465 }
4466
4467 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4468 for i in (0 .. memBarrierCount) {
4469 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4470 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4471 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4472 }
4473 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4474 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4475 imageObject := GetImage(imageMemBarrier.image)
4476 assert(imageObject.device == cmdBufferObject.device)
4477 }
4478 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4479 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4480 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4481 assert(bufferObject.device == cmdBufferObject.device)
4482 }
4483 }
4484 }
4485}
4486
4487@threadSafety("app")
4488cmd void vkCmdPipelineBarrier(
4489 VkCmdBuffer cmdBuffer,
4490 VkPipelineStageFlags srcStageMask,
4491 VkPipelineStageFlags destStageMask,
Jesse Halldc6d36c2015-11-29 19:12:15 -08004492 VkDependencyFlags dependencyFlags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004493 u32 memBarrierCount,
4494 const void* const* ppMemBarriers) {
4495 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4496
4497 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4498 for i in (0 .. memBarrierCount) {
4499 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4500 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4501 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4502 }
4503 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4504 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4505 imageObject := GetImage(imageMemBarrier.image)
4506 assert(imageObject.device == cmdBufferObject.device)
4507 }
4508 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4509 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4510 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4511 assert(bufferObject.device == cmdBufferObject.device)
4512 }
4513 }
4514 }
4515}
4516
4517@threadSafety("app")
4518cmd void vkCmdBeginQuery(
4519 VkCmdBuffer cmdBuffer,
4520 VkQueryPool queryPool,
4521 u32 slot,
4522 VkQueryControlFlags flags) {
4523 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4524 queryPoolObject := GetQueryPool(queryPool)
4525 assert(cmdBufferObject.device == queryPoolObject.device)
4526}
4527
4528@threadSafety("app")
4529cmd void vkCmdEndQuery(
4530 VkCmdBuffer cmdBuffer,
4531 VkQueryPool queryPool,
4532 u32 slot) {
4533 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4534 queryPoolObject := GetQueryPool(queryPool)
4535 assert(cmdBufferObject.device == queryPoolObject.device)
4536}
4537
4538@threadSafety("app")
4539cmd void vkCmdResetQueryPool(
4540 VkCmdBuffer cmdBuffer,
4541 VkQueryPool queryPool,
4542 u32 startQuery,
4543 u32 queryCount) {
4544 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4545 queryPoolObject := GetQueryPool(queryPool)
4546 assert(cmdBufferObject.device == queryPoolObject.device)
4547}
4548
4549@threadSafety("app")
4550cmd void vkCmdWriteTimestamp(
4551 VkCmdBuffer cmdBuffer,
Jesse Hall6f39a6d2015-11-24 11:08:36 -08004552 VkPipelineStageFlagBits pipelineStage,
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004553 VkQueryPool queryPool,
4554 u32 slot) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004555 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004556 queryPoolObject := GetQueryPool(queryPool)
4557 assert(cmdBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004558}
4559
4560@threadSafety("app")
4561cmd void vkCmdCopyQueryPoolResults(
4562 VkCmdBuffer cmdBuffer,
4563 VkQueryPool queryPool,
4564 u32 startQuery,
4565 u32 queryCount,
4566 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004567 VkDeviceSize destOffset,
Jesse Halla9bb62b2015-11-21 19:31:56 -08004568 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004569 VkQueryResultFlags flags) {
4570 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4571 queryPoolObject := GetQueryPool(queryPool)
4572 destBufferObject := GetBuffer(destBuffer)
4573 assert(cmdBufferObject.device == queryPoolObject.device)
4574 assert(cmdBufferObject.device == destBufferObject.device)
4575}
4576
4577cmd void vkCmdPushConstants(
4578 VkCmdBuffer cmdBuffer,
4579 VkPipelineLayout layout,
4580 VkShaderStageFlags stageFlags,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004581 u32 offset,
4582 u32 size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004583 const void* values) {
4584 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4585 layoutObject := GetPipelineLayout(layout)
4586 assert(cmdBufferObject.device == layoutObject.device)
4587}
4588
4589@threadSafety("app")
4590cmd void vkCmdBeginRenderPass(
4591 VkCmdBuffer cmdBuffer,
4592 const VkRenderPassBeginInfo* pRenderPassBegin,
4593 VkRenderPassContents contents) {
4594 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4595 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4596 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
4597 assert(cmdBufferObject.device == renderPassObject.device)
4598 assert(cmdBufferObject.device == framebufferObject.device)
4599
Jesse Halld8bade02015-11-24 10:24:18 -08004600 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004601}
4602
4603cmd void vkCmdNextSubpass(
4604 VkCmdBuffer cmdBuffer,
4605 VkRenderPassContents contents) {
4606 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4607}
4608
4609@threadSafety("app")
4610cmd void vkCmdEndRenderPass(
4611 VkCmdBuffer cmdBuffer) {
4612 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4613
Jesse Halld8bade02015-11-24 10:24:18 -08004614 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004615}
4616
4617cmd void vkCmdExecuteCommands(
4618 VkCmdBuffer cmdBuffer,
4619 u32 cmdBuffersCount,
4620 const VkCmdBuffer* pCmdBuffers) {
4621 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4622
4623 cmdBuffers := pCmdBuffers[0:cmdBuffersCount]
4624 for i in (0 .. cmdBuffersCount) {
4625 secondaryCmdBuffer := cmdBuffers[i]
4626 secondaryCmdBufferObject := GetCmdBuffer(secondaryCmdBuffer)
4627 assert(cmdBufferObject.device == secondaryCmdBufferObject.device)
4628 }
4629}
4630
Jesse Hall1356b0d2015-11-23 17:24:58 -08004631@extension("VK_EXT_KHR_surface")
4632cmd void vkDestroySurfaceKHR(
4633 VkInstance instance,
4634 VkSurfaceKHR surface) {
4635 instanceObject := GetInstance(instance)
4636 surfaceObject := GetSurface(surface)
4637 assert(surfaceObject.instance == instance)
Michael Lentine88594d72015-11-12 12:49:45 -08004638
Jesse Hall1356b0d2015-11-23 17:24:58 -08004639 State.Surfaces[surface] = null
Jesse Hall2818f932015-11-19 21:19:17 -08004640}
4641
Jesse Hall1356b0d2015-11-23 17:24:58 -08004642@extension("VK_EXT_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004643cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004644 VkPhysicalDevice physicalDevice,
4645 u32 queueFamilyIndex,
4646 VkSurfaceKHR surface) {
4647 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4648
4649 //supported := ?
4650
4651 return ?//supported
4652}
4653
4654@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004655cmd VkResult vkGetSurfacePropertiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004656 VkDevice device,
4657 VkSurfaceKHR surface,
4658 VkSurfacePropertiesKHR* pSurfaceProperties) {
Michael Lentine88594d72015-11-12 12:49:45 -08004659 deviceObject := GetDevice(device)
4660
4661 surfaceProperties := ?
4662 pSurfaceProperties[0] = surfaceProperties
4663
4664 return ?
4665}
4666
Jesse Hall1356b0d2015-11-23 17:24:58 -08004667@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004668cmd VkResult vkGetSurfaceFormatsKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004669 VkDevice device,
4670 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004671 u32* pSurfaceFormatCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004672 VkSurfaceFormatKHR* pSurfaceFormats) {
Michael Lentine88594d72015-11-12 12:49:45 -08004673 deviceObject := GetDevice(device)
4674
4675 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004676 pSurfaceFormatCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004677 surfaceFormats := pSurfaceFormats[0:count]
4678
4679 for i in (0 .. count) {
4680 surfaceFormat := ?
4681 surfaceFormats[i] = surfaceFormat
4682 }
4683
4684 return ?
4685}
4686
Jesse Hall1356b0d2015-11-23 17:24:58 -08004687@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004688cmd VkResult vkGetSurfacePresentModesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004689 VkDevice device,
4690 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004691 u32* pPresentModeCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004692 VkPresentModeKHR* pPresentModes) {
Michael Lentine88594d72015-11-12 12:49:45 -08004693 deviceObject := GetDevice(device)
4694
4695 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004696 pPresentModeCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004697 presentModes := pPresentModes[0:count]
4698
4699 for i in (0 .. count) {
4700 presentMode := ?
4701 presentModes[i] = presentMode
4702 }
4703
4704 return ?
4705}
4706
Jesse Hall1356b0d2015-11-23 17:24:58 -08004707@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004708cmd VkResult vkCreateSwapchainKHR(
4709 VkDevice device,
4710 const VkSwapchainCreateInfoKHR* pCreateInfo,
4711 VkSwapchainKHR* pSwapchain) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004712 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
Michael Lentine88594d72015-11-12 12:49:45 -08004713 deviceObject := GetDevice(device)
4714
4715 swapchain := ?
4716 pSwapchain[0] = swapchain
4717 State.Swapchains[swapchain] = new!SwapchainObject(device: device)
4718
4719 return ?
4720}
4721
Jesse Hall1356b0d2015-11-23 17:24:58 -08004722@extension("VK_EXT_KHR_swapchain")
4723cmd void vkDestroySwapchainKHR(
Michael Lentine88594d72015-11-12 12:49:45 -08004724 VkDevice device,
4725 VkSwapchainKHR swapchain) {
4726 deviceObject := GetDevice(device)
4727 swapchainObject := GetSwapchain(swapchain)
4728 assert(swapchainObject.device == device)
4729
4730 State.Swapchains[swapchain] = null
Michael Lentine88594d72015-11-12 12:49:45 -08004731}
4732
Jesse Hall1356b0d2015-11-23 17:24:58 -08004733@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004734cmd VkResult vkGetSwapchainImagesKHR(
4735 VkDevice device,
4736 VkSwapchainKHR swapchain,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004737 u32* pSwapchainImageCount,
Michael Lentine88594d72015-11-12 12:49:45 -08004738 VkImage* pSwapchainImages) {
4739 deviceObject := GetDevice(device)
4740
4741 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004742 pSwapchainImageCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004743 swapchainImages := pSwapchainImages[0:count]
4744
4745 for i in (0 .. count) {
4746 swapchainImage := ?
4747 swapchainImages[i] = swapchainImage
Jesse Hall1356b0d2015-11-23 17:24:58 -08004748 State.Images[swapchainImage] = new!ImageObject(device: device)
Michael Lentine88594d72015-11-12 12:49:45 -08004749 }
4750
4751 return ?
4752}
4753
Jesse Hall1356b0d2015-11-23 17:24:58 -08004754@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004755cmd VkResult vkAcquireNextImageKHR(
4756 VkDevice device,
4757 VkSwapchainKHR swapchain,
4758 u64 timeout,
4759 VkSemaphore semaphore,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004760 VkFence fence,
Michael Lentine88594d72015-11-12 12:49:45 -08004761 u32* pImageIndex) {
4762 deviceObject := GetDevice(device)
4763 swapchainObject := GetSwapchain(swapchain)
4764
4765 imageIndex := ?
4766 pImageIndex[0] = imageIndex
4767
4768 return ?
4769}
4770
Jesse Hall1356b0d2015-11-23 17:24:58 -08004771@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004772cmd VkResult vkQueuePresentKHR(
4773 VkQueue queue,
4774 VkPresentInfoKHR* pPresentInfo) {
4775 queueObject := GetQueue(queue)
4776
4777 presentInfo := ?
4778 pPresentInfo[0] = presentInfo
4779
4780 return ?
4781}
4782
Jesse Hall1356b0d2015-11-23 17:24:58 -08004783@extension("VK_EXT_KHR_display")
4784cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
4785 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004786 u32* pPropertyCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004787 VkDisplayPropertiesKHR* pProperties) {
4788 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4789 return ?
4790}
4791
4792@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004793cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
4794 VkPhysicalDevice physicalDevice,
4795 u32* pPropertyCount,
4796 VkDisplayPlanePropertiesKHR* pProperties) {
4797 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4798 return ?
4799}
4800
4801@extension("VK_EXT_KHR_display")
4802cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR(
4803 VkPhysicalDevice physicalDevice,
4804 u32* pPropertyCount,
4805 VkDisplayKHR* pProperties) {
4806 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4807 return ?
4808}
4809
4810@extension("VK_EXT_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004811cmd VkResult vkGetDisplayModePropertiesKHR(
4812 VkPhysicalDevice physicalDevice,
4813 VkDisplayKHR display,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004814 u32* pPropertyCount,
4815 VkDisplayModePropertiesKHR* pProperties) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004816 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4817 return ?
4818}
4819
4820@extension("VK_EXT_KHR_display")
4821cmd VkResult vkCreateDisplayModeKHR(
4822 VkPhysicalDevice physicalDevice,
4823 VkDisplayKHR display,
4824 const VkDisplayModeCreateInfoKHR* pCreateInfo,
4825 VkDisplayModeKHR* pMode) {
4826 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4827 return ?
4828}
4829
4830@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004831cmd VkResult vkGetDisplayPlaneCapabilitiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004832 VkPhysicalDevice physicalDevice,
Jesse Halla6429252015-11-29 18:59:42 -08004833 VkDisplayModeCreateInfoKHR mode,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004834 u32 planeIndex,
Jesse Halla6429252015-11-29 18:59:42 -08004835 VkDisplayPlaneCapabilitiesKHR* pCapabilities) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004836 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4837 return ?
4838}
4839
Jesse Halla6429252015-11-29 18:59:42 -08004840@extension("VK_EXT_KHR_display")
4841cmd VkResult vkCreateDisplayPlaneSurfaceKHR(
4842 VkInstance instance,
4843 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
4844 VkSurfaceKHR* pSurface) {
4845 return ?
4846}
4847
4848@extension("VK_EXT_KHR_xlib_surface")
4849cmd VkResult vkCreateXlibSurfaceKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004850 VkInstance instance,
4851 platform.Display* dpy,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004852 platform.Window window,
4853 VkSurfaceKHR* pSurface) {
4854 instanceObject := GetInstance(instance)
4855 return ?
4856}
4857
Jesse Halla6429252015-11-29 18:59:42 -08004858@extension("VK_EXT_KHR_xlib_surface")
4859cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
4860 VkPhysicalDevice physicalDevice,
4861 u32 queueFamilyIndex,
4862 platform.Display* dpy,
4863 platform.VisualID visualId) {
4864 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4865 return ?
4866}
4867
Jesse Hall1356b0d2015-11-23 17:24:58 -08004868@extension("VK_EXT_KHR_xcb_surface")
4869cmd VkResult vkCreateXCBSurfaceKHR(
4870 VkInstance instance,
4871 platform.xcb_connection_t* connection,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004872 platform.xcb_window_t window,
4873 VkSurfaceKHR* pSurface) {
4874 instanceObject := GetInstance(instance)
4875 return ?
4876}
4877
Jesse Halla6429252015-11-29 18:59:42 -08004878@extension("VK_EXT_KHR_xlib_surface")
4879cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
4880 VkPhysicalDevice physicalDevice,
4881 u32 queueFamilyIndex,
4882 platform.xcb_connection_t* connection,
4883 platform.xcb_visualid_t visual_id) {
4884 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4885 return ?
4886}
4887
Jesse Hall1356b0d2015-11-23 17:24:58 -08004888@extension("VK_EXT_KHR_wayland_surface")
4889cmd VkResult vkCreateWaylandSurfaceKHR(
4890 VkInstance instance,
4891 platform.wl_display* display,
4892 platform.wl_surface* surface,
4893 VkSurfaceKHR* pSurface) {
4894 instanceObject := GetInstance(instance)
4895 return ?
4896}
4897
Jesse Halla6429252015-11-29 18:59:42 -08004898@extension("VK_EXT_KHR_wayland_surface")
4899cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
4900 VkPhysicalDevice physicalDevice,
4901 u32 queueFamilyIndex,
4902 platform.wl_display* display) {
4903 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4904 return ?
4905}
4906
Jesse Hall1356b0d2015-11-23 17:24:58 -08004907@extension("VK_EXT_KHR_mir_surface")
4908cmd VkResult vkCreateMirSurfaceKHR(
4909 VkInstance instance,
4910 platform.MirConnection* connection,
4911 platform.MirSurface* mirSurface,
4912 VkSurfaceKHR* pSurface) {
4913 instanceObject := GetInstance(instance)
4914 return ?
4915}
4916
Jesse Halla6429252015-11-29 18:59:42 -08004917@extension("VK_EXT_KHR_mir_surface")
4918cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR(
4919 VkPhysicalDevice physicalDevice,
4920 u32 queueFamilyIndex,
4921 platform.MirConnection* connection) {
4922 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4923 return ?
4924}
4925
Jesse Hall1356b0d2015-11-23 17:24:58 -08004926@extension("VK_EXT_KHR_android_surface")
4927cmd VkResult vkCreateAndroidSurfaceKHR(
4928 VkInstance instance,
4929 platform.ANativeWindow* window
4930 VkSurfaceKHR* pSurface) {
4931 instanceObject := GetInstance(instance)
4932 return ?
4933}
4934
4935@extension("VK_EXT_KHR_win32_surface")
4936cmd VkResult vkCreateWin32SurfaceKHR(
4937 VkInstance instance,
4938 platform.HINSTANCE hinstance,
4939 platform.HWND hwnd,
4940 VkSurfaceKHR* pSurface) {
4941 instanceObject := GetInstance(instance)
4942 return ?
4943}
4944
Jesse Halla6429252015-11-29 18:59:42 -08004945@extension("VK_EXT_KHR_win32_surface")
4946cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR(
4947 VkPhysicalDevice physicalDevice,
4948 u32 queueFamilyIndex) {
4949 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4950 return ?
4951}
4952
Jesse Halld27f6aa2015-08-15 17:58:48 -07004953
4954////////////////
4955// Validation //
4956////////////////
4957
4958extern void validate(string layerName, bool condition, string message)
4959
4960
4961/////////////////////////////
4962// Internal State Tracking //
4963/////////////////////////////
4964
4965StateObject State
4966
4967@internal class StateObject {
4968 // Dispatchable objects.
4969 map!(VkInstance, ref!InstanceObject) Instances
4970 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4971 map!(VkDevice, ref!DeviceObject) Devices
4972 map!(VkQueue, ref!QueueObject) Queues
4973 map!(VkCmdBuffer, ref!CmdBufferObject) CmdBuffers
4974
4975 // Non-dispatchable objects.
4976 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4977 map!(VkBuffer, ref!BufferObject) Buffers
4978 map!(VkBufferView, ref!BufferViewObject) BufferViews
4979 map!(VkImage, ref!ImageObject) Images
4980 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004981 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
4982 map!(VkShader, ref!ShaderObject) Shaders
4983 map!(VkPipeline, ref!PipelineObject) Pipelines
4984 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4985 map!(VkSampler, ref!SamplerObject) Samplers
4986 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4987 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4988 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004989 map!(VkFence, ref!FenceObject) Fences
4990 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4991 map!(VkEvent, ref!EventObject) Events
4992 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4993 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4994 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4995 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
4996 map!(VkCmdPool, ref!CmdPoolObject) CmdPools
Jesse Hall1356b0d2015-11-23 17:24:58 -08004997 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces
Michael Lentine88594d72015-11-12 12:49:45 -08004998 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains
Jesse Halld27f6aa2015-08-15 17:58:48 -07004999}
5000
5001@internal class InstanceObject {
5002}
5003
5004@internal class PhysicalDeviceObject {
5005 VkInstance instance
5006}
5007
5008@internal class DeviceObject {
5009 VkPhysicalDevice physicalDevice
5010}
5011
5012@internal class QueueObject {
5013 VkDevice device
5014 VkQueueFlags flags
5015}
5016
5017@internal class CmdBufferObject {
5018 VkDevice device
5019 map!(u64, VkDeviceMemory) boundObjects
5020 VkQueueFlags queueFlags
5021}
5022
5023@internal class DeviceMemoryObject {
5024 VkDevice device
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005025 VkDeviceSize allocationSize
5026 map!(u64, VkDeviceSize ) boundObjects
Jesse Halld27f6aa2015-08-15 17:58:48 -07005027 map!(VkCmdBuffer, VkCmdBuffer) boundCommandBuffers
5028}
5029
5030@internal class BufferObject {
5031 VkDevice device
5032 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005033 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005034}
5035
5036@internal class BufferViewObject {
5037 VkDevice device
5038 VkBuffer buffer
5039}
5040
5041@internal class ImageObject {
5042 VkDevice device
5043 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005044 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005045}
5046
5047@internal class ImageViewObject {
5048 VkDevice device
5049 VkImage image
5050}
5051
Jesse Halld27f6aa2015-08-15 17:58:48 -07005052@internal class ShaderObject {
5053 VkDevice device
5054}
5055
5056@internal class ShaderModuleObject {
5057 VkDevice device
5058}
5059
5060@internal class PipelineObject {
5061 VkDevice device
5062}
5063
5064@internal class PipelineLayoutObject {
5065 VkDevice device
5066}
5067
5068@internal class SamplerObject {
5069 VkDevice device
5070}
5071
5072@internal class DescriptorSetObject {
5073 VkDevice device
5074}
5075
5076@internal class DescriptorSetLayoutObject {
5077 VkDevice device
5078}
5079
5080@internal class DescriptorPoolObject {
5081 VkDevice device
5082}
5083
Jesse Halld27f6aa2015-08-15 17:58:48 -07005084@internal class FenceObject {
5085 VkDevice device
5086 bool signaled
5087}
5088
5089@internal class SemaphoreObject {
5090 VkDevice device
5091}
5092
5093@internal class EventObject {
5094 VkDevice device
5095}
5096
5097@internal class QueryPoolObject {
5098 VkDevice device
5099}
5100
5101@internal class FramebufferObject {
5102 VkDevice device
5103}
5104
5105@internal class RenderPassObject {
5106 VkDevice device
5107}
5108
5109@internal class PipelineCacheObject {
5110 VkDevice device
5111}
5112
5113@internal class CmdPoolObject {
5114 VkDevice device
5115}
5116
Jesse Hall1356b0d2015-11-23 17:24:58 -08005117@internal class SurfaceObject {
5118 VkInstance instance
5119}
5120
Michael Lentine88594d72015-11-12 12:49:45 -08005121@internal class SwapchainObject {
5122 VkDevice device
5123}
5124
Jesse Halld27f6aa2015-08-15 17:58:48 -07005125macro ref!InstanceObject GetInstance(VkInstance instance) {
5126 assert(instance in State.Instances)
5127 return State.Instances[instance]
5128}
5129
5130macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
5131 assert(physicalDevice in State.PhysicalDevices)
5132 return State.PhysicalDevices[physicalDevice]
5133}
5134
5135macro ref!DeviceObject GetDevice(VkDevice device) {
5136 assert(device in State.Devices)
5137 return State.Devices[device]
5138}
5139
5140macro ref!QueueObject GetQueue(VkQueue queue) {
5141 assert(queue in State.Queues)
5142 return State.Queues[queue]
5143}
5144
5145macro ref!CmdBufferObject GetCmdBuffer(VkCmdBuffer cmdBuffer) {
5146 assert(cmdBuffer in State.CmdBuffers)
5147 return State.CmdBuffers[cmdBuffer]
5148}
5149
5150macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory mem) {
5151 assert(mem in State.DeviceMemories)
5152 return State.DeviceMemories[mem]
5153}
5154
5155macro ref!BufferObject GetBuffer(VkBuffer buffer) {
5156 assert(buffer in State.Buffers)
5157 return State.Buffers[buffer]
5158}
5159
5160macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
5161 assert(bufferView in State.BufferViews)
5162 return State.BufferViews[bufferView]
5163}
5164
5165macro ref!ImageObject GetImage(VkImage image) {
5166 assert(image in State.Images)
5167 return State.Images[image]
5168}
5169
5170macro ref!ImageViewObject GetImageView(VkImageView imageView) {
5171 assert(imageView in State.ImageViews)
5172 return State.ImageViews[imageView]
5173}
5174
Jesse Halld27f6aa2015-08-15 17:58:48 -07005175macro ref!ShaderObject GetShader(VkShader shader) {
5176 assert(shader in State.Shaders)
5177 return State.Shaders[shader]
5178}
5179
5180macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
5181 assert(shaderModule in State.ShaderModules)
5182 return State.ShaderModules[shaderModule]
5183}
5184
5185macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
5186 assert(pipeline in State.Pipelines)
5187 return State.Pipelines[pipeline]
5188}
5189
5190macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
5191 assert(pipelineLayout in State.PipelineLayouts)
5192 return State.PipelineLayouts[pipelineLayout]
5193}
5194
5195macro ref!SamplerObject GetSampler(VkSampler sampler) {
5196 assert(sampler in State.Samplers)
5197 return State.Samplers[sampler]
5198}
5199
5200macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
5201 assert(descriptorSet in State.DescriptorSets)
5202 return State.DescriptorSets[descriptorSet]
5203}
5204
5205macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
5206 assert(descriptorSetLayout in State.DescriptorSetLayouts)
5207 return State.DescriptorSetLayouts[descriptorSetLayout]
5208}
5209
5210macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
5211 assert(descriptorPool in State.DescriptorPools)
5212 return State.DescriptorPools[descriptorPool]
5213}
5214
Jesse Halld27f6aa2015-08-15 17:58:48 -07005215macro ref!FenceObject GetFence(VkFence fence) {
5216 assert(fence in State.Fences)
5217 return State.Fences[fence]
5218}
5219
5220macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
5221 assert(semaphore in State.Semaphores)
5222 return State.Semaphores[semaphore]
5223}
5224
5225macro ref!EventObject GetEvent(VkEvent event) {
5226 assert(event in State.Events)
5227 return State.Events[event]
5228}
5229
5230macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
5231 assert(queryPool in State.QueryPools)
5232 return State.QueryPools[queryPool]
5233}
5234
5235macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
5236 assert(framebuffer in State.Framebuffers)
5237 return State.Framebuffers[framebuffer]
5238}
5239
5240macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
5241 assert(renderPass in State.RenderPasses)
5242 return State.RenderPasses[renderPass]
5243}
5244
5245macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
5246 assert(pipelineCache in State.PipelineCaches)
5247 return State.PipelineCaches[pipelineCache]
5248}
5249
5250macro ref!CmdPoolObject GetCmdPool(VkCmdPool cmdPool) {
5251 assert(cmdPool in State.CmdPools)
5252 return State.CmdPools[cmdPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07005253}
Michael Lentine88594d72015-11-12 12:49:45 -08005254
Jesse Hall1356b0d2015-11-23 17:24:58 -08005255macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) {
5256 assert(surface in State.Surfaces)
5257 return State.Surfaces[surface]
5258}
5259
Michael Lentine88594d72015-11-12 12:49:45 -08005260macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) {
5261 assert(swapchain in State.Swapchains)
5262 return State.Swapchains[swapchain]
5263}
Jesse Halld8bade02015-11-24 10:24:18 -08005264
5265macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) {
5266 return as!VkQueueFlags(as!u32(flags) | as!u32(bit))
5267}