blob: bd3049c6f241d67f538115f8d6a8e9dffc386858 [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 Hallb00daad2015-11-29 19:46:20 -080030define VERSION_MINOR 193
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
Jesse Hallb00daad2015-11-29 19:46:20 -0800729 VK_QUEUE_SPARSE_BINDING_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
Jesse Hallb00daad2015-11-29 19:46:20 -0800843/// Image view creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800844type VkFlags VkImageViewCreateFlags
Jesse Hallb00daad2015-11-29 19:46:20 -0800845//bitfield VkImageViewCreateFlagBits {
846//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700847
848/// Pipeline creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800849type VkFlags VkPipelineCreateFlags
850bitfield VkPipelineCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700851 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
852 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
853 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
854}
855
856/// Channel flags
Jesse Halld8bade02015-11-24 10:24:18 -0800857type VkFlags VkChannelFlags
858bitfield VkChannelFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700859 VK_CHANNEL_R_BIT = 0x00000001,
860 VK_CHANNEL_G_BIT = 0x00000002,
861 VK_CHANNEL_B_BIT = 0x00000004,
862 VK_CHANNEL_A_BIT = 0x00000008,
863}
864
865/// Fence creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800866type VkFlags VkFenceCreateFlags
867bitfield VkFenceCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700868 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
869}
870
871/// Semaphore creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800872type VkFlags VkSemaphoreCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800873//bitfield VkSemaphoreCreateFlagBits {
874//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700875
876/// Format capability flags
Jesse Halld8bade02015-11-24 10:24:18 -0800877type VkFlags VkFormatFeatureFlags
878bitfield VkFormatFeatureFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700879 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
880 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type)
881 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images
882 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs)
883 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs)
884 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers
885 VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs)
886 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images
887 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images
888 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700889 VK_FORMAT_FEATURE_BLIT_SOURCE_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCmdBlitImage
890 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 -0700891}
892
893/// Query control flags
Jesse Halld8bade02015-11-24 10:24:18 -0800894type VkFlags VkQueryControlFlags
895bitfield VkQueryControlFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700896 VK_QUERY_CONTROL_CONSERVATIVE_BIT = 0x00000001, /// Allow conservative results to be collected by the query
897}
898
899/// Query result flags
Jesse Halld8bade02015-11-24 10:24:18 -0800900type VkFlags VkQueryResultFlags
901bitfield VkQueryResultFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700902 VK_QUERY_RESULT_DEFAULT = 0x00000000, /// Results of the queries are immediately written to the destination buffer as 32-bit values
903 VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values
904 VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy
905 VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written
906 VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available
907}
908
909/// Shader module creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800910type VkFlags VkShaderModuleCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800911//bitfield VkShaderModuleCreateFlagBits {
912//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700913
914/// Shader creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800915type VkFlags VkShaderCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800916//bitfield VkShaderCreateFlagBits {
917//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700918
919/// Event creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800920type VkFlags VkEventCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800921//bitfield VkEventCreateFlagBits {
922//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700923
Jesse Halla15a4bf2015-11-19 22:48:02 -0800924/// Command buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800925type VkFlags VkCmdBufferUsageFlags
926bitfield VkCmdBufferUsageFlagBits {
Jesse Halla15a4bf2015-11-19 22:48:02 -0800927 VK_CMD_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
928 VK_CMD_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
929 VK_CMD_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700930}
931
932/// Pipeline statistics flags
Jesse Halld8bade02015-11-24 10:24:18 -0800933type VkFlags VkQueryPipelineStatisticFlags
934bitfield VkQueryPipelineStatisticFlagBits {
Jesse Hallae38f732015-11-19 21:32:50 -0800935 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, /// Optional
936 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, /// Optional
937 VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, /// Optional
938 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, /// Optional
939 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, /// Optional
940 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, /// Optional
941 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, /// Optional
942 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, /// Optional
943 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, /// Optional
944 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, /// Optional
945 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, /// Optional
Jesse Halld27f6aa2015-08-15 17:58:48 -0700946}
947
948/// Memory mapping flags
Jesse Halld8bade02015-11-24 10:24:18 -0800949type VkFlags VkMemoryMapFlags
Jesse Halla6429252015-11-29 18:59:42 -0800950//bitfield VkMemoryMapFlagBits {
951//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700952
953/// Bitfield of image aspects
Jesse Halld8bade02015-11-24 10:24:18 -0800954type VkFlags VkImageAspectFlags
955bitfield VkImageAspectFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700956 VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
957 VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
958 VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
959 VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
960}
961
962/// Sparse memory bind flags
Jesse Halld8bade02015-11-24 10:24:18 -0800963type VkFlags VkSparseMemoryBindFlags
964bitfield VkSparseMemoryBindFlagBits {
Jesse Halla9bb62b2015-11-21 19:31:56 -0800965 VK_SPARSE_MEMORY_BIND_REPLICATE_BLOCK_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700966}
967
968/// Sparse image memory requirements flags
Jesse Halld8bade02015-11-24 10:24:18 -0800969type VkFlags VkSparseImageFormatFlags
970bitfield VkSparseImageFormatFlagBits {
Jesse Hallb00daad2015-11-29 19:46:20 -0800971 VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices
972 VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002, /// Image requires mip levels to be an exact multiple of the sparse iamge block size for non-mip-tail levels.
973 VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size
Jesse Halld27f6aa2015-08-15 17:58:48 -0700974}
975
976/// Pipeline stages
Jesse Halld8bade02015-11-24 10:24:18 -0800977type VkFlags VkPipelineStageFlags
978bitfield VkPipelineStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700979 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed
980 VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch
981 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch
982 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading
Jesse Hallae38f732015-11-19 21:32:50 -0800983 VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading
984 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading
Jesse Halld27f6aa2015-08-15 17:58:48 -0700985 VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading
986 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading
987 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests
988 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests
989 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes
990 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading
991 VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700992 VK_PIPELINE_STAGE_HOST_BIT = 0x00002000, /// Indicates host (CPU) is a source/sink of the dependency
Jesse Halld27f6aa2015-08-15 17:58:48 -0700993
994 VK_PIPELINE_STAGE_ALL_GRAPHICS = 0x000007FF, /// All stages of the graphics pipeline
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700995 VK_PIPELINE_STAGE_ALL_GPU_COMMANDS = 0x00001FFF, /// All graphics, compute, copy, and transition commands
996}
997
998/// Render pass attachment description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800999type VkFlags VkAttachmentDescriptionFlags
1000bitfield VkAttachmentDescriptionFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001001 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 -07001002}
1003
1004/// Subpass description flags
Jesse Halld8bade02015-11-24 10:24:18 -08001005type VkFlags VkSubpassDescriptionFlags
1006bitfield VkSubpassDescriptionFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001007}
1008
1009/// Command pool creation flags
Jesse Halld8bade02015-11-24 10:24:18 -08001010type VkFlags VkCmdPoolCreateFlags
1011bitfield VkCmdPoolCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001012 VK_CMD_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime
1013 VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually
1014}
1015
1016/// Command pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -08001017type VkFlags VkCmdPoolResetFlags
1018bitfield VkCmdPoolResetFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001019 VK_CMD_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool
Jesse Halld27f6aa2015-08-15 17:58:48 -07001020}
1021
Jesse Halld8bade02015-11-24 10:24:18 -08001022type VkFlags VkCmdBufferResetFlags
1023bitfield VkCmdBufferResetFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001024 VK_CMD_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer
1025}
1026
Jesse Halld8bade02015-11-24 10:24:18 -08001027type VkFlags VkSampleCountFlags
1028bitfield VkSampleCountFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001029 VK_SAMPLE_COUNT_1_BIT = 0x00000001,
1030 VK_SAMPLE_COUNT_2_BIT = 0x00000002,
1031 VK_SAMPLE_COUNT_4_BIT = 0x00000004,
1032 VK_SAMPLE_COUNT_8_BIT = 0x00000008,
1033 VK_SAMPLE_COUNT_16_BIT = 0x00000010,
1034 VK_SAMPLE_COUNT_32_BIT = 0x00000020,
1035 VK_SAMPLE_COUNT_64_BIT = 0x00000040,
1036}
1037
Jesse Halld8bade02015-11-24 10:24:18 -08001038type VkFlags VkStencilFaceFlags
1039bitfield VkStencilFaceFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001040 VK_STENCIL_FACE_NONE = 0x00000000, /// No faces
1041 VK_STENCIL_FACE_FRONT_BIT = 0x00000001, /// Front face
1042 VK_STENCIL_FACE_BACK_BIT = 0x00000002, /// Back face
Jesse Halld27f6aa2015-08-15 17:58:48 -07001043}
1044
Jesse Halla6429252015-11-29 18:59:42 -08001045/// Instance creation flags
1046type VkFlags VkInstanceCreateFlags
1047//bitfield VkInstanceCreateFlagBits {
1048//}
1049
1050/// Device creation flags
1051type VkFlags VkDeviceCreateFlags
1052//bitfield VkDeviceCreateFlagBits {
1053//}
1054
1055/// Device queue creation flags
1056type VkFlags VkDeviceQueueCreateFlags
1057//bitfield VkDeviceQueueCreateFlagBits {
1058//}
1059
1060/// Query pool creation flags
1061type VkFlags VkQueryPoolCreateFlags
1062//bitfield VkQueryPoolCreateFlagBits {
1063//}
1064
1065/// Buffer view creation flags
1066type VkFlags VkBufferViewCreateFlags
1067//bitfield VkBufferViewCreateFlagBits {
1068//}
1069
1070/// Pipeline cache creation flags
1071type VkFlags VkPipelineCacheCreateFlags
1072//bitfield VkPipelineCacheCreateFlagBits {
1073//}
1074
1075/// Pipeline shader stage creation flags
1076type VkFlags VkPipelineShaderStageCreateFlags
1077//bitfield VkPipelineShaderStageCreateFlagBits {
1078//}
1079
1080/// Descriptor set layout creation flags
1081type VkFlags VkDescriptorSetLayoutCreateFlags
1082//bitfield VkDescriptorSetLayoutCreateFlagBits {
1083//}
1084
1085/// Pipeline vertex input state creation flags
1086type VkFlags VkPipelineVertexInputStateCreateFlags
1087//bitfield VkPipelineVertexInputStateCreateFlagBits {
1088//}
1089
1090/// Pipeline input assembly state creation flags
1091type VkFlags VkPipelineInputAssemblyStateCreateFlags
1092//bitfield VkPipelineInputAssemblyStateCreateFlagBits {
1093//}
1094
1095/// Tessellation state creation flags
1096type VkFlags VkPipelineTessellationStateCreateFlags
1097//bitfield VkPipelineTessellationStateCreateFlagBits {
1098//}
1099
1100/// Viewport state creation flags
1101type VkFlags VkPipelineViewportStateCreateFlags
1102//bitfield VkPipelineViewportStateCreateFlagBits {
1103//}
1104
1105/// Raster state creation flags
1106type VkFlags VkPipelineRasterStateCreateFlags
1107//bitfield VkPipelineRasterStateCreateFlagBits {
1108//}
1109
1110/// Multisample state creation flags
1111type VkFlags VkPipelineMultisampleStateCreateFlags
1112//bitfield VkPipelineMultisampleStateCreateFlagBits {
1113//}
1114
1115/// Color blend state creation flags
1116type VkFlags VkPipelineColorBlendStateCreateFlags
1117//bitfield VkPipelineColorBlendStateCreateFlagBits {
1118//}
1119
1120/// Depth/stencil state creation flags
1121type VkFlags VkPipelineDepthStencilStateCreateFlags
1122//bitfield VkPipelineDepthStencilStateCreateFlagBits {
1123//}
1124
1125/// Dynamic state creation flags
1126type VkFlags VkPipelineDynamicStateCreateFlags
1127//bitfield VkPipelineDynamicStateCreateFlagBits {
1128//}
1129
1130/// Pipeline layout creation flags
1131type VkFlags VkPipelineLayoutCreateFlags
1132//bitfield VkPipelineLayoutCreateFlagBits {
1133//}
1134
1135/// Sampler creation flags
1136type VkFlags VkSamplerCreateFlags
1137//bitfield VkSamplerCreateFlagBits {
1138//}
1139
1140/// Render pass creation flags
1141type VkFlags VkRenderPassCreateFlags
1142//bitfield VkRenderPassCreateFlagBits {
1143//}
1144
1145/// Framebuffer creation flags
1146type VkFlags VkFramebufferCreateFlags
1147//bitfield VkFramebufferCreateFlagBits {
1148//}
1149
Jesse Halldc6d36c2015-11-29 19:12:15 -08001150/// Dependency flags
1151type VkFlags VkDependencyFlags
1152bitfield VkDependencyFlagBits {
1153 VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
1154}
1155
Michael Lentine88594d72015-11-12 12:49:45 -08001156@extension("VK_EXT_KHR_swapchain")
Jesse Halld8bade02015-11-24 10:24:18 -08001157type VkFlags VkSurfaceTransformFlagsKHR
1158@extension("VK_EXT_KHR_swapchain")
1159bitfield VkSurfaceTransformFlagBitsKHR {
Michael Lentine88594d72015-11-12 12:49:45 -08001160 VK_SURFACE_TRANSFORM_NONE_BIT_KHR = 0x00000001,
1161 VK_SURFACE_TRANSFORM_ROT90_BIT_KHR = 0x00000002,
1162 VK_SURFACE_TRANSFORM_ROT180_BIT_KHR = 0x00000004,
1163 VK_SURFACE_TRANSFORM_ROT270_BIT_KHR = 0x00000008,
1164 VK_SURFACE_TRANSFORM_HMIRROR_BIT_KHR = 0x00000010,
1165 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_BIT_KHR = 0x00000020,
1166 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_BIT_KHR = 0x00000040,
1167 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_BIT_KHR = 0x00000080,
1168 VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
1169}
Jesse Halld27f6aa2015-08-15 17:58:48 -07001170
Jesse Halla6429252015-11-29 18:59:42 -08001171@extension("VK_EXT_KHR_swapchain")
1172type VkFlags VkCompositeAlphaFlagsKHR
1173@extension("VK_EXT_KHR_swapchain")
1174bitfield VkCompositeAlphaFlagBitsKHR {
1175 VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
1176 VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
1177 VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
1178 VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
1179}
1180
Jesse Hall1356b0d2015-11-23 17:24:58 -08001181@extension("VK_EXT_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001182type VkFlags VkDisplayPlaneAlphaFlagsKHR
1183@extension("VK_EXT_KHR_display")
1184bitfield VkDisplayPlaneAlphaFlagBitsKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08001185 VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000001,
1186 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000002,
1187 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000004,
1188}
1189
1190
Jesse Halld27f6aa2015-08-15 17:58:48 -07001191//////////////////
1192// Structures //
1193//////////////////
1194
1195class VkOffset2D {
1196 s32 x
1197 s32 y
1198}
1199
1200class VkOffset3D {
1201 s32 x
1202 s32 y
1203 s32 z
1204}
1205
1206class VkExtent2D {
1207 s32 width
1208 s32 height
1209}
1210
1211class VkExtent3D {
1212 s32 width
1213 s32 height
1214 s32 depth
1215}
1216
1217class VkViewport {
1218 f32 originX
1219 f32 originY
1220 f32 width
1221 f32 height
1222 f32 minDepth
1223 f32 maxDepth
1224}
1225
1226class VkRect2D {
1227 VkOffset2D offset
1228 VkExtent2D extent
1229}
1230
Jesse Halla15a4bf2015-11-19 22:48:02 -08001231class VkClearRect {
1232 VkRect2D rect
1233 u32 baseArrayLayer
1234 u32 numLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001235}
1236
1237class VkChannelMapping {
1238 VkChannelSwizzle r
1239 VkChannelSwizzle g
1240 VkChannelSwizzle b
1241 VkChannelSwizzle a
1242}
1243
1244class VkPhysicalDeviceProperties {
1245 u32 apiVersion
1246 u32 driverVersion
1247 u32 vendorId
1248 u32 deviceId
1249 VkPhysicalDeviceType deviceType
1250 char[VK_MAX_PHYSICAL_DEVICE_NAME] deviceName
1251 u8[VK_UUID_LENGTH] pipelineCacheUUID
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001252 VkPhysicalDeviceLimits limits
1253 VkPhysicalDeviceSparseProperties sparseProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001254}
1255
1256class VkExtensionProperties {
1257 char[VK_MAX_EXTENSION_NAME] extName /// extension name
1258 u32 specVersion /// version of the extension specification implemented
1259}
1260
1261class VkLayerProperties {
1262 char[VK_MAX_EXTENSION_NAME] layerName /// layer name
1263 u32 specVersion /// version of the layer specification implemented
1264 u32 implVersion /// build or release version of the layer's library
Jesse Hallf09c6b12015-08-15 19:54:28 -07001265 char[VK_MAX_DESCRIPTION] description /// Free-form description of the layer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001266}
1267
Jesse Halla366a512015-11-19 22:30:07 -08001268class VkSubmitInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001269 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_SUBMIT_INFO
1270 const void* pNext /// Next structure in chain
1271 u32 waitSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001272 const VkSemaphore* pWaitSemaphores
Jesse Hall03b6fe12015-11-24 12:44:21 -08001273 u32 commandBufferCount
Jesse Halla366a512015-11-19 22:30:07 -08001274 const VkCmdBuffer* pCommandBuffers
Jesse Hall03b6fe12015-11-24 12:44:21 -08001275 u32 signalSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001276 const VkSemaphore* pSignalSemaphores
1277}
1278
Jesse Halld27f6aa2015-08-15 17:58:48 -07001279class VkApplicationInfo {
1280 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO
1281 const void* pNext /// Next structure in chain
1282 const char* pAppName
1283 u32 appVersion
1284 const char* pEngineName
1285 u32 engineVersion
1286 u32 apiVersion
1287}
1288
1289class VkAllocCallbacks {
1290 void* pUserData
1291 PFN_vkAllocFunction pfnAlloc
Jesse Hall03b6fe12015-11-24 12:44:21 -08001292 PFN_vkReallocFunction pfnRealloc
Jesse Halld27f6aa2015-08-15 17:58:48 -07001293 PFN_vkFreeFunction pfnFree
Jesse Hall03b6fe12015-11-24 12:44:21 -08001294 PFN_vkInternalAllocNotification pfnInternalAlloc
1295 PFN_vkInternalFreeNotification pfnInternalFree
Jesse Halld27f6aa2015-08-15 17:58:48 -07001296}
1297
1298class VkDeviceQueueCreateInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001299 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
1300 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001301 VkDeviceQueueCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001302 u32 queueFamilyIndex
Jesse Hall03b6fe12015-11-24 12:44:21 -08001303 u32 queuePriorityCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001304 const f32* pQueuePriorities
Jesse Halld27f6aa2015-08-15 17:58:48 -07001305}
1306
1307class VkDeviceCreateInfo {
1308 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
1309 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001310 VkDeviceCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001311 u32 requestedQueueRecordCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001312 const VkDeviceQueueCreateInfo* pRequestedQueues
Jesse Hall03b6fe12015-11-24 12:44:21 -08001313 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001314 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001315 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001316 const char* const* ppEnabledExtensionNames
1317 const VkPhysicalDeviceFeatures* pEnabledFeatures
Jesse Halld27f6aa2015-08-15 17:58:48 -07001318}
1319
1320class VkInstanceCreateInfo {
1321 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
1322 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001323 VkInstanceCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001324 const VkApplicationInfo* pAppInfo
Jesse Hall03b6fe12015-11-24 12:44:21 -08001325 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001326 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001327 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001328 const char* const* ppEnabledExtensionNames /// Extension names to be enabled
1329}
1330
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001331class VkQueueFamilyProperties {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001332 VkQueueFlags queueFlags /// Queue flags
1333 u32 queueCount
Jesse Hallacfa5342015-11-19 21:51:33 -08001334 u32 timestampValidBits
Jesse Halld27f6aa2015-08-15 17:58:48 -07001335}
1336
1337class VkPhysicalDeviceMemoryProperties {
1338 u32 memoryTypeCount
1339 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes
1340 u32 memoryHeapCount
1341 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps
1342}
1343
1344class VkMemoryAllocInfo {
1345 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO
1346 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001347 VkDeviceSize allocationSize /// Size of memory allocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001348 u32 memoryTypeIndex /// Index of the of the memory type to allocate from
1349}
1350
1351class VkMemoryRequirements {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001352 VkDeviceSize size /// Specified in bytes
1353 VkDeviceSize alignment /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001354 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object
1355}
1356
1357class VkSparseImageFormatProperties {
Jesse Halld8bade02015-11-24 10:24:18 -08001358 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001359 VkExtent3D imageGranularity
1360 VkSparseImageFormatFlags flags
1361}
1362
1363class VkSparseImageMemoryRequirements {
Jesse Hallb00daad2015-11-29 19:46:20 -08001364 VkSparseImageFormatProperties formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001365 u32 imageMipTailStartLOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001366 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment
1367 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment
1368 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07001369}
1370
1371class VkMemoryType {
1372 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type
1373 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from
1374}
1375
1376class VkMemoryHeap {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001377 VkDeviceSize size /// Available memory in the heap
Jesse Halld27f6aa2015-08-15 17:58:48 -07001378 VkMemoryHeapFlags flags /// Flags for the heap
1379}
1380
1381class VkMappedMemoryRange {
1382 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
1383 const void* pNext /// Pointer to next structure
1384 VkDeviceMemory mem /// Mapped memory object
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001385 VkDeviceSize offset /// Offset within the mapped memory the range starts from
1386 VkDeviceSize size /// Size of the range within the mapped memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07001387}
1388
1389class VkFormatProperties {
1390 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling
1391 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001392 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001393}
1394
1395class VkImageFormatProperties {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001396 VkExtent3D maxExtent /// max image dimensions for this resource type
1397 u32 maxMipLevels /// max number of mipmap levels for this resource type
Jesse Halla15a4bf2015-11-19 22:48:02 -08001398 u32 maxArrayLayers /// max array layers for this resource type
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001399 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type
1400 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type
1401}
1402
Jesse Halla15a4bf2015-11-19 22:48:02 -08001403class VkDescriptorImageInfo {
1404 VkSampler sampler
1405 VkImageView imageView
1406 VkImageLayout imageLayout
1407}
1408
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001409class VkDescriptorBufferInfo {
1410 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC]
1411 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set.
1412 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001413}
1414
Jesse Halld27f6aa2015-08-15 17:58:48 -07001415class VkWriteDescriptorSet {
1416 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
1417 const void* pNext /// Pointer to next structure
1418 VkDescriptorSet destSet /// Destination descriptor set
1419 u32 destBinding /// Binding within the destination descriptor set to write
1420 u32 destArrayElement /// Array element within the destination binding to write
Jesse Hall03b6fe12015-11-24 12:44:21 -08001421 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001422 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 -08001423 const VkDescriptorImageInfo* pImageInfo
1424 const VkDescriptorBufferInfo* pBufferInfo
1425 const VkBufferView* pTexelBufferView
Jesse Halld27f6aa2015-08-15 17:58:48 -07001426}
1427
1428class VkCopyDescriptorSet {
1429 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
1430 const void* pNext /// Pointer to next structure
1431 VkDescriptorSet srcSet /// Source descriptor set
1432 u32 srcBinding /// Binding within the source descriptor set to copy from
1433 u32 srcArrayElement /// Array element within the source binding to copy from
1434 VkDescriptorSet destSet /// Destination descriptor set
1435 u32 destBinding /// Binding within the destination descriptor set to copy to
1436 u32 destArrayElement /// Array element within the destination binding to copy to
Jesse Hall03b6fe12015-11-24 12:44:21 -08001437 u32 descriptorCount /// Number of descriptors to copy
Jesse Halld27f6aa2015-08-15 17:58:48 -07001438}
1439
1440class VkBufferCreateInfo {
1441 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
1442 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001443 VkBufferCreateFlags flags /// Buffer creation flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001444 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001445 VkBufferUsageFlags usage /// Buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001446 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001447 u32 queueFamilyIndexCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001448 const u32* pQueueFamilyIndices
1449}
1450
1451class VkBufferViewCreateInfo {
1452 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
1453 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001454 VkBufferViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001455 VkBuffer buffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001456 VkFormat format /// Optionally specifies format of elements
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001457 VkDeviceSize offset /// Specified in bytes
1458 VkDeviceSize range /// View size specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001459}
1460
1461class VkImageSubresource {
Jesse Halld8bade02015-11-24 10:24:18 -08001462 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001463 u32 mipLevel
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001464 u32 arrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001465}
1466
1467class VkImageSubresourceRange {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001468 VkImageAspectFlags aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001469 u32 baseMipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001470 u32 numLevels
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001471 u32 baseArrayLayer
Jesse Halla15a4bf2015-11-19 22:48:02 -08001472 u32 numLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001473}
1474
1475class VkMemoryBarrier {
1476 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER
1477 const void* pNext /// Pointer to next structure.
1478 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1479 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1480}
1481
1482class VkBufferMemoryBarrier {
1483 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
1484 const void* pNext /// Pointer to next structure.
1485 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1486 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1487 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
1488 u32 destQueueFamilyIndex /// Queue family to transition ownership to
1489 VkBuffer buffer /// Buffer to sync
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001490 VkDeviceSize offset /// Offset within the buffer to sync
1491 VkDeviceSize size /// Amount of bytes to sync
Jesse Halld27f6aa2015-08-15 17:58:48 -07001492}
1493
1494class VkImageMemoryBarrier {
1495 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
1496 const void* pNext /// Pointer to next structure.
1497 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1498 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1499 VkImageLayout oldLayout /// Current layout of the image
1500 VkImageLayout newLayout /// New layout to transition the image to
1501 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
1502 u32 destQueueFamilyIndex /// Queue family to transition ownership to
1503 VkImage image /// Image to sync
1504 VkImageSubresourceRange subresourceRange /// Subresource range to sync
1505}
1506
1507class VkImageCreateInfo {
1508 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
1509 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001510 VkImageCreateFlags flags /// Image creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001511 VkImageType imageType
1512 VkFormat format
1513 VkExtent3D extent
1514 u32 mipLevels
Jesse Halla15a4bf2015-11-19 22:48:02 -08001515 u32 arrayLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001516 u32 samples
1517 VkImageTiling tiling
1518 VkImageUsageFlags usage /// Image usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001519 VkSharingMode sharingMode /// Cross-queue-family sharing mode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001520 u32 queueFamilyIndexCount /// Number of queue families to share across
Jesse Halld27f6aa2015-08-15 17:58:48 -07001521 const u32* pQueueFamilyIndices /// Array of queue family indices to share across
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001522 VkImageLayout initialLayout /// Initial image layout for all subresources
Jesse Halld27f6aa2015-08-15 17:58:48 -07001523}
1524
1525class VkSubresourceLayout {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001526 VkDeviceSize offset /// Specified in bytes
1527 VkDeviceSize size /// Specified in bytes
1528 VkDeviceSize rowPitch /// Specified in bytes
1529 VkDeviceSize depthPitch /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001530}
1531
1532class VkImageViewCreateInfo {
1533 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
1534 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001535 VkImageViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001536 VkImage image
1537 VkImageViewType viewType
1538 VkFormat format
1539 VkChannelMapping channels
1540 VkImageSubresourceRange subresourceRange
Jesse Halld27f6aa2015-08-15 17:58:48 -07001541}
1542
1543class VkBufferCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001544 VkDeviceSize srcOffset /// Specified in bytes
1545 VkDeviceSize destOffset /// Specified in bytes
Jesse Hallb00daad2015-11-29 19:46:20 -08001546 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001547}
1548
Jesse Halla6429252015-11-29 18:59:42 -08001549class VkSparseMemoryBind {
Jesse Hallb00daad2015-11-29 19:46:20 -08001550 VkDeviceSize resourceOffset /// Specified in bytes
1551 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001552 VkDeviceMemory mem
Jesse Hallb00daad2015-11-29 19:46:20 -08001553 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001554 VkSparseMemoryBindFlags flags
1555}
1556
Jesse Halla6429252015-11-29 18:59:42 -08001557class VkSparseImageMemoryBind {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001558 VkImageSubresource subresource
1559 VkOffset3D offset
1560 VkExtent3D extent
Jesse Halld27f6aa2015-08-15 17:58:48 -07001561 VkDeviceMemory mem
Jesse Hallb00daad2015-11-29 19:46:20 -08001562 VkDeviceSize memOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001563 VkSparseMemoryBindFlags flags
1564}
1565
Jesse Halla6429252015-11-29 18:59:42 -08001566class VkSparseBufferMemoryBindInfo {
1567 VkBuffer buffer
1568 u32 bindCount
1569 const VkSparseMemoryBind* pBinds
1570}
1571
1572class VkSparseImageOpaqueMemoryBindInfo {
1573 VkImage image
1574 u32 bindCount
1575 const VkSparseMemoryBind* pBinds
1576}
1577
1578class VkSparseImageMemoryBindInfo {
1579 VkImage image
1580 u32 bindCount
1581 const VkSparseMemoryBind* pBinds
1582}
1583
1584class VkBindSparseInfo {
1585 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
1586 const void* pNext
1587 u32 waitSemaphoreCount
1588 const VkSemaphore* pWaitSemaphores
1589 u32 numBufferBinds
1590 const VkSparseBufferMemoryBindInfo* pBufferBinds
1591 u32 numImageOpaqueBinds
1592 const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds
1593 u32 numImageBinds
1594 const VkSparseImageMemoryBindInfo* pImageBinds
1595 u32 signalSemaphoreCount
1596 const VkSemaphore* pSignalSemaphores
1597}
1598
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001599class VkImageSubresourceCopy {
Jesse Halla15a4bf2015-11-19 22:48:02 -08001600 VkImageAspectFlags aspect
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001601 u32 mipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001602 u32 baseArrayLayer
1603 u32 numLayers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001604}
1605
Jesse Halld27f6aa2015-08-15 17:58:48 -07001606class VkImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001607 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001608 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001609 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001610 VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images
1611 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images
1612}
1613
1614class VkImageBlit {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001615 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001616 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
1617 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001618 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001619 VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images
1620 VkExtent3D destExtent /// Specified in pixels for both compressed and uncompressed images
1621}
1622
1623class VkBufferImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001624 VkDeviceSize bufferOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001625 u32 bufferRowLength /// Specified in texels
1626 u32 bufferImageHeight
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001627 VkImageSubresourceCopy imageSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001628 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images
1629 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images
1630}
1631
1632class VkImageResolve {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001633 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001634 VkOffset3D srcOffset
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001635 VkImageSubresourceCopy destSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001636 VkOffset3D destOffset
1637 VkExtent3D extent
1638}
1639
1640class VkShaderModuleCreateInfo {
1641 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
1642 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001643 VkShaderModuleCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001644 platform.size_t codeSize /// Specified in bytes
Jesse Halla9bb62b2015-11-21 19:31:56 -08001645 const u32* pCode /// Binary code of size codeSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07001646}
1647
1648class VkShaderCreateInfo {
1649 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
1650 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001651 VkShaderCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001652 VkShaderModule module /// Module containing entry point
1653 const char* pName /// Null-terminated entry point name
Jesse Halld8bade02015-11-24 10:24:18 -08001654 VkShaderStageFlagBits stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001655}
1656
1657class VkDescriptorSetLayoutBinding {
1658 VkDescriptorType descriptorType /// Type of the descriptors in this binding
1659 u32 arraySize /// Number of descriptors in this binding
1660 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to
1661 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements)
1662}
1663
1664class VkDescriptorSetLayoutCreateInfo {
1665 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
1666 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001667 VkDescriptorSetLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001668 u32 bindingCount /// Number of bindings in the descriptor set layout
1669 const VkDescriptorSetLayoutBinding* pBindings /// Array of descriptor set layout bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001670}
1671
1672class VkDescriptorTypeCount {
1673 VkDescriptorType type
Jesse Hall03b6fe12015-11-24 12:44:21 -08001674 u32 descriptorCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001675}
1676
1677class VkDescriptorPoolCreateInfo {
1678 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
1679 const void* pNext /// Pointer to next structure
Jesse Hallfbf97b02015-11-20 14:17:03 -08001680 VkDescriptorPoolCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001681 u32 maxSets
Jesse Hall03b6fe12015-11-24 12:44:21 -08001682 u32 typeCount
1683 const VkDescriptorTypeCount* pTypeCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07001684}
1685
Jesse Hallfbf97b02015-11-20 14:17:03 -08001686class VkDescriptorSetAllocInfo {
1687 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO
1688 const void* pNext /// Pointer to next structure
1689 VkDescriptorPool descriptorPool
Jesse Hall03b6fe12015-11-24 12:44:21 -08001690 u32 setCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001691 const VkDescriptorSetLayout* pSetLayouts
1692}
1693
Jesse Halld27f6aa2015-08-15 17:58:48 -07001694class VkSpecializationMapEntry {
1695 u32 constantId /// The SpecConstant ID specified in the BIL
Jesse Halld27f6aa2015-08-15 17:58:48 -07001696 u32 offset /// Offset of the value in the data block
Jesse Hallb00daad2015-11-29 19:46:20 -08001697 platform.size_t size /// Size in bytes of the SpecConstant
Jesse Halld27f6aa2015-08-15 17:58:48 -07001698}
1699
1700class VkSpecializationInfo {
1701 u32 mapEntryCount /// Number of entries in the map
Jesse Hallb00daad2015-11-29 19:46:20 -08001702 const VkSpecializationMapEntry* pMapEntries /// Array of map entries
Jesse Halld27f6aa2015-08-15 17:58:48 -07001703 platform.size_t dataSize /// Size in bytes of pData
1704 const void* pData /// Pointer to SpecConstant data
1705}
1706
1707class VkPipelineShaderStageCreateInfo {
1708 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
1709 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001710 VkPipelineShaderStageCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001711 VkShader shader
1712 const VkSpecializationInfo* pSpecializationInfo
1713}
1714
1715class VkComputePipelineCreateInfo {
1716 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
1717 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001718 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001719 VkPipelineShaderStageCreateInfo stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001720 VkPipelineLayout layout /// Interface layout of the pipeline
1721 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
1722 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
1723}
1724
1725class VkVertexInputBindingDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001726 u32 binding /// Vertex buffer binding id
1727 u32 stride /// Distance between vertices in bytes (0 = no advancement)
1728 VkVertexInputStepRate stepRate /// Rate at which binding is incremented
Jesse Halld27f6aa2015-08-15 17:58:48 -07001729}
1730
1731class VkVertexInputAttributeDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001732 u32 location /// location of the shader vertex attrib
1733 u32 binding /// Vertex buffer binding id
1734 VkFormat format /// format of source data
1735 u32 offset /// Offset of first element in bytes from base of vertex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001736}
1737
1738class VkPipelineVertexInputStateCreateInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001739 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
1740 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001741 VkPipelineVertexInputStateCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001742 u32 vertexBindingDescriptionCount /// number of bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001743 const VkVertexInputBindingDescription* pVertexBindingDescriptions
Jesse Hall03b6fe12015-11-24 12:44:21 -08001744 u32 vertexAttributeDescriptionCount /// number of attributes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001745 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
1746}
1747
1748class VkPipelineInputAssemblyStateCreateInfo {
1749 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
1750 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001751 VkPipelineInputAssemblyStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001752 VkPrimitiveTopology topology
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001753 VkBool32 primitiveRestartEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001754}
1755
1756class VkPipelineTessellationStateCreateInfo {
1757 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
1758 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001759 VkPipelineTessellationStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001760 u32 patchControlPoints
1761}
1762
1763class VkPipelineViewportStateCreateInfo {
1764 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
1765 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001766 VkPipelineViewportStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001767 u32 viewportCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001768 const VkViewport* pViewports
1769 u32 scissorCount
1770 const VkRect2D* pScissors
Jesse Halld27f6aa2015-08-15 17:58:48 -07001771}
1772
1773class VkPipelineRasterStateCreateInfo {
1774 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO
1775 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001776 VkPipelineRasterStateCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001777 VkBool32 depthClampEnable
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001778 VkBool32 rasterizerDiscardEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001779 VkFillMode fillMode /// optional (GL45)
1780 VkCullMode cullMode
1781 VkFrontFace frontFace
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001782 VkBool32 depthBiasEnable
Jesse Halla9bb62b2015-11-21 19:31:56 -08001783 f32 depthBiasConstantFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001784 f32 depthBiasClamp
Jesse Halla9bb62b2015-11-21 19:31:56 -08001785 f32 depthBiasSlopeFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001786 f32 lineWidth
Jesse Halld27f6aa2015-08-15 17:58:48 -07001787}
1788
1789class VkPipelineMultisampleStateCreateInfo {
1790 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
1791 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001792 VkPipelineMultisampleStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001793 u32 rasterSamples /// Number of samples used for rasterization
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001794 VkBool32 sampleShadingEnable /// optional (GL45)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001795 f32 minSampleShading /// optional (GL45)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001796 const VkSampleMask* pSampleMask
Jesse Hallacfa5342015-11-19 21:51:33 -08001797 VkBool32 alphaToCoverageEnable
1798 VkBool32 alphaToOneEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001799}
1800
1801class VkPipelineColorBlendAttachmentState {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001802 VkBool32 blendEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001803 VkBlend srcBlendColor
1804 VkBlend destBlendColor
1805 VkBlendOp blendOpColor
1806 VkBlend srcBlendAlpha
1807 VkBlend destBlendAlpha
1808 VkBlendOp blendOpAlpha
1809 VkChannelFlags channelWriteMask
1810}
1811
1812class VkPipelineColorBlendStateCreateInfo {
1813 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
1814 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001815 VkPipelineColorBlendStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001816 VkBool32 logicOpEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001817 VkLogicOp logicOp
1818 u32 attachmentCount /// # of pAttachments
1819 const VkPipelineColorBlendAttachmentState* pAttachments
Jesse Hallb00daad2015-11-29 19:46:20 -08001820 f32[4] blendConstants
Jesse Halld27f6aa2015-08-15 17:58:48 -07001821}
1822
1823class VkStencilOpState {
1824 VkStencilOp stencilFailOp
1825 VkStencilOp stencilPassOp
1826 VkStencilOp stencilDepthFailOp
1827 VkCompareOp stencilCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001828 u32 stencilCompareMask
1829 u32 stencilWriteMask
1830 u32 stencilReference
Jesse Halld27f6aa2015-08-15 17:58:48 -07001831}
1832
1833class VkPipelineDepthStencilStateCreateInfo {
1834 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
1835 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001836 VkPipelineDepthStencilStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001837 VkBool32 depthTestEnable
1838 VkBool32 depthWriteEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001839 VkCompareOp depthCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001840 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test)
1841 VkBool32 stencilTestEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001842 VkStencilOpState front
1843 VkStencilOpState back
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001844 f32 minDepthBounds
1845 f32 maxDepthBounds
1846}
1847
1848class VkPipelineDynamicStateCreateInfo {
1849 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
1850 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001851 VkPipelineDynamicStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001852 u32 dynamicStateCount
1853 const VkDynamicState* pDynamicStates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001854}
1855
1856class VkGraphicsPipelineCreateInfo {
Jesse Halla6429252015-11-29 18:59:42 -08001857 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
1858 const void* pNext /// Pointer to next structure
1859 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001860 u32 stageCount
Jesse Halla6429252015-11-29 18:59:42 -08001861 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001862 const VkPipelineVertexInputStateCreateInfo* pVertexInputState
1863 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
1864 const VkPipelineTessellationStateCreateInfo* pTessellationState
1865 const VkPipelineViewportStateCreateInfo* pViewportState
1866 const VkPipelineRasterStateCreateInfo* pRasterState
1867 const VkPipelineMultisampleStateCreateInfo* pMultisampleState
1868 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState
1869 const VkPipelineColorBlendStateCreateInfo* pColorBlendState
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001870 const VkPipelineDynamicStateCreateInfo* pDynamicState
Jesse Halla6429252015-11-29 18:59:42 -08001871 VkPipelineLayout layout /// Interface layout of the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001872 VkRenderPass renderPass
1873 u32 subpass
Jesse Halla6429252015-11-29 18:59:42 -08001874 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
1875 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 -07001876}
1877
1878class VkPipelineCacheCreateInfo {
Jesse Hallb00daad2015-11-29 19:46:20 -08001879 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
1880 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001881 VkPipelineCacheCreateFlags flags
Jesse Hallb00daad2015-11-29 19:46:20 -08001882 platform.size_t initialDataSize /// Size of initial data to populate cache, in bytes
1883 const void* pInitialData /// Initial data to populate cache
1884 platform.size_t maxSize /// Maximum size cache can grow to, in bytes. If zero, then the cache may grow without bound.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001885}
1886
1887class VkPushConstantRange {
1888 VkShaderStageFlags stageFlags /// Which stages use the range
Jesse Hall03b6fe12015-11-24 12:44:21 -08001889 u32 offset /// Start of the range, in bytes
1890 u32 size /// Length of the range, in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001891}
1892
1893class VkPipelineLayoutCreateInfo {
1894 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
1895 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001896 VkPipelineLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001897 u32 setLayoutCount /// Number of descriptor sets interfaced by the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001898 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the
1899 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline
1900 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages
1901}
1902
1903class VkSamplerCreateInfo {
1904 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
1905 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001906 VkSamplerCreateFlags flags
Jesse Hall23ff73f2015-11-29 14:36:39 -08001907 VkFilter magFilter /// Filter mode for magnification
1908 VkFilter minFilter /// Filter mode for minifiation
1909 VkSamplerMipmapMode mipmapMode /// Mipmap selection mode
1910 VkSamplerAddressMode addressModeU
1911 VkSamplerAddressMode addressModeV
1912 VkSamplerAddressMode addressModeW
Jesse Halld27f6aa2015-08-15 17:58:48 -07001913 f32 mipLodBias
1914 f32 maxAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001915 VkBool32 compareEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001916 VkCompareOp compareOp
1917 f32 minLod
1918 f32 maxLod
1919 VkBorderColor borderColor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001920 VkBool32 unnormalizedCoordinates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001921}
1922
1923class VkCmdPoolCreateInfo {
1924 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO
1925 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001926 VkCmdPoolCreateFlags flags /// Command pool creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001927 u32 queueFamilyIndex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001928}
1929
Jesse Hallfbf97b02015-11-20 14:17:03 -08001930class VkCmdBufferAllocInfo {
1931 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001932 const void* pNext /// Pointer to next structure
1933 VkCmdPool cmdPool
1934 VkCmdBufferLevel level
Jesse Hall03b6fe12015-11-24 12:44:21 -08001935 u32 bufferCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001936}
1937
1938class VkCmdBufferBeginInfo {
1939 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO
1940 const void* pNext /// Pointer to next structure
Jesse Halla15a4bf2015-11-19 22:48:02 -08001941 VkCmdBufferUsageFlags flags /// Command buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001942 VkRenderPass renderPass /// Render pass for secondary command buffers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001943 u32 subpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07001944 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers
1945}
1946
1947class VkRenderPassBeginInfo {
1948 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
1949 const void* pNext /// Pointer to next structure
1950 VkRenderPass renderPass
1951 VkFramebuffer framebuffer
1952 VkRect2D renderArea
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001953 u32 clearValueCount
1954 const VkClearValue* pClearValues
Jesse Halld27f6aa2015-08-15 17:58:48 -07001955}
1956
1957@union
1958/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared.
1959class VkClearColorValue {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001960 f32[4] float32
1961 s32[4] int32
1962 u32[4] uint32
Jesse Halld27f6aa2015-08-15 17:58:48 -07001963}
1964
1965class VkClearDepthStencilValue {
1966 f32 depth
1967 u32 stencil
1968}
1969
1970@union
1971/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared.
1972class VkClearValue {
1973 VkClearColorValue color
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001974 VkClearDepthStencilValue depthStencil
Jesse Halld27f6aa2015-08-15 17:58:48 -07001975}
1976
Jesse Hallae38f732015-11-19 21:32:50 -08001977class VkClearAttachment {
1978 VkImageAspectFlags aspectMask
1979 u32 colorAttachment
1980 VkClearValue clearValue
1981}
1982
Jesse Halld27f6aa2015-08-15 17:58:48 -07001983class VkAttachmentDescription {
1984 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION
1985 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001986 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001987 VkFormat format
1988 u32 samples
1989 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1990 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1991 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1992 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1993 VkImageLayout initialLayout
1994 VkImageLayout finalLayout
1995}
1996
1997class VkAttachmentReference {
1998 u32 attachment
1999 VkImageLayout layout
2000}
2001
2002class VkSubpassDescription {
2003 VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DESCRIPTION
2004 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07002005 VkSubpassDescriptionFlags flags
Jesse Halla6429252015-11-29 18:59:42 -08002006 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
Jesse Hall03b6fe12015-11-24 12:44:21 -08002007 u32 inputAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002008 const VkAttachmentReference* pInputAttachments
Jesse Hall03b6fe12015-11-24 12:44:21 -08002009 u32 colorAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002010 const VkAttachmentReference* pColorAttachments
2011 const VkAttachmentReference* pResolveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002012 VkAttachmentReference depthStencilAttachment
Jesse Hall03b6fe12015-11-24 12:44:21 -08002013 u32 preserveAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002014 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002015}
2016
2017class VkSubpassDependency {
2018 VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DEPENDENCY
2019 const void* pNext /// Pointer to next structure
2020 u32 srcSubpass
2021 u32 destSubpass
2022 VkPipelineStageFlags srcStageMask
2023 VkPipelineStageFlags destStageMask
2024 VkMemoryOutputFlags outputMask
2025 VkMemoryInputFlags inputMask
Jesse Halldc6d36c2015-11-29 19:12:15 -08002026 VkDependencyFlags dependencyFlags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002027}
2028
2029class VkRenderPassCreateInfo {
2030 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
2031 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002032 VkRenderPassCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002033 u32 attachmentCount
2034 const VkAttachmentDescription* pAttachments
2035 u32 subpassCount
2036 const VkSubpassDescription* pSubpasses
2037 u32 dependencyCount
2038 const VkSubpassDependency* pDependencies
2039}
2040
2041class VkEventCreateInfo {
2042 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
2043 const void* pNext /// Pointer to next structure
2044 VkEventCreateFlags flags /// Event creation flags
2045}
2046
2047class VkFenceCreateInfo {
2048 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
2049 const void* pNext /// Pointer to next structure
2050 VkFenceCreateFlags flags /// Fence creation flags
2051}
2052
2053class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002054 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
2055 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
2056 VkBool32 imageCubeArray /// image views which are arrays of cube maps
2057 VkBool32 independentBlend /// blending operations are controlled per-attachment
2058 VkBool32 geometryShader /// geometry stage
2059 VkBool32 tessellationShader /// tessellation control and evaluation stage
2060 VkBool32 sampleRateShading /// per-sample shading and interpolation
2061 VkBool32 dualSourceBlend /// blend operations which take two sources
2062 VkBool32 logicOp /// logic operations
2063 VkBool32 multiDrawIndirect /// multi draw indirect
Jesse Hallae38f732015-11-19 21:32:50 -08002064 VkBool32 depthClamp /// depth clamping
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002065 VkBool32 depthBiasClamp /// depth bias clamping
2066 VkBool32 fillModeNonSolid /// point and wireframe fill modes
2067 VkBool32 depthBounds /// depth bounds test
2068 VkBool32 wideLines /// lines with width greater than 1
2069 VkBool32 largePoints /// points with size greater than 1
Jesse Hallfbf97b02015-11-20 14:17:03 -08002070 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
2071 VkBool32 multiViewport
2072 VkBool32 samplerAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002073 VkBool32 textureCompressionETC2 /// ETC texture compression formats
2074 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
2075 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
2076 VkBool32 occlusionQueryNonConservative /// non-conservative (exact) occlusion queries
2077 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
Jesse Halldc6d36c2015-11-29 19:12:15 -08002078 VkBool32 vertexPipelineStoresAndAtomics
2079 VkBool32 fragmentStoresAndAtomics
2080 VkBool32 shaderTessellationAndGeometryPointSize
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002081 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
2082 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
2083 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
2084 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
2085 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
2086 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
2087 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
2088 VkBool32 shaderClipDistance /// clip distance in shaders
2089 VkBool32 shaderCullDistance /// cull distance in shaders
2090 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
2091 VkBool32 shaderInt64 /// 64-bit integers in shaders
2092 VkBool32 shaderInt16 /// 16-bit integers in shaders
2093 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
2094 VkBool32 shaderResourceMinLOD /// shader can use texture operations that specify minimum resource LOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002095 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
2096 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
2097 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
2098 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
2099 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
2100 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
2101 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
2102 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
2103 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002104}
2105
2106class VkPhysicalDeviceLimits {
2107 /// resource maximum sizes
2108 u32 maxImageDimension1D /// max 1D image dimension
2109 u32 maxImageDimension2D /// max 2D image dimension
2110 u32 maxImageDimension3D /// max 3D image dimension
2111 u32 maxImageDimensionCube /// max cubemap image dimension
2112 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002113 VkSampleCountFlags sampleCounts /// sample counts supported for all images supporting rendering and sampling
Jesse Hallb00daad2015-11-29 19:46:20 -08002114 u32 maxTexelBufferElements
Jesse Hallfbf97b02015-11-20 14:17:03 -08002115 u32 maxUniformBufferRange /// max uniform buffer size (bytes)
2116 u32 maxStorageBufferRange /// max storage buffer size (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002117 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
2118 /// memory limits
2119 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002120 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
2121 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002122 /// descriptor set limits
2123 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07002124 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
2125 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
2126 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
2127 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
2128 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
2129 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
2130 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002131 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002132 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002133 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002134 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
2135 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
2136 /// vertex stage limits
2137 u32 maxVertexInputAttributes /// max num of vertex input attribute slots
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002138 u32 maxVertexInputBindings /// max num of vertex input binding slots
Jesse Halld27f6aa2015-08-15 17:58:48 -07002139 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset
2140 u32 maxVertexInputBindingStride /// max vertex input binding stride
2141 u32 maxVertexOutputComponents /// max num of output components written by vertex shader
2142 /// tessellation control stage limits
Jesse Hallae38f732015-11-19 21:32:50 -08002143 u32 maxTessellationGenLevel /// max level supported by tess primitive generator
2144 u32 maxTessellationPatchSize /// max patch size (vertices)
2145 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS
2146 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS
2147 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS
2148 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS
2149 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES
2150 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES
Jesse Halld27f6aa2015-08-15 17:58:48 -07002151 /// geometry stage limits
2152 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader
2153 u32 maxGeometryInputComponents /// max num of input components read in geometry stage
2154 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage
2155 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage
2156 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage
2157 /// fragment stage limits
2158 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage
Jesse Hallfbf97b02015-11-20 14:17:03 -08002159 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage
2160 u32 maxFragmentDualSourceAttachments /// max num of output attachments written when using dual source blending
Jesse Halld27f6aa2015-08-15 17:58:48 -07002161 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers
2162 /// compute stage limits
2163 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes)
2164 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z)
2165 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group
2166 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z)
2167
2168 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y
2169 u32 subTexelPrecisionBits /// num bits of subtexel precision
2170 u32 mipmapPrecisionBits /// num bits of mipmap precision
2171
2172 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices)
2173 u32 maxDrawIndirectInstanceCount /// max instance count for indirect draw calls
Jesse Halld27f6aa2015-08-15 17:58:48 -07002174
2175 f32 maxSamplerLodBias /// max absolute sampler level of detail bias
2176 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy
2177
2178 u32 maxViewports /// max number of active viewports
Jesse Halld27f6aa2015-08-15 17:58:48 -07002179 u32[2] maxViewportDimensions /// max viewport dimensions (x,y)
2180 f32[2] viewportBoundsRange /// viewport bounds range (min,max)
2181 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport
2182
Jesse Halldc6d36c2015-11-29 19:12:15 -08002183 platform.size_t minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes)
2184 VkDeviceSize minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes)
2185 VkDeviceSize minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes)
2186 VkDeviceSize minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002187
Jesse Hallfbf97b02015-11-20 14:17:03 -08002188 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002189 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset
Jesse Hallfbf97b02015-11-20 14:17:03 -08002190 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002191 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset
2192 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset
2193 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset
2194 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset
2195
2196 u32 maxFramebufferWidth /// max width for a framebuffer
2197 u32 maxFramebufferHeight /// max height for a framebuffer
2198 u32 maxFramebufferLayers /// max layer count for a layered framebuffer
2199 u32 maxFramebufferColorSamples /// max color sample count for a framebuffer
2200 u32 maxFramebufferDepthSamples /// max depth sample count for a framebuffer
2201 u32 maxFramebufferStencilSamples /// max stencil sample count for a framebuffer
2202 u32 maxColorAttachments /// max num of framebuffer color attachments
2203
2204 u32 maxSampledImageColorSamples /// max num of color samples for a non-integer sampled image
2205 u32 maxSampledImageDepthSamples /// max num of depth/stencil samples for a sampled image
2206 u32 maxSampledImageIntegerSamples /// max num of samples supported for an integer image
2207 u32 maxStorageImageSamples /// max num of samples for a storage image
2208 u32 maxSampleMaskWords /// max num of sample mask words
2209
Jesse Halla9bb62b2015-11-21 19:31:56 -08002210 f32 timestampPeriod
Jesse Halld27f6aa2015-08-15 17:58:48 -07002211
2212 u32 maxClipDistances /// max number of clip distances
2213 u32 maxCullDistances /// max number of cull distances
2214 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
2215
Jesse Hallfbf97b02015-11-20 14:17:03 -08002216 u32 discreteQueuePriorities
2217
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002218 f32[2] pointSizeRange /// range (min,max) of supported point sizes
2219 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07002220 f32 pointSizeGranularity /// granularity of supported point sizes
2221 f32 lineWidthGranularity /// granularity of supported line widths
Jesse Hall03b6fe12015-11-24 12:44:21 -08002222 VkBool32 strictLines
Jesse Halla9bb62b2015-11-21 19:31:56 -08002223
Jesse Halldc6d36c2015-11-29 19:12:15 -08002224 VkDeviceSize recommendedBufferCopyOffsetAlignment
2225 VkDeviceSize recommendedBufferCopyRowPitchAlignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07002226}
2227
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002228class VkPhysicalDeviceSparseProperties {
2229 VkBool32 residencyStandard2DBlockShape /// Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard block shapes (based on pixel format)
Jesse Hallb00daad2015-11-29 19:46:20 -08002230 VkBool32 residencyStandard2DMultisampleBlockShape /// Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard block shapes (based on pixel format)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002231 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
2232 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
2233 VkBool32 residencyNonResident /// Sparse resources support: GPU can safely access non-resident regions of a resource, read values from read-write resources are undefined
2234 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
2235}
2236
Jesse Halld27f6aa2015-08-15 17:58:48 -07002237class VkSemaphoreCreateInfo {
2238 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
2239 const void* pNext /// Pointer to next structure
2240 VkSemaphoreCreateFlags flags /// Semaphore creation flags
2241}
2242
2243class VkQueryPoolCreateInfo {
2244 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
2245 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002246 VkQueryPoolCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002247 VkQueryType queryType
2248 u32 slots
2249 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
2250}
2251
2252class VkFramebufferCreateInfo {
2253 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
2254 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002255 VkFramebufferCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002256 VkRenderPass renderPass
2257 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002258 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002259 u32 width
2260 u32 height
2261 u32 layers
2262}
2263
2264class VkDrawIndirectCmd {
2265 u32 vertexCount
2266 u32 instanceCount
2267 u32 firstVertex
2268 u32 firstInstance
2269}
2270
2271class VkDrawIndexedIndirectCmd {
2272 u32 indexCount
2273 u32 instanceCount
2274 u32 firstIndex
2275 s32 vertexOffset
2276 u32 firstInstance
2277}
2278
2279class VkDispatchIndirectCmd {
2280 u32 x
2281 u32 y
2282 u32 z
2283}
2284
Jesse Hallb00daad2015-11-29 19:46:20 -08002285@extension("VK_EXT_KHR_surface")
2286class VkSurfaceCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002287 u32 minImageCount
2288 u32 maxImageCount
2289 VkExtent2D currentExtent
2290 VkExtent2D minImageExtent
2291 VkExtent2D maxImageExtent
2292 VkSurfaceTransformFlagsKHR supportedTransforms
2293 VkSurfaceTransformKHR currentTransform
Jesse Halla6429252015-11-29 18:59:42 -08002294 VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002295 u32 maxImageArraySize
2296 VkImageUsageFlags supportedUsageFlags
Michael Lentine88594d72015-11-12 12:49:45 -08002297}
2298
Jesse Hallb00daad2015-11-29 19:46:20 -08002299@extension("VK_EXT_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -08002300class VkSurfaceFormatKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002301 VkFormat format
2302 VkColorSpaceKHR colorSpace
Michael Lentine88594d72015-11-12 12:49:45 -08002303}
2304
Jesse Hall1356b0d2015-11-23 17:24:58 -08002305@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002306class VkSwapchainCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002307 VkStructureType sType
2308 const void* pNext
2309 VkSurfaceKHR surface
2310 u32 minImageCount
2311 VkFormat imageFormat
2312 VkColorSpaceKHR imageColorSpace
2313 VkExtent2D imageExtent
2314 VkImageUsageFlags imageUsageFlags
2315 VkSurfaceTransformKHR preTransform
Jesse Halla6429252015-11-29 18:59:42 -08002316 VkCompositeAlphaFlagBitsKHR compositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002317 u32 imageArraySize
2318 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08002319 u32 queueFamilyIndexCount
Jesse Hall1356b0d2015-11-23 17:24:58 -08002320 const u32* pQueueFamilyIndices
2321 VkPresentModeKHR presentMode
2322 VkSwapchainKHR oldSwapchain
2323 VkBool32 clipped
Michael Lentine88594d72015-11-12 12:49:45 -08002324}
2325
Jesse Hall1356b0d2015-11-23 17:24:58 -08002326@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002327class VkPresentInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002328 VkStructureType sType
2329 const void* pNext
Jesse Hallb00daad2015-11-29 19:46:20 -08002330 u32 waitSemaphoreCount
2331 const VkSemaphore* pWaitSemaphores
Jesse Hall1356b0d2015-11-23 17:24:58 -08002332 u32 swapchainCount
Jesse Hall03b6fe12015-11-24 12:44:21 -08002333 const VkSwapchainKHR* pSwapchains
Jesse Hall1356b0d2015-11-23 17:24:58 -08002334 const u32* imageIndices
Michael Lentine88594d72015-11-12 12:49:45 -08002335}
2336
Jesse Hall1356b0d2015-11-23 17:24:58 -08002337@extension("VK_EXT_KHR_display")
2338class VkDisplayPropertiesKHR {
2339 VkDisplayKHR display
2340 const char* displayName
2341 VkExtent2D physicalDimensions
2342 VkExtent2D physicalResolution
2343 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hall1356b0d2015-11-23 17:24:58 -08002344 VkBool32 planeReorderPossible
Jesse Halla6429252015-11-29 18:59:42 -08002345 VkBool32 persistentContent
Michael Lentine88594d72015-11-12 12:49:45 -08002346}
2347
Jesse Hall1356b0d2015-11-23 17:24:58 -08002348@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002349class VkDisplayModeParametersKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002350 VkExtent2D visibleRegion
Jesse Halla6429252015-11-29 18:59:42 -08002351 u32 refreshRate
Michael Lentine88594d72015-11-12 12:49:45 -08002352}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002353
Jesse Hall1356b0d2015-11-23 17:24:58 -08002354@extension("VK_EXT_KHR_display")
2355class VkDisplayModePropertiesKHR {
2356 VkDisplayModeKHR displayMode
Jesse Halla6429252015-11-29 18:59:42 -08002357 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002358}
2359
2360@extension("VK_EXT_KHR_display")
2361class VkDisplayModeCreateInfoKHR {
2362 VkStructureType sType
2363 const void* pNext
Jesse Halla6429252015-11-29 18:59:42 -08002364 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002365}
2366
2367@extension("VK_EXT_KHR_display")
2368class VkDisplayPlanePropertiesKHR {
Jesse Halla6429252015-11-29 18:59:42 -08002369 VkDisplayKHR currentDisplay
2370 u32 currentStackIndex
2371}
2372
2373@extension("VK_EXT_KHR_display")
2374class VkDisplayPlaneCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002375 VkDisplayPlaneAlphaFlagsKHR supportedAlpha
2376 VkOffset2D minSrcPosition
2377 VkOffset2D maxSrcPosition
2378 VkExtent2D minSrcExtent
2379 VkExtent2D maxSrcExtent
2380 VkOffset2D minDstPosition
2381 VkOffset2D maxDstPosition
2382 VkExtent2D minDstExtent
2383 VkExtent2D maxDstExtent
2384}
2385
2386@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002387class VkDisplaySurfaceCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002388 VkStructureType sType
2389 const void* pNext
2390 VkDisplayModeKHR displayMode
2391 u32 planeIndex
2392 u32 planeStackIndex
2393 VkSurfaceTransformKHR transform
2394 f32 globalAlpha
2395 VkDisplayPlaneAlphaFlagsKHR alphaMode
2396 VkExtent2D imageSize
2397}
2398
2399@extension("VK_EXT_KHR_display_swapchain")
2400class VkDisplaySwapchainCreateInfoKHR {
2401 VkStructureType sType
2402 const void* pNext
2403 const VkSwapchainCreateInfoKHR* pNextSwapchainCreateInfo
2404}
2405
2406@extension("VK_EXT_KHR_display_swapchain")
2407class VkDisplayPresentInfoKHR {
2408 VkStructureType sType
2409 const void* pNext
2410 VkRect2D srcRect
2411 VkRect2D dstRect
Jesse Halla6429252015-11-29 18:59:42 -08002412 VkBool32 persistent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002413}
2414
2415
Jesse Halld27f6aa2015-08-15 17:58:48 -07002416////////////////
2417// Commands //
2418////////////////
2419
2420// Function pointers. TODO: add support for function pointers.
2421
2422@external type void* PFN_vkVoidFunction
2423@pfn cmd void vkVoidFunction() {
2424}
2425
2426@external type void* PFN_vkAllocFunction
2427@pfn cmd void* vkAllocFunction(
2428 void* pUserData,
2429 platform.size_t size,
2430 platform.size_t alignment,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002431 VkSystemAllocScope allocScope) {
2432 return ?
2433}
2434
2435@external type void* PFN_vkReallocFunction
2436@pfn cmd void* vkReallocFunction(
2437 void* pUserData,
2438 void* pOriginal,
2439 platform.size_t size,
2440 platform.size_t alignment,
2441 VkSystemAllocScope allocScope) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002442 return ?
2443}
2444
2445@external type void* PFN_vkFreeFunction
2446@pfn cmd void vkFreeFunction(
2447 void* pUserData,
2448 void* pMem) {
2449}
2450
Jesse Hall03b6fe12015-11-24 12:44:21 -08002451@external type void* PFN_vkInternalAllocNotification
2452@pfn cmd void vkInternalAllocNotification(
2453 void* pUserData,
2454 platform.size_t size,
2455 VkInternalAllocType allocType,
2456 VkSystemAllocScope allocScope) {
2457}
2458
2459@external type void* PFN_vkInternalFreeNotification
2460@pfn cmd void vkInternalFreeNotification(
2461 void* pUserData,
2462 platform.size_t size,
2463 VkInternalAllocType allocType,
2464 VkSystemAllocScope allocScope) {
2465}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002466
2467// Global functions
2468
2469@threadSafety("system")
2470cmd VkResult vkCreateInstance(
2471 const VkInstanceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002472 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002473 VkInstance* pInstance) {
2474 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
2475
2476 instance := ?
2477 pInstance[0] = instance
2478 State.Instances[instance] = new!InstanceObject()
2479
Jesse Hall03b6fe12015-11-24 12:44:21 -08002480 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount]
2481 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount]
Jesse Halld27f6aa2015-08-15 17:58:48 -07002482
2483 return ?
2484}
2485
2486@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002487cmd void vkDestroyInstance(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002488 VkInstance instance,
2489 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002490 instanceObject := GetInstance(instance)
2491
2492 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002493}
2494
2495@threadSafety("system")
2496cmd VkResult vkEnumeratePhysicalDevices(
2497 VkInstance instance,
2498 u32* pPhysicalDeviceCount,
2499 VkPhysicalDevice* pPhysicalDevices) {
2500 instanceObject := GetInstance(instance)
2501
2502 physicalDeviceCount := as!u32(?)
2503 pPhysicalDeviceCount[0] = physicalDeviceCount
2504 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2505
2506 for i in (0 .. physicalDeviceCount) {
2507 physicalDevice := ?
2508 physicalDevices[i] = physicalDevice
2509 if !(physicalDevice in State.PhysicalDevices) {
2510 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2511 }
2512 }
2513
2514 return ?
2515}
2516
2517cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2518 VkDevice device,
2519 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002520 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002521 device := GetDevice(device)
2522 }
2523
2524 return ?
2525}
2526
2527cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2528 VkInstance instance,
2529 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002530 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002531 instanceObject := GetInstance(instance)
2532 }
2533
2534 return ?
2535}
2536
Jesse Hall606a54e2015-11-19 22:17:28 -08002537cmd void vkGetPhysicalDeviceProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002538 VkPhysicalDevice physicalDevice,
2539 VkPhysicalDeviceProperties* pProperties) {
2540 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2541
2542 properties := ?
2543 pProperties[0] = properties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002544}
2545
Jesse Hall606a54e2015-11-19 22:17:28 -08002546cmd void vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002547 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002548 u32* pQueueFamilyPropertyCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002549 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002550 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002551 // TODO: Figure out how to express fetch-count-or-properties
2552 // This version fails 'apic validate' with 'fence not allowed in
2553 // *semantic.Branch'. Other attempts have failed with the same or other
2554 // errors.
2555 // if pQueueFamilyProperties != null {
2556 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2557 // for i in (0 .. pCount[0]) {
2558 // queueProperties := as!VkQueueFamilyProperties(?)
2559 // queuesProperties[i] = queueProperties
2560 // }
2561 // } else {
2562 // count := ?
2563 // pCount[0] = count
2564 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002565}
2566
Jesse Hall606a54e2015-11-19 22:17:28 -08002567cmd void vkGetPhysicalDeviceMemoryProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002568 VkPhysicalDevice physicalDevice,
2569 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2570 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2571
2572 memoryProperties := ?
2573 pMemoryProperties[0] = memoryProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002574}
2575
Jesse Hall606a54e2015-11-19 22:17:28 -08002576cmd void vkGetPhysicalDeviceFeatures(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002577 VkPhysicalDevice physicalDevice,
2578 VkPhysicalDeviceFeatures* pFeatures) {
2579 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2580
2581 features := ?
2582 pFeatures[0] = features
Jesse Halld27f6aa2015-08-15 17:58:48 -07002583}
2584
Jesse Hall606a54e2015-11-19 22:17:28 -08002585cmd void vkGetPhysicalDeviceFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002586 VkPhysicalDevice physicalDevice,
2587 VkFormat format,
2588 VkFormatProperties* pFormatProperties) {
2589 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2590
2591 formatProperties := ?
2592 pFormatProperties[0] = formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002593}
2594
Jesse Hall606a54e2015-11-19 22:17:28 -08002595cmd void vkGetPhysicalDeviceImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002596 VkPhysicalDevice physicalDevice,
2597 VkFormat format,
2598 VkImageType type,
2599 VkImageTiling tiling,
2600 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002601 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002602 VkImageFormatProperties* pImageFormatProperties) {
2603 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2604
2605 imageFormatProperties := ?
2606 pImageFormatProperties[0] = imageFormatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002607}
2608
Jesse Halld27f6aa2015-08-15 17:58:48 -07002609
2610// Device functions
2611
2612@threadSafety("system")
2613cmd VkResult vkCreateDevice(
2614 VkPhysicalDevice physicalDevice,
2615 const VkDeviceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002616 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002617 VkDevice* pDevice) {
2618 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2619 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2620
2621 device := ?
2622 pDevice[0] = device
2623 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2624
2625 return ?
2626}
2627
2628@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002629cmd void vkDestroyDevice(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002630 VkDevice device,
2631 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002632 deviceObject := GetDevice(device)
2633
2634 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002635}
2636
2637
2638// Extension discovery functions
2639
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002640cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002641 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002642 VkLayerProperties* pProperties) {
2643 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002644 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002645
2646 properties := pProperties[0:count]
2647 for i in (0 .. count) {
2648 property := ?
2649 properties[i] = property
2650 }
2651
2652 return ?
2653}
2654
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002655cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002656 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002657 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002658 VkExtensionProperties* pProperties) {
2659 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002660 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002661
2662 properties := pProperties[0:count]
2663 for i in (0 .. count) {
2664 property := ?
2665 properties[i] = property
2666 }
2667
2668 return ?
2669}
2670
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002671cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002672 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002673 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002674 VkLayerProperties* pProperties) {
2675 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2676 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002677 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002678
2679 properties := pProperties[0:count]
2680 for i in (0 .. count) {
2681 property := ?
2682 properties[i] = property
2683 }
2684
2685 return ?
2686}
2687
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002688cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002689 VkPhysicalDevice physicalDevice,
2690 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002691 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002692 VkExtensionProperties* pProperties) {
2693 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2694
2695 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002696 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002697
2698 properties := pProperties[0:count]
2699 for i in (0 .. count) {
2700 property := ?
2701 properties[i] = property
2702 }
2703
2704 return ?
2705}
2706
2707
2708// Queue functions
2709
2710@threadSafety("system")
Jesse Hall606a54e2015-11-19 22:17:28 -08002711cmd void vkGetDeviceQueue(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002712 VkDevice device,
2713 u32 queueFamilyIndex,
2714 u32 queueIndex,
2715 VkQueue* pQueue) {
2716 deviceObject := GetDevice(device)
2717
2718 queue := ?
2719 pQueue[0] = queue
2720
2721 if !(queue in State.Queues) {
2722 State.Queues[queue] = new!QueueObject(device: device)
2723 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002724}
2725
2726@threadSafety("app")
2727cmd VkResult vkQueueSubmit(
2728 VkQueue queue,
Jesse Halla366a512015-11-19 22:30:07 -08002729 u32 submitCount,
Jesse Hallb00daad2015-11-29 19:46:20 -08002730 const VkSubmitInfo* pSubmits,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002731 VkFence fence) {
2732 queueObject := GetQueue(queue)
2733
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002734 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002735 fenceObject := GetFence(fence)
2736 assert(fenceObject.device == queueObject.device)
2737 }
2738
Jesse Halla366a512015-11-19 22:30:07 -08002739 // cmdBuffers := pCmdBuffers[0:cmdBufferCount]
2740 // for i in (0 .. cmdBufferCount) {
2741 // cmdBuffer := cmdBuffers[i]
2742 // cmdBufferObject := GetCmdBuffer(cmdBuffer)
2743 // assert(cmdBufferObject.device == queueObject.device)
2744 //
2745 // validate("QueueCheck", cmdBufferObject.queueFlags in queueObject.flags,
2746 // "vkQueueSubmit: enqueued cmdBuffer requires missing queue capabilities.")
2747 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002748
2749 return ?
2750}
2751
2752@threadSafety("system")
2753cmd VkResult vkQueueWaitIdle(
2754 VkQueue queue) {
2755 queueObject := GetQueue(queue)
2756
2757 return ?
2758}
2759
2760@threadSafety("system")
2761cmd VkResult vkDeviceWaitIdle(
2762 VkDevice device) {
2763 deviceObject := GetDevice(device)
2764
2765 return ?
2766}
2767
2768
2769// Memory functions
2770
2771@threadSafety("system")
2772cmd VkResult vkAllocMemory(
2773 VkDevice device,
2774 const VkMemoryAllocInfo* pAllocInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002775 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002776 VkDeviceMemory* pMem) {
2777 assert(pAllocInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO)
2778 deviceObject := GetDevice(device)
2779
2780 mem := ?
2781 pMem[0] = mem
2782 State.DeviceMemories[mem] = new!DeviceMemoryObject(
2783 device: device,
2784 allocationSize: pAllocInfo[0].allocationSize)
2785
2786 return ?
2787}
2788
2789@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002790cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002791 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002792 VkDeviceMemory mem,
2793 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002794 deviceObject := GetDevice(device)
2795 memObject := GetDeviceMemory(mem)
2796 assert(memObject.device == device)
2797
2798 // Check that no objects are still bound before freeing.
2799 validate("MemoryCheck", len(memObject.boundObjects) == 0,
2800 "vkFreeMemory: objects still bound")
2801 validate("MemoryCheck", len(memObject.boundCommandBuffers) == 0,
2802 "vkFreeMemory: cmdBuffers still bound")
2803 State.DeviceMemories[mem] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002804}
2805
2806@threadSafety("app")
2807cmd VkResult vkMapMemory(
2808 VkDevice device,
2809 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002810 VkDeviceSize offset,
2811 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002812 VkMemoryMapFlags flags,
2813 void** ppData) {
2814 deviceObject := GetDevice(device)
2815 memObject := GetDeviceMemory(mem)
2816 assert(memObject.device == device)
2817
2818 assert(flags == as!VkMemoryMapFlags(0))
2819 assert((offset + size) <= memObject.allocationSize)
2820
2821 return ?
2822}
2823
2824@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002825cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002826 VkDevice device,
2827 VkDeviceMemory mem) {
2828 deviceObject := GetDevice(device)
2829 memObject := GetDeviceMemory(mem)
2830 assert(memObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002831}
2832
2833cmd VkResult vkFlushMappedMemoryRanges(
2834 VkDevice device,
2835 u32 memRangeCount
2836 const VkMappedMemoryRange* pMemRanges) {
2837 deviceObject := GetDevice(device)
2838
2839 memRanges := pMemRanges[0:memRangeCount]
2840 for i in (0 .. memRangeCount) {
2841 memRange := memRanges[i]
2842 memObject := GetDeviceMemory(memRange.mem)
2843 assert(memObject.device == device)
2844 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2845 }
2846
2847 return ?
2848}
2849
2850cmd VkResult vkInvalidateMappedMemoryRanges(
2851 VkDevice device,
2852 u32 memRangeCount,
2853 const VkMappedMemoryRange* pMemRanges) {
2854 deviceObject := GetDevice(device)
2855
2856 memRanges := pMemRanges[0:memRangeCount]
2857 for i in (0 .. memRangeCount) {
2858 memRange := memRanges[i]
2859 memObject := GetDeviceMemory(memRange.mem)
2860 assert(memObject.device == device)
2861 assert((memRange.offset + memRange.size) <= memObject.allocationSize)
2862 }
2863
2864 return ?
2865}
2866
2867
2868// Memory management API functions
2869
Jesse Hall606a54e2015-11-19 22:17:28 -08002870cmd void vkGetDeviceMemoryCommitment(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002871 VkDevice device,
2872 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002873 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002874 deviceObject := GetDevice(device)
2875
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002876 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002877 memoryObject := GetDeviceMemory(memory)
2878 assert(memoryObject.device == device)
2879 }
2880
2881 committedMemoryInBytes := ?
2882 pCommittedMemoryInBytes[0] = committedMemoryInBytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07002883}
2884
Jesse Hall606a54e2015-11-19 22:17:28 -08002885cmd void vkGetBufferMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002886 VkDevice device,
2887 VkBuffer buffer,
2888 VkMemoryRequirements* pMemoryRequirements) {
2889 deviceObject := GetDevice(device)
2890 bufferObject := GetBuffer(buffer)
2891 assert(bufferObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002892}
2893
2894cmd VkResult vkBindBufferMemory(
2895 VkDevice device,
2896 VkBuffer buffer,
2897 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002898 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002899 deviceObject := GetDevice(device)
2900 bufferObject := GetBuffer(buffer)
2901 assert(bufferObject.device == device)
2902
2903 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002904 if bufferObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002905 memObject := GetDeviceMemory(bufferObject.mem)
2906 memObject.boundObjects[as!u64(buffer)] = null
2907 }
2908
2909 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002910 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002911 memObject := GetDeviceMemory(mem)
2912 assert(memObject.device == device)
2913 memObject.boundObjects[as!u64(buffer)] = memOffset
2914 }
2915 bufferObject.mem = mem
2916 bufferObject.memOffset = memOffset
2917
2918 return ?
2919}
2920
Jesse Hall606a54e2015-11-19 22:17:28 -08002921cmd void vkGetImageMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002922 VkDevice device,
2923 VkImage image,
2924 VkMemoryRequirements* pMemoryRequirements) {
2925 deviceObject := GetDevice(device)
2926 imageObject := GetImage(image)
2927 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002928}
2929
2930cmd VkResult vkBindImageMemory(
2931 VkDevice device,
2932 VkImage image,
2933 VkDeviceMemory mem,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002934 VkDeviceSize memOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002935 deviceObject := GetDevice(device)
2936 imageObject := GetImage(image)
2937 assert(imageObject.device == device)
2938
2939 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002940 if imageObject.mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002941 memObject := GetDeviceMemory(imageObject.mem)
2942 memObject.boundObjects[as!u64(image)] = null
2943 }
2944
2945 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002946 if mem != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002947 memObject := GetDeviceMemory(mem)
2948 assert(memObject.device == device)
2949 memObject.boundObjects[as!u64(image)] = memOffset
2950 }
2951 imageObject.mem = mem
2952 imageObject.memOffset = memOffset
2953
2954 return ?
2955}
2956
Jesse Hall606a54e2015-11-19 22:17:28 -08002957cmd void vkGetImageSparseMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002958 VkDevice device,
2959 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002960 u32* pSparseMemoryRequirementCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002961 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2962 deviceObject := GetDevice(device)
2963 imageObject := GetImage(image)
2964 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002965}
2966
Jesse Hall606a54e2015-11-19 22:17:28 -08002967cmd void vkGetPhysicalDeviceSparseImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002968 VkPhysicalDevice physicalDevice,
2969 VkFormat format,
2970 VkImageType type,
2971 u32 samples,
2972 VkImageUsageFlags usage,
2973 VkImageTiling tiling,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002974 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002975 VkSparseImageFormatProperties* pProperties) {
2976 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002977}
2978
Jesse Halla6429252015-11-29 18:59:42 -08002979cmd VkResult vkQueueBindSparse(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002980 VkQueue queue,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002981 u32 bindInfoCount,
Jesse Halla6429252015-11-29 18:59:42 -08002982 const VkBindSparseInfo* pBindInfo,
2983 VkFence fence) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002984 queueObject := GetQueue(queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002985
2986 return ?
2987}
2988
2989
2990// Fence functions
2991
2992@threadSafety("system")
2993cmd VkResult vkCreateFence(
2994 VkDevice device,
2995 const VkFenceCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002996 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002997 VkFence* pFence) {
2998 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
2999 deviceObject := GetDevice(device)
3000
3001 fence := ?
3002 pFence[0] = fence
3003 State.Fences[fence] = new!FenceObject(
Jesse Halld8bade02015-11-24 10:24:18 -08003004 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT)))
Jesse Halld27f6aa2015-08-15 17:58:48 -07003005
3006 return ?
3007}
3008
3009@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003010cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003011 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003012 VkFence fence,
3013 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003014 deviceObject := GetDevice(device)
3015 fenceObject := GetFence(fence)
3016 assert(fenceObject.device == device)
3017
3018 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003019}
3020
3021@threadSafety("system")
3022cmd VkResult vkResetFences(
3023 VkDevice device,
3024 u32 fenceCount,
3025 const VkFence* pFences) {
3026 deviceObject := GetDevice(device)
3027
3028 fences := pFences[0:fenceCount]
3029 for i in (0 .. fenceCount) {
3030 fence := fences[i]
3031 fenceObject := GetFence(fence)
3032 assert(fenceObject.device == device)
3033 fenceObject.signaled = false
3034 }
3035
3036 return ?
3037}
3038
3039@threadSafety("system")
3040cmd VkResult vkGetFenceStatus(
3041 VkDevice device,
3042 VkFence fence) {
3043 deviceObject := GetDevice(device)
3044 fenceObject := GetFence(fence)
3045 assert(fenceObject.device == device)
3046
3047 return ?
3048}
3049
3050@threadSafety("system")
3051cmd VkResult vkWaitForFences(
3052 VkDevice device,
3053 u32 fenceCount,
3054 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003055 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003056 u64 timeout) { /// timeout in nanoseconds
3057 deviceObject := GetDevice(device)
3058
3059 fences := pFences[0:fenceCount]
3060 for i in (0 .. fenceCount) {
3061 fence := fences[i]
3062 fenceObject := GetFence(fence)
3063 assert(fenceObject.device == device)
3064 }
3065
3066 return ?
3067}
3068
3069
3070// Queue semaphore functions
3071
3072@threadSafety("system")
3073cmd VkResult vkCreateSemaphore(
3074 VkDevice device,
3075 const VkSemaphoreCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003076 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003077 VkSemaphore* pSemaphore) {
3078 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
3079 deviceObject := GetDevice(device)
3080
3081 semaphore := ?
3082 pSemaphore[0] = semaphore
3083 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
3084
3085 return ?
3086}
3087
3088@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003089cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003090 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003091 VkSemaphore semaphore,
3092 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003093 deviceObject := GetDevice(device)
3094 semaphoreObject := GetSemaphore(semaphore)
3095 assert(semaphoreObject.device == device)
3096
3097 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003098}
3099
Jesse Halld27f6aa2015-08-15 17:58:48 -07003100
3101// Event functions
3102
3103@threadSafety("system")
3104cmd VkResult vkCreateEvent(
3105 VkDevice device,
3106 const VkEventCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003107 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003108 VkEvent* pEvent) {
3109 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
3110 deviceObject := GetDevice(device)
3111
3112 event := ?
3113 pEvent[0] = event
3114 State.Events[event] = new!EventObject(device: device)
3115
3116 return ?
3117}
3118
3119@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003120cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003121 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003122 VkEvent event,
3123 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003124 deviceObject := GetDevice(device)
3125 eventObject := GetEvent(event)
3126 assert(eventObject.device == device)
3127
3128 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003129}
3130
3131@threadSafety("system")
3132cmd VkResult vkGetEventStatus(
3133 VkDevice device,
3134 VkEvent event) {
3135 deviceObject := GetDevice(device)
3136 eventObject := GetEvent(event)
3137 assert(eventObject.device == device)
3138
3139 return ?
3140}
3141
3142@threadSafety("system")
3143cmd VkResult vkSetEvent(
3144 VkDevice device,
3145 VkEvent event) {
3146 deviceObject := GetDevice(device)
3147 eventObject := GetEvent(event)
3148 assert(eventObject.device == device)
3149
3150 return ?
3151}
3152
3153@threadSafety("system")
3154cmd VkResult vkResetEvent(
3155 VkDevice device,
3156 VkEvent event) {
3157 deviceObject := GetDevice(device)
3158 eventObject := GetEvent(event)
3159 assert(eventObject.device == device)
3160
3161 return ?
3162}
3163
3164
3165// Query functions
3166
3167@threadSafety("system")
3168cmd VkResult vkCreateQueryPool(
3169 VkDevice device,
3170 const VkQueryPoolCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003171 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003172 VkQueryPool* pQueryPool) {
3173 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
3174 deviceObject := GetDevice(device)
3175
3176 queryPool := ?
3177 pQueryPool[0] = queryPool
3178 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
3179
3180 return ?
3181}
3182
3183@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003184cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003185 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003186 VkQueryPool queryPool,
3187 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003188 deviceObject := GetDevice(device)
3189 queryPoolObject := GetQueryPool(queryPool)
3190 assert(queryPoolObject.device == device)
3191
3192 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003193}
3194
3195@threadSafety("system")
3196cmd VkResult vkGetQueryPoolResults(
3197 VkDevice device,
3198 VkQueryPool queryPool,
3199 u32 startQuery,
3200 u32 queryCount,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003201 platform.size_t dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003202 void* pData,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003203 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003204 VkQueryResultFlags flags) {
3205 deviceObject := GetDevice(device)
3206 queryPoolObject := GetQueryPool(queryPool)
3207 assert(queryPoolObject.device == device)
3208
Jesse Halld27f6aa2015-08-15 17:58:48 -07003209 data := pData[0:dataSize]
3210
3211 return ?
3212}
3213
3214// Buffer functions
3215
3216@threadSafety("system")
3217cmd VkResult vkCreateBuffer(
3218 VkDevice device,
3219 const VkBufferCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003220 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003221 VkBuffer* pBuffer) {
3222 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
3223 deviceObject := GetDevice(device)
3224
3225 buffer := ?
3226 pBuffer[0] = buffer
3227 State.Buffers[buffer] = new!BufferObject(device: device)
3228
3229 return ?
3230}
3231
3232@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003233cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003234 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003235 VkBuffer buffer,
3236 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003237 deviceObject := GetDevice(device)
3238 bufferObject := GetBuffer(buffer)
3239 assert(bufferObject.device == device)
3240
3241 assert(bufferObject.mem == 0)
3242 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003243}
3244
3245
3246// Buffer view functions
3247
3248@threadSafety("system")
3249cmd VkResult vkCreateBufferView(
3250 VkDevice device,
3251 const VkBufferViewCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003252 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003253 VkBufferView* pView) {
3254 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
3255 deviceObject := GetDevice(device)
3256
3257 bufferObject := GetBuffer(pCreateInfo.buffer)
3258 assert(bufferObject.device == device)
3259
3260 view := ?
3261 pView[0] = view
3262 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
3263
3264 return ?
3265}
3266
3267@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003268cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003269 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003270 VkBufferView bufferView,
3271 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003272 deviceObject := GetDevice(device)
3273 bufferViewObject := GetBufferView(bufferView)
3274 assert(bufferViewObject.device == device)
3275
3276 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003277}
3278
3279
3280// Image functions
3281
3282@threadSafety("system")
3283cmd VkResult vkCreateImage(
3284 VkDevice device,
3285 const VkImageCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003286 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003287 VkImage* pImage) {
3288 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
3289 deviceObject := GetDevice(device)
3290
3291 image := ?
3292 pImage[0] = image
3293 State.Images[image] = new!ImageObject(device: device)
3294
3295 return ?
3296}
3297
3298@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003299cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003300 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003301 VkImage image,
3302 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003303 deviceObject := GetDevice(device)
3304 imageObject := GetImage(image)
3305 assert(imageObject.device == device)
3306
3307 assert(imageObject.mem == 0)
3308 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003309}
3310
Jesse Hall606a54e2015-11-19 22:17:28 -08003311cmd void vkGetImageSubresourceLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003312 VkDevice device,
3313 VkImage image,
3314 const VkImageSubresource* pSubresource,
3315 VkSubresourceLayout* pLayout) {
3316 deviceObject := GetDevice(device)
3317 imageObject := GetImage(image)
3318 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003319}
3320
3321
3322// Image view functions
3323
3324@threadSafety("system")
3325cmd VkResult vkCreateImageView(
3326 VkDevice device,
3327 const VkImageViewCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003328 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003329 VkImageView* pView) {
3330 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
3331 deviceObject := GetDevice(device)
3332
3333 imageObject := GetImage(pCreateInfo.image)
3334 assert(imageObject.device == device)
3335
3336 view := ?
3337 pView[0] = view
3338 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
3339
3340 return ?
3341}
3342
3343@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003344cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003345 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003346 VkImageView imageView,
3347 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003348 deviceObject := GetDevice(device)
3349 imageViewObject := GetImageView(imageView)
3350 assert(imageViewObject.device == device)
3351
3352 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003353}
3354
3355
3356// Shader functions
3357
3358cmd VkResult vkCreateShaderModule(
3359 VkDevice device,
3360 const VkShaderModuleCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003361 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003362 VkShaderModule* pShaderModule) {
3363 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
3364 deviceObject := GetDevice(device)
3365
3366 shaderModule := ?
3367 pShaderModule[0] = shaderModule
3368 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
3369
3370 return ?
3371}
3372
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003373cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003374 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003375 VkShaderModule shaderModule,
3376 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003377 deviceObject := GetDevice(device)
3378 shaderModuleObject := GetShaderModule(shaderModule)
3379 assert(shaderModuleObject.device == device)
3380
3381 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003382}
3383
3384@threadSafety("system")
3385cmd VkResult vkCreateShader(
3386 VkDevice device,
3387 const VkShaderCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003388 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003389 VkShader* pShader) {
3390 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO)
3391 deviceObject := GetDevice(device)
3392
3393 shader := ?
3394 pShader[0] = shader
3395 State.Shaders[shader] = new!ShaderObject(device: device)
3396
3397 return ?
3398}
3399
3400@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003401cmd void vkDestroyShader(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003402 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003403 VkShader shader,
3404 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003405 deviceObject := GetDevice(device)
3406 shaderObject := GetShader(shader)
3407 assert(shaderObject.device == device)
3408
3409 State.Shaders[shader] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003410}
3411
3412
3413// Pipeline functions
3414
3415cmd VkResult vkCreatePipelineCache(
3416 VkDevice device,
3417 const VkPipelineCacheCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003418 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003419 VkPipelineCache* pPipelineCache) {
3420 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
3421 deviceObject := GetDevice(device)
3422
3423 pipelineCache := ?
3424 pPipelineCache[0] = pipelineCache
3425 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
3426
3427 return ?
3428}
3429
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003430cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003431 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003432 VkPipelineCache pipelineCache,
3433 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003434 deviceObject := GetDevice(device)
3435 pipelineCacheObject := GetPipelineCache(pipelineCache)
3436 assert(pipelineCacheObject.device == device)
3437
3438 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003439}
3440
Jesse Halld27f6aa2015-08-15 17:58:48 -07003441cmd VkResult vkGetPipelineCacheData(
3442 VkDevice device,
3443 VkPipelineCache pipelineCache,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003444 platform.size_t* pDataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003445 void* pData) {
3446 deviceObject := GetDevice(device)
3447 pipelineCacheObject := GetPipelineCache(pipelineCache)
3448 assert(pipelineCacheObject.device == device)
3449
3450 return ?
3451}
3452
3453cmd VkResult vkMergePipelineCaches(
3454 VkDevice device,
3455 VkPipelineCache destCache,
3456 u32 srcCacheCount,
3457 const VkPipelineCache* pSrcCaches) {
3458 deviceObject := GetDevice(device)
3459 destCacheObject := GetPipelineCache(destCache)
3460 assert(destCacheObject.device == device)
3461
3462 srcCaches := pSrcCaches[0:srcCacheCount]
3463 for i in (0 .. srcCacheCount) {
3464 srcCache := srcCaches[i]
3465 srcCacheObject := GetPipelineCache(srcCache)
3466 assert(srcCacheObject.device == device)
3467 }
3468
3469 return ?
3470}
3471
3472cmd VkResult vkCreateGraphicsPipelines(
3473 VkDevice device,
3474 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003475 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003476 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003477 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003478 VkPipeline* pPipelines) {
3479 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003480 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003481 pipelineCacheObject := GetPipelineCache(pipelineCache)
3482 assert(pipelineCacheObject.device == device)
3483 }
3484
Jesse Hall03b6fe12015-11-24 12:44:21 -08003485 createInfos := pCreateInfos[0:createInfoCount]
3486 pipelines := pPipelines[0:createInfoCount]
3487 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003488 pipeline := ?
3489 pipelines[i] = pipeline
3490 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3491 }
3492
3493 return ?
3494}
3495
3496cmd VkResult vkCreateComputePipelines(
3497 VkDevice device,
3498 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003499 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003500 const VkComputePipelineCreateInfo* pCreateInfos,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003501 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003502 VkPipeline* pPipelines) {
3503 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003504 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003505 pipelineCacheObject := GetPipelineCache(pipelineCache)
3506 assert(pipelineCacheObject.device == device)
3507 }
3508
Jesse Hall03b6fe12015-11-24 12:44:21 -08003509 createInfos := pCreateInfos[0:createInfoCount]
3510 pipelines := pPipelines[0:createInfoCount]
3511 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003512 pipeline := ?
3513 pipelines[i] = pipeline
3514 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3515 }
3516
3517 return ?
3518}
3519
3520@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003521cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003522 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003523 VkPipeline pipeline,
3524 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003525 deviceObject := GetDevice(device)
3526 pipelineObjects := GetPipeline(pipeline)
3527 assert(pipelineObjects.device == device)
3528
3529 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003530}
3531
3532
3533// Pipeline layout functions
3534
3535@threadSafety("system")
3536cmd VkResult vkCreatePipelineLayout(
3537 VkDevice device,
3538 const VkPipelineLayoutCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003539 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003540 VkPipelineLayout* pPipelineLayout) {
3541 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3542 deviceObject := GetDevice(device)
3543
3544 pipelineLayout := ?
3545 pPipelineLayout[0] = pipelineLayout
3546 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3547
3548 return ?
3549}
3550
3551@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003552cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003553 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003554 VkPipelineLayout pipelineLayout,
3555 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003556 deviceObject := GetDevice(device)
3557 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3558 assert(pipelineLayoutObjects.device == device)
3559
3560 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003561}
3562
3563
3564// Sampler functions
3565
3566@threadSafety("system")
3567cmd VkResult vkCreateSampler(
3568 VkDevice device,
3569 const VkSamplerCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003570 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003571 VkSampler* pSampler) {
3572 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3573 deviceObject := GetDevice(device)
3574
3575 sampler := ?
3576 pSampler[0] = sampler
3577 State.Samplers[sampler] = new!SamplerObject(device: device)
3578
3579 return ?
3580}
3581
3582@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003583cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003584 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003585 VkSampler sampler,
3586 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003587 deviceObject := GetDevice(device)
3588 samplerObject := GetSampler(sampler)
3589 assert(samplerObject.device == device)
3590
3591 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003592}
3593
3594
3595// Descriptor set functions
3596
3597@threadSafety("system")
3598cmd VkResult vkCreateDescriptorSetLayout(
3599 VkDevice device,
3600 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003601 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003602 VkDescriptorSetLayout* pSetLayout) {
3603 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3604 deviceObject := GetDevice(device)
3605
3606 setLayout := ?
3607 pSetLayout[0] = setLayout
3608 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3609
3610 return ?
3611}
3612
3613@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003614cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003615 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003616 VkDescriptorSetLayout descriptorSetLayout,
3617 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003618 deviceObject := GetDevice(device)
3619 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3620 assert(descriptorSetLayoutObject.device == device)
3621
3622 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003623}
3624
3625@threadSafety("system")
3626cmd VkResult vkCreateDescriptorPool(
3627 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003628 const VkDescriptorPoolCreateInfo* pCreateInfo,
3629 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003630 VkDescriptorPool* pDescriptorPool) {
3631 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3632 deviceObject := GetDevice(device)
3633
3634 descriptorPool := ?
3635 pDescriptorPool[0] = descriptorPool
3636 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3637
3638 return ?
3639}
3640
3641@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003642cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003643 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003644 VkDescriptorPool descriptorPool,
3645 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003646 deviceObject := GetDevice(device)
3647 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3648 assert(descriptorPoolObject.device == device)
3649
3650 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003651}
3652
3653@threadSafety("app")
3654cmd VkResult vkResetDescriptorPool(
3655 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003656 VkDescriptorPool descriptorPool,
3657 VkDescriptorPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003658 deviceObject := GetDevice(device)
3659 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3660 assert(descriptorPoolObject.device == device)
3661
3662 return ?
3663}
3664
3665@threadSafety("app")
3666cmd VkResult vkAllocDescriptorSets(
3667 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003668 const VkDescriptorSetAllocInfo* pAllocInfo,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003669 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003670 deviceObject := GetDevice(device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003671 allocInfo := pAllocInfo[0]
3672 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003673
Jesse Hall03b6fe12015-11-24 12:44:21 -08003674 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount]
3675 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003676 setLayout := setLayouts[i]
3677 setLayoutObject := GetDescriptorSetLayout(setLayout)
3678 assert(setLayoutObject.device == device)
3679 }
3680
Jesse Hall03b6fe12015-11-24 12:44:21 -08003681 descriptorSets := pDescriptorSets[0:allocInfo.setCount]
3682 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003683 descriptorSet := ?
3684 descriptorSets[i] = descriptorSet
3685 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3686 }
3687
3688 return ?
3689}
3690
Jesse Hallf09c6b12015-08-15 19:54:28 -07003691cmd VkResult vkFreeDescriptorSets(
3692 VkDevice device,
3693 VkDescriptorPool descriptorPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003694 u32 descriptorSetCount,
Jesse Hallf09c6b12015-08-15 19:54:28 -07003695 const VkDescriptorSet* pDescriptorSets) {
3696 deviceObject := GetDevice(device)
3697 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3698
Jesse Hall03b6fe12015-11-24 12:44:21 -08003699 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3700 for i in (0 .. descriptorSetCount) {
Jesse Hallf09c6b12015-08-15 19:54:28 -07003701 descriptorSet := descriptorSets[i]
3702 descriptorSetObject := GetDescriptorSet(descriptorSet)
3703 assert(descriptorSetObject.device == device)
3704 State.DescriptorSets[descriptorSet] = null
3705 }
3706
3707 return ?
3708}
3709
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003710cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003711 VkDevice device,
Jesse Hallb00daad2015-11-29 19:46:20 -08003712 u32 descriptorWriteCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003713 const VkWriteDescriptorSet* pDescriptorWrites,
Jesse Hallb00daad2015-11-29 19:46:20 -08003714 u32 descriptorCopyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003715 const VkCopyDescriptorSet* pDescriptorCopies) {
3716 deviceObject := GetDevice(device)
3717
Jesse Hallb00daad2015-11-29 19:46:20 -08003718 descriptorWrites := pDescriptorWrites[0:descriptorWriteCount]
3719 for i in (0 .. descriptorWriteCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003720 descriptorWrite := descriptorWrites[i]
3721 descriptorWriteObject := GetDescriptorSet(descriptorWrite.destSet)
3722 assert(descriptorWriteObject.device == device)
3723 }
3724
Jesse Hallb00daad2015-11-29 19:46:20 -08003725 descriptorCopies := pDescriptorCopies[0:descriptorCopyCount]
3726 for i in (0 .. descriptorCopyCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003727 descriptorCopy := descriptorCopies[i]
3728 descriptorCopyObject := GetDescriptorSet(descriptorCopy.destSet)
3729 assert(descriptorCopyObject.device == device)
3730 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003731}
3732
3733
3734// Framebuffer functions
3735
3736@threadSafety("system")
3737cmd VkResult vkCreateFramebuffer(
3738 VkDevice device,
3739 const VkFramebufferCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003740 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003741 VkFramebuffer* pFramebuffer) {
3742 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3743 deviceObject := GetDevice(device)
3744
3745 framebuffer := ?
3746 pFramebuffer[0] = framebuffer
3747 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3748
3749 return ?
3750}
3751
3752@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003753cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003754 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003755 VkFramebuffer framebuffer,
3756 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003757 deviceObject := GetDevice(device)
3758 framebufferObject := GetFramebuffer(framebuffer)
3759 assert(framebufferObject.device == device)
3760
3761 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003762}
3763
3764
3765// Renderpass functions
3766
3767@threadSafety("system")
3768cmd VkResult vkCreateRenderPass(
3769 VkDevice device,
3770 const VkRenderPassCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003771 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003772 VkRenderPass* pRenderPass) {
3773 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3774 deviceObject := GetDevice(device)
3775
3776 renderpass := ?
3777 pRenderPass[0] = renderpass
3778 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3779
3780 return ?
3781}
3782
3783@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003784cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003785 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003786 VkRenderPass renderPass,
3787 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003788 deviceObject := GetDevice(device)
3789 renderPassObject := GetRenderPass(renderPass)
3790 assert(renderPassObject.device == device)
3791
3792 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003793}
3794
Jesse Hall606a54e2015-11-19 22:17:28 -08003795cmd void vkGetRenderAreaGranularity(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003796 VkDevice device,
3797 VkRenderPass renderPass,
3798 VkExtent2D* pGranularity) {
3799 deviceObject := GetDevice(device)
3800 renderPassObject := GetRenderPass(renderPass)
3801
3802 granularity := ?
3803 pGranularity[0] = granularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07003804}
3805
3806// Command pool functions
3807
3808cmd VkResult vkCreateCommandPool(
3809 VkDevice device,
3810 const VkCmdPoolCreateInfo* pCreateInfo,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003811 const VkAllocCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003812 VkCmdPool* pCmdPool) {
3813 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO)
3814 deviceObject := GetDevice(device)
3815
3816 cmdPool := ?
3817 pCmdPool[0] = cmdPool
3818 State.CmdPools[cmdPool] = new!CmdPoolObject(device: device)
3819
3820 return ?
3821}
3822
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003823cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003824 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003825 VkCmdPool cmdPool,
3826 const VkAllocCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003827 deviceObject := GetDevice(device)
3828 cmdPoolObject := GetCmdPool(cmdPool)
3829 assert(cmdPoolObject.device == device)
3830
3831 State.CmdPools[cmdPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003832}
3833
3834cmd VkResult vkResetCommandPool(
3835 VkDevice device,
3836 VkCmdPool cmdPool,
3837 VkCmdPoolResetFlags flags) {
3838 deviceObject := GetDevice(device)
3839 cmdPoolObject := GetCmdPool(cmdPool)
3840 assert(cmdPoolObject.device == device)
3841
3842 return ?
3843}
3844
3845// Command buffer functions
3846
3847macro void bindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3848 memoryObject := GetDeviceMemory(mem)
3849 memoryObject.boundCommandBuffers[cmdBuffer] = cmdBuffer
3850
3851 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3852 cmdBufferObject.boundObjects[as!u64(obj)] = mem
3853}
3854
3855macro void unbindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) {
3856 memoryObject := GetDeviceMemory(mem)
3857 memoryObject.boundCommandBuffers[cmdBuffer] = null
3858
3859 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3860 cmdBufferObject.boundObjects[as!u64(obj)] = null
3861}
3862
3863@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003864cmd VkResult vkAllocCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003865 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003866 const VkCmdBufferAllocInfo* pAllocInfo,
3867 VkCmdBuffer* pCmdBuffers) {
3868 assert(pAllocInfo[0].sType == VK_STRUCTURE_TYPE_CMD_BUFFER_ALLOC_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003869
Jesse Hall03b6fe12015-11-24 12:44:21 -08003870 count := pAllocInfo[0].bufferCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08003871 cmdBuffers := pCmdBuffers[0:count]
3872 for i in (0 .. count) {
3873 cmdBuffer := ?
3874 cmdBuffers[i] = cmdBuffer
3875 State.CmdBuffers[cmdBuffer] = new!CmdBufferObject(device: device)
3876 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003877
3878 return ?
3879}
3880
3881@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003882cmd void vkFreeCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003883 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003884 VkCmdPool cmdPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003885 u32 commandBufferCount,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003886 const VkCmdBuffer* pCommandBuffers) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003887 deviceObject := GetDevice(device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003888
Jesse Hall03b6fe12015-11-24 12:44:21 -08003889 cmdBuffers := pCommandBuffers[0:commandBufferCount]
3890 for i in (0 .. commandBufferCount) {
Jesse Hallfbf97b02015-11-20 14:17:03 -08003891 cmdBufferObject := GetCmdBuffer(cmdBuffers[i])
3892 assert(cmdBufferObject.device == device)
3893 // TODO: iterate over boundObjects and clear memory bindings
3894 State.CmdBuffers[cmdBuffers[i]] = null
3895 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003896}
3897
3898@threadSafety("app")
3899cmd VkResult vkBeginCommandBuffer(
3900 VkCmdBuffer cmdBuffer,
3901 const VkCmdBufferBeginInfo* pBeginInfo) {
3902 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO)
3903 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3904
3905 // TODO: iterate over boundObjects and clear memory bindings
3906
3907 return ?
3908}
3909
3910@threadSafety("app")
3911cmd VkResult vkEndCommandBuffer(
3912 VkCmdBuffer cmdBuffer) {
3913 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3914
3915 return ?
3916}
3917
3918@threadSafety("app")
3919cmd VkResult vkResetCommandBuffer(
3920 VkCmdBuffer cmdBuffer,
3921 VkCmdBufferResetFlags flags) {
3922 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3923
3924 // TODO: iterate over boundObjects and clear memory bindings
3925
3926 return ?
3927}
3928
3929
3930// Command buffer building functions
3931
3932@threadSafety("app")
3933cmd void vkCmdBindPipeline(
3934 VkCmdBuffer cmdBuffer,
3935 VkPipelineBindPoint pipelineBindPoint,
3936 VkPipeline pipeline) {
3937 cmdBufferObject := GetCmdBuffer(cmdBuffer)
3938 pipelineObject := GetPipeline(pipeline)
3939 assert(cmdBufferObject.device == pipelineObject.device)
3940
Jesse Halld8bade02015-11-24 10:24:18 -08003941 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003942 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3943 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3944 }
Jesse Halld8bade02015-11-24 10:24:18 -08003945 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003946}
3947
3948@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003949cmd void vkCmdSetViewport(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003950 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003951 u32 viewportCount,
3952 const VkViewport* pViewports) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003953 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003954 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003955}
3956
3957@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003958cmd void vkCmdSetScissor(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003959 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003960 u32 scissorCount,
3961 const VkRect2D* pScissors) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003962 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003963 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003964}
3965
3966@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003967cmd void vkCmdSetLineWidth(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003968 VkCmdBuffer cmdBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003969 f32 lineWidth) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003970 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003971 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003972}
3973
3974@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003975cmd void vkCmdSetDepthBias(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003976 VkCmdBuffer cmdBuffer,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003977 f32 depthBiasConstantFactor,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003978 f32 depthBiasClamp,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003979 f32 depthBiasSlopeFactor) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003980 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003981 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003982}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003983
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003984@threadSafety("app")
3985cmd void vkCmdSetBlendConstants(
3986 VkCmdBuffer cmdBuffer,
3987 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3988 // an annotation as a quick hack to pass this to the template without
3989 // having to modify the AST and semantic model.
Jesse Hallb00daad2015-11-29 19:46:20 -08003990 @readonly f32[4] blendConstants) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003991 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08003992 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003993}
3994
3995@threadSafety("app")
3996cmd void vkCmdSetDepthBounds(
3997 VkCmdBuffer cmdBuffer,
3998 f32 minDepthBounds,
3999 f32 maxDepthBounds) {
4000 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004001 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004002}
4003
4004@threadSafety("app")
4005cmd void vkCmdSetStencilCompareMask(
4006 VkCmdBuffer cmdBuffer,
4007 VkStencilFaceFlags faceMask,
4008 u32 stencilCompareMask) {
4009 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004010 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004011}
4012
4013@threadSafety("app")
4014cmd void vkCmdSetStencilWriteMask(
4015 VkCmdBuffer cmdBuffer,
4016 VkStencilFaceFlags faceMask,
4017 u32 stencilWriteMask) {
4018 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004019 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004020}
4021
4022@threadSafety("app")
4023cmd void vkCmdSetStencilReference(
4024 VkCmdBuffer cmdBuffer,
4025 VkStencilFaceFlags faceMask,
4026 u32 stencilReference) {
4027 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halld8bade02015-11-24 10:24:18 -08004028 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004029}
4030
4031@threadSafety("app")
4032cmd void vkCmdBindDescriptorSets(
4033 VkCmdBuffer cmdBuffer,
4034 VkPipelineBindPoint pipelineBindPoint,
4035 VkPipelineLayout layout,
4036 u32 firstSet,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004037 u32 descriptorSetCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004038 const VkDescriptorSet* pDescriptorSets,
4039 u32 dynamicOffsetCount,
4040 const u32* pDynamicOffsets) {
4041 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4042
Jesse Hall03b6fe12015-11-24 12:44:21 -08004043 descriptorSets := pDescriptorSets[0:descriptorSetCount]
4044 for i in (0 .. descriptorSetCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004045 descriptorSet := descriptorSets[i]
4046 descriptorSetObject := GetDescriptorSet(descriptorSet)
4047 assert(cmdBufferObject.device == descriptorSetObject.device)
4048 }
4049
4050 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
4051 for i in (0 .. dynamicOffsetCount) {
4052 dynamicOffset := dynamicOffsets[i]
4053 }
4054
Jesse Halld8bade02015-11-24 10:24:18 -08004055 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004056 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
4057 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
4058 }
Jesse Halld8bade02015-11-24 10:24:18 -08004059 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004060}
4061
4062@threadSafety("app")
4063cmd void vkCmdBindIndexBuffer(
4064 VkCmdBuffer cmdBuffer,
4065 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004066 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004067 VkIndexType indexType) {
4068 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4069 bufferObject := GetBuffer(buffer)
4070 assert(cmdBufferObject.device == bufferObject.device)
4071
4072 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4073
Jesse Halld8bade02015-11-24 10:24:18 -08004074 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004075}
4076
4077@threadSafety("app")
4078cmd void vkCmdBindVertexBuffers(
4079 VkCmdBuffer cmdBuffer,
4080 u32 startBinding,
4081 u32 bindingCount,
4082 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004083 const VkDeviceSize* pOffsets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004084 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4085
4086 // TODO: check if not [startBinding:startBinding+bindingCount]
4087 buffers := pBuffers[0:bindingCount]
4088 offsets := pOffsets[0:bindingCount]
4089 for i in (0 .. bindingCount) {
4090 buffer := buffers[i]
4091 offset := offsets[i]
4092 bufferObject := GetBuffer(buffer)
4093 assert(cmdBufferObject.device == bufferObject.device)
4094
4095 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4096 }
4097
Jesse Halld8bade02015-11-24 10:24:18 -08004098 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004099}
4100
4101@threadSafety("app")
4102cmd void vkCmdDraw(
4103 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004104 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004105 u32 instanceCount,
4106 u32 firstVertex,
4107 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004108 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4109
Jesse Halld8bade02015-11-24 10:24:18 -08004110 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004111}
4112
4113@threadSafety("app")
4114cmd void vkCmdDrawIndexed(
4115 VkCmdBuffer cmdBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004116 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004117 u32 instanceCount,
4118 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004119 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004120 u32 firstInstance) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004121 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4122
Jesse Halld8bade02015-11-24 10:24:18 -08004123 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004124}
4125
4126@threadSafety("app")
4127cmd void vkCmdDrawIndirect(
4128 VkCmdBuffer cmdBuffer,
4129 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004130 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004131 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004132 u32 stride) {
4133 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4134 bufferObject := GetBuffer(buffer)
4135 assert(cmdBufferObject.device == bufferObject.device)
4136
4137 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4138
Jesse Halld8bade02015-11-24 10:24:18 -08004139 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004140}
4141
4142@threadSafety("app")
4143cmd void vkCmdDrawIndexedIndirect(
4144 VkCmdBuffer cmdBuffer,
4145 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004146 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004147 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004148 u32 stride) {
4149 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4150 bufferObject := GetBuffer(buffer)
4151 assert(cmdBufferObject.device == bufferObject.device)
4152
4153 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4154
Jesse Halld8bade02015-11-24 10:24:18 -08004155 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004156}
4157
4158@threadSafety("app")
4159cmd void vkCmdDispatch(
4160 VkCmdBuffer cmdBuffer,
4161 u32 x,
4162 u32 y,
4163 u32 z) {
4164 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4165
Jesse Halld8bade02015-11-24 10:24:18 -08004166 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004167}
4168
4169@threadSafety("app")
4170cmd void vkCmdDispatchIndirect(
4171 VkCmdBuffer cmdBuffer,
4172 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004173 VkDeviceSize offset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004174 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4175 bufferObject := GetBuffer(buffer)
4176 assert(cmdBufferObject.device == bufferObject.device)
4177
4178 bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem)
4179
Jesse Halld8bade02015-11-24 10:24:18 -08004180 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004181}
4182
4183@threadSafety("app")
4184cmd void vkCmdCopyBuffer(
4185 VkCmdBuffer cmdBuffer,
4186 VkBuffer srcBuffer,
4187 VkBuffer destBuffer,
4188 u32 regionCount,
4189 const VkBufferCopy* pRegions) {
4190 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4191 srcBufferObject := GetBuffer(srcBuffer)
4192 destBufferObject := GetBuffer(destBuffer)
4193 assert(cmdBufferObject.device == srcBufferObject.device)
4194 assert(cmdBufferObject.device == destBufferObject.device)
4195
4196 regions := pRegions[0:regionCount]
4197 for i in (0 .. regionCount) {
4198 region := regions[i]
4199 }
4200
4201 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
4202 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4203
Jesse Halld8bade02015-11-24 10:24:18 -08004204 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004205}
4206
4207@threadSafety("app")
4208cmd void vkCmdCopyImage(
4209 VkCmdBuffer cmdBuffer,
4210 VkImage srcImage,
4211 VkImageLayout srcImageLayout,
4212 VkImage destImage,
4213 VkImageLayout destImageLayout,
4214 u32 regionCount,
4215 const VkImageCopy* pRegions) {
4216 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4217 srcImageObject := GetImage(srcImage)
4218 destImageObject := GetImage(destImage)
4219 assert(cmdBufferObject.device == srcImageObject.device)
4220 assert(cmdBufferObject.device == destImageObject.device)
4221
4222 regions := pRegions[0:regionCount]
4223 for i in (0 .. regionCount) {
4224 region := regions[i]
4225 }
4226
4227 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4228 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4229
Jesse Halld8bade02015-11-24 10:24:18 -08004230 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004231}
4232
4233@threadSafety("app")
4234cmd void vkCmdBlitImage(
4235 VkCmdBuffer cmdBuffer,
4236 VkImage srcImage,
4237 VkImageLayout srcImageLayout,
4238 VkImage destImage,
4239 VkImageLayout destImageLayout,
4240 u32 regionCount,
4241 const VkImageBlit* pRegions,
Jesse Hall23ff73f2015-11-29 14:36:39 -08004242 VkFilter filter) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004243 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4244 srcImageObject := GetImage(srcImage)
4245 destImageObject := GetImage(destImage)
4246 assert(cmdBufferObject.device == srcImageObject.device)
4247 assert(cmdBufferObject.device == destImageObject.device)
4248
4249 regions := pRegions[0:regionCount]
4250 for i in (0 .. regionCount) {
4251 region := regions[i]
4252 }
4253
4254 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4255 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4256
Jesse Halld8bade02015-11-24 10:24:18 -08004257 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004258}
4259
4260@threadSafety("app")
4261cmd void vkCmdCopyBufferToImage(
4262 VkCmdBuffer cmdBuffer,
4263 VkBuffer srcBuffer,
4264 VkImage destImage,
4265 VkImageLayout destImageLayout,
4266 u32 regionCount,
4267 const VkBufferImageCopy* pRegions) {
4268 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4269 srcBufferObject := GetBuffer(srcBuffer)
4270 destImageObject := GetImage(destImage)
4271 assert(cmdBufferObject.device == srcBufferObject.device)
4272 assert(cmdBufferObject.device == destImageObject.device)
4273
4274 regions := pRegions[0:regionCount]
4275 for i in (0 .. regionCount) {
4276 region := regions[i]
4277 }
4278
4279 bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem)
4280 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4281
Jesse Halld8bade02015-11-24 10:24:18 -08004282 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004283}
4284
4285@threadSafety("app")
4286cmd void vkCmdCopyImageToBuffer(
4287 VkCmdBuffer cmdBuffer,
4288 VkImage srcImage,
4289 VkImageLayout srcImageLayout,
4290 VkBuffer destBuffer,
4291 u32 regionCount,
4292 const VkBufferImageCopy* pRegions) {
4293 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4294 srcImageObject := GetImage(srcImage)
4295 destBufferObject := GetBuffer(destBuffer)
4296 assert(cmdBufferObject.device == srcImageObject.device)
4297 assert(cmdBufferObject.device == destBufferObject.device)
4298
4299 regions := pRegions[0:regionCount]
4300 for i in (0 .. regionCount) {
4301 region := regions[i]
4302 }
4303
4304 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4305 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4306
Jesse Halld8bade02015-11-24 10:24:18 -08004307 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004308}
4309
4310@threadSafety("app")
4311cmd void vkCmdUpdateBuffer(
4312 VkCmdBuffer cmdBuffer,
4313 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004314 VkDeviceSize destOffset,
4315 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004316 const u32* pData) {
4317 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4318 destBufferObject := GetBuffer(destBuffer)
4319 assert(cmdBufferObject.device == destBufferObject.device)
4320
4321 data := pData[0:dataSize]
4322
4323 bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem)
4324
Jesse Halld8bade02015-11-24 10:24:18 -08004325 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004326}
4327
4328@threadSafety("app")
4329cmd void vkCmdFillBuffer(
4330 VkCmdBuffer cmdBuffer,
4331 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004332 VkDeviceSize destOffset,
Jesse Hallb00daad2015-11-29 19:46:20 -08004333 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004334 u32 data) {
4335 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4336 destBufferObject := GetBuffer(destBuffer)
4337 assert(cmdBufferObject.device == destBufferObject.device)
4338
Jesse Halld8bade02015-11-24 10:24:18 -08004339 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004340}
4341
4342@threadSafety("app")
4343cmd void vkCmdClearColorImage(
4344 VkCmdBuffer cmdBuffer,
4345 VkImage image,
4346 VkImageLayout imageLayout,
4347 const VkClearColorValue* pColor,
4348 u32 rangeCount,
4349 const VkImageSubresourceRange* pRanges) {
4350 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4351 imageObject := GetImage(image)
4352 assert(cmdBufferObject.device == imageObject.device)
4353
4354 ranges := pRanges[0:rangeCount]
4355 for i in (0 .. rangeCount) {
4356 range := ranges[i]
4357 }
4358
4359 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
4360
Jesse Halld8bade02015-11-24 10:24:18 -08004361 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004362}
4363
4364@threadSafety("app")
4365cmd void vkCmdClearDepthStencilImage(
4366 VkCmdBuffer cmdBuffer,
4367 VkImage image,
4368 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004369 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004370 u32 rangeCount,
4371 const VkImageSubresourceRange* pRanges) {
4372 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4373 imageObject := GetImage(image)
4374 assert(cmdBufferObject.device == imageObject.device)
4375
4376 ranges := pRanges[0:rangeCount]
4377 for i in (0 .. rangeCount) {
4378 range := ranges[i]
4379 }
4380
4381 bindCmdBuffer(cmdBuffer, image, imageObject.mem)
4382
Jesse Halld8bade02015-11-24 10:24:18 -08004383 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004384}
4385
4386@threadSafety("app")
Jesse Hallae38f732015-11-19 21:32:50 -08004387cmd void vkCmdClearAttachments(
Jesse Halld27f6aa2015-08-15 17:58:48 -07004388 VkCmdBuffer cmdBuffer,
Jesse Hallae38f732015-11-19 21:32:50 -08004389 u32 attachmentCount,
4390 const VkClearAttachment* pAttachments,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004391 u32 rectCount,
Jesse Halla15a4bf2015-11-19 22:48:02 -08004392 const VkClearRect* pRects) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004393 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4394
4395 rects := pRects[0:rectCount]
4396 for i in (0 .. rectCount) {
4397 rect := rects[i]
4398 }
4399
Jesse Halld8bade02015-11-24 10:24:18 -08004400 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004401}
4402
4403@threadSafety("app")
4404cmd void vkCmdResolveImage(
4405 VkCmdBuffer cmdBuffer,
4406 VkImage srcImage,
4407 VkImageLayout srcImageLayout,
4408 VkImage destImage,
4409 VkImageLayout destImageLayout,
4410 u32 regionCount,
4411 const VkImageResolve* pRegions) {
4412 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4413 srcImageObject := GetImage(srcImage)
4414 destImageObject := GetImage(destImage)
4415 assert(cmdBufferObject.device == srcImageObject.device)
4416 assert(cmdBufferObject.device == destImageObject.device)
4417
4418 regions := pRegions[0:regionCount]
4419 for i in (0 .. regionCount) {
4420 region := regions[i]
4421 }
4422
4423 bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem)
4424 bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem)
4425
Jesse Halld8bade02015-11-24 10:24:18 -08004426 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004427}
4428
4429@threadSafety("app")
4430cmd void vkCmdSetEvent(
4431 VkCmdBuffer cmdBuffer,
4432 VkEvent event,
4433 VkPipelineStageFlags stageMask) {
4434 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4435 eventObject := GetEvent(event)
4436 assert(cmdBufferObject.device == eventObject.device)
4437}
4438
4439@threadSafety("app")
4440cmd void vkCmdResetEvent(
4441 VkCmdBuffer cmdBuffer,
4442 VkEvent event,
4443 VkPipelineStageFlags stageMask) {
4444 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4445 eventObject := GetEvent(event)
4446 assert(cmdBufferObject.device == eventObject.device)
4447}
4448
4449@threadSafety("app")
4450cmd void vkCmdWaitEvents(
4451 VkCmdBuffer cmdBuffer,
4452 u32 eventCount,
4453 const VkEvent* pEvents,
4454 VkPipelineStageFlags srcStageMask,
4455 VkPipelineStageFlags destStageMask,
4456 u32 memBarrierCount,
4457 const void* const* ppMemBarriers) {
4458 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4459
4460 events := pEvents[0:eventCount]
4461 for i in (0 .. eventCount) {
4462 event := events[i]
4463 eventObject := GetEvent(event)
4464 assert(cmdBufferObject.device == eventObject.device)
4465 }
4466
4467 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4468 for i in (0 .. memBarrierCount) {
4469 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4470 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4471 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4472 }
4473 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4474 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4475 imageObject := GetImage(imageMemBarrier.image)
4476 assert(imageObject.device == cmdBufferObject.device)
4477 }
4478 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4479 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4480 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4481 assert(bufferObject.device == cmdBufferObject.device)
4482 }
4483 }
4484 }
4485}
4486
4487@threadSafety("app")
4488cmd void vkCmdPipelineBarrier(
4489 VkCmdBuffer cmdBuffer,
4490 VkPipelineStageFlags srcStageMask,
4491 VkPipelineStageFlags destStageMask,
Jesse Halldc6d36c2015-11-29 19:12:15 -08004492 VkDependencyFlags dependencyFlags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004493 u32 memBarrierCount,
4494 const void* const* ppMemBarriers) {
4495 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4496
4497 pMemBarriers := ppMemBarriers[0:memBarrierCount]
4498 for i in (0 .. memBarrierCount) {
4499 switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType {
4500 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
4501 memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0]
4502 }
4503 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
4504 imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0]
4505 imageObject := GetImage(imageMemBarrier.image)
4506 assert(imageObject.device == cmdBufferObject.device)
4507 }
4508 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
4509 bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0]
4510 bufferObject := GetBuffer(bufferMemBarrier.buffer)
4511 assert(bufferObject.device == cmdBufferObject.device)
4512 }
4513 }
4514 }
4515}
4516
4517@threadSafety("app")
4518cmd void vkCmdBeginQuery(
4519 VkCmdBuffer cmdBuffer,
4520 VkQueryPool queryPool,
4521 u32 slot,
4522 VkQueryControlFlags flags) {
4523 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4524 queryPoolObject := GetQueryPool(queryPool)
4525 assert(cmdBufferObject.device == queryPoolObject.device)
4526}
4527
4528@threadSafety("app")
4529cmd void vkCmdEndQuery(
4530 VkCmdBuffer cmdBuffer,
4531 VkQueryPool queryPool,
4532 u32 slot) {
4533 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4534 queryPoolObject := GetQueryPool(queryPool)
4535 assert(cmdBufferObject.device == queryPoolObject.device)
4536}
4537
4538@threadSafety("app")
4539cmd void vkCmdResetQueryPool(
4540 VkCmdBuffer cmdBuffer,
4541 VkQueryPool queryPool,
4542 u32 startQuery,
4543 u32 queryCount) {
4544 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4545 queryPoolObject := GetQueryPool(queryPool)
4546 assert(cmdBufferObject.device == queryPoolObject.device)
4547}
4548
4549@threadSafety("app")
4550cmd void vkCmdWriteTimestamp(
4551 VkCmdBuffer cmdBuffer,
Jesse Hall6f39a6d2015-11-24 11:08:36 -08004552 VkPipelineStageFlagBits pipelineStage,
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004553 VkQueryPool queryPool,
4554 u32 slot) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004555 cmdBufferObject := GetCmdBuffer(cmdBuffer)
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004556 queryPoolObject := GetQueryPool(queryPool)
4557 assert(cmdBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004558}
4559
4560@threadSafety("app")
4561cmd void vkCmdCopyQueryPoolResults(
4562 VkCmdBuffer cmdBuffer,
4563 VkQueryPool queryPool,
4564 u32 startQuery,
4565 u32 queryCount,
4566 VkBuffer destBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004567 VkDeviceSize destOffset,
Jesse Halla9bb62b2015-11-21 19:31:56 -08004568 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004569 VkQueryResultFlags flags) {
4570 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4571 queryPoolObject := GetQueryPool(queryPool)
4572 destBufferObject := GetBuffer(destBuffer)
4573 assert(cmdBufferObject.device == queryPoolObject.device)
4574 assert(cmdBufferObject.device == destBufferObject.device)
4575}
4576
4577cmd void vkCmdPushConstants(
4578 VkCmdBuffer cmdBuffer,
4579 VkPipelineLayout layout,
4580 VkShaderStageFlags stageFlags,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004581 u32 offset,
4582 u32 size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004583 const void* values) {
4584 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4585 layoutObject := GetPipelineLayout(layout)
4586 assert(cmdBufferObject.device == layoutObject.device)
4587}
4588
4589@threadSafety("app")
4590cmd void vkCmdBeginRenderPass(
4591 VkCmdBuffer cmdBuffer,
4592 const VkRenderPassBeginInfo* pRenderPassBegin,
4593 VkRenderPassContents contents) {
4594 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4595 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4596 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
4597 assert(cmdBufferObject.device == renderPassObject.device)
4598 assert(cmdBufferObject.device == framebufferObject.device)
4599
Jesse Halld8bade02015-11-24 10:24:18 -08004600 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004601}
4602
4603cmd void vkCmdNextSubpass(
4604 VkCmdBuffer cmdBuffer,
4605 VkRenderPassContents contents) {
4606 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4607}
4608
4609@threadSafety("app")
4610cmd void vkCmdEndRenderPass(
4611 VkCmdBuffer cmdBuffer) {
4612 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4613
Jesse Halld8bade02015-11-24 10:24:18 -08004614 cmdBufferObject.queueFlags = AddQueueFlag(cmdBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004615}
4616
4617cmd void vkCmdExecuteCommands(
4618 VkCmdBuffer cmdBuffer,
4619 u32 cmdBuffersCount,
4620 const VkCmdBuffer* pCmdBuffers) {
4621 cmdBufferObject := GetCmdBuffer(cmdBuffer)
4622
4623 cmdBuffers := pCmdBuffers[0:cmdBuffersCount]
4624 for i in (0 .. cmdBuffersCount) {
4625 secondaryCmdBuffer := cmdBuffers[i]
4626 secondaryCmdBufferObject := GetCmdBuffer(secondaryCmdBuffer)
4627 assert(cmdBufferObject.device == secondaryCmdBufferObject.device)
4628 }
4629}
4630
Jesse Hall1356b0d2015-11-23 17:24:58 -08004631@extension("VK_EXT_KHR_surface")
4632cmd void vkDestroySurfaceKHR(
4633 VkInstance instance,
4634 VkSurfaceKHR surface) {
4635 instanceObject := GetInstance(instance)
4636 surfaceObject := GetSurface(surface)
4637 assert(surfaceObject.instance == instance)
Michael Lentine88594d72015-11-12 12:49:45 -08004638
Jesse Hall1356b0d2015-11-23 17:24:58 -08004639 State.Surfaces[surface] = null
Jesse Hall2818f932015-11-19 21:19:17 -08004640}
4641
Jesse Hall1356b0d2015-11-23 17:24:58 -08004642@extension("VK_EXT_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004643cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004644 VkPhysicalDevice physicalDevice,
4645 u32 queueFamilyIndex,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004646 VkSurfaceKHR surface,
Jesse Hallb00daad2015-11-29 19:46:20 -08004647 VkBool32* pSupported) {
4648 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004649
4650 return ?
4651}
4652
Jesse Hallb00daad2015-11-29 19:46:20 -08004653@extension("VK_EXT_KHR_surface")
4654cmd VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
4655 VkPhysicalDevice physicalDevice,
4656 VkSurfaceKHR surface,
4657 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
4658 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4659
4660 surfaceCapabilities := ?
4661 pSurfaceCapabilities[0] = surfaceCapabilities
4662
4663 return ?
4664}
4665
4666@extension("VK_EXT_KHR_surface")
4667cmd VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(
4668 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004669 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004670 u32* pSurfaceFormatCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004671 VkSurfaceFormatKHR* pSurfaceFormats) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004672 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004673
4674 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004675 pSurfaceFormatCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004676 surfaceFormats := pSurfaceFormats[0:count]
4677
4678 for i in (0 .. count) {
4679 surfaceFormat := ?
4680 surfaceFormats[i] = surfaceFormat
4681 }
4682
4683 return ?
4684}
4685
Jesse Hallb00daad2015-11-29 19:46:20 -08004686@extension("VK_EXT_KHR_surface")
4687cmd VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(
4688 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004689 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004690 u32* pPresentModeCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004691 VkPresentModeKHR* pPresentModes) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004692 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004693
4694 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004695 pPresentModeCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004696 presentModes := pPresentModes[0:count]
4697
4698 for i in (0 .. count) {
4699 presentMode := ?
4700 presentModes[i] = presentMode
4701 }
4702
4703 return ?
4704}
4705
Jesse Hall1356b0d2015-11-23 17:24:58 -08004706@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004707cmd VkResult vkCreateSwapchainKHR(
4708 VkDevice device,
4709 const VkSwapchainCreateInfoKHR* pCreateInfo,
4710 VkSwapchainKHR* pSwapchain) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004711 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
Michael Lentine88594d72015-11-12 12:49:45 -08004712 deviceObject := GetDevice(device)
4713
4714 swapchain := ?
4715 pSwapchain[0] = swapchain
4716 State.Swapchains[swapchain] = new!SwapchainObject(device: device)
4717
4718 return ?
4719}
4720
Jesse Hall1356b0d2015-11-23 17:24:58 -08004721@extension("VK_EXT_KHR_swapchain")
4722cmd void vkDestroySwapchainKHR(
Michael Lentine88594d72015-11-12 12:49:45 -08004723 VkDevice device,
4724 VkSwapchainKHR swapchain) {
4725 deviceObject := GetDevice(device)
4726 swapchainObject := GetSwapchain(swapchain)
4727 assert(swapchainObject.device == device)
4728
4729 State.Swapchains[swapchain] = null
Michael Lentine88594d72015-11-12 12:49:45 -08004730}
4731
Jesse Hall1356b0d2015-11-23 17:24:58 -08004732@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004733cmd VkResult vkGetSwapchainImagesKHR(
4734 VkDevice device,
4735 VkSwapchainKHR swapchain,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004736 u32* pSwapchainImageCount,
Michael Lentine88594d72015-11-12 12:49:45 -08004737 VkImage* pSwapchainImages) {
4738 deviceObject := GetDevice(device)
4739
4740 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004741 pSwapchainImageCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004742 swapchainImages := pSwapchainImages[0:count]
4743
4744 for i in (0 .. count) {
4745 swapchainImage := ?
4746 swapchainImages[i] = swapchainImage
Jesse Hall1356b0d2015-11-23 17:24:58 -08004747 State.Images[swapchainImage] = new!ImageObject(device: device)
Michael Lentine88594d72015-11-12 12:49:45 -08004748 }
4749
4750 return ?
4751}
4752
Jesse Hall1356b0d2015-11-23 17:24:58 -08004753@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004754cmd VkResult vkAcquireNextImageKHR(
4755 VkDevice device,
4756 VkSwapchainKHR swapchain,
4757 u64 timeout,
4758 VkSemaphore semaphore,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004759 VkFence fence,
Michael Lentine88594d72015-11-12 12:49:45 -08004760 u32* pImageIndex) {
4761 deviceObject := GetDevice(device)
4762 swapchainObject := GetSwapchain(swapchain)
4763
4764 imageIndex := ?
4765 pImageIndex[0] = imageIndex
4766
4767 return ?
4768}
4769
Jesse Hall1356b0d2015-11-23 17:24:58 -08004770@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004771cmd VkResult vkQueuePresentKHR(
4772 VkQueue queue,
4773 VkPresentInfoKHR* pPresentInfo) {
4774 queueObject := GetQueue(queue)
4775
4776 presentInfo := ?
4777 pPresentInfo[0] = presentInfo
4778
4779 return ?
4780}
4781
Jesse Hall1356b0d2015-11-23 17:24:58 -08004782@extension("VK_EXT_KHR_display")
4783cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
4784 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004785 u32* pPropertyCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004786 VkDisplayPropertiesKHR* pProperties) {
4787 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4788 return ?
4789}
4790
4791@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004792cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
4793 VkPhysicalDevice physicalDevice,
4794 u32* pPropertyCount,
4795 VkDisplayPlanePropertiesKHR* pProperties) {
4796 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4797 return ?
4798}
4799
4800@extension("VK_EXT_KHR_display")
4801cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR(
4802 VkPhysicalDevice physicalDevice,
4803 u32* pPropertyCount,
4804 VkDisplayKHR* pProperties) {
4805 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4806 return ?
4807}
4808
4809@extension("VK_EXT_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004810cmd VkResult vkGetDisplayModePropertiesKHR(
4811 VkPhysicalDevice physicalDevice,
4812 VkDisplayKHR display,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004813 u32* pPropertyCount,
4814 VkDisplayModePropertiesKHR* pProperties) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004815 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4816 return ?
4817}
4818
4819@extension("VK_EXT_KHR_display")
4820cmd VkResult vkCreateDisplayModeKHR(
4821 VkPhysicalDevice physicalDevice,
4822 VkDisplayKHR display,
4823 const VkDisplayModeCreateInfoKHR* pCreateInfo,
4824 VkDisplayModeKHR* pMode) {
4825 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4826 return ?
4827}
4828
4829@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004830cmd VkResult vkGetDisplayPlaneCapabilitiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004831 VkPhysicalDevice physicalDevice,
Jesse Halla6429252015-11-29 18:59:42 -08004832 VkDisplayModeCreateInfoKHR mode,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004833 u32 planeIndex,
Jesse Halla6429252015-11-29 18:59:42 -08004834 VkDisplayPlaneCapabilitiesKHR* pCapabilities) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004835 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4836 return ?
4837}
4838
Jesse Halla6429252015-11-29 18:59:42 -08004839@extension("VK_EXT_KHR_display")
4840cmd VkResult vkCreateDisplayPlaneSurfaceKHR(
4841 VkInstance instance,
4842 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
4843 VkSurfaceKHR* pSurface) {
4844 return ?
4845}
4846
4847@extension("VK_EXT_KHR_xlib_surface")
4848cmd VkResult vkCreateXlibSurfaceKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004849 VkInstance instance,
4850 platform.Display* dpy,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004851 platform.Window window,
4852 VkSurfaceKHR* pSurface) {
4853 instanceObject := GetInstance(instance)
4854 return ?
4855}
4856
Jesse Halla6429252015-11-29 18:59:42 -08004857@extension("VK_EXT_KHR_xlib_surface")
4858cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
4859 VkPhysicalDevice physicalDevice,
4860 u32 queueFamilyIndex,
4861 platform.Display* dpy,
4862 platform.VisualID visualId) {
4863 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4864 return ?
4865}
4866
Jesse Hall1356b0d2015-11-23 17:24:58 -08004867@extension("VK_EXT_KHR_xcb_surface")
4868cmd VkResult vkCreateXCBSurfaceKHR(
4869 VkInstance instance,
4870 platform.xcb_connection_t* connection,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004871 platform.xcb_window_t window,
4872 VkSurfaceKHR* pSurface) {
4873 instanceObject := GetInstance(instance)
4874 return ?
4875}
4876
Jesse Halla6429252015-11-29 18:59:42 -08004877@extension("VK_EXT_KHR_xlib_surface")
4878cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
4879 VkPhysicalDevice physicalDevice,
4880 u32 queueFamilyIndex,
4881 platform.xcb_connection_t* connection,
4882 platform.xcb_visualid_t visual_id) {
4883 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4884 return ?
4885}
4886
Jesse Hall1356b0d2015-11-23 17:24:58 -08004887@extension("VK_EXT_KHR_wayland_surface")
4888cmd VkResult vkCreateWaylandSurfaceKHR(
4889 VkInstance instance,
4890 platform.wl_display* display,
4891 platform.wl_surface* surface,
4892 VkSurfaceKHR* pSurface) {
4893 instanceObject := GetInstance(instance)
4894 return ?
4895}
4896
Jesse Halla6429252015-11-29 18:59:42 -08004897@extension("VK_EXT_KHR_wayland_surface")
4898cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
4899 VkPhysicalDevice physicalDevice,
4900 u32 queueFamilyIndex,
4901 platform.wl_display* display) {
4902 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4903 return ?
4904}
4905
Jesse Hall1356b0d2015-11-23 17:24:58 -08004906@extension("VK_EXT_KHR_mir_surface")
4907cmd VkResult vkCreateMirSurfaceKHR(
4908 VkInstance instance,
4909 platform.MirConnection* connection,
4910 platform.MirSurface* mirSurface,
4911 VkSurfaceKHR* pSurface) {
4912 instanceObject := GetInstance(instance)
4913 return ?
4914}
4915
Jesse Halla6429252015-11-29 18:59:42 -08004916@extension("VK_EXT_KHR_mir_surface")
4917cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR(
4918 VkPhysicalDevice physicalDevice,
4919 u32 queueFamilyIndex,
4920 platform.MirConnection* connection) {
4921 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4922 return ?
4923}
4924
Jesse Hall1356b0d2015-11-23 17:24:58 -08004925@extension("VK_EXT_KHR_android_surface")
4926cmd VkResult vkCreateAndroidSurfaceKHR(
4927 VkInstance instance,
4928 platform.ANativeWindow* window
4929 VkSurfaceKHR* pSurface) {
4930 instanceObject := GetInstance(instance)
4931 return ?
4932}
4933
4934@extension("VK_EXT_KHR_win32_surface")
4935cmd VkResult vkCreateWin32SurfaceKHR(
4936 VkInstance instance,
4937 platform.HINSTANCE hinstance,
4938 platform.HWND hwnd,
4939 VkSurfaceKHR* pSurface) {
4940 instanceObject := GetInstance(instance)
4941 return ?
4942}
4943
Jesse Halla6429252015-11-29 18:59:42 -08004944@extension("VK_EXT_KHR_win32_surface")
4945cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR(
4946 VkPhysicalDevice physicalDevice,
4947 u32 queueFamilyIndex) {
4948 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4949 return ?
4950}
4951
Jesse Halld27f6aa2015-08-15 17:58:48 -07004952
4953////////////////
4954// Validation //
4955////////////////
4956
4957extern void validate(string layerName, bool condition, string message)
4958
4959
4960/////////////////////////////
4961// Internal State Tracking //
4962/////////////////////////////
4963
4964StateObject State
4965
4966@internal class StateObject {
4967 // Dispatchable objects.
4968 map!(VkInstance, ref!InstanceObject) Instances
4969 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4970 map!(VkDevice, ref!DeviceObject) Devices
4971 map!(VkQueue, ref!QueueObject) Queues
4972 map!(VkCmdBuffer, ref!CmdBufferObject) CmdBuffers
4973
4974 // Non-dispatchable objects.
4975 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4976 map!(VkBuffer, ref!BufferObject) Buffers
4977 map!(VkBufferView, ref!BufferViewObject) BufferViews
4978 map!(VkImage, ref!ImageObject) Images
4979 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004980 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
4981 map!(VkShader, ref!ShaderObject) Shaders
4982 map!(VkPipeline, ref!PipelineObject) Pipelines
4983 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4984 map!(VkSampler, ref!SamplerObject) Samplers
4985 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4986 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4987 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004988 map!(VkFence, ref!FenceObject) Fences
4989 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4990 map!(VkEvent, ref!EventObject) Events
4991 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4992 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4993 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4994 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
4995 map!(VkCmdPool, ref!CmdPoolObject) CmdPools
Jesse Hall1356b0d2015-11-23 17:24:58 -08004996 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces
Michael Lentine88594d72015-11-12 12:49:45 -08004997 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains
Jesse Halld27f6aa2015-08-15 17:58:48 -07004998}
4999
5000@internal class InstanceObject {
5001}
5002
5003@internal class PhysicalDeviceObject {
5004 VkInstance instance
5005}
5006
5007@internal class DeviceObject {
5008 VkPhysicalDevice physicalDevice
5009}
5010
5011@internal class QueueObject {
5012 VkDevice device
5013 VkQueueFlags flags
5014}
5015
5016@internal class CmdBufferObject {
5017 VkDevice device
5018 map!(u64, VkDeviceMemory) boundObjects
5019 VkQueueFlags queueFlags
5020}
5021
5022@internal class DeviceMemoryObject {
5023 VkDevice device
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005024 VkDeviceSize allocationSize
5025 map!(u64, VkDeviceSize ) boundObjects
Jesse Halld27f6aa2015-08-15 17:58:48 -07005026 map!(VkCmdBuffer, VkCmdBuffer) boundCommandBuffers
5027}
5028
5029@internal class BufferObject {
5030 VkDevice device
5031 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005032 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005033}
5034
5035@internal class BufferViewObject {
5036 VkDevice device
5037 VkBuffer buffer
5038}
5039
5040@internal class ImageObject {
5041 VkDevice device
5042 VkDeviceMemory mem
Jesse Hall5ae3abb2015-10-08 14:00:22 -07005043 VkDeviceSize memOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005044}
5045
5046@internal class ImageViewObject {
5047 VkDevice device
5048 VkImage image
5049}
5050
Jesse Halld27f6aa2015-08-15 17:58:48 -07005051@internal class ShaderObject {
5052 VkDevice device
5053}
5054
5055@internal class ShaderModuleObject {
5056 VkDevice device
5057}
5058
5059@internal class PipelineObject {
5060 VkDevice device
5061}
5062
5063@internal class PipelineLayoutObject {
5064 VkDevice device
5065}
5066
5067@internal class SamplerObject {
5068 VkDevice device
5069}
5070
5071@internal class DescriptorSetObject {
5072 VkDevice device
5073}
5074
5075@internal class DescriptorSetLayoutObject {
5076 VkDevice device
5077}
5078
5079@internal class DescriptorPoolObject {
5080 VkDevice device
5081}
5082
Jesse Halld27f6aa2015-08-15 17:58:48 -07005083@internal class FenceObject {
5084 VkDevice device
5085 bool signaled
5086}
5087
5088@internal class SemaphoreObject {
5089 VkDevice device
5090}
5091
5092@internal class EventObject {
5093 VkDevice device
5094}
5095
5096@internal class QueryPoolObject {
5097 VkDevice device
5098}
5099
5100@internal class FramebufferObject {
5101 VkDevice device
5102}
5103
5104@internal class RenderPassObject {
5105 VkDevice device
5106}
5107
5108@internal class PipelineCacheObject {
5109 VkDevice device
5110}
5111
5112@internal class CmdPoolObject {
5113 VkDevice device
5114}
5115
Jesse Hall1356b0d2015-11-23 17:24:58 -08005116@internal class SurfaceObject {
5117 VkInstance instance
5118}
5119
Michael Lentine88594d72015-11-12 12:49:45 -08005120@internal class SwapchainObject {
5121 VkDevice device
5122}
5123
Jesse Halld27f6aa2015-08-15 17:58:48 -07005124macro ref!InstanceObject GetInstance(VkInstance instance) {
5125 assert(instance in State.Instances)
5126 return State.Instances[instance]
5127}
5128
5129macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
5130 assert(physicalDevice in State.PhysicalDevices)
5131 return State.PhysicalDevices[physicalDevice]
5132}
5133
5134macro ref!DeviceObject GetDevice(VkDevice device) {
5135 assert(device in State.Devices)
5136 return State.Devices[device]
5137}
5138
5139macro ref!QueueObject GetQueue(VkQueue queue) {
5140 assert(queue in State.Queues)
5141 return State.Queues[queue]
5142}
5143
5144macro ref!CmdBufferObject GetCmdBuffer(VkCmdBuffer cmdBuffer) {
5145 assert(cmdBuffer in State.CmdBuffers)
5146 return State.CmdBuffers[cmdBuffer]
5147}
5148
5149macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory mem) {
5150 assert(mem in State.DeviceMemories)
5151 return State.DeviceMemories[mem]
5152}
5153
5154macro ref!BufferObject GetBuffer(VkBuffer buffer) {
5155 assert(buffer in State.Buffers)
5156 return State.Buffers[buffer]
5157}
5158
5159macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
5160 assert(bufferView in State.BufferViews)
5161 return State.BufferViews[bufferView]
5162}
5163
5164macro ref!ImageObject GetImage(VkImage image) {
5165 assert(image in State.Images)
5166 return State.Images[image]
5167}
5168
5169macro ref!ImageViewObject GetImageView(VkImageView imageView) {
5170 assert(imageView in State.ImageViews)
5171 return State.ImageViews[imageView]
5172}
5173
Jesse Halld27f6aa2015-08-15 17:58:48 -07005174macro ref!ShaderObject GetShader(VkShader shader) {
5175 assert(shader in State.Shaders)
5176 return State.Shaders[shader]
5177}
5178
5179macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
5180 assert(shaderModule in State.ShaderModules)
5181 return State.ShaderModules[shaderModule]
5182}
5183
5184macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
5185 assert(pipeline in State.Pipelines)
5186 return State.Pipelines[pipeline]
5187}
5188
5189macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
5190 assert(pipelineLayout in State.PipelineLayouts)
5191 return State.PipelineLayouts[pipelineLayout]
5192}
5193
5194macro ref!SamplerObject GetSampler(VkSampler sampler) {
5195 assert(sampler in State.Samplers)
5196 return State.Samplers[sampler]
5197}
5198
5199macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
5200 assert(descriptorSet in State.DescriptorSets)
5201 return State.DescriptorSets[descriptorSet]
5202}
5203
5204macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
5205 assert(descriptorSetLayout in State.DescriptorSetLayouts)
5206 return State.DescriptorSetLayouts[descriptorSetLayout]
5207}
5208
5209macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
5210 assert(descriptorPool in State.DescriptorPools)
5211 return State.DescriptorPools[descriptorPool]
5212}
5213
Jesse Halld27f6aa2015-08-15 17:58:48 -07005214macro ref!FenceObject GetFence(VkFence fence) {
5215 assert(fence in State.Fences)
5216 return State.Fences[fence]
5217}
5218
5219macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
5220 assert(semaphore in State.Semaphores)
5221 return State.Semaphores[semaphore]
5222}
5223
5224macro ref!EventObject GetEvent(VkEvent event) {
5225 assert(event in State.Events)
5226 return State.Events[event]
5227}
5228
5229macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
5230 assert(queryPool in State.QueryPools)
5231 return State.QueryPools[queryPool]
5232}
5233
5234macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
5235 assert(framebuffer in State.Framebuffers)
5236 return State.Framebuffers[framebuffer]
5237}
5238
5239macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
5240 assert(renderPass in State.RenderPasses)
5241 return State.RenderPasses[renderPass]
5242}
5243
5244macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
5245 assert(pipelineCache in State.PipelineCaches)
5246 return State.PipelineCaches[pipelineCache]
5247}
5248
5249macro ref!CmdPoolObject GetCmdPool(VkCmdPool cmdPool) {
5250 assert(cmdPool in State.CmdPools)
5251 return State.CmdPools[cmdPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07005252}
Michael Lentine88594d72015-11-12 12:49:45 -08005253
Jesse Hall1356b0d2015-11-23 17:24:58 -08005254macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) {
5255 assert(surface in State.Surfaces)
5256 return State.Surfaces[surface]
5257}
5258
Michael Lentine88594d72015-11-12 12:49:45 -08005259macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) {
5260 assert(swapchain in State.Swapchains)
5261 return State.Swapchains[swapchain]
5262}
Jesse Halld8bade02015-11-24 10:24:18 -08005263
5264macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) {
5265 return as!VkQueueFlags(as!u32(flags) | as!u32(bit))
5266}