blob: d35e11dad047aac94a4bf0ecb8ccd1afa43197d9 [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 Hallf4ab2b12015-11-30 16:04:55 -080030define VERSION_MINOR 209
Jesse Hallae38f732015-11-19 21:32:50 -080031define VERSION_PATCH 0
Jesse Halld27f6aa2015-08-15 17:58:48 -070032
33// API limits
Jesse Hall65ab5522015-11-30 00:07:16 -080034define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256
35define VK_UUID_SIZE 16
36define VK_MAX_EXTENSION_NAME_SIZE 256
37define VK_MAX_DESCRIPTION_SIZE 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.
Jesse Halld27f6aa2015-08-15 17:58:48 -070040
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 Hallf4ab2b12015-11-30 16:04:55 -080048@extension("VK_KHR_surface") define VK_KHR_SURFACE_REVISION 24
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080049@extension("VK_KHR_surface") define VK_KHR_SURFACE_EXTENSION_NUMBER 1
50@extension("VK_KHR_surface") define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080051
Jesse Hallf4ab2b12015-11-30 16:04:55 -080052@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_REVISION 67
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080053@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_EXTENSION_NUMBER 2
54@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain"
Jesse Hall1356b0d2015-11-23 17:24:58 -080055
Jesse Hallf4ab2b12015-11-30 16:04:55 -080056@extension("VK_KHR_display") define VK_KHR_DISPLAY_REVISION 21
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080057@extension("VK_KHR_display") define VK_KHR_DISPLAY_EXTENSION_NUMBER 3
58@extension("VK_KHR_display") define VK_KHR_DISPLAY_EXTENSION_NAME "VK_KHR_display"
Jesse Hall1356b0d2015-11-23 17:24:58 -080059
Jesse Hall0e74f002015-11-30 11:37:59 -080060@extension("VK_KHR_display_swapchain") define VK_KHR_DISPLAY_SWAPCHAIN_REVISION 8
61@extension("VK_KHR_display_swapchain") define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NUMBER 4
62@extension("VK_KHR_display_swapchain") define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain"
Jesse Hall1356b0d2015-11-23 17:24:58 -080063
Jesse Hall0e74f002015-11-30 11:37:59 -080064@extension("VK_KHR_xlib_surface") define VK_KHR_XLIB_SURFACE_REVISION 5
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080065@extension("VK_KHR_xlib_surface") define VK_KHR_XLIB_SURFACE_NUMBER 5
66@extension("VK_KHR_xlib_surface") define VK_KHR_XLIB_SURFACE_NAME "VK_KHR_xlib_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080067
Jesse Hall0e74f002015-11-30 11:37:59 -080068@extension("VK_KHR_xcb_surface") define VK_KHR_XCB_SURFACE_REVISION 5
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080069@extension("VK_KHR_xcb_surface") define VK_KHR_XCB_SURFACE_NUMBER 6
70@extension("VK_KHR_xcb_surface") define VK_KHR_XCB_SURFACE_NAME "VK_KHR_xcb_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080071
Jesse Hall0e74f002015-11-30 11:37:59 -080072@extension("VK_KHR_wayland_surface") define VK_KHR_WAYLAND_SURFACE_REVISION 4
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080073@extension("VK_KHR_wayland_surface") define VK_KHR_WAYLAND_SURFACE_NUMBER 7
74@extension("VK_KHR_wayland_surface") define VK_KHR_WAYLAND_SURFACE_NAME "VK_KHR_wayland_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080075
Jesse Hall0e74f002015-11-30 11:37:59 -080076@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_REVISION 4
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080077@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_NUMBER 8
78@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_NAME "VK_KHR_mir_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080079
Jesse Hallf4ab2b12015-11-30 16:04:55 -080080@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_REVISION 4
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080081@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_NUMBER 8
82@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_NAME "VK_KHR_android_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080083
Jesse Hall0e74f002015-11-30 11:37:59 -080084@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_REVISION 4
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080085@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_NUMBER 9
86@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_NAME "VK_KHR_win32_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080087
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
Jesse Hall3fbc8562015-11-29 22:10:52 -0800103@dispatchHandle type u64 VkCommandBuffer
Jesse Halld27f6aa2015-08-15 17:58:48 -0700104
105/// Non dispatchable handle types.
106@nonDispatchHandle type u64 VkDeviceMemory
Jesse Hall3fbc8562015-11-29 22:10:52 -0800107@nonDispatchHandle type u64 VkCommandPool
Jesse Halld27f6aa2015-08-15 17:58:48 -0700108@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
Jesse Halld27f6aa2015-08-15 17:58:48 -0700113@nonDispatchHandle type u64 VkPipeline
114@nonDispatchHandle type u64 VkPipelineLayout
115@nonDispatchHandle type u64 VkSampler
116@nonDispatchHandle type u64 VkDescriptorSet
117@nonDispatchHandle type u64 VkDescriptorSetLayout
118@nonDispatchHandle type u64 VkDescriptorPool
Jesse Halld27f6aa2015-08-15 17:58:48 -0700119@nonDispatchHandle type u64 VkFence
120@nonDispatchHandle type u64 VkSemaphore
121@nonDispatchHandle type u64 VkEvent
122@nonDispatchHandle type u64 VkQueryPool
123@nonDispatchHandle type u64 VkFramebuffer
124@nonDispatchHandle type u64 VkRenderPass
125@nonDispatchHandle type u64 VkPipelineCache
Jesse Hall1356b0d2015-11-23 17:24:58 -0800126
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800127@extension("VK_KHR_surface") @nonDispatchHandle type u64 VkSurfaceKHR
Jesse Hall1356b0d2015-11-23 17:24:58 -0800128
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800129@extension("VK_KHR_swapchain") @nonDispatchHandle type u64 VkSwapchainKHR
Jesse Hall1356b0d2015-11-23 17:24:58 -0800130
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800131@extension("VK_KHR_display") @nonDispatchHandle type u64 VkDisplayKHR
132@extension("VK_KHR_display") @nonDispatchHandle type u64 VkDisplayModeKHR
Jesse Halld27f6aa2015-08-15 17:58:48 -0700133
134
135/////////////
136// Enums //
137/////////////
138
139enum VkImageLayout {
140 VK_IMAGE_LAYOUT_UNDEFINED = 0x00000000, /// Implicit layout an image is when its contents are undefined due to various reasons (e.g. right after creation)
141 VK_IMAGE_LAYOUT_GENERAL = 0x00000001, /// General layout when image can be used for any kind of access
142 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 0x00000002, /// Optimal layout when image is only used for color attachment read/write
143 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 0x00000003, /// Optimal layout when image is only used for depth/stencil attachment read/write
144 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 0x00000004, /// Optimal layout when image is used for read only depth/stencil attachment and shader access
145 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 0x00000005, /// Optimal layout when image is used for read only shader access
Jesse Hall3fbc8562015-11-29 22:10:52 -0800146 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 0x00000006, /// Optimal layout when image is used only as source of transfer operations
147 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 0x00000007, /// Optimal layout when image is used only as destination of transfer operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700148 VK_IMAGE_LAYOUT_PREINITIALIZED = 0x00000008, /// Initial layout used when the data is populated by the CPU
Jesse Hall1356b0d2015-11-23 17:24:58 -0800149
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800150 //@extension("VK_KHR_swapchain")
Jesse Hall3fbc8562015-11-29 22:10:52 -0800151 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 0xc0000802,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700152}
153
154enum VkAttachmentLoadOp {
155 VK_ATTACHMENT_LOAD_OP_LOAD = 0x00000000,
156 VK_ATTACHMENT_LOAD_OP_CLEAR = 0x00000001,
157 VK_ATTACHMENT_LOAD_OP_DONT_CARE = 0x00000002,
158}
159
160enum VkAttachmentStoreOp {
161 VK_ATTACHMENT_STORE_OP_STORE = 0x00000000,
162 VK_ATTACHMENT_STORE_OP_DONT_CARE = 0x00000001,
163}
164
165enum VkImageType {
166 VK_IMAGE_TYPE_1D = 0x00000000,
167 VK_IMAGE_TYPE_2D = 0x00000001,
168 VK_IMAGE_TYPE_3D = 0x00000002,
169}
170
171enum VkImageTiling {
Jesse Hallc7467b72015-11-29 21:05:26 -0800172 VK_IMAGE_TILING_OPTIMAL = 0x00000000,
173 VK_IMAGE_TILING_LINEAR = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700174}
175
176enum VkImageViewType {
177 VK_IMAGE_VIEW_TYPE_1D = 0x00000000,
178 VK_IMAGE_VIEW_TYPE_2D = 0x00000001,
179 VK_IMAGE_VIEW_TYPE_3D = 0x00000002,
180 VK_IMAGE_VIEW_TYPE_CUBE = 0x00000003,
181 VK_IMAGE_VIEW_TYPE_1D_ARRAY = 0x00000004,
182 VK_IMAGE_VIEW_TYPE_2D_ARRAY = 0x00000005,
183 VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 0x00000006,
184}
185
Jesse Hall3fbc8562015-11-29 22:10:52 -0800186enum VkCommandBufferLevel {
187 VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0x00000000,
188 VK_COMMAND_BUFFER_LEVEL_SECONDARY = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700189}
190
Jesse Hall65ab5522015-11-30 00:07:16 -0800191enum VkComponentSwizzle {
192 VK_COMPONENT_SWIZZLE_IDENTITY = 0x00000000,
193 VK_COMPONENT_SWIZZLE_ZERO = 0x00000001,
194 VK_COMPONENT_SWIZZLE_ONE = 0x00000002,
195 VK_COMPONENT_SWIZZLE_R = 0x00000003,
196 VK_COMPONENT_SWIZZLE_G = 0x00000004,
197 VK_COMPONENT_SWIZZLE_B = 0x00000005,
198 VK_COMPONENT_SWIZZLE_A = 0x00000006,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700199}
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 {
Jesse Hallc7467b72015-11-29 21:05:26 -0800231 VK_PIPELINE_BIND_POINT_GRAPHICS = 0x00000000,
232 VK_PIPELINE_BIND_POINT_COMPUTE = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700233}
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,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800242 VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 0x00000006,
243 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 0x00000007,
244 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 0x00000008,
245 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 0x00000009,
Jesse Hall091ed9e2015-11-30 00:55:29 -0800246 VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 0x0000000a,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700247}
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 {
Jesse Hallc7467b72015-11-29 21:05:26 -0800271 VK_SAMPLER_ADDRESS_MODE_REPEAT = 0x00000000,
272 VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 0x00000001,
273 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 0x00000002,
274 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 0x00000003,
275 VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 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,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800282 VK_COMPARE_OP_LESS_OR_EQUAL = 0x00000003,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700283 VK_COMPARE_OP_GREATER = 0x00000004,
284 VK_COMPARE_OP_NOT_EQUAL = 0x00000005,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800285 VK_COMPARE_OP_GREATER_OR_EQUAL = 0x00000006,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700286 VK_COMPARE_OP_ALWAYS = 0x00000007,
287}
288
Jesse Hall65ab5522015-11-30 00:07:16 -0800289enum VkPolygonMode {
290 VK_POLYGON_MODE_FILL = 0x00000000,
291 VK_POLYGON_MODE_LINE = 0x00000001,
292 VK_POLYGON_MODE_POINT = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700293}
294
295enum VkFrontFace {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800296 VK_FRONT_FACE_COUNTER_CLOCKWISE = 0x00000000,
297 VK_FRONT_FACE_CLOCKWISE = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700298}
299
Jesse Hall65ab5522015-11-30 00:07:16 -0800300enum VkBlendFactor {
301 VK_BLEND_FACTOR_ZERO = 0x00000000,
302 VK_BLEND_FACTOR_ONE = 0x00000001,
303 VK_BLEND_FACTOR_SRC_COLOR = 0x00000002,
304 VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 0x00000003,
305 VK_BLEND_FACTOR_DST_COLOR = 0x00000004,
306 VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 0x00000005,
307 VK_BLEND_FACTOR_SRC_ALPHA = 0x00000006,
308 VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 0x00000007,
309 VK_BLEND_FACTOR_DST_ALPHA = 0x00000008,
310 VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 0x00000009,
311 VK_BLEND_FACTOR_CONSTANT_COLOR = 0x0000000a,
312 VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 0x0000000b,
313 VK_BLEND_FACTOR_CONSTANT_ALPHA = 0x0000000c,
314 VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 0x0000000d,
315 VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 0x0000000e,
316 VK_BLEND_FACTOR_SRC1_COLOR = 0x0000000f,
317 VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 0x00000010,
318 VK_BLEND_FACTOR_SRC1_ALPHA = 0x00000011,
319 VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 0x00000012,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700320}
321
322enum VkBlendOp {
323 VK_BLEND_OP_ADD = 0x00000000,
324 VK_BLEND_OP_SUBTRACT = 0x00000001,
325 VK_BLEND_OP_REVERSE_SUBTRACT = 0x00000002,
326 VK_BLEND_OP_MIN = 0x00000003,
327 VK_BLEND_OP_MAX = 0x00000004,
328}
329
330enum VkStencilOp {
331 VK_STENCIL_OP_KEEP = 0x00000000,
332 VK_STENCIL_OP_ZERO = 0x00000001,
333 VK_STENCIL_OP_REPLACE = 0x00000002,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800334 VK_STENCIL_OP_INCREMENT_AND_CLAMP = 0x00000003,
335 VK_STENCIL_OP_DECREMENT_AND_CLAMP = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700336 VK_STENCIL_OP_INVERT = 0x00000005,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800337 VK_STENCIL_OP_INCREMENT_AND_WRAP = 0x00000006,
338 VK_STENCIL_OP_DECREMENT_AND_WRAP = 0x00000007,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700339}
340
341enum VkLogicOp {
342 VK_LOGIC_OP_CLEAR = 0x00000000,
343 VK_LOGIC_OP_AND = 0x00000001,
344 VK_LOGIC_OP_AND_REVERSE = 0x00000002,
345 VK_LOGIC_OP_COPY = 0x00000003,
346 VK_LOGIC_OP_AND_INVERTED = 0x00000004,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800347 VK_LOGIC_OP_NO_OP = 0x00000005,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700348 VK_LOGIC_OP_XOR = 0x00000006,
349 VK_LOGIC_OP_OR = 0x00000007,
350 VK_LOGIC_OP_NOR = 0x00000008,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800351 VK_LOGIC_OP_EQUIVALENT = 0x00000009,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700352 VK_LOGIC_OP_INVERT = 0x0000000a,
353 VK_LOGIC_OP_OR_REVERSE = 0x0000000b,
354 VK_LOGIC_OP_COPY_INVERTED = 0x0000000c,
355 VK_LOGIC_OP_OR_INVERTED = 0x0000000d,
356 VK_LOGIC_OP_NAND = 0x0000000e,
357 VK_LOGIC_OP_SET = 0x0000000f,
358}
359
Jesse Hall3fbc8562015-11-29 22:10:52 -0800360enum VkSystemAllocationScope {
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800361 VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0x00000000,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800362 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 0x00000001,
363 VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 0x00000002,
364 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 0x00000003,
365 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 0x00000004,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800366}
367
Jesse Hall3fbc8562015-11-29 22:10:52 -0800368enum VkInternalAllocationType {
369 VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0x00000000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700370}
371
372enum VkPhysicalDeviceType {
373 VK_PHYSICAL_DEVICE_TYPE_OTHER = 0x00000000,
374 VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 0x00000001,
375 VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 0x00000002,
376 VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 0x00000003,
377 VK_PHYSICAL_DEVICE_TYPE_CPU = 0x00000004,
378}
379
Jesse Hall65ab5522015-11-30 00:07:16 -0800380enum VkVertexInputRate {
381 VK_VERTEX_INPUT_RATE_VERTEX = 0x00000000,
382 VK_VERTEX_INPUT_RATE_INSTANCE = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700383}
384
385/// Vulkan format definitions
386enum VkFormat {
Jesse Hallf4ab2b12015-11-30 16:04:55 -0800387 VK_FORMAT_UNDEFINED = 0,
388 VK_FORMAT_R4G4_UNORM_PACK8 = 1,
389 VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2,
390 VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3,
391 VK_FORMAT_R5G6B5_UNORM_PACK16 = 4,
392 VK_FORMAT_B5G6R5_UNORM_PACK16 = 5,
393 VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6,
394 VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7,
395 VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8,
396 VK_FORMAT_R8_UNORM = 9,
397 VK_FORMAT_R8_SNORM = 10,
398 VK_FORMAT_R8_USCALED = 11,
399 VK_FORMAT_R8_SSCALED = 12,
400 VK_FORMAT_R8_UINT = 13,
401 VK_FORMAT_R8_SINT = 14,
402 VK_FORMAT_R8_SRGB = 15,
403 VK_FORMAT_R8G8_UNORM = 16,
404 VK_FORMAT_R8G8_SNORM = 17,
405 VK_FORMAT_R8G8_USCALED = 18,
406 VK_FORMAT_R8G8_SSCALED = 19,
407 VK_FORMAT_R8G8_UINT = 20,
408 VK_FORMAT_R8G8_SINT = 21,
409 VK_FORMAT_R8G8_SRGB = 22,
410 VK_FORMAT_R8G8B8_UNORM = 23,
411 VK_FORMAT_R8G8B8_SNORM = 24,
412 VK_FORMAT_R8G8B8_USCALED = 25,
413 VK_FORMAT_R8G8B8_SSCALED = 26,
414 VK_FORMAT_R8G8B8_UINT = 27,
415 VK_FORMAT_R8G8B8_SINT = 28,
416 VK_FORMAT_R8G8B8_SRGB = 29,
417 VK_FORMAT_B8G8R8_UNORM = 30,
418 VK_FORMAT_B8G8R8_SNORM = 31,
419 VK_FORMAT_B8G8R8_USCALED = 32,
420 VK_FORMAT_B8G8R8_SSCALED = 33,
421 VK_FORMAT_B8G8R8_UINT = 34,
422 VK_FORMAT_B8G8R8_SINT = 35,
423 VK_FORMAT_B8G8R8_SRGB = 36,
424 VK_FORMAT_R8G8B8A8_UNORM = 37,
425 VK_FORMAT_R8G8B8A8_SNORM = 38,
426 VK_FORMAT_R8G8B8A8_USCALED = 39,
427 VK_FORMAT_R8G8B8A8_SSCALED = 40,
428 VK_FORMAT_R8G8B8A8_UINT = 41,
429 VK_FORMAT_R8G8B8A8_SINT = 42,
430 VK_FORMAT_R8G8B8A8_SRGB = 43,
431 VK_FORMAT_B8G8R8A8_UNORM = 44,
432 VK_FORMAT_B8G8R8A8_SNORM = 45,
433 VK_FORMAT_B8G8R8A8_USCALED = 46,
434 VK_FORMAT_B8G8R8A8_SSCALED = 47,
435 VK_FORMAT_B8G8R8A8_UINT = 48,
436 VK_FORMAT_B8G8R8A8_SINT = 49,
437 VK_FORMAT_B8G8R8A8_SRGB = 50,
438 VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51,
439 VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52,
440 VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53,
441 VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54,
442 VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55,
443 VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56,
444 VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57,
445 VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58,
446 VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59,
447 VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60,
448 VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61,
449 VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62,
450 VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63,
451 VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64,
452 VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65,
453 VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66,
454 VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67,
455 VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68,
456 VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69,
457 VK_FORMAT_R16_UNORM = 70,
458 VK_FORMAT_R16_SNORM = 71,
459 VK_FORMAT_R16_USCALED = 72,
460 VK_FORMAT_R16_SSCALED = 73,
461 VK_FORMAT_R16_UINT = 74,
462 VK_FORMAT_R16_SINT = 75,
463 VK_FORMAT_R16_SFLOAT = 76,
464 VK_FORMAT_R16G16_UNORM = 77,
465 VK_FORMAT_R16G16_SNORM = 78,
466 VK_FORMAT_R16G16_USCALED = 79,
467 VK_FORMAT_R16G16_SSCALED = 80,
468 VK_FORMAT_R16G16_UINT = 81,
469 VK_FORMAT_R16G16_SINT = 82,
470 VK_FORMAT_R16G16_SFLOAT = 83,
471 VK_FORMAT_R16G16B16_UNORM = 84,
472 VK_FORMAT_R16G16B16_SNORM = 85,
473 VK_FORMAT_R16G16B16_USCALED = 86,
474 VK_FORMAT_R16G16B16_SSCALED = 87,
475 VK_FORMAT_R16G16B16_UINT = 88,
476 VK_FORMAT_R16G16B16_SINT = 89,
477 VK_FORMAT_R16G16B16_SFLOAT = 90,
478 VK_FORMAT_R16G16B16A16_UNORM = 91,
479 VK_FORMAT_R16G16B16A16_SNORM = 92,
480 VK_FORMAT_R16G16B16A16_USCALED = 93,
481 VK_FORMAT_R16G16B16A16_SSCALED = 94,
482 VK_FORMAT_R16G16B16A16_UINT = 95,
483 VK_FORMAT_R16G16B16A16_SINT = 96,
484 VK_FORMAT_R16G16B16A16_SFLOAT = 97,
485 VK_FORMAT_R32_UINT = 98,
486 VK_FORMAT_R32_SINT = 99,
487 VK_FORMAT_R32_SFLOAT = 100,
488 VK_FORMAT_R32G32_UINT = 101,
489 VK_FORMAT_R32G32_SINT = 102,
490 VK_FORMAT_R32G32_SFLOAT = 103,
491 VK_FORMAT_R32G32B32_UINT = 104,
492 VK_FORMAT_R32G32B32_SINT = 105,
493 VK_FORMAT_R32G32B32_SFLOAT = 106,
494 VK_FORMAT_R32G32B32A32_UINT = 107,
495 VK_FORMAT_R32G32B32A32_SINT = 108,
496 VK_FORMAT_R32G32B32A32_SFLOAT = 109,
497 VK_FORMAT_R64_UINT = 110,
498 VK_FORMAT_R64_SINT = 111,
499 VK_FORMAT_R64_SFLOAT = 112,
500 VK_FORMAT_R64G64_UINT = 113,
501 VK_FORMAT_R64G64_SINT = 114,
502 VK_FORMAT_R64G64_SFLOAT = 115,
503 VK_FORMAT_R64G64B64_UINT = 116,
504 VK_FORMAT_R64G64B64_SINT = 117,
505 VK_FORMAT_R64G64B64_SFLOAT = 118,
506 VK_FORMAT_R64G64B64A64_UINT = 119,
507 VK_FORMAT_R64G64B64A64_SINT = 120,
508 VK_FORMAT_R64G64B64A64_SFLOAT = 121,
509 VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122,
510 VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123,
511 VK_FORMAT_D16_UNORM = 124,
512 VK_FORMAT_X8_D24_UNORM_PACK32 = 125,
513 VK_FORMAT_D32_SFLOAT = 126,
514 VK_FORMAT_S8_UINT = 127,
515 VK_FORMAT_D16_UNORM_S8_UINT = 128,
516 VK_FORMAT_D24_UNORM_S8_UINT = 129,
517 VK_FORMAT_D32_SFLOAT_S8_UINT = 130,
518 VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131,
519 VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132,
520 VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133,
521 VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134,
522 VK_FORMAT_BC2_UNORM_BLOCK = 135,
523 VK_FORMAT_BC2_SRGB_BLOCK = 136,
524 VK_FORMAT_BC3_UNORM_BLOCK = 137,
525 VK_FORMAT_BC3_SRGB_BLOCK = 138,
526 VK_FORMAT_BC4_UNORM_BLOCK = 139,
527 VK_FORMAT_BC4_SNORM_BLOCK = 140,
528 VK_FORMAT_BC5_UNORM_BLOCK = 141,
529 VK_FORMAT_BC5_SNORM_BLOCK = 142,
530 VK_FORMAT_BC6H_UFLOAT_BLOCK = 143,
531 VK_FORMAT_BC6H_SFLOAT_BLOCK = 144,
532 VK_FORMAT_BC7_UNORM_BLOCK = 145,
533 VK_FORMAT_BC7_SRGB_BLOCK = 146,
534 VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147,
535 VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148,
536 VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149,
537 VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150,
538 VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151,
539 VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152,
540 VK_FORMAT_EAC_R11_UNORM_BLOCK = 153,
541 VK_FORMAT_EAC_R11_SNORM_BLOCK = 154,
542 VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155,
543 VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156,
544 VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157,
545 VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158,
546 VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159,
547 VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160,
548 VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161,
549 VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162,
550 VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163,
551 VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164,
552 VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165,
553 VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166,
554 VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167,
555 VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168,
556 VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169,
557 VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170,
558 VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171,
559 VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172,
560 VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173,
561 VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174,
562 VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175,
563 VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176,
564 VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177,
565 VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178,
566 VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179,
567 VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180,
568 VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181,
569 VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182,
570 VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183,
571 VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700572}
573
Jesse Halld27f6aa2015-08-15 17:58:48 -0700574/// Structure type enumerant
575enum VkStructureType {
576 VK_STRUCTURE_TYPE_APPLICATION_INFO = 0,
Jesse Hallc7467b72015-11-29 21:05:26 -0800577 VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1,
578 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2,
579 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3,
580 VK_STRUCTURE_TYPE_SUBMIT_INFO = 4,
Jesse Hallf4ab2b12015-11-30 16:04:55 -0800581 VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5,
Jesse Hallc7467b72015-11-29 21:05:26 -0800582 VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6,
583 VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7,
584 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8,
585 VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700586 VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10,
Jesse Hallc7467b72015-11-29 21:05:26 -0800587 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11,
588 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12,
589 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13,
590 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14,
591 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15,
592 VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16,
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800593 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17,
594 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18,
595 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19,
596 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20,
597 VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21,
598 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22,
599 VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23,
600 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24,
601 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25,
602 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26,
603 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27,
604 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28,
605 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29,
606 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30,
607 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31,
608 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32,
609 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33,
Jesse Hallf4ab2b12015-11-30 16:04:55 -0800610 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34,
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800611 VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35,
612 VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36,
613 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37,
614 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38,
615 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39,
Jesse Hallf4ab2b12015-11-30 16:04:55 -0800616 VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40,
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800617 VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 41,
618 VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 42,
619 VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 43,
620 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 44,
621 VK_STRUCTURE_TYPE_MEMORY_BARRIER = 45,
Jesse Hallf4ab2b12015-11-30 16:04:55 -0800622 VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 46,
623 VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 47,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800624
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800625 //@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800626 VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 0xc0000801,
627
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800628 //@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800629 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
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800632 //@extension("VK_KHR_display_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800633 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
Jesse Hall65ab5522015-11-30 00:07:16 -0800637enum VkSubpassContents {
638 VK_SUBPASS_CONTENTS_INLINE = 0x00000000,
639 VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700640}
641
Jesse Hall091ed9e2015-11-30 00:55:29 -0800642@lastUnused(-10)
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 Hall3e0dc8f2015-11-30 00:42:57 -0800653 //@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800654 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 Hall091ed9e2015-11-30 00:55:29 -0800666 VK_ERROR_TOO_MANY_OBJECTS = 0xFFFFFFF6,
Jesse Halla9e57032015-11-30 01:03:10 -0800667 VK_ERROR_FORMAT_NOT_SUPPORTED = 0xFFFFFFF5,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800668
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800669 //@extension("VK_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -0800670 VK_ERROR_SURFACE_LOST_KHR = 0xC0000400,
671
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800672 //@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800673 VK_ERROR_OUT_OF_DATE_KHR = 0xC0000804,
674
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800675 //@extension("VK_KHR_display_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800676 VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = 0xC0001002,
677
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800678 //@extension("VK_KHR_android_surface")
Jesse Hallf4ab2b12015-11-30 16:04:55 -0800679 VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = 0xC0002400,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700680}
681
682enum VkDynamicState {
683 VK_DYNAMIC_STATE_VIEWPORT = 0x00000000,
684 VK_DYNAMIC_STATE_SCISSOR = 0x00000001,
685 VK_DYNAMIC_STATE_LINE_WIDTH = 0x00000002,
686 VK_DYNAMIC_STATE_DEPTH_BIAS = 0x00000003,
687 VK_DYNAMIC_STATE_BLEND_CONSTANTS = 0x00000004,
688 VK_DYNAMIC_STATE_DEPTH_BOUNDS = 0x00000005,
689 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 0x00000006,
690 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 0x00000007,
691 VK_DYNAMIC_STATE_STENCIL_REFERENCE = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700692}
693
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800694@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -0800695enum VkPresentModeKHR {
696 VK_PRESENT_MODE_IMMEDIATE_KHR = 0x00000000,
697 VK_PRESENT_MODE_MAILBOX_KHR = 0x00000001,
698 VK_PRESENT_MODE_FIFO_KHR = 0x00000002,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800699 VK_PRESENT_MODE_FIFO_RELAXED_KHR = 0x00000003,
Michael Lentine88594d72015-11-12 12:49:45 -0800700}
701
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800702@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -0800703enum VkColorSpaceKHR {
704 VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000,
705}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700706
707/////////////////
708// Bitfields //
709/////////////////
710
Jesse Halld27f6aa2015-08-15 17:58:48 -0700711/// Queue capabilities
Jesse Halld8bade02015-11-24 10:24:18 -0800712type VkFlags VkQueueFlags
713bitfield VkQueueFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700714 VK_QUEUE_GRAPHICS_BIT = 0x00000001, /// Queue supports graphics operations
715 VK_QUEUE_COMPUTE_BIT = 0x00000002, /// Queue supports compute operations
Jesse Hall65ab5522015-11-30 00:07:16 -0800716 VK_QUEUE_TRANSFER_BIT = 0x00000004, /// Queue supports transfer operations
Jesse Hallb00daad2015-11-29 19:46:20 -0800717 VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, /// Queue supports sparse resource memory management operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700718}
719
720/// Memory properties passed into vkAllocMemory().
Jesse Halld8bade02015-11-24 10:24:18 -0800721type VkFlags VkMemoryPropertyFlags
722bitfield VkMemoryPropertyFlagBits {
Jesse Halld1af8122015-11-29 23:50:38 -0800723 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001,
724 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002,
725 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004,
726 VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008,
727 VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700728}
729
730/// Memory heap flags
Jesse Halld8bade02015-11-24 10:24:18 -0800731type VkFlags VkMemoryHeapFlags
732bitfield VkMemoryHeapFlagBits {
Jesse Halld1af8122015-11-29 23:50:38 -0800733 VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700734}
735
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800736/// Access flags
737type VkFlags VkAccessFlags
738bitfield VkAccessFlagBits {
739 VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001,
740 VK_ACCESS_INDEX_READ_BIT = 0x00000002,
741 VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004,
742 VK_ACCESS_UNIFORM_READ_BIT = 0x00000008,
743 VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010,
744 VK_ACCESS_SHADER_READ_BIT = 0x00000020,
745 VK_ACCESS_SHADER_WRITE_BIT = 0x00000040,
746 VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080,
747 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100,
748 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200,
749 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400,
750 VK_ACCESS_TRANSFER_READ_BIT = 0x00000800,
751 VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000,
752 VK_ACCESS_HOST_READ_BIT = 0x00002000,
753 VK_ACCESS_HOST_WRITE_BIT = 0x00004000,
754 VK_ACCESS_MEMORY_READ_BIT = 0x00008000,
755 VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700756}
757
758/// Buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800759type VkFlags VkBufferUsageFlags
760bitfield VkBufferUsageFlagBits {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800761 VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations
762 VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700763 VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, /// Can be used as TBO
764 VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, /// Can be used as IBO
765 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, /// Can be used as UBO
766 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, /// Can be used as SSBO
767 VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, /// Can be used as source of fixed function index fetch (index buffer)
768 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, /// Can be used as source of fixed function vertex fetch (VBO)
769 VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, /// Can be the source of indirect parameters (e.g. indirect buffer, parameter buffer)
770}
771
772/// Buffer creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800773type VkFlags VkBufferCreateFlags
774bitfield VkBufferCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700775 VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Buffer should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700776 VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Buffer should support sparse backing with partial residency
777 VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Buffer should support constent data access to physical memory blocks mapped into multiple locations of sparse buffers
778}
779
780/// Shader stage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800781type VkFlags VkShaderStageFlags
782bitfield VkShaderStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700783 VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
Jesse Hallae38f732015-11-19 21:32:50 -0800784 VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
785 VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700786 VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
787 VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
788 VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
Jesse Hallc7467b72015-11-29 21:05:26 -0800789 VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700790
791 VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
792}
793
Jesse Hallfbf97b02015-11-20 14:17:03 -0800794/// Descriptor pool create flags
Jesse Halld8bade02015-11-24 10:24:18 -0800795type VkFlags VkDescriptorPoolCreateFlags
796bitfield VkDescriptorPoolCreateFlagBits {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800797 VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
798}
799
800/// Descriptor pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -0800801type VkFlags VkDescriptorPoolResetFlags
Jesse Halla6429252015-11-29 18:59:42 -0800802//bitfield VkDescriptorPoolResetFlagBits {
803//}
Jesse Hallfbf97b02015-11-20 14:17:03 -0800804
Jesse Halld27f6aa2015-08-15 17:58:48 -0700805/// Image usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800806type VkFlags VkImageUsageFlags
807bitfield VkImageUsageFlagBits {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800808 VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations
809 VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700810 VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, /// Can be sampled from (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
811 VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, /// Can be used as storage image (STORAGE_IMAGE descriptor type)
812 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, /// Can be used as framebuffer color attachment
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700813 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment
Jesse Halld27f6aa2015-08-15 17:58:48 -0700814 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering
815 VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment
816}
817
818/// Image creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800819type VkFlags VkImageCreateFlags
820bitfield VkImageCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700821 VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Image should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700822 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Image should support sparse backing with partial residency
823 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 -0700824 VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, /// Allows image views to have different format than the base image
825 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 -0700826}
827
Jesse Hallb00daad2015-11-29 19:46:20 -0800828/// Image view creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800829type VkFlags VkImageViewCreateFlags
Jesse Hallb00daad2015-11-29 19:46:20 -0800830//bitfield VkImageViewCreateFlagBits {
831//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700832
833/// Pipeline creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800834type VkFlags VkPipelineCreateFlags
835bitfield VkPipelineCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700836 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
837 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
838 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
839}
840
Jesse Hall65ab5522015-11-30 00:07:16 -0800841/// Color component flags
842type VkFlags VkColorComponentFlags
843bitfield VkColorComponentFlagBits {
844 VK_COLOR_COMPONENT_R_BIT = 0x00000001,
845 VK_COLOR_COMPONENT_G_BIT = 0x00000002,
846 VK_COLOR_COMPONENT_B_BIT = 0x00000004,
847 VK_COLOR_COMPONENT_A_BIT = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700848}
849
850/// Fence creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800851type VkFlags VkFenceCreateFlags
852bitfield VkFenceCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700853 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
854}
855
856/// Semaphore creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800857type VkFlags VkSemaphoreCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800858//bitfield VkSemaphoreCreateFlagBits {
859//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700860
861/// Format capability flags
Jesse Halld8bade02015-11-24 10:24:18 -0800862type VkFlags VkFormatFeatureFlags
863bitfield VkFormatFeatureFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700864 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
865 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type)
866 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images
867 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs)
868 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs)
869 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers
870 VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs)
871 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images
872 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images
873 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images
Jesse Hall3fbc8562015-11-29 22:10:52 -0800874 VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCommandBlitImage
875 VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, /// Format can be used as the destination image of blits with vkCommandBlitImage
Jesse Halld27f6aa2015-08-15 17:58:48 -0700876}
877
878/// Query control flags
Jesse Halld8bade02015-11-24 10:24:18 -0800879type VkFlags VkQueryControlFlags
880bitfield VkQueryControlFlagBits {
Jesse Hall65ab5522015-11-30 00:07:16 -0800881 VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700882}
883
884/// Query result flags
Jesse Halld8bade02015-11-24 10:24:18 -0800885type VkFlags VkQueryResultFlags
886bitfield VkQueryResultFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700887 VK_QUERY_RESULT_DEFAULT = 0x00000000, /// Results of the queries are immediately written to the destination buffer as 32-bit values
888 VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values
889 VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy
890 VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written
891 VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available
892}
893
894/// Shader module creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800895type VkFlags VkShaderModuleCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800896//bitfield VkShaderModuleCreateFlagBits {
897//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700898
Jesse Halld27f6aa2015-08-15 17:58:48 -0700899/// Event creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800900type VkFlags VkEventCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800901//bitfield VkEventCreateFlagBits {
902//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700903
Jesse Halla15a4bf2015-11-19 22:48:02 -0800904/// Command buffer usage flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800905type VkFlags VkCommandBufferUsageFlags
906bitfield VkCommandBufferUsageFlagBits {
907 VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
908 VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
909 VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700910}
911
912/// Pipeline statistics flags
Jesse Halld8bade02015-11-24 10:24:18 -0800913type VkFlags VkQueryPipelineStatisticFlags
914bitfield VkQueryPipelineStatisticFlagBits {
Jesse Hallae38f732015-11-19 21:32:50 -0800915 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, /// Optional
916 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, /// Optional
917 VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, /// Optional
918 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, /// Optional
919 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, /// Optional
920 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, /// Optional
921 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, /// Optional
922 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, /// Optional
923 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, /// Optional
924 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, /// Optional
925 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, /// Optional
Jesse Halld27f6aa2015-08-15 17:58:48 -0700926}
927
928/// Memory mapping flags
Jesse Halld8bade02015-11-24 10:24:18 -0800929type VkFlags VkMemoryMapFlags
Jesse Halla6429252015-11-29 18:59:42 -0800930//bitfield VkMemoryMapFlagBits {
931//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700932
933/// Bitfield of image aspects
Jesse Halld8bade02015-11-24 10:24:18 -0800934type VkFlags VkImageAspectFlags
935bitfield VkImageAspectFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700936 VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
937 VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
938 VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
939 VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
940}
941
942/// Sparse memory bind flags
Jesse Halld8bade02015-11-24 10:24:18 -0800943type VkFlags VkSparseMemoryBindFlags
Jesse Hall091ed9e2015-11-30 00:55:29 -0800944bitfield VkSparseMemoryBindFlagBits {
945 VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001,
946}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700947
948/// Sparse image memory requirements flags
Jesse Halld8bade02015-11-24 10:24:18 -0800949type VkFlags VkSparseImageFormatFlags
950bitfield VkSparseImageFormatFlagBits {
Jesse Hallb00daad2015-11-29 19:46:20 -0800951 VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices
952 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.
953 VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size
Jesse Halld27f6aa2015-08-15 17:58:48 -0700954}
955
956/// Pipeline stages
Jesse Halld8bade02015-11-24 10:24:18 -0800957type VkFlags VkPipelineStageFlags
958bitfield VkPipelineStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700959 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed
960 VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch
961 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch
962 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading
Jesse Hallae38f732015-11-19 21:32:50 -0800963 VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading
964 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading
Jesse Halld27f6aa2015-08-15 17:58:48 -0700965 VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading
966 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading
967 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests
968 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests
969 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes
970 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading
971 VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700972 VK_PIPELINE_STAGE_HOST_BIT = 0x00002000, /// Indicates host (CPU) is a source/sink of the dependency
Jesse Halld27f6aa2015-08-15 17:58:48 -0700973
Jesse Hall091ed9e2015-11-30 00:55:29 -0800974 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00004000, /// All stages of the graphics pipeline
975 VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00008000, /// All graphics, compute, copy, and transition commands
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700976}
977
978/// Render pass attachment description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800979type VkFlags VkAttachmentDescriptionFlags
980bitfield VkAttachmentDescriptionFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700981 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 -0700982}
983
984/// Subpass description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800985type VkFlags VkSubpassDescriptionFlags
986bitfield VkSubpassDescriptionFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700987}
988
989/// Command pool creation flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800990type VkFlags VkCommandPoolCreateFlags
991bitfield VkCommandPoolCreateFlagBits {
992 VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime
993 VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually
Jesse Halld27f6aa2015-08-15 17:58:48 -0700994}
995
996/// Command pool reset flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800997type VkFlags VkCommandPoolResetFlags
998bitfield VkCommandPoolResetFlagBits {
999 VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool
Jesse Halld27f6aa2015-08-15 17:58:48 -07001000}
1001
Jesse Hall3fbc8562015-11-29 22:10:52 -08001002type VkFlags VkCommandBufferResetFlags
1003bitfield VkCommandBufferResetFlagBits {
1004 VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001005}
1006
Jesse Halld8bade02015-11-24 10:24:18 -08001007type VkFlags VkSampleCountFlags
1008bitfield VkSampleCountFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001009 VK_SAMPLE_COUNT_1_BIT = 0x00000001,
1010 VK_SAMPLE_COUNT_2_BIT = 0x00000002,
1011 VK_SAMPLE_COUNT_4_BIT = 0x00000004,
1012 VK_SAMPLE_COUNT_8_BIT = 0x00000008,
1013 VK_SAMPLE_COUNT_16_BIT = 0x00000010,
1014 VK_SAMPLE_COUNT_32_BIT = 0x00000020,
1015 VK_SAMPLE_COUNT_64_BIT = 0x00000040,
1016}
1017
Jesse Halld8bade02015-11-24 10:24:18 -08001018type VkFlags VkStencilFaceFlags
1019bitfield VkStencilFaceFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001020 VK_STENCIL_FACE_NONE = 0x00000000, /// No faces
1021 VK_STENCIL_FACE_FRONT_BIT = 0x00000001, /// Front face
1022 VK_STENCIL_FACE_BACK_BIT = 0x00000002, /// Back face
Jesse Hallc7467b72015-11-29 21:05:26 -08001023 VK_STENCIL_FRONT_AND_BACK = 0x00000003,
Jesse Halld27f6aa2015-08-15 17:58:48 -07001024}
1025
Jesse Halla6429252015-11-29 18:59:42 -08001026/// Instance creation flags
1027type VkFlags VkInstanceCreateFlags
1028//bitfield VkInstanceCreateFlagBits {
1029//}
1030
1031/// Device creation flags
1032type VkFlags VkDeviceCreateFlags
1033//bitfield VkDeviceCreateFlagBits {
1034//}
1035
1036/// Device queue creation flags
1037type VkFlags VkDeviceQueueCreateFlags
1038//bitfield VkDeviceQueueCreateFlagBits {
1039//}
1040
1041/// Query pool creation flags
1042type VkFlags VkQueryPoolCreateFlags
1043//bitfield VkQueryPoolCreateFlagBits {
1044//}
1045
1046/// Buffer view creation flags
1047type VkFlags VkBufferViewCreateFlags
1048//bitfield VkBufferViewCreateFlagBits {
1049//}
1050
1051/// Pipeline cache creation flags
1052type VkFlags VkPipelineCacheCreateFlags
1053//bitfield VkPipelineCacheCreateFlagBits {
1054//}
1055
1056/// Pipeline shader stage creation flags
1057type VkFlags VkPipelineShaderStageCreateFlags
1058//bitfield VkPipelineShaderStageCreateFlagBits {
1059//}
1060
1061/// Descriptor set layout creation flags
1062type VkFlags VkDescriptorSetLayoutCreateFlags
1063//bitfield VkDescriptorSetLayoutCreateFlagBits {
1064//}
1065
1066/// Pipeline vertex input state creation flags
1067type VkFlags VkPipelineVertexInputStateCreateFlags
1068//bitfield VkPipelineVertexInputStateCreateFlagBits {
1069//}
1070
1071/// Pipeline input assembly state creation flags
1072type VkFlags VkPipelineInputAssemblyStateCreateFlags
1073//bitfield VkPipelineInputAssemblyStateCreateFlagBits {
1074//}
1075
1076/// Tessellation state creation flags
1077type VkFlags VkPipelineTessellationStateCreateFlags
1078//bitfield VkPipelineTessellationStateCreateFlagBits {
1079//}
1080
1081/// Viewport state creation flags
1082type VkFlags VkPipelineViewportStateCreateFlags
1083//bitfield VkPipelineViewportStateCreateFlagBits {
1084//}
1085
Jesse Hall3fbc8562015-11-29 22:10:52 -08001086/// Rasterization state creation flags
1087type VkFlags VkPipelineRasterizationStateCreateFlags
1088//bitfield VkPipelineRasterizationStateCreateFlagBits {
Jesse Halla6429252015-11-29 18:59:42 -08001089//}
1090
1091/// Multisample state creation flags
1092type VkFlags VkPipelineMultisampleStateCreateFlags
1093//bitfield VkPipelineMultisampleStateCreateFlagBits {
1094//}
1095
1096/// Color blend state creation flags
1097type VkFlags VkPipelineColorBlendStateCreateFlags
1098//bitfield VkPipelineColorBlendStateCreateFlagBits {
1099//}
1100
1101/// Depth/stencil state creation flags
1102type VkFlags VkPipelineDepthStencilStateCreateFlags
1103//bitfield VkPipelineDepthStencilStateCreateFlagBits {
1104//}
1105
1106/// Dynamic state creation flags
1107type VkFlags VkPipelineDynamicStateCreateFlags
1108//bitfield VkPipelineDynamicStateCreateFlagBits {
1109//}
1110
1111/// Pipeline layout creation flags
1112type VkFlags VkPipelineLayoutCreateFlags
1113//bitfield VkPipelineLayoutCreateFlagBits {
1114//}
1115
1116/// Sampler creation flags
1117type VkFlags VkSamplerCreateFlags
1118//bitfield VkSamplerCreateFlagBits {
1119//}
1120
1121/// Render pass creation flags
1122type VkFlags VkRenderPassCreateFlags
1123//bitfield VkRenderPassCreateFlagBits {
1124//}
1125
1126/// Framebuffer creation flags
1127type VkFlags VkFramebufferCreateFlags
1128//bitfield VkFramebufferCreateFlagBits {
1129//}
1130
Jesse Halldc6d36c2015-11-29 19:12:15 -08001131/// Dependency flags
1132type VkFlags VkDependencyFlags
1133bitfield VkDependencyFlagBits {
1134 VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
1135}
1136
Jesse Hallc7467b72015-11-29 21:05:26 -08001137/// Cull mode flags
1138type VkFlags VkCullModeFlags
1139bitfield VkCullModeFlagBits {
1140 VK_CULL_MODE_NONE = 0x00000000,
1141 VK_CULL_MODE_FRONT_BIT = 0x00000001,
1142 VK_CULL_MODE_BACK_BIT = 0x00000002,
1143 VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
1144}
1145
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001146@extension("VK_KHR_swapchain")
Jesse Halld8bade02015-11-24 10:24:18 -08001147type VkFlags VkSurfaceTransformFlagsKHR
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001148@extension("VK_KHR_swapchain")
Jesse Halld8bade02015-11-24 10:24:18 -08001149bitfield VkSurfaceTransformFlagBitsKHR {
Michael Lentine88594d72015-11-12 12:49:45 -08001150 VK_SURFACE_TRANSFORM_NONE_BIT_KHR = 0x00000001,
1151 VK_SURFACE_TRANSFORM_ROT90_BIT_KHR = 0x00000002,
1152 VK_SURFACE_TRANSFORM_ROT180_BIT_KHR = 0x00000004,
1153 VK_SURFACE_TRANSFORM_ROT270_BIT_KHR = 0x00000008,
1154 VK_SURFACE_TRANSFORM_HMIRROR_BIT_KHR = 0x00000010,
1155 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_BIT_KHR = 0x00000020,
1156 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_BIT_KHR = 0x00000040,
1157 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_BIT_KHR = 0x00000080,
1158 VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
1159}
Jesse Halld27f6aa2015-08-15 17:58:48 -07001160
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001161@extension("VK_KHR_swapchain")
Jesse Halla6429252015-11-29 18:59:42 -08001162type VkFlags VkCompositeAlphaFlagsKHR
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001163@extension("VK_KHR_swapchain")
Jesse Halla6429252015-11-29 18:59:42 -08001164bitfield VkCompositeAlphaFlagBitsKHR {
1165 VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
1166 VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
1167 VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
1168 VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
1169}
1170
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001171@extension("VK_KHR_swapchain")
1172type VkFlags VkSwapchainCreateFlagsKHR
1173//@extension("VK_KHR_swapchain")
1174//bitfield VkSwapchainCreateFlagBitsKHR {
1175//}
1176
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001177@extension("VK_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001178type VkFlags VkDisplayPlaneAlphaFlagsKHR
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001179@extension("VK_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001180bitfield VkDisplayPlaneAlphaFlagBitsKHR {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001181 VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
1182 VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002,
1183 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004,
1184 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008,
Jesse Hall1356b0d2015-11-23 17:24:58 -08001185}
1186
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001187@extension("VK_KHR_display")
1188type VkFlags VkDisplaySurfaceCreateFlagsKHR
1189//@extension("VK_KHR_display")
1190//bitfield VkDisplaySurfaceCreateFlagBitsKHR {
1191//}
1192
Jesse Hall1356b0d2015-11-23 17:24:58 -08001193
Jesse Halld27f6aa2015-08-15 17:58:48 -07001194//////////////////
1195// Structures //
1196//////////////////
1197
1198class VkOffset2D {
1199 s32 x
1200 s32 y
1201}
1202
1203class VkOffset3D {
1204 s32 x
1205 s32 y
1206 s32 z
1207}
1208
1209class VkExtent2D {
1210 s32 width
1211 s32 height
1212}
1213
1214class VkExtent3D {
1215 s32 width
1216 s32 height
1217 s32 depth
1218}
1219
1220class VkViewport {
Jesse Hall65ab5522015-11-30 00:07:16 -08001221 f32 x
1222 f32 y
Jesse Halld27f6aa2015-08-15 17:58:48 -07001223 f32 width
1224 f32 height
1225 f32 minDepth
1226 f32 maxDepth
1227}
1228
1229class VkRect2D {
1230 VkOffset2D offset
1231 VkExtent2D extent
1232}
1233
Jesse Halla15a4bf2015-11-19 22:48:02 -08001234class VkClearRect {
1235 VkRect2D rect
1236 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001237 u32 layerCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001238}
1239
Jesse Hall65ab5522015-11-30 00:07:16 -08001240class VkComponentMapping {
1241 VkComponentSwizzle r
1242 VkComponentSwizzle g
1243 VkComponentSwizzle b
1244 VkComponentSwizzle a
Jesse Halld27f6aa2015-08-15 17:58:48 -07001245}
1246
1247class VkPhysicalDeviceProperties {
1248 u32 apiVersion
1249 u32 driverVersion
Jesse Hall65ab5522015-11-30 00:07:16 -08001250 u32 vendorID
1251 u32 deviceID
Jesse Halld27f6aa2015-08-15 17:58:48 -07001252 VkPhysicalDeviceType deviceType
Jesse Hall65ab5522015-11-30 00:07:16 -08001253 char[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE] deviceName
1254 u8[VK_UUID_SIZE] pipelineCacheUUID
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001255 VkPhysicalDeviceLimits limits
1256 VkPhysicalDeviceSparseProperties sparseProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001257}
1258
1259class VkExtensionProperties {
Jesse Hall65ab5522015-11-30 00:07:16 -08001260 char[VK_MAX_EXTENSION_NAME_SIZE] extensionName /// extension name
Jesse Halld27f6aa2015-08-15 17:58:48 -07001261 u32 specVersion /// version of the extension specification implemented
1262}
1263
1264class VkLayerProperties {
Jesse Hall65ab5522015-11-30 00:07:16 -08001265 char[VK_MAX_EXTENSION_NAME_SIZE] layerName /// layer name
Jesse Hall3fbc8562015-11-29 22:10:52 -08001266 u32 specVersion /// version of the layer specification implemented
1267 u32 implementationVersion /// build or release version of the layer's library
Jesse Hall65ab5522015-11-30 00:07:16 -08001268 char[VK_MAX_DESCRIPTION_SIZE] description /// Free-form description of the layer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001269}
1270
Jesse Halla366a512015-11-19 22:30:07 -08001271class VkSubmitInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001272 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_SUBMIT_INFO
1273 const void* pNext /// Next structure in chain
1274 u32 waitSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001275 const VkSemaphore* pWaitSemaphores
Jesse Hall03b6fe12015-11-24 12:44:21 -08001276 u32 commandBufferCount
Jesse Hall3fbc8562015-11-29 22:10:52 -08001277 const VkCommandBuffer* pCommandBuffers
Jesse Hall03b6fe12015-11-24 12:44:21 -08001278 u32 signalSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001279 const VkSemaphore* pSignalSemaphores
1280}
1281
Jesse Halld27f6aa2015-08-15 17:58:48 -07001282class VkApplicationInfo {
1283 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO
1284 const void* pNext /// Next structure in chain
Jesse Hall3fbc8562015-11-29 22:10:52 -08001285 const char* pApplicationName
1286 u32 applicationVersion
Jesse Halld27f6aa2015-08-15 17:58:48 -07001287 const char* pEngineName
1288 u32 engineVersion
1289 u32 apiVersion
1290}
1291
Jesse Hall3fbc8562015-11-29 22:10:52 -08001292class VkAllocationCallbacks {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001293 void* pUserData
Jesse Hall3fbc8562015-11-29 22:10:52 -08001294 PFN_vkAllocationFunction pfnAllocation
1295 PFN_vkReallocationFunction pfnReallocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001296 PFN_vkFreeFunction pfnFree
Jesse Hall3fbc8562015-11-29 22:10:52 -08001297 PFN_vkInternalAllocationNotification pfnInternalAllocation
Jesse Hall03b6fe12015-11-24 12:44:21 -08001298 PFN_vkInternalFreeNotification pfnInternalFree
Jesse Halld27f6aa2015-08-15 17:58:48 -07001299}
1300
1301class VkDeviceQueueCreateInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001302 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
1303 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001304 VkDeviceQueueCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001305 u32 queueFamilyIndex
Jesse Halldba27f72015-11-30 14:25:46 -08001306 u32 queueCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001307 const f32* pQueuePriorities
Jesse Halld27f6aa2015-08-15 17:58:48 -07001308}
1309
1310class VkDeviceCreateInfo {
1311 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
1312 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001313 VkDeviceCreateFlags flags
Jesse Halldba27f72015-11-30 14:25:46 -08001314 u32 queueCreateInfoCount
1315 const VkDeviceQueueCreateInfo* pQueueCreateInfos
Jesse Hall03b6fe12015-11-24 12:44:21 -08001316 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001317 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001318 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001319 const char* const* ppEnabledExtensionNames
1320 const VkPhysicalDeviceFeatures* pEnabledFeatures
Jesse Halld27f6aa2015-08-15 17:58:48 -07001321}
1322
1323class VkInstanceCreateInfo {
1324 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
1325 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001326 VkInstanceCreateFlags flags
Jesse Hall3fbc8562015-11-29 22:10:52 -08001327 const VkApplicationInfo* pApplicationInfo
Jesse Hall03b6fe12015-11-24 12:44:21 -08001328 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001329 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001330 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001331 const char* const* ppEnabledExtensionNames /// Extension names to be enabled
1332}
1333
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001334class VkQueueFamilyProperties {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001335 VkQueueFlags queueFlags /// Queue flags
1336 u32 queueCount
Jesse Hallacfa5342015-11-19 21:51:33 -08001337 u32 timestampValidBits
Jesse Hall65ab5522015-11-30 00:07:16 -08001338 VkExtent3D minImageTransferGranularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07001339}
1340
1341class VkPhysicalDeviceMemoryProperties {
1342 u32 memoryTypeCount
1343 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes
1344 u32 memoryHeapCount
1345 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps
1346}
1347
Jesse Hall3fbc8562015-11-29 22:10:52 -08001348class VkMemoryAllocateInfo {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001349 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001350 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001351 VkDeviceSize allocationSize /// Size of memory allocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001352 u32 memoryTypeIndex /// Index of the of the memory type to allocate from
1353}
1354
1355class VkMemoryRequirements {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001356 VkDeviceSize size /// Specified in bytes
1357 VkDeviceSize alignment /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001358 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object
1359}
1360
1361class VkSparseImageFormatProperties {
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001362 VkImageAspectFlagBits aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001363 VkExtent3D imageGranularity
1364 VkSparseImageFormatFlags flags
1365}
1366
1367class VkSparseImageMemoryRequirements {
Jesse Hallb00daad2015-11-29 19:46:20 -08001368 VkSparseImageFormatProperties formatProperties
Jesse Hall65ab5522015-11-30 00:07:16 -08001369 u32 imageMipTailStartLod
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001370 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment
1371 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment
1372 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07001373}
1374
1375class VkMemoryType {
1376 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type
1377 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from
1378}
1379
1380class VkMemoryHeap {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001381 VkDeviceSize size /// Available memory in the heap
Jesse Halld27f6aa2015-08-15 17:58:48 -07001382 VkMemoryHeapFlags flags /// Flags for the heap
1383}
1384
1385class VkMappedMemoryRange {
1386 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
1387 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001388 VkDeviceMemory memory /// Mapped memory object
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001389 VkDeviceSize offset /// Offset within the mapped memory the range starts from
1390 VkDeviceSize size /// Size of the range within the mapped memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07001391}
1392
1393class VkFormatProperties {
1394 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling
1395 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001396 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001397}
1398
1399class VkImageFormatProperties {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001400 VkExtent3D maxExtent /// max image dimensions for this resource type
1401 u32 maxMipLevels /// max number of mipmap levels for this resource type
Jesse Halla15a4bf2015-11-19 22:48:02 -08001402 u32 maxArrayLayers /// max array layers for this resource type
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001403 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type
1404 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type
1405}
1406
Jesse Halla15a4bf2015-11-19 22:48:02 -08001407class VkDescriptorImageInfo {
1408 VkSampler sampler
1409 VkImageView imageView
1410 VkImageLayout imageLayout
1411}
1412
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001413class VkDescriptorBufferInfo {
1414 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC]
1415 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set.
1416 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001417}
1418
Jesse Halld27f6aa2015-08-15 17:58:48 -07001419class VkWriteDescriptorSet {
1420 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
1421 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001422 VkDescriptorSet dstSet /// Destination descriptor set
1423 u32 dstBinding /// Binding within the destination descriptor set to write
1424 u32 dstArrayElement /// Array element within the destination binding to write
Jesse Hall03b6fe12015-11-24 12:44:21 -08001425 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001426 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 -08001427 const VkDescriptorImageInfo* pImageInfo
1428 const VkDescriptorBufferInfo* pBufferInfo
1429 const VkBufferView* pTexelBufferView
Jesse Halld27f6aa2015-08-15 17:58:48 -07001430}
1431
1432class VkCopyDescriptorSet {
1433 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
1434 const void* pNext /// Pointer to next structure
1435 VkDescriptorSet srcSet /// Source descriptor set
1436 u32 srcBinding /// Binding within the source descriptor set to copy from
1437 u32 srcArrayElement /// Array element within the source binding to copy from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001438 VkDescriptorSet dstSet /// Destination descriptor set
1439 u32 dstBinding /// Binding within the destination descriptor set to copy to
1440 u32 dstArrayElement /// Array element within the destination binding to copy to
Jesse Hall03b6fe12015-11-24 12:44:21 -08001441 u32 descriptorCount /// Number of descriptors to copy
Jesse Halld27f6aa2015-08-15 17:58:48 -07001442}
1443
1444class VkBufferCreateInfo {
1445 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
1446 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001447 VkBufferCreateFlags flags /// Buffer creation flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001448 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001449 VkBufferUsageFlags usage /// Buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001450 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001451 u32 queueFamilyIndexCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001452 const u32* pQueueFamilyIndices
1453}
1454
1455class VkBufferViewCreateInfo {
1456 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
1457 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001458 VkBufferViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001459 VkBuffer buffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001460 VkFormat format /// Optionally specifies format of elements
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001461 VkDeviceSize offset /// Specified in bytes
1462 VkDeviceSize range /// View size specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001463}
1464
1465class VkImageSubresource {
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001466 VkImageAspectFlagBits aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001467 u32 mipLevel
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001468 u32 arrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001469}
1470
1471class VkImageSubresourceRange {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001472 VkImageAspectFlags aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001473 u32 baseMipLevel
Jesse Hall3fbc8562015-11-29 22:10:52 -08001474 u32 levelCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001475 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001476 u32 layerCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001477}
1478
1479class VkMemoryBarrier {
1480 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER
1481 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001482 VkAccessFlags srcAccessMask
1483 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001484}
1485
1486class VkBufferMemoryBarrier {
1487 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
1488 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001489 VkAccessFlags srcAccessMask
1490 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001491 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001492 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001493 VkBuffer buffer /// Buffer to sync
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001494 VkDeviceSize offset /// Offset within the buffer to sync
1495 VkDeviceSize size /// Amount of bytes to sync
Jesse Halld27f6aa2015-08-15 17:58:48 -07001496}
1497
1498class VkImageMemoryBarrier {
1499 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
1500 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001501 VkAccessFlags srcAccessMask
1502 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001503 VkImageLayout oldLayout /// Current layout of the image
1504 VkImageLayout newLayout /// New layout to transition the image to
1505 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001506 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001507 VkImage image /// Image to sync
1508 VkImageSubresourceRange subresourceRange /// Subresource range to sync
1509}
1510
1511class VkImageCreateInfo {
1512 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
1513 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001514 VkImageCreateFlags flags /// Image creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001515 VkImageType imageType
1516 VkFormat format
1517 VkExtent3D extent
1518 u32 mipLevels
Jesse Halla15a4bf2015-11-19 22:48:02 -08001519 u32 arrayLayers
Jesse Hall091ed9e2015-11-30 00:55:29 -08001520 VkSampleCountFlagBits samples
Jesse Halld27f6aa2015-08-15 17:58:48 -07001521 VkImageTiling tiling
1522 VkImageUsageFlags usage /// Image usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001523 VkSharingMode sharingMode /// Cross-queue-family sharing mode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001524 u32 queueFamilyIndexCount /// Number of queue families to share across
Jesse Halld27f6aa2015-08-15 17:58:48 -07001525 const u32* pQueueFamilyIndices /// Array of queue family indices to share across
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001526 VkImageLayout initialLayout /// Initial image layout for all subresources
Jesse Halld27f6aa2015-08-15 17:58:48 -07001527}
1528
1529class VkSubresourceLayout {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001530 VkDeviceSize offset /// Specified in bytes
1531 VkDeviceSize size /// Specified in bytes
1532 VkDeviceSize rowPitch /// Specified in bytes
1533 VkDeviceSize depthPitch /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001534}
1535
1536class VkImageViewCreateInfo {
1537 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
1538 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001539 VkImageViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001540 VkImage image
1541 VkImageViewType viewType
1542 VkFormat format
Jesse Hall65ab5522015-11-30 00:07:16 -08001543 VkComponentMapping components
Jesse Halld27f6aa2015-08-15 17:58:48 -07001544 VkImageSubresourceRange subresourceRange
Jesse Halld27f6aa2015-08-15 17:58:48 -07001545}
1546
1547class VkBufferCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001548 VkDeviceSize srcOffset /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001549 VkDeviceSize dstOffset /// Specified in bytes
Jesse Hallb00daad2015-11-29 19:46:20 -08001550 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001551}
1552
Jesse Halla6429252015-11-29 18:59:42 -08001553class VkSparseMemoryBind {
Jesse Hallb00daad2015-11-29 19:46:20 -08001554 VkDeviceSize resourceOffset /// Specified in bytes
1555 VkDeviceSize size /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001556 VkDeviceMemory memory
1557 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001558 VkSparseMemoryBindFlags flags
1559}
1560
Jesse Halla6429252015-11-29 18:59:42 -08001561class VkSparseImageMemoryBind {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001562 VkImageSubresource subresource
1563 VkOffset3D offset
1564 VkExtent3D extent
Jesse Hall3fbc8562015-11-29 22:10:52 -08001565 VkDeviceMemory memory
1566 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001567 VkSparseMemoryBindFlags flags
1568}
1569
Jesse Halla6429252015-11-29 18:59:42 -08001570class VkSparseBufferMemoryBindInfo {
1571 VkBuffer buffer
1572 u32 bindCount
1573 const VkSparseMemoryBind* pBinds
1574}
1575
1576class VkSparseImageOpaqueMemoryBindInfo {
1577 VkImage image
1578 u32 bindCount
1579 const VkSparseMemoryBind* pBinds
1580}
1581
1582class VkSparseImageMemoryBindInfo {
1583 VkImage image
1584 u32 bindCount
1585 const VkSparseMemoryBind* pBinds
1586}
1587
1588class VkBindSparseInfo {
1589 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
1590 const void* pNext
1591 u32 waitSemaphoreCount
1592 const VkSemaphore* pWaitSemaphores
1593 u32 numBufferBinds
1594 const VkSparseBufferMemoryBindInfo* pBufferBinds
1595 u32 numImageOpaqueBinds
1596 const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds
1597 u32 numImageBinds
1598 const VkSparseImageMemoryBindInfo* pImageBinds
1599 u32 signalSemaphoreCount
1600 const VkSemaphore* pSignalSemaphores
1601}
1602
Jesse Hall65ab5522015-11-30 00:07:16 -08001603class VkImageSubresourceLayers {
1604 VkImageAspectFlags aspectMask
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001605 u32 mipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001606 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001607 u32 layerCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001608}
1609
Jesse Halld27f6aa2015-08-15 17:58:48 -07001610class VkImageCopy {
Jesse Hall65ab5522015-11-30 00:07:16 -08001611 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001612 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Hall65ab5522015-11-30 00:07:16 -08001613 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001614 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001615 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images
1616}
1617
1618class VkImageBlit {
Jesse Hall65ab5522015-11-30 00:07:16 -08001619 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001620 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
1621 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Hall65ab5522015-11-30 00:07:16 -08001622 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001623 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
1624 VkExtent3D dstExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001625}
1626
1627class VkBufferImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001628 VkDeviceSize bufferOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001629 u32 bufferRowLength /// Specified in texels
1630 u32 bufferImageHeight
Jesse Hall65ab5522015-11-30 00:07:16 -08001631 VkImageSubresourceLayers imageSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001632 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images
1633 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images
1634}
1635
1636class VkImageResolve {
Jesse Hall65ab5522015-11-30 00:07:16 -08001637 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001638 VkOffset3D srcOffset
Jesse Hall65ab5522015-11-30 00:07:16 -08001639 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001640 VkOffset3D dstOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07001641 VkExtent3D extent
1642}
1643
1644class VkShaderModuleCreateInfo {
1645 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
1646 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001647 VkShaderModuleCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001648 platform.size_t codeSize /// Specified in bytes
Jesse Halla9bb62b2015-11-21 19:31:56 -08001649 const u32* pCode /// Binary code of size codeSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07001650}
1651
Jesse Halld27f6aa2015-08-15 17:58:48 -07001652class VkDescriptorSetLayoutBinding {
Jesse Hall091ed9e2015-11-30 00:55:29 -08001653 u32 binding
Jesse Halld27f6aa2015-08-15 17:58:48 -07001654 VkDescriptorType descriptorType /// Type of the descriptors in this binding
Jesse Halldba27f72015-11-30 14:25:46 -08001655 u32 descriptorCount /// Number of descriptors in this binding
Jesse Halld27f6aa2015-08-15 17:58:48 -07001656 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to
1657 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements)
1658}
1659
1660class VkDescriptorSetLayoutCreateInfo {
1661 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
1662 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001663 VkDescriptorSetLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001664 u32 bindingCount /// Number of bindings in the descriptor set layout
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001665 const VkDescriptorSetLayoutBinding* pBinding /// Array of descriptor set layout bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001666}
1667
Jesse Hall65ab5522015-11-30 00:07:16 -08001668class VkDescriptorPoolSize {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001669 VkDescriptorType type
Jesse Hall03b6fe12015-11-24 12:44:21 -08001670 u32 descriptorCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001671}
1672
1673class VkDescriptorPoolCreateInfo {
1674 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
1675 const void* pNext /// Pointer to next structure
Jesse Hallfbf97b02015-11-20 14:17:03 -08001676 VkDescriptorPoolCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001677 u32 maxSets
Jesse Hall65ab5522015-11-30 00:07:16 -08001678 u32 poolSizeCount
1679 const VkDescriptorPoolSize* pPoolSizes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001680}
1681
Jesse Hall3fbc8562015-11-29 22:10:52 -08001682class VkDescriptorSetAllocateInfo {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001683 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO
Jesse Hallfbf97b02015-11-20 14:17:03 -08001684 const void* pNext /// Pointer to next structure
1685 VkDescriptorPool descriptorPool
Jesse Hall03b6fe12015-11-24 12:44:21 -08001686 u32 setCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001687 const VkDescriptorSetLayout* pSetLayouts
1688}
1689
Jesse Halld27f6aa2015-08-15 17:58:48 -07001690class VkSpecializationMapEntry {
Jesse Hall65ab5522015-11-30 00:07:16 -08001691 u32 constantID /// The SpecConstant ID specified in the BIL
Jesse Halld27f6aa2015-08-15 17:58:48 -07001692 u32 offset /// Offset of the value in the data block
Jesse Hallb00daad2015-11-29 19:46:20 -08001693 platform.size_t size /// Size in bytes of the SpecConstant
Jesse Halld27f6aa2015-08-15 17:58:48 -07001694}
1695
1696class VkSpecializationInfo {
1697 u32 mapEntryCount /// Number of entries in the map
Jesse Hallb00daad2015-11-29 19:46:20 -08001698 const VkSpecializationMapEntry* pMapEntries /// Array of map entries
Jesse Halld27f6aa2015-08-15 17:58:48 -07001699 platform.size_t dataSize /// Size in bytes of pData
1700 const void* pData /// Pointer to SpecConstant data
1701}
1702
1703class VkPipelineShaderStageCreateInfo {
1704 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
1705 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001706 VkPipelineShaderStageCreateFlags flags
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001707 VkShaderStageFlagBits stage
1708 VkShaderModule module
1709 const char* pName
Jesse Halld27f6aa2015-08-15 17:58:48 -07001710 const VkSpecializationInfo* pSpecializationInfo
1711}
1712
1713class VkComputePipelineCreateInfo {
1714 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
1715 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001716 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001717 VkPipelineShaderStageCreateInfo stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001718 VkPipelineLayout layout /// Interface layout of the pipeline
1719 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
1720 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
1721}
1722
1723class VkVertexInputBindingDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001724 u32 binding /// Vertex buffer binding id
1725 u32 stride /// Distance between vertices in bytes (0 = no advancement)
Jesse Hall65ab5522015-11-30 00:07:16 -08001726 VkVertexInputRate inputRate /// Rate at which binding is incremented
Jesse Halld27f6aa2015-08-15 17:58:48 -07001727}
1728
1729class VkVertexInputAttributeDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001730 u32 location /// location of the shader vertex attrib
1731 u32 binding /// Vertex buffer binding id
1732 VkFormat format /// format of source data
1733 u32 offset /// Offset of first element in bytes from base of vertex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001734}
1735
1736class VkPipelineVertexInputStateCreateInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001737 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
1738 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001739 VkPipelineVertexInputStateCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001740 u32 vertexBindingDescriptionCount /// number of bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001741 const VkVertexInputBindingDescription* pVertexBindingDescriptions
Jesse Hall03b6fe12015-11-24 12:44:21 -08001742 u32 vertexAttributeDescriptionCount /// number of attributes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001743 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
1744}
1745
1746class VkPipelineInputAssemblyStateCreateInfo {
1747 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
1748 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001749 VkPipelineInputAssemblyStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001750 VkPrimitiveTopology topology
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001751 VkBool32 primitiveRestartEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001752}
1753
1754class VkPipelineTessellationStateCreateInfo {
1755 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
1756 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001757 VkPipelineTessellationStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001758 u32 patchControlPoints
1759}
1760
1761class VkPipelineViewportStateCreateInfo {
1762 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
1763 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001764 VkPipelineViewportStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001765 u32 viewportCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001766 const VkViewport* pViewports
1767 u32 scissorCount
1768 const VkRect2D* pScissors
Jesse Halld27f6aa2015-08-15 17:58:48 -07001769}
1770
Jesse Hall3fbc8562015-11-29 22:10:52 -08001771class VkPipelineRasterizationStateCreateInfo {
Jesse Hall65ab5522015-11-30 00:07:16 -08001772 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001773 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001774 VkPipelineRasterizationStateCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001775 VkBool32 depthClampEnable
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001776 VkBool32 rasterizerDiscardEnable
Jesse Hall65ab5522015-11-30 00:07:16 -08001777 VkPolygonMode polygonMode /// optional (GL45)
Jesse Hallc7467b72015-11-29 21:05:26 -08001778 VkCullModeFlags cullMode
Jesse Halld27f6aa2015-08-15 17:58:48 -07001779 VkFrontFace frontFace
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001780 VkBool32 depthBiasEnable
Jesse Halla9bb62b2015-11-21 19:31:56 -08001781 f32 depthBiasConstantFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001782 f32 depthBiasClamp
Jesse Halla9bb62b2015-11-21 19:31:56 -08001783 f32 depthBiasSlopeFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001784 f32 lineWidth
Jesse Halld27f6aa2015-08-15 17:58:48 -07001785}
1786
1787class VkPipelineMultisampleStateCreateInfo {
1788 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
1789 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001790 VkPipelineMultisampleStateCreateFlags flags
Jesse Hall091ed9e2015-11-30 00:55:29 -08001791 VkSampleCountFlagBits rasterizationSamples /// Number of samples used for rasterization
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001792 VkBool32 sampleShadingEnable /// optional (GL45)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001793 f32 minSampleShading /// optional (GL45)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001794 const VkSampleMask* pSampleMask
Jesse Hallacfa5342015-11-19 21:51:33 -08001795 VkBool32 alphaToCoverageEnable
1796 VkBool32 alphaToOneEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001797}
1798
1799class VkPipelineColorBlendAttachmentState {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001800 VkBool32 blendEnable
Jesse Hall65ab5522015-11-30 00:07:16 -08001801 VkBlendFactor srcColorBlendFactor
1802 VkBlendFactor dstColorBlendFactor
1803 VkBlendOp colorBlendOp
1804 VkBlendFactor srcAlphaBlendFactor
1805 VkBlendFactor dstAlphaBlendFactor
1806 VkBlendOp alphaBlendOp
1807 VkColorComponentFlags colorWriteMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001808}
1809
1810class VkPipelineColorBlendStateCreateInfo {
1811 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
1812 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001813 VkPipelineColorBlendStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001814 VkBool32 logicOpEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001815 VkLogicOp logicOp
1816 u32 attachmentCount /// # of pAttachments
1817 const VkPipelineColorBlendAttachmentState* pAttachments
Jesse Hallb00daad2015-11-29 19:46:20 -08001818 f32[4] blendConstants
Jesse Halld27f6aa2015-08-15 17:58:48 -07001819}
1820
1821class VkStencilOpState {
Jesse Hall65ab5522015-11-30 00:07:16 -08001822 VkStencilOp failOp
1823 VkStencilOp passOp
1824 VkStencilOp depthFailOp
1825 VkCompareOp compareOp
1826 u32 compareMask
1827 u32 writeMask
1828 u32 reference
Jesse Halld27f6aa2015-08-15 17:58:48 -07001829}
1830
1831class VkPipelineDepthStencilStateCreateInfo {
1832 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
1833 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001834 VkPipelineDepthStencilStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001835 VkBool32 depthTestEnable
1836 VkBool32 depthWriteEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001837 VkCompareOp depthCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001838 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test)
1839 VkBool32 stencilTestEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001840 VkStencilOpState front
1841 VkStencilOpState back
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001842 f32 minDepthBounds
1843 f32 maxDepthBounds
1844}
1845
1846class VkPipelineDynamicStateCreateInfo {
1847 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
1848 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001849 VkPipelineDynamicStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001850 u32 dynamicStateCount
1851 const VkDynamicState* pDynamicStates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001852}
1853
1854class VkGraphicsPipelineCreateInfo {
Jesse Halla6429252015-11-29 18:59:42 -08001855 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
1856 const void* pNext /// Pointer to next structure
1857 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001858 u32 stageCount
Jesse Halla6429252015-11-29 18:59:42 -08001859 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001860 const VkPipelineVertexInputStateCreateInfo* pVertexInputState
1861 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
1862 const VkPipelineTessellationStateCreateInfo* pTessellationState
1863 const VkPipelineViewportStateCreateInfo* pViewportState
Jesse Hall3fbc8562015-11-29 22:10:52 -08001864 const VkPipelineRasterizationStateCreateInfo* pRasterizationState
Jesse Halld27f6aa2015-08-15 17:58:48 -07001865 const VkPipelineMultisampleStateCreateInfo* pMultisampleState
1866 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState
1867 const VkPipelineColorBlendStateCreateInfo* pColorBlendState
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001868 const VkPipelineDynamicStateCreateInfo* pDynamicState
Jesse Halla6429252015-11-29 18:59:42 -08001869 VkPipelineLayout layout /// Interface layout of the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001870 VkRenderPass renderPass
1871 u32 subpass
Jesse Halla6429252015-11-29 18:59:42 -08001872 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
1873 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 -07001874}
1875
1876class VkPipelineCacheCreateInfo {
Jesse Hallb00daad2015-11-29 19:46:20 -08001877 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
1878 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001879 VkPipelineCacheCreateFlags flags
Jesse Hallb00daad2015-11-29 19:46:20 -08001880 platform.size_t initialDataSize /// Size of initial data to populate cache, in bytes
1881 const void* pInitialData /// Initial data to populate cache
Jesse Halld27f6aa2015-08-15 17:58:48 -07001882}
1883
1884class VkPushConstantRange {
1885 VkShaderStageFlags stageFlags /// Which stages use the range
Jesse Hall03b6fe12015-11-24 12:44:21 -08001886 u32 offset /// Start of the range, in bytes
1887 u32 size /// Length of the range, in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001888}
1889
1890class VkPipelineLayoutCreateInfo {
1891 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
1892 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001893 VkPipelineLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001894 u32 setLayoutCount /// Number of descriptor sets interfaced by the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001895 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the
1896 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline
1897 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages
1898}
1899
1900class VkSamplerCreateInfo {
1901 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
1902 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001903 VkSamplerCreateFlags flags
Jesse Hall23ff73f2015-11-29 14:36:39 -08001904 VkFilter magFilter /// Filter mode for magnification
1905 VkFilter minFilter /// Filter mode for minifiation
1906 VkSamplerMipmapMode mipmapMode /// Mipmap selection mode
1907 VkSamplerAddressMode addressModeU
1908 VkSamplerAddressMode addressModeV
1909 VkSamplerAddressMode addressModeW
Jesse Halld27f6aa2015-08-15 17:58:48 -07001910 f32 mipLodBias
1911 f32 maxAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001912 VkBool32 compareEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001913 VkCompareOp compareOp
1914 f32 minLod
1915 f32 maxLod
1916 VkBorderColor borderColor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001917 VkBool32 unnormalizedCoordinates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001918}
1919
Jesse Hall3fbc8562015-11-29 22:10:52 -08001920class VkCommandPoolCreateInfo {
1921 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001922 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001923 VkCommandPoolCreateFlags flags /// Command pool creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001924 u32 queueFamilyIndex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001925}
1926
Jesse Hall3fbc8562015-11-29 22:10:52 -08001927class VkCommandBufferAllocateInfo {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001928 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001929 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001930 VkCommandPool commandPool
1931 VkCommandBufferLevel level
Jesse Hall03b6fe12015-11-24 12:44:21 -08001932 u32 bufferCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001933}
1934
Jesse Hall3fbc8562015-11-29 22:10:52 -08001935class VkCommandBufferBeginInfo {
1936 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001937 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001938 VkCommandBufferUsageFlags flags /// Command buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001939 VkRenderPass renderPass /// Render pass for secondary command buffers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001940 u32 subpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07001941 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001942 VkBool32 occlusionQueryEnable
1943 VkQueryControlFlags queryFlags
1944 VkQueryPipelineStatisticFlags pipelineStatistics
Jesse Halld27f6aa2015-08-15 17:58:48 -07001945}
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 {
Jesse Halla6429252015-11-29 18:59:42 -08001984 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001985 VkFormat format
Jesse Hall091ed9e2015-11-30 00:55:29 -08001986 VkSampleCountFlagBits samples
Jesse Halld27f6aa2015-08-15 17:58:48 -07001987 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1988 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1989 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1990 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1991 VkImageLayout initialLayout
1992 VkImageLayout finalLayout
1993}
1994
1995class VkAttachmentReference {
1996 u32 attachment
1997 VkImageLayout layout
1998}
1999
2000class VkSubpassDescription {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002001 VkSubpassDescriptionFlags flags
Jesse Halla6429252015-11-29 18:59:42 -08002002 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
Jesse Hall03b6fe12015-11-24 12:44:21 -08002003 u32 inputAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002004 const VkAttachmentReference* pInputAttachments
Jesse Hall03b6fe12015-11-24 12:44:21 -08002005 u32 colorAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002006 const VkAttachmentReference* pColorAttachments
2007 const VkAttachmentReference* pResolveAttachments
Jesse Hallc7467b72015-11-29 21:05:26 -08002008 const VkAttachmentReference* pDepthStencilAttachment
Jesse Hall03b6fe12015-11-24 12:44:21 -08002009 u32 preserveAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002010 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002011}
2012
2013class VkSubpassDependency {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002014 u32 srcSubpass
Jesse Hall3fbc8562015-11-29 22:10:52 -08002015 u32 dstSubpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07002016 VkPipelineStageFlags srcStageMask
Jesse Hall3fbc8562015-11-29 22:10:52 -08002017 VkPipelineStageFlags dstStageMask
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002018 VkAccessFlags srcAccessMask
2019 VkAccessFlags dstAccessMask
Jesse Halldc6d36c2015-11-29 19:12:15 -08002020 VkDependencyFlags dependencyFlags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002021}
2022
2023class VkRenderPassCreateInfo {
2024 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
2025 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002026 VkRenderPassCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002027 u32 attachmentCount
2028 const VkAttachmentDescription* pAttachments
2029 u32 subpassCount
2030 const VkSubpassDescription* pSubpasses
2031 u32 dependencyCount
2032 const VkSubpassDependency* pDependencies
2033}
2034
2035class VkEventCreateInfo {
2036 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
2037 const void* pNext /// Pointer to next structure
2038 VkEventCreateFlags flags /// Event creation flags
2039}
2040
2041class VkFenceCreateInfo {
2042 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
2043 const void* pNext /// Pointer to next structure
2044 VkFenceCreateFlags flags /// Fence creation flags
2045}
2046
2047class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002048 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
2049 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
2050 VkBool32 imageCubeArray /// image views which are arrays of cube maps
2051 VkBool32 independentBlend /// blending operations are controlled per-attachment
2052 VkBool32 geometryShader /// geometry stage
2053 VkBool32 tessellationShader /// tessellation control and evaluation stage
2054 VkBool32 sampleRateShading /// per-sample shading and interpolation
Jesse Hall3fbc8562015-11-29 22:10:52 -08002055 VkBool32 dualSrcBlend /// blend operations which take two sources
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002056 VkBool32 logicOp /// logic operations
2057 VkBool32 multiDrawIndirect /// multi draw indirect
Jesse Hallae38f732015-11-19 21:32:50 -08002058 VkBool32 depthClamp /// depth clamping
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002059 VkBool32 depthBiasClamp /// depth bias clamping
2060 VkBool32 fillModeNonSolid /// point and wireframe fill modes
2061 VkBool32 depthBounds /// depth bounds test
2062 VkBool32 wideLines /// lines with width greater than 1
2063 VkBool32 largePoints /// points with size greater than 1
Jesse Hallfbf97b02015-11-20 14:17:03 -08002064 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
2065 VkBool32 multiViewport
2066 VkBool32 samplerAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002067 VkBool32 textureCompressionETC2 /// ETC texture compression formats
2068 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
2069 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
Jesse Hall65ab5522015-11-30 00:07:16 -08002070 VkBool32 occlusionQueryPrecise
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002071 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
Jesse Halldc6d36c2015-11-29 19:12:15 -08002072 VkBool32 vertexPipelineStoresAndAtomics
2073 VkBool32 fragmentStoresAndAtomics
2074 VkBool32 shaderTessellationAndGeometryPointSize
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002075 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
2076 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
2077 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
Jesse Halld1af8122015-11-29 23:50:38 -08002078 VkBool32 shaderStorageImageReadWithoutFormat
2079 VkBool32 shaderStorageImageWriteWithoutFormat
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002080 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
2081 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
2082 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
2083 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
2084 VkBool32 shaderClipDistance /// clip distance in shaders
2085 VkBool32 shaderCullDistance /// cull distance in shaders
2086 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
2087 VkBool32 shaderInt64 /// 64-bit integers in shaders
2088 VkBool32 shaderInt16 /// 16-bit integers in shaders
2089 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
Jesse Hall65ab5522015-11-30 00:07:16 -08002090 VkBool32 shaderResourceMinLod /// shader can use texture operations that specify minimum resource LOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002091 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
2092 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
2093 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
2094 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
2095 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
2096 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
2097 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
2098 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
2099 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld1af8122015-11-29 23:50:38 -08002100 VkBool32 variableMultisampleRate
Jesse Halld27f6aa2015-08-15 17:58:48 -07002101}
2102
2103class VkPhysicalDeviceLimits {
2104 /// resource maximum sizes
2105 u32 maxImageDimension1D /// max 1D image dimension
2106 u32 maxImageDimension2D /// max 2D image dimension
2107 u32 maxImageDimension3D /// max 3D image dimension
2108 u32 maxImageDimensionCube /// max cubemap image dimension
2109 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hallb00daad2015-11-29 19:46:20 -08002110 u32 maxTexelBufferElements
Jesse Hallfbf97b02015-11-20 14:17:03 -08002111 u32 maxUniformBufferRange /// max uniform buffer size (bytes)
2112 u32 maxStorageBufferRange /// max storage buffer size (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002113 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
2114 /// memory limits
2115 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall091ed9e2015-11-30 00:55:29 -08002116 u32 maxSamplerAllocationCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002117 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
2118 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002119 /// descriptor set limits
2120 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07002121 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
2122 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
2123 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
2124 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
2125 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
Jesse Halle1b12782015-11-30 11:27:32 -08002126 u32 maxPerStageDescriptorInputAttachments
Jesse Halldba27f72015-11-30 14:25:46 -08002127 u32 maxPerStageResources
Jesse Halld27f6aa2015-08-15 17:58:48 -07002128 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
2129 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002130 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002131 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002132 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002133 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
2134 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
Jesse Halle1b12782015-11-30 11:27:32 -08002135 u32 maxDescriptorSetInputAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002136 /// 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 Hall3fbc8562015-11-29 22:10:52 -08002143 u32 maxTessellationGenerationLevel /// max level supported by tess primitive generator
Jesse Hallae38f732015-11-19 21:32:50 -08002144 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
Jesse Hall3fbc8562015-11-29 22:10:52 -08002160 u32 maxFragmentDualSrcAttachments /// 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)
Jesse Halldba27f72015-11-30 14:25:46 -08002173 u32 maxDrawIndirectCount
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
Jesse Hall091ed9e2015-11-30 00:55:29 -08002199 VkSampleCountFlags framebufferColorSampleCounts
2200 VkSampleCountFlags framebufferDepthSampleCounts
2201 VkSampleCountFlags framebufferStencilSampleCounts
2202 VkSampleCountFlags framebufferNoAttachmentSampleCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07002203 u32 maxColorAttachments /// max num of framebuffer color attachments
2204
Jesse Hall091ed9e2015-11-30 00:55:29 -08002205 VkSampleCountFlags sampledImageColorSampleCounts
2206 VkSampleCountFlags sampledImageIntegerSampleCounts
2207 VkSampleCountFlags sampledImageDepthSampleCounts
2208 VkSampleCountFlags sampledImageStencilSampleCounts
2209 VkSampleCountFlags storageImageSampleCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07002210 u32 maxSampleMaskWords /// max num of sample mask words
2211
Jesse Halla9bb62b2015-11-21 19:31:56 -08002212 f32 timestampPeriod
Jesse Halld27f6aa2015-08-15 17:58:48 -07002213
2214 u32 maxClipDistances /// max number of clip distances
2215 u32 maxCullDistances /// max number of cull distances
2216 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
2217
Jesse Hallfbf97b02015-11-20 14:17:03 -08002218 u32 discreteQueuePriorities
2219
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002220 f32[2] pointSizeRange /// range (min,max) of supported point sizes
2221 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07002222 f32 pointSizeGranularity /// granularity of supported point sizes
2223 f32 lineWidthGranularity /// granularity of supported line widths
Jesse Hall03b6fe12015-11-24 12:44:21 -08002224 VkBool32 strictLines
Jesse Hall091ed9e2015-11-30 00:55:29 -08002225 VkBool32 standardSampleLocations
Jesse Halla9bb62b2015-11-21 19:31:56 -08002226
Jesse Hall65ab5522015-11-30 00:07:16 -08002227 VkDeviceSize optimalBufferCopyOffsetAlignment
2228 VkDeviceSize optimalBufferCopyRowPitchAlignment
Jesse Halldba27f72015-11-30 14:25:46 -08002229 VkDeviceSize nonCoherentAtomSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07002230}
2231
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002232class VkPhysicalDeviceSparseProperties {
2233 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 -08002234 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 -07002235 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
2236 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
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002237 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
2238}
2239
Jesse Halld27f6aa2015-08-15 17:58:48 -07002240class VkSemaphoreCreateInfo {
2241 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
2242 const void* pNext /// Pointer to next structure
2243 VkSemaphoreCreateFlags flags /// Semaphore creation flags
2244}
2245
2246class VkQueryPoolCreateInfo {
2247 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
2248 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002249 VkQueryPoolCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002250 VkQueryType queryType
Jesse Hall65ab5522015-11-30 00:07:16 -08002251 u32 entryCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07002252 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
2253}
2254
2255class VkFramebufferCreateInfo {
2256 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
2257 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002258 VkFramebufferCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002259 VkRenderPass renderPass
2260 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002261 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002262 u32 width
2263 u32 height
2264 u32 layers
2265}
2266
Jesse Hall3fbc8562015-11-29 22:10:52 -08002267class VkDrawIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002268 u32 vertexCount
2269 u32 instanceCount
2270 u32 firstVertex
2271 u32 firstInstance
2272}
2273
Jesse Hall3fbc8562015-11-29 22:10:52 -08002274class VkDrawIndexedIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002275 u32 indexCount
2276 u32 instanceCount
2277 u32 firstIndex
2278 s32 vertexOffset
2279 u32 firstInstance
2280}
2281
Jesse Hall3fbc8562015-11-29 22:10:52 -08002282class VkDispatchIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002283 u32 x
2284 u32 y
2285 u32 z
2286}
2287
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002288@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08002289class VkSurfaceCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002290 u32 minImageCount
2291 u32 maxImageCount
2292 VkExtent2D currentExtent
2293 VkExtent2D minImageExtent
2294 VkExtent2D maxImageExtent
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002295 u32 maxImageArrayLayers
Jesse Hall1356b0d2015-11-23 17:24:58 -08002296 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002297 VkSurfaceTransformFlagBitsKHR currentTransform
Jesse Halla6429252015-11-29 18:59:42 -08002298 VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002299 VkImageUsageFlags supportedUsageFlags
Michael Lentine88594d72015-11-12 12:49:45 -08002300}
2301
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002302@extension("VK_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -08002303class VkSurfaceFormatKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002304 VkFormat format
2305 VkColorSpaceKHR colorSpace
Michael Lentine88594d72015-11-12 12:49:45 -08002306}
2307
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002308@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002309class VkSwapchainCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002310 VkStructureType sType
2311 const void* pNext
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002312 VkSwapchainCreateFlagsKHR flags
Jesse Hall1356b0d2015-11-23 17:24:58 -08002313 VkSurfaceKHR surface
2314 u32 minImageCount
2315 VkFormat imageFormat
2316 VkColorSpaceKHR imageColorSpace
2317 VkExtent2D imageExtent
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002318 u32 imageArrayLayers
2319 VkImageUsageFlags imageUsage
Jesse Hall1356b0d2015-11-23 17:24:58 -08002320 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08002321 u32 queueFamilyIndexCount
Jesse Hall1356b0d2015-11-23 17:24:58 -08002322 const u32* pQueueFamilyIndices
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002323 VkSurfaceTransformFlagBitsKHR preTransform
2324 VkCompositeAlphaFlagBitsKHR compositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002325 VkPresentModeKHR presentMode
Jesse Hall1356b0d2015-11-23 17:24:58 -08002326 VkBool32 clipped
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002327 VkSwapchainKHR oldSwapchain
Michael Lentine88594d72015-11-12 12:49:45 -08002328}
2329
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002330@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002331class VkPresentInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002332 VkStructureType sType
2333 const void* pNext
Jesse Hallb00daad2015-11-29 19:46:20 -08002334 u32 waitSemaphoreCount
2335 const VkSemaphore* pWaitSemaphores
Jesse Hall1356b0d2015-11-23 17:24:58 -08002336 u32 swapchainCount
Jesse Hall03b6fe12015-11-24 12:44:21 -08002337 const VkSwapchainKHR* pSwapchains
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002338 const u32* pImageIndices
Jesse Halle1b12782015-11-30 11:27:32 -08002339 VkResult* pResults
Michael Lentine88594d72015-11-12 12:49:45 -08002340}
2341
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002342@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002343class VkDisplayPropertiesKHR {
2344 VkDisplayKHR display
2345 const char* displayName
2346 VkExtent2D physicalDimensions
2347 VkExtent2D physicalResolution
2348 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hall1356b0d2015-11-23 17:24:58 -08002349 VkBool32 planeReorderPossible
Jesse Halla6429252015-11-29 18:59:42 -08002350 VkBool32 persistentContent
Michael Lentine88594d72015-11-12 12:49:45 -08002351}
2352
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002353@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002354class VkDisplayModeParametersKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002355 VkExtent2D visibleRegion
Jesse Halla6429252015-11-29 18:59:42 -08002356 u32 refreshRate
Michael Lentine88594d72015-11-12 12:49:45 -08002357}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002358
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002359@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002360class VkDisplayModePropertiesKHR {
2361 VkDisplayModeKHR displayMode
Jesse Halla6429252015-11-29 18:59:42 -08002362 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002363}
2364
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002365@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002366class VkDisplayModeCreateInfoKHR {
2367 VkStructureType sType
2368 const void* pNext
Jesse Halla6429252015-11-29 18:59:42 -08002369 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002370}
2371
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002372@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002373class VkDisplayPlanePropertiesKHR {
Jesse Halla6429252015-11-29 18:59:42 -08002374 VkDisplayKHR currentDisplay
2375 u32 currentStackIndex
2376}
2377
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002378@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002379class VkDisplayPlaneCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002380 VkDisplayPlaneAlphaFlagsKHR supportedAlpha
2381 VkOffset2D minSrcPosition
2382 VkOffset2D maxSrcPosition
2383 VkExtent2D minSrcExtent
2384 VkExtent2D maxSrcExtent
2385 VkOffset2D minDstPosition
2386 VkOffset2D maxDstPosition
2387 VkExtent2D minDstExtent
2388 VkExtent2D maxDstExtent
2389}
2390
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002391@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002392class VkDisplaySurfaceCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002393 VkStructureType sType
2394 const void* pNext
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002395 VkDisplaySurfaceCreateFlagsKHR flags
Jesse Hall1356b0d2015-11-23 17:24:58 -08002396 VkDisplayModeKHR displayMode
2397 u32 planeIndex
2398 u32 planeStackIndex
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002399 VkSurfaceTransformFlagBitsKHR transform
Jesse Hall1356b0d2015-11-23 17:24:58 -08002400 f32 globalAlpha
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002401 VkDisplayPlaneAlphaFlagBitsKHR alphaMode
2402 VkExtent2D imageExtent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002403}
2404
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002405@extension("VK_KHR_display_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002406class VkDisplaySwapchainCreateInfoKHR {
2407 VkStructureType sType
2408 const void* pNext
2409 const VkSwapchainCreateInfoKHR* pNextSwapchainCreateInfo
2410}
2411
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002412@extension("VK_KHR_display_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002413class VkDisplayPresentInfoKHR {
2414 VkStructureType sType
2415 const void* pNext
2416 VkRect2D srcRect
2417 VkRect2D dstRect
Jesse Halla6429252015-11-29 18:59:42 -08002418 VkBool32 persistent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002419}
2420
2421
Jesse Halld27f6aa2015-08-15 17:58:48 -07002422////////////////
2423// Commands //
2424////////////////
2425
2426// Function pointers. TODO: add support for function pointers.
2427
2428@external type void* PFN_vkVoidFunction
2429@pfn cmd void vkVoidFunction() {
2430}
2431
Jesse Hall3fbc8562015-11-29 22:10:52 -08002432@external type void* PFN_vkAllocationFunction
2433@pfn cmd void* vkAllocationFunction(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002434 void* pUserData,
2435 platform.size_t size,
2436 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002437 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002438 return ?
2439}
2440
Jesse Hall3fbc8562015-11-29 22:10:52 -08002441@external type void* PFN_vkReallocationFunction
2442@pfn cmd void* vkReallocationFunction(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002443 void* pUserData,
2444 void* pOriginal,
2445 platform.size_t size,
2446 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002447 VkSystemAllocationScope allocationScope) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002448 return ?
2449}
2450
2451@external type void* PFN_vkFreeFunction
2452@pfn cmd void vkFreeFunction(
2453 void* pUserData,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002454 void* pMemory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002455}
2456
Jesse Hall3fbc8562015-11-29 22:10:52 -08002457@external type void* PFN_vkInternalAllocationNotification
2458@pfn cmd void vkInternalAllocationNotification(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002459 void* pUserData,
2460 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002461 VkInternalAllocationType allocationType,
2462 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002463}
2464
2465@external type void* PFN_vkInternalFreeNotification
2466@pfn cmd void vkInternalFreeNotification(
2467 void* pUserData,
2468 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002469 VkInternalAllocationType allocationType,
2470 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002471}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002472
2473// Global functions
2474
2475@threadSafety("system")
2476cmd VkResult vkCreateInstance(
2477 const VkInstanceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002478 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002479 VkInstance* pInstance) {
2480 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
2481
2482 instance := ?
2483 pInstance[0] = instance
2484 State.Instances[instance] = new!InstanceObject()
2485
Jesse Hall03b6fe12015-11-24 12:44:21 -08002486 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount]
2487 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount]
Jesse Halld27f6aa2015-08-15 17:58:48 -07002488
2489 return ?
2490}
2491
2492@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002493cmd void vkDestroyInstance(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002494 VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002495 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002496 instanceObject := GetInstance(instance)
2497
2498 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002499}
2500
2501@threadSafety("system")
2502cmd VkResult vkEnumeratePhysicalDevices(
2503 VkInstance instance,
2504 u32* pPhysicalDeviceCount,
2505 VkPhysicalDevice* pPhysicalDevices) {
2506 instanceObject := GetInstance(instance)
2507
2508 physicalDeviceCount := as!u32(?)
2509 pPhysicalDeviceCount[0] = physicalDeviceCount
2510 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2511
2512 for i in (0 .. physicalDeviceCount) {
2513 physicalDevice := ?
2514 physicalDevices[i] = physicalDevice
2515 if !(physicalDevice in State.PhysicalDevices) {
2516 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2517 }
2518 }
2519
2520 return ?
2521}
2522
2523cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2524 VkDevice device,
2525 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002526 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002527 device := GetDevice(device)
2528 }
2529
2530 return ?
2531}
2532
2533cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2534 VkInstance instance,
2535 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002536 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002537 instanceObject := GetInstance(instance)
2538 }
2539
2540 return ?
2541}
2542
Jesse Hall606a54e2015-11-19 22:17:28 -08002543cmd void vkGetPhysicalDeviceProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002544 VkPhysicalDevice physicalDevice,
2545 VkPhysicalDeviceProperties* pProperties) {
2546 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2547
2548 properties := ?
2549 pProperties[0] = properties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002550}
2551
Jesse Hall606a54e2015-11-19 22:17:28 -08002552cmd void vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002553 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002554 u32* pQueueFamilyPropertyCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002555 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002556 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002557 // TODO: Figure out how to express fetch-count-or-properties
2558 // This version fails 'apic validate' with 'fence not allowed in
2559 // *semantic.Branch'. Other attempts have failed with the same or other
2560 // errors.
2561 // if pQueueFamilyProperties != null {
2562 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2563 // for i in (0 .. pCount[0]) {
2564 // queueProperties := as!VkQueueFamilyProperties(?)
2565 // queuesProperties[i] = queueProperties
2566 // }
2567 // } else {
2568 // count := ?
2569 // pCount[0] = count
2570 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002571}
2572
Jesse Hall606a54e2015-11-19 22:17:28 -08002573cmd void vkGetPhysicalDeviceMemoryProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002574 VkPhysicalDevice physicalDevice,
2575 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2576 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2577
2578 memoryProperties := ?
2579 pMemoryProperties[0] = memoryProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002580}
2581
Jesse Hall606a54e2015-11-19 22:17:28 -08002582cmd void vkGetPhysicalDeviceFeatures(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002583 VkPhysicalDevice physicalDevice,
2584 VkPhysicalDeviceFeatures* pFeatures) {
2585 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2586
2587 features := ?
2588 pFeatures[0] = features
Jesse Halld27f6aa2015-08-15 17:58:48 -07002589}
2590
Jesse Hall606a54e2015-11-19 22:17:28 -08002591cmd void vkGetPhysicalDeviceFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002592 VkPhysicalDevice physicalDevice,
2593 VkFormat format,
2594 VkFormatProperties* pFormatProperties) {
2595 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2596
2597 formatProperties := ?
2598 pFormatProperties[0] = formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002599}
2600
Jesse Halla9e57032015-11-30 01:03:10 -08002601cmd VkResult vkGetPhysicalDeviceImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002602 VkPhysicalDevice physicalDevice,
2603 VkFormat format,
2604 VkImageType type,
2605 VkImageTiling tiling,
2606 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002607 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002608 VkImageFormatProperties* pImageFormatProperties) {
2609 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2610
2611 imageFormatProperties := ?
2612 pImageFormatProperties[0] = imageFormatProperties
Jesse Halla9e57032015-11-30 01:03:10 -08002613
2614 return ?
Jesse Halld27f6aa2015-08-15 17:58:48 -07002615}
2616
Jesse Halld27f6aa2015-08-15 17:58:48 -07002617
2618// Device functions
2619
2620@threadSafety("system")
2621cmd VkResult vkCreateDevice(
2622 VkPhysicalDevice physicalDevice,
2623 const VkDeviceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002624 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002625 VkDevice* pDevice) {
2626 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2627 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2628
2629 device := ?
2630 pDevice[0] = device
2631 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2632
2633 return ?
2634}
2635
2636@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002637cmd void vkDestroyDevice(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002638 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002639 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002640 deviceObject := GetDevice(device)
2641
2642 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002643}
2644
2645
2646// Extension discovery functions
2647
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002648cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002649 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002650 VkLayerProperties* pProperties) {
2651 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002652 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002653
2654 properties := pProperties[0:count]
2655 for i in (0 .. count) {
2656 property := ?
2657 properties[i] = property
2658 }
2659
2660 return ?
2661}
2662
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002663cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002664 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002665 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002666 VkExtensionProperties* pProperties) {
2667 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002668 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002669
2670 properties := pProperties[0:count]
2671 for i in (0 .. count) {
2672 property := ?
2673 properties[i] = property
2674 }
2675
2676 return ?
2677}
2678
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002679cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002680 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002681 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002682 VkLayerProperties* pProperties) {
2683 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2684 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002685 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002686
2687 properties := pProperties[0:count]
2688 for i in (0 .. count) {
2689 property := ?
2690 properties[i] = property
2691 }
2692
2693 return ?
2694}
2695
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002696cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002697 VkPhysicalDevice physicalDevice,
2698 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002699 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002700 VkExtensionProperties* pProperties) {
2701 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2702
2703 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002704 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002705
2706 properties := pProperties[0:count]
2707 for i in (0 .. count) {
2708 property := ?
2709 properties[i] = property
2710 }
2711
2712 return ?
2713}
2714
2715
2716// Queue functions
2717
2718@threadSafety("system")
Jesse Hall606a54e2015-11-19 22:17:28 -08002719cmd void vkGetDeviceQueue(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002720 VkDevice device,
2721 u32 queueFamilyIndex,
2722 u32 queueIndex,
2723 VkQueue* pQueue) {
2724 deviceObject := GetDevice(device)
2725
2726 queue := ?
2727 pQueue[0] = queue
2728
2729 if !(queue in State.Queues) {
2730 State.Queues[queue] = new!QueueObject(device: device)
2731 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002732}
2733
2734@threadSafety("app")
2735cmd VkResult vkQueueSubmit(
2736 VkQueue queue,
Jesse Halla366a512015-11-19 22:30:07 -08002737 u32 submitCount,
Jesse Hallb00daad2015-11-29 19:46:20 -08002738 const VkSubmitInfo* pSubmits,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002739 VkFence fence) {
2740 queueObject := GetQueue(queue)
2741
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002742 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002743 fenceObject := GetFence(fence)
2744 assert(fenceObject.device == queueObject.device)
2745 }
2746
Jesse Hall3fbc8562015-11-29 22:10:52 -08002747 // commandBuffers := pcommandBuffers[0:commandBufferCount]
2748 // for i in (0 .. commandBufferCount) {
2749 // commandBuffer := commandBuffers[i]
2750 // commandBufferObject := GetCommandBuffer(commandBuffer)
2751 // assert(commandBufferObject.device == queueObject.device)
Jesse Halla366a512015-11-19 22:30:07 -08002752 //
Jesse Hall3fbc8562015-11-29 22:10:52 -08002753 // validate("QueueCheck", commandBufferObject.queueFlags in queueObject.flags,
2754 // "vkQueueSubmit: enqueued commandBuffer requires missing queue capabilities.")
Jesse Halla366a512015-11-19 22:30:07 -08002755 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002756
2757 return ?
2758}
2759
2760@threadSafety("system")
2761cmd VkResult vkQueueWaitIdle(
2762 VkQueue queue) {
2763 queueObject := GetQueue(queue)
2764
2765 return ?
2766}
2767
2768@threadSafety("system")
2769cmd VkResult vkDeviceWaitIdle(
2770 VkDevice device) {
2771 deviceObject := GetDevice(device)
2772
2773 return ?
2774}
2775
2776
2777// Memory functions
2778
2779@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002780cmd VkResult vkAllocateMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002781 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002782 const VkMemoryAllocateInfo* pAllocateInfo,
2783 const VkAllocationCallbacks* pAllocator,
2784 VkDeviceMemory* pMemory) {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002785 assert(pAllocateInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002786 deviceObject := GetDevice(device)
2787
Jesse Hall3fbc8562015-11-29 22:10:52 -08002788 memory := ?
2789 pMemory[0] = memory
2790 State.DeviceMemories[memory] = new!DeviceMemoryObject(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002791 device: device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002792 allocationSize: pAllocateInfo[0].allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002793
2794 return ?
2795}
2796
2797@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002798cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002799 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002800 VkDeviceMemory memory,
2801 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002802 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002803 memoryObject := GetDeviceMemory(memory)
2804 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002805
2806 // Check that no objects are still bound before freeing.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002807 validate("MemoryCheck", len(memoryObject.boundObjects) == 0,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002808 "vkFreeMemory: objects still bound")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002809 validate("MemoryCheck", len(memoryObject.boundCommandBuffers) == 0,
2810 "vkFreeMemory: commandBuffers still bound")
2811 State.DeviceMemories[memory] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002812}
2813
2814@threadSafety("app")
2815cmd VkResult vkMapMemory(
2816 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002817 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002818 VkDeviceSize offset,
2819 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002820 VkMemoryMapFlags flags,
2821 void** ppData) {
2822 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002823 memoryObject := GetDeviceMemory(memory)
2824 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002825
2826 assert(flags == as!VkMemoryMapFlags(0))
Jesse Hall3fbc8562015-11-29 22:10:52 -08002827 assert((offset + size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002828
2829 return ?
2830}
2831
2832@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002833cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002834 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002835 VkDeviceMemory memory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002836 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002837 memoryObject := GetDeviceMemory(memory)
2838 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002839}
2840
2841cmd VkResult vkFlushMappedMemoryRanges(
2842 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002843 u32 memoryRangeCount
2844 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002845 deviceObject := GetDevice(device)
2846
Jesse Hall3fbc8562015-11-29 22:10:52 -08002847 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2848 for i in (0 .. memoryRangeCount) {
2849 memoryRange := memoryRanges[i]
2850 memoryObject := GetDeviceMemory(memoryRange.memory)
2851 assert(memoryObject.device == device)
2852 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002853 }
2854
2855 return ?
2856}
2857
2858cmd VkResult vkInvalidateMappedMemoryRanges(
2859 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002860 u32 memoryRangeCount,
2861 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002862 deviceObject := GetDevice(device)
2863
Jesse Hall3fbc8562015-11-29 22:10:52 -08002864 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2865 for i in (0 .. memoryRangeCount) {
2866 memoryRange := memoryRanges[i]
2867 memoryObject := GetDeviceMemory(memoryRange.memory)
2868 assert(memoryObject.device == device)
2869 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002870 }
2871
2872 return ?
2873}
2874
2875
2876// Memory management API functions
2877
Jesse Hall606a54e2015-11-19 22:17:28 -08002878cmd void vkGetDeviceMemoryCommitment(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002879 VkDevice device,
2880 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002881 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002882 deviceObject := GetDevice(device)
2883
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002884 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002885 memoryObject := GetDeviceMemory(memory)
2886 assert(memoryObject.device == device)
2887 }
2888
2889 committedMemoryInBytes := ?
2890 pCommittedMemoryInBytes[0] = committedMemoryInBytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07002891}
2892
Jesse Hall606a54e2015-11-19 22:17:28 -08002893cmd void vkGetBufferMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002894 VkDevice device,
2895 VkBuffer buffer,
2896 VkMemoryRequirements* pMemoryRequirements) {
2897 deviceObject := GetDevice(device)
2898 bufferObject := GetBuffer(buffer)
2899 assert(bufferObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002900}
2901
2902cmd VkResult vkBindBufferMemory(
2903 VkDevice device,
2904 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002905 VkDeviceMemory memory,
2906 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002907 deviceObject := GetDevice(device)
2908 bufferObject := GetBuffer(buffer)
2909 assert(bufferObject.device == device)
2910
2911 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002912 if bufferObject.memory != NULL_HANDLE {
2913 memoryObject := GetDeviceMemory(bufferObject.memory)
2914 memoryObject.boundObjects[as!u64(buffer)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002915 }
2916
2917 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002918 if memory != NULL_HANDLE {
2919 memoryObject := GetDeviceMemory(memory)
2920 assert(memoryObject.device == device)
2921 memoryObject.boundObjects[as!u64(buffer)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002922 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002923 bufferObject.memory = memory
2924 bufferObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002925
2926 return ?
2927}
2928
Jesse Hall606a54e2015-11-19 22:17:28 -08002929cmd void vkGetImageMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002930 VkDevice device,
2931 VkImage image,
2932 VkMemoryRequirements* pMemoryRequirements) {
2933 deviceObject := GetDevice(device)
2934 imageObject := GetImage(image)
2935 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002936}
2937
2938cmd VkResult vkBindImageMemory(
2939 VkDevice device,
2940 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002941 VkDeviceMemory memory,
2942 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002943 deviceObject := GetDevice(device)
2944 imageObject := GetImage(image)
2945 assert(imageObject.device == device)
2946
2947 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002948 if imageObject.memory != NULL_HANDLE {
2949 memoryObject := GetDeviceMemory(imageObject.memory)
2950 memoryObject.boundObjects[as!u64(image)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002951 }
2952
2953 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002954 if memory != NULL_HANDLE {
2955 memoryObject := GetDeviceMemory(memory)
2956 assert(memoryObject.device == device)
2957 memoryObject.boundObjects[as!u64(image)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002958 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002959 imageObject.memory = memory
2960 imageObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002961
2962 return ?
2963}
2964
Jesse Hall606a54e2015-11-19 22:17:28 -08002965cmd void vkGetImageSparseMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002966 VkDevice device,
2967 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002968 u32* pSparseMemoryRequirementCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002969 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2970 deviceObject := GetDevice(device)
2971 imageObject := GetImage(image)
2972 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002973}
2974
Jesse Hall606a54e2015-11-19 22:17:28 -08002975cmd void vkGetPhysicalDeviceSparseImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002976 VkPhysicalDevice physicalDevice,
2977 VkFormat format,
2978 VkImageType type,
Jesse Hall091ed9e2015-11-30 00:55:29 -08002979 VkSampleCountFlagBits samples,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002980 VkImageUsageFlags usage,
2981 VkImageTiling tiling,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002982 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002983 VkSparseImageFormatProperties* pProperties) {
2984 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002985}
2986
Jesse Halla6429252015-11-29 18:59:42 -08002987cmd VkResult vkQueueBindSparse(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002988 VkQueue queue,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002989 u32 bindInfoCount,
Jesse Halla6429252015-11-29 18:59:42 -08002990 const VkBindSparseInfo* pBindInfo,
2991 VkFence fence) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002992 queueObject := GetQueue(queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002993
2994 return ?
2995}
2996
2997
2998// Fence functions
2999
3000@threadSafety("system")
3001cmd VkResult vkCreateFence(
3002 VkDevice device,
3003 const VkFenceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003004 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003005 VkFence* pFence) {
3006 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
3007 deviceObject := GetDevice(device)
3008
3009 fence := ?
3010 pFence[0] = fence
3011 State.Fences[fence] = new!FenceObject(
Jesse Halld8bade02015-11-24 10:24:18 -08003012 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT)))
Jesse Halld27f6aa2015-08-15 17:58:48 -07003013
3014 return ?
3015}
3016
3017@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003018cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003019 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003020 VkFence fence,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003021 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003022 deviceObject := GetDevice(device)
3023 fenceObject := GetFence(fence)
3024 assert(fenceObject.device == device)
3025
3026 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003027}
3028
3029@threadSafety("system")
3030cmd VkResult vkResetFences(
3031 VkDevice device,
3032 u32 fenceCount,
3033 const VkFence* pFences) {
3034 deviceObject := GetDevice(device)
3035
3036 fences := pFences[0:fenceCount]
3037 for i in (0 .. fenceCount) {
3038 fence := fences[i]
3039 fenceObject := GetFence(fence)
3040 assert(fenceObject.device == device)
3041 fenceObject.signaled = false
3042 }
3043
3044 return ?
3045}
3046
3047@threadSafety("system")
3048cmd VkResult vkGetFenceStatus(
3049 VkDevice device,
3050 VkFence fence) {
3051 deviceObject := GetDevice(device)
3052 fenceObject := GetFence(fence)
3053 assert(fenceObject.device == device)
3054
3055 return ?
3056}
3057
3058@threadSafety("system")
3059cmd VkResult vkWaitForFences(
3060 VkDevice device,
3061 u32 fenceCount,
3062 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003063 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003064 u64 timeout) { /// timeout in nanoseconds
3065 deviceObject := GetDevice(device)
3066
3067 fences := pFences[0:fenceCount]
3068 for i in (0 .. fenceCount) {
3069 fence := fences[i]
3070 fenceObject := GetFence(fence)
3071 assert(fenceObject.device == device)
3072 }
3073
3074 return ?
3075}
3076
3077
3078// Queue semaphore functions
3079
3080@threadSafety("system")
3081cmd VkResult vkCreateSemaphore(
3082 VkDevice device,
3083 const VkSemaphoreCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003084 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003085 VkSemaphore* pSemaphore) {
3086 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
3087 deviceObject := GetDevice(device)
3088
3089 semaphore := ?
3090 pSemaphore[0] = semaphore
3091 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
3092
3093 return ?
3094}
3095
3096@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003097cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003098 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003099 VkSemaphore semaphore,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003100 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003101 deviceObject := GetDevice(device)
3102 semaphoreObject := GetSemaphore(semaphore)
3103 assert(semaphoreObject.device == device)
3104
3105 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003106}
3107
Jesse Halld27f6aa2015-08-15 17:58:48 -07003108
3109// Event functions
3110
3111@threadSafety("system")
3112cmd VkResult vkCreateEvent(
3113 VkDevice device,
3114 const VkEventCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003115 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003116 VkEvent* pEvent) {
3117 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
3118 deviceObject := GetDevice(device)
3119
3120 event := ?
3121 pEvent[0] = event
3122 State.Events[event] = new!EventObject(device: device)
3123
3124 return ?
3125}
3126
3127@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003128cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003129 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003130 VkEvent event,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003131 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003132 deviceObject := GetDevice(device)
3133 eventObject := GetEvent(event)
3134 assert(eventObject.device == device)
3135
3136 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003137}
3138
3139@threadSafety("system")
3140cmd VkResult vkGetEventStatus(
3141 VkDevice device,
3142 VkEvent event) {
3143 deviceObject := GetDevice(device)
3144 eventObject := GetEvent(event)
3145 assert(eventObject.device == device)
3146
3147 return ?
3148}
3149
3150@threadSafety("system")
3151cmd VkResult vkSetEvent(
3152 VkDevice device,
3153 VkEvent event) {
3154 deviceObject := GetDevice(device)
3155 eventObject := GetEvent(event)
3156 assert(eventObject.device == device)
3157
3158 return ?
3159}
3160
3161@threadSafety("system")
3162cmd VkResult vkResetEvent(
3163 VkDevice device,
3164 VkEvent event) {
3165 deviceObject := GetDevice(device)
3166 eventObject := GetEvent(event)
3167 assert(eventObject.device == device)
3168
3169 return ?
3170}
3171
3172
3173// Query functions
3174
3175@threadSafety("system")
3176cmd VkResult vkCreateQueryPool(
3177 VkDevice device,
3178 const VkQueryPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003179 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003180 VkQueryPool* pQueryPool) {
3181 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
3182 deviceObject := GetDevice(device)
3183
3184 queryPool := ?
3185 pQueryPool[0] = queryPool
3186 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
3187
3188 return ?
3189}
3190
3191@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003192cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003193 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003194 VkQueryPool queryPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003195 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003196 deviceObject := GetDevice(device)
3197 queryPoolObject := GetQueryPool(queryPool)
3198 assert(queryPoolObject.device == device)
3199
3200 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003201}
3202
3203@threadSafety("system")
3204cmd VkResult vkGetQueryPoolResults(
3205 VkDevice device,
3206 VkQueryPool queryPool,
3207 u32 startQuery,
3208 u32 queryCount,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003209 platform.size_t dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003210 void* pData,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003211 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003212 VkQueryResultFlags flags) {
3213 deviceObject := GetDevice(device)
3214 queryPoolObject := GetQueryPool(queryPool)
3215 assert(queryPoolObject.device == device)
3216
Jesse Halld27f6aa2015-08-15 17:58:48 -07003217 data := pData[0:dataSize]
3218
3219 return ?
3220}
3221
3222// Buffer functions
3223
3224@threadSafety("system")
3225cmd VkResult vkCreateBuffer(
3226 VkDevice device,
3227 const VkBufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003228 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003229 VkBuffer* pBuffer) {
3230 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
3231 deviceObject := GetDevice(device)
3232
3233 buffer := ?
3234 pBuffer[0] = buffer
3235 State.Buffers[buffer] = new!BufferObject(device: device)
3236
3237 return ?
3238}
3239
3240@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003241cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003242 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003243 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003244 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003245 deviceObject := GetDevice(device)
3246 bufferObject := GetBuffer(buffer)
3247 assert(bufferObject.device == device)
3248
Jesse Hall3fbc8562015-11-29 22:10:52 -08003249 assert(bufferObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003250 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003251}
3252
3253
3254// Buffer view functions
3255
3256@threadSafety("system")
3257cmd VkResult vkCreateBufferView(
3258 VkDevice device,
3259 const VkBufferViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003260 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003261 VkBufferView* pView) {
3262 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
3263 deviceObject := GetDevice(device)
3264
3265 bufferObject := GetBuffer(pCreateInfo.buffer)
3266 assert(bufferObject.device == device)
3267
3268 view := ?
3269 pView[0] = view
3270 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
3271
3272 return ?
3273}
3274
3275@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003276cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003277 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003278 VkBufferView bufferView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003279 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003280 deviceObject := GetDevice(device)
3281 bufferViewObject := GetBufferView(bufferView)
3282 assert(bufferViewObject.device == device)
3283
3284 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003285}
3286
3287
3288// Image functions
3289
3290@threadSafety("system")
3291cmd VkResult vkCreateImage(
3292 VkDevice device,
3293 const VkImageCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003294 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003295 VkImage* pImage) {
3296 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
3297 deviceObject := GetDevice(device)
3298
3299 image := ?
3300 pImage[0] = image
3301 State.Images[image] = new!ImageObject(device: device)
3302
3303 return ?
3304}
3305
3306@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003307cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003308 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003309 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003310 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003311 deviceObject := GetDevice(device)
3312 imageObject := GetImage(image)
3313 assert(imageObject.device == device)
3314
Jesse Hall3fbc8562015-11-29 22:10:52 -08003315 assert(imageObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003316 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003317}
3318
Jesse Hall606a54e2015-11-19 22:17:28 -08003319cmd void vkGetImageSubresourceLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003320 VkDevice device,
3321 VkImage image,
3322 const VkImageSubresource* pSubresource,
3323 VkSubresourceLayout* pLayout) {
3324 deviceObject := GetDevice(device)
3325 imageObject := GetImage(image)
3326 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003327}
3328
3329
3330// Image view functions
3331
3332@threadSafety("system")
3333cmd VkResult vkCreateImageView(
3334 VkDevice device,
3335 const VkImageViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003336 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003337 VkImageView* pView) {
3338 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
3339 deviceObject := GetDevice(device)
3340
3341 imageObject := GetImage(pCreateInfo.image)
3342 assert(imageObject.device == device)
3343
3344 view := ?
3345 pView[0] = view
3346 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
3347
3348 return ?
3349}
3350
3351@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003352cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003353 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003354 VkImageView imageView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003355 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003356 deviceObject := GetDevice(device)
3357 imageViewObject := GetImageView(imageView)
3358 assert(imageViewObject.device == device)
3359
3360 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003361}
3362
3363
3364// Shader functions
3365
3366cmd VkResult vkCreateShaderModule(
3367 VkDevice device,
3368 const VkShaderModuleCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003369 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003370 VkShaderModule* pShaderModule) {
3371 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
3372 deviceObject := GetDevice(device)
3373
3374 shaderModule := ?
3375 pShaderModule[0] = shaderModule
3376 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
3377
3378 return ?
3379}
3380
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003381cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003382 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003383 VkShaderModule shaderModule,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003384 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003385 deviceObject := GetDevice(device)
3386 shaderModuleObject := GetShaderModule(shaderModule)
3387 assert(shaderModuleObject.device == device)
3388
3389 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003390}
3391
Jesse Halld27f6aa2015-08-15 17:58:48 -07003392
3393// Pipeline functions
3394
3395cmd VkResult vkCreatePipelineCache(
3396 VkDevice device,
3397 const VkPipelineCacheCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003398 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003399 VkPipelineCache* pPipelineCache) {
3400 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
3401 deviceObject := GetDevice(device)
3402
3403 pipelineCache := ?
3404 pPipelineCache[0] = pipelineCache
3405 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
3406
3407 return ?
3408}
3409
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003410cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003411 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003412 VkPipelineCache pipelineCache,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003413 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003414 deviceObject := GetDevice(device)
3415 pipelineCacheObject := GetPipelineCache(pipelineCache)
3416 assert(pipelineCacheObject.device == device)
3417
3418 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003419}
3420
Jesse Halld27f6aa2015-08-15 17:58:48 -07003421cmd VkResult vkGetPipelineCacheData(
3422 VkDevice device,
3423 VkPipelineCache pipelineCache,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003424 platform.size_t* pDataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003425 void* pData) {
3426 deviceObject := GetDevice(device)
3427 pipelineCacheObject := GetPipelineCache(pipelineCache)
3428 assert(pipelineCacheObject.device == device)
3429
3430 return ?
3431}
3432
3433cmd VkResult vkMergePipelineCaches(
3434 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003435 VkPipelineCache dstCache,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003436 u32 srcCacheCount,
3437 const VkPipelineCache* pSrcCaches) {
3438 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003439 dstCacheObject := GetPipelineCache(dstCache)
3440 assert(dstCacheObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003441
3442 srcCaches := pSrcCaches[0:srcCacheCount]
3443 for i in (0 .. srcCacheCount) {
3444 srcCache := srcCaches[i]
3445 srcCacheObject := GetPipelineCache(srcCache)
3446 assert(srcCacheObject.device == device)
3447 }
3448
3449 return ?
3450}
3451
3452cmd VkResult vkCreateGraphicsPipelines(
3453 VkDevice device,
3454 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003455 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003456 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003457 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003458 VkPipeline* pPipelines) {
3459 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003460 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003461 pipelineCacheObject := GetPipelineCache(pipelineCache)
3462 assert(pipelineCacheObject.device == device)
3463 }
3464
Jesse Hall03b6fe12015-11-24 12:44:21 -08003465 createInfos := pCreateInfos[0:createInfoCount]
3466 pipelines := pPipelines[0:createInfoCount]
3467 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003468 pipeline := ?
3469 pipelines[i] = pipeline
3470 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3471 }
3472
3473 return ?
3474}
3475
3476cmd VkResult vkCreateComputePipelines(
3477 VkDevice device,
3478 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003479 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003480 const VkComputePipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003481 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003482 VkPipeline* pPipelines) {
3483 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003484 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003485 pipelineCacheObject := GetPipelineCache(pipelineCache)
3486 assert(pipelineCacheObject.device == device)
3487 }
3488
Jesse Hall03b6fe12015-11-24 12:44:21 -08003489 createInfos := pCreateInfos[0:createInfoCount]
3490 pipelines := pPipelines[0:createInfoCount]
3491 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003492 pipeline := ?
3493 pipelines[i] = pipeline
3494 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3495 }
3496
3497 return ?
3498}
3499
3500@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003501cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003502 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003503 VkPipeline pipeline,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003504 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003505 deviceObject := GetDevice(device)
3506 pipelineObjects := GetPipeline(pipeline)
3507 assert(pipelineObjects.device == device)
3508
3509 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003510}
3511
3512
3513// Pipeline layout functions
3514
3515@threadSafety("system")
3516cmd VkResult vkCreatePipelineLayout(
3517 VkDevice device,
3518 const VkPipelineLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003519 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003520 VkPipelineLayout* pPipelineLayout) {
3521 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3522 deviceObject := GetDevice(device)
3523
3524 pipelineLayout := ?
3525 pPipelineLayout[0] = pipelineLayout
3526 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3527
3528 return ?
3529}
3530
3531@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003532cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003533 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003534 VkPipelineLayout pipelineLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003535 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003536 deviceObject := GetDevice(device)
3537 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3538 assert(pipelineLayoutObjects.device == device)
3539
3540 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003541}
3542
3543
3544// Sampler functions
3545
3546@threadSafety("system")
3547cmd VkResult vkCreateSampler(
3548 VkDevice device,
3549 const VkSamplerCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003550 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003551 VkSampler* pSampler) {
3552 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3553 deviceObject := GetDevice(device)
3554
3555 sampler := ?
3556 pSampler[0] = sampler
3557 State.Samplers[sampler] = new!SamplerObject(device: device)
3558
3559 return ?
3560}
3561
3562@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003563cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003564 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003565 VkSampler sampler,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003566 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003567 deviceObject := GetDevice(device)
3568 samplerObject := GetSampler(sampler)
3569 assert(samplerObject.device == device)
3570
3571 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003572}
3573
3574
3575// Descriptor set functions
3576
3577@threadSafety("system")
3578cmd VkResult vkCreateDescriptorSetLayout(
3579 VkDevice device,
3580 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003581 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003582 VkDescriptorSetLayout* pSetLayout) {
3583 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3584 deviceObject := GetDevice(device)
3585
3586 setLayout := ?
3587 pSetLayout[0] = setLayout
3588 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3589
3590 return ?
3591}
3592
3593@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003594cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003595 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003596 VkDescriptorSetLayout descriptorSetLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003597 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003598 deviceObject := GetDevice(device)
3599 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3600 assert(descriptorSetLayoutObject.device == device)
3601
3602 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003603}
3604
3605@threadSafety("system")
3606cmd VkResult vkCreateDescriptorPool(
3607 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003608 const VkDescriptorPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003609 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003610 VkDescriptorPool* pDescriptorPool) {
3611 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3612 deviceObject := GetDevice(device)
3613
3614 descriptorPool := ?
3615 pDescriptorPool[0] = descriptorPool
3616 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3617
3618 return ?
3619}
3620
3621@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003622cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003623 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003624 VkDescriptorPool descriptorPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003625 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003626 deviceObject := GetDevice(device)
3627 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3628 assert(descriptorPoolObject.device == device)
3629
3630 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003631}
3632
3633@threadSafety("app")
3634cmd VkResult vkResetDescriptorPool(
3635 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003636 VkDescriptorPool descriptorPool,
3637 VkDescriptorPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003638 deviceObject := GetDevice(device)
3639 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3640 assert(descriptorPoolObject.device == device)
3641
3642 return ?
3643}
3644
3645@threadSafety("app")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003646cmd VkResult vkAllocateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003647 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003648 const VkDescriptorSetAllocateInfo* pAllocateInfo,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003649 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003650 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003651 allocInfo := pAllocateInfo[0]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003652 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003653
Jesse Hall03b6fe12015-11-24 12:44:21 -08003654 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount]
3655 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003656 setLayout := setLayouts[i]
3657 setLayoutObject := GetDescriptorSetLayout(setLayout)
3658 assert(setLayoutObject.device == device)
3659 }
3660
Jesse Hall03b6fe12015-11-24 12:44:21 -08003661 descriptorSets := pDescriptorSets[0:allocInfo.setCount]
3662 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003663 descriptorSet := ?
3664 descriptorSets[i] = descriptorSet
3665 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3666 }
3667
3668 return ?
3669}
3670
Jesse Hallf09c6b12015-08-15 19:54:28 -07003671cmd VkResult vkFreeDescriptorSets(
3672 VkDevice device,
3673 VkDescriptorPool descriptorPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003674 u32 descriptorSetCount,
Jesse Hallf09c6b12015-08-15 19:54:28 -07003675 const VkDescriptorSet* pDescriptorSets) {
3676 deviceObject := GetDevice(device)
3677 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3678
Jesse Hall03b6fe12015-11-24 12:44:21 -08003679 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3680 for i in (0 .. descriptorSetCount) {
Jesse Hallf09c6b12015-08-15 19:54:28 -07003681 descriptorSet := descriptorSets[i]
3682 descriptorSetObject := GetDescriptorSet(descriptorSet)
3683 assert(descriptorSetObject.device == device)
3684 State.DescriptorSets[descriptorSet] = null
3685 }
3686
3687 return ?
3688}
3689
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003690cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003691 VkDevice device,
Jesse Hallb00daad2015-11-29 19:46:20 -08003692 u32 descriptorWriteCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003693 const VkWriteDescriptorSet* pDescriptorWrites,
Jesse Hallb00daad2015-11-29 19:46:20 -08003694 u32 descriptorCopyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003695 const VkCopyDescriptorSet* pDescriptorCopies) {
3696 deviceObject := GetDevice(device)
3697
Jesse Hallb00daad2015-11-29 19:46:20 -08003698 descriptorWrites := pDescriptorWrites[0:descriptorWriteCount]
3699 for i in (0 .. descriptorWriteCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003700 descriptorWrite := descriptorWrites[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003701 descriptorWriteObject := GetDescriptorSet(descriptorWrite.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003702 assert(descriptorWriteObject.device == device)
3703 }
3704
Jesse Hallb00daad2015-11-29 19:46:20 -08003705 descriptorCopies := pDescriptorCopies[0:descriptorCopyCount]
3706 for i in (0 .. descriptorCopyCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003707 descriptorCopy := descriptorCopies[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003708 descriptorCopyObject := GetDescriptorSet(descriptorCopy.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003709 assert(descriptorCopyObject.device == device)
3710 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003711}
3712
3713
3714// Framebuffer functions
3715
3716@threadSafety("system")
3717cmd VkResult vkCreateFramebuffer(
3718 VkDevice device,
3719 const VkFramebufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003720 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003721 VkFramebuffer* pFramebuffer) {
3722 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3723 deviceObject := GetDevice(device)
3724
3725 framebuffer := ?
3726 pFramebuffer[0] = framebuffer
3727 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3728
3729 return ?
3730}
3731
3732@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003733cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003734 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003735 VkFramebuffer framebuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003736 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003737 deviceObject := GetDevice(device)
3738 framebufferObject := GetFramebuffer(framebuffer)
3739 assert(framebufferObject.device == device)
3740
3741 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003742}
3743
3744
3745// Renderpass functions
3746
3747@threadSafety("system")
3748cmd VkResult vkCreateRenderPass(
3749 VkDevice device,
3750 const VkRenderPassCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003751 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003752 VkRenderPass* pRenderPass) {
3753 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3754 deviceObject := GetDevice(device)
3755
3756 renderpass := ?
3757 pRenderPass[0] = renderpass
3758 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3759
3760 return ?
3761}
3762
3763@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003764cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003765 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003766 VkRenderPass renderPass,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003767 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003768 deviceObject := GetDevice(device)
3769 renderPassObject := GetRenderPass(renderPass)
3770 assert(renderPassObject.device == device)
3771
3772 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003773}
3774
Jesse Hall606a54e2015-11-19 22:17:28 -08003775cmd void vkGetRenderAreaGranularity(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003776 VkDevice device,
3777 VkRenderPass renderPass,
3778 VkExtent2D* pGranularity) {
3779 deviceObject := GetDevice(device)
3780 renderPassObject := GetRenderPass(renderPass)
3781
3782 granularity := ?
3783 pGranularity[0] = granularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07003784}
3785
3786// Command pool functions
3787
3788cmd VkResult vkCreateCommandPool(
3789 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003790 const VkCommandPoolCreateInfo* pCreateInfo,
3791 const VkAllocationCallbacks* pAllocator,
3792 VkCommandPool* pCommandPool) {
3793 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003794 deviceObject := GetDevice(device)
3795
Jesse Hall3fbc8562015-11-29 22:10:52 -08003796 commandPool := ?
3797 pCommandPool[0] = commandPool
3798 State.CommandPools[commandPool] = new!CommandPoolObject(device: device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003799
3800 return ?
3801}
3802
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003803cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003804 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003805 VkCommandPool commandPool,
3806 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003807 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003808 commandPoolObject := GetCommandPool(commandPool)
3809 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003810
Jesse Hall3fbc8562015-11-29 22:10:52 -08003811 State.CommandPools[commandPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003812}
3813
3814cmd VkResult vkResetCommandPool(
3815 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003816 VkCommandPool commandPool,
3817 VkCommandPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003818 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003819 commandPoolObject := GetCommandPool(commandPool)
3820 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003821
3822 return ?
3823}
3824
3825// Command buffer functions
3826
Jesse Hall3fbc8562015-11-29 22:10:52 -08003827macro void bindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3828 memoryObject := GetDeviceMemory(memory)
3829 memoryObject.boundCommandBuffers[commandBuffer] = commandBuffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07003830
Jesse Hall3fbc8562015-11-29 22:10:52 -08003831 commandBufferObject := GetCommandBuffer(commandBuffer)
3832 commandBufferObject.boundObjects[as!u64(obj)] = memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07003833}
3834
Jesse Hall3fbc8562015-11-29 22:10:52 -08003835macro void unbindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3836 memoryObject := GetDeviceMemory(memory)
3837 memoryObject.boundCommandBuffers[commandBuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003838
Jesse Hall3fbc8562015-11-29 22:10:52 -08003839 commandBufferObject := GetCommandBuffer(commandBuffer)
3840 commandBufferObject.boundObjects[as!u64(obj)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003841}
3842
3843@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003844cmd VkResult vkAllocateCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003845 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003846 const VkCommandBufferAllocateInfo* pAllocateInfo,
3847 VkCommandBuffer* pCommandBuffers) {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08003848 assert(pAllocateInfo[0].sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003849
Jesse Hall3fbc8562015-11-29 22:10:52 -08003850 count := pAllocateInfo[0].bufferCount
3851 commandBuffers := pCommandBuffers[0:count]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003852 for i in (0 .. count) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003853 commandBuffer := ?
3854 commandBuffers[i] = commandBuffer
3855 State.CommandBuffers[commandBuffer] = new!CommandBufferObject(device: device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003856 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003857
3858 return ?
3859}
3860
3861@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003862cmd void vkFreeCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003863 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003864 VkCommandPool commandPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003865 u32 commandBufferCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003866 const VkCommandBuffer* pCommandBuffers) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003867 deviceObject := GetDevice(device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003868
Jesse Hall3fbc8562015-11-29 22:10:52 -08003869 commandBuffers := pCommandBuffers[0:commandBufferCount]
Jesse Hall03b6fe12015-11-24 12:44:21 -08003870 for i in (0 .. commandBufferCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003871 commandBufferObject := GetCommandBuffer(commandBuffers[i])
3872 assert(commandBufferObject.device == device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003873 // TODO: iterate over boundObjects and clear memory bindings
Jesse Hall3fbc8562015-11-29 22:10:52 -08003874 State.CommandBuffers[commandBuffers[i]] = null
Jesse Hallfbf97b02015-11-20 14:17:03 -08003875 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003876}
3877
3878@threadSafety("app")
3879cmd VkResult vkBeginCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003880 VkCommandBuffer commandBuffer,
3881 const VkCommandBufferBeginInfo* pBeginInfo) {
3882 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO)
3883 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003884
3885 // TODO: iterate over boundObjects and clear memory bindings
3886
3887 return ?
3888}
3889
3890@threadSafety("app")
3891cmd VkResult vkEndCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003892 VkCommandBuffer commandBuffer) {
3893 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003894
3895 return ?
3896}
3897
3898@threadSafety("app")
3899cmd VkResult vkResetCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003900 VkCommandBuffer commandBuffer,
3901 VkCommandBufferResetFlags flags) {
3902 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003903
3904 // TODO: iterate over boundObjects and clear memory bindings
3905
3906 return ?
3907}
3908
3909
3910// Command buffer building functions
3911
3912@threadSafety("app")
3913cmd void vkCmdBindPipeline(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003914 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003915 VkPipelineBindPoint pipelineBindPoint,
3916 VkPipeline pipeline) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003917 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003918 pipelineObject := GetPipeline(pipeline)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003919 assert(commandBufferObject.device == pipelineObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003920
Jesse Halld8bade02015-11-24 10:24:18 -08003921 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003922 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3923 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3924 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08003925 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003926}
3927
3928@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003929cmd void vkCmdSetViewport(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003930 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003931 u32 viewportCount,
3932 const VkViewport* pViewports) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003933 commandBufferObject := GetCommandBuffer(commandBuffer)
3934 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003935}
3936
3937@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003938cmd void vkCmdSetScissor(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003939 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003940 u32 scissorCount,
3941 const VkRect2D* pScissors) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003942 commandBufferObject := GetCommandBuffer(commandBuffer)
3943 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003944}
3945
3946@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003947cmd void vkCmdSetLineWidth(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003948 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003949 f32 lineWidth) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003950 commandBufferObject := GetCommandBuffer(commandBuffer)
3951 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003952}
3953
3954@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003955cmd void vkCmdSetDepthBias(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003956 VkCommandBuffer commandBuffer,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003957 f32 depthBiasConstantFactor,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003958 f32 depthBiasClamp,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003959 f32 depthBiasSlopeFactor) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003960 commandBufferObject := GetCommandBuffer(commandBuffer)
3961 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003962}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003963
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003964@threadSafety("app")
3965cmd void vkCmdSetBlendConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003966 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003967 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3968 // an annotation as a quick hack to pass this to the template without
3969 // having to modify the AST and semantic model.
Jesse Hallb00daad2015-11-29 19:46:20 -08003970 @readonly f32[4] blendConstants) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003971 commandBufferObject := GetCommandBuffer(commandBuffer)
3972 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003973}
3974
3975@threadSafety("app")
3976cmd void vkCmdSetDepthBounds(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003977 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003978 f32 minDepthBounds,
3979 f32 maxDepthBounds) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003980 commandBufferObject := GetCommandBuffer(commandBuffer)
3981 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003982}
3983
3984@threadSafety("app")
3985cmd void vkCmdSetStencilCompareMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003986 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003987 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08003988 u32 compareMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003989 commandBufferObject := GetCommandBuffer(commandBuffer)
3990 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003991}
3992
3993@threadSafety("app")
3994cmd void vkCmdSetStencilWriteMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003995 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003996 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08003997 u32 writeMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003998 commandBufferObject := GetCommandBuffer(commandBuffer)
3999 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004000}
4001
4002@threadSafety("app")
4003cmd void vkCmdSetStencilReference(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004004 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004005 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08004006 u32 reference) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004007 commandBufferObject := GetCommandBuffer(commandBuffer)
4008 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004009}
4010
4011@threadSafety("app")
4012cmd void vkCmdBindDescriptorSets(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004013 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004014 VkPipelineBindPoint pipelineBindPoint,
4015 VkPipelineLayout layout,
4016 u32 firstSet,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004017 u32 descriptorSetCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004018 const VkDescriptorSet* pDescriptorSets,
4019 u32 dynamicOffsetCount,
4020 const u32* pDynamicOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004021 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004022
Jesse Hall03b6fe12015-11-24 12:44:21 -08004023 descriptorSets := pDescriptorSets[0:descriptorSetCount]
4024 for i in (0 .. descriptorSetCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004025 descriptorSet := descriptorSets[i]
4026 descriptorSetObject := GetDescriptorSet(descriptorSet)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004027 assert(commandBufferObject.device == descriptorSetObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004028 }
4029
4030 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
4031 for i in (0 .. dynamicOffsetCount) {
4032 dynamicOffset := dynamicOffsets[i]
4033 }
4034
Jesse Halld8bade02015-11-24 10:24:18 -08004035 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004036 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
4037 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
4038 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08004039 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004040}
4041
4042@threadSafety("app")
4043cmd void vkCmdBindIndexBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004044 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004045 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004046 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004047 VkIndexType indexType) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004048 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004049 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004050 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004051
Jesse Hall3fbc8562015-11-29 22:10:52 -08004052 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004053
Jesse Hall3fbc8562015-11-29 22:10:52 -08004054 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004055}
4056
4057@threadSafety("app")
4058cmd void vkCmdBindVertexBuffers(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004059 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004060 u32 startBinding,
4061 u32 bindingCount,
4062 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004063 const VkDeviceSize* pOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004064 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004065
4066 // TODO: check if not [startBinding:startBinding+bindingCount]
4067 buffers := pBuffers[0:bindingCount]
4068 offsets := pOffsets[0:bindingCount]
4069 for i in (0 .. bindingCount) {
4070 buffer := buffers[i]
4071 offset := offsets[i]
4072 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004073 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004074
Jesse Hall3fbc8562015-11-29 22:10:52 -08004075 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004076 }
4077
Jesse Hall3fbc8562015-11-29 22:10:52 -08004078 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004079}
4080
4081@threadSafety("app")
4082cmd void vkCmdDraw(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004083 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004084 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004085 u32 instanceCount,
4086 u32 firstVertex,
4087 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004088 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004089
Jesse Hall3fbc8562015-11-29 22:10:52 -08004090 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004091}
4092
4093@threadSafety("app")
4094cmd void vkCmdDrawIndexed(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004095 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004096 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004097 u32 instanceCount,
4098 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004099 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004100 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004101 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004102
Jesse Hall3fbc8562015-11-29 22:10:52 -08004103 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004104}
4105
4106@threadSafety("app")
4107cmd void vkCmdDrawIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004108 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004109 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004110 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004111 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004112 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004113 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004114 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004115 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004116
Jesse Hall3fbc8562015-11-29 22:10:52 -08004117 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004118
Jesse Hall3fbc8562015-11-29 22:10:52 -08004119 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004120}
4121
4122@threadSafety("app")
4123cmd void vkCmdDrawIndexedIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004124 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004125 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004126 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004127 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004128 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004129 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004130 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004131 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004132
Jesse Hall3fbc8562015-11-29 22:10:52 -08004133 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004134
Jesse Hall3fbc8562015-11-29 22:10:52 -08004135 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004136}
4137
4138@threadSafety("app")
4139cmd void vkCmdDispatch(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004140 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004141 u32 x,
4142 u32 y,
4143 u32 z) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004144 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004145
Jesse Hall3fbc8562015-11-29 22:10:52 -08004146 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004147}
4148
4149@threadSafety("app")
4150cmd void vkCmdDispatchIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004151 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004152 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004153 VkDeviceSize offset) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004154 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004155 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004156 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004157
Jesse Hall3fbc8562015-11-29 22:10:52 -08004158 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004159
Jesse Hall3fbc8562015-11-29 22:10:52 -08004160 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004161}
4162
4163@threadSafety("app")
4164cmd void vkCmdCopyBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004165 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004166 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004167 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004168 u32 regionCount,
4169 const VkBufferCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004170 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004171 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004172 dstBufferObject := GetBuffer(dstBuffer)
4173 assert(commandBufferObject.device == srcBufferObject.device)
4174 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004175
4176 regions := pRegions[0:regionCount]
4177 for i in (0 .. regionCount) {
4178 region := regions[i]
4179 }
4180
Jesse Hall3fbc8562015-11-29 22:10:52 -08004181 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4182 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004183
Jesse Hall65ab5522015-11-30 00:07:16 -08004184 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004185}
4186
4187@threadSafety("app")
4188cmd void vkCmdCopyImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004189 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004190 VkImage srcImage,
4191 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004192 VkImage dstImage,
4193 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004194 u32 regionCount,
4195 const VkImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004196 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004197 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004198 dstImageObject := GetImage(dstImage)
4199 assert(commandBufferObject.device == srcImageObject.device)
4200 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004201
4202 regions := pRegions[0:regionCount]
4203 for i in (0 .. regionCount) {
4204 region := regions[i]
4205 }
4206
Jesse Hall3fbc8562015-11-29 22:10:52 -08004207 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4208 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004209
Jesse Hall65ab5522015-11-30 00:07:16 -08004210 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004211}
4212
4213@threadSafety("app")
4214cmd void vkCmdBlitImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004215 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004216 VkImage srcImage,
4217 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004218 VkImage dstImage,
4219 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004220 u32 regionCount,
4221 const VkImageBlit* pRegions,
Jesse Hall23ff73f2015-11-29 14:36:39 -08004222 VkFilter filter) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004223 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004224 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004225 dstImageObject := GetImage(dstImage)
4226 assert(commandBufferObject.device == srcImageObject.device)
4227 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004228
4229 regions := pRegions[0:regionCount]
4230 for i in (0 .. regionCount) {
4231 region := regions[i]
4232 }
4233
Jesse Hall3fbc8562015-11-29 22:10:52 -08004234 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4235 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004236
Jesse Hall3fbc8562015-11-29 22:10:52 -08004237 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004238}
4239
4240@threadSafety("app")
4241cmd void vkCmdCopyBufferToImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004242 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004243 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004244 VkImage dstImage,
4245 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004246 u32 regionCount,
4247 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004248 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004249 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004250 dstImageObject := GetImage(dstImage)
4251 assert(commandBufferObject.device == srcBufferObject.device)
4252 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004253
4254 regions := pRegions[0:regionCount]
4255 for i in (0 .. regionCount) {
4256 region := regions[i]
4257 }
4258
Jesse Hall3fbc8562015-11-29 22:10:52 -08004259 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4260 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004261
Jesse Hall65ab5522015-11-30 00:07:16 -08004262 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004263}
4264
4265@threadSafety("app")
4266cmd void vkCmdCopyImageToBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004267 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004268 VkImage srcImage,
4269 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004270 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004271 u32 regionCount,
4272 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004273 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004274 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004275 dstBufferObject := GetBuffer(dstBuffer)
4276 assert(commandBufferObject.device == srcImageObject.device)
4277 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004278
4279 regions := pRegions[0:regionCount]
4280 for i in (0 .. regionCount) {
4281 region := regions[i]
4282 }
4283
Jesse Hall3fbc8562015-11-29 22:10:52 -08004284 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4285 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004286
Jesse Hall65ab5522015-11-30 00:07:16 -08004287 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004288}
4289
4290@threadSafety("app")
4291cmd void vkCmdUpdateBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004292 VkCommandBuffer commandBuffer,
4293 VkBuffer dstBuffer,
4294 VkDeviceSize dstOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004295 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004296 const u32* pData) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004297 commandBufferObject := GetCommandBuffer(commandBuffer)
4298 dstBufferObject := GetBuffer(dstBuffer)
4299 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004300
4301 data := pData[0:dataSize]
4302
Jesse Hall3fbc8562015-11-29 22:10:52 -08004303 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004304
Jesse Hall65ab5522015-11-30 00:07:16 -08004305 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004306}
4307
4308@threadSafety("app")
4309cmd void vkCmdFillBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004310 VkCommandBuffer commandBuffer,
4311 VkBuffer dstBuffer,
4312 VkDeviceSize dstOffset,
Jesse Hallb00daad2015-11-29 19:46:20 -08004313 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004314 u32 data) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004315 commandBufferObject := GetCommandBuffer(commandBuffer)
4316 dstBufferObject := GetBuffer(dstBuffer)
4317 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004318
Jesse Hall65ab5522015-11-30 00:07:16 -08004319 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004320}
4321
4322@threadSafety("app")
4323cmd void vkCmdClearColorImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004324 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004325 VkImage image,
4326 VkImageLayout imageLayout,
4327 const VkClearColorValue* pColor,
4328 u32 rangeCount,
4329 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004330 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004331 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004332 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004333
4334 ranges := pRanges[0:rangeCount]
4335 for i in (0 .. rangeCount) {
4336 range := ranges[i]
4337 }
4338
Jesse Hall3fbc8562015-11-29 22:10:52 -08004339 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004340
Jesse Hall3fbc8562015-11-29 22:10:52 -08004341 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004342}
4343
4344@threadSafety("app")
4345cmd void vkCmdClearDepthStencilImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004346 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004347 VkImage image,
4348 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004349 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004350 u32 rangeCount,
4351 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004352 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004353 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004354 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004355
4356 ranges := pRanges[0:rangeCount]
4357 for i in (0 .. rangeCount) {
4358 range := ranges[i]
4359 }
4360
Jesse Hall3fbc8562015-11-29 22:10:52 -08004361 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004362
Jesse Hall3fbc8562015-11-29 22:10:52 -08004363 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004364}
4365
4366@threadSafety("app")
Jesse Hallae38f732015-11-19 21:32:50 -08004367cmd void vkCmdClearAttachments(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004368 VkCommandBuffer commandBuffer,
Jesse Hallae38f732015-11-19 21:32:50 -08004369 u32 attachmentCount,
4370 const VkClearAttachment* pAttachments,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004371 u32 rectCount,
Jesse Halla15a4bf2015-11-19 22:48:02 -08004372 const VkClearRect* pRects) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004373 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004374
4375 rects := pRects[0:rectCount]
4376 for i in (0 .. rectCount) {
4377 rect := rects[i]
4378 }
4379
Jesse Hall3fbc8562015-11-29 22:10:52 -08004380 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004381}
4382
4383@threadSafety("app")
4384cmd void vkCmdResolveImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004385 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004386 VkImage srcImage,
4387 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004388 VkImage dstImage,
4389 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004390 u32 regionCount,
4391 const VkImageResolve* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004392 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004393 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004394 dstImageObject := GetImage(dstImage)
4395 assert(commandBufferObject.device == srcImageObject.device)
4396 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004397
4398 regions := pRegions[0:regionCount]
4399 for i in (0 .. regionCount) {
4400 region := regions[i]
4401 }
4402
Jesse Hall3fbc8562015-11-29 22:10:52 -08004403 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4404 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004405
Jesse Hall3fbc8562015-11-29 22:10:52 -08004406 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004407}
4408
4409@threadSafety("app")
4410cmd void vkCmdSetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004411 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004412 VkEvent event,
4413 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004414 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004415 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004416 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004417}
4418
4419@threadSafety("app")
4420cmd void vkCmdResetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004421 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004422 VkEvent event,
4423 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004424 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004425 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004426 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004427}
4428
4429@threadSafety("app")
4430cmd void vkCmdWaitEvents(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004431 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004432 u32 eventCount,
4433 const VkEvent* pEvents,
4434 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004435 VkPipelineStageFlags dstStageMask,
4436 u32 memoryBarrierCount,
4437 const void* const* ppMemoryBarriers) {
4438 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004439
4440 events := pEvents[0:eventCount]
4441 for i in (0 .. eventCount) {
4442 event := events[i]
4443 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004444 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004445 }
4446
Jesse Hall3fbc8562015-11-29 22:10:52 -08004447 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4448 for i in (0 .. memoryBarrierCount) {
4449 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004450 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004451 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004452 }
4453 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004454 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4455 imageObject := GetImage(imageMemoryBarrier.image)
4456 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004457 }
4458 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004459 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4460 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4461 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004462 }
4463 }
4464 }
4465}
4466
4467@threadSafety("app")
4468cmd void vkCmdPipelineBarrier(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004469 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004470 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004471 VkPipelineStageFlags dstStageMask,
Jesse Halldc6d36c2015-11-29 19:12:15 -08004472 VkDependencyFlags dependencyFlags,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004473 u32 memoryBarrierCount,
4474 const void* const* ppMemoryBarriers) {
4475 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004476
Jesse Hall3fbc8562015-11-29 22:10:52 -08004477 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4478 for i in (0 .. memoryBarrierCount) {
4479 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004480 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004481 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004482 }
4483 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004484 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4485 imageObject := GetImage(imageMemoryBarrier.image)
4486 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004487 }
4488 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004489 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4490 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4491 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004492 }
4493 }
4494 }
4495}
4496
4497@threadSafety("app")
4498cmd void vkCmdBeginQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004499 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004500 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004501 u32 entry,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004502 VkQueryControlFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004503 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004504 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004505 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004506}
4507
4508@threadSafety("app")
4509cmd void vkCmdEndQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004510 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004511 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004512 u32 entry) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004513 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004514 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004515 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004516}
4517
4518@threadSafety("app")
4519cmd void vkCmdResetQueryPool(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004520 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004521 VkQueryPool queryPool,
4522 u32 startQuery,
4523 u32 queryCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004524 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004525 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004526 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004527}
4528
4529@threadSafety("app")
4530cmd void vkCmdWriteTimestamp(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004531 VkCommandBuffer commandBuffer,
Jesse Hall6f39a6d2015-11-24 11:08:36 -08004532 VkPipelineStageFlagBits pipelineStage,
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004533 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004534 u32 entry) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004535 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004536 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004537 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004538}
4539
4540@threadSafety("app")
4541cmd void vkCmdCopyQueryPoolResults(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004542 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004543 VkQueryPool queryPool,
4544 u32 startQuery,
4545 u32 queryCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004546 VkBuffer dstBuffer,
4547 VkDeviceSize dstOffset,
Jesse Halla9bb62b2015-11-21 19:31:56 -08004548 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004549 VkQueryResultFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004550 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004551 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004552 dstBufferObject := GetBuffer(dstBuffer)
4553 assert(commandBufferObject.device == queryPoolObject.device)
4554 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004555}
4556
4557cmd void vkCmdPushConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004558 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004559 VkPipelineLayout layout,
4560 VkShaderStageFlags stageFlags,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004561 u32 offset,
4562 u32 size,
Jesse Hallf4ab2b12015-11-30 16:04:55 -08004563 const void* pValues) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004564 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004565 layoutObject := GetPipelineLayout(layout)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004566 assert(commandBufferObject.device == layoutObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004567}
4568
4569@threadSafety("app")
4570cmd void vkCmdBeginRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004571 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004572 const VkRenderPassBeginInfo* pRenderPassBegin,
Jesse Hall65ab5522015-11-30 00:07:16 -08004573 VkSubpassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004574 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004575 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4576 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004577 assert(commandBufferObject.device == renderPassObject.device)
4578 assert(commandBufferObject.device == framebufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004579
Jesse Hall3fbc8562015-11-29 22:10:52 -08004580 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004581}
4582
4583cmd void vkCmdNextSubpass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004584 VkCommandBuffer commandBuffer,
Jesse Hall65ab5522015-11-30 00:07:16 -08004585 VkSubpassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004586 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004587}
4588
4589@threadSafety("app")
4590cmd void vkCmdEndRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004591 VkCommandBuffer commandBuffer) {
4592 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004593
Jesse Hall3fbc8562015-11-29 22:10:52 -08004594 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004595}
4596
4597cmd void vkCmdExecuteCommands(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004598 VkCommandBuffer commandBuffer,
4599 u32 commandBuffersCount,
4600 const VkCommandBuffer* pCommandBuffers) {
4601 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004602
Jesse Hall3fbc8562015-11-29 22:10:52 -08004603 commandBuffers := pCommandBuffers[0:commandBuffersCount]
4604 for i in (0 .. commandBuffersCount) {
4605 secondaryCommandBuffer := commandBuffers[i]
4606 secondaryCommandBufferObject := GetCommandBuffer(secondaryCommandBuffer)
4607 assert(commandBufferObject.device == secondaryCommandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004608 }
4609}
4610
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004611@extension("VK_KHR_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004612cmd void vkDestroySurfaceKHR(
4613 VkInstance instance,
Jesse Hall0e74f002015-11-30 11:37:59 -08004614 VkSurfaceKHR surface,
4615 const VkAllocationCallbacks* pAllocator) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004616 instanceObject := GetInstance(instance)
4617 surfaceObject := GetSurface(surface)
4618 assert(surfaceObject.instance == instance)
Michael Lentine88594d72015-11-12 12:49:45 -08004619
Jesse Hall1356b0d2015-11-23 17:24:58 -08004620 State.Surfaces[surface] = null
Jesse Hall2818f932015-11-19 21:19:17 -08004621}
4622
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004623@extension("VK_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004624cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004625 VkPhysicalDevice physicalDevice,
4626 u32 queueFamilyIndex,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004627 VkSurfaceKHR surface,
Jesse Hallb00daad2015-11-29 19:46:20 -08004628 VkBool32* pSupported) {
4629 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004630
4631 return ?
4632}
4633
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004634@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004635cmd VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
4636 VkPhysicalDevice physicalDevice,
4637 VkSurfaceKHR surface,
4638 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
4639 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4640
4641 surfaceCapabilities := ?
4642 pSurfaceCapabilities[0] = surfaceCapabilities
4643
4644 return ?
4645}
4646
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004647@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004648cmd VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(
4649 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004650 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004651 u32* pSurfaceFormatCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004652 VkSurfaceFormatKHR* pSurfaceFormats) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004653 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004654
4655 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004656 pSurfaceFormatCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004657 surfaceFormats := pSurfaceFormats[0:count]
4658
4659 for i in (0 .. count) {
4660 surfaceFormat := ?
4661 surfaceFormats[i] = surfaceFormat
4662 }
4663
4664 return ?
4665}
4666
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004667@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004668cmd VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(
4669 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004670 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004671 u32* pPresentModeCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004672 VkPresentModeKHR* pPresentModes) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004673 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004674
4675 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004676 pPresentModeCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004677 presentModes := pPresentModes[0:count]
4678
4679 for i in (0 .. count) {
4680 presentMode := ?
4681 presentModes[i] = presentMode
4682 }
4683
4684 return ?
4685}
4686
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004687@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004688cmd VkResult vkCreateSwapchainKHR(
4689 VkDevice device,
4690 const VkSwapchainCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004691 const VkAllocationCallbacks* pAllocator,
Michael Lentine88594d72015-11-12 12:49:45 -08004692 VkSwapchainKHR* pSwapchain) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004693 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
Michael Lentine88594d72015-11-12 12:49:45 -08004694 deviceObject := GetDevice(device)
4695
4696 swapchain := ?
4697 pSwapchain[0] = swapchain
4698 State.Swapchains[swapchain] = new!SwapchainObject(device: device)
4699
4700 return ?
4701}
4702
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004703@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004704cmd void vkDestroySwapchainKHR(
Michael Lentine88594d72015-11-12 12:49:45 -08004705 VkDevice device,
Jesse Hall0e74f002015-11-30 11:37:59 -08004706 VkSwapchainKHR swapchain,
4707 const VkAllocationCallbacks* pAllocator) {
Michael Lentine88594d72015-11-12 12:49:45 -08004708 deviceObject := GetDevice(device)
4709 swapchainObject := GetSwapchain(swapchain)
4710 assert(swapchainObject.device == device)
4711
4712 State.Swapchains[swapchain] = null
Michael Lentine88594d72015-11-12 12:49:45 -08004713}
4714
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004715@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004716cmd VkResult vkGetSwapchainImagesKHR(
4717 VkDevice device,
4718 VkSwapchainKHR swapchain,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004719 u32* pSwapchainImageCount,
Michael Lentine88594d72015-11-12 12:49:45 -08004720 VkImage* pSwapchainImages) {
4721 deviceObject := GetDevice(device)
4722
4723 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004724 pSwapchainImageCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004725 swapchainImages := pSwapchainImages[0:count]
4726
4727 for i in (0 .. count) {
4728 swapchainImage := ?
4729 swapchainImages[i] = swapchainImage
Jesse Hall1356b0d2015-11-23 17:24:58 -08004730 State.Images[swapchainImage] = new!ImageObject(device: device)
Michael Lentine88594d72015-11-12 12:49:45 -08004731 }
4732
4733 return ?
4734}
4735
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004736@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004737cmd VkResult vkAcquireNextImageKHR(
4738 VkDevice device,
4739 VkSwapchainKHR swapchain,
4740 u64 timeout,
4741 VkSemaphore semaphore,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004742 VkFence fence,
Michael Lentine88594d72015-11-12 12:49:45 -08004743 u32* pImageIndex) {
4744 deviceObject := GetDevice(device)
4745 swapchainObject := GetSwapchain(swapchain)
4746
4747 imageIndex := ?
4748 pImageIndex[0] = imageIndex
4749
4750 return ?
4751}
4752
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004753@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004754cmd VkResult vkQueuePresentKHR(
4755 VkQueue queue,
Jesse Hallf4ab2b12015-11-30 16:04:55 -08004756 const VkPresentInfoKHR* pPresentInfo) {
Michael Lentine88594d72015-11-12 12:49:45 -08004757 queueObject := GetQueue(queue)
4758
4759 presentInfo := ?
4760 pPresentInfo[0] = presentInfo
4761
4762 return ?
4763}
4764
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004765@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004766cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
4767 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004768 u32* pPropertyCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004769 VkDisplayPropertiesKHR* pProperties) {
4770 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4771 return ?
4772}
4773
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004774@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004775cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
4776 VkPhysicalDevice physicalDevice,
4777 u32* pPropertyCount,
4778 VkDisplayPlanePropertiesKHR* pProperties) {
4779 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4780 return ?
4781}
4782
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004783@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004784cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR(
4785 VkPhysicalDevice physicalDevice,
Jesse Hallf4ab2b12015-11-30 16:04:55 -08004786 u32* pDisplayCount,
4787 VkDisplayKHR* pDisplays) {
Jesse Halla6429252015-11-29 18:59:42 -08004788 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4789 return ?
4790}
4791
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004792@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004793cmd VkResult vkGetDisplayModePropertiesKHR(
4794 VkPhysicalDevice physicalDevice,
4795 VkDisplayKHR display,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004796 u32* pPropertyCount,
4797 VkDisplayModePropertiesKHR* pProperties) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004798 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4799 return ?
4800}
4801
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004802@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004803cmd VkResult vkCreateDisplayModeKHR(
4804 VkPhysicalDevice physicalDevice,
4805 VkDisplayKHR display,
4806 const VkDisplayModeCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004807 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004808 VkDisplayModeKHR* pMode) {
4809 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4810 return ?
4811}
4812
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004813@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004814cmd VkResult vkGetDisplayPlaneCapabilitiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004815 VkPhysicalDevice physicalDevice,
Jesse Halla6429252015-11-29 18:59:42 -08004816 VkDisplayModeCreateInfoKHR mode,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004817 u32 planeIndex,
Jesse Halla6429252015-11-29 18:59:42 -08004818 VkDisplayPlaneCapabilitiesKHR* pCapabilities) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004819 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4820 return ?
4821}
4822
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004823@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004824cmd VkResult vkCreateDisplayPlaneSurfaceKHR(
4825 VkInstance instance,
4826 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004827 const VkAllocationCallbacks* pAllocator,
Jesse Halla6429252015-11-29 18:59:42 -08004828 VkSurfaceKHR* pSurface) {
4829 return ?
4830}
4831
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004832@extension("VK_KHR_xlib_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004833cmd VkResult vkCreateXlibSurfaceKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004834 VkInstance instance,
4835 platform.Display* dpy,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004836 platform.Window window,
Jesse Hall0e74f002015-11-30 11:37:59 -08004837 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004838 VkSurfaceKHR* pSurface) {
4839 instanceObject := GetInstance(instance)
4840 return ?
4841}
4842
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004843@extension("VK_KHR_xlib_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004844cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
4845 VkPhysicalDevice physicalDevice,
4846 u32 queueFamilyIndex,
4847 platform.Display* dpy,
Jesse Hall65ab5522015-11-30 00:07:16 -08004848 platform.VisualID visualID) {
Jesse Halla6429252015-11-29 18:59:42 -08004849 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4850 return ?
4851}
4852
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004853@extension("VK_KHR_xcb_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004854cmd VkResult vkCreateXCBSurfaceKHR(
4855 VkInstance instance,
4856 platform.xcb_connection_t* connection,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004857 platform.xcb_window_t window,
Jesse Hall0e74f002015-11-30 11:37:59 -08004858 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004859 VkSurfaceKHR* pSurface) {
4860 instanceObject := GetInstance(instance)
4861 return ?
4862}
4863
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004864@extension("VK_KHR_xlib_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004865cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
4866 VkPhysicalDevice physicalDevice,
4867 u32 queueFamilyIndex,
4868 platform.xcb_connection_t* connection,
4869 platform.xcb_visualid_t visual_id) {
4870 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4871 return ?
4872}
4873
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004874@extension("VK_KHR_wayland_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004875cmd VkResult vkCreateWaylandSurfaceKHR(
4876 VkInstance instance,
4877 platform.wl_display* display,
4878 platform.wl_surface* surface,
Jesse Hall0e74f002015-11-30 11:37:59 -08004879 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004880 VkSurfaceKHR* pSurface) {
4881 instanceObject := GetInstance(instance)
4882 return ?
4883}
4884
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004885@extension("VK_KHR_wayland_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004886cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
4887 VkPhysicalDevice physicalDevice,
4888 u32 queueFamilyIndex,
4889 platform.wl_display* display) {
4890 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4891 return ?
4892}
4893
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004894@extension("VK_KHR_mir_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004895cmd VkResult vkCreateMirSurfaceKHR(
4896 VkInstance instance,
4897 platform.MirConnection* connection,
4898 platform.MirSurface* mirSurface,
Jesse Hall0e74f002015-11-30 11:37:59 -08004899 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004900 VkSurfaceKHR* pSurface) {
4901 instanceObject := GetInstance(instance)
4902 return ?
4903}
4904
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004905@extension("VK_KHR_mir_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004906cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR(
4907 VkPhysicalDevice physicalDevice,
4908 u32 queueFamilyIndex,
4909 platform.MirConnection* connection) {
4910 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4911 return ?
4912}
4913
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004914@extension("VK_KHR_android_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004915cmd VkResult vkCreateAndroidSurfaceKHR(
4916 VkInstance instance,
Jesse Hall0e74f002015-11-30 11:37:59 -08004917 platform.ANativeWindow* window,
4918 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004919 VkSurfaceKHR* pSurface) {
4920 instanceObject := GetInstance(instance)
4921 return ?
4922}
4923
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004924@extension("VK_KHR_win32_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004925cmd VkResult vkCreateWin32SurfaceKHR(
4926 VkInstance instance,
4927 platform.HINSTANCE hinstance,
4928 platform.HWND hwnd,
Jesse Hall0e74f002015-11-30 11:37:59 -08004929 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004930 VkSurfaceKHR* pSurface) {
4931 instanceObject := GetInstance(instance)
4932 return ?
4933}
4934
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004935@extension("VK_KHR_win32_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004936cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR(
4937 VkPhysicalDevice physicalDevice,
4938 u32 queueFamilyIndex) {
4939 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4940 return ?
4941}
4942
Jesse Halld27f6aa2015-08-15 17:58:48 -07004943
4944////////////////
4945// Validation //
4946////////////////
4947
4948extern void validate(string layerName, bool condition, string message)
4949
4950
4951/////////////////////////////
4952// Internal State Tracking //
4953/////////////////////////////
4954
4955StateObject State
4956
4957@internal class StateObject {
4958 // Dispatchable objects.
4959 map!(VkInstance, ref!InstanceObject) Instances
4960 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4961 map!(VkDevice, ref!DeviceObject) Devices
4962 map!(VkQueue, ref!QueueObject) Queues
Jesse Hall3fbc8562015-11-29 22:10:52 -08004963 map!(VkCommandBuffer, ref!CommandBufferObject) CommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07004964
4965 // Non-dispatchable objects.
4966 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4967 map!(VkBuffer, ref!BufferObject) Buffers
4968 map!(VkBufferView, ref!BufferViewObject) BufferViews
4969 map!(VkImage, ref!ImageObject) Images
4970 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004971 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
Jesse Halld27f6aa2015-08-15 17:58:48 -07004972 map!(VkPipeline, ref!PipelineObject) Pipelines
4973 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4974 map!(VkSampler, ref!SamplerObject) Samplers
4975 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4976 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4977 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004978 map!(VkFence, ref!FenceObject) Fences
4979 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4980 map!(VkEvent, ref!EventObject) Events
4981 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4982 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4983 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4984 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
Jesse Hall3fbc8562015-11-29 22:10:52 -08004985 map!(VkCommandPool, ref!CommandPoolObject) CommandPools
Jesse Hall1356b0d2015-11-23 17:24:58 -08004986 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces
Michael Lentine88594d72015-11-12 12:49:45 -08004987 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains
Jesse Halld27f6aa2015-08-15 17:58:48 -07004988}
4989
4990@internal class InstanceObject {
4991}
4992
4993@internal class PhysicalDeviceObject {
4994 VkInstance instance
4995}
4996
4997@internal class DeviceObject {
4998 VkPhysicalDevice physicalDevice
4999}
5000
5001@internal class QueueObject {
5002 VkDevice device
5003 VkQueueFlags flags
5004}
5005
Jesse Hall3fbc8562015-11-29 22:10:52 -08005006@internal class CommandBufferObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07005007 VkDevice device
5008 map!(u64, VkDeviceMemory) boundObjects
5009 VkQueueFlags queueFlags
5010}
5011
5012@internal class DeviceMemoryObject {
Jesse Hall3fbc8562015-11-29 22:10:52 -08005013 VkDevice device
5014 VkDeviceSize allocationSize
5015 map!(u64, VkDeviceSize) boundObjects
5016 map!(VkCommandBuffer, VkCommandBuffer) boundCommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07005017}
5018
5019@internal class BufferObject {
5020 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005021 VkDeviceMemory memory
5022 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005023}
5024
5025@internal class BufferViewObject {
5026 VkDevice device
5027 VkBuffer buffer
5028}
5029
5030@internal class ImageObject {
5031 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005032 VkDeviceMemory memory
5033 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005034}
5035
5036@internal class ImageViewObject {
5037 VkDevice device
5038 VkImage image
5039}
5040
Jesse Halld27f6aa2015-08-15 17:58:48 -07005041@internal class ShaderObject {
5042 VkDevice device
5043}
5044
5045@internal class ShaderModuleObject {
5046 VkDevice device
5047}
5048
5049@internal class PipelineObject {
5050 VkDevice device
5051}
5052
5053@internal class PipelineLayoutObject {
5054 VkDevice device
5055}
5056
5057@internal class SamplerObject {
5058 VkDevice device
5059}
5060
5061@internal class DescriptorSetObject {
5062 VkDevice device
5063}
5064
5065@internal class DescriptorSetLayoutObject {
5066 VkDevice device
5067}
5068
5069@internal class DescriptorPoolObject {
5070 VkDevice device
5071}
5072
Jesse Halld27f6aa2015-08-15 17:58:48 -07005073@internal class FenceObject {
5074 VkDevice device
5075 bool signaled
5076}
5077
5078@internal class SemaphoreObject {
5079 VkDevice device
5080}
5081
5082@internal class EventObject {
5083 VkDevice device
5084}
5085
5086@internal class QueryPoolObject {
5087 VkDevice device
5088}
5089
5090@internal class FramebufferObject {
5091 VkDevice device
5092}
5093
5094@internal class RenderPassObject {
5095 VkDevice device
5096}
5097
5098@internal class PipelineCacheObject {
5099 VkDevice device
5100}
5101
Jesse Hall3fbc8562015-11-29 22:10:52 -08005102@internal class CommandPoolObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07005103 VkDevice device
5104}
5105
Jesse Hall1356b0d2015-11-23 17:24:58 -08005106@internal class SurfaceObject {
5107 VkInstance instance
5108}
5109
Michael Lentine88594d72015-11-12 12:49:45 -08005110@internal class SwapchainObject {
5111 VkDevice device
5112}
5113
Jesse Halld27f6aa2015-08-15 17:58:48 -07005114macro ref!InstanceObject GetInstance(VkInstance instance) {
5115 assert(instance in State.Instances)
5116 return State.Instances[instance]
5117}
5118
5119macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
5120 assert(physicalDevice in State.PhysicalDevices)
5121 return State.PhysicalDevices[physicalDevice]
5122}
5123
5124macro ref!DeviceObject GetDevice(VkDevice device) {
5125 assert(device in State.Devices)
5126 return State.Devices[device]
5127}
5128
5129macro ref!QueueObject GetQueue(VkQueue queue) {
5130 assert(queue in State.Queues)
5131 return State.Queues[queue]
5132}
5133
Jesse Hall3fbc8562015-11-29 22:10:52 -08005134macro ref!CommandBufferObject GetCommandBuffer(VkCommandBuffer commandBuffer) {
5135 assert(commandBuffer in State.CommandBuffers)
5136 return State.CommandBuffers[commandBuffer]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005137}
5138
Jesse Hall3fbc8562015-11-29 22:10:52 -08005139macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory memory) {
5140 assert(memory in State.DeviceMemories)
5141 return State.DeviceMemories[memory]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005142}
5143
5144macro ref!BufferObject GetBuffer(VkBuffer buffer) {
5145 assert(buffer in State.Buffers)
5146 return State.Buffers[buffer]
5147}
5148
5149macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
5150 assert(bufferView in State.BufferViews)
5151 return State.BufferViews[bufferView]
5152}
5153
5154macro ref!ImageObject GetImage(VkImage image) {
5155 assert(image in State.Images)
5156 return State.Images[image]
5157}
5158
5159macro ref!ImageViewObject GetImageView(VkImageView imageView) {
5160 assert(imageView in State.ImageViews)
5161 return State.ImageViews[imageView]
5162}
5163
Jesse Halld27f6aa2015-08-15 17:58:48 -07005164macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
5165 assert(shaderModule in State.ShaderModules)
5166 return State.ShaderModules[shaderModule]
5167}
5168
5169macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
5170 assert(pipeline in State.Pipelines)
5171 return State.Pipelines[pipeline]
5172}
5173
5174macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
5175 assert(pipelineLayout in State.PipelineLayouts)
5176 return State.PipelineLayouts[pipelineLayout]
5177}
5178
5179macro ref!SamplerObject GetSampler(VkSampler sampler) {
5180 assert(sampler in State.Samplers)
5181 return State.Samplers[sampler]
5182}
5183
5184macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
5185 assert(descriptorSet in State.DescriptorSets)
5186 return State.DescriptorSets[descriptorSet]
5187}
5188
5189macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
5190 assert(descriptorSetLayout in State.DescriptorSetLayouts)
5191 return State.DescriptorSetLayouts[descriptorSetLayout]
5192}
5193
5194macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
5195 assert(descriptorPool in State.DescriptorPools)
5196 return State.DescriptorPools[descriptorPool]
5197}
5198
Jesse Halld27f6aa2015-08-15 17:58:48 -07005199macro ref!FenceObject GetFence(VkFence fence) {
5200 assert(fence in State.Fences)
5201 return State.Fences[fence]
5202}
5203
5204macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
5205 assert(semaphore in State.Semaphores)
5206 return State.Semaphores[semaphore]
5207}
5208
5209macro ref!EventObject GetEvent(VkEvent event) {
5210 assert(event in State.Events)
5211 return State.Events[event]
5212}
5213
5214macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
5215 assert(queryPool in State.QueryPools)
5216 return State.QueryPools[queryPool]
5217}
5218
5219macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
5220 assert(framebuffer in State.Framebuffers)
5221 return State.Framebuffers[framebuffer]
5222}
5223
5224macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
5225 assert(renderPass in State.RenderPasses)
5226 return State.RenderPasses[renderPass]
5227}
5228
5229macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
5230 assert(pipelineCache in State.PipelineCaches)
5231 return State.PipelineCaches[pipelineCache]
5232}
5233
Jesse Hall3fbc8562015-11-29 22:10:52 -08005234macro ref!CommandPoolObject GetCommandPool(VkCommandPool commandPool) {
5235 assert(commandPool in State.CommandPools)
5236 return State.CommandPools[commandPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07005237}
Michael Lentine88594d72015-11-12 12:49:45 -08005238
Jesse Hall1356b0d2015-11-23 17:24:58 -08005239macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) {
5240 assert(surface in State.Surfaces)
5241 return State.Surfaces[surface]
5242}
5243
Michael Lentine88594d72015-11-12 12:49:45 -08005244macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) {
5245 assert(swapchain in State.Swapchains)
5246 return State.Swapchains[swapchain]
5247}
Jesse Halld8bade02015-11-24 10:24:18 -08005248
5249macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) {
5250 return as!VkQueueFlags(as!u32(flags) | as!u32(bit))
5251}