blob: 45a5eb694e603f53df6956d0561cf4d8f2de52c3 [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 Hall9ba8bc82015-11-30 16:22:16 -080030define VERSION_MINOR 210
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 Hall9ba8bc82015-11-30 16:22:16 -080060@extension("VK_KHR_display_swapchain") define VK_KHR_DISPLAY_SWAPCHAIN_REVISION 9
Jesse Hall0e74f002015-11-30 11:37:59 -080061@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 Hall9ba8bc82015-11-30 16:22:16 -0800633 VK_STRUCTURE_TYPE_DISPLAY_DISPLAY_PRESENT_INFO_KHR = 0xc0001000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700634}
635
Jesse Hall65ab5522015-11-30 00:07:16 -0800636enum VkSubpassContents {
637 VK_SUBPASS_CONTENTS_INLINE = 0x00000000,
638 VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700639}
640
Jesse Hall091ed9e2015-11-30 00:55:29 -0800641@lastUnused(-10)
Jesse Halld27f6aa2015-08-15 17:58:48 -0700642/// Error and return codes
643enum VkResult {
644 // Return codes for successful operation execution (positive values)
645 VK_SUCCESS = 0x00000000,
Jesse Halla15a4bf2015-11-19 22:48:02 -0800646 VK_NOT_READY = 0x00000001,
647 VK_TIMEOUT = 0x00000002,
648 VK_EVENT_SET = 0x00000003,
649 VK_EVENT_RESET = 0x00000004,
650 VK_INCOMPLETE = 0x00000005,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700651
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800652 //@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800653 VK_SUBOPTIMAL_KHR = 0x40000403,
654
Jesse Halld27f6aa2015-08-15 17:58:48 -0700655 // Error codes (negative values)
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700656 VK_ERROR_OUT_OF_HOST_MEMORY = 0xFFFFFFFF,
657 VK_ERROR_OUT_OF_DEVICE_MEMORY = 0xFFFFFFFE,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700658 VK_ERROR_INITIALIZATION_FAILED = 0xFFFFFFFD,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700659 VK_ERROR_DEVICE_LOST = 0xFFFFFFFC,
660 VK_ERROR_MEMORY_MAP_FAILED = 0xFFFFFFFB,
661 VK_ERROR_LAYER_NOT_PRESENT = 0xFFFFFFFA,
662 VK_ERROR_EXTENSION_NOT_PRESENT = 0xFFFFFFF9,
Jesse Hall606a54e2015-11-19 22:17:28 -0800663 VK_ERROR_FEATURE_NOT_PRESENT = 0xFFFFFFF8,
664 VK_ERROR_INCOMPATIBLE_DRIVER = 0xFFFFFFF7,
Jesse Hall091ed9e2015-11-30 00:55:29 -0800665 VK_ERROR_TOO_MANY_OBJECTS = 0xFFFFFFF6,
Jesse Halla9e57032015-11-30 01:03:10 -0800666 VK_ERROR_FORMAT_NOT_SUPPORTED = 0xFFFFFFF5,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800667
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800668 //@extension("VK_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -0800669 VK_ERROR_SURFACE_LOST_KHR = 0xC0000400,
670
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800671 //@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800672 VK_ERROR_OUT_OF_DATE_KHR = 0xC0000804,
673
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800674 //@extension("VK_KHR_display_swapchain")
Jesse Hall9ba8bc82015-11-30 16:22:16 -0800675 VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = 0xC0001001,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800676
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800677 //@extension("VK_KHR_android_surface")
Jesse Hallf4ab2b12015-11-30 16:04:55 -0800678 VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = 0xC0002400,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700679}
680
681enum VkDynamicState {
682 VK_DYNAMIC_STATE_VIEWPORT = 0x00000000,
683 VK_DYNAMIC_STATE_SCISSOR = 0x00000001,
684 VK_DYNAMIC_STATE_LINE_WIDTH = 0x00000002,
685 VK_DYNAMIC_STATE_DEPTH_BIAS = 0x00000003,
686 VK_DYNAMIC_STATE_BLEND_CONSTANTS = 0x00000004,
687 VK_DYNAMIC_STATE_DEPTH_BOUNDS = 0x00000005,
688 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 0x00000006,
689 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 0x00000007,
690 VK_DYNAMIC_STATE_STENCIL_REFERENCE = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700691}
692
Jesse Hall523db342015-11-30 21:12:55 -0800693@extension("VK_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -0800694enum VkPresentModeKHR {
695 VK_PRESENT_MODE_IMMEDIATE_KHR = 0x00000000,
696 VK_PRESENT_MODE_MAILBOX_KHR = 0x00000001,
697 VK_PRESENT_MODE_FIFO_KHR = 0x00000002,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800698 VK_PRESENT_MODE_FIFO_RELAXED_KHR = 0x00000003,
Michael Lentine88594d72015-11-12 12:49:45 -0800699}
700
Jesse Hall523db342015-11-30 21:12:55 -0800701@extension("VK_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -0800702enum VkColorSpaceKHR {
703 VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000,
704}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700705
706/////////////////
707// Bitfields //
708/////////////////
709
Jesse Halld27f6aa2015-08-15 17:58:48 -0700710/// Queue capabilities
Jesse Halld8bade02015-11-24 10:24:18 -0800711type VkFlags VkQueueFlags
712bitfield VkQueueFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700713 VK_QUEUE_GRAPHICS_BIT = 0x00000001, /// Queue supports graphics operations
714 VK_QUEUE_COMPUTE_BIT = 0x00000002, /// Queue supports compute operations
Jesse Hall65ab5522015-11-30 00:07:16 -0800715 VK_QUEUE_TRANSFER_BIT = 0x00000004, /// Queue supports transfer operations
Jesse Hallb00daad2015-11-29 19:46:20 -0800716 VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, /// Queue supports sparse resource memory management operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700717}
718
719/// Memory properties passed into vkAllocMemory().
Jesse Halld8bade02015-11-24 10:24:18 -0800720type VkFlags VkMemoryPropertyFlags
721bitfield VkMemoryPropertyFlagBits {
Jesse Halld1af8122015-11-29 23:50:38 -0800722 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001,
723 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002,
724 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004,
725 VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008,
726 VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700727}
728
729/// Memory heap flags
Jesse Halld8bade02015-11-24 10:24:18 -0800730type VkFlags VkMemoryHeapFlags
731bitfield VkMemoryHeapFlagBits {
Jesse Halld1af8122015-11-29 23:50:38 -0800732 VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700733}
734
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800735/// Access flags
736type VkFlags VkAccessFlags
737bitfield VkAccessFlagBits {
738 VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001,
739 VK_ACCESS_INDEX_READ_BIT = 0x00000002,
740 VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004,
741 VK_ACCESS_UNIFORM_READ_BIT = 0x00000008,
742 VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010,
743 VK_ACCESS_SHADER_READ_BIT = 0x00000020,
744 VK_ACCESS_SHADER_WRITE_BIT = 0x00000040,
745 VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080,
746 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100,
747 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200,
748 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400,
749 VK_ACCESS_TRANSFER_READ_BIT = 0x00000800,
750 VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000,
751 VK_ACCESS_HOST_READ_BIT = 0x00002000,
752 VK_ACCESS_HOST_WRITE_BIT = 0x00004000,
753 VK_ACCESS_MEMORY_READ_BIT = 0x00008000,
754 VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700755}
756
757/// Buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800758type VkFlags VkBufferUsageFlags
759bitfield VkBufferUsageFlagBits {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800760 VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations
761 VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700762 VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, /// Can be used as TBO
763 VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, /// Can be used as IBO
764 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, /// Can be used as UBO
765 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, /// Can be used as SSBO
766 VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, /// Can be used as source of fixed function index fetch (index buffer)
767 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, /// Can be used as source of fixed function vertex fetch (VBO)
768 VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, /// Can be the source of indirect parameters (e.g. indirect buffer, parameter buffer)
769}
770
771/// Buffer creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800772type VkFlags VkBufferCreateFlags
773bitfield VkBufferCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700774 VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Buffer should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700775 VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Buffer should support sparse backing with partial residency
776 VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Buffer should support constent data access to physical memory blocks mapped into multiple locations of sparse buffers
777}
778
779/// Shader stage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800780type VkFlags VkShaderStageFlags
781bitfield VkShaderStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700782 VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
Jesse Hallae38f732015-11-19 21:32:50 -0800783 VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
784 VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700785 VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
786 VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
787 VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
Jesse Hallc7467b72015-11-29 21:05:26 -0800788 VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700789
790 VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
791}
792
Jesse Hallfbf97b02015-11-20 14:17:03 -0800793/// Descriptor pool create flags
Jesse Halld8bade02015-11-24 10:24:18 -0800794type VkFlags VkDescriptorPoolCreateFlags
795bitfield VkDescriptorPoolCreateFlagBits {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800796 VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
797}
798
799/// Descriptor pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -0800800type VkFlags VkDescriptorPoolResetFlags
Jesse Halla6429252015-11-29 18:59:42 -0800801//bitfield VkDescriptorPoolResetFlagBits {
802//}
Jesse Hallfbf97b02015-11-20 14:17:03 -0800803
Jesse Halld27f6aa2015-08-15 17:58:48 -0700804/// Image usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800805type VkFlags VkImageUsageFlags
806bitfield VkImageUsageFlagBits {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800807 VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations
808 VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700809 VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, /// Can be sampled from (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
810 VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, /// Can be used as storage image (STORAGE_IMAGE descriptor type)
811 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, /// Can be used as framebuffer color attachment
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700812 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment
Jesse Halld27f6aa2015-08-15 17:58:48 -0700813 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering
814 VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment
815}
816
817/// Image creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800818type VkFlags VkImageCreateFlags
819bitfield VkImageCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700820 VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Image should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700821 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Image should support sparse backing with partial residency
822 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 -0700823 VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, /// Allows image views to have different format than the base image
824 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 -0700825}
826
Jesse Hallb00daad2015-11-29 19:46:20 -0800827/// Image view creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800828type VkFlags VkImageViewCreateFlags
Jesse Hallb00daad2015-11-29 19:46:20 -0800829//bitfield VkImageViewCreateFlagBits {
830//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700831
832/// Pipeline creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800833type VkFlags VkPipelineCreateFlags
834bitfield VkPipelineCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700835 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
836 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
837 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
838}
839
Jesse Hall65ab5522015-11-30 00:07:16 -0800840/// Color component flags
841type VkFlags VkColorComponentFlags
842bitfield VkColorComponentFlagBits {
843 VK_COLOR_COMPONENT_R_BIT = 0x00000001,
844 VK_COLOR_COMPONENT_G_BIT = 0x00000002,
845 VK_COLOR_COMPONENT_B_BIT = 0x00000004,
846 VK_COLOR_COMPONENT_A_BIT = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700847}
848
849/// Fence creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800850type VkFlags VkFenceCreateFlags
851bitfield VkFenceCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700852 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
853}
854
855/// Semaphore creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800856type VkFlags VkSemaphoreCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800857//bitfield VkSemaphoreCreateFlagBits {
858//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700859
860/// Format capability flags
Jesse Halld8bade02015-11-24 10:24:18 -0800861type VkFlags VkFormatFeatureFlags
862bitfield VkFormatFeatureFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700863 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
864 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type)
865 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images
866 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs)
867 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs)
868 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers
869 VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs)
870 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images
871 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images
872 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images
Jesse Hall3fbc8562015-11-29 22:10:52 -0800873 VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCommandBlitImage
874 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 -0700875}
876
877/// Query control flags
Jesse Halld8bade02015-11-24 10:24:18 -0800878type VkFlags VkQueryControlFlags
879bitfield VkQueryControlFlagBits {
Jesse Hall65ab5522015-11-30 00:07:16 -0800880 VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700881}
882
883/// Query result flags
Jesse Halld8bade02015-11-24 10:24:18 -0800884type VkFlags VkQueryResultFlags
885bitfield VkQueryResultFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700886 VK_QUERY_RESULT_DEFAULT = 0x00000000, /// Results of the queries are immediately written to the destination buffer as 32-bit values
887 VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values
888 VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy
889 VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written
890 VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available
891}
892
893/// Shader module creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800894type VkFlags VkShaderModuleCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800895//bitfield VkShaderModuleCreateFlagBits {
896//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700897
Jesse Halld27f6aa2015-08-15 17:58:48 -0700898/// Event creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800899type VkFlags VkEventCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800900//bitfield VkEventCreateFlagBits {
901//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700902
Jesse Halla15a4bf2015-11-19 22:48:02 -0800903/// Command buffer usage flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800904type VkFlags VkCommandBufferUsageFlags
905bitfield VkCommandBufferUsageFlagBits {
906 VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
907 VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
908 VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700909}
910
911/// Pipeline statistics flags
Jesse Halld8bade02015-11-24 10:24:18 -0800912type VkFlags VkQueryPipelineStatisticFlags
913bitfield VkQueryPipelineStatisticFlagBits {
Jesse Hallae38f732015-11-19 21:32:50 -0800914 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, /// Optional
915 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, /// Optional
916 VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, /// Optional
917 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, /// Optional
918 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, /// Optional
919 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, /// Optional
920 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, /// Optional
921 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, /// Optional
922 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, /// Optional
923 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, /// Optional
924 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, /// Optional
Jesse Halld27f6aa2015-08-15 17:58:48 -0700925}
926
927/// Memory mapping flags
Jesse Halld8bade02015-11-24 10:24:18 -0800928type VkFlags VkMemoryMapFlags
Jesse Halla6429252015-11-29 18:59:42 -0800929//bitfield VkMemoryMapFlagBits {
930//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700931
932/// Bitfield of image aspects
Jesse Halld8bade02015-11-24 10:24:18 -0800933type VkFlags VkImageAspectFlags
934bitfield VkImageAspectFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700935 VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
936 VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
937 VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
938 VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
939}
940
941/// Sparse memory bind flags
Jesse Halld8bade02015-11-24 10:24:18 -0800942type VkFlags VkSparseMemoryBindFlags
Jesse Hall091ed9e2015-11-30 00:55:29 -0800943bitfield VkSparseMemoryBindFlagBits {
944 VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001,
945}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700946
947/// Sparse image memory requirements flags
Jesse Halld8bade02015-11-24 10:24:18 -0800948type VkFlags VkSparseImageFormatFlags
949bitfield VkSparseImageFormatFlagBits {
Jesse Hallb00daad2015-11-29 19:46:20 -0800950 VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices
951 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.
952 VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size
Jesse Halld27f6aa2015-08-15 17:58:48 -0700953}
954
955/// Pipeline stages
Jesse Halld8bade02015-11-24 10:24:18 -0800956type VkFlags VkPipelineStageFlags
957bitfield VkPipelineStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700958 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed
959 VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch
960 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch
961 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading
Jesse Hallae38f732015-11-19 21:32:50 -0800962 VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading
963 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading
Jesse Halld27f6aa2015-08-15 17:58:48 -0700964 VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading
965 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading
966 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests
967 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests
968 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes
969 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading
970 VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700971 VK_PIPELINE_STAGE_HOST_BIT = 0x00002000, /// Indicates host (CPU) is a source/sink of the dependency
Jesse Halld27f6aa2015-08-15 17:58:48 -0700972
Jesse Hall091ed9e2015-11-30 00:55:29 -0800973 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00004000, /// All stages of the graphics pipeline
974 VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00008000, /// All graphics, compute, copy, and transition commands
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700975}
976
977/// Render pass attachment description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800978type VkFlags VkAttachmentDescriptionFlags
979bitfield VkAttachmentDescriptionFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700980 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 -0700981}
982
983/// Subpass description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800984type VkFlags VkSubpassDescriptionFlags
985bitfield VkSubpassDescriptionFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700986}
987
988/// Command pool creation flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800989type VkFlags VkCommandPoolCreateFlags
990bitfield VkCommandPoolCreateFlagBits {
991 VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime
992 VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually
Jesse Halld27f6aa2015-08-15 17:58:48 -0700993}
994
995/// Command pool reset flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800996type VkFlags VkCommandPoolResetFlags
997bitfield VkCommandPoolResetFlagBits {
998 VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool
Jesse Halld27f6aa2015-08-15 17:58:48 -0700999}
1000
Jesse Hall3fbc8562015-11-29 22:10:52 -08001001type VkFlags VkCommandBufferResetFlags
1002bitfield VkCommandBufferResetFlagBits {
1003 VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001004}
1005
Jesse Halld8bade02015-11-24 10:24:18 -08001006type VkFlags VkSampleCountFlags
1007bitfield VkSampleCountFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001008 VK_SAMPLE_COUNT_1_BIT = 0x00000001,
1009 VK_SAMPLE_COUNT_2_BIT = 0x00000002,
1010 VK_SAMPLE_COUNT_4_BIT = 0x00000004,
1011 VK_SAMPLE_COUNT_8_BIT = 0x00000008,
1012 VK_SAMPLE_COUNT_16_BIT = 0x00000010,
1013 VK_SAMPLE_COUNT_32_BIT = 0x00000020,
1014 VK_SAMPLE_COUNT_64_BIT = 0x00000040,
1015}
1016
Jesse Halld8bade02015-11-24 10:24:18 -08001017type VkFlags VkStencilFaceFlags
1018bitfield VkStencilFaceFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001019 VK_STENCIL_FACE_NONE = 0x00000000, /// No faces
1020 VK_STENCIL_FACE_FRONT_BIT = 0x00000001, /// Front face
1021 VK_STENCIL_FACE_BACK_BIT = 0x00000002, /// Back face
Jesse Hallc7467b72015-11-29 21:05:26 -08001022 VK_STENCIL_FRONT_AND_BACK = 0x00000003,
Jesse Halld27f6aa2015-08-15 17:58:48 -07001023}
1024
Jesse Halla6429252015-11-29 18:59:42 -08001025/// Instance creation flags
1026type VkFlags VkInstanceCreateFlags
1027//bitfield VkInstanceCreateFlagBits {
1028//}
1029
1030/// Device creation flags
1031type VkFlags VkDeviceCreateFlags
1032//bitfield VkDeviceCreateFlagBits {
1033//}
1034
1035/// Device queue creation flags
1036type VkFlags VkDeviceQueueCreateFlags
1037//bitfield VkDeviceQueueCreateFlagBits {
1038//}
1039
1040/// Query pool creation flags
1041type VkFlags VkQueryPoolCreateFlags
1042//bitfield VkQueryPoolCreateFlagBits {
1043//}
1044
1045/// Buffer view creation flags
1046type VkFlags VkBufferViewCreateFlags
1047//bitfield VkBufferViewCreateFlagBits {
1048//}
1049
1050/// Pipeline cache creation flags
1051type VkFlags VkPipelineCacheCreateFlags
1052//bitfield VkPipelineCacheCreateFlagBits {
1053//}
1054
1055/// Pipeline shader stage creation flags
1056type VkFlags VkPipelineShaderStageCreateFlags
1057//bitfield VkPipelineShaderStageCreateFlagBits {
1058//}
1059
1060/// Descriptor set layout creation flags
1061type VkFlags VkDescriptorSetLayoutCreateFlags
1062//bitfield VkDescriptorSetLayoutCreateFlagBits {
1063//}
1064
1065/// Pipeline vertex input state creation flags
1066type VkFlags VkPipelineVertexInputStateCreateFlags
1067//bitfield VkPipelineVertexInputStateCreateFlagBits {
1068//}
1069
1070/// Pipeline input assembly state creation flags
1071type VkFlags VkPipelineInputAssemblyStateCreateFlags
1072//bitfield VkPipelineInputAssemblyStateCreateFlagBits {
1073//}
1074
1075/// Tessellation state creation flags
1076type VkFlags VkPipelineTessellationStateCreateFlags
1077//bitfield VkPipelineTessellationStateCreateFlagBits {
1078//}
1079
1080/// Viewport state creation flags
1081type VkFlags VkPipelineViewportStateCreateFlags
1082//bitfield VkPipelineViewportStateCreateFlagBits {
1083//}
1084
Jesse Hall3fbc8562015-11-29 22:10:52 -08001085/// Rasterization state creation flags
1086type VkFlags VkPipelineRasterizationStateCreateFlags
1087//bitfield VkPipelineRasterizationStateCreateFlagBits {
Jesse Halla6429252015-11-29 18:59:42 -08001088//}
1089
1090/// Multisample state creation flags
1091type VkFlags VkPipelineMultisampleStateCreateFlags
1092//bitfield VkPipelineMultisampleStateCreateFlagBits {
1093//}
1094
1095/// Color blend state creation flags
1096type VkFlags VkPipelineColorBlendStateCreateFlags
1097//bitfield VkPipelineColorBlendStateCreateFlagBits {
1098//}
1099
1100/// Depth/stencil state creation flags
1101type VkFlags VkPipelineDepthStencilStateCreateFlags
1102//bitfield VkPipelineDepthStencilStateCreateFlagBits {
1103//}
1104
1105/// Dynamic state creation flags
1106type VkFlags VkPipelineDynamicStateCreateFlags
1107//bitfield VkPipelineDynamicStateCreateFlagBits {
1108//}
1109
1110/// Pipeline layout creation flags
1111type VkFlags VkPipelineLayoutCreateFlags
1112//bitfield VkPipelineLayoutCreateFlagBits {
1113//}
1114
1115/// Sampler creation flags
1116type VkFlags VkSamplerCreateFlags
1117//bitfield VkSamplerCreateFlagBits {
1118//}
1119
1120/// Render pass creation flags
1121type VkFlags VkRenderPassCreateFlags
1122//bitfield VkRenderPassCreateFlagBits {
1123//}
1124
1125/// Framebuffer creation flags
1126type VkFlags VkFramebufferCreateFlags
1127//bitfield VkFramebufferCreateFlagBits {
1128//}
1129
Jesse Halldc6d36c2015-11-29 19:12:15 -08001130/// Dependency flags
1131type VkFlags VkDependencyFlags
1132bitfield VkDependencyFlagBits {
1133 VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
1134}
1135
Jesse Hallc7467b72015-11-29 21:05:26 -08001136/// Cull mode flags
1137type VkFlags VkCullModeFlags
1138bitfield VkCullModeFlagBits {
1139 VK_CULL_MODE_NONE = 0x00000000,
1140 VK_CULL_MODE_FRONT_BIT = 0x00000001,
1141 VK_CULL_MODE_BACK_BIT = 0x00000002,
1142 VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
1143}
1144
Jesse Hall523db342015-11-30 21:12:55 -08001145@extension("VK_KHR_surface")
Jesse Halld8bade02015-11-24 10:24:18 -08001146type VkFlags VkSurfaceTransformFlagsKHR
Jesse Hall523db342015-11-30 21:12:55 -08001147@extension("VK_KHR_surface")
Jesse Halld8bade02015-11-24 10:24:18 -08001148bitfield VkSurfaceTransformFlagBitsKHR {
Jesse Hall9ba8bc82015-11-30 16:22:16 -08001149 VK_SURFACE_TRANSFORM_NONE_BIT_KHR = 0x00000001,
1150 VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 0x00000002,
1151 VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 0x00000004,
1152 VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 0x00000008,
1153 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 0x00000010,
1154 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 0x00000020,
1155 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040,
1156 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080,
1157 VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
Michael Lentine88594d72015-11-12 12:49:45 -08001158}
Jesse Halld27f6aa2015-08-15 17:58:48 -07001159
Jesse Hall523db342015-11-30 21:12:55 -08001160@extension("VK_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08001161type VkFlags VkCompositeAlphaFlagsKHR
Jesse Hall523db342015-11-30 21:12:55 -08001162@extension("VK_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08001163bitfield VkCompositeAlphaFlagBitsKHR {
1164 VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
1165 VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
1166 VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
1167 VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
1168}
1169
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001170@extension("VK_KHR_swapchain")
1171type VkFlags VkSwapchainCreateFlagsKHR
1172//@extension("VK_KHR_swapchain")
1173//bitfield VkSwapchainCreateFlagBitsKHR {
1174//}
1175
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001176@extension("VK_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001177type VkFlags VkDisplayPlaneAlphaFlagsKHR
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001178@extension("VK_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001179bitfield VkDisplayPlaneAlphaFlagBitsKHR {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001180 VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
1181 VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002,
1182 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004,
1183 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008,
Jesse Hall1356b0d2015-11-23 17:24:58 -08001184}
1185
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001186@extension("VK_KHR_display")
1187type VkFlags VkDisplaySurfaceCreateFlagsKHR
1188//@extension("VK_KHR_display")
1189//bitfield VkDisplaySurfaceCreateFlagBitsKHR {
1190//}
1191
Jesse Hall9ba8bc82015-11-30 16:22:16 -08001192@extension("VK_KHR_display")
1193type VkFlags VkDisplayModeCreateFlagsKHR
1194//@extension("VK_KHR_display")
1195//bitfield VkDisplayModeCreateFlagBitsKHR {
1196//}
1197
Jesse Hall1356b0d2015-11-23 17:24:58 -08001198
Jesse Halld27f6aa2015-08-15 17:58:48 -07001199//////////////////
1200// Structures //
1201//////////////////
1202
1203class VkOffset2D {
1204 s32 x
1205 s32 y
1206}
1207
1208class VkOffset3D {
1209 s32 x
1210 s32 y
1211 s32 z
1212}
1213
1214class VkExtent2D {
1215 s32 width
1216 s32 height
1217}
1218
1219class VkExtent3D {
1220 s32 width
1221 s32 height
1222 s32 depth
1223}
1224
1225class VkViewport {
Jesse Hall65ab5522015-11-30 00:07:16 -08001226 f32 x
1227 f32 y
Jesse Halld27f6aa2015-08-15 17:58:48 -07001228 f32 width
1229 f32 height
1230 f32 minDepth
1231 f32 maxDepth
1232}
1233
1234class VkRect2D {
1235 VkOffset2D offset
1236 VkExtent2D extent
1237}
1238
Jesse Halla15a4bf2015-11-19 22:48:02 -08001239class VkClearRect {
1240 VkRect2D rect
1241 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001242 u32 layerCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001243}
1244
Jesse Hall65ab5522015-11-30 00:07:16 -08001245class VkComponentMapping {
1246 VkComponentSwizzle r
1247 VkComponentSwizzle g
1248 VkComponentSwizzle b
1249 VkComponentSwizzle a
Jesse Halld27f6aa2015-08-15 17:58:48 -07001250}
1251
1252class VkPhysicalDeviceProperties {
1253 u32 apiVersion
1254 u32 driverVersion
Jesse Hall65ab5522015-11-30 00:07:16 -08001255 u32 vendorID
1256 u32 deviceID
Jesse Halld27f6aa2015-08-15 17:58:48 -07001257 VkPhysicalDeviceType deviceType
Jesse Hall65ab5522015-11-30 00:07:16 -08001258 char[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE] deviceName
1259 u8[VK_UUID_SIZE] pipelineCacheUUID
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001260 VkPhysicalDeviceLimits limits
1261 VkPhysicalDeviceSparseProperties sparseProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001262}
1263
1264class VkExtensionProperties {
Jesse Hall65ab5522015-11-30 00:07:16 -08001265 char[VK_MAX_EXTENSION_NAME_SIZE] extensionName /// extension name
Jesse Halld27f6aa2015-08-15 17:58:48 -07001266 u32 specVersion /// version of the extension specification implemented
1267}
1268
1269class VkLayerProperties {
Jesse Hall65ab5522015-11-30 00:07:16 -08001270 char[VK_MAX_EXTENSION_NAME_SIZE] layerName /// layer name
Jesse Hall3fbc8562015-11-29 22:10:52 -08001271 u32 specVersion /// version of the layer specification implemented
1272 u32 implementationVersion /// build or release version of the layer's library
Jesse Hall65ab5522015-11-30 00:07:16 -08001273 char[VK_MAX_DESCRIPTION_SIZE] description /// Free-form description of the layer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001274}
1275
Jesse Halla366a512015-11-19 22:30:07 -08001276class VkSubmitInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001277 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_SUBMIT_INFO
1278 const void* pNext /// Next structure in chain
1279 u32 waitSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001280 const VkSemaphore* pWaitSemaphores
Jesse Hall03b6fe12015-11-24 12:44:21 -08001281 u32 commandBufferCount
Jesse Hall3fbc8562015-11-29 22:10:52 -08001282 const VkCommandBuffer* pCommandBuffers
Jesse Hall03b6fe12015-11-24 12:44:21 -08001283 u32 signalSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001284 const VkSemaphore* pSignalSemaphores
1285}
1286
Jesse Halld27f6aa2015-08-15 17:58:48 -07001287class VkApplicationInfo {
1288 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO
1289 const void* pNext /// Next structure in chain
Jesse Hall3fbc8562015-11-29 22:10:52 -08001290 const char* pApplicationName
1291 u32 applicationVersion
Jesse Halld27f6aa2015-08-15 17:58:48 -07001292 const char* pEngineName
1293 u32 engineVersion
1294 u32 apiVersion
1295}
1296
Jesse Hall3fbc8562015-11-29 22:10:52 -08001297class VkAllocationCallbacks {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001298 void* pUserData
Jesse Hall3fbc8562015-11-29 22:10:52 -08001299 PFN_vkAllocationFunction pfnAllocation
1300 PFN_vkReallocationFunction pfnReallocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001301 PFN_vkFreeFunction pfnFree
Jesse Hall3fbc8562015-11-29 22:10:52 -08001302 PFN_vkInternalAllocationNotification pfnInternalAllocation
Jesse Hall03b6fe12015-11-24 12:44:21 -08001303 PFN_vkInternalFreeNotification pfnInternalFree
Jesse Halld27f6aa2015-08-15 17:58:48 -07001304}
1305
1306class VkDeviceQueueCreateInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001307 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
1308 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001309 VkDeviceQueueCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001310 u32 queueFamilyIndex
Jesse Halldba27f72015-11-30 14:25:46 -08001311 u32 queueCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001312 const f32* pQueuePriorities
Jesse Halld27f6aa2015-08-15 17:58:48 -07001313}
1314
1315class VkDeviceCreateInfo {
1316 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
1317 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001318 VkDeviceCreateFlags flags
Jesse Halldba27f72015-11-30 14:25:46 -08001319 u32 queueCreateInfoCount
1320 const VkDeviceQueueCreateInfo* pQueueCreateInfos
Jesse Hall03b6fe12015-11-24 12:44:21 -08001321 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001322 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001323 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001324 const char* const* ppEnabledExtensionNames
1325 const VkPhysicalDeviceFeatures* pEnabledFeatures
Jesse Halld27f6aa2015-08-15 17:58:48 -07001326}
1327
1328class VkInstanceCreateInfo {
1329 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
1330 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001331 VkInstanceCreateFlags flags
Jesse Hall3fbc8562015-11-29 22:10:52 -08001332 const VkApplicationInfo* pApplicationInfo
Jesse Hall03b6fe12015-11-24 12:44:21 -08001333 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001334 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001335 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001336 const char* const* ppEnabledExtensionNames /// Extension names to be enabled
1337}
1338
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001339class VkQueueFamilyProperties {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001340 VkQueueFlags queueFlags /// Queue flags
1341 u32 queueCount
Jesse Hallacfa5342015-11-19 21:51:33 -08001342 u32 timestampValidBits
Jesse Hall65ab5522015-11-30 00:07:16 -08001343 VkExtent3D minImageTransferGranularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07001344}
1345
1346class VkPhysicalDeviceMemoryProperties {
1347 u32 memoryTypeCount
1348 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes
1349 u32 memoryHeapCount
1350 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps
1351}
1352
Jesse Hall3fbc8562015-11-29 22:10:52 -08001353class VkMemoryAllocateInfo {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001354 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001355 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001356 VkDeviceSize allocationSize /// Size of memory allocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001357 u32 memoryTypeIndex /// Index of the of the memory type to allocate from
1358}
1359
1360class VkMemoryRequirements {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001361 VkDeviceSize size /// Specified in bytes
1362 VkDeviceSize alignment /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001363 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object
1364}
1365
1366class VkSparseImageFormatProperties {
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001367 VkImageAspectFlagBits aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001368 VkExtent3D imageGranularity
1369 VkSparseImageFormatFlags flags
1370}
1371
1372class VkSparseImageMemoryRequirements {
Jesse Hallb00daad2015-11-29 19:46:20 -08001373 VkSparseImageFormatProperties formatProperties
Jesse Hall65ab5522015-11-30 00:07:16 -08001374 u32 imageMipTailStartLod
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001375 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment
1376 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment
1377 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07001378}
1379
1380class VkMemoryType {
1381 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type
1382 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from
1383}
1384
1385class VkMemoryHeap {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001386 VkDeviceSize size /// Available memory in the heap
Jesse Halld27f6aa2015-08-15 17:58:48 -07001387 VkMemoryHeapFlags flags /// Flags for the heap
1388}
1389
1390class VkMappedMemoryRange {
1391 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
1392 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001393 VkDeviceMemory memory /// Mapped memory object
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001394 VkDeviceSize offset /// Offset within the mapped memory the range starts from
1395 VkDeviceSize size /// Size of the range within the mapped memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07001396}
1397
1398class VkFormatProperties {
1399 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling
1400 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001401 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001402}
1403
1404class VkImageFormatProperties {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001405 VkExtent3D maxExtent /// max image dimensions for this resource type
1406 u32 maxMipLevels /// max number of mipmap levels for this resource type
Jesse Halla15a4bf2015-11-19 22:48:02 -08001407 u32 maxArrayLayers /// max array layers for this resource type
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001408 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type
1409 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type
1410}
1411
Jesse Halla15a4bf2015-11-19 22:48:02 -08001412class VkDescriptorImageInfo {
1413 VkSampler sampler
1414 VkImageView imageView
1415 VkImageLayout imageLayout
1416}
1417
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001418class VkDescriptorBufferInfo {
1419 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC]
1420 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set.
1421 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001422}
1423
Jesse Halld27f6aa2015-08-15 17:58:48 -07001424class VkWriteDescriptorSet {
1425 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
1426 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001427 VkDescriptorSet dstSet /// Destination descriptor set
1428 u32 dstBinding /// Binding within the destination descriptor set to write
1429 u32 dstArrayElement /// Array element within the destination binding to write
Jesse Hall03b6fe12015-11-24 12:44:21 -08001430 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001431 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 -08001432 const VkDescriptorImageInfo* pImageInfo
1433 const VkDescriptorBufferInfo* pBufferInfo
1434 const VkBufferView* pTexelBufferView
Jesse Halld27f6aa2015-08-15 17:58:48 -07001435}
1436
1437class VkCopyDescriptorSet {
1438 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
1439 const void* pNext /// Pointer to next structure
1440 VkDescriptorSet srcSet /// Source descriptor set
1441 u32 srcBinding /// Binding within the source descriptor set to copy from
1442 u32 srcArrayElement /// Array element within the source binding to copy from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001443 VkDescriptorSet dstSet /// Destination descriptor set
1444 u32 dstBinding /// Binding within the destination descriptor set to copy to
1445 u32 dstArrayElement /// Array element within the destination binding to copy to
Jesse Hall03b6fe12015-11-24 12:44:21 -08001446 u32 descriptorCount /// Number of descriptors to copy
Jesse Halld27f6aa2015-08-15 17:58:48 -07001447}
1448
1449class VkBufferCreateInfo {
1450 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
1451 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001452 VkBufferCreateFlags flags /// Buffer creation flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001453 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001454 VkBufferUsageFlags usage /// Buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001455 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001456 u32 queueFamilyIndexCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001457 const u32* pQueueFamilyIndices
1458}
1459
1460class VkBufferViewCreateInfo {
1461 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
1462 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001463 VkBufferViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001464 VkBuffer buffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001465 VkFormat format /// Optionally specifies format of elements
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001466 VkDeviceSize offset /// Specified in bytes
1467 VkDeviceSize range /// View size specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001468}
1469
1470class VkImageSubresource {
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001471 VkImageAspectFlagBits aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001472 u32 mipLevel
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001473 u32 arrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001474}
1475
1476class VkImageSubresourceRange {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001477 VkImageAspectFlags aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001478 u32 baseMipLevel
Jesse Hall3fbc8562015-11-29 22:10:52 -08001479 u32 levelCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001480 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001481 u32 layerCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001482}
1483
1484class VkMemoryBarrier {
1485 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER
1486 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001487 VkAccessFlags srcAccessMask
1488 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001489}
1490
1491class VkBufferMemoryBarrier {
1492 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
1493 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001494 VkAccessFlags srcAccessMask
1495 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001496 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001497 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001498 VkBuffer buffer /// Buffer to sync
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001499 VkDeviceSize offset /// Offset within the buffer to sync
1500 VkDeviceSize size /// Amount of bytes to sync
Jesse Halld27f6aa2015-08-15 17:58:48 -07001501}
1502
1503class VkImageMemoryBarrier {
1504 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
1505 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001506 VkAccessFlags srcAccessMask
1507 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001508 VkImageLayout oldLayout /// Current layout of the image
1509 VkImageLayout newLayout /// New layout to transition the image to
1510 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001511 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001512 VkImage image /// Image to sync
1513 VkImageSubresourceRange subresourceRange /// Subresource range to sync
1514}
1515
1516class VkImageCreateInfo {
1517 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
1518 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001519 VkImageCreateFlags flags /// Image creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001520 VkImageType imageType
1521 VkFormat format
1522 VkExtent3D extent
1523 u32 mipLevels
Jesse Halla15a4bf2015-11-19 22:48:02 -08001524 u32 arrayLayers
Jesse Hall091ed9e2015-11-30 00:55:29 -08001525 VkSampleCountFlagBits samples
Jesse Halld27f6aa2015-08-15 17:58:48 -07001526 VkImageTiling tiling
1527 VkImageUsageFlags usage /// Image usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001528 VkSharingMode sharingMode /// Cross-queue-family sharing mode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001529 u32 queueFamilyIndexCount /// Number of queue families to share across
Jesse Halld27f6aa2015-08-15 17:58:48 -07001530 const u32* pQueueFamilyIndices /// Array of queue family indices to share across
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001531 VkImageLayout initialLayout /// Initial image layout for all subresources
Jesse Halld27f6aa2015-08-15 17:58:48 -07001532}
1533
1534class VkSubresourceLayout {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001535 VkDeviceSize offset /// Specified in bytes
1536 VkDeviceSize size /// Specified in bytes
1537 VkDeviceSize rowPitch /// Specified in bytes
1538 VkDeviceSize depthPitch /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001539}
1540
1541class VkImageViewCreateInfo {
1542 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
1543 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001544 VkImageViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001545 VkImage image
1546 VkImageViewType viewType
1547 VkFormat format
Jesse Hall65ab5522015-11-30 00:07:16 -08001548 VkComponentMapping components
Jesse Halld27f6aa2015-08-15 17:58:48 -07001549 VkImageSubresourceRange subresourceRange
Jesse Halld27f6aa2015-08-15 17:58:48 -07001550}
1551
1552class VkBufferCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001553 VkDeviceSize srcOffset /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001554 VkDeviceSize dstOffset /// Specified in bytes
Jesse Hallb00daad2015-11-29 19:46:20 -08001555 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001556}
1557
Jesse Halla6429252015-11-29 18:59:42 -08001558class VkSparseMemoryBind {
Jesse Hallb00daad2015-11-29 19:46:20 -08001559 VkDeviceSize resourceOffset /// Specified in bytes
1560 VkDeviceSize size /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001561 VkDeviceMemory memory
1562 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001563 VkSparseMemoryBindFlags flags
1564}
1565
Jesse Halla6429252015-11-29 18:59:42 -08001566class VkSparseImageMemoryBind {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001567 VkImageSubresource subresource
1568 VkOffset3D offset
1569 VkExtent3D extent
Jesse Hall3fbc8562015-11-29 22:10:52 -08001570 VkDeviceMemory memory
1571 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001572 VkSparseMemoryBindFlags flags
1573}
1574
Jesse Halla6429252015-11-29 18:59:42 -08001575class VkSparseBufferMemoryBindInfo {
1576 VkBuffer buffer
1577 u32 bindCount
1578 const VkSparseMemoryBind* pBinds
1579}
1580
1581class VkSparseImageOpaqueMemoryBindInfo {
1582 VkImage image
1583 u32 bindCount
1584 const VkSparseMemoryBind* pBinds
1585}
1586
1587class VkSparseImageMemoryBindInfo {
1588 VkImage image
1589 u32 bindCount
1590 const VkSparseMemoryBind* pBinds
1591}
1592
1593class VkBindSparseInfo {
1594 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
1595 const void* pNext
1596 u32 waitSemaphoreCount
1597 const VkSemaphore* pWaitSemaphores
1598 u32 numBufferBinds
1599 const VkSparseBufferMemoryBindInfo* pBufferBinds
1600 u32 numImageOpaqueBinds
1601 const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds
1602 u32 numImageBinds
1603 const VkSparseImageMemoryBindInfo* pImageBinds
1604 u32 signalSemaphoreCount
1605 const VkSemaphore* pSignalSemaphores
1606}
1607
Jesse Hall65ab5522015-11-30 00:07:16 -08001608class VkImageSubresourceLayers {
1609 VkImageAspectFlags aspectMask
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001610 u32 mipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001611 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001612 u32 layerCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001613}
1614
Jesse Halld27f6aa2015-08-15 17:58:48 -07001615class VkImageCopy {
Jesse Hall65ab5522015-11-30 00:07:16 -08001616 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001617 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Hall65ab5522015-11-30 00:07:16 -08001618 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001619 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001620 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images
1621}
1622
1623class VkImageBlit {
Jesse Hall65ab5522015-11-30 00:07:16 -08001624 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001625 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
1626 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Hall65ab5522015-11-30 00:07:16 -08001627 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001628 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
1629 VkExtent3D dstExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001630}
1631
1632class VkBufferImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001633 VkDeviceSize bufferOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001634 u32 bufferRowLength /// Specified in texels
1635 u32 bufferImageHeight
Jesse Hall65ab5522015-11-30 00:07:16 -08001636 VkImageSubresourceLayers imageSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001637 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images
1638 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images
1639}
1640
1641class VkImageResolve {
Jesse Hall65ab5522015-11-30 00:07:16 -08001642 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001643 VkOffset3D srcOffset
Jesse Hall65ab5522015-11-30 00:07:16 -08001644 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001645 VkOffset3D dstOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07001646 VkExtent3D extent
1647}
1648
1649class VkShaderModuleCreateInfo {
1650 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
1651 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001652 VkShaderModuleCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001653 platform.size_t codeSize /// Specified in bytes
Jesse Halla9bb62b2015-11-21 19:31:56 -08001654 const u32* pCode /// Binary code of size codeSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07001655}
1656
Jesse Halld27f6aa2015-08-15 17:58:48 -07001657class VkDescriptorSetLayoutBinding {
Jesse Hall091ed9e2015-11-30 00:55:29 -08001658 u32 binding
Jesse Halld27f6aa2015-08-15 17:58:48 -07001659 VkDescriptorType descriptorType /// Type of the descriptors in this binding
Jesse Halldba27f72015-11-30 14:25:46 -08001660 u32 descriptorCount /// Number of descriptors in this binding
Jesse Halld27f6aa2015-08-15 17:58:48 -07001661 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to
1662 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements)
1663}
1664
1665class VkDescriptorSetLayoutCreateInfo {
1666 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
1667 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001668 VkDescriptorSetLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001669 u32 bindingCount /// Number of bindings in the descriptor set layout
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001670 const VkDescriptorSetLayoutBinding* pBinding /// Array of descriptor set layout bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001671}
1672
Jesse Hall65ab5522015-11-30 00:07:16 -08001673class VkDescriptorPoolSize {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001674 VkDescriptorType type
Jesse Hall03b6fe12015-11-24 12:44:21 -08001675 u32 descriptorCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001676}
1677
1678class VkDescriptorPoolCreateInfo {
1679 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
1680 const void* pNext /// Pointer to next structure
Jesse Hallfbf97b02015-11-20 14:17:03 -08001681 VkDescriptorPoolCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001682 u32 maxSets
Jesse Hall65ab5522015-11-30 00:07:16 -08001683 u32 poolSizeCount
1684 const VkDescriptorPoolSize* pPoolSizes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001685}
1686
Jesse Hall3fbc8562015-11-29 22:10:52 -08001687class VkDescriptorSetAllocateInfo {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001688 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO
Jesse Hallfbf97b02015-11-20 14:17:03 -08001689 const void* pNext /// Pointer to next structure
1690 VkDescriptorPool descriptorPool
Jesse Hall03b6fe12015-11-24 12:44:21 -08001691 u32 setCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001692 const VkDescriptorSetLayout* pSetLayouts
1693}
1694
Jesse Halld27f6aa2015-08-15 17:58:48 -07001695class VkSpecializationMapEntry {
Jesse Hall65ab5522015-11-30 00:07:16 -08001696 u32 constantID /// The SpecConstant ID specified in the BIL
Jesse Halld27f6aa2015-08-15 17:58:48 -07001697 u32 offset /// Offset of the value in the data block
Jesse Hallb00daad2015-11-29 19:46:20 -08001698 platform.size_t size /// Size in bytes of the SpecConstant
Jesse Halld27f6aa2015-08-15 17:58:48 -07001699}
1700
1701class VkSpecializationInfo {
1702 u32 mapEntryCount /// Number of entries in the map
Jesse Hallb00daad2015-11-29 19:46:20 -08001703 const VkSpecializationMapEntry* pMapEntries /// Array of map entries
Jesse Halld27f6aa2015-08-15 17:58:48 -07001704 platform.size_t dataSize /// Size in bytes of pData
1705 const void* pData /// Pointer to SpecConstant data
1706}
1707
1708class VkPipelineShaderStageCreateInfo {
1709 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
1710 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001711 VkPipelineShaderStageCreateFlags flags
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001712 VkShaderStageFlagBits stage
1713 VkShaderModule module
1714 const char* pName
Jesse Halld27f6aa2015-08-15 17:58:48 -07001715 const VkSpecializationInfo* pSpecializationInfo
1716}
1717
1718class VkComputePipelineCreateInfo {
1719 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
1720 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001721 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001722 VkPipelineShaderStageCreateInfo stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001723 VkPipelineLayout layout /// Interface layout of the pipeline
1724 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
1725 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
1726}
1727
1728class VkVertexInputBindingDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001729 u32 binding /// Vertex buffer binding id
1730 u32 stride /// Distance between vertices in bytes (0 = no advancement)
Jesse Hall65ab5522015-11-30 00:07:16 -08001731 VkVertexInputRate inputRate /// Rate at which binding is incremented
Jesse Halld27f6aa2015-08-15 17:58:48 -07001732}
1733
1734class VkVertexInputAttributeDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001735 u32 location /// location of the shader vertex attrib
1736 u32 binding /// Vertex buffer binding id
1737 VkFormat format /// format of source data
1738 u32 offset /// Offset of first element in bytes from base of vertex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001739}
1740
1741class VkPipelineVertexInputStateCreateInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001742 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
1743 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001744 VkPipelineVertexInputStateCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001745 u32 vertexBindingDescriptionCount /// number of bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001746 const VkVertexInputBindingDescription* pVertexBindingDescriptions
Jesse Hall03b6fe12015-11-24 12:44:21 -08001747 u32 vertexAttributeDescriptionCount /// number of attributes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001748 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
1749}
1750
1751class VkPipelineInputAssemblyStateCreateInfo {
1752 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
1753 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001754 VkPipelineInputAssemblyStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001755 VkPrimitiveTopology topology
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001756 VkBool32 primitiveRestartEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001757}
1758
1759class VkPipelineTessellationStateCreateInfo {
1760 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
1761 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001762 VkPipelineTessellationStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001763 u32 patchControlPoints
1764}
1765
1766class VkPipelineViewportStateCreateInfo {
1767 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
1768 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001769 VkPipelineViewportStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001770 u32 viewportCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001771 const VkViewport* pViewports
1772 u32 scissorCount
1773 const VkRect2D* pScissors
Jesse Halld27f6aa2015-08-15 17:58:48 -07001774}
1775
Jesse Hall3fbc8562015-11-29 22:10:52 -08001776class VkPipelineRasterizationStateCreateInfo {
Jesse Hall65ab5522015-11-30 00:07:16 -08001777 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001778 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001779 VkPipelineRasterizationStateCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001780 VkBool32 depthClampEnable
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001781 VkBool32 rasterizerDiscardEnable
Jesse Hall65ab5522015-11-30 00:07:16 -08001782 VkPolygonMode polygonMode /// optional (GL45)
Jesse Hallc7467b72015-11-29 21:05:26 -08001783 VkCullModeFlags cullMode
Jesse Halld27f6aa2015-08-15 17:58:48 -07001784 VkFrontFace frontFace
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001785 VkBool32 depthBiasEnable
Jesse Halla9bb62b2015-11-21 19:31:56 -08001786 f32 depthBiasConstantFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001787 f32 depthBiasClamp
Jesse Halla9bb62b2015-11-21 19:31:56 -08001788 f32 depthBiasSlopeFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001789 f32 lineWidth
Jesse Halld27f6aa2015-08-15 17:58:48 -07001790}
1791
1792class VkPipelineMultisampleStateCreateInfo {
1793 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
1794 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001795 VkPipelineMultisampleStateCreateFlags flags
Jesse Hall091ed9e2015-11-30 00:55:29 -08001796 VkSampleCountFlagBits rasterizationSamples /// Number of samples used for rasterization
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001797 VkBool32 sampleShadingEnable /// optional (GL45)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001798 f32 minSampleShading /// optional (GL45)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001799 const VkSampleMask* pSampleMask
Jesse Hallacfa5342015-11-19 21:51:33 -08001800 VkBool32 alphaToCoverageEnable
1801 VkBool32 alphaToOneEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001802}
1803
1804class VkPipelineColorBlendAttachmentState {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001805 VkBool32 blendEnable
Jesse Hall65ab5522015-11-30 00:07:16 -08001806 VkBlendFactor srcColorBlendFactor
1807 VkBlendFactor dstColorBlendFactor
1808 VkBlendOp colorBlendOp
1809 VkBlendFactor srcAlphaBlendFactor
1810 VkBlendFactor dstAlphaBlendFactor
1811 VkBlendOp alphaBlendOp
1812 VkColorComponentFlags colorWriteMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001813}
1814
1815class VkPipelineColorBlendStateCreateInfo {
1816 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
1817 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001818 VkPipelineColorBlendStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001819 VkBool32 logicOpEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001820 VkLogicOp logicOp
1821 u32 attachmentCount /// # of pAttachments
1822 const VkPipelineColorBlendAttachmentState* pAttachments
Jesse Hallb00daad2015-11-29 19:46:20 -08001823 f32[4] blendConstants
Jesse Halld27f6aa2015-08-15 17:58:48 -07001824}
1825
1826class VkStencilOpState {
Jesse Hall65ab5522015-11-30 00:07:16 -08001827 VkStencilOp failOp
1828 VkStencilOp passOp
1829 VkStencilOp depthFailOp
1830 VkCompareOp compareOp
1831 u32 compareMask
1832 u32 writeMask
1833 u32 reference
Jesse Halld27f6aa2015-08-15 17:58:48 -07001834}
1835
1836class VkPipelineDepthStencilStateCreateInfo {
1837 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
1838 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001839 VkPipelineDepthStencilStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001840 VkBool32 depthTestEnable
1841 VkBool32 depthWriteEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001842 VkCompareOp depthCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001843 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test)
1844 VkBool32 stencilTestEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001845 VkStencilOpState front
1846 VkStencilOpState back
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001847 f32 minDepthBounds
1848 f32 maxDepthBounds
1849}
1850
1851class VkPipelineDynamicStateCreateInfo {
1852 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
1853 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001854 VkPipelineDynamicStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001855 u32 dynamicStateCount
1856 const VkDynamicState* pDynamicStates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001857}
1858
1859class VkGraphicsPipelineCreateInfo {
Jesse Halla6429252015-11-29 18:59:42 -08001860 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
1861 const void* pNext /// Pointer to next structure
1862 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001863 u32 stageCount
Jesse Halla6429252015-11-29 18:59:42 -08001864 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001865 const VkPipelineVertexInputStateCreateInfo* pVertexInputState
1866 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
1867 const VkPipelineTessellationStateCreateInfo* pTessellationState
1868 const VkPipelineViewportStateCreateInfo* pViewportState
Jesse Hall3fbc8562015-11-29 22:10:52 -08001869 const VkPipelineRasterizationStateCreateInfo* pRasterizationState
Jesse Halld27f6aa2015-08-15 17:58:48 -07001870 const VkPipelineMultisampleStateCreateInfo* pMultisampleState
1871 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState
1872 const VkPipelineColorBlendStateCreateInfo* pColorBlendState
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001873 const VkPipelineDynamicStateCreateInfo* pDynamicState
Jesse Halla6429252015-11-29 18:59:42 -08001874 VkPipelineLayout layout /// Interface layout of the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001875 VkRenderPass renderPass
1876 u32 subpass
Jesse Halla6429252015-11-29 18:59:42 -08001877 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
1878 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 -07001879}
1880
1881class VkPipelineCacheCreateInfo {
Jesse Hallb00daad2015-11-29 19:46:20 -08001882 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
1883 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001884 VkPipelineCacheCreateFlags flags
Jesse Hallb00daad2015-11-29 19:46:20 -08001885 platform.size_t initialDataSize /// Size of initial data to populate cache, in bytes
1886 const void* pInitialData /// Initial data to populate cache
Jesse Halld27f6aa2015-08-15 17:58:48 -07001887}
1888
1889class VkPushConstantRange {
1890 VkShaderStageFlags stageFlags /// Which stages use the range
Jesse Hall03b6fe12015-11-24 12:44:21 -08001891 u32 offset /// Start of the range, in bytes
1892 u32 size /// Length of the range, in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001893}
1894
1895class VkPipelineLayoutCreateInfo {
1896 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
1897 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001898 VkPipelineLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001899 u32 setLayoutCount /// Number of descriptor sets interfaced by the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001900 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the
1901 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline
1902 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages
1903}
1904
1905class VkSamplerCreateInfo {
1906 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
1907 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001908 VkSamplerCreateFlags flags
Jesse Hall23ff73f2015-11-29 14:36:39 -08001909 VkFilter magFilter /// Filter mode for magnification
1910 VkFilter minFilter /// Filter mode for minifiation
1911 VkSamplerMipmapMode mipmapMode /// Mipmap selection mode
1912 VkSamplerAddressMode addressModeU
1913 VkSamplerAddressMode addressModeV
1914 VkSamplerAddressMode addressModeW
Jesse Halld27f6aa2015-08-15 17:58:48 -07001915 f32 mipLodBias
1916 f32 maxAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001917 VkBool32 compareEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001918 VkCompareOp compareOp
1919 f32 minLod
1920 f32 maxLod
1921 VkBorderColor borderColor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001922 VkBool32 unnormalizedCoordinates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001923}
1924
Jesse Hall3fbc8562015-11-29 22:10:52 -08001925class VkCommandPoolCreateInfo {
1926 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001927 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001928 VkCommandPoolCreateFlags flags /// Command pool creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001929 u32 queueFamilyIndex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001930}
1931
Jesse Hall3fbc8562015-11-29 22:10:52 -08001932class VkCommandBufferAllocateInfo {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001933 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001934 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001935 VkCommandPool commandPool
1936 VkCommandBufferLevel level
Jesse Hall03b6fe12015-11-24 12:44:21 -08001937 u32 bufferCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001938}
1939
Jesse Hall3fbc8562015-11-29 22:10:52 -08001940class VkCommandBufferBeginInfo {
1941 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001942 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001943 VkCommandBufferUsageFlags flags /// Command buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001944 VkRenderPass renderPass /// Render pass for secondary command buffers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001945 u32 subpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07001946 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001947 VkBool32 occlusionQueryEnable
1948 VkQueryControlFlags queryFlags
1949 VkQueryPipelineStatisticFlags pipelineStatistics
Jesse Halld27f6aa2015-08-15 17:58:48 -07001950}
1951
1952class VkRenderPassBeginInfo {
1953 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
1954 const void* pNext /// Pointer to next structure
1955 VkRenderPass renderPass
1956 VkFramebuffer framebuffer
1957 VkRect2D renderArea
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001958 u32 clearValueCount
1959 const VkClearValue* pClearValues
Jesse Halld27f6aa2015-08-15 17:58:48 -07001960}
1961
1962@union
1963/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared.
1964class VkClearColorValue {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001965 f32[4] float32
1966 s32[4] int32
1967 u32[4] uint32
Jesse Halld27f6aa2015-08-15 17:58:48 -07001968}
1969
1970class VkClearDepthStencilValue {
1971 f32 depth
1972 u32 stencil
1973}
1974
1975@union
1976/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared.
1977class VkClearValue {
1978 VkClearColorValue color
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001979 VkClearDepthStencilValue depthStencil
Jesse Halld27f6aa2015-08-15 17:58:48 -07001980}
1981
Jesse Hallae38f732015-11-19 21:32:50 -08001982class VkClearAttachment {
1983 VkImageAspectFlags aspectMask
1984 u32 colorAttachment
1985 VkClearValue clearValue
1986}
1987
Jesse Halld27f6aa2015-08-15 17:58:48 -07001988class VkAttachmentDescription {
Jesse Halla6429252015-11-29 18:59:42 -08001989 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001990 VkFormat format
Jesse Hall091ed9e2015-11-30 00:55:29 -08001991 VkSampleCountFlagBits samples
Jesse Halld27f6aa2015-08-15 17:58:48 -07001992 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1993 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1994 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1995 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1996 VkImageLayout initialLayout
1997 VkImageLayout finalLayout
1998}
1999
2000class VkAttachmentReference {
2001 u32 attachment
2002 VkImageLayout layout
2003}
2004
2005class VkSubpassDescription {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002006 VkSubpassDescriptionFlags flags
Jesse Halla6429252015-11-29 18:59:42 -08002007 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
Jesse Hall03b6fe12015-11-24 12:44:21 -08002008 u32 inputAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002009 const VkAttachmentReference* pInputAttachments
Jesse Hall03b6fe12015-11-24 12:44:21 -08002010 u32 colorAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002011 const VkAttachmentReference* pColorAttachments
2012 const VkAttachmentReference* pResolveAttachments
Jesse Hallc7467b72015-11-29 21:05:26 -08002013 const VkAttachmentReference* pDepthStencilAttachment
Jesse Hall03b6fe12015-11-24 12:44:21 -08002014 u32 preserveAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002015 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002016}
2017
2018class VkSubpassDependency {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002019 u32 srcSubpass
Jesse Hall3fbc8562015-11-29 22:10:52 -08002020 u32 dstSubpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07002021 VkPipelineStageFlags srcStageMask
Jesse Hall3fbc8562015-11-29 22:10:52 -08002022 VkPipelineStageFlags dstStageMask
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002023 VkAccessFlags srcAccessMask
2024 VkAccessFlags dstAccessMask
Jesse Halldc6d36c2015-11-29 19:12:15 -08002025 VkDependencyFlags dependencyFlags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002026}
2027
2028class VkRenderPassCreateInfo {
2029 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
2030 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002031 VkRenderPassCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002032 u32 attachmentCount
2033 const VkAttachmentDescription* pAttachments
2034 u32 subpassCount
2035 const VkSubpassDescription* pSubpasses
2036 u32 dependencyCount
2037 const VkSubpassDependency* pDependencies
2038}
2039
2040class VkEventCreateInfo {
2041 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
2042 const void* pNext /// Pointer to next structure
2043 VkEventCreateFlags flags /// Event creation flags
2044}
2045
2046class VkFenceCreateInfo {
2047 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
2048 const void* pNext /// Pointer to next structure
2049 VkFenceCreateFlags flags /// Fence creation flags
2050}
2051
2052class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002053 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
2054 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
2055 VkBool32 imageCubeArray /// image views which are arrays of cube maps
2056 VkBool32 independentBlend /// blending operations are controlled per-attachment
2057 VkBool32 geometryShader /// geometry stage
2058 VkBool32 tessellationShader /// tessellation control and evaluation stage
2059 VkBool32 sampleRateShading /// per-sample shading and interpolation
Jesse Hall3fbc8562015-11-29 22:10:52 -08002060 VkBool32 dualSrcBlend /// blend operations which take two sources
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002061 VkBool32 logicOp /// logic operations
2062 VkBool32 multiDrawIndirect /// multi draw indirect
Jesse Hallae38f732015-11-19 21:32:50 -08002063 VkBool32 depthClamp /// depth clamping
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002064 VkBool32 depthBiasClamp /// depth bias clamping
2065 VkBool32 fillModeNonSolid /// point and wireframe fill modes
2066 VkBool32 depthBounds /// depth bounds test
2067 VkBool32 wideLines /// lines with width greater than 1
2068 VkBool32 largePoints /// points with size greater than 1
Jesse Hallfbf97b02015-11-20 14:17:03 -08002069 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
2070 VkBool32 multiViewport
2071 VkBool32 samplerAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002072 VkBool32 textureCompressionETC2 /// ETC texture compression formats
2073 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
2074 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
Jesse Hall65ab5522015-11-30 00:07:16 -08002075 VkBool32 occlusionQueryPrecise
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002076 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
Jesse Halldc6d36c2015-11-29 19:12:15 -08002077 VkBool32 vertexPipelineStoresAndAtomics
2078 VkBool32 fragmentStoresAndAtomics
2079 VkBool32 shaderTessellationAndGeometryPointSize
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002080 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
2081 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
2082 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
Jesse Halld1af8122015-11-29 23:50:38 -08002083 VkBool32 shaderStorageImageReadWithoutFormat
2084 VkBool32 shaderStorageImageWriteWithoutFormat
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002085 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
2086 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
2087 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
2088 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
2089 VkBool32 shaderClipDistance /// clip distance in shaders
2090 VkBool32 shaderCullDistance /// cull distance in shaders
2091 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
2092 VkBool32 shaderInt64 /// 64-bit integers in shaders
2093 VkBool32 shaderInt16 /// 16-bit integers in shaders
2094 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
Jesse Hall65ab5522015-11-30 00:07:16 -08002095 VkBool32 shaderResourceMinLod /// shader can use texture operations that specify minimum resource LOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002096 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
2097 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
2098 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
2099 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
2100 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
2101 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
2102 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
2103 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
2104 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld1af8122015-11-29 23:50:38 -08002105 VkBool32 variableMultisampleRate
Jesse Halld27f6aa2015-08-15 17:58:48 -07002106}
2107
2108class VkPhysicalDeviceLimits {
2109 /// resource maximum sizes
2110 u32 maxImageDimension1D /// max 1D image dimension
2111 u32 maxImageDimension2D /// max 2D image dimension
2112 u32 maxImageDimension3D /// max 3D image dimension
2113 u32 maxImageDimensionCube /// max cubemap image dimension
2114 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hallb00daad2015-11-29 19:46:20 -08002115 u32 maxTexelBufferElements
Jesse Hallfbf97b02015-11-20 14:17:03 -08002116 u32 maxUniformBufferRange /// max uniform buffer size (bytes)
2117 u32 maxStorageBufferRange /// max storage buffer size (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002118 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
2119 /// memory limits
2120 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall091ed9e2015-11-30 00:55:29 -08002121 u32 maxSamplerAllocationCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002122 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
2123 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002124 /// descriptor set limits
2125 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07002126 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
2127 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
2128 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
2129 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
2130 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
Jesse Halle1b12782015-11-30 11:27:32 -08002131 u32 maxPerStageDescriptorInputAttachments
Jesse Halldba27f72015-11-30 14:25:46 -08002132 u32 maxPerStageResources
Jesse Halld27f6aa2015-08-15 17:58:48 -07002133 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
2134 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002135 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002136 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002137 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002138 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
2139 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
Jesse Halle1b12782015-11-30 11:27:32 -08002140 u32 maxDescriptorSetInputAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002141 /// vertex stage limits
2142 u32 maxVertexInputAttributes /// max num of vertex input attribute slots
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002143 u32 maxVertexInputBindings /// max num of vertex input binding slots
Jesse Halld27f6aa2015-08-15 17:58:48 -07002144 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset
2145 u32 maxVertexInputBindingStride /// max vertex input binding stride
2146 u32 maxVertexOutputComponents /// max num of output components written by vertex shader
2147 /// tessellation control stage limits
Jesse Hall3fbc8562015-11-29 22:10:52 -08002148 u32 maxTessellationGenerationLevel /// max level supported by tess primitive generator
Jesse Hallae38f732015-11-19 21:32:50 -08002149 u32 maxTessellationPatchSize /// max patch size (vertices)
2150 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS
2151 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS
2152 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS
2153 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS
2154 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES
2155 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES
Jesse Halld27f6aa2015-08-15 17:58:48 -07002156 /// geometry stage limits
2157 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader
2158 u32 maxGeometryInputComponents /// max num of input components read in geometry stage
2159 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage
2160 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage
2161 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage
2162 /// fragment stage limits
2163 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage
Jesse Hallfbf97b02015-11-20 14:17:03 -08002164 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage
Jesse Hall3fbc8562015-11-29 22:10:52 -08002165 u32 maxFragmentDualSrcAttachments /// max num of output attachments written when using dual source blending
Jesse Halld27f6aa2015-08-15 17:58:48 -07002166 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers
2167 /// compute stage limits
2168 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes)
2169 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z)
2170 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group
2171 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z)
2172
2173 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y
2174 u32 subTexelPrecisionBits /// num bits of subtexel precision
2175 u32 mipmapPrecisionBits /// num bits of mipmap precision
2176
2177 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices)
Jesse Halldba27f72015-11-30 14:25:46 -08002178 u32 maxDrawIndirectCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07002179
2180 f32 maxSamplerLodBias /// max absolute sampler level of detail bias
2181 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy
2182
2183 u32 maxViewports /// max number of active viewports
Jesse Halld27f6aa2015-08-15 17:58:48 -07002184 u32[2] maxViewportDimensions /// max viewport dimensions (x,y)
2185 f32[2] viewportBoundsRange /// viewport bounds range (min,max)
2186 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport
2187
Jesse Halldc6d36c2015-11-29 19:12:15 -08002188 platform.size_t minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes)
2189 VkDeviceSize minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes)
2190 VkDeviceSize minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes)
2191 VkDeviceSize minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002192
Jesse Hallfbf97b02015-11-20 14:17:03 -08002193 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002194 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset
Jesse Hallfbf97b02015-11-20 14:17:03 -08002195 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002196 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset
2197 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset
2198 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset
2199 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset
2200
2201 u32 maxFramebufferWidth /// max width for a framebuffer
2202 u32 maxFramebufferHeight /// max height for a framebuffer
2203 u32 maxFramebufferLayers /// max layer count for a layered framebuffer
Jesse Hall091ed9e2015-11-30 00:55:29 -08002204 VkSampleCountFlags framebufferColorSampleCounts
2205 VkSampleCountFlags framebufferDepthSampleCounts
2206 VkSampleCountFlags framebufferStencilSampleCounts
2207 VkSampleCountFlags framebufferNoAttachmentSampleCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07002208 u32 maxColorAttachments /// max num of framebuffer color attachments
2209
Jesse Hall091ed9e2015-11-30 00:55:29 -08002210 VkSampleCountFlags sampledImageColorSampleCounts
2211 VkSampleCountFlags sampledImageIntegerSampleCounts
2212 VkSampleCountFlags sampledImageDepthSampleCounts
2213 VkSampleCountFlags sampledImageStencilSampleCounts
2214 VkSampleCountFlags storageImageSampleCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07002215 u32 maxSampleMaskWords /// max num of sample mask words
2216
Jesse Halla9bb62b2015-11-21 19:31:56 -08002217 f32 timestampPeriod
Jesse Halld27f6aa2015-08-15 17:58:48 -07002218
2219 u32 maxClipDistances /// max number of clip distances
2220 u32 maxCullDistances /// max number of cull distances
2221 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
2222
Jesse Hallfbf97b02015-11-20 14:17:03 -08002223 u32 discreteQueuePriorities
2224
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002225 f32[2] pointSizeRange /// range (min,max) of supported point sizes
2226 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07002227 f32 pointSizeGranularity /// granularity of supported point sizes
2228 f32 lineWidthGranularity /// granularity of supported line widths
Jesse Hall03b6fe12015-11-24 12:44:21 -08002229 VkBool32 strictLines
Jesse Hall091ed9e2015-11-30 00:55:29 -08002230 VkBool32 standardSampleLocations
Jesse Halla9bb62b2015-11-21 19:31:56 -08002231
Jesse Hall65ab5522015-11-30 00:07:16 -08002232 VkDeviceSize optimalBufferCopyOffsetAlignment
2233 VkDeviceSize optimalBufferCopyRowPitchAlignment
Jesse Halldba27f72015-11-30 14:25:46 -08002234 VkDeviceSize nonCoherentAtomSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07002235}
2236
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002237class VkPhysicalDeviceSparseProperties {
2238 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 -08002239 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 -07002240 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
2241 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 -07002242 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
2243}
2244
Jesse Halld27f6aa2015-08-15 17:58:48 -07002245class VkSemaphoreCreateInfo {
2246 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
2247 const void* pNext /// Pointer to next structure
2248 VkSemaphoreCreateFlags flags /// Semaphore creation flags
2249}
2250
2251class VkQueryPoolCreateInfo {
2252 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
2253 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002254 VkQueryPoolCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002255 VkQueryType queryType
Jesse Hall65ab5522015-11-30 00:07:16 -08002256 u32 entryCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07002257 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
2258}
2259
2260class VkFramebufferCreateInfo {
2261 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
2262 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002263 VkFramebufferCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002264 VkRenderPass renderPass
2265 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002266 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002267 u32 width
2268 u32 height
2269 u32 layers
2270}
2271
Jesse Hall3fbc8562015-11-29 22:10:52 -08002272class VkDrawIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002273 u32 vertexCount
2274 u32 instanceCount
2275 u32 firstVertex
2276 u32 firstInstance
2277}
2278
Jesse Hall3fbc8562015-11-29 22:10:52 -08002279class VkDrawIndexedIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002280 u32 indexCount
2281 u32 instanceCount
2282 u32 firstIndex
2283 s32 vertexOffset
2284 u32 firstInstance
2285}
2286
Jesse Hall3fbc8562015-11-29 22:10:52 -08002287class VkDispatchIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002288 u32 x
2289 u32 y
2290 u32 z
2291}
2292
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002293@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08002294class VkSurfaceCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002295 u32 minImageCount
2296 u32 maxImageCount
2297 VkExtent2D currentExtent
2298 VkExtent2D minImageExtent
2299 VkExtent2D maxImageExtent
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002300 u32 maxImageArrayLayers
Jesse Hall1356b0d2015-11-23 17:24:58 -08002301 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002302 VkSurfaceTransformFlagBitsKHR currentTransform
Jesse Halla6429252015-11-29 18:59:42 -08002303 VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002304 VkImageUsageFlags supportedUsageFlags
Michael Lentine88594d72015-11-12 12:49:45 -08002305}
2306
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002307@extension("VK_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -08002308class VkSurfaceFormatKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002309 VkFormat format
2310 VkColorSpaceKHR colorSpace
Michael Lentine88594d72015-11-12 12:49:45 -08002311}
2312
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002313@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002314class VkSwapchainCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002315 VkStructureType sType
2316 const void* pNext
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002317 VkSwapchainCreateFlagsKHR flags
Jesse Hall1356b0d2015-11-23 17:24:58 -08002318 VkSurfaceKHR surface
2319 u32 minImageCount
2320 VkFormat imageFormat
2321 VkColorSpaceKHR imageColorSpace
2322 VkExtent2D imageExtent
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002323 u32 imageArrayLayers
2324 VkImageUsageFlags imageUsage
Jesse Hall1356b0d2015-11-23 17:24:58 -08002325 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08002326 u32 queueFamilyIndexCount
Jesse Hall1356b0d2015-11-23 17:24:58 -08002327 const u32* pQueueFamilyIndices
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002328 VkSurfaceTransformFlagBitsKHR preTransform
2329 VkCompositeAlphaFlagBitsKHR compositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002330 VkPresentModeKHR presentMode
Jesse Hall1356b0d2015-11-23 17:24:58 -08002331 VkBool32 clipped
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002332 VkSwapchainKHR oldSwapchain
Michael Lentine88594d72015-11-12 12:49:45 -08002333}
2334
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002335@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002336class VkPresentInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002337 VkStructureType sType
2338 const void* pNext
Jesse Hallb00daad2015-11-29 19:46:20 -08002339 u32 waitSemaphoreCount
2340 const VkSemaphore* pWaitSemaphores
Jesse Hall1356b0d2015-11-23 17:24:58 -08002341 u32 swapchainCount
Jesse Hall03b6fe12015-11-24 12:44:21 -08002342 const VkSwapchainKHR* pSwapchains
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002343 const u32* pImageIndices
Jesse Halle1b12782015-11-30 11:27:32 -08002344 VkResult* pResults
Michael Lentine88594d72015-11-12 12:49:45 -08002345}
2346
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002347@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002348class VkDisplayPropertiesKHR {
2349 VkDisplayKHR display
2350 const char* displayName
2351 VkExtent2D physicalDimensions
2352 VkExtent2D physicalResolution
2353 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hall1356b0d2015-11-23 17:24:58 -08002354 VkBool32 planeReorderPossible
Jesse Halla6429252015-11-29 18:59:42 -08002355 VkBool32 persistentContent
Michael Lentine88594d72015-11-12 12:49:45 -08002356}
2357
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002358@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002359class VkDisplayModeParametersKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002360 VkExtent2D visibleRegion
Jesse Halla6429252015-11-29 18:59:42 -08002361 u32 refreshRate
Michael Lentine88594d72015-11-12 12:49:45 -08002362}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002363
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002364@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002365class VkDisplayModePropertiesKHR {
2366 VkDisplayModeKHR displayMode
Jesse Halla6429252015-11-29 18:59:42 -08002367 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002368}
2369
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002370@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002371class VkDisplayModeCreateInfoKHR {
2372 VkStructureType sType
2373 const void* pNext
Jesse Hall9ba8bc82015-11-30 16:22:16 -08002374 VkDisplayModeCreateFlagsKHR flags
Jesse Halla6429252015-11-29 18:59:42 -08002375 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002376}
2377
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002378@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002379class VkDisplayPlanePropertiesKHR {
Jesse Halla6429252015-11-29 18:59:42 -08002380 VkDisplayKHR currentDisplay
2381 u32 currentStackIndex
2382}
2383
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002384@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002385class VkDisplayPlaneCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002386 VkDisplayPlaneAlphaFlagsKHR supportedAlpha
2387 VkOffset2D minSrcPosition
2388 VkOffset2D maxSrcPosition
2389 VkExtent2D minSrcExtent
2390 VkExtent2D maxSrcExtent
2391 VkOffset2D minDstPosition
2392 VkOffset2D maxDstPosition
2393 VkExtent2D minDstExtent
2394 VkExtent2D maxDstExtent
2395}
2396
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002397@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002398class VkDisplaySurfaceCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002399 VkStructureType sType
2400 const void* pNext
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002401 VkDisplaySurfaceCreateFlagsKHR flags
Jesse Hall1356b0d2015-11-23 17:24:58 -08002402 VkDisplayModeKHR displayMode
2403 u32 planeIndex
2404 u32 planeStackIndex
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002405 VkSurfaceTransformFlagBitsKHR transform
Jesse Hall1356b0d2015-11-23 17:24:58 -08002406 f32 globalAlpha
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002407 VkDisplayPlaneAlphaFlagBitsKHR alphaMode
2408 VkExtent2D imageExtent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002409}
2410
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002411@extension("VK_KHR_display_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002412class VkDisplayPresentInfoKHR {
2413 VkStructureType sType
2414 const void* pNext
2415 VkRect2D srcRect
2416 VkRect2D dstRect
Jesse Halla6429252015-11-29 18:59:42 -08002417 VkBool32 persistent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002418}
2419
2420
Jesse Halld27f6aa2015-08-15 17:58:48 -07002421////////////////
2422// Commands //
2423////////////////
2424
2425// Function pointers. TODO: add support for function pointers.
2426
2427@external type void* PFN_vkVoidFunction
2428@pfn cmd void vkVoidFunction() {
2429}
2430
Jesse Hall3fbc8562015-11-29 22:10:52 -08002431@external type void* PFN_vkAllocationFunction
2432@pfn cmd void* vkAllocationFunction(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002433 void* pUserData,
2434 platform.size_t size,
2435 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002436 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002437 return ?
2438}
2439
Jesse Hall3fbc8562015-11-29 22:10:52 -08002440@external type void* PFN_vkReallocationFunction
2441@pfn cmd void* vkReallocationFunction(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002442 void* pUserData,
2443 void* pOriginal,
2444 platform.size_t size,
2445 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002446 VkSystemAllocationScope allocationScope) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002447 return ?
2448}
2449
2450@external type void* PFN_vkFreeFunction
2451@pfn cmd void vkFreeFunction(
2452 void* pUserData,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002453 void* pMemory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002454}
2455
Jesse Hall3fbc8562015-11-29 22:10:52 -08002456@external type void* PFN_vkInternalAllocationNotification
2457@pfn cmd void vkInternalAllocationNotification(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002458 void* pUserData,
2459 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002460 VkInternalAllocationType allocationType,
2461 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002462}
2463
2464@external type void* PFN_vkInternalFreeNotification
2465@pfn cmd void vkInternalFreeNotification(
2466 void* pUserData,
2467 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002468 VkInternalAllocationType allocationType,
2469 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002470}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002471
2472// Global functions
2473
2474@threadSafety("system")
2475cmd VkResult vkCreateInstance(
2476 const VkInstanceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002477 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002478 VkInstance* pInstance) {
2479 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
2480
2481 instance := ?
2482 pInstance[0] = instance
2483 State.Instances[instance] = new!InstanceObject()
2484
Jesse Hall03b6fe12015-11-24 12:44:21 -08002485 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount]
2486 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount]
Jesse Halld27f6aa2015-08-15 17:58:48 -07002487
2488 return ?
2489}
2490
2491@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002492cmd void vkDestroyInstance(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002493 VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002494 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002495 instanceObject := GetInstance(instance)
2496
2497 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002498}
2499
2500@threadSafety("system")
2501cmd VkResult vkEnumeratePhysicalDevices(
2502 VkInstance instance,
2503 u32* pPhysicalDeviceCount,
2504 VkPhysicalDevice* pPhysicalDevices) {
2505 instanceObject := GetInstance(instance)
2506
2507 physicalDeviceCount := as!u32(?)
2508 pPhysicalDeviceCount[0] = physicalDeviceCount
2509 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2510
2511 for i in (0 .. physicalDeviceCount) {
2512 physicalDevice := ?
2513 physicalDevices[i] = physicalDevice
2514 if !(physicalDevice in State.PhysicalDevices) {
2515 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2516 }
2517 }
2518
2519 return ?
2520}
2521
2522cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2523 VkDevice device,
2524 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002525 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002526 device := GetDevice(device)
2527 }
2528
2529 return ?
2530}
2531
2532cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2533 VkInstance instance,
2534 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002535 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002536 instanceObject := GetInstance(instance)
2537 }
2538
2539 return ?
2540}
2541
Jesse Hall606a54e2015-11-19 22:17:28 -08002542cmd void vkGetPhysicalDeviceProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002543 VkPhysicalDevice physicalDevice,
2544 VkPhysicalDeviceProperties* pProperties) {
2545 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2546
2547 properties := ?
2548 pProperties[0] = properties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002549}
2550
Jesse Hall606a54e2015-11-19 22:17:28 -08002551cmd void vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002552 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002553 u32* pQueueFamilyPropertyCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002554 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002555 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002556 // TODO: Figure out how to express fetch-count-or-properties
2557 // This version fails 'apic validate' with 'fence not allowed in
2558 // *semantic.Branch'. Other attempts have failed with the same or other
2559 // errors.
2560 // if pQueueFamilyProperties != null {
2561 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2562 // for i in (0 .. pCount[0]) {
2563 // queueProperties := as!VkQueueFamilyProperties(?)
2564 // queuesProperties[i] = queueProperties
2565 // }
2566 // } else {
2567 // count := ?
2568 // pCount[0] = count
2569 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002570}
2571
Jesse Hall606a54e2015-11-19 22:17:28 -08002572cmd void vkGetPhysicalDeviceMemoryProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002573 VkPhysicalDevice physicalDevice,
2574 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2575 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2576
2577 memoryProperties := ?
2578 pMemoryProperties[0] = memoryProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002579}
2580
Jesse Hall606a54e2015-11-19 22:17:28 -08002581cmd void vkGetPhysicalDeviceFeatures(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002582 VkPhysicalDevice physicalDevice,
2583 VkPhysicalDeviceFeatures* pFeatures) {
2584 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2585
2586 features := ?
2587 pFeatures[0] = features
Jesse Halld27f6aa2015-08-15 17:58:48 -07002588}
2589
Jesse Hall606a54e2015-11-19 22:17:28 -08002590cmd void vkGetPhysicalDeviceFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002591 VkPhysicalDevice physicalDevice,
2592 VkFormat format,
2593 VkFormatProperties* pFormatProperties) {
2594 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2595
2596 formatProperties := ?
2597 pFormatProperties[0] = formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002598}
2599
Jesse Halla9e57032015-11-30 01:03:10 -08002600cmd VkResult vkGetPhysicalDeviceImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002601 VkPhysicalDevice physicalDevice,
2602 VkFormat format,
2603 VkImageType type,
2604 VkImageTiling tiling,
2605 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002606 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002607 VkImageFormatProperties* pImageFormatProperties) {
2608 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2609
2610 imageFormatProperties := ?
2611 pImageFormatProperties[0] = imageFormatProperties
Jesse Halla9e57032015-11-30 01:03:10 -08002612
2613 return ?
Jesse Halld27f6aa2015-08-15 17:58:48 -07002614}
2615
Jesse Halld27f6aa2015-08-15 17:58:48 -07002616
2617// Device functions
2618
2619@threadSafety("system")
2620cmd VkResult vkCreateDevice(
2621 VkPhysicalDevice physicalDevice,
2622 const VkDeviceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002623 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002624 VkDevice* pDevice) {
2625 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2626 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2627
2628 device := ?
2629 pDevice[0] = device
2630 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2631
2632 return ?
2633}
2634
2635@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002636cmd void vkDestroyDevice(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002637 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002638 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002639 deviceObject := GetDevice(device)
2640
2641 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002642}
2643
2644
2645// Extension discovery functions
2646
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002647cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002648 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002649 VkLayerProperties* pProperties) {
2650 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002651 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002652
2653 properties := pProperties[0:count]
2654 for i in (0 .. count) {
2655 property := ?
2656 properties[i] = property
2657 }
2658
2659 return ?
2660}
2661
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002662cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002663 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002664 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002665 VkExtensionProperties* pProperties) {
2666 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002667 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002668
2669 properties := pProperties[0:count]
2670 for i in (0 .. count) {
2671 property := ?
2672 properties[i] = property
2673 }
2674
2675 return ?
2676}
2677
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002678cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002679 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002680 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002681 VkLayerProperties* pProperties) {
2682 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2683 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002684 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002685
2686 properties := pProperties[0:count]
2687 for i in (0 .. count) {
2688 property := ?
2689 properties[i] = property
2690 }
2691
2692 return ?
2693}
2694
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002695cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002696 VkPhysicalDevice physicalDevice,
2697 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002698 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002699 VkExtensionProperties* pProperties) {
2700 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2701
2702 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002703 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002704
2705 properties := pProperties[0:count]
2706 for i in (0 .. count) {
2707 property := ?
2708 properties[i] = property
2709 }
2710
2711 return ?
2712}
2713
2714
2715// Queue functions
2716
2717@threadSafety("system")
Jesse Hall606a54e2015-11-19 22:17:28 -08002718cmd void vkGetDeviceQueue(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002719 VkDevice device,
2720 u32 queueFamilyIndex,
2721 u32 queueIndex,
2722 VkQueue* pQueue) {
2723 deviceObject := GetDevice(device)
2724
2725 queue := ?
2726 pQueue[0] = queue
2727
2728 if !(queue in State.Queues) {
2729 State.Queues[queue] = new!QueueObject(device: device)
2730 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002731}
2732
2733@threadSafety("app")
2734cmd VkResult vkQueueSubmit(
2735 VkQueue queue,
Jesse Halla366a512015-11-19 22:30:07 -08002736 u32 submitCount,
Jesse Hallb00daad2015-11-29 19:46:20 -08002737 const VkSubmitInfo* pSubmits,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002738 VkFence fence) {
2739 queueObject := GetQueue(queue)
2740
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002741 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002742 fenceObject := GetFence(fence)
2743 assert(fenceObject.device == queueObject.device)
2744 }
2745
Jesse Hall3fbc8562015-11-29 22:10:52 -08002746 // commandBuffers := pcommandBuffers[0:commandBufferCount]
2747 // for i in (0 .. commandBufferCount) {
2748 // commandBuffer := commandBuffers[i]
2749 // commandBufferObject := GetCommandBuffer(commandBuffer)
2750 // assert(commandBufferObject.device == queueObject.device)
Jesse Halla366a512015-11-19 22:30:07 -08002751 //
Jesse Hall3fbc8562015-11-29 22:10:52 -08002752 // validate("QueueCheck", commandBufferObject.queueFlags in queueObject.flags,
2753 // "vkQueueSubmit: enqueued commandBuffer requires missing queue capabilities.")
Jesse Halla366a512015-11-19 22:30:07 -08002754 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002755
2756 return ?
2757}
2758
2759@threadSafety("system")
2760cmd VkResult vkQueueWaitIdle(
2761 VkQueue queue) {
2762 queueObject := GetQueue(queue)
2763
2764 return ?
2765}
2766
2767@threadSafety("system")
2768cmd VkResult vkDeviceWaitIdle(
2769 VkDevice device) {
2770 deviceObject := GetDevice(device)
2771
2772 return ?
2773}
2774
2775
2776// Memory functions
2777
2778@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002779cmd VkResult vkAllocateMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002780 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002781 const VkMemoryAllocateInfo* pAllocateInfo,
2782 const VkAllocationCallbacks* pAllocator,
2783 VkDeviceMemory* pMemory) {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002784 assert(pAllocateInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002785 deviceObject := GetDevice(device)
2786
Jesse Hall3fbc8562015-11-29 22:10:52 -08002787 memory := ?
2788 pMemory[0] = memory
2789 State.DeviceMemories[memory] = new!DeviceMemoryObject(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002790 device: device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002791 allocationSize: pAllocateInfo[0].allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002792
2793 return ?
2794}
2795
2796@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002797cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002798 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002799 VkDeviceMemory memory,
2800 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002801 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002802 memoryObject := GetDeviceMemory(memory)
2803 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002804
2805 // Check that no objects are still bound before freeing.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002806 validate("MemoryCheck", len(memoryObject.boundObjects) == 0,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002807 "vkFreeMemory: objects still bound")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002808 validate("MemoryCheck", len(memoryObject.boundCommandBuffers) == 0,
2809 "vkFreeMemory: commandBuffers still bound")
2810 State.DeviceMemories[memory] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002811}
2812
2813@threadSafety("app")
2814cmd VkResult vkMapMemory(
2815 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002816 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002817 VkDeviceSize offset,
2818 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002819 VkMemoryMapFlags flags,
2820 void** ppData) {
2821 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002822 memoryObject := GetDeviceMemory(memory)
2823 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002824
2825 assert(flags == as!VkMemoryMapFlags(0))
Jesse Hall3fbc8562015-11-29 22:10:52 -08002826 assert((offset + size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002827
2828 return ?
2829}
2830
2831@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002832cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002833 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002834 VkDeviceMemory memory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002835 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002836 memoryObject := GetDeviceMemory(memory)
2837 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002838}
2839
2840cmd VkResult vkFlushMappedMemoryRanges(
2841 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002842 u32 memoryRangeCount
2843 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002844 deviceObject := GetDevice(device)
2845
Jesse Hall3fbc8562015-11-29 22:10:52 -08002846 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2847 for i in (0 .. memoryRangeCount) {
2848 memoryRange := memoryRanges[i]
2849 memoryObject := GetDeviceMemory(memoryRange.memory)
2850 assert(memoryObject.device == device)
2851 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002852 }
2853
2854 return ?
2855}
2856
2857cmd VkResult vkInvalidateMappedMemoryRanges(
2858 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002859 u32 memoryRangeCount,
2860 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002861 deviceObject := GetDevice(device)
2862
Jesse Hall3fbc8562015-11-29 22:10:52 -08002863 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2864 for i in (0 .. memoryRangeCount) {
2865 memoryRange := memoryRanges[i]
2866 memoryObject := GetDeviceMemory(memoryRange.memory)
2867 assert(memoryObject.device == device)
2868 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002869 }
2870
2871 return ?
2872}
2873
2874
2875// Memory management API functions
2876
Jesse Hall606a54e2015-11-19 22:17:28 -08002877cmd void vkGetDeviceMemoryCommitment(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002878 VkDevice device,
2879 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002880 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002881 deviceObject := GetDevice(device)
2882
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002883 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002884 memoryObject := GetDeviceMemory(memory)
2885 assert(memoryObject.device == device)
2886 }
2887
2888 committedMemoryInBytes := ?
2889 pCommittedMemoryInBytes[0] = committedMemoryInBytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07002890}
2891
Jesse Hall606a54e2015-11-19 22:17:28 -08002892cmd void vkGetBufferMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002893 VkDevice device,
2894 VkBuffer buffer,
2895 VkMemoryRequirements* pMemoryRequirements) {
2896 deviceObject := GetDevice(device)
2897 bufferObject := GetBuffer(buffer)
2898 assert(bufferObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002899}
2900
2901cmd VkResult vkBindBufferMemory(
2902 VkDevice device,
2903 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002904 VkDeviceMemory memory,
2905 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002906 deviceObject := GetDevice(device)
2907 bufferObject := GetBuffer(buffer)
2908 assert(bufferObject.device == device)
2909
2910 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002911 if bufferObject.memory != NULL_HANDLE {
2912 memoryObject := GetDeviceMemory(bufferObject.memory)
2913 memoryObject.boundObjects[as!u64(buffer)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002914 }
2915
2916 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002917 if memory != NULL_HANDLE {
2918 memoryObject := GetDeviceMemory(memory)
2919 assert(memoryObject.device == device)
2920 memoryObject.boundObjects[as!u64(buffer)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002921 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002922 bufferObject.memory = memory
2923 bufferObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002924
2925 return ?
2926}
2927
Jesse Hall606a54e2015-11-19 22:17:28 -08002928cmd void vkGetImageMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002929 VkDevice device,
2930 VkImage image,
2931 VkMemoryRequirements* pMemoryRequirements) {
2932 deviceObject := GetDevice(device)
2933 imageObject := GetImage(image)
2934 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002935}
2936
2937cmd VkResult vkBindImageMemory(
2938 VkDevice device,
2939 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002940 VkDeviceMemory memory,
2941 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002942 deviceObject := GetDevice(device)
2943 imageObject := GetImage(image)
2944 assert(imageObject.device == device)
2945
2946 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002947 if imageObject.memory != NULL_HANDLE {
2948 memoryObject := GetDeviceMemory(imageObject.memory)
2949 memoryObject.boundObjects[as!u64(image)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002950 }
2951
2952 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002953 if memory != NULL_HANDLE {
2954 memoryObject := GetDeviceMemory(memory)
2955 assert(memoryObject.device == device)
2956 memoryObject.boundObjects[as!u64(image)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002957 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002958 imageObject.memory = memory
2959 imageObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002960
2961 return ?
2962}
2963
Jesse Hall606a54e2015-11-19 22:17:28 -08002964cmd void vkGetImageSparseMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002965 VkDevice device,
2966 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002967 u32* pSparseMemoryRequirementCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002968 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2969 deviceObject := GetDevice(device)
2970 imageObject := GetImage(image)
2971 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002972}
2973
Jesse Hall606a54e2015-11-19 22:17:28 -08002974cmd void vkGetPhysicalDeviceSparseImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002975 VkPhysicalDevice physicalDevice,
2976 VkFormat format,
2977 VkImageType type,
Jesse Hall091ed9e2015-11-30 00:55:29 -08002978 VkSampleCountFlagBits samples,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002979 VkImageUsageFlags usage,
2980 VkImageTiling tiling,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002981 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002982 VkSparseImageFormatProperties* pProperties) {
2983 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002984}
2985
Jesse Halla6429252015-11-29 18:59:42 -08002986cmd VkResult vkQueueBindSparse(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002987 VkQueue queue,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002988 u32 bindInfoCount,
Jesse Halla6429252015-11-29 18:59:42 -08002989 const VkBindSparseInfo* pBindInfo,
2990 VkFence fence) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002991 queueObject := GetQueue(queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002992
2993 return ?
2994}
2995
2996
2997// Fence functions
2998
2999@threadSafety("system")
3000cmd VkResult vkCreateFence(
3001 VkDevice device,
3002 const VkFenceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003003 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003004 VkFence* pFence) {
3005 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
3006 deviceObject := GetDevice(device)
3007
3008 fence := ?
3009 pFence[0] = fence
3010 State.Fences[fence] = new!FenceObject(
Jesse Halld8bade02015-11-24 10:24:18 -08003011 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT)))
Jesse Halld27f6aa2015-08-15 17:58:48 -07003012
3013 return ?
3014}
3015
3016@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003017cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003018 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003019 VkFence fence,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003020 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003021 deviceObject := GetDevice(device)
3022 fenceObject := GetFence(fence)
3023 assert(fenceObject.device == device)
3024
3025 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003026}
3027
3028@threadSafety("system")
3029cmd VkResult vkResetFences(
3030 VkDevice device,
3031 u32 fenceCount,
3032 const VkFence* pFences) {
3033 deviceObject := GetDevice(device)
3034
3035 fences := pFences[0:fenceCount]
3036 for i in (0 .. fenceCount) {
3037 fence := fences[i]
3038 fenceObject := GetFence(fence)
3039 assert(fenceObject.device == device)
3040 fenceObject.signaled = false
3041 }
3042
3043 return ?
3044}
3045
3046@threadSafety("system")
3047cmd VkResult vkGetFenceStatus(
3048 VkDevice device,
3049 VkFence fence) {
3050 deviceObject := GetDevice(device)
3051 fenceObject := GetFence(fence)
3052 assert(fenceObject.device == device)
3053
3054 return ?
3055}
3056
3057@threadSafety("system")
3058cmd VkResult vkWaitForFences(
3059 VkDevice device,
3060 u32 fenceCount,
3061 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003062 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003063 u64 timeout) { /// timeout in nanoseconds
3064 deviceObject := GetDevice(device)
3065
3066 fences := pFences[0:fenceCount]
3067 for i in (0 .. fenceCount) {
3068 fence := fences[i]
3069 fenceObject := GetFence(fence)
3070 assert(fenceObject.device == device)
3071 }
3072
3073 return ?
3074}
3075
3076
3077// Queue semaphore functions
3078
3079@threadSafety("system")
3080cmd VkResult vkCreateSemaphore(
3081 VkDevice device,
3082 const VkSemaphoreCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003083 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003084 VkSemaphore* pSemaphore) {
3085 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
3086 deviceObject := GetDevice(device)
3087
3088 semaphore := ?
3089 pSemaphore[0] = semaphore
3090 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
3091
3092 return ?
3093}
3094
3095@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003096cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003097 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003098 VkSemaphore semaphore,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003099 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003100 deviceObject := GetDevice(device)
3101 semaphoreObject := GetSemaphore(semaphore)
3102 assert(semaphoreObject.device == device)
3103
3104 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003105}
3106
Jesse Halld27f6aa2015-08-15 17:58:48 -07003107
3108// Event functions
3109
3110@threadSafety("system")
3111cmd VkResult vkCreateEvent(
3112 VkDevice device,
3113 const VkEventCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003114 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003115 VkEvent* pEvent) {
3116 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
3117 deviceObject := GetDevice(device)
3118
3119 event := ?
3120 pEvent[0] = event
3121 State.Events[event] = new!EventObject(device: device)
3122
3123 return ?
3124}
3125
3126@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003127cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003128 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003129 VkEvent event,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003130 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003131 deviceObject := GetDevice(device)
3132 eventObject := GetEvent(event)
3133 assert(eventObject.device == device)
3134
3135 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003136}
3137
3138@threadSafety("system")
3139cmd VkResult vkGetEventStatus(
3140 VkDevice device,
3141 VkEvent event) {
3142 deviceObject := GetDevice(device)
3143 eventObject := GetEvent(event)
3144 assert(eventObject.device == device)
3145
3146 return ?
3147}
3148
3149@threadSafety("system")
3150cmd VkResult vkSetEvent(
3151 VkDevice device,
3152 VkEvent event) {
3153 deviceObject := GetDevice(device)
3154 eventObject := GetEvent(event)
3155 assert(eventObject.device == device)
3156
3157 return ?
3158}
3159
3160@threadSafety("system")
3161cmd VkResult vkResetEvent(
3162 VkDevice device,
3163 VkEvent event) {
3164 deviceObject := GetDevice(device)
3165 eventObject := GetEvent(event)
3166 assert(eventObject.device == device)
3167
3168 return ?
3169}
3170
3171
3172// Query functions
3173
3174@threadSafety("system")
3175cmd VkResult vkCreateQueryPool(
3176 VkDevice device,
3177 const VkQueryPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003178 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003179 VkQueryPool* pQueryPool) {
3180 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
3181 deviceObject := GetDevice(device)
3182
3183 queryPool := ?
3184 pQueryPool[0] = queryPool
3185 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
3186
3187 return ?
3188}
3189
3190@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003191cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003192 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003193 VkQueryPool queryPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003194 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003195 deviceObject := GetDevice(device)
3196 queryPoolObject := GetQueryPool(queryPool)
3197 assert(queryPoolObject.device == device)
3198
3199 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003200}
3201
3202@threadSafety("system")
3203cmd VkResult vkGetQueryPoolResults(
3204 VkDevice device,
3205 VkQueryPool queryPool,
3206 u32 startQuery,
3207 u32 queryCount,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003208 platform.size_t dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003209 void* pData,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003210 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003211 VkQueryResultFlags flags) {
3212 deviceObject := GetDevice(device)
3213 queryPoolObject := GetQueryPool(queryPool)
3214 assert(queryPoolObject.device == device)
3215
Jesse Halld27f6aa2015-08-15 17:58:48 -07003216 data := pData[0:dataSize]
3217
3218 return ?
3219}
3220
3221// Buffer functions
3222
3223@threadSafety("system")
3224cmd VkResult vkCreateBuffer(
3225 VkDevice device,
3226 const VkBufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003227 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003228 VkBuffer* pBuffer) {
3229 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
3230 deviceObject := GetDevice(device)
3231
3232 buffer := ?
3233 pBuffer[0] = buffer
3234 State.Buffers[buffer] = new!BufferObject(device: device)
3235
3236 return ?
3237}
3238
3239@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003240cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003241 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003242 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003243 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003244 deviceObject := GetDevice(device)
3245 bufferObject := GetBuffer(buffer)
3246 assert(bufferObject.device == device)
3247
Jesse Hall3fbc8562015-11-29 22:10:52 -08003248 assert(bufferObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003249 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003250}
3251
3252
3253// Buffer view functions
3254
3255@threadSafety("system")
3256cmd VkResult vkCreateBufferView(
3257 VkDevice device,
3258 const VkBufferViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003259 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003260 VkBufferView* pView) {
3261 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
3262 deviceObject := GetDevice(device)
3263
3264 bufferObject := GetBuffer(pCreateInfo.buffer)
3265 assert(bufferObject.device == device)
3266
3267 view := ?
3268 pView[0] = view
3269 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
3270
3271 return ?
3272}
3273
3274@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003275cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003276 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003277 VkBufferView bufferView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003278 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003279 deviceObject := GetDevice(device)
3280 bufferViewObject := GetBufferView(bufferView)
3281 assert(bufferViewObject.device == device)
3282
3283 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003284}
3285
3286
3287// Image functions
3288
3289@threadSafety("system")
3290cmd VkResult vkCreateImage(
3291 VkDevice device,
3292 const VkImageCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003293 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003294 VkImage* pImage) {
3295 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
3296 deviceObject := GetDevice(device)
3297
3298 image := ?
3299 pImage[0] = image
3300 State.Images[image] = new!ImageObject(device: device)
3301
3302 return ?
3303}
3304
3305@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003306cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003307 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003308 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003309 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003310 deviceObject := GetDevice(device)
3311 imageObject := GetImage(image)
3312 assert(imageObject.device == device)
3313
Jesse Hall3fbc8562015-11-29 22:10:52 -08003314 assert(imageObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003315 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003316}
3317
Jesse Hall606a54e2015-11-19 22:17:28 -08003318cmd void vkGetImageSubresourceLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003319 VkDevice device,
3320 VkImage image,
3321 const VkImageSubresource* pSubresource,
3322 VkSubresourceLayout* pLayout) {
3323 deviceObject := GetDevice(device)
3324 imageObject := GetImage(image)
3325 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003326}
3327
3328
3329// Image view functions
3330
3331@threadSafety("system")
3332cmd VkResult vkCreateImageView(
3333 VkDevice device,
3334 const VkImageViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003335 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003336 VkImageView* pView) {
3337 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
3338 deviceObject := GetDevice(device)
3339
3340 imageObject := GetImage(pCreateInfo.image)
3341 assert(imageObject.device == device)
3342
3343 view := ?
3344 pView[0] = view
3345 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
3346
3347 return ?
3348}
3349
3350@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003351cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003352 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003353 VkImageView imageView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003354 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003355 deviceObject := GetDevice(device)
3356 imageViewObject := GetImageView(imageView)
3357 assert(imageViewObject.device == device)
3358
3359 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003360}
3361
3362
3363// Shader functions
3364
3365cmd VkResult vkCreateShaderModule(
3366 VkDevice device,
3367 const VkShaderModuleCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003368 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003369 VkShaderModule* pShaderModule) {
3370 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
3371 deviceObject := GetDevice(device)
3372
3373 shaderModule := ?
3374 pShaderModule[0] = shaderModule
3375 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
3376
3377 return ?
3378}
3379
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003380cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003381 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003382 VkShaderModule shaderModule,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003383 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003384 deviceObject := GetDevice(device)
3385 shaderModuleObject := GetShaderModule(shaderModule)
3386 assert(shaderModuleObject.device == device)
3387
3388 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003389}
3390
Jesse Halld27f6aa2015-08-15 17:58:48 -07003391
3392// Pipeline functions
3393
3394cmd VkResult vkCreatePipelineCache(
3395 VkDevice device,
3396 const VkPipelineCacheCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003397 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003398 VkPipelineCache* pPipelineCache) {
3399 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
3400 deviceObject := GetDevice(device)
3401
3402 pipelineCache := ?
3403 pPipelineCache[0] = pipelineCache
3404 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
3405
3406 return ?
3407}
3408
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003409cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003410 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003411 VkPipelineCache pipelineCache,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003412 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003413 deviceObject := GetDevice(device)
3414 pipelineCacheObject := GetPipelineCache(pipelineCache)
3415 assert(pipelineCacheObject.device == device)
3416
3417 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003418}
3419
Jesse Halld27f6aa2015-08-15 17:58:48 -07003420cmd VkResult vkGetPipelineCacheData(
3421 VkDevice device,
3422 VkPipelineCache pipelineCache,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003423 platform.size_t* pDataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003424 void* pData) {
3425 deviceObject := GetDevice(device)
3426 pipelineCacheObject := GetPipelineCache(pipelineCache)
3427 assert(pipelineCacheObject.device == device)
3428
3429 return ?
3430}
3431
3432cmd VkResult vkMergePipelineCaches(
3433 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003434 VkPipelineCache dstCache,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003435 u32 srcCacheCount,
3436 const VkPipelineCache* pSrcCaches) {
3437 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003438 dstCacheObject := GetPipelineCache(dstCache)
3439 assert(dstCacheObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003440
3441 srcCaches := pSrcCaches[0:srcCacheCount]
3442 for i in (0 .. srcCacheCount) {
3443 srcCache := srcCaches[i]
3444 srcCacheObject := GetPipelineCache(srcCache)
3445 assert(srcCacheObject.device == device)
3446 }
3447
3448 return ?
3449}
3450
3451cmd VkResult vkCreateGraphicsPipelines(
3452 VkDevice device,
3453 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003454 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003455 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003456 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003457 VkPipeline* pPipelines) {
3458 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003459 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003460 pipelineCacheObject := GetPipelineCache(pipelineCache)
3461 assert(pipelineCacheObject.device == device)
3462 }
3463
Jesse Hall03b6fe12015-11-24 12:44:21 -08003464 createInfos := pCreateInfos[0:createInfoCount]
3465 pipelines := pPipelines[0:createInfoCount]
3466 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003467 pipeline := ?
3468 pipelines[i] = pipeline
3469 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3470 }
3471
3472 return ?
3473}
3474
3475cmd VkResult vkCreateComputePipelines(
3476 VkDevice device,
3477 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003478 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003479 const VkComputePipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003480 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003481 VkPipeline* pPipelines) {
3482 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003483 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003484 pipelineCacheObject := GetPipelineCache(pipelineCache)
3485 assert(pipelineCacheObject.device == device)
3486 }
3487
Jesse Hall03b6fe12015-11-24 12:44:21 -08003488 createInfos := pCreateInfos[0:createInfoCount]
3489 pipelines := pPipelines[0:createInfoCount]
3490 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003491 pipeline := ?
3492 pipelines[i] = pipeline
3493 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3494 }
3495
3496 return ?
3497}
3498
3499@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003500cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003501 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003502 VkPipeline pipeline,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003503 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003504 deviceObject := GetDevice(device)
3505 pipelineObjects := GetPipeline(pipeline)
3506 assert(pipelineObjects.device == device)
3507
3508 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003509}
3510
3511
3512// Pipeline layout functions
3513
3514@threadSafety("system")
3515cmd VkResult vkCreatePipelineLayout(
3516 VkDevice device,
3517 const VkPipelineLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003518 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003519 VkPipelineLayout* pPipelineLayout) {
3520 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3521 deviceObject := GetDevice(device)
3522
3523 pipelineLayout := ?
3524 pPipelineLayout[0] = pipelineLayout
3525 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3526
3527 return ?
3528}
3529
3530@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003531cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003532 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003533 VkPipelineLayout pipelineLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003534 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003535 deviceObject := GetDevice(device)
3536 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3537 assert(pipelineLayoutObjects.device == device)
3538
3539 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003540}
3541
3542
3543// Sampler functions
3544
3545@threadSafety("system")
3546cmd VkResult vkCreateSampler(
3547 VkDevice device,
3548 const VkSamplerCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003549 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003550 VkSampler* pSampler) {
3551 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3552 deviceObject := GetDevice(device)
3553
3554 sampler := ?
3555 pSampler[0] = sampler
3556 State.Samplers[sampler] = new!SamplerObject(device: device)
3557
3558 return ?
3559}
3560
3561@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003562cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003563 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003564 VkSampler sampler,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003565 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003566 deviceObject := GetDevice(device)
3567 samplerObject := GetSampler(sampler)
3568 assert(samplerObject.device == device)
3569
3570 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003571}
3572
3573
3574// Descriptor set functions
3575
3576@threadSafety("system")
3577cmd VkResult vkCreateDescriptorSetLayout(
3578 VkDevice device,
3579 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003580 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003581 VkDescriptorSetLayout* pSetLayout) {
3582 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3583 deviceObject := GetDevice(device)
3584
3585 setLayout := ?
3586 pSetLayout[0] = setLayout
3587 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3588
3589 return ?
3590}
3591
3592@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003593cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003594 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003595 VkDescriptorSetLayout descriptorSetLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003596 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003597 deviceObject := GetDevice(device)
3598 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3599 assert(descriptorSetLayoutObject.device == device)
3600
3601 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003602}
3603
3604@threadSafety("system")
3605cmd VkResult vkCreateDescriptorPool(
3606 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003607 const VkDescriptorPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003608 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003609 VkDescriptorPool* pDescriptorPool) {
3610 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3611 deviceObject := GetDevice(device)
3612
3613 descriptorPool := ?
3614 pDescriptorPool[0] = descriptorPool
3615 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3616
3617 return ?
3618}
3619
3620@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003621cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003622 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003623 VkDescriptorPool descriptorPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003624 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003625 deviceObject := GetDevice(device)
3626 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3627 assert(descriptorPoolObject.device == device)
3628
3629 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003630}
3631
3632@threadSafety("app")
3633cmd VkResult vkResetDescriptorPool(
3634 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003635 VkDescriptorPool descriptorPool,
3636 VkDescriptorPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003637 deviceObject := GetDevice(device)
3638 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3639 assert(descriptorPoolObject.device == device)
3640
3641 return ?
3642}
3643
3644@threadSafety("app")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003645cmd VkResult vkAllocateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003646 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003647 const VkDescriptorSetAllocateInfo* pAllocateInfo,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003648 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003649 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003650 allocInfo := pAllocateInfo[0]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003651 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003652
Jesse Hall03b6fe12015-11-24 12:44:21 -08003653 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount]
3654 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003655 setLayout := setLayouts[i]
3656 setLayoutObject := GetDescriptorSetLayout(setLayout)
3657 assert(setLayoutObject.device == device)
3658 }
3659
Jesse Hall03b6fe12015-11-24 12:44:21 -08003660 descriptorSets := pDescriptorSets[0:allocInfo.setCount]
3661 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003662 descriptorSet := ?
3663 descriptorSets[i] = descriptorSet
3664 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3665 }
3666
3667 return ?
3668}
3669
Jesse Hallf09c6b12015-08-15 19:54:28 -07003670cmd VkResult vkFreeDescriptorSets(
3671 VkDevice device,
3672 VkDescriptorPool descriptorPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003673 u32 descriptorSetCount,
Jesse Hallf09c6b12015-08-15 19:54:28 -07003674 const VkDescriptorSet* pDescriptorSets) {
3675 deviceObject := GetDevice(device)
3676 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3677
Jesse Hall03b6fe12015-11-24 12:44:21 -08003678 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3679 for i in (0 .. descriptorSetCount) {
Jesse Hallf09c6b12015-08-15 19:54:28 -07003680 descriptorSet := descriptorSets[i]
3681 descriptorSetObject := GetDescriptorSet(descriptorSet)
3682 assert(descriptorSetObject.device == device)
3683 State.DescriptorSets[descriptorSet] = null
3684 }
3685
3686 return ?
3687}
3688
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003689cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003690 VkDevice device,
Jesse Hallb00daad2015-11-29 19:46:20 -08003691 u32 descriptorWriteCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003692 const VkWriteDescriptorSet* pDescriptorWrites,
Jesse Hallb00daad2015-11-29 19:46:20 -08003693 u32 descriptorCopyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003694 const VkCopyDescriptorSet* pDescriptorCopies) {
3695 deviceObject := GetDevice(device)
3696
Jesse Hallb00daad2015-11-29 19:46:20 -08003697 descriptorWrites := pDescriptorWrites[0:descriptorWriteCount]
3698 for i in (0 .. descriptorWriteCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003699 descriptorWrite := descriptorWrites[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003700 descriptorWriteObject := GetDescriptorSet(descriptorWrite.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003701 assert(descriptorWriteObject.device == device)
3702 }
3703
Jesse Hallb00daad2015-11-29 19:46:20 -08003704 descriptorCopies := pDescriptorCopies[0:descriptorCopyCount]
3705 for i in (0 .. descriptorCopyCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003706 descriptorCopy := descriptorCopies[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003707 descriptorCopyObject := GetDescriptorSet(descriptorCopy.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003708 assert(descriptorCopyObject.device == device)
3709 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003710}
3711
3712
3713// Framebuffer functions
3714
3715@threadSafety("system")
3716cmd VkResult vkCreateFramebuffer(
3717 VkDevice device,
3718 const VkFramebufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003719 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003720 VkFramebuffer* pFramebuffer) {
3721 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3722 deviceObject := GetDevice(device)
3723
3724 framebuffer := ?
3725 pFramebuffer[0] = framebuffer
3726 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3727
3728 return ?
3729}
3730
3731@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003732cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003733 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003734 VkFramebuffer framebuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003735 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003736 deviceObject := GetDevice(device)
3737 framebufferObject := GetFramebuffer(framebuffer)
3738 assert(framebufferObject.device == device)
3739
3740 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003741}
3742
3743
3744// Renderpass functions
3745
3746@threadSafety("system")
3747cmd VkResult vkCreateRenderPass(
3748 VkDevice device,
3749 const VkRenderPassCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003750 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003751 VkRenderPass* pRenderPass) {
3752 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3753 deviceObject := GetDevice(device)
3754
3755 renderpass := ?
3756 pRenderPass[0] = renderpass
3757 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3758
3759 return ?
3760}
3761
3762@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003763cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003764 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003765 VkRenderPass renderPass,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003766 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003767 deviceObject := GetDevice(device)
3768 renderPassObject := GetRenderPass(renderPass)
3769 assert(renderPassObject.device == device)
3770
3771 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003772}
3773
Jesse Hall606a54e2015-11-19 22:17:28 -08003774cmd void vkGetRenderAreaGranularity(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003775 VkDevice device,
3776 VkRenderPass renderPass,
3777 VkExtent2D* pGranularity) {
3778 deviceObject := GetDevice(device)
3779 renderPassObject := GetRenderPass(renderPass)
3780
3781 granularity := ?
3782 pGranularity[0] = granularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07003783}
3784
3785// Command pool functions
3786
3787cmd VkResult vkCreateCommandPool(
3788 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003789 const VkCommandPoolCreateInfo* pCreateInfo,
3790 const VkAllocationCallbacks* pAllocator,
3791 VkCommandPool* pCommandPool) {
3792 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003793 deviceObject := GetDevice(device)
3794
Jesse Hall3fbc8562015-11-29 22:10:52 -08003795 commandPool := ?
3796 pCommandPool[0] = commandPool
3797 State.CommandPools[commandPool] = new!CommandPoolObject(device: device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003798
3799 return ?
3800}
3801
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003802cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003803 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003804 VkCommandPool commandPool,
3805 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003806 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003807 commandPoolObject := GetCommandPool(commandPool)
3808 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003809
Jesse Hall3fbc8562015-11-29 22:10:52 -08003810 State.CommandPools[commandPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003811}
3812
3813cmd VkResult vkResetCommandPool(
3814 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003815 VkCommandPool commandPool,
3816 VkCommandPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003817 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003818 commandPoolObject := GetCommandPool(commandPool)
3819 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003820
3821 return ?
3822}
3823
3824// Command buffer functions
3825
Jesse Hall3fbc8562015-11-29 22:10:52 -08003826macro void bindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3827 memoryObject := GetDeviceMemory(memory)
3828 memoryObject.boundCommandBuffers[commandBuffer] = commandBuffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07003829
Jesse Hall3fbc8562015-11-29 22:10:52 -08003830 commandBufferObject := GetCommandBuffer(commandBuffer)
3831 commandBufferObject.boundObjects[as!u64(obj)] = memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07003832}
3833
Jesse Hall3fbc8562015-11-29 22:10:52 -08003834macro void unbindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3835 memoryObject := GetDeviceMemory(memory)
3836 memoryObject.boundCommandBuffers[commandBuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003837
Jesse Hall3fbc8562015-11-29 22:10:52 -08003838 commandBufferObject := GetCommandBuffer(commandBuffer)
3839 commandBufferObject.boundObjects[as!u64(obj)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003840}
3841
3842@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003843cmd VkResult vkAllocateCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003844 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003845 const VkCommandBufferAllocateInfo* pAllocateInfo,
3846 VkCommandBuffer* pCommandBuffers) {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08003847 assert(pAllocateInfo[0].sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003848
Jesse Hall3fbc8562015-11-29 22:10:52 -08003849 count := pAllocateInfo[0].bufferCount
3850 commandBuffers := pCommandBuffers[0:count]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003851 for i in (0 .. count) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003852 commandBuffer := ?
3853 commandBuffers[i] = commandBuffer
3854 State.CommandBuffers[commandBuffer] = new!CommandBufferObject(device: device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003855 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003856
3857 return ?
3858}
3859
3860@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003861cmd void vkFreeCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003862 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003863 VkCommandPool commandPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003864 u32 commandBufferCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003865 const VkCommandBuffer* pCommandBuffers) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003866 deviceObject := GetDevice(device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003867
Jesse Hall3fbc8562015-11-29 22:10:52 -08003868 commandBuffers := pCommandBuffers[0:commandBufferCount]
Jesse Hall03b6fe12015-11-24 12:44:21 -08003869 for i in (0 .. commandBufferCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003870 commandBufferObject := GetCommandBuffer(commandBuffers[i])
3871 assert(commandBufferObject.device == device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003872 // TODO: iterate over boundObjects and clear memory bindings
Jesse Hall3fbc8562015-11-29 22:10:52 -08003873 State.CommandBuffers[commandBuffers[i]] = null
Jesse Hallfbf97b02015-11-20 14:17:03 -08003874 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003875}
3876
3877@threadSafety("app")
3878cmd VkResult vkBeginCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003879 VkCommandBuffer commandBuffer,
3880 const VkCommandBufferBeginInfo* pBeginInfo) {
3881 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO)
3882 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003883
3884 // TODO: iterate over boundObjects and clear memory bindings
3885
3886 return ?
3887}
3888
3889@threadSafety("app")
3890cmd VkResult vkEndCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003891 VkCommandBuffer commandBuffer) {
3892 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003893
3894 return ?
3895}
3896
3897@threadSafety("app")
3898cmd VkResult vkResetCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003899 VkCommandBuffer commandBuffer,
3900 VkCommandBufferResetFlags flags) {
3901 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003902
3903 // TODO: iterate over boundObjects and clear memory bindings
3904
3905 return ?
3906}
3907
3908
3909// Command buffer building functions
3910
3911@threadSafety("app")
3912cmd void vkCmdBindPipeline(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003913 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003914 VkPipelineBindPoint pipelineBindPoint,
3915 VkPipeline pipeline) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003916 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003917 pipelineObject := GetPipeline(pipeline)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003918 assert(commandBufferObject.device == pipelineObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003919
Jesse Halld8bade02015-11-24 10:24:18 -08003920 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003921 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3922 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3923 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08003924 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003925}
3926
3927@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003928cmd void vkCmdSetViewport(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003929 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003930 u32 viewportCount,
3931 const VkViewport* pViewports) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003932 commandBufferObject := GetCommandBuffer(commandBuffer)
3933 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003934}
3935
3936@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003937cmd void vkCmdSetScissor(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003938 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003939 u32 scissorCount,
3940 const VkRect2D* pScissors) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003941 commandBufferObject := GetCommandBuffer(commandBuffer)
3942 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003943}
3944
3945@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003946cmd void vkCmdSetLineWidth(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003947 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003948 f32 lineWidth) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003949 commandBufferObject := GetCommandBuffer(commandBuffer)
3950 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003951}
3952
3953@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003954cmd void vkCmdSetDepthBias(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003955 VkCommandBuffer commandBuffer,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003956 f32 depthBiasConstantFactor,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003957 f32 depthBiasClamp,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003958 f32 depthBiasSlopeFactor) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003959 commandBufferObject := GetCommandBuffer(commandBuffer)
3960 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003961}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003962
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003963@threadSafety("app")
3964cmd void vkCmdSetBlendConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003965 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003966 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3967 // an annotation as a quick hack to pass this to the template without
3968 // having to modify the AST and semantic model.
Jesse Hallb00daad2015-11-29 19:46:20 -08003969 @readonly f32[4] blendConstants) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003970 commandBufferObject := GetCommandBuffer(commandBuffer)
3971 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003972}
3973
3974@threadSafety("app")
3975cmd void vkCmdSetDepthBounds(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003976 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003977 f32 minDepthBounds,
3978 f32 maxDepthBounds) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003979 commandBufferObject := GetCommandBuffer(commandBuffer)
3980 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003981}
3982
3983@threadSafety("app")
3984cmd void vkCmdSetStencilCompareMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003985 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003986 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08003987 u32 compareMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003988 commandBufferObject := GetCommandBuffer(commandBuffer)
3989 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003990}
3991
3992@threadSafety("app")
3993cmd void vkCmdSetStencilWriteMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003994 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003995 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08003996 u32 writeMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003997 commandBufferObject := GetCommandBuffer(commandBuffer)
3998 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003999}
4000
4001@threadSafety("app")
4002cmd void vkCmdSetStencilReference(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004003 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004004 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08004005 u32 reference) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004006 commandBufferObject := GetCommandBuffer(commandBuffer)
4007 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004008}
4009
4010@threadSafety("app")
4011cmd void vkCmdBindDescriptorSets(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004012 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004013 VkPipelineBindPoint pipelineBindPoint,
4014 VkPipelineLayout layout,
4015 u32 firstSet,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004016 u32 descriptorSetCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004017 const VkDescriptorSet* pDescriptorSets,
4018 u32 dynamicOffsetCount,
4019 const u32* pDynamicOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004020 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004021
Jesse Hall03b6fe12015-11-24 12:44:21 -08004022 descriptorSets := pDescriptorSets[0:descriptorSetCount]
4023 for i in (0 .. descriptorSetCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004024 descriptorSet := descriptorSets[i]
4025 descriptorSetObject := GetDescriptorSet(descriptorSet)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004026 assert(commandBufferObject.device == descriptorSetObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004027 }
4028
4029 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
4030 for i in (0 .. dynamicOffsetCount) {
4031 dynamicOffset := dynamicOffsets[i]
4032 }
4033
Jesse Halld8bade02015-11-24 10:24:18 -08004034 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004035 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
4036 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
4037 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08004038 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004039}
4040
4041@threadSafety("app")
4042cmd void vkCmdBindIndexBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004043 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004044 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004045 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004046 VkIndexType indexType) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004047 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004048 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004049 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004050
Jesse Hall3fbc8562015-11-29 22:10:52 -08004051 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004052
Jesse Hall3fbc8562015-11-29 22:10:52 -08004053 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004054}
4055
4056@threadSafety("app")
4057cmd void vkCmdBindVertexBuffers(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004058 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004059 u32 startBinding,
4060 u32 bindingCount,
4061 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004062 const VkDeviceSize* pOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004063 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004064
4065 // TODO: check if not [startBinding:startBinding+bindingCount]
4066 buffers := pBuffers[0:bindingCount]
4067 offsets := pOffsets[0:bindingCount]
4068 for i in (0 .. bindingCount) {
4069 buffer := buffers[i]
4070 offset := offsets[i]
4071 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004072 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004073
Jesse Hall3fbc8562015-11-29 22:10:52 -08004074 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004075 }
4076
Jesse Hall3fbc8562015-11-29 22:10:52 -08004077 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004078}
4079
4080@threadSafety("app")
4081cmd void vkCmdDraw(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004082 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004083 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004084 u32 instanceCount,
4085 u32 firstVertex,
4086 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004087 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004088
Jesse Hall3fbc8562015-11-29 22:10:52 -08004089 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004090}
4091
4092@threadSafety("app")
4093cmd void vkCmdDrawIndexed(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004094 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004095 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004096 u32 instanceCount,
4097 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004098 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004099 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004100 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004101
Jesse Hall3fbc8562015-11-29 22:10:52 -08004102 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004103}
4104
4105@threadSafety("app")
4106cmd void vkCmdDrawIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004107 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004108 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004109 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004110 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004111 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004112 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004113 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004114 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004115
Jesse Hall3fbc8562015-11-29 22:10:52 -08004116 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004117
Jesse Hall3fbc8562015-11-29 22:10:52 -08004118 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004119}
4120
4121@threadSafety("app")
4122cmd void vkCmdDrawIndexedIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004123 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004124 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004125 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004126 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004127 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004128 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004129 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004130 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004131
Jesse Hall3fbc8562015-11-29 22:10:52 -08004132 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004133
Jesse Hall3fbc8562015-11-29 22:10:52 -08004134 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004135}
4136
4137@threadSafety("app")
4138cmd void vkCmdDispatch(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004139 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004140 u32 x,
4141 u32 y,
4142 u32 z) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004143 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004144
Jesse Hall3fbc8562015-11-29 22:10:52 -08004145 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004146}
4147
4148@threadSafety("app")
4149cmd void vkCmdDispatchIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004150 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004151 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004152 VkDeviceSize offset) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004153 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004154 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004155 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004156
Jesse Hall3fbc8562015-11-29 22:10:52 -08004157 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004158
Jesse Hall3fbc8562015-11-29 22:10:52 -08004159 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004160}
4161
4162@threadSafety("app")
4163cmd void vkCmdCopyBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004164 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004165 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004166 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004167 u32 regionCount,
4168 const VkBufferCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004169 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004170 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004171 dstBufferObject := GetBuffer(dstBuffer)
4172 assert(commandBufferObject.device == srcBufferObject.device)
4173 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004174
4175 regions := pRegions[0:regionCount]
4176 for i in (0 .. regionCount) {
4177 region := regions[i]
4178 }
4179
Jesse Hall3fbc8562015-11-29 22:10:52 -08004180 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4181 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004182
Jesse Hall65ab5522015-11-30 00:07:16 -08004183 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004184}
4185
4186@threadSafety("app")
4187cmd void vkCmdCopyImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004188 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004189 VkImage srcImage,
4190 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004191 VkImage dstImage,
4192 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004193 u32 regionCount,
4194 const VkImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004195 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004196 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004197 dstImageObject := GetImage(dstImage)
4198 assert(commandBufferObject.device == srcImageObject.device)
4199 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004200
4201 regions := pRegions[0:regionCount]
4202 for i in (0 .. regionCount) {
4203 region := regions[i]
4204 }
4205
Jesse Hall3fbc8562015-11-29 22:10:52 -08004206 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4207 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004208
Jesse Hall65ab5522015-11-30 00:07:16 -08004209 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004210}
4211
4212@threadSafety("app")
4213cmd void vkCmdBlitImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004214 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004215 VkImage srcImage,
4216 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004217 VkImage dstImage,
4218 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004219 u32 regionCount,
4220 const VkImageBlit* pRegions,
Jesse Hall23ff73f2015-11-29 14:36:39 -08004221 VkFilter filter) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004222 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004223 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004224 dstImageObject := GetImage(dstImage)
4225 assert(commandBufferObject.device == srcImageObject.device)
4226 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004227
4228 regions := pRegions[0:regionCount]
4229 for i in (0 .. regionCount) {
4230 region := regions[i]
4231 }
4232
Jesse Hall3fbc8562015-11-29 22:10:52 -08004233 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4234 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004235
Jesse Hall3fbc8562015-11-29 22:10:52 -08004236 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004237}
4238
4239@threadSafety("app")
4240cmd void vkCmdCopyBufferToImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004241 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004242 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004243 VkImage dstImage,
4244 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004245 u32 regionCount,
4246 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004247 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004248 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004249 dstImageObject := GetImage(dstImage)
4250 assert(commandBufferObject.device == srcBufferObject.device)
4251 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004252
4253 regions := pRegions[0:regionCount]
4254 for i in (0 .. regionCount) {
4255 region := regions[i]
4256 }
4257
Jesse Hall3fbc8562015-11-29 22:10:52 -08004258 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4259 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004260
Jesse Hall65ab5522015-11-30 00:07:16 -08004261 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004262}
4263
4264@threadSafety("app")
4265cmd void vkCmdCopyImageToBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004266 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004267 VkImage srcImage,
4268 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004269 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004270 u32 regionCount,
4271 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004272 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004273 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004274 dstBufferObject := GetBuffer(dstBuffer)
4275 assert(commandBufferObject.device == srcImageObject.device)
4276 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004277
4278 regions := pRegions[0:regionCount]
4279 for i in (0 .. regionCount) {
4280 region := regions[i]
4281 }
4282
Jesse Hall3fbc8562015-11-29 22:10:52 -08004283 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4284 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004285
Jesse Hall65ab5522015-11-30 00:07:16 -08004286 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004287}
4288
4289@threadSafety("app")
4290cmd void vkCmdUpdateBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004291 VkCommandBuffer commandBuffer,
4292 VkBuffer dstBuffer,
4293 VkDeviceSize dstOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004294 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004295 const u32* pData) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004296 commandBufferObject := GetCommandBuffer(commandBuffer)
4297 dstBufferObject := GetBuffer(dstBuffer)
4298 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004299
4300 data := pData[0:dataSize]
4301
Jesse Hall3fbc8562015-11-29 22:10:52 -08004302 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004303
Jesse Hall65ab5522015-11-30 00:07:16 -08004304 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004305}
4306
4307@threadSafety("app")
4308cmd void vkCmdFillBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004309 VkCommandBuffer commandBuffer,
4310 VkBuffer dstBuffer,
4311 VkDeviceSize dstOffset,
Jesse Hallb00daad2015-11-29 19:46:20 -08004312 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004313 u32 data) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004314 commandBufferObject := GetCommandBuffer(commandBuffer)
4315 dstBufferObject := GetBuffer(dstBuffer)
4316 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004317
Jesse Hall65ab5522015-11-30 00:07:16 -08004318 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004319}
4320
4321@threadSafety("app")
4322cmd void vkCmdClearColorImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004323 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004324 VkImage image,
4325 VkImageLayout imageLayout,
4326 const VkClearColorValue* pColor,
4327 u32 rangeCount,
4328 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004329 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004330 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004331 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004332
4333 ranges := pRanges[0:rangeCount]
4334 for i in (0 .. rangeCount) {
4335 range := ranges[i]
4336 }
4337
Jesse Hall3fbc8562015-11-29 22:10:52 -08004338 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004339
Jesse Hall3fbc8562015-11-29 22:10:52 -08004340 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004341}
4342
4343@threadSafety("app")
4344cmd void vkCmdClearDepthStencilImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004345 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004346 VkImage image,
4347 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004348 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004349 u32 rangeCount,
4350 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004351 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004352 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004353 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004354
4355 ranges := pRanges[0:rangeCount]
4356 for i in (0 .. rangeCount) {
4357 range := ranges[i]
4358 }
4359
Jesse Hall3fbc8562015-11-29 22:10:52 -08004360 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004361
Jesse Hall3fbc8562015-11-29 22:10:52 -08004362 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004363}
4364
4365@threadSafety("app")
Jesse Hallae38f732015-11-19 21:32:50 -08004366cmd void vkCmdClearAttachments(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004367 VkCommandBuffer commandBuffer,
Jesse Hallae38f732015-11-19 21:32:50 -08004368 u32 attachmentCount,
4369 const VkClearAttachment* pAttachments,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004370 u32 rectCount,
Jesse Halla15a4bf2015-11-19 22:48:02 -08004371 const VkClearRect* pRects) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004372 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004373
4374 rects := pRects[0:rectCount]
4375 for i in (0 .. rectCount) {
4376 rect := rects[i]
4377 }
4378
Jesse Hall3fbc8562015-11-29 22:10:52 -08004379 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004380}
4381
4382@threadSafety("app")
4383cmd void vkCmdResolveImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004384 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004385 VkImage srcImage,
4386 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004387 VkImage dstImage,
4388 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004389 u32 regionCount,
4390 const VkImageResolve* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004391 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004392 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004393 dstImageObject := GetImage(dstImage)
4394 assert(commandBufferObject.device == srcImageObject.device)
4395 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004396
4397 regions := pRegions[0:regionCount]
4398 for i in (0 .. regionCount) {
4399 region := regions[i]
4400 }
4401
Jesse Hall3fbc8562015-11-29 22:10:52 -08004402 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4403 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004404
Jesse Hall3fbc8562015-11-29 22:10:52 -08004405 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004406}
4407
4408@threadSafety("app")
4409cmd void vkCmdSetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004410 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004411 VkEvent event,
4412 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004413 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004414 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004415 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004416}
4417
4418@threadSafety("app")
4419cmd void vkCmdResetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004420 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004421 VkEvent event,
4422 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004423 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004424 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004425 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004426}
4427
4428@threadSafety("app")
4429cmd void vkCmdWaitEvents(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004430 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004431 u32 eventCount,
4432 const VkEvent* pEvents,
4433 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004434 VkPipelineStageFlags dstStageMask,
4435 u32 memoryBarrierCount,
4436 const void* const* ppMemoryBarriers) {
4437 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004438
4439 events := pEvents[0:eventCount]
4440 for i in (0 .. eventCount) {
4441 event := events[i]
4442 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004443 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004444 }
4445
Jesse Hall3fbc8562015-11-29 22:10:52 -08004446 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4447 for i in (0 .. memoryBarrierCount) {
4448 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004449 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004450 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004451 }
4452 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004453 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4454 imageObject := GetImage(imageMemoryBarrier.image)
4455 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004456 }
4457 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004458 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4459 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4460 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004461 }
4462 }
4463 }
4464}
4465
4466@threadSafety("app")
4467cmd void vkCmdPipelineBarrier(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004468 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004469 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004470 VkPipelineStageFlags dstStageMask,
Jesse Halldc6d36c2015-11-29 19:12:15 -08004471 VkDependencyFlags dependencyFlags,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004472 u32 memoryBarrierCount,
4473 const void* const* ppMemoryBarriers) {
4474 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004475
Jesse Hall3fbc8562015-11-29 22:10:52 -08004476 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4477 for i in (0 .. memoryBarrierCount) {
4478 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004479 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004480 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004481 }
4482 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004483 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4484 imageObject := GetImage(imageMemoryBarrier.image)
4485 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004486 }
4487 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004488 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4489 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4490 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004491 }
4492 }
4493 }
4494}
4495
4496@threadSafety("app")
4497cmd void vkCmdBeginQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004498 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004499 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004500 u32 entry,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004501 VkQueryControlFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004502 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004503 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004504 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004505}
4506
4507@threadSafety("app")
4508cmd void vkCmdEndQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004509 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004510 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004511 u32 entry) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004512 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004513 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004514 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004515}
4516
4517@threadSafety("app")
4518cmd void vkCmdResetQueryPool(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004519 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004520 VkQueryPool queryPool,
4521 u32 startQuery,
4522 u32 queryCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004523 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004524 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004525 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004526}
4527
4528@threadSafety("app")
4529cmd void vkCmdWriteTimestamp(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004530 VkCommandBuffer commandBuffer,
Jesse Hall6f39a6d2015-11-24 11:08:36 -08004531 VkPipelineStageFlagBits pipelineStage,
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004532 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004533 u32 entry) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004534 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004535 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004536 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004537}
4538
4539@threadSafety("app")
4540cmd void vkCmdCopyQueryPoolResults(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004541 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004542 VkQueryPool queryPool,
4543 u32 startQuery,
4544 u32 queryCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004545 VkBuffer dstBuffer,
4546 VkDeviceSize dstOffset,
Jesse Halla9bb62b2015-11-21 19:31:56 -08004547 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004548 VkQueryResultFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004549 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004550 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004551 dstBufferObject := GetBuffer(dstBuffer)
4552 assert(commandBufferObject.device == queryPoolObject.device)
4553 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004554}
4555
4556cmd void vkCmdPushConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004557 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004558 VkPipelineLayout layout,
4559 VkShaderStageFlags stageFlags,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004560 u32 offset,
4561 u32 size,
Jesse Hallf4ab2b12015-11-30 16:04:55 -08004562 const void* pValues) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004563 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004564 layoutObject := GetPipelineLayout(layout)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004565 assert(commandBufferObject.device == layoutObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004566}
4567
4568@threadSafety("app")
4569cmd void vkCmdBeginRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004570 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004571 const VkRenderPassBeginInfo* pRenderPassBegin,
Jesse Hall65ab5522015-11-30 00:07:16 -08004572 VkSubpassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004573 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004574 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4575 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004576 assert(commandBufferObject.device == renderPassObject.device)
4577 assert(commandBufferObject.device == framebufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004578
Jesse Hall3fbc8562015-11-29 22:10:52 -08004579 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004580}
4581
4582cmd void vkCmdNextSubpass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004583 VkCommandBuffer commandBuffer,
Jesse Hall65ab5522015-11-30 00:07:16 -08004584 VkSubpassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004585 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004586}
4587
4588@threadSafety("app")
4589cmd void vkCmdEndRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004590 VkCommandBuffer commandBuffer) {
4591 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004592
Jesse Hall3fbc8562015-11-29 22:10:52 -08004593 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004594}
4595
4596cmd void vkCmdExecuteCommands(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004597 VkCommandBuffer commandBuffer,
4598 u32 commandBuffersCount,
4599 const VkCommandBuffer* pCommandBuffers) {
4600 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004601
Jesse Hall3fbc8562015-11-29 22:10:52 -08004602 commandBuffers := pCommandBuffers[0:commandBuffersCount]
4603 for i in (0 .. commandBuffersCount) {
4604 secondaryCommandBuffer := commandBuffers[i]
4605 secondaryCommandBufferObject := GetCommandBuffer(secondaryCommandBuffer)
4606 assert(commandBufferObject.device == secondaryCommandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004607 }
4608}
4609
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004610@extension("VK_KHR_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004611cmd void vkDestroySurfaceKHR(
4612 VkInstance instance,
Jesse Hall0e74f002015-11-30 11:37:59 -08004613 VkSurfaceKHR surface,
4614 const VkAllocationCallbacks* pAllocator) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004615 instanceObject := GetInstance(instance)
4616 surfaceObject := GetSurface(surface)
4617 assert(surfaceObject.instance == instance)
Michael Lentine88594d72015-11-12 12:49:45 -08004618
Jesse Hall1356b0d2015-11-23 17:24:58 -08004619 State.Surfaces[surface] = null
Jesse Hall2818f932015-11-19 21:19:17 -08004620}
4621
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004622@extension("VK_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004623cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004624 VkPhysicalDevice physicalDevice,
4625 u32 queueFamilyIndex,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004626 VkSurfaceKHR surface,
Jesse Hallb00daad2015-11-29 19:46:20 -08004627 VkBool32* pSupported) {
4628 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004629
4630 return ?
4631}
4632
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004633@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004634cmd VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
4635 VkPhysicalDevice physicalDevice,
4636 VkSurfaceKHR surface,
4637 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
4638 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4639
4640 surfaceCapabilities := ?
4641 pSurfaceCapabilities[0] = surfaceCapabilities
4642
4643 return ?
4644}
4645
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004646@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004647cmd VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(
4648 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004649 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004650 u32* pSurfaceFormatCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004651 VkSurfaceFormatKHR* pSurfaceFormats) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004652 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004653
4654 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004655 pSurfaceFormatCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004656 surfaceFormats := pSurfaceFormats[0:count]
4657
4658 for i in (0 .. count) {
4659 surfaceFormat := ?
4660 surfaceFormats[i] = surfaceFormat
4661 }
4662
4663 return ?
4664}
4665
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004666@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004667cmd VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(
4668 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004669 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004670 u32* pPresentModeCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004671 VkPresentModeKHR* pPresentModes) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004672 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004673
4674 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004675 pPresentModeCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004676 presentModes := pPresentModes[0:count]
4677
4678 for i in (0 .. count) {
4679 presentMode := ?
4680 presentModes[i] = presentMode
4681 }
4682
4683 return ?
4684}
4685
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004686@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004687cmd VkResult vkCreateSwapchainKHR(
4688 VkDevice device,
4689 const VkSwapchainCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004690 const VkAllocationCallbacks* pAllocator,
Michael Lentine88594d72015-11-12 12:49:45 -08004691 VkSwapchainKHR* pSwapchain) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004692 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
Michael Lentine88594d72015-11-12 12:49:45 -08004693 deviceObject := GetDevice(device)
4694
4695 swapchain := ?
4696 pSwapchain[0] = swapchain
4697 State.Swapchains[swapchain] = new!SwapchainObject(device: device)
4698
4699 return ?
4700}
4701
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004702@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004703cmd void vkDestroySwapchainKHR(
Michael Lentine88594d72015-11-12 12:49:45 -08004704 VkDevice device,
Jesse Hall0e74f002015-11-30 11:37:59 -08004705 VkSwapchainKHR swapchain,
4706 const VkAllocationCallbacks* pAllocator) {
Michael Lentine88594d72015-11-12 12:49:45 -08004707 deviceObject := GetDevice(device)
4708 swapchainObject := GetSwapchain(swapchain)
4709 assert(swapchainObject.device == device)
4710
4711 State.Swapchains[swapchain] = null
Michael Lentine88594d72015-11-12 12:49:45 -08004712}
4713
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004714@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004715cmd VkResult vkGetSwapchainImagesKHR(
4716 VkDevice device,
4717 VkSwapchainKHR swapchain,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004718 u32* pSwapchainImageCount,
Michael Lentine88594d72015-11-12 12:49:45 -08004719 VkImage* pSwapchainImages) {
4720 deviceObject := GetDevice(device)
4721
4722 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004723 pSwapchainImageCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004724 swapchainImages := pSwapchainImages[0:count]
4725
4726 for i in (0 .. count) {
4727 swapchainImage := ?
4728 swapchainImages[i] = swapchainImage
Jesse Hall1356b0d2015-11-23 17:24:58 -08004729 State.Images[swapchainImage] = new!ImageObject(device: device)
Michael Lentine88594d72015-11-12 12:49:45 -08004730 }
4731
4732 return ?
4733}
4734
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004735@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004736cmd VkResult vkAcquireNextImageKHR(
4737 VkDevice device,
4738 VkSwapchainKHR swapchain,
4739 u64 timeout,
4740 VkSemaphore semaphore,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004741 VkFence fence,
Michael Lentine88594d72015-11-12 12:49:45 -08004742 u32* pImageIndex) {
4743 deviceObject := GetDevice(device)
4744 swapchainObject := GetSwapchain(swapchain)
4745
4746 imageIndex := ?
4747 pImageIndex[0] = imageIndex
4748
4749 return ?
4750}
4751
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004752@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004753cmd VkResult vkQueuePresentKHR(
4754 VkQueue queue,
Jesse Hallf4ab2b12015-11-30 16:04:55 -08004755 const VkPresentInfoKHR* pPresentInfo) {
Michael Lentine88594d72015-11-12 12:49:45 -08004756 queueObject := GetQueue(queue)
4757
4758 presentInfo := ?
4759 pPresentInfo[0] = presentInfo
4760
4761 return ?
4762}
4763
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004764@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004765cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
4766 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004767 u32* pPropertyCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004768 VkDisplayPropertiesKHR* pProperties) {
4769 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4770 return ?
4771}
4772
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004773@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004774cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
4775 VkPhysicalDevice physicalDevice,
4776 u32* pPropertyCount,
4777 VkDisplayPlanePropertiesKHR* pProperties) {
4778 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4779 return ?
4780}
4781
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004782@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004783cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR(
4784 VkPhysicalDevice physicalDevice,
Jesse Hallf4ab2b12015-11-30 16:04:55 -08004785 u32* pDisplayCount,
4786 VkDisplayKHR* pDisplays) {
Jesse Halla6429252015-11-29 18:59:42 -08004787 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4788 return ?
4789}
4790
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004791@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004792cmd VkResult vkGetDisplayModePropertiesKHR(
4793 VkPhysicalDevice physicalDevice,
4794 VkDisplayKHR display,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004795 u32* pPropertyCount,
4796 VkDisplayModePropertiesKHR* pProperties) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004797 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4798 return ?
4799}
4800
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004801@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004802cmd VkResult vkCreateDisplayModeKHR(
4803 VkPhysicalDevice physicalDevice,
4804 VkDisplayKHR display,
4805 const VkDisplayModeCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004806 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004807 VkDisplayModeKHR* pMode) {
4808 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4809 return ?
4810}
4811
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004812@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004813cmd VkResult vkGetDisplayPlaneCapabilitiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004814 VkPhysicalDevice physicalDevice,
Jesse Hall9ba8bc82015-11-30 16:22:16 -08004815 VkDisplayModeKHR mode,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004816 u32 planeIndex,
Jesse Halla6429252015-11-29 18:59:42 -08004817 VkDisplayPlaneCapabilitiesKHR* pCapabilities) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004818 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4819 return ?
4820}
4821
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004822@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004823cmd VkResult vkCreateDisplayPlaneSurfaceKHR(
4824 VkInstance instance,
4825 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004826 const VkAllocationCallbacks* pAllocator,
Jesse Halla6429252015-11-29 18:59:42 -08004827 VkSurfaceKHR* pSurface) {
4828 return ?
4829}
4830
Jesse Hall9ba8bc82015-11-30 16:22:16 -08004831@extension("VK_KHR_display_swapchain")
4832cmd VkResult vkCreateSharedSwapchainsKHR(
4833 VkDevice device,
4834 u32 swapchainCount,
4835 const VkSwapchainCreateInfoKHR* pCreateInfos,
4836 const VkAllocationCallbacks* pAllocator,
4837 VkSwapchainKHR* pSwapchains) {
4838 return ?
4839}
4840
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004841@extension("VK_KHR_xlib_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004842cmd VkResult vkCreateXlibSurfaceKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004843 VkInstance instance,
4844 platform.Display* dpy,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004845 platform.Window window,
Jesse Hall0e74f002015-11-30 11:37:59 -08004846 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004847 VkSurfaceKHR* pSurface) {
4848 instanceObject := GetInstance(instance)
4849 return ?
4850}
4851
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004852@extension("VK_KHR_xlib_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004853cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
4854 VkPhysicalDevice physicalDevice,
4855 u32 queueFamilyIndex,
4856 platform.Display* dpy,
Jesse Hall65ab5522015-11-30 00:07:16 -08004857 platform.VisualID visualID) {
Jesse Halla6429252015-11-29 18:59:42 -08004858 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4859 return ?
4860}
4861
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004862@extension("VK_KHR_xcb_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004863cmd VkResult vkCreateXCBSurfaceKHR(
4864 VkInstance instance,
4865 platform.xcb_connection_t* connection,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004866 platform.xcb_window_t window,
Jesse Hall0e74f002015-11-30 11:37:59 -08004867 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004868 VkSurfaceKHR* pSurface) {
4869 instanceObject := GetInstance(instance)
4870 return ?
4871}
4872
Jesse Hall523db342015-11-30 21:12:55 -08004873@extension("VK_KHR_xcb_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004874cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
4875 VkPhysicalDevice physicalDevice,
4876 u32 queueFamilyIndex,
4877 platform.xcb_connection_t* connection,
4878 platform.xcb_visualid_t visual_id) {
4879 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4880 return ?
4881}
4882
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004883@extension("VK_KHR_wayland_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004884cmd VkResult vkCreateWaylandSurfaceKHR(
4885 VkInstance instance,
4886 platform.wl_display* display,
4887 platform.wl_surface* surface,
Jesse Hall0e74f002015-11-30 11:37:59 -08004888 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004889 VkSurfaceKHR* pSurface) {
4890 instanceObject := GetInstance(instance)
4891 return ?
4892}
4893
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004894@extension("VK_KHR_wayland_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004895cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
4896 VkPhysicalDevice physicalDevice,
4897 u32 queueFamilyIndex,
4898 platform.wl_display* display) {
4899 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4900 return ?
4901}
4902
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004903@extension("VK_KHR_mir_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004904cmd VkResult vkCreateMirSurfaceKHR(
4905 VkInstance instance,
4906 platform.MirConnection* connection,
4907 platform.MirSurface* mirSurface,
Jesse Hall0e74f002015-11-30 11:37:59 -08004908 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004909 VkSurfaceKHR* pSurface) {
4910 instanceObject := GetInstance(instance)
4911 return ?
4912}
4913
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004914@extension("VK_KHR_mir_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004915cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR(
4916 VkPhysicalDevice physicalDevice,
4917 u32 queueFamilyIndex,
4918 platform.MirConnection* connection) {
4919 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4920 return ?
4921}
4922
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004923@extension("VK_KHR_android_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004924cmd VkResult vkCreateAndroidSurfaceKHR(
4925 VkInstance instance,
Jesse Hall0e74f002015-11-30 11:37:59 -08004926 platform.ANativeWindow* window,
4927 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004928 VkSurfaceKHR* pSurface) {
4929 instanceObject := GetInstance(instance)
4930 return ?
4931}
4932
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004933@extension("VK_KHR_win32_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004934cmd VkResult vkCreateWin32SurfaceKHR(
4935 VkInstance instance,
4936 platform.HINSTANCE hinstance,
4937 platform.HWND hwnd,
Jesse Hall0e74f002015-11-30 11:37:59 -08004938 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004939 VkSurfaceKHR* pSurface) {
4940 instanceObject := GetInstance(instance)
4941 return ?
4942}
4943
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004944@extension("VK_KHR_win32_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004945cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR(
4946 VkPhysicalDevice physicalDevice,
4947 u32 queueFamilyIndex) {
4948 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4949 return ?
4950}
4951
Jesse Halld27f6aa2015-08-15 17:58:48 -07004952
4953////////////////
4954// Validation //
4955////////////////
4956
4957extern void validate(string layerName, bool condition, string message)
4958
4959
4960/////////////////////////////
4961// Internal State Tracking //
4962/////////////////////////////
4963
4964StateObject State
4965
4966@internal class StateObject {
4967 // Dispatchable objects.
4968 map!(VkInstance, ref!InstanceObject) Instances
4969 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4970 map!(VkDevice, ref!DeviceObject) Devices
4971 map!(VkQueue, ref!QueueObject) Queues
Jesse Hall3fbc8562015-11-29 22:10:52 -08004972 map!(VkCommandBuffer, ref!CommandBufferObject) CommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07004973
4974 // Non-dispatchable objects.
4975 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4976 map!(VkBuffer, ref!BufferObject) Buffers
4977 map!(VkBufferView, ref!BufferViewObject) BufferViews
4978 map!(VkImage, ref!ImageObject) Images
4979 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004980 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
Jesse Halld27f6aa2015-08-15 17:58:48 -07004981 map!(VkPipeline, ref!PipelineObject) Pipelines
4982 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4983 map!(VkSampler, ref!SamplerObject) Samplers
4984 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4985 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4986 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004987 map!(VkFence, ref!FenceObject) Fences
4988 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4989 map!(VkEvent, ref!EventObject) Events
4990 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4991 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4992 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4993 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
Jesse Hall3fbc8562015-11-29 22:10:52 -08004994 map!(VkCommandPool, ref!CommandPoolObject) CommandPools
Jesse Hall1356b0d2015-11-23 17:24:58 -08004995 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces
Michael Lentine88594d72015-11-12 12:49:45 -08004996 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains
Jesse Halld27f6aa2015-08-15 17:58:48 -07004997}
4998
4999@internal class InstanceObject {
5000}
5001
5002@internal class PhysicalDeviceObject {
5003 VkInstance instance
5004}
5005
5006@internal class DeviceObject {
5007 VkPhysicalDevice physicalDevice
5008}
5009
5010@internal class QueueObject {
5011 VkDevice device
5012 VkQueueFlags flags
5013}
5014
Jesse Hall3fbc8562015-11-29 22:10:52 -08005015@internal class CommandBufferObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07005016 VkDevice device
5017 map!(u64, VkDeviceMemory) boundObjects
5018 VkQueueFlags queueFlags
5019}
5020
5021@internal class DeviceMemoryObject {
Jesse Hall3fbc8562015-11-29 22:10:52 -08005022 VkDevice device
5023 VkDeviceSize allocationSize
5024 map!(u64, VkDeviceSize) boundObjects
5025 map!(VkCommandBuffer, VkCommandBuffer) boundCommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07005026}
5027
5028@internal class BufferObject {
5029 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005030 VkDeviceMemory memory
5031 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005032}
5033
5034@internal class BufferViewObject {
5035 VkDevice device
5036 VkBuffer buffer
5037}
5038
5039@internal class ImageObject {
5040 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005041 VkDeviceMemory memory
5042 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005043}
5044
5045@internal class ImageViewObject {
5046 VkDevice device
5047 VkImage image
5048}
5049
Jesse Halld27f6aa2015-08-15 17:58:48 -07005050@internal class ShaderObject {
5051 VkDevice device
5052}
5053
5054@internal class ShaderModuleObject {
5055 VkDevice device
5056}
5057
5058@internal class PipelineObject {
5059 VkDevice device
5060}
5061
5062@internal class PipelineLayoutObject {
5063 VkDevice device
5064}
5065
5066@internal class SamplerObject {
5067 VkDevice device
5068}
5069
5070@internal class DescriptorSetObject {
5071 VkDevice device
5072}
5073
5074@internal class DescriptorSetLayoutObject {
5075 VkDevice device
5076}
5077
5078@internal class DescriptorPoolObject {
5079 VkDevice device
5080}
5081
Jesse Halld27f6aa2015-08-15 17:58:48 -07005082@internal class FenceObject {
5083 VkDevice device
5084 bool signaled
5085}
5086
5087@internal class SemaphoreObject {
5088 VkDevice device
5089}
5090
5091@internal class EventObject {
5092 VkDevice device
5093}
5094
5095@internal class QueryPoolObject {
5096 VkDevice device
5097}
5098
5099@internal class FramebufferObject {
5100 VkDevice device
5101}
5102
5103@internal class RenderPassObject {
5104 VkDevice device
5105}
5106
5107@internal class PipelineCacheObject {
5108 VkDevice device
5109}
5110
Jesse Hall3fbc8562015-11-29 22:10:52 -08005111@internal class CommandPoolObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07005112 VkDevice device
5113}
5114
Jesse Hall1356b0d2015-11-23 17:24:58 -08005115@internal class SurfaceObject {
5116 VkInstance instance
5117}
5118
Michael Lentine88594d72015-11-12 12:49:45 -08005119@internal class SwapchainObject {
5120 VkDevice device
5121}
5122
Jesse Halld27f6aa2015-08-15 17:58:48 -07005123macro ref!InstanceObject GetInstance(VkInstance instance) {
5124 assert(instance in State.Instances)
5125 return State.Instances[instance]
5126}
5127
5128macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
5129 assert(physicalDevice in State.PhysicalDevices)
5130 return State.PhysicalDevices[physicalDevice]
5131}
5132
5133macro ref!DeviceObject GetDevice(VkDevice device) {
5134 assert(device in State.Devices)
5135 return State.Devices[device]
5136}
5137
5138macro ref!QueueObject GetQueue(VkQueue queue) {
5139 assert(queue in State.Queues)
5140 return State.Queues[queue]
5141}
5142
Jesse Hall3fbc8562015-11-29 22:10:52 -08005143macro ref!CommandBufferObject GetCommandBuffer(VkCommandBuffer commandBuffer) {
5144 assert(commandBuffer in State.CommandBuffers)
5145 return State.CommandBuffers[commandBuffer]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005146}
5147
Jesse Hall3fbc8562015-11-29 22:10:52 -08005148macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory memory) {
5149 assert(memory in State.DeviceMemories)
5150 return State.DeviceMemories[memory]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005151}
5152
5153macro ref!BufferObject GetBuffer(VkBuffer buffer) {
5154 assert(buffer in State.Buffers)
5155 return State.Buffers[buffer]
5156}
5157
5158macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
5159 assert(bufferView in State.BufferViews)
5160 return State.BufferViews[bufferView]
5161}
5162
5163macro ref!ImageObject GetImage(VkImage image) {
5164 assert(image in State.Images)
5165 return State.Images[image]
5166}
5167
5168macro ref!ImageViewObject GetImageView(VkImageView imageView) {
5169 assert(imageView in State.ImageViews)
5170 return State.ImageViews[imageView]
5171}
5172
Jesse Halld27f6aa2015-08-15 17:58:48 -07005173macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
5174 assert(shaderModule in State.ShaderModules)
5175 return State.ShaderModules[shaderModule]
5176}
5177
5178macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
5179 assert(pipeline in State.Pipelines)
5180 return State.Pipelines[pipeline]
5181}
5182
5183macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
5184 assert(pipelineLayout in State.PipelineLayouts)
5185 return State.PipelineLayouts[pipelineLayout]
5186}
5187
5188macro ref!SamplerObject GetSampler(VkSampler sampler) {
5189 assert(sampler in State.Samplers)
5190 return State.Samplers[sampler]
5191}
5192
5193macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
5194 assert(descriptorSet in State.DescriptorSets)
5195 return State.DescriptorSets[descriptorSet]
5196}
5197
5198macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
5199 assert(descriptorSetLayout in State.DescriptorSetLayouts)
5200 return State.DescriptorSetLayouts[descriptorSetLayout]
5201}
5202
5203macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
5204 assert(descriptorPool in State.DescriptorPools)
5205 return State.DescriptorPools[descriptorPool]
5206}
5207
Jesse Halld27f6aa2015-08-15 17:58:48 -07005208macro ref!FenceObject GetFence(VkFence fence) {
5209 assert(fence in State.Fences)
5210 return State.Fences[fence]
5211}
5212
5213macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
5214 assert(semaphore in State.Semaphores)
5215 return State.Semaphores[semaphore]
5216}
5217
5218macro ref!EventObject GetEvent(VkEvent event) {
5219 assert(event in State.Events)
5220 return State.Events[event]
5221}
5222
5223macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
5224 assert(queryPool in State.QueryPools)
5225 return State.QueryPools[queryPool]
5226}
5227
5228macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
5229 assert(framebuffer in State.Framebuffers)
5230 return State.Framebuffers[framebuffer]
5231}
5232
5233macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
5234 assert(renderPass in State.RenderPasses)
5235 return State.RenderPasses[renderPass]
5236}
5237
5238macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
5239 assert(pipelineCache in State.PipelineCaches)
5240 return State.PipelineCaches[pipelineCache]
5241}
5242
Jesse Hall3fbc8562015-11-29 22:10:52 -08005243macro ref!CommandPoolObject GetCommandPool(VkCommandPool commandPool) {
5244 assert(commandPool in State.CommandPools)
5245 return State.CommandPools[commandPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07005246}
Michael Lentine88594d72015-11-12 12:49:45 -08005247
Jesse Hall1356b0d2015-11-23 17:24:58 -08005248macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) {
5249 assert(surface in State.Surfaces)
5250 return State.Surfaces[surface]
5251}
5252
Michael Lentine88594d72015-11-12 12:49:45 -08005253macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) {
5254 assert(swapchain in State.Swapchains)
5255 return State.Swapchains[swapchain]
5256}
Jesse Halld8bade02015-11-24 10:24:18 -08005257
5258macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) {
5259 return as!VkQueueFlags(as!u32(flags) | as!u32(bit))
5260}