blob: 0c6a3cc7bd1d6418bca83b5a47dec2f71794ed4e [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 Halla6429252015-11-29 18:59:42 -080030define VERSION_MINOR 190
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
Michael Lentine88594d72015-11-12 12:49:45 -08001152@extension("VK_EXT_KHR_swapchain")
Jesse Halld8bade02015-11-24 10:24:18 -08001153type VkFlags VkSurfaceTransformFlagsKHR
1154@extension("VK_EXT_KHR_swapchain")
1155bitfield VkSurfaceTransformFlagBitsKHR {
Michael Lentine88594d72015-11-12 12:49:45 -08001156 VK_SURFACE_TRANSFORM_NONE_BIT_KHR = 0x00000001,
1157 VK_SURFACE_TRANSFORM_ROT90_BIT_KHR = 0x00000002,
1158 VK_SURFACE_TRANSFORM_ROT180_BIT_KHR = 0x00000004,
1159 VK_SURFACE_TRANSFORM_ROT270_BIT_KHR = 0x00000008,
1160 VK_SURFACE_TRANSFORM_HMIRROR_BIT_KHR = 0x00000010,
1161 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_BIT_KHR = 0x00000020,
1162 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_BIT_KHR = 0x00000040,
1163 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_BIT_KHR = 0x00000080,
1164 VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
1165}
Jesse Halld27f6aa2015-08-15 17:58:48 -07001166
Jesse Halla6429252015-11-29 18:59:42 -08001167@extension("VK_EXT_KHR_swapchain")
1168type VkFlags VkCompositeAlphaFlagsKHR
1169@extension("VK_EXT_KHR_swapchain")
1170bitfield VkCompositeAlphaFlagBitsKHR {
1171 VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
1172 VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
1173 VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
1174 VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
1175}
1176
Jesse Hall1356b0d2015-11-23 17:24:58 -08001177@extension("VK_EXT_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001178type VkFlags VkDisplayPlaneAlphaFlagsKHR
1179@extension("VK_EXT_KHR_display")
1180bitfield VkDisplayPlaneAlphaFlagBitsKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08001181 VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000001,
1182 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000002,
1183 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000004,
1184}
1185
1186
Jesse Halld27f6aa2015-08-15 17:58:48 -07001187//////////////////
1188// Structures //
1189//////////////////
1190
1191class VkOffset2D {
1192 s32 x
1193 s32 y
1194}
1195
1196class VkOffset3D {
1197 s32 x
1198 s32 y
1199 s32 z
1200}
1201
1202class VkExtent2D {
1203 s32 width
1204 s32 height
1205}
1206
1207class VkExtent3D {
1208 s32 width
1209 s32 height
1210 s32 depth
1211}
1212
1213class VkViewport {
1214 f32 originX
1215 f32 originY
1216 f32 width
1217 f32 height
1218 f32 minDepth
1219 f32 maxDepth
1220}
1221
1222class VkRect2D {
1223 VkOffset2D offset
1224 VkExtent2D extent
1225}
1226
Jesse Halla15a4bf2015-11-19 22:48:02 -08001227class VkClearRect {
1228 VkRect2D rect
1229 u32 baseArrayLayer
1230 u32 numLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001231}
1232
1233class VkChannelMapping {
1234 VkChannelSwizzle r
1235 VkChannelSwizzle g
1236 VkChannelSwizzle b
1237 VkChannelSwizzle a
1238}
1239
1240class VkPhysicalDeviceProperties {
1241 u32 apiVersion
1242 u32 driverVersion
1243 u32 vendorId
1244 u32 deviceId
1245 VkPhysicalDeviceType deviceType
1246 char[VK_MAX_PHYSICAL_DEVICE_NAME] deviceName
1247 u8[VK_UUID_LENGTH] pipelineCacheUUID
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001248 VkPhysicalDeviceLimits limits
1249 VkPhysicalDeviceSparseProperties sparseProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001250}
1251
1252class VkExtensionProperties {
1253 char[VK_MAX_EXTENSION_NAME] extName /// extension name
1254 u32 specVersion /// version of the extension specification implemented
1255}
1256
1257class VkLayerProperties {
1258 char[VK_MAX_EXTENSION_NAME] layerName /// layer name
1259 u32 specVersion /// version of the layer specification implemented
1260 u32 implVersion /// build or release version of the layer's library
Jesse Hallf09c6b12015-08-15 19:54:28 -07001261 char[VK_MAX_DESCRIPTION] description /// Free-form description of the layer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001262}
1263
Jesse Halla366a512015-11-19 22:30:07 -08001264class VkSubmitInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001265 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_SUBMIT_INFO
1266 const void* pNext /// Next structure in chain
1267 u32 waitSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001268 const VkSemaphore* pWaitSemaphores
Jesse Hall03b6fe12015-11-24 12:44:21 -08001269 u32 commandBufferCount
Jesse Halla366a512015-11-19 22:30:07 -08001270 const VkCmdBuffer* pCommandBuffers
Jesse Hall03b6fe12015-11-24 12:44:21 -08001271 u32 signalSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001272 const VkSemaphore* pSignalSemaphores
1273}
1274
Jesse Halld27f6aa2015-08-15 17:58:48 -07001275class VkApplicationInfo {
1276 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO
1277 const void* pNext /// Next structure in chain
1278 const char* pAppName
1279 u32 appVersion
1280 const char* pEngineName
1281 u32 engineVersion
1282 u32 apiVersion
1283}
1284
1285class VkAllocCallbacks {
1286 void* pUserData
1287 PFN_vkAllocFunction pfnAlloc
Jesse Hall03b6fe12015-11-24 12:44:21 -08001288 PFN_vkReallocFunction pfnRealloc
Jesse Halld27f6aa2015-08-15 17:58:48 -07001289 PFN_vkFreeFunction pfnFree
Jesse Hall03b6fe12015-11-24 12:44:21 -08001290 PFN_vkInternalAllocNotification pfnInternalAlloc
1291 PFN_vkInternalFreeNotification pfnInternalFree
Jesse Halld27f6aa2015-08-15 17:58:48 -07001292}
1293
1294class VkDeviceQueueCreateInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001295 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
1296 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001297 VkDeviceQueueCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001298 u32 queueFamilyIndex
Jesse Hall03b6fe12015-11-24 12:44:21 -08001299 u32 queuePriorityCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001300 const f32* pQueuePriorities
Jesse Halld27f6aa2015-08-15 17:58:48 -07001301}
1302
1303class VkDeviceCreateInfo {
1304 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
1305 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001306 VkDeviceCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001307 u32 requestedQueueRecordCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001308 const VkDeviceQueueCreateInfo* pRequestedQueues
Jesse Hall03b6fe12015-11-24 12:44:21 -08001309 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001310 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001311 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001312 const char* const* ppEnabledExtensionNames
1313 const VkPhysicalDeviceFeatures* pEnabledFeatures
Jesse Halld27f6aa2015-08-15 17:58:48 -07001314}
1315
1316class VkInstanceCreateInfo {
1317 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
1318 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001319 VkInstanceCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001320 const VkApplicationInfo* pAppInfo
Jesse Hall03b6fe12015-11-24 12:44:21 -08001321 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001322 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001323 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001324 const char* const* ppEnabledExtensionNames /// Extension names to be enabled
1325}
1326
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001327class VkQueueFamilyProperties {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001328 VkQueueFlags queueFlags /// Queue flags
1329 u32 queueCount
Jesse Hallacfa5342015-11-19 21:51:33 -08001330 u32 timestampValidBits
Jesse Halld27f6aa2015-08-15 17:58:48 -07001331}
1332
1333class VkPhysicalDeviceMemoryProperties {
1334 u32 memoryTypeCount
1335 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes
1336 u32 memoryHeapCount
1337 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps
1338}
1339
1340class VkMemoryAllocInfo {
1341 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO
1342 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001343 VkDeviceSize allocationSize /// Size of memory allocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001344 u32 memoryTypeIndex /// Index of the of the memory type to allocate from
1345}
1346
1347class VkMemoryRequirements {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001348 VkDeviceSize size /// Specified in bytes
1349 VkDeviceSize alignment /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001350 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object
1351}
1352
1353class VkSparseImageFormatProperties {
Jesse Halld8bade02015-11-24 10:24:18 -08001354 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001355 VkExtent3D imageGranularity
1356 VkSparseImageFormatFlags flags
1357}
1358
1359class VkSparseImageMemoryRequirements {
1360 VkSparseImageFormatProperties formatProps
1361 u32 imageMipTailStartLOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001362 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment
1363 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment
1364 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07001365}
1366
1367class VkMemoryType {
1368 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type
1369 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from
1370}
1371
1372class VkMemoryHeap {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001373 VkDeviceSize size /// Available memory in the heap
Jesse Halld27f6aa2015-08-15 17:58:48 -07001374 VkMemoryHeapFlags flags /// Flags for the heap
1375}
1376
1377class VkMappedMemoryRange {
1378 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
1379 const void* pNext /// Pointer to next structure
1380 VkDeviceMemory mem /// Mapped memory object
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001381 VkDeviceSize offset /// Offset within the mapped memory the range starts from
1382 VkDeviceSize size /// Size of the range within the mapped memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07001383}
1384
1385class VkFormatProperties {
1386 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling
1387 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001388 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001389}
1390
1391class VkImageFormatProperties {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001392 VkExtent3D maxExtent /// max image dimensions for this resource type
1393 u32 maxMipLevels /// max number of mipmap levels for this resource type
Jesse Halla15a4bf2015-11-19 22:48:02 -08001394 u32 maxArrayLayers /// max array layers for this resource type
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001395 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type
1396 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type
1397}
1398
Jesse Halla15a4bf2015-11-19 22:48:02 -08001399class VkDescriptorImageInfo {
1400 VkSampler sampler
1401 VkImageView imageView
1402 VkImageLayout imageLayout
1403}
1404
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001405class VkDescriptorBufferInfo {
1406 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC]
1407 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set.
1408 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001409}
1410
Jesse Halld27f6aa2015-08-15 17:58:48 -07001411class VkWriteDescriptorSet {
1412 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
1413 const void* pNext /// Pointer to next structure
1414 VkDescriptorSet destSet /// Destination descriptor set
1415 u32 destBinding /// Binding within the destination descriptor set to write
1416 u32 destArrayElement /// Array element within the destination binding to write
Jesse Hall03b6fe12015-11-24 12:44:21 -08001417 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001418 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 -08001419 const VkDescriptorImageInfo* pImageInfo
1420 const VkDescriptorBufferInfo* pBufferInfo
1421 const VkBufferView* pTexelBufferView
Jesse Halld27f6aa2015-08-15 17:58:48 -07001422}
1423
1424class VkCopyDescriptorSet {
1425 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
1426 const void* pNext /// Pointer to next structure
1427 VkDescriptorSet srcSet /// Source descriptor set
1428 u32 srcBinding /// Binding within the source descriptor set to copy from
1429 u32 srcArrayElement /// Array element within the source binding to copy from
1430 VkDescriptorSet destSet /// Destination descriptor set
1431 u32 destBinding /// Binding within the destination descriptor set to copy to
1432 u32 destArrayElement /// Array element within the destination binding to copy to
Jesse Hall03b6fe12015-11-24 12:44:21 -08001433 u32 descriptorCount /// Number of descriptors to copy
Jesse Halld27f6aa2015-08-15 17:58:48 -07001434}
1435
1436class VkBufferCreateInfo {
1437 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
1438 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001439 VkBufferCreateFlags flags /// Buffer creation flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001440 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001441 VkBufferUsageFlags usage /// Buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001442 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001443 u32 queueFamilyIndexCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001444 const u32* pQueueFamilyIndices
1445}
1446
1447class VkBufferViewCreateInfo {
1448 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
1449 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001450 VkBufferViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001451 VkBuffer buffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001452 VkFormat format /// Optionally specifies format of elements
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001453 VkDeviceSize offset /// Specified in bytes
1454 VkDeviceSize range /// View size specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001455}
1456
1457class VkImageSubresource {
Jesse Halld8bade02015-11-24 10:24:18 -08001458 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001459 u32 mipLevel
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001460 u32 arrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001461}
1462
1463class VkImageSubresourceRange {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001464 VkImageAspectFlags aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001465 u32 baseMipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001466 u32 numLevels
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001467 u32 baseArrayLayer
Jesse Halla15a4bf2015-11-19 22:48:02 -08001468 u32 numLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001469}
1470
1471class VkMemoryBarrier {
1472 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER
1473 const void* pNext /// Pointer to next structure.
1474 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1475 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1476}
1477
1478class VkBufferMemoryBarrier {
1479 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
1480 const void* pNext /// Pointer to next structure.
1481 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1482 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1483 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
1484 u32 destQueueFamilyIndex /// Queue family to transition ownership to
1485 VkBuffer buffer /// Buffer to sync
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001486 VkDeviceSize offset /// Offset within the buffer to sync
1487 VkDeviceSize size /// Amount of bytes to sync
Jesse Halld27f6aa2015-08-15 17:58:48 -07001488}
1489
1490class VkImageMemoryBarrier {
1491 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
1492 const void* pNext /// Pointer to next structure.
1493 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1494 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1495 VkImageLayout oldLayout /// Current layout of the image
1496 VkImageLayout newLayout /// New layout to transition the image to
1497 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
1498 u32 destQueueFamilyIndex /// Queue family to transition ownership to
1499 VkImage image /// Image to sync
1500 VkImageSubresourceRange subresourceRange /// Subresource range to sync
1501}
1502
1503class VkImageCreateInfo {
1504 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
1505 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001506 VkImageCreateFlags flags /// Image creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001507 VkImageType imageType
1508 VkFormat format
1509 VkExtent3D extent
1510 u32 mipLevels
Jesse Halla15a4bf2015-11-19 22:48:02 -08001511 u32 arrayLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001512 u32 samples
1513 VkImageTiling tiling
1514 VkImageUsageFlags usage /// Image usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001515 VkSharingMode sharingMode /// Cross-queue-family sharing mode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001516 u32 queueFamilyIndexCount /// Number of queue families to share across
Jesse Halld27f6aa2015-08-15 17:58:48 -07001517 const u32* pQueueFamilyIndices /// Array of queue family indices to share across
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001518 VkImageLayout initialLayout /// Initial image layout for all subresources
Jesse Halld27f6aa2015-08-15 17:58:48 -07001519}
1520
1521class VkSubresourceLayout {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001522 VkDeviceSize offset /// Specified in bytes
1523 VkDeviceSize size /// Specified in bytes
1524 VkDeviceSize rowPitch /// Specified in bytes
1525 VkDeviceSize depthPitch /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001526}
1527
1528class VkImageViewCreateInfo {
1529 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
1530 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001531 VkImageViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001532 VkImage image
1533 VkImageViewType viewType
1534 VkFormat format
1535 VkChannelMapping channels
1536 VkImageSubresourceRange subresourceRange
Jesse Halld27f6aa2015-08-15 17:58:48 -07001537}
1538
1539class VkBufferCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001540 VkDeviceSize srcOffset /// Specified in bytes
1541 VkDeviceSize destOffset /// Specified in bytes
1542 VkDeviceSize copySize /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001543}
1544
Jesse Halla6429252015-11-29 18:59:42 -08001545class VkSparseMemoryBind {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001546 VkDeviceSize rangeOffset /// Specified in bytes
1547 VkDeviceSize rangeSize /// Specified in bytes
1548 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001549 VkDeviceMemory mem
1550 VkSparseMemoryBindFlags flags
1551}
1552
Jesse Halla6429252015-11-29 18:59:42 -08001553class VkSparseImageMemoryBind {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001554 VkImageSubresource subresource
1555 VkOffset3D offset
1556 VkExtent3D extent
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001557 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001558 VkDeviceMemory mem
1559 VkSparseMemoryBindFlags flags
1560}
1561
Jesse Halla6429252015-11-29 18:59:42 -08001562class VkSparseBufferMemoryBindInfo {
1563 VkBuffer buffer
1564 u32 bindCount
1565 const VkSparseMemoryBind* pBinds
1566}
1567
1568class VkSparseImageOpaqueMemoryBindInfo {
1569 VkImage image
1570 u32 bindCount
1571 const VkSparseMemoryBind* pBinds
1572}
1573
1574class VkSparseImageMemoryBindInfo {
1575 VkImage image
1576 u32 bindCount
1577 const VkSparseMemoryBind* pBinds
1578}
1579
1580class VkBindSparseInfo {
1581 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
1582 const void* pNext
1583 u32 waitSemaphoreCount
1584 const VkSemaphore* pWaitSemaphores
1585 u32 numBufferBinds
1586 const VkSparseBufferMemoryBindInfo* pBufferBinds
1587 u32 numImageOpaqueBinds
1588 const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds
1589 u32 numImageBinds
1590 const VkSparseImageMemoryBindInfo* pImageBinds
1591 u32 signalSemaphoreCount
1592 const VkSemaphore* pSignalSemaphores
1593}
1594
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001595class VkImageSubresourceCopy {
Jesse Halla15a4bf2015-11-19 22:48:02 -08001596 VkImageAspectFlags aspect
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001597 u32 mipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001598 u32 baseArrayLayer
1599 u32 numLayers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001600}
1601
Jesse Halld27f6aa2015-08-15 17:58:48 -07001602class VkImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001603 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001604 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001605 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001606 VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images
1607 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images
1608}
1609
1610class VkImageBlit {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001611 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001612 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
1613 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001614 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001615 VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images
1616 VkExtent3D destExtent /// Specified in pixels for both compressed and uncompressed images
1617}
1618
1619class VkBufferImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001620 VkDeviceSize bufferOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001621 u32 bufferRowLength /// Specified in texels
1622 u32 bufferImageHeight
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001623 VkImageSubresourceCopy imageSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001624 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images
1625 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images
1626}
1627
1628class VkImageResolve {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001629 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001630 VkOffset3D srcOffset
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001631 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001632 VkOffset3D destOffset
1633 VkExtent3D extent
1634}
1635
1636class VkShaderModuleCreateInfo {
1637 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
1638 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001639 VkShaderModuleCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001640 platform.size_t codeSize /// Specified in bytes
Jesse Halla9bb62b2015-11-21 19:31:56 -08001641 const u32* pCode /// Binary code of size codeSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07001642}
1643
1644class VkShaderCreateInfo {
1645 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
1646 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001647 VkShaderCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001648 VkShaderModule module /// Module containing entry point
1649 const char* pName /// Null-terminated entry point name
Jesse Halld8bade02015-11-24 10:24:18 -08001650 VkShaderStageFlagBits stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001651}
1652
1653class VkDescriptorSetLayoutBinding {
1654 VkDescriptorType descriptorType /// Type of the descriptors in this binding
1655 u32 arraySize /// Number of descriptors in this binding
1656 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to
1657 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements)
1658}
1659
1660class VkDescriptorSetLayoutCreateInfo {
1661 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
1662 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001663 VkDescriptorSetLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001664 u32 bindingCount /// Number of bindings in the descriptor set layout
1665 const VkDescriptorSetLayoutBinding* pBindings /// Array of descriptor set layout bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001666}
1667
1668class VkDescriptorTypeCount {
1669 VkDescriptorType type
Jesse Hall03b6fe12015-11-24 12:44:21 -08001670 u32 descriptorCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001671}
1672
1673class VkDescriptorPoolCreateInfo {
1674 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
1675 const void* pNext /// Pointer to next structure
Jesse Hallfbf97b02015-11-20 14:17:03 -08001676 VkDescriptorPoolCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001677 u32 maxSets
Jesse Hall03b6fe12015-11-24 12:44:21 -08001678 u32 typeCount
1679 const VkDescriptorTypeCount* pTypeCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07001680}
1681
Jesse Hallfbf97b02015-11-20 14:17:03 -08001682class VkDescriptorSetAllocInfo {
1683 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO
1684 const void* pNext /// Pointer to next structure
1685 VkDescriptorPool descriptorPool
Jesse Hall03b6fe12015-11-24 12:44:21 -08001686 u32 setCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001687 const VkDescriptorSetLayout* pSetLayouts
1688}
1689
Jesse Halld27f6aa2015-08-15 17:58:48 -07001690class VkSpecializationMapEntry {
1691 u32 constantId /// The SpecConstant ID specified in the BIL
1692 platform.size_t size /// Size in bytes of the SpecConstant
1693 u32 offset /// Offset of the value in the data block
1694}
1695
1696class VkSpecializationInfo {
1697 u32 mapEntryCount /// Number of entries in the map
1698 const VkSpecializationMapEntry* pMap /// Array of map entries
1699 platform.size_t dataSize /// Size in bytes of pData
1700 const void* pData /// Pointer to SpecConstant data
1701}
1702
1703class VkPipelineShaderStageCreateInfo {
1704 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
1705 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001706 VkPipelineShaderStageCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001707 VkShader shader
1708 const VkSpecializationInfo* pSpecializationInfo
1709}
1710
1711class VkComputePipelineCreateInfo {
1712 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
1713 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001714 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001715 VkPipelineShaderStageCreateInfo stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001716 VkPipelineLayout layout /// Interface layout of the pipeline
1717 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
1718 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
1719}
1720
1721class VkVertexInputBindingDescription {
1722 u32 binding /// Vertex buffer binding id
1723 u32 strideInBytes /// Distance between vertices in bytes (0 = no advancement)
1724 VkVertexInputStepRate stepRate /// Rate at which binding is incremented
1725}
1726
1727class VkVertexInputAttributeDescription {
1728 u32 location /// location of the shader vertex attrib
1729 u32 binding /// Vertex buffer binding id
1730 VkFormat format /// format of source data
1731 u32 offsetInBytes /// Offset of first element in bytes from base of vertex
1732}
1733
1734class VkPipelineVertexInputStateCreateInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001735 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
1736 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001737 VkPipelineVertexInputStateCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001738 u32 vertexBindingDescriptionCount /// number of bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001739 const VkVertexInputBindingDescription* pVertexBindingDescriptions
Jesse Hall03b6fe12015-11-24 12:44:21 -08001740 u32 vertexAttributeDescriptionCount /// number of attributes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001741 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
1742}
1743
1744class VkPipelineInputAssemblyStateCreateInfo {
1745 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
1746 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001747 VkPipelineInputAssemblyStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001748 VkPrimitiveTopology topology
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001749 VkBool32 primitiveRestartEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001750}
1751
1752class VkPipelineTessellationStateCreateInfo {
1753 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
1754 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001755 VkPipelineTessellationStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001756 u32 patchControlPoints
1757}
1758
1759class VkPipelineViewportStateCreateInfo {
1760 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
1761 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001762 VkPipelineViewportStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001763 u32 viewportCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001764 const VkViewport* pViewports
1765 u32 scissorCount
1766 const VkRect2D* pScissors
Jesse Halld27f6aa2015-08-15 17:58:48 -07001767}
1768
1769class VkPipelineRasterStateCreateInfo {
1770 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO
1771 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001772 VkPipelineRasterStateCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001773 VkBool32 depthClampEnable
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001774 VkBool32 rasterizerDiscardEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001775 VkFillMode fillMode /// optional (GL45)
1776 VkCullMode cullMode
1777 VkFrontFace frontFace
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001778 VkBool32 depthBiasEnable
Jesse Halla9bb62b2015-11-21 19:31:56 -08001779 f32 depthBiasConstantFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001780 f32 depthBiasClamp
Jesse Halla9bb62b2015-11-21 19:31:56 -08001781 f32 depthBiasSlopeFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001782 f32 lineWidth
Jesse Halld27f6aa2015-08-15 17:58:48 -07001783}
1784
1785class VkPipelineMultisampleStateCreateInfo {
1786 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
1787 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001788 VkPipelineMultisampleStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001789 u32 rasterSamples /// Number of samples used for rasterization
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001790 VkBool32 sampleShadingEnable /// optional (GL45)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001791 f32 minSampleShading /// optional (GL45)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001792 const VkSampleMask* pSampleMask
Jesse Hallacfa5342015-11-19 21:51:33 -08001793 VkBool32 alphaToCoverageEnable
1794 VkBool32 alphaToOneEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001795}
1796
1797class VkPipelineColorBlendAttachmentState {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001798 VkBool32 blendEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001799 VkBlend srcBlendColor
1800 VkBlend destBlendColor
1801 VkBlendOp blendOpColor
1802 VkBlend srcBlendAlpha
1803 VkBlend destBlendAlpha
1804 VkBlendOp blendOpAlpha
1805 VkChannelFlags channelWriteMask
1806}
1807
1808class VkPipelineColorBlendStateCreateInfo {
1809 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
1810 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001811 VkPipelineColorBlendStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001812 VkBool32 logicOpEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001813 VkLogicOp logicOp
1814 u32 attachmentCount /// # of pAttachments
1815 const VkPipelineColorBlendAttachmentState* pAttachments
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001816 f32[4] blendConst
Jesse Halld27f6aa2015-08-15 17:58:48 -07001817}
1818
1819class VkStencilOpState {
1820 VkStencilOp stencilFailOp
1821 VkStencilOp stencilPassOp
1822 VkStencilOp stencilDepthFailOp
1823 VkCompareOp stencilCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001824 u32 stencilCompareMask
1825 u32 stencilWriteMask
1826 u32 stencilReference
Jesse Halld27f6aa2015-08-15 17:58:48 -07001827}
1828
1829class VkPipelineDepthStencilStateCreateInfo {
1830 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
1831 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001832 VkPipelineDepthStencilStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001833 VkBool32 depthTestEnable
1834 VkBool32 depthWriteEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001835 VkCompareOp depthCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001836 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test)
1837 VkBool32 stencilTestEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001838 VkStencilOpState front
1839 VkStencilOpState back
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001840 f32 minDepthBounds
1841 f32 maxDepthBounds
1842}
1843
1844class VkPipelineDynamicStateCreateInfo {
1845 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
1846 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001847 VkPipelineDynamicStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001848 u32 dynamicStateCount
1849 const VkDynamicState* pDynamicStates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001850}
1851
1852class VkGraphicsPipelineCreateInfo {
Jesse Halla6429252015-11-29 18:59:42 -08001853 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
1854 const void* pNext /// Pointer to next structure
1855 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001856 u32 stageCount
Jesse Halla6429252015-11-29 18:59:42 -08001857 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001858 const VkPipelineVertexInputStateCreateInfo* pVertexInputState
1859 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
1860 const VkPipelineTessellationStateCreateInfo* pTessellationState
1861 const VkPipelineViewportStateCreateInfo* pViewportState
1862 const VkPipelineRasterStateCreateInfo* pRasterState
1863 const VkPipelineMultisampleStateCreateInfo* pMultisampleState
1864 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState
1865 const VkPipelineColorBlendStateCreateInfo* pColorBlendState
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001866 const VkPipelineDynamicStateCreateInfo* pDynamicState
Jesse Halla6429252015-11-29 18:59:42 -08001867 VkPipelineLayout layout /// Interface layout of the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001868 VkRenderPass renderPass
1869 u32 subpass
Jesse Halla6429252015-11-29 18:59:42 -08001870 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
1871 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 -07001872}
1873
1874class VkPipelineCacheCreateInfo {
1875 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
1876 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001877 VkPipelineCacheCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001878 platform.size_t initialSize /// Size of initial data to populate cache, in bytes
1879 const void* initialData /// Initial data to populate cache
1880 platform.size_t maxSize /// Maximum size cache can grow to, in bytes. If zero, then the cache may grow without bound.
1881}
1882
1883class VkPushConstantRange {
1884 VkShaderStageFlags stageFlags /// Which stages use the range
Jesse Hall03b6fe12015-11-24 12:44:21 -08001885 u32 offset /// Start of the range, in bytes
1886 u32 size /// Length of the range, in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001887}
1888
1889class VkPipelineLayoutCreateInfo {
1890 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
1891 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001892 VkPipelineLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001893 u32 setLayoutCount /// Number of descriptor sets interfaced by the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001894 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the
1895 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline
1896 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages
1897}
1898
1899class VkSamplerCreateInfo {
1900 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
1901 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001902 VkSamplerCreateFlags flags
Jesse Hall23ff73f2015-11-29 14:36:39 -08001903 VkFilter magFilter /// Filter mode for magnification
1904 VkFilter minFilter /// Filter mode for minifiation
1905 VkSamplerMipmapMode mipmapMode /// Mipmap selection mode
1906 VkSamplerAddressMode addressModeU
1907 VkSamplerAddressMode addressModeV
1908 VkSamplerAddressMode addressModeW
Jesse Halld27f6aa2015-08-15 17:58:48 -07001909 f32 mipLodBias
1910 f32 maxAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001911 VkBool32 compareEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001912 VkCompareOp compareOp
1913 f32 minLod
1914 f32 maxLod
1915 VkBorderColor borderColor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001916 VkBool32 unnormalizedCoordinates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001917}
1918
1919class VkCmdPoolCreateInfo {
1920 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO
1921 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001922 VkCmdPoolCreateFlags flags /// Command pool creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001923 u32 queueFamilyIndex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001924}
1925
Jesse Hallfbf97b02015-11-20 14:17:03 -08001926class VkCmdBufferAllocInfo {
1927 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001928 const void* pNext /// Pointer to next structure
1929 VkCmdPool cmdPool
1930 VkCmdBufferLevel level
Jesse Hall03b6fe12015-11-24 12:44:21 -08001931 u32 bufferCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001932}
1933
1934class VkCmdBufferBeginInfo {
1935 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO
1936 const void* pNext /// Pointer to next structure
Jesse Halla15a4bf2015-11-19 22:48:02 -08001937 VkCmdBufferUsageFlags flags /// Command buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001938 VkRenderPass renderPass /// Render pass for secondary command buffers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001939 u32 subpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07001940 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers
1941}
1942
1943class VkRenderPassBeginInfo {
1944 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
1945 const void* pNext /// Pointer to next structure
1946 VkRenderPass renderPass
1947 VkFramebuffer framebuffer
1948 VkRect2D renderArea
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001949 u32 clearValueCount
1950 const VkClearValue* pClearValues
Jesse Halld27f6aa2015-08-15 17:58:48 -07001951}
1952
1953@union
1954/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared.
1955class VkClearColorValue {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001956 f32[4] float32
1957 s32[4] int32
1958 u32[4] uint32
Jesse Halld27f6aa2015-08-15 17:58:48 -07001959}
1960
1961class VkClearDepthStencilValue {
1962 f32 depth
1963 u32 stencil
1964}
1965
1966@union
1967/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared.
1968class VkClearValue {
1969 VkClearColorValue color
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001970 VkClearDepthStencilValue depthStencil
Jesse Halld27f6aa2015-08-15 17:58:48 -07001971}
1972
Jesse Hallae38f732015-11-19 21:32:50 -08001973class VkClearAttachment {
1974 VkImageAspectFlags aspectMask
1975 u32 colorAttachment
1976 VkClearValue clearValue
1977}
1978
Jesse Halld27f6aa2015-08-15 17:58:48 -07001979class VkAttachmentDescription {
1980 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION
1981 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001982 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001983 VkFormat format
1984 u32 samples
1985 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1986 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1987 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1988 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1989 VkImageLayout initialLayout
1990 VkImageLayout finalLayout
1991}
1992
1993class VkAttachmentReference {
1994 u32 attachment
1995 VkImageLayout layout
1996}
1997
1998class VkSubpassDescription {
1999 VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DESCRIPTION
2000 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07002001 VkSubpassDescriptionFlags flags
Jesse Halla6429252015-11-29 18:59:42 -08002002 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
Jesse Hall03b6fe12015-11-24 12:44:21 -08002003 u32 inputAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002004 const VkAttachmentReference* pInputAttachments
Jesse Hall03b6fe12015-11-24 12:44:21 -08002005 u32 colorAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002006 const VkAttachmentReference* pColorAttachments
2007 const VkAttachmentReference* pResolveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002008 VkAttachmentReference depthStencilAttachment
Jesse Hall03b6fe12015-11-24 12:44:21 -08002009 u32 preserveAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002010 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002011}
2012
2013class VkSubpassDependency {
2014 VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DEPENDENCY
2015 const void* pNext /// Pointer to next structure
2016 u32 srcSubpass
2017 u32 destSubpass
2018 VkPipelineStageFlags srcStageMask
2019 VkPipelineStageFlags destStageMask
2020 VkMemoryOutputFlags outputMask
2021 VkMemoryInputFlags inputMask
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002022 VkBool32 byRegion
Jesse Halld27f6aa2015-08-15 17:58:48 -07002023}
2024
2025class VkRenderPassCreateInfo {
2026 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
2027 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002028 VkRenderPassCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002029 u32 attachmentCount
2030 const VkAttachmentDescription* pAttachments
2031 u32 subpassCount
2032 const VkSubpassDescription* pSubpasses
2033 u32 dependencyCount
2034 const VkSubpassDependency* pDependencies
2035}
2036
2037class VkEventCreateInfo {
2038 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
2039 const void* pNext /// Pointer to next structure
2040 VkEventCreateFlags flags /// Event creation flags
2041}
2042
2043class VkFenceCreateInfo {
2044 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
2045 const void* pNext /// Pointer to next structure
2046 VkFenceCreateFlags flags /// Fence creation flags
2047}
2048
2049class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002050 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
2051 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
2052 VkBool32 imageCubeArray /// image views which are arrays of cube maps
2053 VkBool32 independentBlend /// blending operations are controlled per-attachment
2054 VkBool32 geometryShader /// geometry stage
2055 VkBool32 tessellationShader /// tessellation control and evaluation stage
2056 VkBool32 sampleRateShading /// per-sample shading and interpolation
2057 VkBool32 dualSourceBlend /// blend operations which take two sources
2058 VkBool32 logicOp /// logic operations
2059 VkBool32 multiDrawIndirect /// multi draw indirect
Jesse Hallae38f732015-11-19 21:32:50 -08002060 VkBool32 depthClamp /// depth clamping
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002061 VkBool32 depthBiasClamp /// depth bias clamping
2062 VkBool32 fillModeNonSolid /// point and wireframe fill modes
2063 VkBool32 depthBounds /// depth bounds test
2064 VkBool32 wideLines /// lines with width greater than 1
2065 VkBool32 largePoints /// points with size greater than 1
Jesse Hallfbf97b02015-11-20 14:17:03 -08002066 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
2067 VkBool32 multiViewport
2068 VkBool32 samplerAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002069 VkBool32 textureCompressionETC2 /// ETC texture compression formats
2070 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
2071 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
2072 VkBool32 occlusionQueryNonConservative /// non-conservative (exact) occlusion queries
2073 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
2074 VkBool32 vertexSideEffects /// storage buffers and images in vertex stage
2075 VkBool32 tessellationSideEffects /// storage buffers and images in tessellation stage
2076 VkBool32 geometrySideEffects /// storage buffers and images in geometry stage
2077 VkBool32 fragmentSideEffects /// storage buffers and images in fragment stage
2078 VkBool32 shaderTessellationPointSize /// tessellation stage can export point size
2079 VkBool32 shaderGeometryPointSize /// geometry stage can export point size
2080 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
2081 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
2082 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
2083 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
2084 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
2085 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
2086 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
2087 VkBool32 shaderClipDistance /// clip distance in shaders
2088 VkBool32 shaderCullDistance /// cull distance in shaders
2089 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
2090 VkBool32 shaderInt64 /// 64-bit integers in shaders
2091 VkBool32 shaderInt16 /// 16-bit integers in shaders
2092 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
2093 VkBool32 shaderResourceMinLOD /// shader can use texture operations that specify minimum resource LOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002094 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
2095 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
2096 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
2097 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
2098 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
2099 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
2100 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
2101 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
2102 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002103}
2104
2105class VkPhysicalDeviceLimits {
2106 /// resource maximum sizes
2107 u32 maxImageDimension1D /// max 1D image dimension
2108 u32 maxImageDimension2D /// max 2D image dimension
2109 u32 maxImageDimension3D /// max 3D image dimension
2110 u32 maxImageDimensionCube /// max cubemap image dimension
2111 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002112 VkSampleCountFlags sampleCounts /// sample counts supported for all images supporting rendering and sampling
Jesse Halld27f6aa2015-08-15 17:58:48 -07002113 u32 maxTexelBufferSize /// max texel buffer size (bytes)
Jesse Hallfbf97b02015-11-20 14:17:03 -08002114 u32 maxUniformBufferRange /// max uniform buffer size (bytes)
2115 u32 maxStorageBufferRange /// max storage buffer size (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002116 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
2117 /// memory limits
2118 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002119 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
2120 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002121 /// descriptor set limits
2122 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07002123 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
2124 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
2125 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
2126 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
2127 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
2128 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
2129 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002130 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002131 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002132 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002133 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
2134 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
2135 /// vertex stage limits
2136 u32 maxVertexInputAttributes /// max num of vertex input attribute slots
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002137 u32 maxVertexInputBindings /// max num of vertex input binding slots
Jesse Halld27f6aa2015-08-15 17:58:48 -07002138 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset
2139 u32 maxVertexInputBindingStride /// max vertex input binding stride
2140 u32 maxVertexOutputComponents /// max num of output components written by vertex shader
2141 /// tessellation control stage limits
Jesse Hallae38f732015-11-19 21:32:50 -08002142 u32 maxTessellationGenLevel /// max level supported by tess primitive generator
2143 u32 maxTessellationPatchSize /// max patch size (vertices)
2144 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS
2145 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS
2146 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS
2147 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS
2148 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES
2149 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES
Jesse Halld27f6aa2015-08-15 17:58:48 -07002150 /// geometry stage limits
2151 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader
2152 u32 maxGeometryInputComponents /// max num of input components read in geometry stage
2153 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage
2154 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage
2155 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage
2156 /// fragment stage limits
2157 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage
Jesse Hallfbf97b02015-11-20 14:17:03 -08002158 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage
2159 u32 maxFragmentDualSourceAttachments /// max num of output attachments written when using dual source blending
Jesse Halld27f6aa2015-08-15 17:58:48 -07002160 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers
2161 /// compute stage limits
2162 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes)
2163 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z)
2164 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group
2165 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z)
2166
2167 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y
2168 u32 subTexelPrecisionBits /// num bits of subtexel precision
2169 u32 mipmapPrecisionBits /// num bits of mipmap precision
2170
2171 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices)
2172 u32 maxDrawIndirectInstanceCount /// max instance count for indirect draw calls
Jesse Halld27f6aa2015-08-15 17:58:48 -07002173
2174 f32 maxSamplerLodBias /// max absolute sampler level of detail bias
2175 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy
2176
2177 u32 maxViewports /// max number of active viewports
Jesse Halld27f6aa2015-08-15 17:58:48 -07002178 u32[2] maxViewportDimensions /// max viewport dimensions (x,y)
2179 f32[2] viewportBoundsRange /// viewport bounds range (min,max)
2180 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport
2181
2182 u32 minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes)
Jesse Hallf09c6b12015-08-15 19:54:28 -07002183 u32 minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002184 u32 minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes)
2185 u32 minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes)
2186
Jesse Hallfbf97b02015-11-20 14:17:03 -08002187 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002188 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset
Jesse Hallfbf97b02015-11-20 14:17:03 -08002189 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002190 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset
2191 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset
2192 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset
2193 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset
2194
2195 u32 maxFramebufferWidth /// max width for a framebuffer
2196 u32 maxFramebufferHeight /// max height for a framebuffer
2197 u32 maxFramebufferLayers /// max layer count for a layered framebuffer
2198 u32 maxFramebufferColorSamples /// max color sample count for a framebuffer
2199 u32 maxFramebufferDepthSamples /// max depth sample count for a framebuffer
2200 u32 maxFramebufferStencilSamples /// max stencil sample count for a framebuffer
2201 u32 maxColorAttachments /// max num of framebuffer color attachments
2202
2203 u32 maxSampledImageColorSamples /// max num of color samples for a non-integer sampled image
2204 u32 maxSampledImageDepthSamples /// max num of depth/stencil samples for a sampled image
2205 u32 maxSampledImageIntegerSamples /// max num of samples supported for an integer image
2206 u32 maxStorageImageSamples /// max num of samples for a storage image
2207 u32 maxSampleMaskWords /// max num of sample mask words
2208
Jesse Halla9bb62b2015-11-21 19:31:56 -08002209 f32 timestampPeriod
Jesse Halld27f6aa2015-08-15 17:58:48 -07002210
2211 u32 maxClipDistances /// max number of clip distances
2212 u32 maxCullDistances /// max number of cull distances
2213 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
2214
Jesse Hallfbf97b02015-11-20 14:17:03 -08002215 u32 discreteQueuePriorities
2216
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002217 f32[2] pointSizeRange /// range (min,max) of supported point sizes
2218 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07002219 f32 pointSizeGranularity /// granularity of supported point sizes
2220 f32 lineWidthGranularity /// granularity of supported line widths
Jesse Hall03b6fe12015-11-24 12:44:21 -08002221 VkBool32 strictLines
Jesse Halla9bb62b2015-11-21 19:31:56 -08002222
2223 u32 recommendedBufferCopyOffsetAlignment
2224 u32 recommendedBufferCopyRowPitchAlignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07002225}
2226
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002227class VkPhysicalDeviceSparseProperties {
2228 VkBool32 residencyStandard2DBlockShape /// Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard block shapes (based on pixel format)
2229 VkBool32 residencyStandard2DMSBlockShape /// Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard block shapes (based on pixel format)
2230 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
2231 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
2232 VkBool32 residencyNonResident /// Sparse resources support: GPU can safely access non-resident regions of a resource, read values from read-write resources are undefined
2233 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
2234}
2235
Jesse Halld27f6aa2015-08-15 17:58:48 -07002236class VkSemaphoreCreateInfo {
2237 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
2238 const void* pNext /// Pointer to next structure
2239 VkSemaphoreCreateFlags flags /// Semaphore creation flags
2240}
2241
2242class VkQueryPoolCreateInfo {
2243 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
2244 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002245 VkQueryPoolCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002246 VkQueryType queryType
2247 u32 slots
2248 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
2249}
2250
2251class VkFramebufferCreateInfo {
2252 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
2253 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002254 VkFramebufferCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002255 VkRenderPass renderPass
2256 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002257 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002258 u32 width
2259 u32 height
2260 u32 layers
2261}
2262
2263class VkDrawIndirectCmd {
2264 u32 vertexCount
2265 u32 instanceCount
2266 u32 firstVertex
2267 u32 firstInstance
2268}
2269
2270class VkDrawIndexedIndirectCmd {
2271 u32 indexCount
2272 u32 instanceCount
2273 u32 firstIndex
2274 s32 vertexOffset
2275 u32 firstInstance
2276}
2277
2278class VkDispatchIndirectCmd {
2279 u32 x
2280 u32 y
2281 u32 z
2282}
2283
Jesse Hall1356b0d2015-11-23 17:24:58 -08002284@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002285class VkSurfacePropertiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002286 u32 minImageCount
2287 u32 maxImageCount
2288 VkExtent2D currentExtent
2289 VkExtent2D minImageExtent
2290 VkExtent2D maxImageExtent
2291 VkSurfaceTransformFlagsKHR supportedTransforms
2292 VkSurfaceTransformKHR currentTransform
Jesse Halla6429252015-11-29 18:59:42 -08002293 VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002294 u32 maxImageArraySize
2295 VkImageUsageFlags supportedUsageFlags
Michael Lentine88594d72015-11-12 12:49:45 -08002296}
2297
Jesse Hall1356b0d2015-11-23 17:24:58 -08002298@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002299class VkSurfaceFormatKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002300 VkFormat format
2301 VkColorSpaceKHR colorSpace
Michael Lentine88594d72015-11-12 12:49:45 -08002302}
2303
Jesse Hall1356b0d2015-11-23 17:24:58 -08002304@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002305class VkSwapchainCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002306 VkStructureType sType
2307 const void* pNext
2308 VkSurfaceKHR surface
2309 u32 minImageCount
2310 VkFormat imageFormat
2311 VkColorSpaceKHR imageColorSpace
2312 VkExtent2D imageExtent
2313 VkImageUsageFlags imageUsageFlags
2314 VkSurfaceTransformKHR preTransform
Jesse Halla6429252015-11-29 18:59:42 -08002315 VkCompositeAlphaFlagBitsKHR compositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002316 u32 imageArraySize
2317 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08002318 u32 queueFamilyIndexCount
Jesse Hall1356b0d2015-11-23 17:24:58 -08002319 const u32* pQueueFamilyIndices
2320 VkPresentModeKHR presentMode
2321 VkSwapchainKHR oldSwapchain
2322 VkBool32 clipped
Michael Lentine88594d72015-11-12 12:49:45 -08002323}
2324
Jesse Hall1356b0d2015-11-23 17:24:58 -08002325@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002326class VkPresentInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002327 VkStructureType sType
2328 const void* pNext
2329 u32 swapchainCount
Jesse Hall03b6fe12015-11-24 12:44:21 -08002330 const VkSwapchainKHR* pSwapchains
Jesse Hall1356b0d2015-11-23 17:24:58 -08002331 const u32* imageIndices
Michael Lentine88594d72015-11-12 12:49:45 -08002332}
2333
Jesse Hall1356b0d2015-11-23 17:24:58 -08002334@extension("VK_EXT_KHR_display")
2335class VkDisplayPropertiesKHR {
2336 VkDisplayKHR display
2337 const char* displayName
2338 VkExtent2D physicalDimensions
2339 VkExtent2D physicalResolution
2340 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hall1356b0d2015-11-23 17:24:58 -08002341 VkBool32 planeReorderPossible
Jesse Halla6429252015-11-29 18:59:42 -08002342 VkBool32 persistentContent
Michael Lentine88594d72015-11-12 12:49:45 -08002343}
2344
Jesse Hall1356b0d2015-11-23 17:24:58 -08002345@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002346class VkDisplayModeParametersKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002347 VkExtent2D visibleRegion
Jesse Halla6429252015-11-29 18:59:42 -08002348 u32 refreshRate
Michael Lentine88594d72015-11-12 12:49:45 -08002349}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002350
Jesse Hall1356b0d2015-11-23 17:24:58 -08002351@extension("VK_EXT_KHR_display")
2352class VkDisplayModePropertiesKHR {
2353 VkDisplayModeKHR displayMode
Jesse Halla6429252015-11-29 18:59:42 -08002354 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002355}
2356
2357@extension("VK_EXT_KHR_display")
2358class VkDisplayModeCreateInfoKHR {
2359 VkStructureType sType
2360 const void* pNext
Jesse Halla6429252015-11-29 18:59:42 -08002361 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002362}
2363
2364@extension("VK_EXT_KHR_display")
2365class VkDisplayPlanePropertiesKHR {
Jesse Halla6429252015-11-29 18:59:42 -08002366 VkDisplayKHR currentDisplay
2367 u32 currentStackIndex
2368}
2369
2370@extension("VK_EXT_KHR_display")
2371class VkDisplayPlaneCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002372 VkDisplayPlaneAlphaFlagsKHR supportedAlpha
2373 VkOffset2D minSrcPosition
2374 VkOffset2D maxSrcPosition
2375 VkExtent2D minSrcExtent
2376 VkExtent2D maxSrcExtent
2377 VkOffset2D minDstPosition
2378 VkOffset2D maxDstPosition
2379 VkExtent2D minDstExtent
2380 VkExtent2D maxDstExtent
2381}
2382
2383@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002384class VkDisplaySurfaceCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002385 VkStructureType sType
2386 const void* pNext
2387 VkDisplayModeKHR displayMode
2388 u32 planeIndex
2389 u32 planeStackIndex
2390 VkSurfaceTransformKHR transform
2391 f32 globalAlpha
2392 VkDisplayPlaneAlphaFlagsKHR alphaMode
2393 VkExtent2D imageSize
2394}
2395
2396@extension("VK_EXT_KHR_display_swapchain")
2397class VkDisplaySwapchainCreateInfoKHR {
2398 VkStructureType sType
2399 const void* pNext
2400 const VkSwapchainCreateInfoKHR* pNextSwapchainCreateInfo
2401}
2402
2403@extension("VK_EXT_KHR_display_swapchain")
2404class VkDisplayPresentInfoKHR {
2405 VkStructureType sType
2406 const void* pNext
2407 VkRect2D srcRect
2408 VkRect2D dstRect
Jesse Halla6429252015-11-29 18:59:42 -08002409 VkBool32 persistent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002410}
2411
2412
Jesse Halld27f6aa2015-08-15 17:58:48 -07002413////////////////
2414// Commands //
2415////////////////
2416
2417// Function pointers. TODO: add support for function pointers.
2418
2419@external type void* PFN_vkVoidFunction
2420@pfn cmd void vkVoidFunction() {
2421}
2422
2423@external type void* PFN_vkAllocFunction
2424@pfn cmd void* vkAllocFunction(
2425 void* pUserData,
2426 platform.size_t size,
2427 platform.size_t alignment,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002428 VkSystemAllocScope allocScope) {
2429 return ?
2430}
2431
2432@external type void* PFN_vkReallocFunction
2433@pfn cmd void* vkReallocFunction(
2434 void* pUserData,
2435 void* pOriginal,
2436 platform.size_t size,
2437 platform.size_t alignment,
2438 VkSystemAllocScope allocScope) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002439 return ?
2440}
2441
2442@external type void* PFN_vkFreeFunction
2443@pfn cmd void vkFreeFunction(
2444 void* pUserData,
2445 void* pMem) {
2446}
2447
Jesse Hall03b6fe12015-11-24 12:44:21 -08002448@external type void* PFN_vkInternalAllocNotification
2449@pfn cmd void vkInternalAllocNotification(
2450 void* pUserData,
2451 platform.size_t size,
2452 VkInternalAllocType allocType,
2453 VkSystemAllocScope allocScope) {
2454}
2455
2456@external type void* PFN_vkInternalFreeNotification
2457@pfn cmd void vkInternalFreeNotification(
2458 void* pUserData,
2459 platform.size_t size,
2460 VkInternalAllocType allocType,
2461 VkSystemAllocScope allocScope) {
2462}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002463
2464// Global functions
2465
2466@threadSafety("system")
2467cmd VkResult vkCreateInstance(
2468 const VkInstanceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002469 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002470 VkInstance* pInstance) {
2471 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
2472
2473 instance := ?
2474 pInstance[0] = instance
2475 State.Instances[instance] = new!InstanceObject()
2476
Jesse Hall03b6fe12015-11-24 12:44:21 -08002477 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount]
2478 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount]
Jesse Halld27f6aa2015-08-15 17:58:48 -07002479
2480 return ?
2481}
2482
2483@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002484cmd void vkDestroyInstance(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002485 VkInstance instance,
2486 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002487 instanceObject := GetInstance(instance)
2488
2489 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002490}
2491
2492@threadSafety("system")
2493cmd VkResult vkEnumeratePhysicalDevices(
2494 VkInstance instance,
2495 u32* pPhysicalDeviceCount,
2496 VkPhysicalDevice* pPhysicalDevices) {
2497 instanceObject := GetInstance(instance)
2498
2499 physicalDeviceCount := as!u32(?)
2500 pPhysicalDeviceCount[0] = physicalDeviceCount
2501 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2502
2503 for i in (0 .. physicalDeviceCount) {
2504 physicalDevice := ?
2505 physicalDevices[i] = physicalDevice
2506 if !(physicalDevice in State.PhysicalDevices) {
2507 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2508 }
2509 }
2510
2511 return ?
2512}
2513
2514cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2515 VkDevice device,
2516 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002517 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002518 device := GetDevice(device)
2519 }
2520
2521 return ?
2522}
2523
2524cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2525 VkInstance instance,
2526 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002527 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002528 instanceObject := GetInstance(instance)
2529 }
2530
2531 return ?
2532}
2533
Jesse Hall606a54e2015-11-19 22:17:28 -08002534cmd void vkGetPhysicalDeviceProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002535 VkPhysicalDevice physicalDevice,
2536 VkPhysicalDeviceProperties* pProperties) {
2537 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2538
2539 properties := ?
2540 pProperties[0] = properties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002541}
2542
Jesse Hall606a54e2015-11-19 22:17:28 -08002543cmd void vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002544 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002545 u32* pQueueFamilyPropertyCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002546 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002547 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002548 // TODO: Figure out how to express fetch-count-or-properties
2549 // This version fails 'apic validate' with 'fence not allowed in
2550 // *semantic.Branch'. Other attempts have failed with the same or other
2551 // errors.
2552 // if pQueueFamilyProperties != null {
2553 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2554 // for i in (0 .. pCount[0]) {
2555 // queueProperties := as!VkQueueFamilyProperties(?)
2556 // queuesProperties[i] = queueProperties
2557 // }
2558 // } else {
2559 // count := ?
2560 // pCount[0] = count
2561 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002562}
2563
Jesse Hall606a54e2015-11-19 22:17:28 -08002564cmd void vkGetPhysicalDeviceMemoryProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002565 VkPhysicalDevice physicalDevice,
2566 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2567 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2568
2569 memoryProperties := ?
2570 pMemoryProperties[0] = memoryProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002571}
2572
Jesse Hall606a54e2015-11-19 22:17:28 -08002573cmd void vkGetPhysicalDeviceFeatures(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002574 VkPhysicalDevice physicalDevice,
2575 VkPhysicalDeviceFeatures* pFeatures) {
2576 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2577
2578 features := ?
2579 pFeatures[0] = features
Jesse Halld27f6aa2015-08-15 17:58:48 -07002580}
2581
Jesse Hall606a54e2015-11-19 22:17:28 -08002582cmd void vkGetPhysicalDeviceFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002583 VkPhysicalDevice physicalDevice,
2584 VkFormat format,
2585 VkFormatProperties* pFormatProperties) {
2586 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2587
2588 formatProperties := ?
2589 pFormatProperties[0] = formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002590}
2591
Jesse Hall606a54e2015-11-19 22:17:28 -08002592cmd void vkGetPhysicalDeviceImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002593 VkPhysicalDevice physicalDevice,
2594 VkFormat format,
2595 VkImageType type,
2596 VkImageTiling tiling,
2597 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002598 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002599 VkImageFormatProperties* pImageFormatProperties) {
2600 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2601
2602 imageFormatProperties := ?
2603 pImageFormatProperties[0] = imageFormatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002604}
2605
Jesse Halld27f6aa2015-08-15 17:58:48 -07002606
2607// Device functions
2608
2609@threadSafety("system")
2610cmd VkResult vkCreateDevice(
2611 VkPhysicalDevice physicalDevice,
2612 const VkDeviceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002613 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002614 VkDevice* pDevice) {
2615 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2616 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2617
2618 device := ?
2619 pDevice[0] = device
2620 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2621
2622 return ?
2623}
2624
2625@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002626cmd void vkDestroyDevice(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002627 VkDevice device,
2628 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002629 deviceObject := GetDevice(device)
2630
2631 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002632}
2633
2634
2635// Extension discovery functions
2636
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002637cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002638 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002639 VkLayerProperties* pProperties) {
2640 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002641 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002642
2643 properties := pProperties[0:count]
2644 for i in (0 .. count) {
2645 property := ?
2646 properties[i] = property
2647 }
2648
2649 return ?
2650}
2651
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002652cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002653 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002654 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002655 VkExtensionProperties* pProperties) {
2656 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002657 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002658
2659 properties := pProperties[0:count]
2660 for i in (0 .. count) {
2661 property := ?
2662 properties[i] = property
2663 }
2664
2665 return ?
2666}
2667
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002668cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002669 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002670 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002671 VkLayerProperties* pProperties) {
2672 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2673 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002674 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002675
2676 properties := pProperties[0:count]
2677 for i in (0 .. count) {
2678 property := ?
2679 properties[i] = property
2680 }
2681
2682 return ?
2683}
2684
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002685cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002686 VkPhysicalDevice physicalDevice,
2687 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002688 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002689 VkExtensionProperties* pProperties) {
2690 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2691
2692 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002693 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002694
2695 properties := pProperties[0:count]
2696 for i in (0 .. count) {
2697 property := ?
2698 properties[i] = property
2699 }
2700
2701 return ?
2702}
2703
2704
2705// Queue functions
2706
2707@threadSafety("system")
Jesse Hall606a54e2015-11-19 22:17:28 -08002708cmd void vkGetDeviceQueue(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002709 VkDevice device,
2710 u32 queueFamilyIndex,
2711 u32 queueIndex,
2712 VkQueue* pQueue) {
2713 deviceObject := GetDevice(device)
2714
2715 queue := ?
2716 pQueue[0] = queue
2717
2718 if !(queue in State.Queues) {
2719 State.Queues[queue] = new!QueueObject(device: device)
2720 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002721}
2722
2723@threadSafety("app")
2724cmd VkResult vkQueueSubmit(
2725 VkQueue queue,
Jesse Halla366a512015-11-19 22:30:07 -08002726 u32 submitCount,
2727 const VkSubmitInfo* pSubmitInfo,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002728 VkFence fence) {
2729 queueObject := GetQueue(queue)
2730
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002731 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002732 fenceObject := GetFence(fence)
2733 assert(fenceObject.device == queueObject.device)
2734 }
2735
Jesse Halla366a512015-11-19 22:30:07 -08002736 // cmdBuffers := pCmdBuffers[0:cmdBufferCount]
2737 // for i in (0 .. cmdBufferCount) {
2738 // cmdBuffer := cmdBuffers[i]
2739 // cmdBufferObject := GetCmdBuffer(cmdBuffer)
2740 // assert(cmdBufferObject.device == queueObject.device)
2741 //
2742 // validate("QueueCheck", cmdBufferObject.queueFlags in queueObject.flags,
2743 // "vkQueueSubmit: enqueued cmdBuffer requires missing queue capabilities.")
2744 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002745
2746 return ?
2747}
2748
2749@threadSafety("system")
2750cmd VkResult vkQueueWaitIdle(
2751 VkQueue queue) {
2752 queueObject := GetQueue(queue)
2753
2754 return ?
2755}
2756
2757@threadSafety("system")
2758cmd VkResult vkDeviceWaitIdle(
2759 VkDevice device) {
2760 deviceObject := GetDevice(device)
2761
2762 return ?
2763}
2764
2765
2766// Memory functions
2767
2768@threadSafety("system")
2769cmd VkResult vkAllocMemory(
2770 VkDevice device,
2771 const VkMemoryAllocInfo* pAllocInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002772 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002773 VkDeviceMemory* pMem) {
2774 assert(pAllocInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO)
2775 deviceObject := GetDevice(device)
2776
2777 mem := ?
2778 pMem[0] = mem
2779 State.DeviceMemories[mem] = new!DeviceMemoryObject(
2780 device: device,
2781 allocationSize: pAllocInfo[0].allocationSize)
2782
2783 return ?
2784}
2785
2786@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002787cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002788 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002789 VkDeviceMemory mem,
2790 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002791 deviceObject := GetDevice(device)
2792 memObject := GetDeviceMemory(mem)
2793 assert(memObject.device == device)
2794
2795 // Check that no objects are still bound before freeing.
2796 validate("MemoryCheck", len(memObject.boundObjects) == 0,
2797 "vkFreeMemory: objects still bound")
2798 validate("MemoryCheck", len(memObject.boundCommandBuffers) == 0,
2799 "vkFreeMemory: cmdBuffers still bound")
2800 State.DeviceMemories[mem] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002801}
2802
2803@threadSafety("app")
2804cmd VkResult vkMapMemory(
2805 VkDevice device,
2806 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002807 VkDeviceSize offset,
2808 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002809 VkMemoryMapFlags flags,
2810 void** ppData) {
2811 deviceObject := GetDevice(device)
2812 memObject := GetDeviceMemory(mem)
2813 assert(memObject.device == device)
2814
2815 assert(flags == as!VkMemoryMapFlags(0))
2816 assert((offset + size) <= memObject.allocationSize)
2817
2818 return ?
2819}
2820
2821@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002822cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002823 VkDevice device,
2824 VkDeviceMemory mem) {
2825 deviceObject := GetDevice(device)
2826 memObject := GetDeviceMemory(mem)
2827 assert(memObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002828}
2829
2830cmd VkResult vkFlushMappedMemoryRanges(
2831 VkDevice device,
2832 u32 memRangeCount
2833 const VkMappedMemoryRange* pMemRanges) {
2834 deviceObject := GetDevice(device)
2835
2836 memRanges := pMemRanges[0:memRangeCount]
2837 for i in (0 .. memRangeCount) {
2838 memRange := memRanges[i]
2839 memObject := GetDeviceMemory(memRange.mem)
2840 assert(memObject.device == device)
2841 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2842 }
2843
2844 return ?
2845}
2846
2847cmd VkResult vkInvalidateMappedMemoryRanges(
2848 VkDevice device,
2849 u32 memRangeCount,
2850 const VkMappedMemoryRange* pMemRanges) {
2851 deviceObject := GetDevice(device)
2852
2853 memRanges := pMemRanges[0:memRangeCount]
2854 for i in (0 .. memRangeCount) {
2855 memRange := memRanges[i]
2856 memObject := GetDeviceMemory(memRange.mem)
2857 assert(memObject.device == device)
2858 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2859 }
2860
2861 return ?
2862}
2863
2864
2865// Memory management API functions
2866
Jesse Hall606a54e2015-11-19 22:17:28 -08002867cmd void vkGetDeviceMemoryCommitment(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002868 VkDevice device,
2869 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002870 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002871 deviceObject := GetDevice(device)
2872
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002873 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002874 memoryObject := GetDeviceMemory(memory)
2875 assert(memoryObject.device == device)
2876 }
2877
2878 committedMemoryInBytes := ?
2879 pCommittedMemoryInBytes[0] = committedMemoryInBytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07002880}
2881
Jesse Hall606a54e2015-11-19 22:17:28 -08002882cmd void vkGetBufferMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002883 VkDevice device,
2884 VkBuffer buffer,
2885 VkMemoryRequirements* pMemoryRequirements) {
2886 deviceObject := GetDevice(device)
2887 bufferObject := GetBuffer(buffer)
2888 assert(bufferObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002889}
2890
2891cmd VkResult vkBindBufferMemory(
2892 VkDevice device,
2893 VkBuffer buffer,
2894 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002895 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002896 deviceObject := GetDevice(device)
2897 bufferObject := GetBuffer(buffer)
2898 assert(bufferObject.device == device)
2899
2900 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002901 if bufferObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002902 memObject := GetDeviceMemory(bufferObject.mem)
2903 memObject.boundObjects[as!u64(buffer)] = null
2904 }
2905
2906 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002907 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002908 memObject := GetDeviceMemory(mem)
2909 assert(memObject.device == device)
2910 memObject.boundObjects[as!u64(buffer)] = memOffset
2911 }
2912 bufferObject.mem = mem
2913 bufferObject.memOffset = memOffset
2914
2915 return ?
2916}
2917
Jesse Hall606a54e2015-11-19 22:17:28 -08002918cmd void vkGetImageMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002919 VkDevice device,
2920 VkImage image,
2921 VkMemoryRequirements* pMemoryRequirements) {
2922 deviceObject := GetDevice(device)
2923 imageObject := GetImage(image)
2924 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002925}
2926
2927cmd VkResult vkBindImageMemory(
2928 VkDevice device,
2929 VkImage image,
2930 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002931 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002932 deviceObject := GetDevice(device)
2933 imageObject := GetImage(image)
2934 assert(imageObject.device == device)
2935
2936 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002937 if imageObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002938 memObject := GetDeviceMemory(imageObject.mem)
2939 memObject.boundObjects[as!u64(image)] = null
2940 }
2941
2942 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002943 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002944 memObject := GetDeviceMemory(mem)
2945 assert(memObject.device == device)
2946 memObject.boundObjects[as!u64(image)] = memOffset
2947 }
2948 imageObject.mem = mem
2949 imageObject.memOffset = memOffset
2950
2951 return ?
2952}
2953
Jesse Hall606a54e2015-11-19 22:17:28 -08002954cmd void vkGetImageSparseMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002955 VkDevice device,
2956 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002957 u32* pSparseMemoryRequirementCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002958 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2959 deviceObject := GetDevice(device)
2960 imageObject := GetImage(image)
2961 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002962}
2963
Jesse Hall606a54e2015-11-19 22:17:28 -08002964cmd void vkGetPhysicalDeviceSparseImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002965 VkPhysicalDevice physicalDevice,
2966 VkFormat format,
2967 VkImageType type,
2968 u32 samples,
2969 VkImageUsageFlags usage,
2970 VkImageTiling tiling,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002971 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002972 VkSparseImageFormatProperties* pProperties) {
2973 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002974}
2975
Jesse Halla6429252015-11-29 18:59:42 -08002976cmd VkResult vkQueueBindSparse(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002977 VkQueue queue,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002978 u32 bindInfoCount,
Jesse Halla6429252015-11-29 18:59:42 -08002979 const VkBindSparseInfo* pBindInfo,
2980 VkFence fence) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002981 queueObject := GetQueue(queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002982
2983 return ?
2984}
2985
2986
2987// Fence functions
2988
2989@threadSafety("system")
2990cmd VkResult vkCreateFence(
2991 VkDevice device,
2992 const VkFenceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002993 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002994 VkFence* pFence) {
2995 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
2996 deviceObject := GetDevice(device)
2997
2998 fence := ?
2999 pFence[0] = fence
3000 State.Fences[fence] = new!FenceObject(
Jesse Halld8bade02015-11-24 10:24:18 -08003001 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT)))
Jesse Halld27f6aa2015-08-15 17:58:48 -07003002
3003 return ?
3004}
3005
3006@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003007cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003008 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003009 VkFence fence,
3010 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003011 deviceObject := GetDevice(device)
3012 fenceObject := GetFence(fence)
3013 assert(fenceObject.device == device)
3014
3015 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003016}
3017
3018@threadSafety("system")
3019cmd VkResult vkResetFences(
3020 VkDevice device,
3021 u32 fenceCount,
3022 const VkFence* pFences) {
3023 deviceObject := GetDevice(device)
3024
3025 fences := pFences[0:fenceCount]
3026 for i in (0 .. fenceCount) {
3027 fence := fences[i]
3028 fenceObject := GetFence(fence)
3029 assert(fenceObject.device == device)
3030 fenceObject.signaled = false
3031 }
3032
3033 return ?
3034}
3035
3036@threadSafety("system")
3037cmd VkResult vkGetFenceStatus(
3038 VkDevice device,
3039 VkFence fence) {
3040 deviceObject := GetDevice(device)
3041 fenceObject := GetFence(fence)
3042 assert(fenceObject.device == device)
3043
3044 return ?
3045}
3046
3047@threadSafety("system")
3048cmd VkResult vkWaitForFences(
3049 VkDevice device,
3050 u32 fenceCount,
3051 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003052 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003053 u64 timeout) { /// timeout in nanoseconds
3054 deviceObject := GetDevice(device)
3055
3056 fences := pFences[0:fenceCount]
3057 for i in (0 .. fenceCount) {
3058 fence := fences[i]
3059 fenceObject := GetFence(fence)
3060 assert(fenceObject.device == device)
3061 }
3062
3063 return ?
3064}
3065
3066
3067// Queue semaphore functions
3068
3069@threadSafety("system")
3070cmd VkResult vkCreateSemaphore(
3071 VkDevice device,
3072 const VkSemaphoreCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003073 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003074 VkSemaphore* pSemaphore) {
3075 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
3076 deviceObject := GetDevice(device)
3077
3078 semaphore := ?
3079 pSemaphore[0] = semaphore
3080 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
3081
3082 return ?
3083}
3084
3085@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003086cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003087 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003088 VkSemaphore semaphore,
3089 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003090 deviceObject := GetDevice(device)
3091 semaphoreObject := GetSemaphore(semaphore)
3092 assert(semaphoreObject.device == device)
3093
3094 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003095}
3096
Jesse Halld27f6aa2015-08-15 17:58:48 -07003097
3098// Event functions
3099
3100@threadSafety("system")
3101cmd VkResult vkCreateEvent(
3102 VkDevice device,
3103 const VkEventCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003104 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003105 VkEvent* pEvent) {
3106 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
3107 deviceObject := GetDevice(device)
3108
3109 event := ?
3110 pEvent[0] = event
3111 State.Events[event] = new!EventObject(device: device)
3112
3113 return ?
3114}
3115
3116@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003117cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003118 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003119 VkEvent event,
3120 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003121 deviceObject := GetDevice(device)
3122 eventObject := GetEvent(event)
3123 assert(eventObject.device == device)
3124
3125 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003126}
3127
3128@threadSafety("system")
3129cmd VkResult vkGetEventStatus(
3130 VkDevice device,
3131 VkEvent event) {
3132 deviceObject := GetDevice(device)
3133 eventObject := GetEvent(event)
3134 assert(eventObject.device == device)
3135
3136 return ?
3137}
3138
3139@threadSafety("system")
3140cmd VkResult vkSetEvent(
3141 VkDevice device,
3142 VkEvent event) {
3143 deviceObject := GetDevice(device)
3144 eventObject := GetEvent(event)
3145 assert(eventObject.device == device)
3146
3147 return ?
3148}
3149
3150@threadSafety("system")
3151cmd VkResult vkResetEvent(
3152 VkDevice device,
3153 VkEvent event) {
3154 deviceObject := GetDevice(device)
3155 eventObject := GetEvent(event)
3156 assert(eventObject.device == device)
3157
3158 return ?
3159}
3160
3161
3162// Query functions
3163
3164@threadSafety("system")
3165cmd VkResult vkCreateQueryPool(
3166 VkDevice device,
3167 const VkQueryPoolCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003168 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003169 VkQueryPool* pQueryPool) {
3170 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
3171 deviceObject := GetDevice(device)
3172
3173 queryPool := ?
3174 pQueryPool[0] = queryPool
3175 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
3176
3177 return ?
3178}
3179
3180@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003181cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003182 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003183 VkQueryPool queryPool,
3184 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003185 deviceObject := GetDevice(device)
3186 queryPoolObject := GetQueryPool(queryPool)
3187 assert(queryPoolObject.device == device)
3188
3189 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003190}
3191
3192@threadSafety("system")
3193cmd VkResult vkGetQueryPoolResults(
3194 VkDevice device,
3195 VkQueryPool queryPool,
3196 u32 startQuery,
3197 u32 queryCount,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003198 platform.size_t dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003199 void* pData,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003200 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003201 VkQueryResultFlags flags) {
3202 deviceObject := GetDevice(device)
3203 queryPoolObject := GetQueryPool(queryPool)
3204 assert(queryPoolObject.device == device)
3205
Jesse Halld27f6aa2015-08-15 17:58:48 -07003206 data := pData[0:dataSize]
3207
3208 return ?
3209}
3210
3211// Buffer functions
3212
3213@threadSafety("system")
3214cmd VkResult vkCreateBuffer(
3215 VkDevice device,
3216 const VkBufferCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003217 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003218 VkBuffer* pBuffer) {
3219 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
3220 deviceObject := GetDevice(device)
3221
3222 buffer := ?
3223 pBuffer[0] = buffer
3224 State.Buffers[buffer] = new!BufferObject(device: device)
3225
3226 return ?
3227}
3228
3229@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003230cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003231 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003232 VkBuffer buffer,
3233 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003234 deviceObject := GetDevice(device)
3235 bufferObject := GetBuffer(buffer)
3236 assert(bufferObject.device == device)
3237
3238 assert(bufferObject.mem == 0)
3239 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003240}
3241
3242
3243// Buffer view functions
3244
3245@threadSafety("system")
3246cmd VkResult vkCreateBufferView(
3247 VkDevice device,
3248 const VkBufferViewCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003249 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003250 VkBufferView* pView) {
3251 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
3252 deviceObject := GetDevice(device)
3253
3254 bufferObject := GetBuffer(pCreateInfo.buffer)
3255 assert(bufferObject.device == device)
3256
3257 view := ?
3258 pView[0] = view
3259 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
3260
3261 return ?
3262}
3263
3264@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003265cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003266 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003267 VkBufferView bufferView,
3268 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003269 deviceObject := GetDevice(device)
3270 bufferViewObject := GetBufferView(bufferView)
3271 assert(bufferViewObject.device == device)
3272
3273 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003274}
3275
3276
3277// Image functions
3278
3279@threadSafety("system")
3280cmd VkResult vkCreateImage(
3281 VkDevice device,
3282 const VkImageCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003283 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003284 VkImage* pImage) {
3285 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
3286 deviceObject := GetDevice(device)
3287
3288 image := ?
3289 pImage[0] = image
3290 State.Images[image] = new!ImageObject(device: device)
3291
3292 return ?
3293}
3294
3295@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003296cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003297 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003298 VkImage image,
3299 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003300 deviceObject := GetDevice(device)
3301 imageObject := GetImage(image)
3302 assert(imageObject.device == device)
3303
3304 assert(imageObject.mem == 0)
3305 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003306}
3307
Jesse Hall606a54e2015-11-19 22:17:28 -08003308cmd void vkGetImageSubresourceLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003309 VkDevice device,
3310 VkImage image,
3311 const VkImageSubresource* pSubresource,
3312 VkSubresourceLayout* pLayout) {
3313 deviceObject := GetDevice(device)
3314 imageObject := GetImage(image)
3315 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003316}
3317
3318
3319// Image view functions
3320
3321@threadSafety("system")
3322cmd VkResult vkCreateImageView(
3323 VkDevice device,
3324 const VkImageViewCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003325 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003326 VkImageView* pView) {
3327 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
3328 deviceObject := GetDevice(device)
3329
3330 imageObject := GetImage(pCreateInfo.image)
3331 assert(imageObject.device == device)
3332
3333 view := ?
3334 pView[0] = view
3335 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
3336
3337 return ?
3338}
3339
3340@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003341cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003342 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003343 VkImageView imageView,
3344 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003345 deviceObject := GetDevice(device)
3346 imageViewObject := GetImageView(imageView)
3347 assert(imageViewObject.device == device)
3348
3349 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003350}
3351
3352
3353// Shader functions
3354
3355cmd VkResult vkCreateShaderModule(
3356 VkDevice device,
3357 const VkShaderModuleCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003358 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003359 VkShaderModule* pShaderModule) {
3360 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
3361 deviceObject := GetDevice(device)
3362
3363 shaderModule := ?
3364 pShaderModule[0] = shaderModule
3365 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
3366
3367 return ?
3368}
3369
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003370cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003371 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003372 VkShaderModule shaderModule,
3373 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003374 deviceObject := GetDevice(device)
3375 shaderModuleObject := GetShaderModule(shaderModule)
3376 assert(shaderModuleObject.device == device)
3377
3378 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003379}
3380
3381@threadSafety("system")
3382cmd VkResult vkCreateShader(
3383 VkDevice device,
3384 const VkShaderCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003385 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003386 VkShader* pShader) {
3387 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO)
3388 deviceObject := GetDevice(device)
3389
3390 shader := ?
3391 pShader[0] = shader
3392 State.Shaders[shader] = new!ShaderObject(device: device)
3393
3394 return ?
3395}
3396
3397@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003398cmd void vkDestroyShader(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003399 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003400 VkShader shader,
3401 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003402 deviceObject := GetDevice(device)
3403 shaderObject := GetShader(shader)
3404 assert(shaderObject.device == device)
3405
3406 State.Shaders[shader] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003407}
3408
3409
3410// Pipeline functions
3411
3412cmd VkResult vkCreatePipelineCache(
3413 VkDevice device,
3414 const VkPipelineCacheCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003415 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003416 VkPipelineCache* pPipelineCache) {
3417 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
3418 deviceObject := GetDevice(device)
3419
3420 pipelineCache := ?
3421 pPipelineCache[0] = pipelineCache
3422 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
3423
3424 return ?
3425}
3426
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003427cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003428 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003429 VkPipelineCache pipelineCache,
3430 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003431 deviceObject := GetDevice(device)
3432 pipelineCacheObject := GetPipelineCache(pipelineCache)
3433 assert(pipelineCacheObject.device == device)
3434
3435 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003436}
3437
Jesse Halld27f6aa2015-08-15 17:58:48 -07003438cmd VkResult vkGetPipelineCacheData(
3439 VkDevice device,
3440 VkPipelineCache pipelineCache,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003441 platform.size_t* pDataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003442 void* pData) {
3443 deviceObject := GetDevice(device)
3444 pipelineCacheObject := GetPipelineCache(pipelineCache)
3445 assert(pipelineCacheObject.device == device)
3446
3447 return ?
3448}
3449
3450cmd VkResult vkMergePipelineCaches(
3451 VkDevice device,
3452 VkPipelineCache destCache,
3453 u32 srcCacheCount,
3454 const VkPipelineCache* pSrcCaches) {
3455 deviceObject := GetDevice(device)
3456 destCacheObject := GetPipelineCache(destCache)
3457 assert(destCacheObject.device == device)
3458
3459 srcCaches := pSrcCaches[0:srcCacheCount]
3460 for i in (0 .. srcCacheCount) {
3461 srcCache := srcCaches[i]
3462 srcCacheObject := GetPipelineCache(srcCache)
3463 assert(srcCacheObject.device == device)
3464 }
3465
3466 return ?
3467}
3468
3469cmd VkResult vkCreateGraphicsPipelines(
3470 VkDevice device,
3471 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003472 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003473 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003474 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003475 VkPipeline* pPipelines) {
3476 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003477 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003478 pipelineCacheObject := GetPipelineCache(pipelineCache)
3479 assert(pipelineCacheObject.device == device)
3480 }
3481
Jesse Hall03b6fe12015-11-24 12:44:21 -08003482 createInfos := pCreateInfos[0:createInfoCount]
3483 pipelines := pPipelines[0:createInfoCount]
3484 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003485 pipeline := ?
3486 pipelines[i] = pipeline
3487 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3488 }
3489
3490 return ?
3491}
3492
3493cmd VkResult vkCreateComputePipelines(
3494 VkDevice device,
3495 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003496 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003497 const VkComputePipelineCreateInfo* pCreateInfos,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003498 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003499 VkPipeline* pPipelines) {
3500 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003501 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003502 pipelineCacheObject := GetPipelineCache(pipelineCache)
3503 assert(pipelineCacheObject.device == device)
3504 }
3505
Jesse Hall03b6fe12015-11-24 12:44:21 -08003506 createInfos := pCreateInfos[0:createInfoCount]
3507 pipelines := pPipelines[0:createInfoCount]
3508 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003509 pipeline := ?
3510 pipelines[i] = pipeline
3511 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3512 }
3513
3514 return ?
3515}
3516
3517@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003518cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003519 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003520 VkPipeline pipeline,
3521 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003522 deviceObject := GetDevice(device)
3523 pipelineObjects := GetPipeline(pipeline)
3524 assert(pipelineObjects.device == device)
3525
3526 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003527}
3528
3529
3530// Pipeline layout functions
3531
3532@threadSafety("system")
3533cmd VkResult vkCreatePipelineLayout(
3534 VkDevice device,
3535 const VkPipelineLayoutCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003536 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003537 VkPipelineLayout* pPipelineLayout) {
3538 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3539 deviceObject := GetDevice(device)
3540
3541 pipelineLayout := ?
3542 pPipelineLayout[0] = pipelineLayout
3543 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3544
3545 return ?
3546}
3547
3548@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003549cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003550 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003551 VkPipelineLayout pipelineLayout,
3552 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003553 deviceObject := GetDevice(device)
3554 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3555 assert(pipelineLayoutObjects.device == device)
3556
3557 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003558}
3559
3560
3561// Sampler functions
3562
3563@threadSafety("system")
3564cmd VkResult vkCreateSampler(
3565 VkDevice device,
3566 const VkSamplerCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003567 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003568 VkSampler* pSampler) {
3569 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3570 deviceObject := GetDevice(device)
3571
3572 sampler := ?
3573 pSampler[0] = sampler
3574 State.Samplers[sampler] = new!SamplerObject(device: device)
3575
3576 return ?
3577}
3578
3579@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003580cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003581 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003582 VkSampler sampler,
3583 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003584 deviceObject := GetDevice(device)
3585 samplerObject := GetSampler(sampler)
3586 assert(samplerObject.device == device)
3587
3588 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003589}
3590
3591
3592// Descriptor set functions
3593
3594@threadSafety("system")
3595cmd VkResult vkCreateDescriptorSetLayout(
3596 VkDevice device,
3597 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003598 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003599 VkDescriptorSetLayout* pSetLayout) {
3600 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3601 deviceObject := GetDevice(device)
3602
3603 setLayout := ?
3604 pSetLayout[0] = setLayout
3605 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3606
3607 return ?
3608}
3609
3610@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003611cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003612 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003613 VkDescriptorSetLayout descriptorSetLayout,
3614 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003615 deviceObject := GetDevice(device)
3616 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3617 assert(descriptorSetLayoutObject.device == device)
3618
3619 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003620}
3621
3622@threadSafety("system")
3623cmd VkResult vkCreateDescriptorPool(
3624 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003625 const VkDescriptorPoolCreateInfo* pCreateInfo,
3626 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003627 VkDescriptorPool* pDescriptorPool) {
3628 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3629 deviceObject := GetDevice(device)
3630
3631 descriptorPool := ?
3632 pDescriptorPool[0] = descriptorPool
3633 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3634
3635 return ?
3636}
3637
3638@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003639cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003640 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003641 VkDescriptorPool descriptorPool,
3642 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003643 deviceObject := GetDevice(device)
3644 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3645 assert(descriptorPoolObject.device == device)
3646
3647 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003648}
3649
3650@threadSafety("app")
3651cmd VkResult vkResetDescriptorPool(
3652 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003653 VkDescriptorPool descriptorPool,
3654 VkDescriptorPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003655 deviceObject := GetDevice(device)
3656 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3657 assert(descriptorPoolObject.device == device)
3658
3659 return ?
3660}
3661
3662@threadSafety("app")
3663cmd VkResult vkAllocDescriptorSets(
3664 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003665 const VkDescriptorSetAllocInfo* pAllocInfo,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003666 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003667 deviceObject := GetDevice(device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003668 allocInfo := pAllocInfo[0]
3669 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003670
Jesse Hall03b6fe12015-11-24 12:44:21 -08003671 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount]
3672 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003673 setLayout := setLayouts[i]
3674 setLayoutObject := GetDescriptorSetLayout(setLayout)
3675 assert(setLayoutObject.device == device)
3676 }
3677
Jesse Hall03b6fe12015-11-24 12:44:21 -08003678 descriptorSets := pDescriptorSets[0:allocInfo.setCount]
3679 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003680 descriptorSet := ?
3681 descriptorSets[i] = descriptorSet
3682 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3683 }
3684
3685 return ?
3686}
3687
Jesse Hallf09c6b12015-08-15 19:54:28 -07003688cmd VkResult vkFreeDescriptorSets(
3689 VkDevice device,
3690 VkDescriptorPool descriptorPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003691 u32 descriptorSetCount,
Jesse Hallf09c6b12015-08-15 19:54:28 -07003692 const VkDescriptorSet* pDescriptorSets) {
3693 deviceObject := GetDevice(device)
3694 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3695
Jesse Hall03b6fe12015-11-24 12:44:21 -08003696 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3697 for i in (0 .. descriptorSetCount) {
Jesse Hallf09c6b12015-08-15 19:54:28 -07003698 descriptorSet := descriptorSets[i]
3699 descriptorSetObject := GetDescriptorSet(descriptorSet)
3700 assert(descriptorSetObject.device == device)
3701 State.DescriptorSets[descriptorSet] = null
3702 }
3703
3704 return ?
3705}
3706
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003707cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003708 VkDevice device,
3709 u32 writeCount,
3710 const VkWriteDescriptorSet* pDescriptorWrites,
3711 u32 copyCount,
3712 const VkCopyDescriptorSet* pDescriptorCopies) {
3713 deviceObject := GetDevice(device)
3714
3715 descriptorWrites := pDescriptorWrites[0:writeCount]
3716 for i in (0 .. writeCount) {
3717 descriptorWrite := descriptorWrites[i]
3718 descriptorWriteObject := GetDescriptorSet(descriptorWrite.destSet)
3719 assert(descriptorWriteObject.device == device)
3720 }
3721
3722 descriptorCopies := pDescriptorCopies[0:copyCount]
3723 for i in (0 .. copyCount) {
3724 descriptorCopy := descriptorCopies[i]
3725 descriptorCopyObject := GetDescriptorSet(descriptorCopy.destSet)
3726 assert(descriptorCopyObject.device == device)
3727 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003728}
3729
3730
3731// Framebuffer functions
3732
3733@threadSafety("system")
3734cmd VkResult vkCreateFramebuffer(
3735 VkDevice device,
3736 const VkFramebufferCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003737 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003738 VkFramebuffer* pFramebuffer) {
3739 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3740 deviceObject := GetDevice(device)
3741
3742 framebuffer := ?
3743 pFramebuffer[0] = framebuffer
3744 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3745
3746 return ?
3747}
3748
3749@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003750cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003751 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003752 VkFramebuffer framebuffer,
3753 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003754 deviceObject := GetDevice(device)
3755 framebufferObject := GetFramebuffer(framebuffer)
3756 assert(framebufferObject.device == device)
3757
3758 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003759}
3760
3761
3762// Renderpass functions
3763
3764@threadSafety("system")
3765cmd VkResult vkCreateRenderPass(
3766 VkDevice device,
3767 const VkRenderPassCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003768 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003769 VkRenderPass* pRenderPass) {
3770 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3771 deviceObject := GetDevice(device)
3772
3773 renderpass := ?
3774 pRenderPass[0] = renderpass
3775 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3776
3777 return ?
3778}
3779
3780@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003781cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003782 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003783 VkRenderPass renderPass,
3784 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003785 deviceObject := GetDevice(device)
3786 renderPassObject := GetRenderPass(renderPass)
3787 assert(renderPassObject.device == device)
3788
3789 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003790}
3791
Jesse Hall606a54e2015-11-19 22:17:28 -08003792cmd void vkGetRenderAreaGranularity(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003793 VkDevice device,
3794 VkRenderPass renderPass,
3795 VkExtent2D* pGranularity) {
3796 deviceObject := GetDevice(device)
3797 renderPassObject := GetRenderPass(renderPass)
3798
3799 granularity := ?
3800 pGranularity[0] = granularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07003801}
3802
3803// Command pool functions
3804
3805cmd VkResult vkCreateCommandPool(
3806 VkDevice device,
3807 const VkCmdPoolCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003808 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003809 VkCmdPool* pCmdPool) {
3810 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO)
3811 deviceObject := GetDevice(device)
3812
3813 cmdPool := ?
3814 pCmdPool[0] = cmdPool
3815 State.CmdPools[cmdPool] = new!CmdPoolObject(device: device)
3816
3817 return ?
3818}
3819
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003820cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003821 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003822 VkCmdPool cmdPool,
3823 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003824 deviceObject := GetDevice(device)
3825 cmdPoolObject := GetCmdPool(cmdPool)
3826 assert(cmdPoolObject.device == device)
3827
3828 State.CmdPools[cmdPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003829}
3830
3831cmd VkResult vkResetCommandPool(
3832 VkDevice device,
3833 VkCmdPool cmdPool,
3834 VkCmdPoolResetFlags flags) {
3835 deviceObject := GetDevice(device)
3836 cmdPoolObject := GetCmdPool(cmdPool)
3837 assert(cmdPoolObject.device == device)
3838
3839 return ?
3840}
3841
3842// Command buffer functions
3843
3844macro void bindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3845 memoryObject := GetDeviceMemory(mem)
3846 memoryObject.boundCommandBuffers[cmdBuffer] = cmdBuffer
3847
3848 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3849 cmdBufferObject.boundObjects[as!u64(obj)] = mem
3850}
3851
3852macro void unbindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3853 memoryObject := GetDeviceMemory(mem)
3854 memoryObject.boundCommandBuffers[cmdBuffer] = null
3855
3856 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3857 cmdBufferObject.boundObjects[as!u64(obj)] = null
3858}
3859
3860@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003861cmd VkResult vkAllocCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003862 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003863 const VkCmdBufferAllocInfo* pAllocInfo,
3864 VkCmdBuffer* pCmdBuffers) {
3865 assert(pAllocInfo[0].sType == VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003866
Jesse Hall03b6fe12015-11-24 12:44:21 -08003867 count := pAllocInfo[0].bufferCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08003868 cmdBuffers := pCmdBuffers[0:count]
3869 for i in (0 .. count) {
3870 cmdBuffer := ?
3871 cmdBuffers[i] = cmdBuffer
3872 State.CmdBuffers[cmdBuffer] = new!CmdBufferObject(device: device)
3873 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003874
3875 return ?
3876}
3877
3878@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003879cmd void vkFreeCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003880 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003881 VkCmdPool cmdPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003882 u32 commandBufferCount,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003883 const VkCmdBuffer* pCommandBuffers) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003884 deviceObject := GetDevice(device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003885
Jesse Hall03b6fe12015-11-24 12:44:21 -08003886 cmdBuffers := pCommandBuffers[0:commandBufferCount]
3887 for i in (0 .. commandBufferCount) {
Jesse Hallfbf97b02015-11-20 14:17:03 -08003888 cmdBufferObject := GetCmdBuffer(cmdBuffers[i])
3889 assert(cmdBufferObject.device == device)
3890 // TODO: iterate over boundObjects and clear memory bindings
3891 State.CmdBuffers[cmdBuffers[i]] = null
3892 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003893}
3894
3895@threadSafety("app")
3896cmd VkResult vkBeginCommandBuffer(
3897 VkCmdBuffer cmdBuffer,
3898 const VkCmdBufferBeginInfo* pBeginInfo) {
3899 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO)
3900 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3901
3902 // TODO: iterate over boundObjects and clear memory bindings
3903
3904 return ?
3905}
3906
3907@threadSafety("app")
3908cmd VkResult vkEndCommandBuffer(
3909 VkCmdBuffer cmdBuffer) {
3910 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3911
3912 return ?
3913}
3914
3915@threadSafety("app")
3916cmd VkResult vkResetCommandBuffer(
3917 VkCmdBuffer cmdBuffer,
3918 VkCmdBufferResetFlags flags) {
3919 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3920
3921 // TODO: iterate over boundObjects and clear memory bindings
3922
3923 return ?
3924}
3925
3926
3927// Command buffer building functions
3928
3929@threadSafety("app")
3930cmd void vkCmdBindPipeline(
3931 VkCmdBuffer cmdBuffer,
3932 VkPipelineBindPoint pipelineBindPoint,
3933 VkPipeline pipeline) {
3934 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3935 pipelineObject := GetPipeline(pipeline)
3936 assert(cmdBufferObject.device == pipelineObject.device)
3937
Jesse Halld8bade02015-11-24 10:24:18 -08003938 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003939 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3940 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3941 }
Jesse Halld8bade02015-11-24 10:24:18 -08003942 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003943}
3944
3945@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003946cmd void vkCmdSetViewport(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003947 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003948 u32 viewportCount,
3949 const VkViewport* pViewports) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003950 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003951 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003952}
3953
3954@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003955cmd void vkCmdSetScissor(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003956 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003957 u32 scissorCount,
3958 const VkRect2D* pScissors) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003959 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003960 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003961}
3962
3963@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003964cmd void vkCmdSetLineWidth(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003965 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003966 f32 lineWidth) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003967 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003968 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003969}
3970
3971@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003972cmd void vkCmdSetDepthBias(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003973 VkCmdBuffer cmdBuffer,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003974 f32 depthBiasConstantFactor,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003975 f32 depthBiasClamp,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003976 f32 depthBiasSlopeFactor) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003977 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003978 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003979}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003980
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003981@threadSafety("app")
3982cmd void vkCmdSetBlendConstants(
3983 VkCmdBuffer cmdBuffer,
3984 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3985 // an annotation as a quick hack to pass this to the template without
3986 // having to modify the AST and semantic model.
3987 @readonly f32[4] blendConst) {
3988 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003989 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003990}
3991
3992@threadSafety("app")
3993cmd void vkCmdSetDepthBounds(
3994 VkCmdBuffer cmdBuffer,
3995 f32 minDepthBounds,
3996 f32 maxDepthBounds) {
3997 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003998 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003999}
4000
4001@threadSafety("app")
4002cmd void vkCmdSetStencilCompareMask(
4003 VkCmdBuffer cmdBuffer,
4004 VkStencilFaceFlags faceMask,
4005 u32 stencilCompareMask) {
4006 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004007 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004008}
4009
4010@threadSafety("app")
4011cmd void vkCmdSetStencilWriteMask(
4012 VkCmdBuffer cmdBuffer,
4013 VkStencilFaceFlags faceMask,
4014 u32 stencilWriteMask) {
4015 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004016 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004017}
4018
4019@threadSafety("app")
4020cmd void vkCmdSetStencilReference(
4021 VkCmdBuffer cmdBuffer,
4022 VkStencilFaceFlags faceMask,
4023 u32 stencilReference) {
4024 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004025 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004026}
4027
4028@threadSafety("app")
4029cmd void vkCmdBindDescriptorSets(
4030 VkCmdBuffer cmdBuffer,
4031 VkPipelineBindPoint pipelineBindPoint,
4032 VkPipelineLayout layout,
4033 u32 firstSet,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004034 u32 descriptorSetCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004035 const VkDescriptorSet* pDescriptorSets,
4036 u32 dynamicOffsetCount,
4037 const u32* pDynamicOffsets) {
4038 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4039
Jesse Hall03b6fe12015-11-24 12:44:21 -08004040 descriptorSets := pDescriptorSets[0:descriptorSetCount]
4041 for i in (0 .. descriptorSetCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004042 descriptorSet := descriptorSets[i]
4043 descriptorSetObject := GetDescriptorSet(descriptorSet)
4044 assert(cmdBufferObject.device == descriptorSetObject.device)
4045 }
4046
4047 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
4048 for i in (0 .. dynamicOffsetCount) {
4049 dynamicOffset := dynamicOffsets[i]
4050 }
4051
Jesse Halld8bade02015-11-24 10:24:18 -08004052 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004053 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
4054 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
4055 }
Jesse Halld8bade02015-11-24 10:24:18 -08004056 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004057}
4058
4059@threadSafety("app")
4060cmd void vkCmdBindIndexBuffer(
4061 VkCmdBuffer cmdBuffer,
4062 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004063 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004064 VkIndexType indexType) {
4065 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4066 bufferObject := GetBuffer(buffer)
4067 assert(cmdBufferObject.device == bufferObject.device)
4068
4069 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4070
Jesse Halld8bade02015-11-24 10:24:18 -08004071 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004072}
4073
4074@threadSafety("app")
4075cmd void vkCmdBindVertexBuffers(
4076 VkCmdBuffer cmdBuffer,
4077 u32 startBinding,
4078 u32 bindingCount,
4079 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004080 const VkDeviceSize* pOffsets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004081 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4082
4083 // TODO: check if not [startBinding:startBinding+bindingCount]
4084 buffers := pBuffers[0:bindingCount]
4085 offsets := pOffsets[0:bindingCount]
4086 for i in (0 .. bindingCount) {
4087 buffer := buffers[i]
4088 offset := offsets[i]
4089 bufferObject := GetBuffer(buffer)
4090 assert(cmdBufferObject.device == bufferObject.device)
4091
4092 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4093 }
4094
Jesse Halld8bade02015-11-24 10:24:18 -08004095 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004096}
4097
4098@threadSafety("app")
4099cmd void vkCmdDraw(
4100 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004101 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004102 u32 instanceCount,
4103 u32 firstVertex,
4104 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004105 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4106
Jesse Halld8bade02015-11-24 10:24:18 -08004107 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004108}
4109
4110@threadSafety("app")
4111cmd void vkCmdDrawIndexed(
4112 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004113 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004114 u32 instanceCount,
4115 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004116 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004117 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004118 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4119
Jesse Halld8bade02015-11-24 10:24:18 -08004120 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004121}
4122
4123@threadSafety("app")
4124cmd void vkCmdDrawIndirect(
4125 VkCmdBuffer cmdBuffer,
4126 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004127 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004128 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004129 u32 stride) {
4130 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4131 bufferObject := GetBuffer(buffer)
4132 assert(cmdBufferObject.device == bufferObject.device)
4133
4134 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4135
Jesse Halld8bade02015-11-24 10:24:18 -08004136 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004137}
4138
4139@threadSafety("app")
4140cmd void vkCmdDrawIndexedIndirect(
4141 VkCmdBuffer cmdBuffer,
4142 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004143 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004144 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004145 u32 stride) {
4146 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4147 bufferObject := GetBuffer(buffer)
4148 assert(cmdBufferObject.device == bufferObject.device)
4149
4150 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4151
Jesse Halld8bade02015-11-24 10:24:18 -08004152 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004153}
4154
4155@threadSafety("app")
4156cmd void vkCmdDispatch(
4157 VkCmdBuffer cmdBuffer,
4158 u32 x,
4159 u32 y,
4160 u32 z) {
4161 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4162
Jesse Halld8bade02015-11-24 10:24:18 -08004163 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004164}
4165
4166@threadSafety("app")
4167cmd void vkCmdDispatchIndirect(
4168 VkCmdBuffer cmdBuffer,
4169 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004170 VkDeviceSize offset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004171 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4172 bufferObject := GetBuffer(buffer)
4173 assert(cmdBufferObject.device == bufferObject.device)
4174
4175 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4176
Jesse Halld8bade02015-11-24 10:24:18 -08004177 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004178}
4179
4180@threadSafety("app")
4181cmd void vkCmdCopyBuffer(
4182 VkCmdBuffer cmdBuffer,
4183 VkBuffer srcBuffer,
4184 VkBuffer destBuffer,
4185 u32 regionCount,
4186 const VkBufferCopy* pRegions) {
4187 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4188 srcBufferObject := GetBuffer(srcBuffer)
4189 destBufferObject := GetBuffer(destBuffer)
4190 assert(cmdBufferObject.device == srcBufferObject.device)
4191 assert(cmdBufferObject.device == destBufferObject.device)
4192
4193 regions := pRegions[0:regionCount]
4194 for i in (0 .. regionCount) {
4195 region := regions[i]
4196 }
4197
4198 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
4199 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4200
Jesse Halld8bade02015-11-24 10:24:18 -08004201 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004202}
4203
4204@threadSafety("app")
4205cmd void vkCmdCopyImage(
4206 VkCmdBuffer cmdBuffer,
4207 VkImage srcImage,
4208 VkImageLayout srcImageLayout,
4209 VkImage destImage,
4210 VkImageLayout destImageLayout,
4211 u32 regionCount,
4212 const VkImageCopy* pRegions) {
4213 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4214 srcImageObject := GetImage(srcImage)
4215 destImageObject := GetImage(destImage)
4216 assert(cmdBufferObject.device == srcImageObject.device)
4217 assert(cmdBufferObject.device == destImageObject.device)
4218
4219 regions := pRegions[0:regionCount]
4220 for i in (0 .. regionCount) {
4221 region := regions[i]
4222 }
4223
4224 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4225 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4226
Jesse Halld8bade02015-11-24 10:24:18 -08004227 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004228}
4229
4230@threadSafety("app")
4231cmd void vkCmdBlitImage(
4232 VkCmdBuffer cmdBuffer,
4233 VkImage srcImage,
4234 VkImageLayout srcImageLayout,
4235 VkImage destImage,
4236 VkImageLayout destImageLayout,
4237 u32 regionCount,
4238 const VkImageBlit* pRegions,
Jesse Hall23ff73f2015-11-29 14:36:39 -08004239 VkFilter filter) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004240 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4241 srcImageObject := GetImage(srcImage)
4242 destImageObject := GetImage(destImage)
4243 assert(cmdBufferObject.device == srcImageObject.device)
4244 assert(cmdBufferObject.device == destImageObject.device)
4245
4246 regions := pRegions[0:regionCount]
4247 for i in (0 .. regionCount) {
4248 region := regions[i]
4249 }
4250
4251 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4252 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4253
Jesse Halld8bade02015-11-24 10:24:18 -08004254 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004255}
4256
4257@threadSafety("app")
4258cmd void vkCmdCopyBufferToImage(
4259 VkCmdBuffer cmdBuffer,
4260 VkBuffer srcBuffer,
4261 VkImage destImage,
4262 VkImageLayout destImageLayout,
4263 u32 regionCount,
4264 const VkBufferImageCopy* pRegions) {
4265 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4266 srcBufferObject := GetBuffer(srcBuffer)
4267 destImageObject := GetImage(destImage)
4268 assert(cmdBufferObject.device == srcBufferObject.device)
4269 assert(cmdBufferObject.device == destImageObject.device)
4270
4271 regions := pRegions[0:regionCount]
4272 for i in (0 .. regionCount) {
4273 region := regions[i]
4274 }
4275
4276 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
4277 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4278
Jesse Halld8bade02015-11-24 10:24:18 -08004279 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004280}
4281
4282@threadSafety("app")
4283cmd void vkCmdCopyImageToBuffer(
4284 VkCmdBuffer cmdBuffer,
4285 VkImage srcImage,
4286 VkImageLayout srcImageLayout,
4287 VkBuffer destBuffer,
4288 u32 regionCount,
4289 const VkBufferImageCopy* pRegions) {
4290 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4291 srcImageObject := GetImage(srcImage)
4292 destBufferObject := GetBuffer(destBuffer)
4293 assert(cmdBufferObject.device == srcImageObject.device)
4294 assert(cmdBufferObject.device == destBufferObject.device)
4295
4296 regions := pRegions[0:regionCount]
4297 for i in (0 .. regionCount) {
4298 region := regions[i]
4299 }
4300
4301 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4302 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4303
Jesse Halld8bade02015-11-24 10:24:18 -08004304 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004305}
4306
4307@threadSafety("app")
4308cmd void vkCmdUpdateBuffer(
4309 VkCmdBuffer cmdBuffer,
4310 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004311 VkDeviceSize destOffset,
4312 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004313 const u32* pData) {
4314 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4315 destBufferObject := GetBuffer(destBuffer)
4316 assert(cmdBufferObject.device == destBufferObject.device)
4317
4318 data := pData[0:dataSize]
4319
4320 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4321
Jesse Halld8bade02015-11-24 10:24:18 -08004322 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004323}
4324
4325@threadSafety("app")
4326cmd void vkCmdFillBuffer(
4327 VkCmdBuffer cmdBuffer,
4328 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004329 VkDeviceSize destOffset,
4330 VkDeviceSize fillSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004331 u32 data) {
4332 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4333 destBufferObject := GetBuffer(destBuffer)
4334 assert(cmdBufferObject.device == destBufferObject.device)
4335
Jesse Halld8bade02015-11-24 10:24:18 -08004336 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004337}
4338
4339@threadSafety("app")
4340cmd void vkCmdClearColorImage(
4341 VkCmdBuffer cmdBuffer,
4342 VkImage image,
4343 VkImageLayout imageLayout,
4344 const VkClearColorValue* pColor,
4345 u32 rangeCount,
4346 const VkImageSubresourceRange* pRanges) {
4347 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4348 imageObject := GetImage(image)
4349 assert(cmdBufferObject.device == imageObject.device)
4350
4351 ranges := pRanges[0:rangeCount]
4352 for i in (0 .. rangeCount) {
4353 range := ranges[i]
4354 }
4355
4356 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
4357
Jesse Halld8bade02015-11-24 10:24:18 -08004358 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004359}
4360
4361@threadSafety("app")
4362cmd void vkCmdClearDepthStencilImage(
4363 VkCmdBuffer cmdBuffer,
4364 VkImage image,
4365 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004366 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004367 u32 rangeCount,
4368 const VkImageSubresourceRange* pRanges) {
4369 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4370 imageObject := GetImage(image)
4371 assert(cmdBufferObject.device == imageObject.device)
4372
4373 ranges := pRanges[0:rangeCount]
4374 for i in (0 .. rangeCount) {
4375 range := ranges[i]
4376 }
4377
4378 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
4379
Jesse Halld8bade02015-11-24 10:24:18 -08004380 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004381}
4382
4383@threadSafety("app")
Jesse Hallae38f732015-11-19 21:32:50 -08004384cmd void vkCmdClearAttachments(
Jesse Halld27f6aa2015-08-15 17:58:48 -07004385 VkCmdBuffer cmdBuffer,
Jesse Hallae38f732015-11-19 21:32:50 -08004386 u32 attachmentCount,
4387 const VkClearAttachment* pAttachments,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004388 u32 rectCount,
Jesse Halla15a4bf2015-11-19 22:48:02 -08004389 const VkClearRect* pRects) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004390 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4391
4392 rects := pRects[0:rectCount]
4393 for i in (0 .. rectCount) {
4394 rect := rects[i]
4395 }
4396
Jesse Halld8bade02015-11-24 10:24:18 -08004397 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004398}
4399
4400@threadSafety("app")
4401cmd void vkCmdResolveImage(
4402 VkCmdBuffer cmdBuffer,
4403 VkImage srcImage,
4404 VkImageLayout srcImageLayout,
4405 VkImage destImage,
4406 VkImageLayout destImageLayout,
4407 u32 regionCount,
4408 const VkImageResolve* pRegions) {
4409 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4410 srcImageObject := GetImage(srcImage)
4411 destImageObject := GetImage(destImage)
4412 assert(cmdBufferObject.device == srcImageObject.device)
4413 assert(cmdBufferObject.device == destImageObject.device)
4414
4415 regions := pRegions[0:regionCount]
4416 for i in (0 .. regionCount) {
4417 region := regions[i]
4418 }
4419
4420 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4421 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4422
Jesse Halld8bade02015-11-24 10:24:18 -08004423 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004424}
4425
4426@threadSafety("app")
4427cmd void vkCmdSetEvent(
4428 VkCmdBuffer cmdBuffer,
4429 VkEvent event,
4430 VkPipelineStageFlags stageMask) {
4431 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4432 eventObject := GetEvent(event)
4433 assert(cmdBufferObject.device == eventObject.device)
4434}
4435
4436@threadSafety("app")
4437cmd void vkCmdResetEvent(
4438 VkCmdBuffer cmdBuffer,
4439 VkEvent event,
4440 VkPipelineStageFlags stageMask) {
4441 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4442 eventObject := GetEvent(event)
4443 assert(cmdBufferObject.device == eventObject.device)
4444}
4445
4446@threadSafety("app")
4447cmd void vkCmdWaitEvents(
4448 VkCmdBuffer cmdBuffer,
4449 u32 eventCount,
4450 const VkEvent* pEvents,
4451 VkPipelineStageFlags srcStageMask,
4452 VkPipelineStageFlags destStageMask,
4453 u32 memBarrierCount,
4454 const void* const* ppMemBarriers) {
4455 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4456
4457 events := pEvents[0:eventCount]
4458 for i in (0 .. eventCount) {
4459 event := events[i]
4460 eventObject := GetEvent(event)
4461 assert(cmdBufferObject.device == eventObject.device)
4462 }
4463
4464 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4465 for i in (0 .. memBarrierCount) {
4466 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4467 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4468 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4469 }
4470 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4471 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4472 imageObject := GetImage(imageMemBarrier.image)
4473 assert(imageObject.device == cmdBufferObject.device)
4474 }
4475 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4476 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4477 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4478 assert(bufferObject.device == cmdBufferObject.device)
4479 }
4480 }
4481 }
4482}
4483
4484@threadSafety("app")
4485cmd void vkCmdPipelineBarrier(
4486 VkCmdBuffer cmdBuffer,
4487 VkPipelineStageFlags srcStageMask,
4488 VkPipelineStageFlags destStageMask,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004489 VkBool32 byRegion,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004490 u32 memBarrierCount,
4491 const void* const* ppMemBarriers) {
4492 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4493
4494 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4495 for i in (0 .. memBarrierCount) {
4496 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4497 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4498 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4499 }
4500 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4501 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4502 imageObject := GetImage(imageMemBarrier.image)
4503 assert(imageObject.device == cmdBufferObject.device)
4504 }
4505 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4506 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4507 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4508 assert(bufferObject.device == cmdBufferObject.device)
4509 }
4510 }
4511 }
4512}
4513
4514@threadSafety("app")
4515cmd void vkCmdBeginQuery(
4516 VkCmdBuffer cmdBuffer,
4517 VkQueryPool queryPool,
4518 u32 slot,
4519 VkQueryControlFlags flags) {
4520 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4521 queryPoolObject := GetQueryPool(queryPool)
4522 assert(cmdBufferObject.device == queryPoolObject.device)
4523}
4524
4525@threadSafety("app")
4526cmd void vkCmdEndQuery(
4527 VkCmdBuffer cmdBuffer,
4528 VkQueryPool queryPool,
4529 u32 slot) {
4530 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4531 queryPoolObject := GetQueryPool(queryPool)
4532 assert(cmdBufferObject.device == queryPoolObject.device)
4533}
4534
4535@threadSafety("app")
4536cmd void vkCmdResetQueryPool(
4537 VkCmdBuffer cmdBuffer,
4538 VkQueryPool queryPool,
4539 u32 startQuery,
4540 u32 queryCount) {
4541 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4542 queryPoolObject := GetQueryPool(queryPool)
4543 assert(cmdBufferObject.device == queryPoolObject.device)
4544}
4545
4546@threadSafety("app")
4547cmd void vkCmdWriteTimestamp(
4548 VkCmdBuffer cmdBuffer,
Jesse Hall6f39a6d2015-11-24 11:08:36 -08004549 VkPipelineStageFlagBits pipelineStage,
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004550 VkQueryPool queryPool,
4551 u32 slot) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004552 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004553 queryPoolObject := GetQueryPool(queryPool)
4554 assert(cmdBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004555}
4556
4557@threadSafety("app")
4558cmd void vkCmdCopyQueryPoolResults(
4559 VkCmdBuffer cmdBuffer,
4560 VkQueryPool queryPool,
4561 u32 startQuery,
4562 u32 queryCount,
4563 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004564 VkDeviceSize destOffset,
Jesse Halla9bb62b2015-11-21 19:31:56 -08004565 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004566 VkQueryResultFlags flags) {
4567 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4568 queryPoolObject := GetQueryPool(queryPool)
4569 destBufferObject := GetBuffer(destBuffer)
4570 assert(cmdBufferObject.device == queryPoolObject.device)
4571 assert(cmdBufferObject.device == destBufferObject.device)
4572}
4573
4574cmd void vkCmdPushConstants(
4575 VkCmdBuffer cmdBuffer,
4576 VkPipelineLayout layout,
4577 VkShaderStageFlags stageFlags,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004578 u32 offset,
4579 u32 size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004580 const void* values) {
4581 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4582 layoutObject := GetPipelineLayout(layout)
4583 assert(cmdBufferObject.device == layoutObject.device)
4584}
4585
4586@threadSafety("app")
4587cmd void vkCmdBeginRenderPass(
4588 VkCmdBuffer cmdBuffer,
4589 const VkRenderPassBeginInfo* pRenderPassBegin,
4590 VkRenderPassContents contents) {
4591 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4592 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4593 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
4594 assert(cmdBufferObject.device == renderPassObject.device)
4595 assert(cmdBufferObject.device == framebufferObject.device)
4596
Jesse Halld8bade02015-11-24 10:24:18 -08004597 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004598}
4599
4600cmd void vkCmdNextSubpass(
4601 VkCmdBuffer cmdBuffer,
4602 VkRenderPassContents contents) {
4603 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4604}
4605
4606@threadSafety("app")
4607cmd void vkCmdEndRenderPass(
4608 VkCmdBuffer cmdBuffer) {
4609 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4610
Jesse Halld8bade02015-11-24 10:24:18 -08004611 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004612}
4613
4614cmd void vkCmdExecuteCommands(
4615 VkCmdBuffer cmdBuffer,
4616 u32 cmdBuffersCount,
4617 const VkCmdBuffer* pCmdBuffers) {
4618 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4619
4620 cmdBuffers := pCmdBuffers[0:cmdBuffersCount]
4621 for i in (0 .. cmdBuffersCount) {
4622 secondaryCmdBuffer := cmdBuffers[i]
4623 secondaryCmdBufferObject := GetCmdBuffer(secondaryCmdBuffer)
4624 assert(cmdBufferObject.device == secondaryCmdBufferObject.device)
4625 }
4626}
4627
Jesse Hall1356b0d2015-11-23 17:24:58 -08004628@extension("VK_EXT_KHR_surface")
4629cmd void vkDestroySurfaceKHR(
4630 VkInstance instance,
4631 VkSurfaceKHR surface) {
4632 instanceObject := GetInstance(instance)
4633 surfaceObject := GetSurface(surface)
4634 assert(surfaceObject.instance == instance)
Michael Lentine88594d72015-11-12 12:49:45 -08004635
Jesse Hall1356b0d2015-11-23 17:24:58 -08004636 State.Surfaces[surface] = null
Jesse Hall2818f932015-11-19 21:19:17 -08004637}
4638
Jesse Hall1356b0d2015-11-23 17:24:58 -08004639@extension("VK_EXT_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004640cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004641 VkPhysicalDevice physicalDevice,
4642 u32 queueFamilyIndex,
4643 VkSurfaceKHR surface) {
4644 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4645
4646 //supported := ?
4647
4648 return ?//supported
4649}
4650
4651@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004652cmd VkResult vkGetSurfacePropertiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004653 VkDevice device,
4654 VkSurfaceKHR surface,
4655 VkSurfacePropertiesKHR* pSurfaceProperties) {
Michael Lentine88594d72015-11-12 12:49:45 -08004656 deviceObject := GetDevice(device)
4657
4658 surfaceProperties := ?
4659 pSurfaceProperties[0] = surfaceProperties
4660
4661 return ?
4662}
4663
Jesse Hall1356b0d2015-11-23 17:24:58 -08004664@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004665cmd VkResult vkGetSurfaceFormatsKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004666 VkDevice device,
4667 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004668 u32* pSurfaceFormatCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004669 VkSurfaceFormatKHR* pSurfaceFormats) {
Michael Lentine88594d72015-11-12 12:49:45 -08004670 deviceObject := GetDevice(device)
4671
4672 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004673 pSurfaceFormatCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004674 surfaceFormats := pSurfaceFormats[0:count]
4675
4676 for i in (0 .. count) {
4677 surfaceFormat := ?
4678 surfaceFormats[i] = surfaceFormat
4679 }
4680
4681 return ?
4682}
4683
Jesse Hall1356b0d2015-11-23 17:24:58 -08004684@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004685cmd VkResult vkGetSurfacePresentModesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004686 VkDevice device,
4687 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004688 u32* pPresentModeCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004689 VkPresentModeKHR* pPresentModes) {
Michael Lentine88594d72015-11-12 12:49:45 -08004690 deviceObject := GetDevice(device)
4691
4692 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004693 pPresentModeCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004694 presentModes := pPresentModes[0:count]
4695
4696 for i in (0 .. count) {
4697 presentMode := ?
4698 presentModes[i] = presentMode
4699 }
4700
4701 return ?
4702}
4703
Jesse Hall1356b0d2015-11-23 17:24:58 -08004704@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004705cmd VkResult vkCreateSwapchainKHR(
4706 VkDevice device,
4707 const VkSwapchainCreateInfoKHR* pCreateInfo,
4708 VkSwapchainKHR* pSwapchain) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004709 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
Michael Lentine88594d72015-11-12 12:49:45 -08004710 deviceObject := GetDevice(device)
4711
4712 swapchain := ?
4713 pSwapchain[0] = swapchain
4714 State.Swapchains[swapchain] = new!SwapchainObject(device: device)
4715
4716 return ?
4717}
4718
Jesse Hall1356b0d2015-11-23 17:24:58 -08004719@extension("VK_EXT_KHR_swapchain")
4720cmd void vkDestroySwapchainKHR(
Michael Lentine88594d72015-11-12 12:49:45 -08004721 VkDevice device,
4722 VkSwapchainKHR swapchain) {
4723 deviceObject := GetDevice(device)
4724 swapchainObject := GetSwapchain(swapchain)
4725 assert(swapchainObject.device == device)
4726
4727 State.Swapchains[swapchain] = null
Michael Lentine88594d72015-11-12 12:49:45 -08004728}
4729
Jesse Hall1356b0d2015-11-23 17:24:58 -08004730@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004731cmd VkResult vkGetSwapchainImagesKHR(
4732 VkDevice device,
4733 VkSwapchainKHR swapchain,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004734 u32* pSwapchainImageCount,
Michael Lentine88594d72015-11-12 12:49:45 -08004735 VkImage* pSwapchainImages) {
4736 deviceObject := GetDevice(device)
4737
4738 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004739 pSwapchainImageCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004740 swapchainImages := pSwapchainImages[0:count]
4741
4742 for i in (0 .. count) {
4743 swapchainImage := ?
4744 swapchainImages[i] = swapchainImage
Jesse Hall1356b0d2015-11-23 17:24:58 -08004745 State.Images[swapchainImage] = new!ImageObject(device: device)
Michael Lentine88594d72015-11-12 12:49:45 -08004746 }
4747
4748 return ?
4749}
4750
Jesse Hall1356b0d2015-11-23 17:24:58 -08004751@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004752cmd VkResult vkAcquireNextImageKHR(
4753 VkDevice device,
4754 VkSwapchainKHR swapchain,
4755 u64 timeout,
4756 VkSemaphore semaphore,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004757 VkFence fence,
Michael Lentine88594d72015-11-12 12:49:45 -08004758 u32* pImageIndex) {
4759 deviceObject := GetDevice(device)
4760 swapchainObject := GetSwapchain(swapchain)
4761
4762 imageIndex := ?
4763 pImageIndex[0] = imageIndex
4764
4765 return ?
4766}
4767
Jesse Hall1356b0d2015-11-23 17:24:58 -08004768@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004769cmd VkResult vkQueuePresentKHR(
4770 VkQueue queue,
4771 VkPresentInfoKHR* pPresentInfo) {
4772 queueObject := GetQueue(queue)
4773
4774 presentInfo := ?
4775 pPresentInfo[0] = presentInfo
4776
4777 return ?
4778}
4779
Jesse Hall1356b0d2015-11-23 17:24:58 -08004780@extension("VK_EXT_KHR_display")
4781cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
4782 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004783 u32* pPropertyCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004784 VkDisplayPropertiesKHR* pProperties) {
4785 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4786 return ?
4787}
4788
4789@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004790cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
4791 VkPhysicalDevice physicalDevice,
4792 u32* pPropertyCount,
4793 VkDisplayPlanePropertiesKHR* pProperties) {
4794 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4795 return ?
4796}
4797
4798@extension("VK_EXT_KHR_display")
4799cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR(
4800 VkPhysicalDevice physicalDevice,
4801 u32* pPropertyCount,
4802 VkDisplayKHR* pProperties) {
4803 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4804 return ?
4805}
4806
4807@extension("VK_EXT_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004808cmd VkResult vkGetDisplayModePropertiesKHR(
4809 VkPhysicalDevice physicalDevice,
4810 VkDisplayKHR display,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004811 u32* pPropertyCount,
4812 VkDisplayModePropertiesKHR* pProperties) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004813 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4814 return ?
4815}
4816
4817@extension("VK_EXT_KHR_display")
4818cmd VkResult vkCreateDisplayModeKHR(
4819 VkPhysicalDevice physicalDevice,
4820 VkDisplayKHR display,
4821 const VkDisplayModeCreateInfoKHR* pCreateInfo,
4822 VkDisplayModeKHR* pMode) {
4823 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4824 return ?
4825}
4826
4827@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004828cmd VkResult vkGetDisplayPlaneCapabilitiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004829 VkPhysicalDevice physicalDevice,
Jesse Halla6429252015-11-29 18:59:42 -08004830 VkDisplayModeCreateInfoKHR mode,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004831 u32 planeIndex,
Jesse Halla6429252015-11-29 18:59:42 -08004832 VkDisplayPlaneCapabilitiesKHR* pCapabilities) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004833 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4834 return ?
4835}
4836
Jesse Halla6429252015-11-29 18:59:42 -08004837@extension("VK_EXT_KHR_display")
4838cmd VkResult vkCreateDisplayPlaneSurfaceKHR(
4839 VkInstance instance,
4840 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
4841 VkSurfaceKHR* pSurface) {
4842 return ?
4843}
4844
4845@extension("VK_EXT_KHR_xlib_surface")
4846cmd VkResult vkCreateXlibSurfaceKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004847 VkInstance instance,
4848 platform.Display* dpy,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004849 platform.Window window,
4850 VkSurfaceKHR* pSurface) {
4851 instanceObject := GetInstance(instance)
4852 return ?
4853}
4854
Jesse Halla6429252015-11-29 18:59:42 -08004855@extension("VK_EXT_KHR_xlib_surface")
4856cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
4857 VkPhysicalDevice physicalDevice,
4858 u32 queueFamilyIndex,
4859 platform.Display* dpy,
4860 platform.VisualID visualId) {
4861 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4862 return ?
4863}
4864
Jesse Hall1356b0d2015-11-23 17:24:58 -08004865@extension("VK_EXT_KHR_xcb_surface")
4866cmd VkResult vkCreateXCBSurfaceKHR(
4867 VkInstance instance,
4868 platform.xcb_connection_t* connection,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004869 platform.xcb_window_t window,
4870 VkSurfaceKHR* pSurface) {
4871 instanceObject := GetInstance(instance)
4872 return ?
4873}
4874
Jesse Halla6429252015-11-29 18:59:42 -08004875@extension("VK_EXT_KHR_xlib_surface")
4876cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
4877 VkPhysicalDevice physicalDevice,
4878 u32 queueFamilyIndex,
4879 platform.xcb_connection_t* connection,
4880 platform.xcb_visualid_t visual_id) {
4881 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4882 return ?
4883}
4884
Jesse Hall1356b0d2015-11-23 17:24:58 -08004885@extension("VK_EXT_KHR_wayland_surface")
4886cmd VkResult vkCreateWaylandSurfaceKHR(
4887 VkInstance instance,
4888 platform.wl_display* display,
4889 platform.wl_surface* surface,
4890 VkSurfaceKHR* pSurface) {
4891 instanceObject := GetInstance(instance)
4892 return ?
4893}
4894
Jesse Halla6429252015-11-29 18:59:42 -08004895@extension("VK_EXT_KHR_wayland_surface")
4896cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
4897 VkPhysicalDevice physicalDevice,
4898 u32 queueFamilyIndex,
4899 platform.wl_display* display) {
4900 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4901 return ?
4902}
4903
Jesse Hall1356b0d2015-11-23 17:24:58 -08004904@extension("VK_EXT_KHR_mir_surface")
4905cmd VkResult vkCreateMirSurfaceKHR(
4906 VkInstance instance,
4907 platform.MirConnection* connection,
4908 platform.MirSurface* mirSurface,
4909 VkSurfaceKHR* pSurface) {
4910 instanceObject := GetInstance(instance)
4911 return ?
4912}
4913
Jesse Halla6429252015-11-29 18:59:42 -08004914@extension("VK_EXT_KHR_mir_surface")
4915cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR(
4916 VkPhysicalDevice physicalDevice,
4917 u32 queueFamilyIndex,
4918 platform.MirConnection* connection) {
4919 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4920 return ?
4921}
4922
Jesse Hall1356b0d2015-11-23 17:24:58 -08004923@extension("VK_EXT_KHR_android_surface")
4924cmd VkResult vkCreateAndroidSurfaceKHR(
4925 VkInstance instance,
4926 platform.ANativeWindow* window
4927 VkSurfaceKHR* pSurface) {
4928 instanceObject := GetInstance(instance)
4929 return ?
4930}
4931
4932@extension("VK_EXT_KHR_win32_surface")
4933cmd VkResult vkCreateWin32SurfaceKHR(
4934 VkInstance instance,
4935 platform.HINSTANCE hinstance,
4936 platform.HWND hwnd,
4937 VkSurfaceKHR* pSurface) {
4938 instanceObject := GetInstance(instance)
4939 return ?
4940}
4941
Jesse Halla6429252015-11-29 18:59:42 -08004942@extension("VK_EXT_KHR_win32_surface")
4943cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR(
4944 VkPhysicalDevice physicalDevice,
4945 u32 queueFamilyIndex) {
4946 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4947 return ?
4948}
4949
Jesse Halld27f6aa2015-08-15 17:58:48 -07004950
4951////////////////
4952// Validation //
4953////////////////
4954
4955extern void validate(string layerName, bool condition, string message)
4956
4957
4958/////////////////////////////
4959// Internal State Tracking //
4960/////////////////////////////
4961
4962StateObject State
4963
4964@internal class StateObject {
4965 // Dispatchable objects.
4966 map!(VkInstance, ref!InstanceObject) Instances
4967 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4968 map!(VkDevice, ref!DeviceObject) Devices
4969 map!(VkQueue, ref!QueueObject) Queues
4970 map!(VkCmdBuffer, ref!CmdBufferObject) CmdBuffers
4971
4972 // Non-dispatchable objects.
4973 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4974 map!(VkBuffer, ref!BufferObject) Buffers
4975 map!(VkBufferView, ref!BufferViewObject) BufferViews
4976 map!(VkImage, ref!ImageObject) Images
4977 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004978 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
4979 map!(VkShader, ref!ShaderObject) Shaders
4980 map!(VkPipeline, ref!PipelineObject) Pipelines
4981 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4982 map!(VkSampler, ref!SamplerObject) Samplers
4983 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4984 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4985 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004986 map!(VkFence, ref!FenceObject) Fences
4987 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4988 map!(VkEvent, ref!EventObject) Events
4989 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4990 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4991 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4992 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
4993 map!(VkCmdPool, ref!CmdPoolObject) CmdPools
Jesse Hall1356b0d2015-11-23 17:24:58 -08004994 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces
Michael Lentine88594d72015-11-12 12:49:45 -08004995 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains
Jesse Halld27f6aa2015-08-15 17:58:48 -07004996}
4997
4998@internal class InstanceObject {
4999}
5000
5001@internal class PhysicalDeviceObject {
5002 VkInstance instance
5003}
5004
5005@internal class DeviceObject {
5006 VkPhysicalDevice physicalDevice
5007}
5008
5009@internal class QueueObject {
5010 VkDevice device
5011 VkQueueFlags flags
5012}
5013
5014@internal class CmdBufferObject {
5015 VkDevice device
5016 map!(u64, VkDeviceMemory) boundObjects
5017 VkQueueFlags queueFlags
5018}
5019
5020@internal class DeviceMemoryObject {
5021 VkDevice device
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005022 VkDeviceSize allocationSize
5023 map!(u64, VkDeviceSize ) boundObjects
Jesse Halld27f6aa2015-08-15 17:58:48 -07005024 map!(VkCmdBuffer, VkCmdBuffer) boundCommandBuffers
5025}
5026
5027@internal class BufferObject {
5028 VkDevice device
5029 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005030 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005031}
5032
5033@internal class BufferViewObject {
5034 VkDevice device
5035 VkBuffer buffer
5036}
5037
5038@internal class ImageObject {
5039 VkDevice device
5040 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005041 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005042}
5043
5044@internal class ImageViewObject {
5045 VkDevice device
5046 VkImage image
5047}
5048
Jesse Halld27f6aa2015-08-15 17:58:48 -07005049@internal class ShaderObject {
5050 VkDevice device
5051}
5052
5053@internal class ShaderModuleObject {
5054 VkDevice device
5055}
5056
5057@internal class PipelineObject {
5058 VkDevice device
5059}
5060
5061@internal class PipelineLayoutObject {
5062 VkDevice device
5063}
5064
5065@internal class SamplerObject {
5066 VkDevice device
5067}
5068
5069@internal class DescriptorSetObject {
5070 VkDevice device
5071}
5072
5073@internal class DescriptorSetLayoutObject {
5074 VkDevice device
5075}
5076
5077@internal class DescriptorPoolObject {
5078 VkDevice device
5079}
5080
Jesse Halld27f6aa2015-08-15 17:58:48 -07005081@internal class FenceObject {
5082 VkDevice device
5083 bool signaled
5084}
5085
5086@internal class SemaphoreObject {
5087 VkDevice device
5088}
5089
5090@internal class EventObject {
5091 VkDevice device
5092}
5093
5094@internal class QueryPoolObject {
5095 VkDevice device
5096}
5097
5098@internal class FramebufferObject {
5099 VkDevice device
5100}
5101
5102@internal class RenderPassObject {
5103 VkDevice device
5104}
5105
5106@internal class PipelineCacheObject {
5107 VkDevice device
5108}
5109
5110@internal class CmdPoolObject {
5111 VkDevice device
5112}
5113
Jesse Hall1356b0d2015-11-23 17:24:58 -08005114@internal class SurfaceObject {
5115 VkInstance instance
5116}
5117
Michael Lentine88594d72015-11-12 12:49:45 -08005118@internal class SwapchainObject {
5119 VkDevice device
5120}
5121
Jesse Halld27f6aa2015-08-15 17:58:48 -07005122macro ref!InstanceObject GetInstance(VkInstance instance) {
5123 assert(instance in State.Instances)
5124 return State.Instances[instance]
5125}
5126
5127macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
5128 assert(physicalDevice in State.PhysicalDevices)
5129 return State.PhysicalDevices[physicalDevice]
5130}
5131
5132macro ref!DeviceObject GetDevice(VkDevice device) {
5133 assert(device in State.Devices)
5134 return State.Devices[device]
5135}
5136
5137macro ref!QueueObject GetQueue(VkQueue queue) {
5138 assert(queue in State.Queues)
5139 return State.Queues[queue]
5140}
5141
5142macro ref!CmdBufferObject GetCmdBuffer(VkCmdBuffer cmdBuffer) {
5143 assert(cmdBuffer in State.CmdBuffers)
5144 return State.CmdBuffers[cmdBuffer]
5145}
5146
5147macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory mem) {
5148 assert(mem in State.DeviceMemories)
5149 return State.DeviceMemories[mem]
5150}
5151
5152macro ref!BufferObject GetBuffer(VkBuffer buffer) {
5153 assert(buffer in State.Buffers)
5154 return State.Buffers[buffer]
5155}
5156
5157macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
5158 assert(bufferView in State.BufferViews)
5159 return State.BufferViews[bufferView]
5160}
5161
5162macro ref!ImageObject GetImage(VkImage image) {
5163 assert(image in State.Images)
5164 return State.Images[image]
5165}
5166
5167macro ref!ImageViewObject GetImageView(VkImageView imageView) {
5168 assert(imageView in State.ImageViews)
5169 return State.ImageViews[imageView]
5170}
5171
Jesse Halld27f6aa2015-08-15 17:58:48 -07005172macro ref!ShaderObject GetShader(VkShader shader) {
5173 assert(shader in State.Shaders)
5174 return State.Shaders[shader]
5175}
5176
5177macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
5178 assert(shaderModule in State.ShaderModules)
5179 return State.ShaderModules[shaderModule]
5180}
5181
5182macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
5183 assert(pipeline in State.Pipelines)
5184 return State.Pipelines[pipeline]
5185}
5186
5187macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
5188 assert(pipelineLayout in State.PipelineLayouts)
5189 return State.PipelineLayouts[pipelineLayout]
5190}
5191
5192macro ref!SamplerObject GetSampler(VkSampler sampler) {
5193 assert(sampler in State.Samplers)
5194 return State.Samplers[sampler]
5195}
5196
5197macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
5198 assert(descriptorSet in State.DescriptorSets)
5199 return State.DescriptorSets[descriptorSet]
5200}
5201
5202macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
5203 assert(descriptorSetLayout in State.DescriptorSetLayouts)
5204 return State.DescriptorSetLayouts[descriptorSetLayout]
5205}
5206
5207macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
5208 assert(descriptorPool in State.DescriptorPools)
5209 return State.DescriptorPools[descriptorPool]
5210}
5211
Jesse Halld27f6aa2015-08-15 17:58:48 -07005212macro ref!FenceObject GetFence(VkFence fence) {
5213 assert(fence in State.Fences)
5214 return State.Fences[fence]
5215}
5216
5217macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
5218 assert(semaphore in State.Semaphores)
5219 return State.Semaphores[semaphore]
5220}
5221
5222macro ref!EventObject GetEvent(VkEvent event) {
5223 assert(event in State.Events)
5224 return State.Events[event]
5225}
5226
5227macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
5228 assert(queryPool in State.QueryPools)
5229 return State.QueryPools[queryPool]
5230}
5231
5232macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
5233 assert(framebuffer in State.Framebuffers)
5234 return State.Framebuffers[framebuffer]
5235}
5236
5237macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
5238 assert(renderPass in State.RenderPasses)
5239 return State.RenderPasses[renderPass]
5240}
5241
5242macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
5243 assert(pipelineCache in State.PipelineCaches)
5244 return State.PipelineCaches[pipelineCache]
5245}
5246
5247macro ref!CmdPoolObject GetCmdPool(VkCmdPool cmdPool) {
5248 assert(cmdPool in State.CmdPools)
5249 return State.CmdPools[cmdPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07005250}
Michael Lentine88594d72015-11-12 12:49:45 -08005251
Jesse Hall1356b0d2015-11-23 17:24:58 -08005252macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) {
5253 assert(surface in State.Surfaces)
5254 return State.Surfaces[surface]
5255}
5256
Michael Lentine88594d72015-11-12 12:49:45 -08005257macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) {
5258 assert(swapchain in State.Swapchains)
5259 return State.Swapchains[swapchain]
5260}
Jesse Halld8bade02015-11-24 10:24:18 -08005261
5262macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) {
5263 return as!VkQueueFlags(as!u32(flags) | as!u32(bit))
5264}