blob: 0d561458282e9272af2161b9bfd70d47f37442c5 [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 Hallbd888842015-11-30 21:44:14 -080031define VERSION_PATCH 1
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 Hallbd888842015-11-30 21:44:14 -0800151 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002,
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 Hallbd888842015-11-30 21:44:14 -0800626 VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000,
627 VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800628
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800629 //@extension("VK_KHR_display")
Jesse Hallbd888842015-11-30 21:44:14 -0800630 VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000,
631 VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800632
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800633 //@extension("VK_KHR_display_swapchain")
Jesse Hallbd888842015-11-30 21:44:14 -0800634 VK_STRUCTURE_TYPE_DISPLAY_DISPLAY_PRESENT_INFO_KHR = 1000003000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700635}
636
Jesse Hall65ab5522015-11-30 00:07:16 -0800637enum VkSubpassContents {
638 VK_SUBPASS_CONTENTS_INLINE = 0x00000000,
639 VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700640}
641
Jesse Hallbd888842015-11-30 21:44:14 -0800642@lastUnused(-11)
Jesse Halld27f6aa2015-08-15 17:58:48 -0700643/// Error and return codes
644enum VkResult {
645 // Return codes for successful operation execution (positive values)
Jesse Hallbd888842015-11-30 21:44:14 -0800646 VK_SUCCESS = 0,
647 VK_NOT_READY = 1,
648 VK_TIMEOUT = 2,
649 VK_EVENT_SET = 3,
650 VK_EVENT_RESET = 4,
651 VK_INCOMPLETE = 5,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700652
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800653 //@extension("VK_KHR_swapchain")
Jesse Hallbd888842015-11-30 21:44:14 -0800654 VK_SUBOPTIMAL_KHR = 1000001003,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800655
Jesse Halld27f6aa2015-08-15 17:58:48 -0700656 // Error codes (negative values)
Jesse Hallbd888842015-11-30 21:44:14 -0800657 VK_ERROR_OUT_OF_HOST_MEMORY = 0xFFFFFFFF, // -1
658 VK_ERROR_OUT_OF_DEVICE_MEMORY = 0xFFFFFFFE, // -2
659 VK_ERROR_INITIALIZATION_FAILED = 0xFFFFFFFD, // -3
660 VK_ERROR_DEVICE_LOST = 0xFFFFFFFC, // -4
661 VK_ERROR_MEMORY_MAP_FAILED = 0xFFFFFFFB, // -5
662 VK_ERROR_LAYER_NOT_PRESENT = 0xFFFFFFFA, // -6
663 VK_ERROR_EXTENSION_NOT_PRESENT = 0xFFFFFFF9, // -7
664 VK_ERROR_FEATURE_NOT_PRESENT = 0xFFFFFFF8, // -8
665 VK_ERROR_INCOMPATIBLE_DRIVER = 0xFFFFFFF7, // -9
666 VK_ERROR_TOO_MANY_OBJECTS = 0xFFFFFFF6, // -10
667 VK_ERROR_FORMAT_NOT_SUPPORTED = 0xFFFFFFF5, // -11
Jesse Hall1356b0d2015-11-23 17:24:58 -0800668
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800669 //@extension("VK_KHR_surface")
Jesse Hallbd888842015-11-30 21:44:14 -0800670 VK_ERROR_SURFACE_LOST_KHR = 0xC4653600, // -1000000000
Jesse Halla6429252015-11-29 18:59:42 -0800671
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800672 //@extension("VK_KHR_swapchain")
Jesse Hallbd888842015-11-30 21:44:14 -0800673 VK_ERROR_OUT_OF_DATE_KHR = 0xC4653214, // -1000001004
Jesse Hall1356b0d2015-11-23 17:24:58 -0800674
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800675 //@extension("VK_KHR_display_swapchain")
Jesse Hallbd888842015-11-30 21:44:14 -0800676 VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = 0xC4652A47, // -1000003001
Jesse Hall1356b0d2015-11-23 17:24:58 -0800677
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800678 //@extension("VK_KHR_android_surface")
Jesse Hallbd888842015-11-30 21:44:14 -0800679 VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = 0xC46516C0, // -1000008000
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700680}
681
682enum VkDynamicState {
683 VK_DYNAMIC_STATE_VIEWPORT = 0x00000000,
684 VK_DYNAMIC_STATE_SCISSOR = 0x00000001,
685 VK_DYNAMIC_STATE_LINE_WIDTH = 0x00000002,
686 VK_DYNAMIC_STATE_DEPTH_BIAS = 0x00000003,
687 VK_DYNAMIC_STATE_BLEND_CONSTANTS = 0x00000004,
688 VK_DYNAMIC_STATE_DEPTH_BOUNDS = 0x00000005,
689 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 0x00000006,
690 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 0x00000007,
691 VK_DYNAMIC_STATE_STENCIL_REFERENCE = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700692}
693
Jesse Hall523db342015-11-30 21:12:55 -0800694@extension("VK_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -0800695enum VkPresentModeKHR {
696 VK_PRESENT_MODE_IMMEDIATE_KHR = 0x00000000,
697 VK_PRESENT_MODE_MAILBOX_KHR = 0x00000001,
698 VK_PRESENT_MODE_FIFO_KHR = 0x00000002,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800699 VK_PRESENT_MODE_FIFO_RELAXED_KHR = 0x00000003,
Michael Lentine88594d72015-11-12 12:49:45 -0800700}
701
Jesse Hall523db342015-11-30 21:12:55 -0800702@extension("VK_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -0800703enum VkColorSpaceKHR {
704 VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000,
705}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700706
707/////////////////
708// Bitfields //
709/////////////////
710
Jesse Halld27f6aa2015-08-15 17:58:48 -0700711/// Queue capabilities
Jesse Halld8bade02015-11-24 10:24:18 -0800712type VkFlags VkQueueFlags
713bitfield VkQueueFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700714 VK_QUEUE_GRAPHICS_BIT = 0x00000001, /// Queue supports graphics operations
715 VK_QUEUE_COMPUTE_BIT = 0x00000002, /// Queue supports compute operations
Jesse Hall65ab5522015-11-30 00:07:16 -0800716 VK_QUEUE_TRANSFER_BIT = 0x00000004, /// Queue supports transfer operations
Jesse Hallb00daad2015-11-29 19:46:20 -0800717 VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, /// Queue supports sparse resource memory management operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700718}
719
720/// Memory properties passed into vkAllocMemory().
Jesse Halld8bade02015-11-24 10:24:18 -0800721type VkFlags VkMemoryPropertyFlags
722bitfield VkMemoryPropertyFlagBits {
Jesse Halld1af8122015-11-29 23:50:38 -0800723 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001,
724 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002,
725 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004,
726 VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008,
727 VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700728}
729
730/// Memory heap flags
Jesse Halld8bade02015-11-24 10:24:18 -0800731type VkFlags VkMemoryHeapFlags
732bitfield VkMemoryHeapFlagBits {
Jesse Halld1af8122015-11-29 23:50:38 -0800733 VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700734}
735
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800736/// Access flags
737type VkFlags VkAccessFlags
738bitfield VkAccessFlagBits {
739 VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001,
740 VK_ACCESS_INDEX_READ_BIT = 0x00000002,
741 VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004,
742 VK_ACCESS_UNIFORM_READ_BIT = 0x00000008,
743 VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010,
744 VK_ACCESS_SHADER_READ_BIT = 0x00000020,
745 VK_ACCESS_SHADER_WRITE_BIT = 0x00000040,
746 VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080,
747 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100,
748 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200,
749 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400,
750 VK_ACCESS_TRANSFER_READ_BIT = 0x00000800,
751 VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000,
752 VK_ACCESS_HOST_READ_BIT = 0x00002000,
753 VK_ACCESS_HOST_WRITE_BIT = 0x00004000,
754 VK_ACCESS_MEMORY_READ_BIT = 0x00008000,
755 VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700756}
757
758/// Buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800759type VkFlags VkBufferUsageFlags
760bitfield VkBufferUsageFlagBits {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800761 VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations
762 VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700763 VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, /// Can be used as TBO
764 VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, /// Can be used as IBO
765 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, /// Can be used as UBO
766 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, /// Can be used as SSBO
767 VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, /// Can be used as source of fixed function index fetch (index buffer)
768 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, /// Can be used as source of fixed function vertex fetch (VBO)
769 VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, /// Can be the source of indirect parameters (e.g. indirect buffer, parameter buffer)
770}
771
772/// Buffer creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800773type VkFlags VkBufferCreateFlags
774bitfield VkBufferCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700775 VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Buffer should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700776 VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Buffer should support sparse backing with partial residency
777 VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Buffer should support constent data access to physical memory blocks mapped into multiple locations of sparse buffers
778}
779
780/// Shader stage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800781type VkFlags VkShaderStageFlags
782bitfield VkShaderStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700783 VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
Jesse Hallae38f732015-11-19 21:32:50 -0800784 VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
785 VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700786 VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
787 VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
788 VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
Jesse Hallc7467b72015-11-29 21:05:26 -0800789 VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700790
791 VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
792}
793
Jesse Hallfbf97b02015-11-20 14:17:03 -0800794/// Descriptor pool create flags
Jesse Halld8bade02015-11-24 10:24:18 -0800795type VkFlags VkDescriptorPoolCreateFlags
796bitfield VkDescriptorPoolCreateFlagBits {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800797 VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
798}
799
800/// Descriptor pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -0800801type VkFlags VkDescriptorPoolResetFlags
Jesse Halla6429252015-11-29 18:59:42 -0800802//bitfield VkDescriptorPoolResetFlagBits {
803//}
Jesse Hallfbf97b02015-11-20 14:17:03 -0800804
Jesse Halld27f6aa2015-08-15 17:58:48 -0700805/// Image usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800806type VkFlags VkImageUsageFlags
807bitfield VkImageUsageFlagBits {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800808 VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations
809 VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700810 VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, /// Can be sampled from (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
811 VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, /// Can be used as storage image (STORAGE_IMAGE descriptor type)
812 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, /// Can be used as framebuffer color attachment
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700813 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment
Jesse Halld27f6aa2015-08-15 17:58:48 -0700814 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering
815 VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment
816}
817
818/// Image creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800819type VkFlags VkImageCreateFlags
820bitfield VkImageCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700821 VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Image should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700822 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Image should support sparse backing with partial residency
823 VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Image should support constent data access to physical memory blocks mapped into multiple locations of sparse images
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700824 VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, /// Allows image views to have different format than the base image
825 VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, /// Allows creating image views with cube type from the created image
Jesse Halld27f6aa2015-08-15 17:58:48 -0700826}
827
Jesse Hallb00daad2015-11-29 19:46:20 -0800828/// Image view creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800829type VkFlags VkImageViewCreateFlags
Jesse Hallb00daad2015-11-29 19:46:20 -0800830//bitfield VkImageViewCreateFlagBits {
831//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700832
833/// Pipeline creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800834type VkFlags VkPipelineCreateFlags
835bitfield VkPipelineCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700836 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
837 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
838 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
839}
840
Jesse Hall65ab5522015-11-30 00:07:16 -0800841/// Color component flags
842type VkFlags VkColorComponentFlags
843bitfield VkColorComponentFlagBits {
844 VK_COLOR_COMPONENT_R_BIT = 0x00000001,
845 VK_COLOR_COMPONENT_G_BIT = 0x00000002,
846 VK_COLOR_COMPONENT_B_BIT = 0x00000004,
847 VK_COLOR_COMPONENT_A_BIT = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700848}
849
850/// Fence creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800851type VkFlags VkFenceCreateFlags
852bitfield VkFenceCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700853 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
854}
855
856/// Semaphore creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800857type VkFlags VkSemaphoreCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800858//bitfield VkSemaphoreCreateFlagBits {
859//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700860
861/// Format capability flags
Jesse Halld8bade02015-11-24 10:24:18 -0800862type VkFlags VkFormatFeatureFlags
863bitfield VkFormatFeatureFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700864 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
865 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type)
866 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images
867 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs)
868 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs)
869 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers
870 VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs)
871 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images
872 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images
873 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images
Jesse Hall3fbc8562015-11-29 22:10:52 -0800874 VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCommandBlitImage
875 VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, /// Format can be used as the destination image of blits with vkCommandBlitImage
Jesse Halld27f6aa2015-08-15 17:58:48 -0700876}
877
878/// Query control flags
Jesse Halld8bade02015-11-24 10:24:18 -0800879type VkFlags VkQueryControlFlags
880bitfield VkQueryControlFlagBits {
Jesse Hall65ab5522015-11-30 00:07:16 -0800881 VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700882}
883
884/// Query result flags
Jesse Halld8bade02015-11-24 10:24:18 -0800885type VkFlags VkQueryResultFlags
886bitfield VkQueryResultFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700887 VK_QUERY_RESULT_DEFAULT = 0x00000000, /// Results of the queries are immediately written to the destination buffer as 32-bit values
888 VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values
889 VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy
890 VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written
891 VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available
892}
893
894/// Shader module creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800895type VkFlags VkShaderModuleCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800896//bitfield VkShaderModuleCreateFlagBits {
897//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700898
Jesse Halld27f6aa2015-08-15 17:58:48 -0700899/// Event creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800900type VkFlags VkEventCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800901//bitfield VkEventCreateFlagBits {
902//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700903
Jesse Halla15a4bf2015-11-19 22:48:02 -0800904/// Command buffer usage flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800905type VkFlags VkCommandBufferUsageFlags
906bitfield VkCommandBufferUsageFlagBits {
907 VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
908 VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
909 VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700910}
911
912/// Pipeline statistics flags
Jesse Halld8bade02015-11-24 10:24:18 -0800913type VkFlags VkQueryPipelineStatisticFlags
914bitfield VkQueryPipelineStatisticFlagBits {
Jesse Hallae38f732015-11-19 21:32:50 -0800915 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, /// Optional
916 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, /// Optional
917 VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, /// Optional
918 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, /// Optional
919 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, /// Optional
920 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, /// Optional
921 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, /// Optional
922 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, /// Optional
923 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, /// Optional
924 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, /// Optional
925 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, /// Optional
Jesse Halld27f6aa2015-08-15 17:58:48 -0700926}
927
928/// Memory mapping flags
Jesse Halld8bade02015-11-24 10:24:18 -0800929type VkFlags VkMemoryMapFlags
Jesse Halla6429252015-11-29 18:59:42 -0800930//bitfield VkMemoryMapFlagBits {
931//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700932
933/// Bitfield of image aspects
Jesse Halld8bade02015-11-24 10:24:18 -0800934type VkFlags VkImageAspectFlags
935bitfield VkImageAspectFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700936 VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
937 VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
938 VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
939 VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
940}
941
942/// Sparse memory bind flags
Jesse Halld8bade02015-11-24 10:24:18 -0800943type VkFlags VkSparseMemoryBindFlags
Jesse Hall091ed9e2015-11-30 00:55:29 -0800944bitfield VkSparseMemoryBindFlagBits {
945 VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001,
946}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700947
948/// Sparse image memory requirements flags
Jesse Halld8bade02015-11-24 10:24:18 -0800949type VkFlags VkSparseImageFormatFlags
950bitfield VkSparseImageFormatFlagBits {
Jesse Hallb00daad2015-11-29 19:46:20 -0800951 VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices
952 VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002, /// Image requires mip levels to be an exact multiple of the sparse iamge block size for non-mip-tail levels.
953 VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size
Jesse Halld27f6aa2015-08-15 17:58:48 -0700954}
955
956/// Pipeline stages
Jesse Halld8bade02015-11-24 10:24:18 -0800957type VkFlags VkPipelineStageFlags
958bitfield VkPipelineStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700959 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed
960 VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch
961 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch
962 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading
Jesse Hallae38f732015-11-19 21:32:50 -0800963 VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading
964 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading
Jesse Halld27f6aa2015-08-15 17:58:48 -0700965 VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading
966 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading
967 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests
968 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests
969 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes
970 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading
971 VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700972 VK_PIPELINE_STAGE_HOST_BIT = 0x00002000, /// Indicates host (CPU) is a source/sink of the dependency
Jesse Halld27f6aa2015-08-15 17:58:48 -0700973
Jesse Hall091ed9e2015-11-30 00:55:29 -0800974 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00004000, /// All stages of the graphics pipeline
975 VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00008000, /// All graphics, compute, copy, and transition commands
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700976}
977
978/// Render pass attachment description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800979type VkFlags VkAttachmentDescriptionFlags
980bitfield VkAttachmentDescriptionFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700981 VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001, /// The attachment may alias physical memory of another attachment in the same renderpass
Jesse Halld27f6aa2015-08-15 17:58:48 -0700982}
983
984/// Subpass description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800985type VkFlags VkSubpassDescriptionFlags
986bitfield VkSubpassDescriptionFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700987}
988
989/// Command pool creation flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800990type VkFlags VkCommandPoolCreateFlags
991bitfield VkCommandPoolCreateFlagBits {
992 VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime
993 VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually
Jesse Halld27f6aa2015-08-15 17:58:48 -0700994}
995
996/// Command pool reset flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800997type VkFlags VkCommandPoolResetFlags
998bitfield VkCommandPoolResetFlagBits {
999 VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool
Jesse Halld27f6aa2015-08-15 17:58:48 -07001000}
1001
Jesse Hall3fbc8562015-11-29 22:10:52 -08001002type VkFlags VkCommandBufferResetFlags
1003bitfield VkCommandBufferResetFlagBits {
1004 VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001005}
1006
Jesse Halld8bade02015-11-24 10:24:18 -08001007type VkFlags VkSampleCountFlags
1008bitfield VkSampleCountFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001009 VK_SAMPLE_COUNT_1_BIT = 0x00000001,
1010 VK_SAMPLE_COUNT_2_BIT = 0x00000002,
1011 VK_SAMPLE_COUNT_4_BIT = 0x00000004,
1012 VK_SAMPLE_COUNT_8_BIT = 0x00000008,
1013 VK_SAMPLE_COUNT_16_BIT = 0x00000010,
1014 VK_SAMPLE_COUNT_32_BIT = 0x00000020,
1015 VK_SAMPLE_COUNT_64_BIT = 0x00000040,
1016}
1017
Jesse Halld8bade02015-11-24 10:24:18 -08001018type VkFlags VkStencilFaceFlags
1019bitfield VkStencilFaceFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001020 VK_STENCIL_FACE_NONE = 0x00000000, /// No faces
1021 VK_STENCIL_FACE_FRONT_BIT = 0x00000001, /// Front face
1022 VK_STENCIL_FACE_BACK_BIT = 0x00000002, /// Back face
Jesse Hallc7467b72015-11-29 21:05:26 -08001023 VK_STENCIL_FRONT_AND_BACK = 0x00000003,
Jesse Halld27f6aa2015-08-15 17:58:48 -07001024}
1025
Jesse Halla6429252015-11-29 18:59:42 -08001026/// Instance creation flags
1027type VkFlags VkInstanceCreateFlags
1028//bitfield VkInstanceCreateFlagBits {
1029//}
1030
1031/// Device creation flags
1032type VkFlags VkDeviceCreateFlags
1033//bitfield VkDeviceCreateFlagBits {
1034//}
1035
1036/// Device queue creation flags
1037type VkFlags VkDeviceQueueCreateFlags
1038//bitfield VkDeviceQueueCreateFlagBits {
1039//}
1040
1041/// Query pool creation flags
1042type VkFlags VkQueryPoolCreateFlags
1043//bitfield VkQueryPoolCreateFlagBits {
1044//}
1045
1046/// Buffer view creation flags
1047type VkFlags VkBufferViewCreateFlags
1048//bitfield VkBufferViewCreateFlagBits {
1049//}
1050
1051/// Pipeline cache creation flags
1052type VkFlags VkPipelineCacheCreateFlags
1053//bitfield VkPipelineCacheCreateFlagBits {
1054//}
1055
1056/// Pipeline shader stage creation flags
1057type VkFlags VkPipelineShaderStageCreateFlags
1058//bitfield VkPipelineShaderStageCreateFlagBits {
1059//}
1060
1061/// Descriptor set layout creation flags
1062type VkFlags VkDescriptorSetLayoutCreateFlags
1063//bitfield VkDescriptorSetLayoutCreateFlagBits {
1064//}
1065
1066/// Pipeline vertex input state creation flags
1067type VkFlags VkPipelineVertexInputStateCreateFlags
1068//bitfield VkPipelineVertexInputStateCreateFlagBits {
1069//}
1070
1071/// Pipeline input assembly state creation flags
1072type VkFlags VkPipelineInputAssemblyStateCreateFlags
1073//bitfield VkPipelineInputAssemblyStateCreateFlagBits {
1074//}
1075
1076/// Tessellation state creation flags
1077type VkFlags VkPipelineTessellationStateCreateFlags
1078//bitfield VkPipelineTessellationStateCreateFlagBits {
1079//}
1080
1081/// Viewport state creation flags
1082type VkFlags VkPipelineViewportStateCreateFlags
1083//bitfield VkPipelineViewportStateCreateFlagBits {
1084//}
1085
Jesse Hall3fbc8562015-11-29 22:10:52 -08001086/// Rasterization state creation flags
1087type VkFlags VkPipelineRasterizationStateCreateFlags
1088//bitfield VkPipelineRasterizationStateCreateFlagBits {
Jesse Halla6429252015-11-29 18:59:42 -08001089//}
1090
1091/// Multisample state creation flags
1092type VkFlags VkPipelineMultisampleStateCreateFlags
1093//bitfield VkPipelineMultisampleStateCreateFlagBits {
1094//}
1095
1096/// Color blend state creation flags
1097type VkFlags VkPipelineColorBlendStateCreateFlags
1098//bitfield VkPipelineColorBlendStateCreateFlagBits {
1099//}
1100
1101/// Depth/stencil state creation flags
1102type VkFlags VkPipelineDepthStencilStateCreateFlags
1103//bitfield VkPipelineDepthStencilStateCreateFlagBits {
1104//}
1105
1106/// Dynamic state creation flags
1107type VkFlags VkPipelineDynamicStateCreateFlags
1108//bitfield VkPipelineDynamicStateCreateFlagBits {
1109//}
1110
1111/// Pipeline layout creation flags
1112type VkFlags VkPipelineLayoutCreateFlags
1113//bitfield VkPipelineLayoutCreateFlagBits {
1114//}
1115
1116/// Sampler creation flags
1117type VkFlags VkSamplerCreateFlags
1118//bitfield VkSamplerCreateFlagBits {
1119//}
1120
1121/// Render pass creation flags
1122type VkFlags VkRenderPassCreateFlags
1123//bitfield VkRenderPassCreateFlagBits {
1124//}
1125
1126/// Framebuffer creation flags
1127type VkFlags VkFramebufferCreateFlags
1128//bitfield VkFramebufferCreateFlagBits {
1129//}
1130
Jesse Halldc6d36c2015-11-29 19:12:15 -08001131/// Dependency flags
1132type VkFlags VkDependencyFlags
1133bitfield VkDependencyFlagBits {
1134 VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
1135}
1136
Jesse Hallc7467b72015-11-29 21:05:26 -08001137/// Cull mode flags
1138type VkFlags VkCullModeFlags
1139bitfield VkCullModeFlagBits {
1140 VK_CULL_MODE_NONE = 0x00000000,
1141 VK_CULL_MODE_FRONT_BIT = 0x00000001,
1142 VK_CULL_MODE_BACK_BIT = 0x00000002,
1143 VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
1144}
1145
Jesse Hall523db342015-11-30 21:12:55 -08001146@extension("VK_KHR_surface")
Jesse Halld8bade02015-11-24 10:24:18 -08001147type VkFlags VkSurfaceTransformFlagsKHR
Jesse Hall523db342015-11-30 21:12:55 -08001148@extension("VK_KHR_surface")
Jesse Halld8bade02015-11-24 10:24:18 -08001149bitfield VkSurfaceTransformFlagBitsKHR {
Jesse Hall9ba8bc82015-11-30 16:22:16 -08001150 VK_SURFACE_TRANSFORM_NONE_BIT_KHR = 0x00000001,
1151 VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 0x00000002,
1152 VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 0x00000004,
1153 VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 0x00000008,
1154 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 0x00000010,
1155 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 0x00000020,
1156 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040,
1157 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080,
1158 VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
Michael Lentine88594d72015-11-12 12:49:45 -08001159}
Jesse Halld27f6aa2015-08-15 17:58:48 -07001160
Jesse Hall523db342015-11-30 21:12:55 -08001161@extension("VK_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08001162type VkFlags VkCompositeAlphaFlagsKHR
Jesse Hall523db342015-11-30 21:12:55 -08001163@extension("VK_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08001164bitfield VkCompositeAlphaFlagBitsKHR {
1165 VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
1166 VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
1167 VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
1168 VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
1169}
1170
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001171@extension("VK_KHR_swapchain")
1172type VkFlags VkSwapchainCreateFlagsKHR
1173//@extension("VK_KHR_swapchain")
1174//bitfield VkSwapchainCreateFlagBitsKHR {
1175//}
1176
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001177@extension("VK_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001178type VkFlags VkDisplayPlaneAlphaFlagsKHR
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001179@extension("VK_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001180bitfield VkDisplayPlaneAlphaFlagBitsKHR {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001181 VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
1182 VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002,
1183 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004,
1184 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008,
Jesse Hall1356b0d2015-11-23 17:24:58 -08001185}
1186
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001187@extension("VK_KHR_display")
1188type VkFlags VkDisplaySurfaceCreateFlagsKHR
1189//@extension("VK_KHR_display")
1190//bitfield VkDisplaySurfaceCreateFlagBitsKHR {
1191//}
1192
Jesse Hall9ba8bc82015-11-30 16:22:16 -08001193@extension("VK_KHR_display")
1194type VkFlags VkDisplayModeCreateFlagsKHR
1195//@extension("VK_KHR_display")
1196//bitfield VkDisplayModeCreateFlagBitsKHR {
1197//}
1198
Jesse Hall1356b0d2015-11-23 17:24:58 -08001199
Jesse Halld27f6aa2015-08-15 17:58:48 -07001200//////////////////
1201// Structures //
1202//////////////////
1203
1204class VkOffset2D {
1205 s32 x
1206 s32 y
1207}
1208
1209class VkOffset3D {
1210 s32 x
1211 s32 y
1212 s32 z
1213}
1214
1215class VkExtent2D {
1216 s32 width
1217 s32 height
1218}
1219
1220class VkExtent3D {
1221 s32 width
1222 s32 height
1223 s32 depth
1224}
1225
1226class VkViewport {
Jesse Hall65ab5522015-11-30 00:07:16 -08001227 f32 x
1228 f32 y
Jesse Halld27f6aa2015-08-15 17:58:48 -07001229 f32 width
1230 f32 height
1231 f32 minDepth
1232 f32 maxDepth
1233}
1234
1235class VkRect2D {
1236 VkOffset2D offset
1237 VkExtent2D extent
1238}
1239
Jesse Halla15a4bf2015-11-19 22:48:02 -08001240class VkClearRect {
1241 VkRect2D rect
1242 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001243 u32 layerCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001244}
1245
Jesse Hall65ab5522015-11-30 00:07:16 -08001246class VkComponentMapping {
1247 VkComponentSwizzle r
1248 VkComponentSwizzle g
1249 VkComponentSwizzle b
1250 VkComponentSwizzle a
Jesse Halld27f6aa2015-08-15 17:58:48 -07001251}
1252
1253class VkPhysicalDeviceProperties {
1254 u32 apiVersion
1255 u32 driverVersion
Jesse Hall65ab5522015-11-30 00:07:16 -08001256 u32 vendorID
1257 u32 deviceID
Jesse Halld27f6aa2015-08-15 17:58:48 -07001258 VkPhysicalDeviceType deviceType
Jesse Hall65ab5522015-11-30 00:07:16 -08001259 char[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE] deviceName
1260 u8[VK_UUID_SIZE] pipelineCacheUUID
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001261 VkPhysicalDeviceLimits limits
1262 VkPhysicalDeviceSparseProperties sparseProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001263}
1264
1265class VkExtensionProperties {
Jesse Hall65ab5522015-11-30 00:07:16 -08001266 char[VK_MAX_EXTENSION_NAME_SIZE] extensionName /// extension name
Jesse Halld27f6aa2015-08-15 17:58:48 -07001267 u32 specVersion /// version of the extension specification implemented
1268}
1269
1270class VkLayerProperties {
Jesse Hall65ab5522015-11-30 00:07:16 -08001271 char[VK_MAX_EXTENSION_NAME_SIZE] layerName /// layer name
Jesse Hall3fbc8562015-11-29 22:10:52 -08001272 u32 specVersion /// version of the layer specification implemented
1273 u32 implementationVersion /// build or release version of the layer's library
Jesse Hall65ab5522015-11-30 00:07:16 -08001274 char[VK_MAX_DESCRIPTION_SIZE] description /// Free-form description of the layer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001275}
1276
Jesse Halla366a512015-11-19 22:30:07 -08001277class VkSubmitInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001278 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_SUBMIT_INFO
1279 const void* pNext /// Next structure in chain
1280 u32 waitSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001281 const VkSemaphore* pWaitSemaphores
Jesse Hall03b6fe12015-11-24 12:44:21 -08001282 u32 commandBufferCount
Jesse Hall3fbc8562015-11-29 22:10:52 -08001283 const VkCommandBuffer* pCommandBuffers
Jesse Hall03b6fe12015-11-24 12:44:21 -08001284 u32 signalSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001285 const VkSemaphore* pSignalSemaphores
1286}
1287
Jesse Halld27f6aa2015-08-15 17:58:48 -07001288class VkApplicationInfo {
1289 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO
1290 const void* pNext /// Next structure in chain
Jesse Hall3fbc8562015-11-29 22:10:52 -08001291 const char* pApplicationName
1292 u32 applicationVersion
Jesse Halld27f6aa2015-08-15 17:58:48 -07001293 const char* pEngineName
1294 u32 engineVersion
1295 u32 apiVersion
1296}
1297
Jesse Hall3fbc8562015-11-29 22:10:52 -08001298class VkAllocationCallbacks {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001299 void* pUserData
Jesse Hall3fbc8562015-11-29 22:10:52 -08001300 PFN_vkAllocationFunction pfnAllocation
1301 PFN_vkReallocationFunction pfnReallocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001302 PFN_vkFreeFunction pfnFree
Jesse Hall3fbc8562015-11-29 22:10:52 -08001303 PFN_vkInternalAllocationNotification pfnInternalAllocation
Jesse Hall03b6fe12015-11-24 12:44:21 -08001304 PFN_vkInternalFreeNotification pfnInternalFree
Jesse Halld27f6aa2015-08-15 17:58:48 -07001305}
1306
1307class VkDeviceQueueCreateInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001308 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
1309 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001310 VkDeviceQueueCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001311 u32 queueFamilyIndex
Jesse Halldba27f72015-11-30 14:25:46 -08001312 u32 queueCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001313 const f32* pQueuePriorities
Jesse Halld27f6aa2015-08-15 17:58:48 -07001314}
1315
1316class VkDeviceCreateInfo {
1317 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
1318 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001319 VkDeviceCreateFlags flags
Jesse Halldba27f72015-11-30 14:25:46 -08001320 u32 queueCreateInfoCount
1321 const VkDeviceQueueCreateInfo* pQueueCreateInfos
Jesse Hall03b6fe12015-11-24 12:44:21 -08001322 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001323 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001324 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001325 const char* const* ppEnabledExtensionNames
1326 const VkPhysicalDeviceFeatures* pEnabledFeatures
Jesse Halld27f6aa2015-08-15 17:58:48 -07001327}
1328
1329class VkInstanceCreateInfo {
1330 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
1331 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001332 VkInstanceCreateFlags flags
Jesse Hall3fbc8562015-11-29 22:10:52 -08001333 const VkApplicationInfo* pApplicationInfo
Jesse Hall03b6fe12015-11-24 12:44:21 -08001334 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001335 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001336 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001337 const char* const* ppEnabledExtensionNames /// Extension names to be enabled
1338}
1339
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001340class VkQueueFamilyProperties {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001341 VkQueueFlags queueFlags /// Queue flags
1342 u32 queueCount
Jesse Hallacfa5342015-11-19 21:51:33 -08001343 u32 timestampValidBits
Jesse Hall65ab5522015-11-30 00:07:16 -08001344 VkExtent3D minImageTransferGranularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07001345}
1346
1347class VkPhysicalDeviceMemoryProperties {
1348 u32 memoryTypeCount
1349 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes
1350 u32 memoryHeapCount
1351 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps
1352}
1353
Jesse Hall3fbc8562015-11-29 22:10:52 -08001354class VkMemoryAllocateInfo {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001355 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001356 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001357 VkDeviceSize allocationSize /// Size of memory allocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001358 u32 memoryTypeIndex /// Index of the of the memory type to allocate from
1359}
1360
1361class VkMemoryRequirements {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001362 VkDeviceSize size /// Specified in bytes
1363 VkDeviceSize alignment /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001364 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object
1365}
1366
1367class VkSparseImageFormatProperties {
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001368 VkImageAspectFlagBits aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001369 VkExtent3D imageGranularity
1370 VkSparseImageFormatFlags flags
1371}
1372
1373class VkSparseImageMemoryRequirements {
Jesse Hallb00daad2015-11-29 19:46:20 -08001374 VkSparseImageFormatProperties formatProperties
Jesse Hall65ab5522015-11-30 00:07:16 -08001375 u32 imageMipTailStartLod
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001376 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment
1377 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment
1378 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07001379}
1380
1381class VkMemoryType {
1382 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type
1383 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from
1384}
1385
1386class VkMemoryHeap {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001387 VkDeviceSize size /// Available memory in the heap
Jesse Halld27f6aa2015-08-15 17:58:48 -07001388 VkMemoryHeapFlags flags /// Flags for the heap
1389}
1390
1391class VkMappedMemoryRange {
1392 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
1393 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001394 VkDeviceMemory memory /// Mapped memory object
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001395 VkDeviceSize offset /// Offset within the mapped memory the range starts from
1396 VkDeviceSize size /// Size of the range within the mapped memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07001397}
1398
1399class VkFormatProperties {
1400 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling
1401 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001402 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001403}
1404
1405class VkImageFormatProperties {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001406 VkExtent3D maxExtent /// max image dimensions for this resource type
1407 u32 maxMipLevels /// max number of mipmap levels for this resource type
Jesse Halla15a4bf2015-11-19 22:48:02 -08001408 u32 maxArrayLayers /// max array layers for this resource type
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001409 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type
1410 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type
1411}
1412
Jesse Halla15a4bf2015-11-19 22:48:02 -08001413class VkDescriptorImageInfo {
1414 VkSampler sampler
1415 VkImageView imageView
1416 VkImageLayout imageLayout
1417}
1418
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001419class VkDescriptorBufferInfo {
1420 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC]
1421 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set.
1422 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001423}
1424
Jesse Halld27f6aa2015-08-15 17:58:48 -07001425class VkWriteDescriptorSet {
1426 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
1427 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001428 VkDescriptorSet dstSet /// Destination descriptor set
1429 u32 dstBinding /// Binding within the destination descriptor set to write
1430 u32 dstArrayElement /// Array element within the destination binding to write
Jesse Hall03b6fe12015-11-24 12:44:21 -08001431 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001432 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 -08001433 const VkDescriptorImageInfo* pImageInfo
1434 const VkDescriptorBufferInfo* pBufferInfo
1435 const VkBufferView* pTexelBufferView
Jesse Halld27f6aa2015-08-15 17:58:48 -07001436}
1437
1438class VkCopyDescriptorSet {
1439 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
1440 const void* pNext /// Pointer to next structure
1441 VkDescriptorSet srcSet /// Source descriptor set
1442 u32 srcBinding /// Binding within the source descriptor set to copy from
1443 u32 srcArrayElement /// Array element within the source binding to copy from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001444 VkDescriptorSet dstSet /// Destination descriptor set
1445 u32 dstBinding /// Binding within the destination descriptor set to copy to
1446 u32 dstArrayElement /// Array element within the destination binding to copy to
Jesse Hall03b6fe12015-11-24 12:44:21 -08001447 u32 descriptorCount /// Number of descriptors to copy
Jesse Halld27f6aa2015-08-15 17:58:48 -07001448}
1449
1450class VkBufferCreateInfo {
1451 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
1452 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001453 VkBufferCreateFlags flags /// Buffer creation flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001454 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001455 VkBufferUsageFlags usage /// Buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001456 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001457 u32 queueFamilyIndexCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001458 const u32* pQueueFamilyIndices
1459}
1460
1461class VkBufferViewCreateInfo {
1462 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
1463 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001464 VkBufferViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001465 VkBuffer buffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001466 VkFormat format /// Optionally specifies format of elements
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001467 VkDeviceSize offset /// Specified in bytes
1468 VkDeviceSize range /// View size specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001469}
1470
1471class VkImageSubresource {
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001472 VkImageAspectFlagBits aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001473 u32 mipLevel
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001474 u32 arrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001475}
1476
1477class VkImageSubresourceRange {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001478 VkImageAspectFlags aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001479 u32 baseMipLevel
Jesse Hall3fbc8562015-11-29 22:10:52 -08001480 u32 levelCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001481 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001482 u32 layerCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001483}
1484
1485class VkMemoryBarrier {
1486 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER
1487 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001488 VkAccessFlags srcAccessMask
1489 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001490}
1491
1492class VkBufferMemoryBarrier {
1493 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
1494 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001495 VkAccessFlags srcAccessMask
1496 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001497 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001498 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001499 VkBuffer buffer /// Buffer to sync
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001500 VkDeviceSize offset /// Offset within the buffer to sync
1501 VkDeviceSize size /// Amount of bytes to sync
Jesse Halld27f6aa2015-08-15 17:58:48 -07001502}
1503
1504class VkImageMemoryBarrier {
1505 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
1506 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001507 VkAccessFlags srcAccessMask
1508 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001509 VkImageLayout oldLayout /// Current layout of the image
1510 VkImageLayout newLayout /// New layout to transition the image to
1511 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001512 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001513 VkImage image /// Image to sync
1514 VkImageSubresourceRange subresourceRange /// Subresource range to sync
1515}
1516
1517class VkImageCreateInfo {
1518 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
1519 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001520 VkImageCreateFlags flags /// Image creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001521 VkImageType imageType
1522 VkFormat format
1523 VkExtent3D extent
1524 u32 mipLevels
Jesse Halla15a4bf2015-11-19 22:48:02 -08001525 u32 arrayLayers
Jesse Hall091ed9e2015-11-30 00:55:29 -08001526 VkSampleCountFlagBits samples
Jesse Halld27f6aa2015-08-15 17:58:48 -07001527 VkImageTiling tiling
1528 VkImageUsageFlags usage /// Image usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001529 VkSharingMode sharingMode /// Cross-queue-family sharing mode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001530 u32 queueFamilyIndexCount /// Number of queue families to share across
Jesse Halld27f6aa2015-08-15 17:58:48 -07001531 const u32* pQueueFamilyIndices /// Array of queue family indices to share across
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001532 VkImageLayout initialLayout /// Initial image layout for all subresources
Jesse Halld27f6aa2015-08-15 17:58:48 -07001533}
1534
1535class VkSubresourceLayout {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001536 VkDeviceSize offset /// Specified in bytes
1537 VkDeviceSize size /// Specified in bytes
1538 VkDeviceSize rowPitch /// Specified in bytes
1539 VkDeviceSize depthPitch /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001540}
1541
1542class VkImageViewCreateInfo {
1543 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
1544 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001545 VkImageViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001546 VkImage image
1547 VkImageViewType viewType
1548 VkFormat format
Jesse Hall65ab5522015-11-30 00:07:16 -08001549 VkComponentMapping components
Jesse Halld27f6aa2015-08-15 17:58:48 -07001550 VkImageSubresourceRange subresourceRange
Jesse Halld27f6aa2015-08-15 17:58:48 -07001551}
1552
1553class VkBufferCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001554 VkDeviceSize srcOffset /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001555 VkDeviceSize dstOffset /// Specified in bytes
Jesse Hallb00daad2015-11-29 19:46:20 -08001556 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001557}
1558
Jesse Halla6429252015-11-29 18:59:42 -08001559class VkSparseMemoryBind {
Jesse Hallb00daad2015-11-29 19:46:20 -08001560 VkDeviceSize resourceOffset /// Specified in bytes
1561 VkDeviceSize size /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001562 VkDeviceMemory memory
1563 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001564 VkSparseMemoryBindFlags flags
1565}
1566
Jesse Halla6429252015-11-29 18:59:42 -08001567class VkSparseImageMemoryBind {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001568 VkImageSubresource subresource
1569 VkOffset3D offset
1570 VkExtent3D extent
Jesse Hall3fbc8562015-11-29 22:10:52 -08001571 VkDeviceMemory memory
1572 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001573 VkSparseMemoryBindFlags flags
1574}
1575
Jesse Halla6429252015-11-29 18:59:42 -08001576class VkSparseBufferMemoryBindInfo {
1577 VkBuffer buffer
1578 u32 bindCount
1579 const VkSparseMemoryBind* pBinds
1580}
1581
1582class VkSparseImageOpaqueMemoryBindInfo {
1583 VkImage image
1584 u32 bindCount
1585 const VkSparseMemoryBind* pBinds
1586}
1587
1588class VkSparseImageMemoryBindInfo {
1589 VkImage image
1590 u32 bindCount
1591 const VkSparseMemoryBind* pBinds
1592}
1593
1594class VkBindSparseInfo {
1595 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
1596 const void* pNext
1597 u32 waitSemaphoreCount
1598 const VkSemaphore* pWaitSemaphores
1599 u32 numBufferBinds
1600 const VkSparseBufferMemoryBindInfo* pBufferBinds
1601 u32 numImageOpaqueBinds
1602 const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds
1603 u32 numImageBinds
1604 const VkSparseImageMemoryBindInfo* pImageBinds
1605 u32 signalSemaphoreCount
1606 const VkSemaphore* pSignalSemaphores
1607}
1608
Jesse Hall65ab5522015-11-30 00:07:16 -08001609class VkImageSubresourceLayers {
1610 VkImageAspectFlags aspectMask
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001611 u32 mipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001612 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001613 u32 layerCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001614}
1615
Jesse Halld27f6aa2015-08-15 17:58:48 -07001616class VkImageCopy {
Jesse Hall65ab5522015-11-30 00:07:16 -08001617 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001618 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Hall65ab5522015-11-30 00:07:16 -08001619 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001620 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001621 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images
1622}
1623
1624class VkImageBlit {
Jesse Hall65ab5522015-11-30 00:07:16 -08001625 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001626 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
1627 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Hall65ab5522015-11-30 00:07:16 -08001628 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001629 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
1630 VkExtent3D dstExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001631}
1632
1633class VkBufferImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001634 VkDeviceSize bufferOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001635 u32 bufferRowLength /// Specified in texels
1636 u32 bufferImageHeight
Jesse Hall65ab5522015-11-30 00:07:16 -08001637 VkImageSubresourceLayers imageSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001638 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images
1639 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images
1640}
1641
1642class VkImageResolve {
Jesse Hall65ab5522015-11-30 00:07:16 -08001643 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001644 VkOffset3D srcOffset
Jesse Hall65ab5522015-11-30 00:07:16 -08001645 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001646 VkOffset3D dstOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07001647 VkExtent3D extent
1648}
1649
1650class VkShaderModuleCreateInfo {
1651 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
1652 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001653 VkShaderModuleCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001654 platform.size_t codeSize /// Specified in bytes
Jesse Halla9bb62b2015-11-21 19:31:56 -08001655 const u32* pCode /// Binary code of size codeSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07001656}
1657
Jesse Halld27f6aa2015-08-15 17:58:48 -07001658class VkDescriptorSetLayoutBinding {
Jesse Hall091ed9e2015-11-30 00:55:29 -08001659 u32 binding
Jesse Halld27f6aa2015-08-15 17:58:48 -07001660 VkDescriptorType descriptorType /// Type of the descriptors in this binding
Jesse Halldba27f72015-11-30 14:25:46 -08001661 u32 descriptorCount /// Number of descriptors in this binding
Jesse Halld27f6aa2015-08-15 17:58:48 -07001662 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to
1663 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements)
1664}
1665
1666class VkDescriptorSetLayoutCreateInfo {
1667 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
1668 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001669 VkDescriptorSetLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001670 u32 bindingCount /// Number of bindings in the descriptor set layout
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001671 const VkDescriptorSetLayoutBinding* pBinding /// Array of descriptor set layout bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001672}
1673
Jesse Hall65ab5522015-11-30 00:07:16 -08001674class VkDescriptorPoolSize {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001675 VkDescriptorType type
Jesse Hall03b6fe12015-11-24 12:44:21 -08001676 u32 descriptorCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001677}
1678
1679class VkDescriptorPoolCreateInfo {
1680 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
1681 const void* pNext /// Pointer to next structure
Jesse Hallfbf97b02015-11-20 14:17:03 -08001682 VkDescriptorPoolCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001683 u32 maxSets
Jesse Hall65ab5522015-11-30 00:07:16 -08001684 u32 poolSizeCount
1685 const VkDescriptorPoolSize* pPoolSizes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001686}
1687
Jesse Hall3fbc8562015-11-29 22:10:52 -08001688class VkDescriptorSetAllocateInfo {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001689 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO
Jesse Hallfbf97b02015-11-20 14:17:03 -08001690 const void* pNext /// Pointer to next structure
1691 VkDescriptorPool descriptorPool
Jesse Hall03b6fe12015-11-24 12:44:21 -08001692 u32 setCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001693 const VkDescriptorSetLayout* pSetLayouts
1694}
1695
Jesse Halld27f6aa2015-08-15 17:58:48 -07001696class VkSpecializationMapEntry {
Jesse Hall65ab5522015-11-30 00:07:16 -08001697 u32 constantID /// The SpecConstant ID specified in the BIL
Jesse Halld27f6aa2015-08-15 17:58:48 -07001698 u32 offset /// Offset of the value in the data block
Jesse Hallb00daad2015-11-29 19:46:20 -08001699 platform.size_t size /// Size in bytes of the SpecConstant
Jesse Halld27f6aa2015-08-15 17:58:48 -07001700}
1701
1702class VkSpecializationInfo {
1703 u32 mapEntryCount /// Number of entries in the map
Jesse Hallb00daad2015-11-29 19:46:20 -08001704 const VkSpecializationMapEntry* pMapEntries /// Array of map entries
Jesse Halld27f6aa2015-08-15 17:58:48 -07001705 platform.size_t dataSize /// Size in bytes of pData
1706 const void* pData /// Pointer to SpecConstant data
1707}
1708
1709class VkPipelineShaderStageCreateInfo {
1710 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
1711 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001712 VkPipelineShaderStageCreateFlags flags
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001713 VkShaderStageFlagBits stage
1714 VkShaderModule module
1715 const char* pName
Jesse Halld27f6aa2015-08-15 17:58:48 -07001716 const VkSpecializationInfo* pSpecializationInfo
1717}
1718
1719class VkComputePipelineCreateInfo {
1720 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
1721 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001722 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001723 VkPipelineShaderStageCreateInfo stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001724 VkPipelineLayout layout /// Interface layout of the pipeline
1725 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
1726 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
1727}
1728
1729class VkVertexInputBindingDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001730 u32 binding /// Vertex buffer binding id
1731 u32 stride /// Distance between vertices in bytes (0 = no advancement)
Jesse Hall65ab5522015-11-30 00:07:16 -08001732 VkVertexInputRate inputRate /// Rate at which binding is incremented
Jesse Halld27f6aa2015-08-15 17:58:48 -07001733}
1734
1735class VkVertexInputAttributeDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001736 u32 location /// location of the shader vertex attrib
1737 u32 binding /// Vertex buffer binding id
1738 VkFormat format /// format of source data
1739 u32 offset /// Offset of first element in bytes from base of vertex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001740}
1741
1742class VkPipelineVertexInputStateCreateInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001743 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
1744 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001745 VkPipelineVertexInputStateCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001746 u32 vertexBindingDescriptionCount /// number of bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001747 const VkVertexInputBindingDescription* pVertexBindingDescriptions
Jesse Hall03b6fe12015-11-24 12:44:21 -08001748 u32 vertexAttributeDescriptionCount /// number of attributes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001749 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
1750}
1751
1752class VkPipelineInputAssemblyStateCreateInfo {
1753 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
1754 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001755 VkPipelineInputAssemblyStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001756 VkPrimitiveTopology topology
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001757 VkBool32 primitiveRestartEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001758}
1759
1760class VkPipelineTessellationStateCreateInfo {
1761 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
1762 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001763 VkPipelineTessellationStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001764 u32 patchControlPoints
1765}
1766
1767class VkPipelineViewportStateCreateInfo {
1768 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
1769 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001770 VkPipelineViewportStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001771 u32 viewportCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001772 const VkViewport* pViewports
1773 u32 scissorCount
1774 const VkRect2D* pScissors
Jesse Halld27f6aa2015-08-15 17:58:48 -07001775}
1776
Jesse Hall3fbc8562015-11-29 22:10:52 -08001777class VkPipelineRasterizationStateCreateInfo {
Jesse Hall65ab5522015-11-30 00:07:16 -08001778 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001779 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001780 VkPipelineRasterizationStateCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001781 VkBool32 depthClampEnable
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001782 VkBool32 rasterizerDiscardEnable
Jesse Hall65ab5522015-11-30 00:07:16 -08001783 VkPolygonMode polygonMode /// optional (GL45)
Jesse Hallc7467b72015-11-29 21:05:26 -08001784 VkCullModeFlags cullMode
Jesse Halld27f6aa2015-08-15 17:58:48 -07001785 VkFrontFace frontFace
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001786 VkBool32 depthBiasEnable
Jesse Halla9bb62b2015-11-21 19:31:56 -08001787 f32 depthBiasConstantFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001788 f32 depthBiasClamp
Jesse Halla9bb62b2015-11-21 19:31:56 -08001789 f32 depthBiasSlopeFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001790 f32 lineWidth
Jesse Halld27f6aa2015-08-15 17:58:48 -07001791}
1792
1793class VkPipelineMultisampleStateCreateInfo {
1794 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
1795 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001796 VkPipelineMultisampleStateCreateFlags flags
Jesse Hall091ed9e2015-11-30 00:55:29 -08001797 VkSampleCountFlagBits rasterizationSamples /// Number of samples used for rasterization
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001798 VkBool32 sampleShadingEnable /// optional (GL45)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001799 f32 minSampleShading /// optional (GL45)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001800 const VkSampleMask* pSampleMask
Jesse Hallacfa5342015-11-19 21:51:33 -08001801 VkBool32 alphaToCoverageEnable
1802 VkBool32 alphaToOneEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001803}
1804
1805class VkPipelineColorBlendAttachmentState {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001806 VkBool32 blendEnable
Jesse Hall65ab5522015-11-30 00:07:16 -08001807 VkBlendFactor srcColorBlendFactor
1808 VkBlendFactor dstColorBlendFactor
1809 VkBlendOp colorBlendOp
1810 VkBlendFactor srcAlphaBlendFactor
1811 VkBlendFactor dstAlphaBlendFactor
1812 VkBlendOp alphaBlendOp
1813 VkColorComponentFlags colorWriteMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001814}
1815
1816class VkPipelineColorBlendStateCreateInfo {
1817 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
1818 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001819 VkPipelineColorBlendStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001820 VkBool32 logicOpEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001821 VkLogicOp logicOp
1822 u32 attachmentCount /// # of pAttachments
1823 const VkPipelineColorBlendAttachmentState* pAttachments
Jesse Hallb00daad2015-11-29 19:46:20 -08001824 f32[4] blendConstants
Jesse Halld27f6aa2015-08-15 17:58:48 -07001825}
1826
1827class VkStencilOpState {
Jesse Hall65ab5522015-11-30 00:07:16 -08001828 VkStencilOp failOp
1829 VkStencilOp passOp
1830 VkStencilOp depthFailOp
1831 VkCompareOp compareOp
1832 u32 compareMask
1833 u32 writeMask
1834 u32 reference
Jesse Halld27f6aa2015-08-15 17:58:48 -07001835}
1836
1837class VkPipelineDepthStencilStateCreateInfo {
1838 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
1839 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001840 VkPipelineDepthStencilStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001841 VkBool32 depthTestEnable
1842 VkBool32 depthWriteEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001843 VkCompareOp depthCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001844 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test)
1845 VkBool32 stencilTestEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001846 VkStencilOpState front
1847 VkStencilOpState back
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001848 f32 minDepthBounds
1849 f32 maxDepthBounds
1850}
1851
1852class VkPipelineDynamicStateCreateInfo {
1853 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
1854 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001855 VkPipelineDynamicStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001856 u32 dynamicStateCount
1857 const VkDynamicState* pDynamicStates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001858}
1859
1860class VkGraphicsPipelineCreateInfo {
Jesse Halla6429252015-11-29 18:59:42 -08001861 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
1862 const void* pNext /// Pointer to next structure
1863 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001864 u32 stageCount
Jesse Halla6429252015-11-29 18:59:42 -08001865 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001866 const VkPipelineVertexInputStateCreateInfo* pVertexInputState
1867 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
1868 const VkPipelineTessellationStateCreateInfo* pTessellationState
1869 const VkPipelineViewportStateCreateInfo* pViewportState
Jesse Hall3fbc8562015-11-29 22:10:52 -08001870 const VkPipelineRasterizationStateCreateInfo* pRasterizationState
Jesse Halld27f6aa2015-08-15 17:58:48 -07001871 const VkPipelineMultisampleStateCreateInfo* pMultisampleState
1872 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState
1873 const VkPipelineColorBlendStateCreateInfo* pColorBlendState
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001874 const VkPipelineDynamicStateCreateInfo* pDynamicState
Jesse Halla6429252015-11-29 18:59:42 -08001875 VkPipelineLayout layout /// Interface layout of the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001876 VkRenderPass renderPass
1877 u32 subpass
Jesse Halla6429252015-11-29 18:59:42 -08001878 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
1879 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 -07001880}
1881
1882class VkPipelineCacheCreateInfo {
Jesse Hallb00daad2015-11-29 19:46:20 -08001883 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
1884 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001885 VkPipelineCacheCreateFlags flags
Jesse Hallb00daad2015-11-29 19:46:20 -08001886 platform.size_t initialDataSize /// Size of initial data to populate cache, in bytes
1887 const void* pInitialData /// Initial data to populate cache
Jesse Halld27f6aa2015-08-15 17:58:48 -07001888}
1889
1890class VkPushConstantRange {
1891 VkShaderStageFlags stageFlags /// Which stages use the range
Jesse Hall03b6fe12015-11-24 12:44:21 -08001892 u32 offset /// Start of the range, in bytes
1893 u32 size /// Length of the range, in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001894}
1895
1896class VkPipelineLayoutCreateInfo {
1897 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
1898 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001899 VkPipelineLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001900 u32 setLayoutCount /// Number of descriptor sets interfaced by the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001901 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the
1902 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline
1903 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages
1904}
1905
1906class VkSamplerCreateInfo {
1907 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
1908 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001909 VkSamplerCreateFlags flags
Jesse Hall23ff73f2015-11-29 14:36:39 -08001910 VkFilter magFilter /// Filter mode for magnification
1911 VkFilter minFilter /// Filter mode for minifiation
1912 VkSamplerMipmapMode mipmapMode /// Mipmap selection mode
1913 VkSamplerAddressMode addressModeU
1914 VkSamplerAddressMode addressModeV
1915 VkSamplerAddressMode addressModeW
Jesse Halld27f6aa2015-08-15 17:58:48 -07001916 f32 mipLodBias
1917 f32 maxAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001918 VkBool32 compareEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001919 VkCompareOp compareOp
1920 f32 minLod
1921 f32 maxLod
1922 VkBorderColor borderColor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001923 VkBool32 unnormalizedCoordinates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001924}
1925
Jesse Hall3fbc8562015-11-29 22:10:52 -08001926class VkCommandPoolCreateInfo {
1927 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001928 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001929 VkCommandPoolCreateFlags flags /// Command pool creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001930 u32 queueFamilyIndex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001931}
1932
Jesse Hall3fbc8562015-11-29 22:10:52 -08001933class VkCommandBufferAllocateInfo {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001934 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001935 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001936 VkCommandPool commandPool
1937 VkCommandBufferLevel level
Jesse Hall03b6fe12015-11-24 12:44:21 -08001938 u32 bufferCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001939}
1940
Jesse Hall3fbc8562015-11-29 22:10:52 -08001941class VkCommandBufferBeginInfo {
1942 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001943 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001944 VkCommandBufferUsageFlags flags /// Command buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001945 VkRenderPass renderPass /// Render pass for secondary command buffers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001946 u32 subpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07001947 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers
Jesse Hallf4ab2b12015-11-30 16:04:55 -08001948 VkBool32 occlusionQueryEnable
1949 VkQueryControlFlags queryFlags
1950 VkQueryPipelineStatisticFlags pipelineStatistics
Jesse Halld27f6aa2015-08-15 17:58:48 -07001951}
1952
1953class VkRenderPassBeginInfo {
1954 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
1955 const void* pNext /// Pointer to next structure
1956 VkRenderPass renderPass
1957 VkFramebuffer framebuffer
1958 VkRect2D renderArea
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001959 u32 clearValueCount
1960 const VkClearValue* pClearValues
Jesse Halld27f6aa2015-08-15 17:58:48 -07001961}
1962
1963@union
1964/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared.
1965class VkClearColorValue {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001966 f32[4] float32
1967 s32[4] int32
1968 u32[4] uint32
Jesse Halld27f6aa2015-08-15 17:58:48 -07001969}
1970
1971class VkClearDepthStencilValue {
1972 f32 depth
1973 u32 stencil
1974}
1975
1976@union
1977/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared.
1978class VkClearValue {
1979 VkClearColorValue color
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001980 VkClearDepthStencilValue depthStencil
Jesse Halld27f6aa2015-08-15 17:58:48 -07001981}
1982
Jesse Hallae38f732015-11-19 21:32:50 -08001983class VkClearAttachment {
1984 VkImageAspectFlags aspectMask
1985 u32 colorAttachment
1986 VkClearValue clearValue
1987}
1988
Jesse Halld27f6aa2015-08-15 17:58:48 -07001989class VkAttachmentDescription {
Jesse Halla6429252015-11-29 18:59:42 -08001990 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001991 VkFormat format
Jesse Hall091ed9e2015-11-30 00:55:29 -08001992 VkSampleCountFlagBits samples
Jesse Halld27f6aa2015-08-15 17:58:48 -07001993 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1994 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1995 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1996 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1997 VkImageLayout initialLayout
1998 VkImageLayout finalLayout
1999}
2000
2001class VkAttachmentReference {
2002 u32 attachment
2003 VkImageLayout layout
2004}
2005
2006class VkSubpassDescription {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002007 VkSubpassDescriptionFlags flags
Jesse Halla6429252015-11-29 18:59:42 -08002008 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
Jesse Hall03b6fe12015-11-24 12:44:21 -08002009 u32 inputAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002010 const VkAttachmentReference* pInputAttachments
Jesse Hall03b6fe12015-11-24 12:44:21 -08002011 u32 colorAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002012 const VkAttachmentReference* pColorAttachments
2013 const VkAttachmentReference* pResolveAttachments
Jesse Hallc7467b72015-11-29 21:05:26 -08002014 const VkAttachmentReference* pDepthStencilAttachment
Jesse Hall03b6fe12015-11-24 12:44:21 -08002015 u32 preserveAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002016 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002017}
2018
2019class VkSubpassDependency {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002020 u32 srcSubpass
Jesse Hall3fbc8562015-11-29 22:10:52 -08002021 u32 dstSubpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07002022 VkPipelineStageFlags srcStageMask
Jesse Hall3fbc8562015-11-29 22:10:52 -08002023 VkPipelineStageFlags dstStageMask
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002024 VkAccessFlags srcAccessMask
2025 VkAccessFlags dstAccessMask
Jesse Halldc6d36c2015-11-29 19:12:15 -08002026 VkDependencyFlags dependencyFlags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002027}
2028
2029class VkRenderPassCreateInfo {
2030 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
2031 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002032 VkRenderPassCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002033 u32 attachmentCount
2034 const VkAttachmentDescription* pAttachments
2035 u32 subpassCount
2036 const VkSubpassDescription* pSubpasses
2037 u32 dependencyCount
2038 const VkSubpassDependency* pDependencies
2039}
2040
2041class VkEventCreateInfo {
2042 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
2043 const void* pNext /// Pointer to next structure
2044 VkEventCreateFlags flags /// Event creation flags
2045}
2046
2047class VkFenceCreateInfo {
2048 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
2049 const void* pNext /// Pointer to next structure
2050 VkFenceCreateFlags flags /// Fence creation flags
2051}
2052
2053class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002054 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
2055 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
2056 VkBool32 imageCubeArray /// image views which are arrays of cube maps
2057 VkBool32 independentBlend /// blending operations are controlled per-attachment
2058 VkBool32 geometryShader /// geometry stage
2059 VkBool32 tessellationShader /// tessellation control and evaluation stage
2060 VkBool32 sampleRateShading /// per-sample shading and interpolation
Jesse Hall3fbc8562015-11-29 22:10:52 -08002061 VkBool32 dualSrcBlend /// blend operations which take two sources
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002062 VkBool32 logicOp /// logic operations
2063 VkBool32 multiDrawIndirect /// multi draw indirect
Jesse Hallae38f732015-11-19 21:32:50 -08002064 VkBool32 depthClamp /// depth clamping
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002065 VkBool32 depthBiasClamp /// depth bias clamping
2066 VkBool32 fillModeNonSolid /// point and wireframe fill modes
2067 VkBool32 depthBounds /// depth bounds test
2068 VkBool32 wideLines /// lines with width greater than 1
2069 VkBool32 largePoints /// points with size greater than 1
Jesse Hallfbf97b02015-11-20 14:17:03 -08002070 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
2071 VkBool32 multiViewport
2072 VkBool32 samplerAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002073 VkBool32 textureCompressionETC2 /// ETC texture compression formats
2074 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
2075 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
Jesse Hall65ab5522015-11-30 00:07:16 -08002076 VkBool32 occlusionQueryPrecise
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002077 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
Jesse Halldc6d36c2015-11-29 19:12:15 -08002078 VkBool32 vertexPipelineStoresAndAtomics
2079 VkBool32 fragmentStoresAndAtomics
2080 VkBool32 shaderTessellationAndGeometryPointSize
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002081 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
2082 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
2083 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
Jesse Halld1af8122015-11-29 23:50:38 -08002084 VkBool32 shaderStorageImageReadWithoutFormat
2085 VkBool32 shaderStorageImageWriteWithoutFormat
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002086 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
2087 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
2088 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
2089 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
2090 VkBool32 shaderClipDistance /// clip distance in shaders
2091 VkBool32 shaderCullDistance /// cull distance in shaders
2092 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
2093 VkBool32 shaderInt64 /// 64-bit integers in shaders
2094 VkBool32 shaderInt16 /// 16-bit integers in shaders
2095 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
Jesse Hall65ab5522015-11-30 00:07:16 -08002096 VkBool32 shaderResourceMinLod /// shader can use texture operations that specify minimum resource LOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002097 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
2098 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
2099 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
2100 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
2101 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
2102 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
2103 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
2104 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
2105 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld1af8122015-11-29 23:50:38 -08002106 VkBool32 variableMultisampleRate
Jesse Halld27f6aa2015-08-15 17:58:48 -07002107}
2108
2109class VkPhysicalDeviceLimits {
2110 /// resource maximum sizes
2111 u32 maxImageDimension1D /// max 1D image dimension
2112 u32 maxImageDimension2D /// max 2D image dimension
2113 u32 maxImageDimension3D /// max 3D image dimension
2114 u32 maxImageDimensionCube /// max cubemap image dimension
2115 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hallb00daad2015-11-29 19:46:20 -08002116 u32 maxTexelBufferElements
Jesse Hallfbf97b02015-11-20 14:17:03 -08002117 u32 maxUniformBufferRange /// max uniform buffer size (bytes)
2118 u32 maxStorageBufferRange /// max storage buffer size (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002119 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
2120 /// memory limits
2121 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall091ed9e2015-11-30 00:55:29 -08002122 u32 maxSamplerAllocationCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002123 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
2124 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002125 /// descriptor set limits
2126 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07002127 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
2128 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
2129 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
2130 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
2131 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
Jesse Halle1b12782015-11-30 11:27:32 -08002132 u32 maxPerStageDescriptorInputAttachments
Jesse Halldba27f72015-11-30 14:25:46 -08002133 u32 maxPerStageResources
Jesse Halld27f6aa2015-08-15 17:58:48 -07002134 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
2135 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002136 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002137 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002138 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002139 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
2140 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
Jesse Halle1b12782015-11-30 11:27:32 -08002141 u32 maxDescriptorSetInputAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002142 /// vertex stage limits
2143 u32 maxVertexInputAttributes /// max num of vertex input attribute slots
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002144 u32 maxVertexInputBindings /// max num of vertex input binding slots
Jesse Halld27f6aa2015-08-15 17:58:48 -07002145 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset
2146 u32 maxVertexInputBindingStride /// max vertex input binding stride
2147 u32 maxVertexOutputComponents /// max num of output components written by vertex shader
2148 /// tessellation control stage limits
Jesse Hall3fbc8562015-11-29 22:10:52 -08002149 u32 maxTessellationGenerationLevel /// max level supported by tess primitive generator
Jesse Hallae38f732015-11-19 21:32:50 -08002150 u32 maxTessellationPatchSize /// max patch size (vertices)
2151 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS
2152 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS
2153 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS
2154 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS
2155 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES
2156 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES
Jesse Halld27f6aa2015-08-15 17:58:48 -07002157 /// geometry stage limits
2158 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader
2159 u32 maxGeometryInputComponents /// max num of input components read in geometry stage
2160 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage
2161 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage
2162 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage
2163 /// fragment stage limits
2164 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage
Jesse Hallfbf97b02015-11-20 14:17:03 -08002165 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage
Jesse Hall3fbc8562015-11-29 22:10:52 -08002166 u32 maxFragmentDualSrcAttachments /// max num of output attachments written when using dual source blending
Jesse Halld27f6aa2015-08-15 17:58:48 -07002167 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers
2168 /// compute stage limits
2169 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes)
2170 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z)
2171 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group
2172 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z)
2173
2174 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y
2175 u32 subTexelPrecisionBits /// num bits of subtexel precision
2176 u32 mipmapPrecisionBits /// num bits of mipmap precision
2177
2178 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices)
Jesse Halldba27f72015-11-30 14:25:46 -08002179 u32 maxDrawIndirectCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07002180
2181 f32 maxSamplerLodBias /// max absolute sampler level of detail bias
2182 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy
2183
2184 u32 maxViewports /// max number of active viewports
Jesse Halld27f6aa2015-08-15 17:58:48 -07002185 u32[2] maxViewportDimensions /// max viewport dimensions (x,y)
2186 f32[2] viewportBoundsRange /// viewport bounds range (min,max)
2187 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport
2188
Jesse Halldc6d36c2015-11-29 19:12:15 -08002189 platform.size_t minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes)
2190 VkDeviceSize minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes)
2191 VkDeviceSize minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes)
2192 VkDeviceSize minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002193
Jesse Hallfbf97b02015-11-20 14:17:03 -08002194 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002195 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset
Jesse Hallfbf97b02015-11-20 14:17:03 -08002196 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002197 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset
2198 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset
2199 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset
2200 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset
2201
2202 u32 maxFramebufferWidth /// max width for a framebuffer
2203 u32 maxFramebufferHeight /// max height for a framebuffer
2204 u32 maxFramebufferLayers /// max layer count for a layered framebuffer
Jesse Hall091ed9e2015-11-30 00:55:29 -08002205 VkSampleCountFlags framebufferColorSampleCounts
2206 VkSampleCountFlags framebufferDepthSampleCounts
2207 VkSampleCountFlags framebufferStencilSampleCounts
2208 VkSampleCountFlags framebufferNoAttachmentSampleCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07002209 u32 maxColorAttachments /// max num of framebuffer color attachments
2210
Jesse Hall091ed9e2015-11-30 00:55:29 -08002211 VkSampleCountFlags sampledImageColorSampleCounts
2212 VkSampleCountFlags sampledImageIntegerSampleCounts
2213 VkSampleCountFlags sampledImageDepthSampleCounts
2214 VkSampleCountFlags sampledImageStencilSampleCounts
2215 VkSampleCountFlags storageImageSampleCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07002216 u32 maxSampleMaskWords /// max num of sample mask words
2217
Jesse Halla9bb62b2015-11-21 19:31:56 -08002218 f32 timestampPeriod
Jesse Halld27f6aa2015-08-15 17:58:48 -07002219
2220 u32 maxClipDistances /// max number of clip distances
2221 u32 maxCullDistances /// max number of cull distances
2222 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
2223
Jesse Hallfbf97b02015-11-20 14:17:03 -08002224 u32 discreteQueuePriorities
2225
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002226 f32[2] pointSizeRange /// range (min,max) of supported point sizes
2227 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07002228 f32 pointSizeGranularity /// granularity of supported point sizes
2229 f32 lineWidthGranularity /// granularity of supported line widths
Jesse Hall03b6fe12015-11-24 12:44:21 -08002230 VkBool32 strictLines
Jesse Hall091ed9e2015-11-30 00:55:29 -08002231 VkBool32 standardSampleLocations
Jesse Halla9bb62b2015-11-21 19:31:56 -08002232
Jesse Hall65ab5522015-11-30 00:07:16 -08002233 VkDeviceSize optimalBufferCopyOffsetAlignment
2234 VkDeviceSize optimalBufferCopyRowPitchAlignment
Jesse Halldba27f72015-11-30 14:25:46 -08002235 VkDeviceSize nonCoherentAtomSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07002236}
2237
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002238class VkPhysicalDeviceSparseProperties {
2239 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 -08002240 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 -07002241 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
2242 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 -07002243 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
2244}
2245
Jesse Halld27f6aa2015-08-15 17:58:48 -07002246class VkSemaphoreCreateInfo {
2247 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
2248 const void* pNext /// Pointer to next structure
2249 VkSemaphoreCreateFlags flags /// Semaphore creation flags
2250}
2251
2252class VkQueryPoolCreateInfo {
2253 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
2254 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002255 VkQueryPoolCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002256 VkQueryType queryType
Jesse Hall65ab5522015-11-30 00:07:16 -08002257 u32 entryCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07002258 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
2259}
2260
2261class VkFramebufferCreateInfo {
2262 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
2263 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002264 VkFramebufferCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002265 VkRenderPass renderPass
2266 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002267 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002268 u32 width
2269 u32 height
2270 u32 layers
2271}
2272
Jesse Hall3fbc8562015-11-29 22:10:52 -08002273class VkDrawIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002274 u32 vertexCount
2275 u32 instanceCount
2276 u32 firstVertex
2277 u32 firstInstance
2278}
2279
Jesse Hall3fbc8562015-11-29 22:10:52 -08002280class VkDrawIndexedIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002281 u32 indexCount
2282 u32 instanceCount
2283 u32 firstIndex
2284 s32 vertexOffset
2285 u32 firstInstance
2286}
2287
Jesse Hall3fbc8562015-11-29 22:10:52 -08002288class VkDispatchIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002289 u32 x
2290 u32 y
2291 u32 z
2292}
2293
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002294@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08002295class VkSurfaceCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002296 u32 minImageCount
2297 u32 maxImageCount
2298 VkExtent2D currentExtent
2299 VkExtent2D minImageExtent
2300 VkExtent2D maxImageExtent
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002301 u32 maxImageArrayLayers
Jesse Hall1356b0d2015-11-23 17:24:58 -08002302 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002303 VkSurfaceTransformFlagBitsKHR currentTransform
Jesse Halla6429252015-11-29 18:59:42 -08002304 VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002305 VkImageUsageFlags supportedUsageFlags
Michael Lentine88594d72015-11-12 12:49:45 -08002306}
2307
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002308@extension("VK_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -08002309class VkSurfaceFormatKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002310 VkFormat format
2311 VkColorSpaceKHR colorSpace
Michael Lentine88594d72015-11-12 12:49:45 -08002312}
2313
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002314@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002315class VkSwapchainCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002316 VkStructureType sType
2317 const void* pNext
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002318 VkSwapchainCreateFlagsKHR flags
Jesse Hall1356b0d2015-11-23 17:24:58 -08002319 VkSurfaceKHR surface
2320 u32 minImageCount
2321 VkFormat imageFormat
2322 VkColorSpaceKHR imageColorSpace
2323 VkExtent2D imageExtent
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002324 u32 imageArrayLayers
2325 VkImageUsageFlags imageUsage
Jesse Hall1356b0d2015-11-23 17:24:58 -08002326 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08002327 u32 queueFamilyIndexCount
Jesse Hall1356b0d2015-11-23 17:24:58 -08002328 const u32* pQueueFamilyIndices
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002329 VkSurfaceTransformFlagBitsKHR preTransform
2330 VkCompositeAlphaFlagBitsKHR compositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002331 VkPresentModeKHR presentMode
Jesse Hall1356b0d2015-11-23 17:24:58 -08002332 VkBool32 clipped
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002333 VkSwapchainKHR oldSwapchain
Michael Lentine88594d72015-11-12 12:49:45 -08002334}
2335
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002336@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002337class VkPresentInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002338 VkStructureType sType
2339 const void* pNext
Jesse Hallb00daad2015-11-29 19:46:20 -08002340 u32 waitSemaphoreCount
2341 const VkSemaphore* pWaitSemaphores
Jesse Hall1356b0d2015-11-23 17:24:58 -08002342 u32 swapchainCount
Jesse Hall03b6fe12015-11-24 12:44:21 -08002343 const VkSwapchainKHR* pSwapchains
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002344 const u32* pImageIndices
Jesse Halle1b12782015-11-30 11:27:32 -08002345 VkResult* pResults
Michael Lentine88594d72015-11-12 12:49:45 -08002346}
2347
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002348@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002349class VkDisplayPropertiesKHR {
2350 VkDisplayKHR display
2351 const char* displayName
2352 VkExtent2D physicalDimensions
2353 VkExtent2D physicalResolution
2354 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hall1356b0d2015-11-23 17:24:58 -08002355 VkBool32 planeReorderPossible
Jesse Halla6429252015-11-29 18:59:42 -08002356 VkBool32 persistentContent
Michael Lentine88594d72015-11-12 12:49:45 -08002357}
2358
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002359@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002360class VkDisplayModeParametersKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002361 VkExtent2D visibleRegion
Jesse Halla6429252015-11-29 18:59:42 -08002362 u32 refreshRate
Michael Lentine88594d72015-11-12 12:49:45 -08002363}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002364
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002365@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002366class VkDisplayModePropertiesKHR {
2367 VkDisplayModeKHR displayMode
Jesse Halla6429252015-11-29 18:59:42 -08002368 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002369}
2370
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002371@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002372class VkDisplayModeCreateInfoKHR {
2373 VkStructureType sType
2374 const void* pNext
Jesse Hall9ba8bc82015-11-30 16:22:16 -08002375 VkDisplayModeCreateFlagsKHR flags
Jesse Halla6429252015-11-29 18:59:42 -08002376 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002377}
2378
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002379@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002380class VkDisplayPlanePropertiesKHR {
Jesse Halla6429252015-11-29 18:59:42 -08002381 VkDisplayKHR currentDisplay
2382 u32 currentStackIndex
2383}
2384
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002385@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002386class VkDisplayPlaneCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002387 VkDisplayPlaneAlphaFlagsKHR supportedAlpha
2388 VkOffset2D minSrcPosition
2389 VkOffset2D maxSrcPosition
2390 VkExtent2D minSrcExtent
2391 VkExtent2D maxSrcExtent
2392 VkOffset2D minDstPosition
2393 VkOffset2D maxDstPosition
2394 VkExtent2D minDstExtent
2395 VkExtent2D maxDstExtent
2396}
2397
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002398@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002399class VkDisplaySurfaceCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002400 VkStructureType sType
2401 const void* pNext
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002402 VkDisplaySurfaceCreateFlagsKHR flags
Jesse Hall1356b0d2015-11-23 17:24:58 -08002403 VkDisplayModeKHR displayMode
2404 u32 planeIndex
2405 u32 planeStackIndex
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002406 VkSurfaceTransformFlagBitsKHR transform
Jesse Hall1356b0d2015-11-23 17:24:58 -08002407 f32 globalAlpha
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002408 VkDisplayPlaneAlphaFlagBitsKHR alphaMode
2409 VkExtent2D imageExtent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002410}
2411
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002412@extension("VK_KHR_display_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002413class VkDisplayPresentInfoKHR {
2414 VkStructureType sType
2415 const void* pNext
2416 VkRect2D srcRect
2417 VkRect2D dstRect
Jesse Halla6429252015-11-29 18:59:42 -08002418 VkBool32 persistent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002419}
2420
2421
Jesse Halld27f6aa2015-08-15 17:58:48 -07002422////////////////
2423// Commands //
2424////////////////
2425
2426// Function pointers. TODO: add support for function pointers.
2427
2428@external type void* PFN_vkVoidFunction
2429@pfn cmd void vkVoidFunction() {
2430}
2431
Jesse Hall3fbc8562015-11-29 22:10:52 -08002432@external type void* PFN_vkAllocationFunction
2433@pfn cmd void* vkAllocationFunction(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002434 void* pUserData,
2435 platform.size_t size,
2436 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002437 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002438 return ?
2439}
2440
Jesse Hall3fbc8562015-11-29 22:10:52 -08002441@external type void* PFN_vkReallocationFunction
2442@pfn cmd void* vkReallocationFunction(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002443 void* pUserData,
2444 void* pOriginal,
2445 platform.size_t size,
2446 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002447 VkSystemAllocationScope allocationScope) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002448 return ?
2449}
2450
2451@external type void* PFN_vkFreeFunction
2452@pfn cmd void vkFreeFunction(
2453 void* pUserData,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002454 void* pMemory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002455}
2456
Jesse Hall3fbc8562015-11-29 22:10:52 -08002457@external type void* PFN_vkInternalAllocationNotification
2458@pfn cmd void vkInternalAllocationNotification(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002459 void* pUserData,
2460 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002461 VkInternalAllocationType allocationType,
2462 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002463}
2464
2465@external type void* PFN_vkInternalFreeNotification
2466@pfn cmd void vkInternalFreeNotification(
2467 void* pUserData,
2468 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002469 VkInternalAllocationType allocationType,
2470 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002471}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002472
2473// Global functions
2474
2475@threadSafety("system")
2476cmd VkResult vkCreateInstance(
2477 const VkInstanceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002478 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002479 VkInstance* pInstance) {
2480 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
2481
2482 instance := ?
2483 pInstance[0] = instance
2484 State.Instances[instance] = new!InstanceObject()
2485
Jesse Hall03b6fe12015-11-24 12:44:21 -08002486 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount]
2487 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount]
Jesse Halld27f6aa2015-08-15 17:58:48 -07002488
2489 return ?
2490}
2491
2492@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002493cmd void vkDestroyInstance(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002494 VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002495 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002496 instanceObject := GetInstance(instance)
2497
2498 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002499}
2500
2501@threadSafety("system")
2502cmd VkResult vkEnumeratePhysicalDevices(
2503 VkInstance instance,
2504 u32* pPhysicalDeviceCount,
2505 VkPhysicalDevice* pPhysicalDevices) {
2506 instanceObject := GetInstance(instance)
2507
2508 physicalDeviceCount := as!u32(?)
2509 pPhysicalDeviceCount[0] = physicalDeviceCount
2510 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2511
2512 for i in (0 .. physicalDeviceCount) {
2513 physicalDevice := ?
2514 physicalDevices[i] = physicalDevice
2515 if !(physicalDevice in State.PhysicalDevices) {
2516 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2517 }
2518 }
2519
2520 return ?
2521}
2522
2523cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2524 VkDevice device,
2525 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002526 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002527 device := GetDevice(device)
2528 }
2529
2530 return ?
2531}
2532
2533cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2534 VkInstance instance,
2535 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002536 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002537 instanceObject := GetInstance(instance)
2538 }
2539
2540 return ?
2541}
2542
Jesse Hall606a54e2015-11-19 22:17:28 -08002543cmd void vkGetPhysicalDeviceProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002544 VkPhysicalDevice physicalDevice,
2545 VkPhysicalDeviceProperties* pProperties) {
2546 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2547
2548 properties := ?
2549 pProperties[0] = properties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002550}
2551
Jesse Hall606a54e2015-11-19 22:17:28 -08002552cmd void vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002553 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002554 u32* pQueueFamilyPropertyCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002555 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002556 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002557 // TODO: Figure out how to express fetch-count-or-properties
2558 // This version fails 'apic validate' with 'fence not allowed in
2559 // *semantic.Branch'. Other attempts have failed with the same or other
2560 // errors.
2561 // if pQueueFamilyProperties != null {
2562 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2563 // for i in (0 .. pCount[0]) {
2564 // queueProperties := as!VkQueueFamilyProperties(?)
2565 // queuesProperties[i] = queueProperties
2566 // }
2567 // } else {
2568 // count := ?
2569 // pCount[0] = count
2570 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002571}
2572
Jesse Hall606a54e2015-11-19 22:17:28 -08002573cmd void vkGetPhysicalDeviceMemoryProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002574 VkPhysicalDevice physicalDevice,
2575 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2576 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2577
2578 memoryProperties := ?
2579 pMemoryProperties[0] = memoryProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002580}
2581
Jesse Hall606a54e2015-11-19 22:17:28 -08002582cmd void vkGetPhysicalDeviceFeatures(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002583 VkPhysicalDevice physicalDevice,
2584 VkPhysicalDeviceFeatures* pFeatures) {
2585 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2586
2587 features := ?
2588 pFeatures[0] = features
Jesse Halld27f6aa2015-08-15 17:58:48 -07002589}
2590
Jesse Hall606a54e2015-11-19 22:17:28 -08002591cmd void vkGetPhysicalDeviceFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002592 VkPhysicalDevice physicalDevice,
2593 VkFormat format,
2594 VkFormatProperties* pFormatProperties) {
2595 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2596
2597 formatProperties := ?
2598 pFormatProperties[0] = formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002599}
2600
Jesse Halla9e57032015-11-30 01:03:10 -08002601cmd VkResult vkGetPhysicalDeviceImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002602 VkPhysicalDevice physicalDevice,
2603 VkFormat format,
2604 VkImageType type,
2605 VkImageTiling tiling,
2606 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002607 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002608 VkImageFormatProperties* pImageFormatProperties) {
2609 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2610
2611 imageFormatProperties := ?
2612 pImageFormatProperties[0] = imageFormatProperties
Jesse Halla9e57032015-11-30 01:03:10 -08002613
2614 return ?
Jesse Halld27f6aa2015-08-15 17:58:48 -07002615}
2616
Jesse Halld27f6aa2015-08-15 17:58:48 -07002617
2618// Device functions
2619
2620@threadSafety("system")
2621cmd VkResult vkCreateDevice(
2622 VkPhysicalDevice physicalDevice,
2623 const VkDeviceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002624 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002625 VkDevice* pDevice) {
2626 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2627 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2628
2629 device := ?
2630 pDevice[0] = device
2631 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2632
2633 return ?
2634}
2635
2636@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002637cmd void vkDestroyDevice(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002638 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002639 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002640 deviceObject := GetDevice(device)
2641
2642 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002643}
2644
2645
2646// Extension discovery functions
2647
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002648cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002649 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002650 VkLayerProperties* pProperties) {
2651 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002652 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002653
2654 properties := pProperties[0:count]
2655 for i in (0 .. count) {
2656 property := ?
2657 properties[i] = property
2658 }
2659
2660 return ?
2661}
2662
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002663cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002664 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002665 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002666 VkExtensionProperties* pProperties) {
2667 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002668 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002669
2670 properties := pProperties[0:count]
2671 for i in (0 .. count) {
2672 property := ?
2673 properties[i] = property
2674 }
2675
2676 return ?
2677}
2678
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002679cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002680 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002681 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002682 VkLayerProperties* pProperties) {
2683 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2684 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002685 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002686
2687 properties := pProperties[0:count]
2688 for i in (0 .. count) {
2689 property := ?
2690 properties[i] = property
2691 }
2692
2693 return ?
2694}
2695
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002696cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002697 VkPhysicalDevice physicalDevice,
2698 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002699 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002700 VkExtensionProperties* pProperties) {
2701 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2702
2703 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002704 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002705
2706 properties := pProperties[0:count]
2707 for i in (0 .. count) {
2708 property := ?
2709 properties[i] = property
2710 }
2711
2712 return ?
2713}
2714
2715
2716// Queue functions
2717
2718@threadSafety("system")
Jesse Hall606a54e2015-11-19 22:17:28 -08002719cmd void vkGetDeviceQueue(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002720 VkDevice device,
2721 u32 queueFamilyIndex,
2722 u32 queueIndex,
2723 VkQueue* pQueue) {
2724 deviceObject := GetDevice(device)
2725
2726 queue := ?
2727 pQueue[0] = queue
2728
2729 if !(queue in State.Queues) {
2730 State.Queues[queue] = new!QueueObject(device: device)
2731 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002732}
2733
2734@threadSafety("app")
2735cmd VkResult vkQueueSubmit(
2736 VkQueue queue,
Jesse Halla366a512015-11-19 22:30:07 -08002737 u32 submitCount,
Jesse Hallb00daad2015-11-29 19:46:20 -08002738 const VkSubmitInfo* pSubmits,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002739 VkFence fence) {
2740 queueObject := GetQueue(queue)
2741
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002742 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002743 fenceObject := GetFence(fence)
2744 assert(fenceObject.device == queueObject.device)
2745 }
2746
Jesse Hall3fbc8562015-11-29 22:10:52 -08002747 // commandBuffers := pcommandBuffers[0:commandBufferCount]
2748 // for i in (0 .. commandBufferCount) {
2749 // commandBuffer := commandBuffers[i]
2750 // commandBufferObject := GetCommandBuffer(commandBuffer)
2751 // assert(commandBufferObject.device == queueObject.device)
Jesse Halla366a512015-11-19 22:30:07 -08002752 //
Jesse Hall3fbc8562015-11-29 22:10:52 -08002753 // validate("QueueCheck", commandBufferObject.queueFlags in queueObject.flags,
2754 // "vkQueueSubmit: enqueued commandBuffer requires missing queue capabilities.")
Jesse Halla366a512015-11-19 22:30:07 -08002755 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002756
2757 return ?
2758}
2759
2760@threadSafety("system")
2761cmd VkResult vkQueueWaitIdle(
2762 VkQueue queue) {
2763 queueObject := GetQueue(queue)
2764
2765 return ?
2766}
2767
2768@threadSafety("system")
2769cmd VkResult vkDeviceWaitIdle(
2770 VkDevice device) {
2771 deviceObject := GetDevice(device)
2772
2773 return ?
2774}
2775
2776
2777// Memory functions
2778
2779@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002780cmd VkResult vkAllocateMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002781 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002782 const VkMemoryAllocateInfo* pAllocateInfo,
2783 const VkAllocationCallbacks* pAllocator,
2784 VkDeviceMemory* pMemory) {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08002785 assert(pAllocateInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002786 deviceObject := GetDevice(device)
2787
Jesse Hall3fbc8562015-11-29 22:10:52 -08002788 memory := ?
2789 pMemory[0] = memory
2790 State.DeviceMemories[memory] = new!DeviceMemoryObject(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002791 device: device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002792 allocationSize: pAllocateInfo[0].allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002793
2794 return ?
2795}
2796
2797@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002798cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002799 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002800 VkDeviceMemory memory,
2801 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002802 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002803 memoryObject := GetDeviceMemory(memory)
2804 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002805
2806 // Check that no objects are still bound before freeing.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002807 validate("MemoryCheck", len(memoryObject.boundObjects) == 0,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002808 "vkFreeMemory: objects still bound")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002809 validate("MemoryCheck", len(memoryObject.boundCommandBuffers) == 0,
2810 "vkFreeMemory: commandBuffers still bound")
2811 State.DeviceMemories[memory] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002812}
2813
2814@threadSafety("app")
2815cmd VkResult vkMapMemory(
2816 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002817 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002818 VkDeviceSize offset,
2819 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002820 VkMemoryMapFlags flags,
2821 void** ppData) {
2822 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002823 memoryObject := GetDeviceMemory(memory)
2824 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002825
2826 assert(flags == as!VkMemoryMapFlags(0))
Jesse Hall3fbc8562015-11-29 22:10:52 -08002827 assert((offset + size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002828
2829 return ?
2830}
2831
2832@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002833cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002834 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002835 VkDeviceMemory memory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002836 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002837 memoryObject := GetDeviceMemory(memory)
2838 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002839}
2840
2841cmd VkResult vkFlushMappedMemoryRanges(
2842 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002843 u32 memoryRangeCount
2844 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002845 deviceObject := GetDevice(device)
2846
Jesse Hall3fbc8562015-11-29 22:10:52 -08002847 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2848 for i in (0 .. memoryRangeCount) {
2849 memoryRange := memoryRanges[i]
2850 memoryObject := GetDeviceMemory(memoryRange.memory)
2851 assert(memoryObject.device == device)
2852 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002853 }
2854
2855 return ?
2856}
2857
2858cmd VkResult vkInvalidateMappedMemoryRanges(
2859 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002860 u32 memoryRangeCount,
2861 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002862 deviceObject := GetDevice(device)
2863
Jesse Hall3fbc8562015-11-29 22:10:52 -08002864 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2865 for i in (0 .. memoryRangeCount) {
2866 memoryRange := memoryRanges[i]
2867 memoryObject := GetDeviceMemory(memoryRange.memory)
2868 assert(memoryObject.device == device)
2869 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002870 }
2871
2872 return ?
2873}
2874
2875
2876// Memory management API functions
2877
Jesse Hall606a54e2015-11-19 22:17:28 -08002878cmd void vkGetDeviceMemoryCommitment(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002879 VkDevice device,
2880 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002881 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002882 deviceObject := GetDevice(device)
2883
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002884 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002885 memoryObject := GetDeviceMemory(memory)
2886 assert(memoryObject.device == device)
2887 }
2888
2889 committedMemoryInBytes := ?
2890 pCommittedMemoryInBytes[0] = committedMemoryInBytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07002891}
2892
Jesse Hall606a54e2015-11-19 22:17:28 -08002893cmd void vkGetBufferMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002894 VkDevice device,
2895 VkBuffer buffer,
2896 VkMemoryRequirements* pMemoryRequirements) {
2897 deviceObject := GetDevice(device)
2898 bufferObject := GetBuffer(buffer)
2899 assert(bufferObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002900}
2901
2902cmd VkResult vkBindBufferMemory(
2903 VkDevice device,
2904 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002905 VkDeviceMemory memory,
2906 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002907 deviceObject := GetDevice(device)
2908 bufferObject := GetBuffer(buffer)
2909 assert(bufferObject.device == device)
2910
2911 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002912 if bufferObject.memory != NULL_HANDLE {
2913 memoryObject := GetDeviceMemory(bufferObject.memory)
2914 memoryObject.boundObjects[as!u64(buffer)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002915 }
2916
2917 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002918 if memory != NULL_HANDLE {
2919 memoryObject := GetDeviceMemory(memory)
2920 assert(memoryObject.device == device)
2921 memoryObject.boundObjects[as!u64(buffer)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002922 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002923 bufferObject.memory = memory
2924 bufferObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002925
2926 return ?
2927}
2928
Jesse Hall606a54e2015-11-19 22:17:28 -08002929cmd void vkGetImageMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002930 VkDevice device,
2931 VkImage image,
2932 VkMemoryRequirements* pMemoryRequirements) {
2933 deviceObject := GetDevice(device)
2934 imageObject := GetImage(image)
2935 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002936}
2937
2938cmd VkResult vkBindImageMemory(
2939 VkDevice device,
2940 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002941 VkDeviceMemory memory,
2942 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002943 deviceObject := GetDevice(device)
2944 imageObject := GetImage(image)
2945 assert(imageObject.device == device)
2946
2947 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002948 if imageObject.memory != NULL_HANDLE {
2949 memoryObject := GetDeviceMemory(imageObject.memory)
2950 memoryObject.boundObjects[as!u64(image)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002951 }
2952
2953 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002954 if memory != NULL_HANDLE {
2955 memoryObject := GetDeviceMemory(memory)
2956 assert(memoryObject.device == device)
2957 memoryObject.boundObjects[as!u64(image)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002958 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002959 imageObject.memory = memory
2960 imageObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002961
2962 return ?
2963}
2964
Jesse Hall606a54e2015-11-19 22:17:28 -08002965cmd void vkGetImageSparseMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002966 VkDevice device,
2967 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002968 u32* pSparseMemoryRequirementCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002969 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2970 deviceObject := GetDevice(device)
2971 imageObject := GetImage(image)
2972 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002973}
2974
Jesse Hall606a54e2015-11-19 22:17:28 -08002975cmd void vkGetPhysicalDeviceSparseImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002976 VkPhysicalDevice physicalDevice,
2977 VkFormat format,
2978 VkImageType type,
Jesse Hall091ed9e2015-11-30 00:55:29 -08002979 VkSampleCountFlagBits samples,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002980 VkImageUsageFlags usage,
2981 VkImageTiling tiling,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002982 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002983 VkSparseImageFormatProperties* pProperties) {
2984 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002985}
2986
Jesse Halla6429252015-11-29 18:59:42 -08002987cmd VkResult vkQueueBindSparse(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002988 VkQueue queue,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002989 u32 bindInfoCount,
Jesse Halla6429252015-11-29 18:59:42 -08002990 const VkBindSparseInfo* pBindInfo,
2991 VkFence fence) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002992 queueObject := GetQueue(queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002993
2994 return ?
2995}
2996
2997
2998// Fence functions
2999
3000@threadSafety("system")
3001cmd VkResult vkCreateFence(
3002 VkDevice device,
3003 const VkFenceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003004 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003005 VkFence* pFence) {
3006 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
3007 deviceObject := GetDevice(device)
3008
3009 fence := ?
3010 pFence[0] = fence
3011 State.Fences[fence] = new!FenceObject(
Jesse Halld8bade02015-11-24 10:24:18 -08003012 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT)))
Jesse Halld27f6aa2015-08-15 17:58:48 -07003013
3014 return ?
3015}
3016
3017@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003018cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003019 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003020 VkFence fence,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003021 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003022 deviceObject := GetDevice(device)
3023 fenceObject := GetFence(fence)
3024 assert(fenceObject.device == device)
3025
3026 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003027}
3028
3029@threadSafety("system")
3030cmd VkResult vkResetFences(
3031 VkDevice device,
3032 u32 fenceCount,
3033 const VkFence* pFences) {
3034 deviceObject := GetDevice(device)
3035
3036 fences := pFences[0:fenceCount]
3037 for i in (0 .. fenceCount) {
3038 fence := fences[i]
3039 fenceObject := GetFence(fence)
3040 assert(fenceObject.device == device)
3041 fenceObject.signaled = false
3042 }
3043
3044 return ?
3045}
3046
3047@threadSafety("system")
3048cmd VkResult vkGetFenceStatus(
3049 VkDevice device,
3050 VkFence fence) {
3051 deviceObject := GetDevice(device)
3052 fenceObject := GetFence(fence)
3053 assert(fenceObject.device == device)
3054
3055 return ?
3056}
3057
3058@threadSafety("system")
3059cmd VkResult vkWaitForFences(
3060 VkDevice device,
3061 u32 fenceCount,
3062 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003063 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003064 u64 timeout) { /// timeout in nanoseconds
3065 deviceObject := GetDevice(device)
3066
3067 fences := pFences[0:fenceCount]
3068 for i in (0 .. fenceCount) {
3069 fence := fences[i]
3070 fenceObject := GetFence(fence)
3071 assert(fenceObject.device == device)
3072 }
3073
3074 return ?
3075}
3076
3077
3078// Queue semaphore functions
3079
3080@threadSafety("system")
3081cmd VkResult vkCreateSemaphore(
3082 VkDevice device,
3083 const VkSemaphoreCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003084 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003085 VkSemaphore* pSemaphore) {
3086 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
3087 deviceObject := GetDevice(device)
3088
3089 semaphore := ?
3090 pSemaphore[0] = semaphore
3091 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
3092
3093 return ?
3094}
3095
3096@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003097cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003098 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003099 VkSemaphore semaphore,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003100 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003101 deviceObject := GetDevice(device)
3102 semaphoreObject := GetSemaphore(semaphore)
3103 assert(semaphoreObject.device == device)
3104
3105 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003106}
3107
Jesse Halld27f6aa2015-08-15 17:58:48 -07003108
3109// Event functions
3110
3111@threadSafety("system")
3112cmd VkResult vkCreateEvent(
3113 VkDevice device,
3114 const VkEventCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003115 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003116 VkEvent* pEvent) {
3117 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
3118 deviceObject := GetDevice(device)
3119
3120 event := ?
3121 pEvent[0] = event
3122 State.Events[event] = new!EventObject(device: device)
3123
3124 return ?
3125}
3126
3127@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003128cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003129 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003130 VkEvent event,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003131 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003132 deviceObject := GetDevice(device)
3133 eventObject := GetEvent(event)
3134 assert(eventObject.device == device)
3135
3136 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003137}
3138
3139@threadSafety("system")
3140cmd VkResult vkGetEventStatus(
3141 VkDevice device,
3142 VkEvent event) {
3143 deviceObject := GetDevice(device)
3144 eventObject := GetEvent(event)
3145 assert(eventObject.device == device)
3146
3147 return ?
3148}
3149
3150@threadSafety("system")
3151cmd VkResult vkSetEvent(
3152 VkDevice device,
3153 VkEvent event) {
3154 deviceObject := GetDevice(device)
3155 eventObject := GetEvent(event)
3156 assert(eventObject.device == device)
3157
3158 return ?
3159}
3160
3161@threadSafety("system")
3162cmd VkResult vkResetEvent(
3163 VkDevice device,
3164 VkEvent event) {
3165 deviceObject := GetDevice(device)
3166 eventObject := GetEvent(event)
3167 assert(eventObject.device == device)
3168
3169 return ?
3170}
3171
3172
3173// Query functions
3174
3175@threadSafety("system")
3176cmd VkResult vkCreateQueryPool(
3177 VkDevice device,
3178 const VkQueryPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003179 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003180 VkQueryPool* pQueryPool) {
3181 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
3182 deviceObject := GetDevice(device)
3183
3184 queryPool := ?
3185 pQueryPool[0] = queryPool
3186 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
3187
3188 return ?
3189}
3190
3191@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003192cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003193 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003194 VkQueryPool queryPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003195 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003196 deviceObject := GetDevice(device)
3197 queryPoolObject := GetQueryPool(queryPool)
3198 assert(queryPoolObject.device == device)
3199
3200 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003201}
3202
3203@threadSafety("system")
3204cmd VkResult vkGetQueryPoolResults(
3205 VkDevice device,
3206 VkQueryPool queryPool,
3207 u32 startQuery,
3208 u32 queryCount,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003209 platform.size_t dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003210 void* pData,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003211 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003212 VkQueryResultFlags flags) {
3213 deviceObject := GetDevice(device)
3214 queryPoolObject := GetQueryPool(queryPool)
3215 assert(queryPoolObject.device == device)
3216
Jesse Halld27f6aa2015-08-15 17:58:48 -07003217 data := pData[0:dataSize]
3218
3219 return ?
3220}
3221
3222// Buffer functions
3223
3224@threadSafety("system")
3225cmd VkResult vkCreateBuffer(
3226 VkDevice device,
3227 const VkBufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003228 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003229 VkBuffer* pBuffer) {
3230 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
3231 deviceObject := GetDevice(device)
3232
3233 buffer := ?
3234 pBuffer[0] = buffer
3235 State.Buffers[buffer] = new!BufferObject(device: device)
3236
3237 return ?
3238}
3239
3240@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003241cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003242 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003243 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003244 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003245 deviceObject := GetDevice(device)
3246 bufferObject := GetBuffer(buffer)
3247 assert(bufferObject.device == device)
3248
Jesse Hall3fbc8562015-11-29 22:10:52 -08003249 assert(bufferObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003250 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003251}
3252
3253
3254// Buffer view functions
3255
3256@threadSafety("system")
3257cmd VkResult vkCreateBufferView(
3258 VkDevice device,
3259 const VkBufferViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003260 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003261 VkBufferView* pView) {
3262 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
3263 deviceObject := GetDevice(device)
3264
3265 bufferObject := GetBuffer(pCreateInfo.buffer)
3266 assert(bufferObject.device == device)
3267
3268 view := ?
3269 pView[0] = view
3270 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
3271
3272 return ?
3273}
3274
3275@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003276cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003277 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003278 VkBufferView bufferView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003279 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003280 deviceObject := GetDevice(device)
3281 bufferViewObject := GetBufferView(bufferView)
3282 assert(bufferViewObject.device == device)
3283
3284 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003285}
3286
3287
3288// Image functions
3289
3290@threadSafety("system")
3291cmd VkResult vkCreateImage(
3292 VkDevice device,
3293 const VkImageCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003294 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003295 VkImage* pImage) {
3296 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
3297 deviceObject := GetDevice(device)
3298
3299 image := ?
3300 pImage[0] = image
3301 State.Images[image] = new!ImageObject(device: device)
3302
3303 return ?
3304}
3305
3306@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003307cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003308 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003309 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003310 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003311 deviceObject := GetDevice(device)
3312 imageObject := GetImage(image)
3313 assert(imageObject.device == device)
3314
Jesse Hall3fbc8562015-11-29 22:10:52 -08003315 assert(imageObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003316 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003317}
3318
Jesse Hall606a54e2015-11-19 22:17:28 -08003319cmd void vkGetImageSubresourceLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003320 VkDevice device,
3321 VkImage image,
3322 const VkImageSubresource* pSubresource,
3323 VkSubresourceLayout* pLayout) {
3324 deviceObject := GetDevice(device)
3325 imageObject := GetImage(image)
3326 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003327}
3328
3329
3330// Image view functions
3331
3332@threadSafety("system")
3333cmd VkResult vkCreateImageView(
3334 VkDevice device,
3335 const VkImageViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003336 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003337 VkImageView* pView) {
3338 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
3339 deviceObject := GetDevice(device)
3340
3341 imageObject := GetImage(pCreateInfo.image)
3342 assert(imageObject.device == device)
3343
3344 view := ?
3345 pView[0] = view
3346 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
3347
3348 return ?
3349}
3350
3351@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003352cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003353 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003354 VkImageView imageView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003355 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003356 deviceObject := GetDevice(device)
3357 imageViewObject := GetImageView(imageView)
3358 assert(imageViewObject.device == device)
3359
3360 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003361}
3362
3363
3364// Shader functions
3365
3366cmd VkResult vkCreateShaderModule(
3367 VkDevice device,
3368 const VkShaderModuleCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003369 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003370 VkShaderModule* pShaderModule) {
3371 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
3372 deviceObject := GetDevice(device)
3373
3374 shaderModule := ?
3375 pShaderModule[0] = shaderModule
3376 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
3377
3378 return ?
3379}
3380
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003381cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003382 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003383 VkShaderModule shaderModule,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003384 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003385 deviceObject := GetDevice(device)
3386 shaderModuleObject := GetShaderModule(shaderModule)
3387 assert(shaderModuleObject.device == device)
3388
3389 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003390}
3391
Jesse Halld27f6aa2015-08-15 17:58:48 -07003392
3393// Pipeline functions
3394
3395cmd VkResult vkCreatePipelineCache(
3396 VkDevice device,
3397 const VkPipelineCacheCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003398 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003399 VkPipelineCache* pPipelineCache) {
3400 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
3401 deviceObject := GetDevice(device)
3402
3403 pipelineCache := ?
3404 pPipelineCache[0] = pipelineCache
3405 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
3406
3407 return ?
3408}
3409
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003410cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003411 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003412 VkPipelineCache pipelineCache,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003413 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003414 deviceObject := GetDevice(device)
3415 pipelineCacheObject := GetPipelineCache(pipelineCache)
3416 assert(pipelineCacheObject.device == device)
3417
3418 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003419}
3420
Jesse Halld27f6aa2015-08-15 17:58:48 -07003421cmd VkResult vkGetPipelineCacheData(
3422 VkDevice device,
3423 VkPipelineCache pipelineCache,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003424 platform.size_t* pDataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003425 void* pData) {
3426 deviceObject := GetDevice(device)
3427 pipelineCacheObject := GetPipelineCache(pipelineCache)
3428 assert(pipelineCacheObject.device == device)
3429
3430 return ?
3431}
3432
3433cmd VkResult vkMergePipelineCaches(
3434 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003435 VkPipelineCache dstCache,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003436 u32 srcCacheCount,
3437 const VkPipelineCache* pSrcCaches) {
3438 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003439 dstCacheObject := GetPipelineCache(dstCache)
3440 assert(dstCacheObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003441
3442 srcCaches := pSrcCaches[0:srcCacheCount]
3443 for i in (0 .. srcCacheCount) {
3444 srcCache := srcCaches[i]
3445 srcCacheObject := GetPipelineCache(srcCache)
3446 assert(srcCacheObject.device == device)
3447 }
3448
3449 return ?
3450}
3451
3452cmd VkResult vkCreateGraphicsPipelines(
3453 VkDevice device,
3454 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003455 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003456 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003457 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003458 VkPipeline* pPipelines) {
3459 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003460 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003461 pipelineCacheObject := GetPipelineCache(pipelineCache)
3462 assert(pipelineCacheObject.device == device)
3463 }
3464
Jesse Hall03b6fe12015-11-24 12:44:21 -08003465 createInfos := pCreateInfos[0:createInfoCount]
3466 pipelines := pPipelines[0:createInfoCount]
3467 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003468 pipeline := ?
3469 pipelines[i] = pipeline
3470 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3471 }
3472
3473 return ?
3474}
3475
3476cmd VkResult vkCreateComputePipelines(
3477 VkDevice device,
3478 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003479 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003480 const VkComputePipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003481 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003482 VkPipeline* pPipelines) {
3483 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003484 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003485 pipelineCacheObject := GetPipelineCache(pipelineCache)
3486 assert(pipelineCacheObject.device == device)
3487 }
3488
Jesse Hall03b6fe12015-11-24 12:44:21 -08003489 createInfos := pCreateInfos[0:createInfoCount]
3490 pipelines := pPipelines[0:createInfoCount]
3491 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003492 pipeline := ?
3493 pipelines[i] = pipeline
3494 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3495 }
3496
3497 return ?
3498}
3499
3500@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003501cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003502 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003503 VkPipeline pipeline,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003504 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003505 deviceObject := GetDevice(device)
3506 pipelineObjects := GetPipeline(pipeline)
3507 assert(pipelineObjects.device == device)
3508
3509 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003510}
3511
3512
3513// Pipeline layout functions
3514
3515@threadSafety("system")
3516cmd VkResult vkCreatePipelineLayout(
3517 VkDevice device,
3518 const VkPipelineLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003519 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003520 VkPipelineLayout* pPipelineLayout) {
3521 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3522 deviceObject := GetDevice(device)
3523
3524 pipelineLayout := ?
3525 pPipelineLayout[0] = pipelineLayout
3526 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3527
3528 return ?
3529}
3530
3531@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003532cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003533 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003534 VkPipelineLayout pipelineLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003535 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003536 deviceObject := GetDevice(device)
3537 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3538 assert(pipelineLayoutObjects.device == device)
3539
3540 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003541}
3542
3543
3544// Sampler functions
3545
3546@threadSafety("system")
3547cmd VkResult vkCreateSampler(
3548 VkDevice device,
3549 const VkSamplerCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003550 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003551 VkSampler* pSampler) {
3552 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3553 deviceObject := GetDevice(device)
3554
3555 sampler := ?
3556 pSampler[0] = sampler
3557 State.Samplers[sampler] = new!SamplerObject(device: device)
3558
3559 return ?
3560}
3561
3562@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003563cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003564 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003565 VkSampler sampler,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003566 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003567 deviceObject := GetDevice(device)
3568 samplerObject := GetSampler(sampler)
3569 assert(samplerObject.device == device)
3570
3571 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003572}
3573
3574
3575// Descriptor set functions
3576
3577@threadSafety("system")
3578cmd VkResult vkCreateDescriptorSetLayout(
3579 VkDevice device,
3580 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003581 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003582 VkDescriptorSetLayout* pSetLayout) {
3583 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3584 deviceObject := GetDevice(device)
3585
3586 setLayout := ?
3587 pSetLayout[0] = setLayout
3588 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3589
3590 return ?
3591}
3592
3593@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003594cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003595 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003596 VkDescriptorSetLayout descriptorSetLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003597 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003598 deviceObject := GetDevice(device)
3599 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3600 assert(descriptorSetLayoutObject.device == device)
3601
3602 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003603}
3604
3605@threadSafety("system")
3606cmd VkResult vkCreateDescriptorPool(
3607 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003608 const VkDescriptorPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003609 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003610 VkDescriptorPool* pDescriptorPool) {
3611 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3612 deviceObject := GetDevice(device)
3613
3614 descriptorPool := ?
3615 pDescriptorPool[0] = descriptorPool
3616 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3617
3618 return ?
3619}
3620
3621@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003622cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003623 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003624 VkDescriptorPool descriptorPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003625 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003626 deviceObject := GetDevice(device)
3627 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3628 assert(descriptorPoolObject.device == device)
3629
3630 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003631}
3632
3633@threadSafety("app")
3634cmd VkResult vkResetDescriptorPool(
3635 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003636 VkDescriptorPool descriptorPool,
3637 VkDescriptorPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003638 deviceObject := GetDevice(device)
3639 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3640 assert(descriptorPoolObject.device == device)
3641
3642 return ?
3643}
3644
3645@threadSafety("app")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003646cmd VkResult vkAllocateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003647 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003648 const VkDescriptorSetAllocateInfo* pAllocateInfo,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003649 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003650 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003651 allocInfo := pAllocateInfo[0]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003652 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003653
Jesse Hall03b6fe12015-11-24 12:44:21 -08003654 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount]
3655 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003656 setLayout := setLayouts[i]
3657 setLayoutObject := GetDescriptorSetLayout(setLayout)
3658 assert(setLayoutObject.device == device)
3659 }
3660
Jesse Hall03b6fe12015-11-24 12:44:21 -08003661 descriptorSets := pDescriptorSets[0:allocInfo.setCount]
3662 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003663 descriptorSet := ?
3664 descriptorSets[i] = descriptorSet
3665 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3666 }
3667
3668 return ?
3669}
3670
Jesse Hallf09c6b12015-08-15 19:54:28 -07003671cmd VkResult vkFreeDescriptorSets(
3672 VkDevice device,
3673 VkDescriptorPool descriptorPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003674 u32 descriptorSetCount,
Jesse Hallf09c6b12015-08-15 19:54:28 -07003675 const VkDescriptorSet* pDescriptorSets) {
3676 deviceObject := GetDevice(device)
3677 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3678
Jesse Hall03b6fe12015-11-24 12:44:21 -08003679 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3680 for i in (0 .. descriptorSetCount) {
Jesse Hallf09c6b12015-08-15 19:54:28 -07003681 descriptorSet := descriptorSets[i]
3682 descriptorSetObject := GetDescriptorSet(descriptorSet)
3683 assert(descriptorSetObject.device == device)
3684 State.DescriptorSets[descriptorSet] = null
3685 }
3686
3687 return ?
3688}
3689
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003690cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003691 VkDevice device,
Jesse Hallb00daad2015-11-29 19:46:20 -08003692 u32 descriptorWriteCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003693 const VkWriteDescriptorSet* pDescriptorWrites,
Jesse Hallb00daad2015-11-29 19:46:20 -08003694 u32 descriptorCopyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003695 const VkCopyDescriptorSet* pDescriptorCopies) {
3696 deviceObject := GetDevice(device)
3697
Jesse Hallb00daad2015-11-29 19:46:20 -08003698 descriptorWrites := pDescriptorWrites[0:descriptorWriteCount]
3699 for i in (0 .. descriptorWriteCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003700 descriptorWrite := descriptorWrites[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003701 descriptorWriteObject := GetDescriptorSet(descriptorWrite.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003702 assert(descriptorWriteObject.device == device)
3703 }
3704
Jesse Hallb00daad2015-11-29 19:46:20 -08003705 descriptorCopies := pDescriptorCopies[0:descriptorCopyCount]
3706 for i in (0 .. descriptorCopyCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003707 descriptorCopy := descriptorCopies[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003708 descriptorCopyObject := GetDescriptorSet(descriptorCopy.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003709 assert(descriptorCopyObject.device == device)
3710 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003711}
3712
3713
3714// Framebuffer functions
3715
3716@threadSafety("system")
3717cmd VkResult vkCreateFramebuffer(
3718 VkDevice device,
3719 const VkFramebufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003720 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003721 VkFramebuffer* pFramebuffer) {
3722 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3723 deviceObject := GetDevice(device)
3724
3725 framebuffer := ?
3726 pFramebuffer[0] = framebuffer
3727 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3728
3729 return ?
3730}
3731
3732@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003733cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003734 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003735 VkFramebuffer framebuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003736 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003737 deviceObject := GetDevice(device)
3738 framebufferObject := GetFramebuffer(framebuffer)
3739 assert(framebufferObject.device == device)
3740
3741 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003742}
3743
3744
3745// Renderpass functions
3746
3747@threadSafety("system")
3748cmd VkResult vkCreateRenderPass(
3749 VkDevice device,
3750 const VkRenderPassCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003751 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003752 VkRenderPass* pRenderPass) {
3753 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3754 deviceObject := GetDevice(device)
3755
3756 renderpass := ?
3757 pRenderPass[0] = renderpass
3758 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3759
3760 return ?
3761}
3762
3763@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003764cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003765 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003766 VkRenderPass renderPass,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003767 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003768 deviceObject := GetDevice(device)
3769 renderPassObject := GetRenderPass(renderPass)
3770 assert(renderPassObject.device == device)
3771
3772 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003773}
3774
Jesse Hall606a54e2015-11-19 22:17:28 -08003775cmd void vkGetRenderAreaGranularity(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003776 VkDevice device,
3777 VkRenderPass renderPass,
3778 VkExtent2D* pGranularity) {
3779 deviceObject := GetDevice(device)
3780 renderPassObject := GetRenderPass(renderPass)
3781
3782 granularity := ?
3783 pGranularity[0] = granularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07003784}
3785
3786// Command pool functions
3787
3788cmd VkResult vkCreateCommandPool(
3789 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003790 const VkCommandPoolCreateInfo* pCreateInfo,
3791 const VkAllocationCallbacks* pAllocator,
3792 VkCommandPool* pCommandPool) {
3793 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003794 deviceObject := GetDevice(device)
3795
Jesse Hall3fbc8562015-11-29 22:10:52 -08003796 commandPool := ?
3797 pCommandPool[0] = commandPool
3798 State.CommandPools[commandPool] = new!CommandPoolObject(device: device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003799
3800 return ?
3801}
3802
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003803cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003804 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003805 VkCommandPool commandPool,
3806 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003807 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003808 commandPoolObject := GetCommandPool(commandPool)
3809 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003810
Jesse Hall3fbc8562015-11-29 22:10:52 -08003811 State.CommandPools[commandPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003812}
3813
3814cmd VkResult vkResetCommandPool(
3815 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003816 VkCommandPool commandPool,
3817 VkCommandPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003818 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003819 commandPoolObject := GetCommandPool(commandPool)
3820 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003821
3822 return ?
3823}
3824
3825// Command buffer functions
3826
Jesse Hall3fbc8562015-11-29 22:10:52 -08003827macro void bindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3828 memoryObject := GetDeviceMemory(memory)
3829 memoryObject.boundCommandBuffers[commandBuffer] = commandBuffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07003830
Jesse Hall3fbc8562015-11-29 22:10:52 -08003831 commandBufferObject := GetCommandBuffer(commandBuffer)
3832 commandBufferObject.boundObjects[as!u64(obj)] = memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07003833}
3834
Jesse Hall3fbc8562015-11-29 22:10:52 -08003835macro void unbindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3836 memoryObject := GetDeviceMemory(memory)
3837 memoryObject.boundCommandBuffers[commandBuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003838
Jesse Hall3fbc8562015-11-29 22:10:52 -08003839 commandBufferObject := GetCommandBuffer(commandBuffer)
3840 commandBufferObject.boundObjects[as!u64(obj)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003841}
3842
3843@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003844cmd VkResult vkAllocateCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003845 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003846 const VkCommandBufferAllocateInfo* pAllocateInfo,
3847 VkCommandBuffer* pCommandBuffers) {
Jesse Hallf4ab2b12015-11-30 16:04:55 -08003848 assert(pAllocateInfo[0].sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003849
Jesse Hall3fbc8562015-11-29 22:10:52 -08003850 count := pAllocateInfo[0].bufferCount
3851 commandBuffers := pCommandBuffers[0:count]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003852 for i in (0 .. count) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003853 commandBuffer := ?
3854 commandBuffers[i] = commandBuffer
3855 State.CommandBuffers[commandBuffer] = new!CommandBufferObject(device: device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003856 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003857
3858 return ?
3859}
3860
3861@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003862cmd void vkFreeCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003863 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003864 VkCommandPool commandPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003865 u32 commandBufferCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003866 const VkCommandBuffer* pCommandBuffers) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003867 deviceObject := GetDevice(device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003868
Jesse Hall3fbc8562015-11-29 22:10:52 -08003869 commandBuffers := pCommandBuffers[0:commandBufferCount]
Jesse Hall03b6fe12015-11-24 12:44:21 -08003870 for i in (0 .. commandBufferCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003871 commandBufferObject := GetCommandBuffer(commandBuffers[i])
3872 assert(commandBufferObject.device == device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003873 // TODO: iterate over boundObjects and clear memory bindings
Jesse Hall3fbc8562015-11-29 22:10:52 -08003874 State.CommandBuffers[commandBuffers[i]] = null
Jesse Hallfbf97b02015-11-20 14:17:03 -08003875 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003876}
3877
3878@threadSafety("app")
3879cmd VkResult vkBeginCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003880 VkCommandBuffer commandBuffer,
3881 const VkCommandBufferBeginInfo* pBeginInfo) {
3882 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO)
3883 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003884
3885 // TODO: iterate over boundObjects and clear memory bindings
3886
3887 return ?
3888}
3889
3890@threadSafety("app")
3891cmd VkResult vkEndCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003892 VkCommandBuffer commandBuffer) {
3893 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003894
3895 return ?
3896}
3897
3898@threadSafety("app")
3899cmd VkResult vkResetCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003900 VkCommandBuffer commandBuffer,
3901 VkCommandBufferResetFlags flags) {
3902 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003903
3904 // TODO: iterate over boundObjects and clear memory bindings
3905
3906 return ?
3907}
3908
3909
3910// Command buffer building functions
3911
3912@threadSafety("app")
3913cmd void vkCmdBindPipeline(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003914 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003915 VkPipelineBindPoint pipelineBindPoint,
3916 VkPipeline pipeline) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003917 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003918 pipelineObject := GetPipeline(pipeline)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003919 assert(commandBufferObject.device == pipelineObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003920
Jesse Halld8bade02015-11-24 10:24:18 -08003921 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003922 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3923 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3924 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08003925 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003926}
3927
3928@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003929cmd void vkCmdSetViewport(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003930 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003931 u32 viewportCount,
3932 const VkViewport* pViewports) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003933 commandBufferObject := GetCommandBuffer(commandBuffer)
3934 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003935}
3936
3937@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003938cmd void vkCmdSetScissor(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003939 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003940 u32 scissorCount,
3941 const VkRect2D* pScissors) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003942 commandBufferObject := GetCommandBuffer(commandBuffer)
3943 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003944}
3945
3946@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003947cmd void vkCmdSetLineWidth(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003948 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003949 f32 lineWidth) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003950 commandBufferObject := GetCommandBuffer(commandBuffer)
3951 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003952}
3953
3954@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003955cmd void vkCmdSetDepthBias(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003956 VkCommandBuffer commandBuffer,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003957 f32 depthBiasConstantFactor,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003958 f32 depthBiasClamp,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003959 f32 depthBiasSlopeFactor) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003960 commandBufferObject := GetCommandBuffer(commandBuffer)
3961 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003962}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003963
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003964@threadSafety("app")
3965cmd void vkCmdSetBlendConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003966 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003967 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3968 // an annotation as a quick hack to pass this to the template without
3969 // having to modify the AST and semantic model.
Jesse Hallb00daad2015-11-29 19:46:20 -08003970 @readonly f32[4] blendConstants) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003971 commandBufferObject := GetCommandBuffer(commandBuffer)
3972 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003973}
3974
3975@threadSafety("app")
3976cmd void vkCmdSetDepthBounds(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003977 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003978 f32 minDepthBounds,
3979 f32 maxDepthBounds) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003980 commandBufferObject := GetCommandBuffer(commandBuffer)
3981 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003982}
3983
3984@threadSafety("app")
3985cmd void vkCmdSetStencilCompareMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003986 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003987 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08003988 u32 compareMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003989 commandBufferObject := GetCommandBuffer(commandBuffer)
3990 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003991}
3992
3993@threadSafety("app")
3994cmd void vkCmdSetStencilWriteMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003995 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003996 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08003997 u32 writeMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003998 commandBufferObject := GetCommandBuffer(commandBuffer)
3999 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004000}
4001
4002@threadSafety("app")
4003cmd void vkCmdSetStencilReference(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004004 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004005 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08004006 u32 reference) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004007 commandBufferObject := GetCommandBuffer(commandBuffer)
4008 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004009}
4010
4011@threadSafety("app")
4012cmd void vkCmdBindDescriptorSets(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004013 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004014 VkPipelineBindPoint pipelineBindPoint,
4015 VkPipelineLayout layout,
4016 u32 firstSet,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004017 u32 descriptorSetCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004018 const VkDescriptorSet* pDescriptorSets,
4019 u32 dynamicOffsetCount,
4020 const u32* pDynamicOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004021 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004022
Jesse Hall03b6fe12015-11-24 12:44:21 -08004023 descriptorSets := pDescriptorSets[0:descriptorSetCount]
4024 for i in (0 .. descriptorSetCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004025 descriptorSet := descriptorSets[i]
4026 descriptorSetObject := GetDescriptorSet(descriptorSet)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004027 assert(commandBufferObject.device == descriptorSetObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004028 }
4029
4030 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
4031 for i in (0 .. dynamicOffsetCount) {
4032 dynamicOffset := dynamicOffsets[i]
4033 }
4034
Jesse Halld8bade02015-11-24 10:24:18 -08004035 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004036 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
4037 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
4038 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08004039 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004040}
4041
4042@threadSafety("app")
4043cmd void vkCmdBindIndexBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004044 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004045 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004046 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004047 VkIndexType indexType) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004048 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004049 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004050 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004051
Jesse Hall3fbc8562015-11-29 22:10:52 -08004052 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004053
Jesse Hall3fbc8562015-11-29 22:10:52 -08004054 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004055}
4056
4057@threadSafety("app")
4058cmd void vkCmdBindVertexBuffers(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004059 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004060 u32 startBinding,
4061 u32 bindingCount,
4062 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004063 const VkDeviceSize* pOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004064 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004065
4066 // TODO: check if not [startBinding:startBinding+bindingCount]
4067 buffers := pBuffers[0:bindingCount]
4068 offsets := pOffsets[0:bindingCount]
4069 for i in (0 .. bindingCount) {
4070 buffer := buffers[i]
4071 offset := offsets[i]
4072 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004073 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004074
Jesse Hall3fbc8562015-11-29 22:10:52 -08004075 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004076 }
4077
Jesse Hall3fbc8562015-11-29 22:10:52 -08004078 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004079}
4080
4081@threadSafety("app")
4082cmd void vkCmdDraw(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004083 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004084 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004085 u32 instanceCount,
4086 u32 firstVertex,
4087 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004088 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004089
Jesse Hall3fbc8562015-11-29 22:10:52 -08004090 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004091}
4092
4093@threadSafety("app")
4094cmd void vkCmdDrawIndexed(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004095 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004096 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004097 u32 instanceCount,
4098 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004099 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004100 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004101 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004102
Jesse Hall3fbc8562015-11-29 22:10:52 -08004103 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004104}
4105
4106@threadSafety("app")
4107cmd void vkCmdDrawIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004108 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004109 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004110 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004111 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004112 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004113 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004114 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004115 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004116
Jesse Hall3fbc8562015-11-29 22:10:52 -08004117 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004118
Jesse Hall3fbc8562015-11-29 22:10:52 -08004119 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004120}
4121
4122@threadSafety("app")
4123cmd void vkCmdDrawIndexedIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004124 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004125 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004126 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004127 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004128 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004129 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004130 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004131 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004132
Jesse Hall3fbc8562015-11-29 22:10:52 -08004133 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004134
Jesse Hall3fbc8562015-11-29 22:10:52 -08004135 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004136}
4137
4138@threadSafety("app")
4139cmd void vkCmdDispatch(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004140 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004141 u32 x,
4142 u32 y,
4143 u32 z) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004144 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004145
Jesse Hall3fbc8562015-11-29 22:10:52 -08004146 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004147}
4148
4149@threadSafety("app")
4150cmd void vkCmdDispatchIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004151 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004152 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004153 VkDeviceSize offset) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004154 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004155 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004156 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004157
Jesse Hall3fbc8562015-11-29 22:10:52 -08004158 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004159
Jesse Hall3fbc8562015-11-29 22:10:52 -08004160 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004161}
4162
4163@threadSafety("app")
4164cmd void vkCmdCopyBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004165 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004166 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004167 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004168 u32 regionCount,
4169 const VkBufferCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004170 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004171 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004172 dstBufferObject := GetBuffer(dstBuffer)
4173 assert(commandBufferObject.device == srcBufferObject.device)
4174 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004175
4176 regions := pRegions[0:regionCount]
4177 for i in (0 .. regionCount) {
4178 region := regions[i]
4179 }
4180
Jesse Hall3fbc8562015-11-29 22:10:52 -08004181 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4182 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004183
Jesse Hall65ab5522015-11-30 00:07:16 -08004184 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004185}
4186
4187@threadSafety("app")
4188cmd void vkCmdCopyImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004189 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004190 VkImage srcImage,
4191 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004192 VkImage dstImage,
4193 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004194 u32 regionCount,
4195 const VkImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004196 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004197 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004198 dstImageObject := GetImage(dstImage)
4199 assert(commandBufferObject.device == srcImageObject.device)
4200 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004201
4202 regions := pRegions[0:regionCount]
4203 for i in (0 .. regionCount) {
4204 region := regions[i]
4205 }
4206
Jesse Hall3fbc8562015-11-29 22:10:52 -08004207 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4208 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004209
Jesse Hall65ab5522015-11-30 00:07:16 -08004210 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004211}
4212
4213@threadSafety("app")
4214cmd void vkCmdBlitImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004215 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004216 VkImage srcImage,
4217 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004218 VkImage dstImage,
4219 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004220 u32 regionCount,
4221 const VkImageBlit* pRegions,
Jesse Hall23ff73f2015-11-29 14:36:39 -08004222 VkFilter filter) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004223 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004224 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004225 dstImageObject := GetImage(dstImage)
4226 assert(commandBufferObject.device == srcImageObject.device)
4227 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004228
4229 regions := pRegions[0:regionCount]
4230 for i in (0 .. regionCount) {
4231 region := regions[i]
4232 }
4233
Jesse Hall3fbc8562015-11-29 22:10:52 -08004234 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4235 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004236
Jesse Hall3fbc8562015-11-29 22:10:52 -08004237 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004238}
4239
4240@threadSafety("app")
4241cmd void vkCmdCopyBufferToImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004242 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004243 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004244 VkImage dstImage,
4245 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004246 u32 regionCount,
4247 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004248 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004249 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004250 dstImageObject := GetImage(dstImage)
4251 assert(commandBufferObject.device == srcBufferObject.device)
4252 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004253
4254 regions := pRegions[0:regionCount]
4255 for i in (0 .. regionCount) {
4256 region := regions[i]
4257 }
4258
Jesse Hall3fbc8562015-11-29 22:10:52 -08004259 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4260 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004261
Jesse Hall65ab5522015-11-30 00:07:16 -08004262 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004263}
4264
4265@threadSafety("app")
4266cmd void vkCmdCopyImageToBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004267 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004268 VkImage srcImage,
4269 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004270 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004271 u32 regionCount,
4272 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004273 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004274 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004275 dstBufferObject := GetBuffer(dstBuffer)
4276 assert(commandBufferObject.device == srcImageObject.device)
4277 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004278
4279 regions := pRegions[0:regionCount]
4280 for i in (0 .. regionCount) {
4281 region := regions[i]
4282 }
4283
Jesse Hall3fbc8562015-11-29 22:10:52 -08004284 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4285 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004286
Jesse Hall65ab5522015-11-30 00:07:16 -08004287 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004288}
4289
4290@threadSafety("app")
4291cmd void vkCmdUpdateBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004292 VkCommandBuffer commandBuffer,
4293 VkBuffer dstBuffer,
4294 VkDeviceSize dstOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004295 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004296 const u32* pData) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004297 commandBufferObject := GetCommandBuffer(commandBuffer)
4298 dstBufferObject := GetBuffer(dstBuffer)
4299 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004300
4301 data := pData[0:dataSize]
4302
Jesse Hall3fbc8562015-11-29 22:10:52 -08004303 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004304
Jesse Hall65ab5522015-11-30 00:07:16 -08004305 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004306}
4307
4308@threadSafety("app")
4309cmd void vkCmdFillBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004310 VkCommandBuffer commandBuffer,
4311 VkBuffer dstBuffer,
4312 VkDeviceSize dstOffset,
Jesse Hallb00daad2015-11-29 19:46:20 -08004313 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004314 u32 data) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004315 commandBufferObject := GetCommandBuffer(commandBuffer)
4316 dstBufferObject := GetBuffer(dstBuffer)
4317 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004318
Jesse Hall65ab5522015-11-30 00:07:16 -08004319 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004320}
4321
4322@threadSafety("app")
4323cmd void vkCmdClearColorImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004324 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004325 VkImage image,
4326 VkImageLayout imageLayout,
4327 const VkClearColorValue* pColor,
4328 u32 rangeCount,
4329 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004330 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004331 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004332 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004333
4334 ranges := pRanges[0:rangeCount]
4335 for i in (0 .. rangeCount) {
4336 range := ranges[i]
4337 }
4338
Jesse Hall3fbc8562015-11-29 22:10:52 -08004339 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004340
Jesse Hall3fbc8562015-11-29 22:10:52 -08004341 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004342}
4343
4344@threadSafety("app")
4345cmd void vkCmdClearDepthStencilImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004346 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004347 VkImage image,
4348 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004349 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004350 u32 rangeCount,
4351 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004352 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004353 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004354 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004355
4356 ranges := pRanges[0:rangeCount]
4357 for i in (0 .. rangeCount) {
4358 range := ranges[i]
4359 }
4360
Jesse Hall3fbc8562015-11-29 22:10:52 -08004361 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004362
Jesse Hall3fbc8562015-11-29 22:10:52 -08004363 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004364}
4365
4366@threadSafety("app")
Jesse Hallae38f732015-11-19 21:32:50 -08004367cmd void vkCmdClearAttachments(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004368 VkCommandBuffer commandBuffer,
Jesse Hallae38f732015-11-19 21:32:50 -08004369 u32 attachmentCount,
4370 const VkClearAttachment* pAttachments,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004371 u32 rectCount,
Jesse Halla15a4bf2015-11-19 22:48:02 -08004372 const VkClearRect* pRects) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004373 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004374
4375 rects := pRects[0:rectCount]
4376 for i in (0 .. rectCount) {
4377 rect := rects[i]
4378 }
4379
Jesse Hall3fbc8562015-11-29 22:10:52 -08004380 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004381}
4382
4383@threadSafety("app")
4384cmd void vkCmdResolveImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004385 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004386 VkImage srcImage,
4387 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004388 VkImage dstImage,
4389 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004390 u32 regionCount,
4391 const VkImageResolve* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004392 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004393 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004394 dstImageObject := GetImage(dstImage)
4395 assert(commandBufferObject.device == srcImageObject.device)
4396 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004397
4398 regions := pRegions[0:regionCount]
4399 for i in (0 .. regionCount) {
4400 region := regions[i]
4401 }
4402
Jesse Hall3fbc8562015-11-29 22:10:52 -08004403 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4404 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004405
Jesse Hall3fbc8562015-11-29 22:10:52 -08004406 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004407}
4408
4409@threadSafety("app")
4410cmd void vkCmdSetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004411 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004412 VkEvent event,
4413 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004414 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004415 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004416 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004417}
4418
4419@threadSafety("app")
4420cmd void vkCmdResetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004421 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004422 VkEvent event,
4423 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004424 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004425 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004426 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004427}
4428
4429@threadSafety("app")
4430cmd void vkCmdWaitEvents(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004431 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004432 u32 eventCount,
4433 const VkEvent* pEvents,
4434 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004435 VkPipelineStageFlags dstStageMask,
4436 u32 memoryBarrierCount,
4437 const void* const* ppMemoryBarriers) {
4438 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004439
4440 events := pEvents[0:eventCount]
4441 for i in (0 .. eventCount) {
4442 event := events[i]
4443 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004444 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004445 }
4446
Jesse Hall3fbc8562015-11-29 22:10:52 -08004447 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4448 for i in (0 .. memoryBarrierCount) {
4449 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004450 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004451 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004452 }
4453 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004454 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4455 imageObject := GetImage(imageMemoryBarrier.image)
4456 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004457 }
4458 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004459 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4460 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4461 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004462 }
4463 }
4464 }
4465}
4466
4467@threadSafety("app")
4468cmd void vkCmdPipelineBarrier(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004469 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004470 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004471 VkPipelineStageFlags dstStageMask,
Jesse Halldc6d36c2015-11-29 19:12:15 -08004472 VkDependencyFlags dependencyFlags,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004473 u32 memoryBarrierCount,
4474 const void* const* ppMemoryBarriers) {
4475 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004476
Jesse Hall3fbc8562015-11-29 22:10:52 -08004477 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4478 for i in (0 .. memoryBarrierCount) {
4479 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004480 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004481 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004482 }
4483 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004484 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4485 imageObject := GetImage(imageMemoryBarrier.image)
4486 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004487 }
4488 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004489 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4490 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4491 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004492 }
4493 }
4494 }
4495}
4496
4497@threadSafety("app")
4498cmd void vkCmdBeginQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004499 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004500 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004501 u32 entry,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004502 VkQueryControlFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004503 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004504 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004505 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004506}
4507
4508@threadSafety("app")
4509cmd void vkCmdEndQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004510 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004511 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004512 u32 entry) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004513 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004514 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004515 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004516}
4517
4518@threadSafety("app")
4519cmd void vkCmdResetQueryPool(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004520 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004521 VkQueryPool queryPool,
4522 u32 startQuery,
4523 u32 queryCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004524 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004525 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004526 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004527}
4528
4529@threadSafety("app")
4530cmd void vkCmdWriteTimestamp(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004531 VkCommandBuffer commandBuffer,
Jesse Hall6f39a6d2015-11-24 11:08:36 -08004532 VkPipelineStageFlagBits pipelineStage,
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004533 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004534 u32 entry) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004535 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004536 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004537 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004538}
4539
4540@threadSafety("app")
4541cmd void vkCmdCopyQueryPoolResults(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004542 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004543 VkQueryPool queryPool,
4544 u32 startQuery,
4545 u32 queryCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004546 VkBuffer dstBuffer,
4547 VkDeviceSize dstOffset,
Jesse Halla9bb62b2015-11-21 19:31:56 -08004548 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004549 VkQueryResultFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004550 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004551 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004552 dstBufferObject := GetBuffer(dstBuffer)
4553 assert(commandBufferObject.device == queryPoolObject.device)
4554 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004555}
4556
4557cmd void vkCmdPushConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004558 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004559 VkPipelineLayout layout,
4560 VkShaderStageFlags stageFlags,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004561 u32 offset,
4562 u32 size,
Jesse Hallf4ab2b12015-11-30 16:04:55 -08004563 const void* pValues) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004564 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004565 layoutObject := GetPipelineLayout(layout)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004566 assert(commandBufferObject.device == layoutObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004567}
4568
4569@threadSafety("app")
4570cmd void vkCmdBeginRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004571 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004572 const VkRenderPassBeginInfo* pRenderPassBegin,
Jesse Hall65ab5522015-11-30 00:07:16 -08004573 VkSubpassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004574 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004575 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4576 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004577 assert(commandBufferObject.device == renderPassObject.device)
4578 assert(commandBufferObject.device == framebufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004579
Jesse Hall3fbc8562015-11-29 22:10:52 -08004580 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004581}
4582
4583cmd void vkCmdNextSubpass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004584 VkCommandBuffer commandBuffer,
Jesse Hall65ab5522015-11-30 00:07:16 -08004585 VkSubpassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004586 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004587}
4588
4589@threadSafety("app")
4590cmd void vkCmdEndRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004591 VkCommandBuffer commandBuffer) {
4592 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004593
Jesse Hall3fbc8562015-11-29 22:10:52 -08004594 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004595}
4596
4597cmd void vkCmdExecuteCommands(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004598 VkCommandBuffer commandBuffer,
4599 u32 commandBuffersCount,
4600 const VkCommandBuffer* pCommandBuffers) {
4601 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004602
Jesse Hall3fbc8562015-11-29 22:10:52 -08004603 commandBuffers := pCommandBuffers[0:commandBuffersCount]
4604 for i in (0 .. commandBuffersCount) {
4605 secondaryCommandBuffer := commandBuffers[i]
4606 secondaryCommandBufferObject := GetCommandBuffer(secondaryCommandBuffer)
4607 assert(commandBufferObject.device == secondaryCommandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004608 }
4609}
4610
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004611@extension("VK_KHR_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004612cmd void vkDestroySurfaceKHR(
4613 VkInstance instance,
Jesse Hall0e74f002015-11-30 11:37:59 -08004614 VkSurfaceKHR surface,
4615 const VkAllocationCallbacks* pAllocator) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004616 instanceObject := GetInstance(instance)
4617 surfaceObject := GetSurface(surface)
4618 assert(surfaceObject.instance == instance)
Michael Lentine88594d72015-11-12 12:49:45 -08004619
Jesse Hall1356b0d2015-11-23 17:24:58 -08004620 State.Surfaces[surface] = null
Jesse Hall2818f932015-11-19 21:19:17 -08004621}
4622
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004623@extension("VK_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004624cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004625 VkPhysicalDevice physicalDevice,
4626 u32 queueFamilyIndex,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004627 VkSurfaceKHR surface,
Jesse Hallb00daad2015-11-29 19:46:20 -08004628 VkBool32* pSupported) {
4629 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004630
4631 return ?
4632}
4633
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004634@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004635cmd VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
4636 VkPhysicalDevice physicalDevice,
4637 VkSurfaceKHR surface,
4638 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
4639 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4640
4641 surfaceCapabilities := ?
4642 pSurfaceCapabilities[0] = surfaceCapabilities
4643
4644 return ?
4645}
4646
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004647@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004648cmd VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(
4649 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004650 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004651 u32* pSurfaceFormatCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004652 VkSurfaceFormatKHR* pSurfaceFormats) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004653 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004654
4655 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004656 pSurfaceFormatCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004657 surfaceFormats := pSurfaceFormats[0:count]
4658
4659 for i in (0 .. count) {
4660 surfaceFormat := ?
4661 surfaceFormats[i] = surfaceFormat
4662 }
4663
4664 return ?
4665}
4666
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004667@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004668cmd VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(
4669 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004670 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004671 u32* pPresentModeCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004672 VkPresentModeKHR* pPresentModes) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004673 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004674
4675 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004676 pPresentModeCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004677 presentModes := pPresentModes[0:count]
4678
4679 for i in (0 .. count) {
4680 presentMode := ?
4681 presentModes[i] = presentMode
4682 }
4683
4684 return ?
4685}
4686
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004687@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004688cmd VkResult vkCreateSwapchainKHR(
4689 VkDevice device,
4690 const VkSwapchainCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004691 const VkAllocationCallbacks* pAllocator,
Michael Lentine88594d72015-11-12 12:49:45 -08004692 VkSwapchainKHR* pSwapchain) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004693 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
Michael Lentine88594d72015-11-12 12:49:45 -08004694 deviceObject := GetDevice(device)
4695
4696 swapchain := ?
4697 pSwapchain[0] = swapchain
4698 State.Swapchains[swapchain] = new!SwapchainObject(device: device)
4699
4700 return ?
4701}
4702
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004703@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004704cmd void vkDestroySwapchainKHR(
Michael Lentine88594d72015-11-12 12:49:45 -08004705 VkDevice device,
Jesse Hall0e74f002015-11-30 11:37:59 -08004706 VkSwapchainKHR swapchain,
4707 const VkAllocationCallbacks* pAllocator) {
Michael Lentine88594d72015-11-12 12:49:45 -08004708 deviceObject := GetDevice(device)
4709 swapchainObject := GetSwapchain(swapchain)
4710 assert(swapchainObject.device == device)
4711
4712 State.Swapchains[swapchain] = null
Michael Lentine88594d72015-11-12 12:49:45 -08004713}
4714
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004715@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004716cmd VkResult vkGetSwapchainImagesKHR(
4717 VkDevice device,
4718 VkSwapchainKHR swapchain,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004719 u32* pSwapchainImageCount,
Michael Lentine88594d72015-11-12 12:49:45 -08004720 VkImage* pSwapchainImages) {
4721 deviceObject := GetDevice(device)
4722
4723 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004724 pSwapchainImageCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004725 swapchainImages := pSwapchainImages[0:count]
4726
4727 for i in (0 .. count) {
4728 swapchainImage := ?
4729 swapchainImages[i] = swapchainImage
Jesse Hall1356b0d2015-11-23 17:24:58 -08004730 State.Images[swapchainImage] = new!ImageObject(device: device)
Michael Lentine88594d72015-11-12 12:49:45 -08004731 }
4732
4733 return ?
4734}
4735
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004736@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004737cmd VkResult vkAcquireNextImageKHR(
4738 VkDevice device,
4739 VkSwapchainKHR swapchain,
4740 u64 timeout,
4741 VkSemaphore semaphore,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004742 VkFence fence,
Michael Lentine88594d72015-11-12 12:49:45 -08004743 u32* pImageIndex) {
4744 deviceObject := GetDevice(device)
4745 swapchainObject := GetSwapchain(swapchain)
4746
4747 imageIndex := ?
4748 pImageIndex[0] = imageIndex
4749
4750 return ?
4751}
4752
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004753@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004754cmd VkResult vkQueuePresentKHR(
4755 VkQueue queue,
Jesse Hallf4ab2b12015-11-30 16:04:55 -08004756 const VkPresentInfoKHR* pPresentInfo) {
Michael Lentine88594d72015-11-12 12:49:45 -08004757 queueObject := GetQueue(queue)
4758
4759 presentInfo := ?
4760 pPresentInfo[0] = presentInfo
4761
4762 return ?
4763}
4764
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004765@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004766cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
4767 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004768 u32* pPropertyCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004769 VkDisplayPropertiesKHR* pProperties) {
4770 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4771 return ?
4772}
4773
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004774@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004775cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
4776 VkPhysicalDevice physicalDevice,
4777 u32* pPropertyCount,
4778 VkDisplayPlanePropertiesKHR* pProperties) {
4779 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4780 return ?
4781}
4782
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004783@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004784cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR(
4785 VkPhysicalDevice physicalDevice,
Jesse Hallf4ab2b12015-11-30 16:04:55 -08004786 u32* pDisplayCount,
4787 VkDisplayKHR* pDisplays) {
Jesse Halla6429252015-11-29 18:59:42 -08004788 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4789 return ?
4790}
4791
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004792@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004793cmd VkResult vkGetDisplayModePropertiesKHR(
4794 VkPhysicalDevice physicalDevice,
4795 VkDisplayKHR display,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004796 u32* pPropertyCount,
4797 VkDisplayModePropertiesKHR* pProperties) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004798 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4799 return ?
4800}
4801
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004802@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004803cmd VkResult vkCreateDisplayModeKHR(
4804 VkPhysicalDevice physicalDevice,
4805 VkDisplayKHR display,
4806 const VkDisplayModeCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004807 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004808 VkDisplayModeKHR* pMode) {
4809 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4810 return ?
4811}
4812
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004813@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004814cmd VkResult vkGetDisplayPlaneCapabilitiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004815 VkPhysicalDevice physicalDevice,
Jesse Hall9ba8bc82015-11-30 16:22:16 -08004816 VkDisplayModeKHR mode,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004817 u32 planeIndex,
Jesse Halla6429252015-11-29 18:59:42 -08004818 VkDisplayPlaneCapabilitiesKHR* pCapabilities) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004819 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4820 return ?
4821}
4822
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004823@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004824cmd VkResult vkCreateDisplayPlaneSurfaceKHR(
4825 VkInstance instance,
4826 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004827 const VkAllocationCallbacks* pAllocator,
Jesse Halla6429252015-11-29 18:59:42 -08004828 VkSurfaceKHR* pSurface) {
4829 return ?
4830}
4831
Jesse Hall9ba8bc82015-11-30 16:22:16 -08004832@extension("VK_KHR_display_swapchain")
4833cmd VkResult vkCreateSharedSwapchainsKHR(
4834 VkDevice device,
4835 u32 swapchainCount,
4836 const VkSwapchainCreateInfoKHR* pCreateInfos,
4837 const VkAllocationCallbacks* pAllocator,
4838 VkSwapchainKHR* pSwapchains) {
4839 return ?
4840}
4841
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004842@extension("VK_KHR_xlib_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004843cmd VkResult vkCreateXlibSurfaceKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004844 VkInstance instance,
4845 platform.Display* dpy,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004846 platform.Window window,
Jesse Hall0e74f002015-11-30 11:37:59 -08004847 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004848 VkSurfaceKHR* pSurface) {
4849 instanceObject := GetInstance(instance)
4850 return ?
4851}
4852
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004853@extension("VK_KHR_xlib_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004854cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
4855 VkPhysicalDevice physicalDevice,
4856 u32 queueFamilyIndex,
4857 platform.Display* dpy,
Jesse Hall65ab5522015-11-30 00:07:16 -08004858 platform.VisualID visualID) {
Jesse Halla6429252015-11-29 18:59:42 -08004859 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4860 return ?
4861}
4862
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004863@extension("VK_KHR_xcb_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004864cmd VkResult vkCreateXCBSurfaceKHR(
4865 VkInstance instance,
4866 platform.xcb_connection_t* connection,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004867 platform.xcb_window_t window,
Jesse Hall0e74f002015-11-30 11:37:59 -08004868 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004869 VkSurfaceKHR* pSurface) {
4870 instanceObject := GetInstance(instance)
4871 return ?
4872}
4873
Jesse Hall523db342015-11-30 21:12:55 -08004874@extension("VK_KHR_xcb_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004875cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
4876 VkPhysicalDevice physicalDevice,
4877 u32 queueFamilyIndex,
4878 platform.xcb_connection_t* connection,
4879 platform.xcb_visualid_t visual_id) {
4880 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4881 return ?
4882}
4883
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004884@extension("VK_KHR_wayland_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004885cmd VkResult vkCreateWaylandSurfaceKHR(
4886 VkInstance instance,
4887 platform.wl_display* display,
4888 platform.wl_surface* surface,
Jesse Hall0e74f002015-11-30 11:37:59 -08004889 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004890 VkSurfaceKHR* pSurface) {
4891 instanceObject := GetInstance(instance)
4892 return ?
4893}
4894
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004895@extension("VK_KHR_wayland_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004896cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
4897 VkPhysicalDevice physicalDevice,
4898 u32 queueFamilyIndex,
4899 platform.wl_display* display) {
4900 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4901 return ?
4902}
4903
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004904@extension("VK_KHR_mir_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004905cmd VkResult vkCreateMirSurfaceKHR(
4906 VkInstance instance,
4907 platform.MirConnection* connection,
4908 platform.MirSurface* mirSurface,
Jesse Hall0e74f002015-11-30 11:37:59 -08004909 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004910 VkSurfaceKHR* pSurface) {
4911 instanceObject := GetInstance(instance)
4912 return ?
4913}
4914
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004915@extension("VK_KHR_mir_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004916cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR(
4917 VkPhysicalDevice physicalDevice,
4918 u32 queueFamilyIndex,
4919 platform.MirConnection* connection) {
4920 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4921 return ?
4922}
4923
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004924@extension("VK_KHR_android_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004925cmd VkResult vkCreateAndroidSurfaceKHR(
4926 VkInstance instance,
Jesse Hall0e74f002015-11-30 11:37:59 -08004927 platform.ANativeWindow* window,
4928 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004929 VkSurfaceKHR* pSurface) {
4930 instanceObject := GetInstance(instance)
4931 return ?
4932}
4933
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004934@extension("VK_KHR_win32_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004935cmd VkResult vkCreateWin32SurfaceKHR(
4936 VkInstance instance,
4937 platform.HINSTANCE hinstance,
4938 platform.HWND hwnd,
Jesse Hall0e74f002015-11-30 11:37:59 -08004939 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004940 VkSurfaceKHR* pSurface) {
4941 instanceObject := GetInstance(instance)
4942 return ?
4943}
4944
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004945@extension("VK_KHR_win32_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004946cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR(
4947 VkPhysicalDevice physicalDevice,
4948 u32 queueFamilyIndex) {
4949 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4950 return ?
4951}
4952
Jesse Halld27f6aa2015-08-15 17:58:48 -07004953
4954////////////////
4955// Validation //
4956////////////////
4957
4958extern void validate(string layerName, bool condition, string message)
4959
4960
4961/////////////////////////////
4962// Internal State Tracking //
4963/////////////////////////////
4964
4965StateObject State
4966
4967@internal class StateObject {
4968 // Dispatchable objects.
4969 map!(VkInstance, ref!InstanceObject) Instances
4970 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4971 map!(VkDevice, ref!DeviceObject) Devices
4972 map!(VkQueue, ref!QueueObject) Queues
Jesse Hall3fbc8562015-11-29 22:10:52 -08004973 map!(VkCommandBuffer, ref!CommandBufferObject) CommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07004974
4975 // Non-dispatchable objects.
4976 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4977 map!(VkBuffer, ref!BufferObject) Buffers
4978 map!(VkBufferView, ref!BufferViewObject) BufferViews
4979 map!(VkImage, ref!ImageObject) Images
4980 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004981 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
Jesse Halld27f6aa2015-08-15 17:58:48 -07004982 map!(VkPipeline, ref!PipelineObject) Pipelines
4983 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4984 map!(VkSampler, ref!SamplerObject) Samplers
4985 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4986 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4987 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004988 map!(VkFence, ref!FenceObject) Fences
4989 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4990 map!(VkEvent, ref!EventObject) Events
4991 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4992 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4993 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4994 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
Jesse Hall3fbc8562015-11-29 22:10:52 -08004995 map!(VkCommandPool, ref!CommandPoolObject) CommandPools
Jesse Hall1356b0d2015-11-23 17:24:58 -08004996 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces
Michael Lentine88594d72015-11-12 12:49:45 -08004997 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains
Jesse Halld27f6aa2015-08-15 17:58:48 -07004998}
4999
5000@internal class InstanceObject {
5001}
5002
5003@internal class PhysicalDeviceObject {
5004 VkInstance instance
5005}
5006
5007@internal class DeviceObject {
5008 VkPhysicalDevice physicalDevice
5009}
5010
5011@internal class QueueObject {
5012 VkDevice device
5013 VkQueueFlags flags
5014}
5015
Jesse Hall3fbc8562015-11-29 22:10:52 -08005016@internal class CommandBufferObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07005017 VkDevice device
5018 map!(u64, VkDeviceMemory) boundObjects
5019 VkQueueFlags queueFlags
5020}
5021
5022@internal class DeviceMemoryObject {
Jesse Hall3fbc8562015-11-29 22:10:52 -08005023 VkDevice device
5024 VkDeviceSize allocationSize
5025 map!(u64, VkDeviceSize) boundObjects
5026 map!(VkCommandBuffer, VkCommandBuffer) boundCommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07005027}
5028
5029@internal class BufferObject {
5030 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005031 VkDeviceMemory memory
5032 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005033}
5034
5035@internal class BufferViewObject {
5036 VkDevice device
5037 VkBuffer buffer
5038}
5039
5040@internal class ImageObject {
5041 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005042 VkDeviceMemory memory
5043 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005044}
5045
5046@internal class ImageViewObject {
5047 VkDevice device
5048 VkImage image
5049}
5050
Jesse Halld27f6aa2015-08-15 17:58:48 -07005051@internal class ShaderObject {
5052 VkDevice device
5053}
5054
5055@internal class ShaderModuleObject {
5056 VkDevice device
5057}
5058
5059@internal class PipelineObject {
5060 VkDevice device
5061}
5062
5063@internal class PipelineLayoutObject {
5064 VkDevice device
5065}
5066
5067@internal class SamplerObject {
5068 VkDevice device
5069}
5070
5071@internal class DescriptorSetObject {
5072 VkDevice device
5073}
5074
5075@internal class DescriptorSetLayoutObject {
5076 VkDevice device
5077}
5078
5079@internal class DescriptorPoolObject {
5080 VkDevice device
5081}
5082
Jesse Halld27f6aa2015-08-15 17:58:48 -07005083@internal class FenceObject {
5084 VkDevice device
5085 bool signaled
5086}
5087
5088@internal class SemaphoreObject {
5089 VkDevice device
5090}
5091
5092@internal class EventObject {
5093 VkDevice device
5094}
5095
5096@internal class QueryPoolObject {
5097 VkDevice device
5098}
5099
5100@internal class FramebufferObject {
5101 VkDevice device
5102}
5103
5104@internal class RenderPassObject {
5105 VkDevice device
5106}
5107
5108@internal class PipelineCacheObject {
5109 VkDevice device
5110}
5111
Jesse Hall3fbc8562015-11-29 22:10:52 -08005112@internal class CommandPoolObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07005113 VkDevice device
5114}
5115
Jesse Hall1356b0d2015-11-23 17:24:58 -08005116@internal class SurfaceObject {
5117 VkInstance instance
5118}
5119
Michael Lentine88594d72015-11-12 12:49:45 -08005120@internal class SwapchainObject {
5121 VkDevice device
5122}
5123
Jesse Halld27f6aa2015-08-15 17:58:48 -07005124macro ref!InstanceObject GetInstance(VkInstance instance) {
5125 assert(instance in State.Instances)
5126 return State.Instances[instance]
5127}
5128
5129macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
5130 assert(physicalDevice in State.PhysicalDevices)
5131 return State.PhysicalDevices[physicalDevice]
5132}
5133
5134macro ref!DeviceObject GetDevice(VkDevice device) {
5135 assert(device in State.Devices)
5136 return State.Devices[device]
5137}
5138
5139macro ref!QueueObject GetQueue(VkQueue queue) {
5140 assert(queue in State.Queues)
5141 return State.Queues[queue]
5142}
5143
Jesse Hall3fbc8562015-11-29 22:10:52 -08005144macro ref!CommandBufferObject GetCommandBuffer(VkCommandBuffer commandBuffer) {
5145 assert(commandBuffer in State.CommandBuffers)
5146 return State.CommandBuffers[commandBuffer]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005147}
5148
Jesse Hall3fbc8562015-11-29 22:10:52 -08005149macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory memory) {
5150 assert(memory in State.DeviceMemories)
5151 return State.DeviceMemories[memory]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005152}
5153
5154macro ref!BufferObject GetBuffer(VkBuffer buffer) {
5155 assert(buffer in State.Buffers)
5156 return State.Buffers[buffer]
5157}
5158
5159macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
5160 assert(bufferView in State.BufferViews)
5161 return State.BufferViews[bufferView]
5162}
5163
5164macro ref!ImageObject GetImage(VkImage image) {
5165 assert(image in State.Images)
5166 return State.Images[image]
5167}
5168
5169macro ref!ImageViewObject GetImageView(VkImageView imageView) {
5170 assert(imageView in State.ImageViews)
5171 return State.ImageViews[imageView]
5172}
5173
Jesse Halld27f6aa2015-08-15 17:58:48 -07005174macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
5175 assert(shaderModule in State.ShaderModules)
5176 return State.ShaderModules[shaderModule]
5177}
5178
5179macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
5180 assert(pipeline in State.Pipelines)
5181 return State.Pipelines[pipeline]
5182}
5183
5184macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
5185 assert(pipelineLayout in State.PipelineLayouts)
5186 return State.PipelineLayouts[pipelineLayout]
5187}
5188
5189macro ref!SamplerObject GetSampler(VkSampler sampler) {
5190 assert(sampler in State.Samplers)
5191 return State.Samplers[sampler]
5192}
5193
5194macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
5195 assert(descriptorSet in State.DescriptorSets)
5196 return State.DescriptorSets[descriptorSet]
5197}
5198
5199macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
5200 assert(descriptorSetLayout in State.DescriptorSetLayouts)
5201 return State.DescriptorSetLayouts[descriptorSetLayout]
5202}
5203
5204macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
5205 assert(descriptorPool in State.DescriptorPools)
5206 return State.DescriptorPools[descriptorPool]
5207}
5208
Jesse Halld27f6aa2015-08-15 17:58:48 -07005209macro ref!FenceObject GetFence(VkFence fence) {
5210 assert(fence in State.Fences)
5211 return State.Fences[fence]
5212}
5213
5214macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
5215 assert(semaphore in State.Semaphores)
5216 return State.Semaphores[semaphore]
5217}
5218
5219macro ref!EventObject GetEvent(VkEvent event) {
5220 assert(event in State.Events)
5221 return State.Events[event]
5222}
5223
5224macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
5225 assert(queryPool in State.QueryPools)
5226 return State.QueryPools[queryPool]
5227}
5228
5229macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
5230 assert(framebuffer in State.Framebuffers)
5231 return State.Framebuffers[framebuffer]
5232}
5233
5234macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
5235 assert(renderPass in State.RenderPasses)
5236 return State.RenderPasses[renderPass]
5237}
5238
5239macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
5240 assert(pipelineCache in State.PipelineCaches)
5241 return State.PipelineCaches[pipelineCache]
5242}
5243
Jesse Hall3fbc8562015-11-29 22:10:52 -08005244macro ref!CommandPoolObject GetCommandPool(VkCommandPool commandPool) {
5245 assert(commandPool in State.CommandPools)
5246 return State.CommandPools[commandPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07005247}
Michael Lentine88594d72015-11-12 12:49:45 -08005248
Jesse Hall1356b0d2015-11-23 17:24:58 -08005249macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) {
5250 assert(surface in State.Surfaces)
5251 return State.Surfaces[surface]
5252}
5253
Michael Lentine88594d72015-11-12 12:49:45 -08005254macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) {
5255 assert(swapchain in State.Swapchains)
5256 return State.Swapchains[swapchain]
5257}
Jesse Halld8bade02015-11-24 10:24:18 -08005258
5259macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) {
5260 return as!VkQueueFlags(as!u32(flags) | as!u32(bit))
5261}