blob: 73f26e00f0ddd626138f78133d44634b0c0101ce [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 Halldba27f72015-11-30 14:25:46 -080030define VERSION_MINOR 206
Jesse Hallae38f732015-11-19 21:32:50 -080031define VERSION_PATCH 0
Jesse Halld27f6aa2015-08-15 17:58:48 -070032
33// API limits
Jesse Hall65ab5522015-11-30 00:07:16 -080034define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256
35define VK_UUID_SIZE 16
36define VK_MAX_EXTENSION_NAME_SIZE 256
37define VK_MAX_DESCRIPTION_SIZE 256
38define VK_MAX_MEMORY_TYPES 32
39define VK_MAX_MEMORY_HEAPS 16 /// The maximum number of unique memory heaps, each of which supporting 1 or more memory types.
Jesse Halld27f6aa2015-08-15 17:58:48 -070040
41// API keywords
42define VK_TRUE 1
43define VK_FALSE 0
Jesse Hall5ae3abb2015-10-08 14:00:22 -070044
45// API keyword, but needs special handling by some templates
46define NULL_HANDLE 0
Jesse Halld27f6aa2015-08-15 17:58:48 -070047
Jesse Hall0e74f002015-11-30 11:37:59 -080048@extension("VK_KHR_surface") define VK_KHR_SURFACE_REVISION 23
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 Hall0e74f002015-11-30 11:37:59 -080052@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_REVISION 66
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 Hall0e74f002015-11-30 11:37:59 -080056@extension("VK_KHR_display") define VK_KHR_DISPLAY_REVISION 19
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080057@extension("VK_KHR_display") define VK_KHR_DISPLAY_EXTENSION_NUMBER 3
58@extension("VK_KHR_display") define VK_KHR_DISPLAY_EXTENSION_NAME "VK_KHR_display"
Jesse Hall1356b0d2015-11-23 17:24:58 -080059
Jesse Hall0e74f002015-11-30 11:37:59 -080060@extension("VK_KHR_display_swapchain") define VK_KHR_DISPLAY_SWAPCHAIN_REVISION 8
61@extension("VK_KHR_display_swapchain") define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NUMBER 4
62@extension("VK_KHR_display_swapchain") define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain"
Jesse Hall1356b0d2015-11-23 17:24:58 -080063
Jesse Hall0e74f002015-11-30 11:37:59 -080064@extension("VK_KHR_xlib_surface") define VK_KHR_XLIB_SURFACE_REVISION 5
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080065@extension("VK_KHR_xlib_surface") define VK_KHR_XLIB_SURFACE_NUMBER 5
66@extension("VK_KHR_xlib_surface") define VK_KHR_XLIB_SURFACE_NAME "VK_KHR_xlib_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080067
Jesse Hall0e74f002015-11-30 11:37:59 -080068@extension("VK_KHR_xcb_surface") define VK_KHR_XCB_SURFACE_REVISION 5
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080069@extension("VK_KHR_xcb_surface") define VK_KHR_XCB_SURFACE_NUMBER 6
70@extension("VK_KHR_xcb_surface") define VK_KHR_XCB_SURFACE_NAME "VK_KHR_xcb_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080071
Jesse Hall0e74f002015-11-30 11:37:59 -080072@extension("VK_KHR_wayland_surface") define VK_KHR_WAYLAND_SURFACE_REVISION 4
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080073@extension("VK_KHR_wayland_surface") define VK_KHR_WAYLAND_SURFACE_NUMBER 7
74@extension("VK_KHR_wayland_surface") define VK_KHR_WAYLAND_SURFACE_NAME "VK_KHR_wayland_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080075
Jesse Hall0e74f002015-11-30 11:37:59 -080076@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_REVISION 4
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080077@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_NUMBER 8
78@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_NAME "VK_KHR_mir_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080079
Jesse Hall0e74f002015-11-30 11:37:59 -080080@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_REVISION 3
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080081@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_NUMBER 8
82@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_NAME "VK_KHR_android_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080083
Jesse Hall0e74f002015-11-30 11:37:59 -080084@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_REVISION 4
Jesse Hall3e0dc8f2015-11-30 00:42:57 -080085@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_NUMBER 9
86@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_NAME "VK_KHR_win32_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080087
Jesse Halld27f6aa2015-08-15 17:58:48 -070088
89/////////////
90// Types //
91/////////////
92
Jesse Hall5ae3abb2015-10-08 14:00:22 -070093type u32 VkBool32
94type u32 VkFlags
95type u64 VkDeviceSize
96type u32 VkSampleMask
97
Jesse Halld27f6aa2015-08-15 17:58:48 -070098/// Dispatchable handle types.
99@dispatchHandle type u64 VkInstance
100@dispatchHandle type u64 VkPhysicalDevice
101@dispatchHandle type u64 VkDevice
102@dispatchHandle type u64 VkQueue
Jesse Hall3fbc8562015-11-29 22:10:52 -0800103@dispatchHandle type u64 VkCommandBuffer
Jesse Halld27f6aa2015-08-15 17:58:48 -0700104
105/// Non dispatchable handle types.
106@nonDispatchHandle type u64 VkDeviceMemory
Jesse Hall3fbc8562015-11-29 22:10:52 -0800107@nonDispatchHandle type u64 VkCommandPool
Jesse Halld27f6aa2015-08-15 17:58:48 -0700108@nonDispatchHandle type u64 VkBuffer
109@nonDispatchHandle type u64 VkBufferView
110@nonDispatchHandle type u64 VkImage
111@nonDispatchHandle type u64 VkImageView
Jesse Halld27f6aa2015-08-15 17:58:48 -0700112@nonDispatchHandle type u64 VkShaderModule
Jesse Halld27f6aa2015-08-15 17:58:48 -0700113@nonDispatchHandle type u64 VkPipeline
114@nonDispatchHandle type u64 VkPipelineLayout
115@nonDispatchHandle type u64 VkSampler
116@nonDispatchHandle type u64 VkDescriptorSet
117@nonDispatchHandle type u64 VkDescriptorSetLayout
118@nonDispatchHandle type u64 VkDescriptorPool
Jesse Halld27f6aa2015-08-15 17:58:48 -0700119@nonDispatchHandle type u64 VkFence
120@nonDispatchHandle type u64 VkSemaphore
121@nonDispatchHandle type u64 VkEvent
122@nonDispatchHandle type u64 VkQueryPool
123@nonDispatchHandle type u64 VkFramebuffer
124@nonDispatchHandle type u64 VkRenderPass
125@nonDispatchHandle type u64 VkPipelineCache
Jesse Hall1356b0d2015-11-23 17:24:58 -0800126
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800127@extension("VK_KHR_surface") @nonDispatchHandle type u64 VkSurfaceKHR
Jesse Hall1356b0d2015-11-23 17:24:58 -0800128
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800129@extension("VK_KHR_swapchain") @nonDispatchHandle type u64 VkSwapchainKHR
Jesse Hall1356b0d2015-11-23 17:24:58 -0800130
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800131@extension("VK_KHR_display") @nonDispatchHandle type u64 VkDisplayKHR
132@extension("VK_KHR_display") @nonDispatchHandle type u64 VkDisplayModeKHR
Jesse Halld27f6aa2015-08-15 17:58:48 -0700133
134
135/////////////
136// Enums //
137/////////////
138
139enum VkImageLayout {
140 VK_IMAGE_LAYOUT_UNDEFINED = 0x00000000, /// Implicit layout an image is when its contents are undefined due to various reasons (e.g. right after creation)
141 VK_IMAGE_LAYOUT_GENERAL = 0x00000001, /// General layout when image can be used for any kind of access
142 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 0x00000002, /// Optimal layout when image is only used for color attachment read/write
143 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 0x00000003, /// Optimal layout when image is only used for depth/stencil attachment read/write
144 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 0x00000004, /// Optimal layout when image is used for read only depth/stencil attachment and shader access
145 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 0x00000005, /// Optimal layout when image is used for read only shader access
Jesse Hall3fbc8562015-11-29 22:10:52 -0800146 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 0x00000006, /// Optimal layout when image is used only as source of transfer operations
147 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 0x00000007, /// Optimal layout when image is used only as destination of transfer operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700148 VK_IMAGE_LAYOUT_PREINITIALIZED = 0x00000008, /// Initial layout used when the data is populated by the CPU
Jesse Hall1356b0d2015-11-23 17:24:58 -0800149
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800150 //@extension("VK_KHR_swapchain")
Jesse Hall3fbc8562015-11-29 22:10:52 -0800151 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 0xc0000802,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700152}
153
154enum VkAttachmentLoadOp {
155 VK_ATTACHMENT_LOAD_OP_LOAD = 0x00000000,
156 VK_ATTACHMENT_LOAD_OP_CLEAR = 0x00000001,
157 VK_ATTACHMENT_LOAD_OP_DONT_CARE = 0x00000002,
158}
159
160enum VkAttachmentStoreOp {
161 VK_ATTACHMENT_STORE_OP_STORE = 0x00000000,
162 VK_ATTACHMENT_STORE_OP_DONT_CARE = 0x00000001,
163}
164
165enum VkImageType {
166 VK_IMAGE_TYPE_1D = 0x00000000,
167 VK_IMAGE_TYPE_2D = 0x00000001,
168 VK_IMAGE_TYPE_3D = 0x00000002,
169}
170
171enum VkImageTiling {
Jesse Hallc7467b72015-11-29 21:05:26 -0800172 VK_IMAGE_TILING_OPTIMAL = 0x00000000,
173 VK_IMAGE_TILING_LINEAR = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700174}
175
176enum VkImageViewType {
177 VK_IMAGE_VIEW_TYPE_1D = 0x00000000,
178 VK_IMAGE_VIEW_TYPE_2D = 0x00000001,
179 VK_IMAGE_VIEW_TYPE_3D = 0x00000002,
180 VK_IMAGE_VIEW_TYPE_CUBE = 0x00000003,
181 VK_IMAGE_VIEW_TYPE_1D_ARRAY = 0x00000004,
182 VK_IMAGE_VIEW_TYPE_2D_ARRAY = 0x00000005,
183 VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 0x00000006,
184}
185
Jesse Hall3fbc8562015-11-29 22:10:52 -0800186enum VkCommandBufferLevel {
187 VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0x00000000,
188 VK_COMMAND_BUFFER_LEVEL_SECONDARY = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700189}
190
Jesse Hall65ab5522015-11-30 00:07:16 -0800191enum VkComponentSwizzle {
192 VK_COMPONENT_SWIZZLE_IDENTITY = 0x00000000,
193 VK_COMPONENT_SWIZZLE_ZERO = 0x00000001,
194 VK_COMPONENT_SWIZZLE_ONE = 0x00000002,
195 VK_COMPONENT_SWIZZLE_R = 0x00000003,
196 VK_COMPONENT_SWIZZLE_G = 0x00000004,
197 VK_COMPONENT_SWIZZLE_B = 0x00000005,
198 VK_COMPONENT_SWIZZLE_A = 0x00000006,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700199}
200
201enum VkDescriptorType {
202 VK_DESCRIPTOR_TYPE_SAMPLER = 0x00000000,
203 VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 0x00000001,
204 VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 0x00000002,
205 VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 0x00000003,
206 VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 0x00000004,
207 VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 0x00000005,
208 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 0x00000006,
209 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 0x00000007,
210 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 0x00000008,
211 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 0x00000009,
212 VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 0x0000000a,
213}
214
Jesse Halld27f6aa2015-08-15 17:58:48 -0700215enum VkQueryType {
216 VK_QUERY_TYPE_OCCLUSION = 0x00000000,
217 VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, /// Optional
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800218 VK_QUERY_TYPE_TIMESTAMP = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700219}
220
Jesse Halld27f6aa2015-08-15 17:58:48 -0700221enum VkBorderColor {
222 VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0x00000000,
223 VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 0x00000001,
224 VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 0x00000002,
225 VK_BORDER_COLOR_INT_OPAQUE_BLACK = 0x00000003,
226 VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 0x00000004,
227 VK_BORDER_COLOR_INT_OPAQUE_WHITE = 0x00000005,
228}
229
230enum VkPipelineBindPoint {
Jesse Hallc7467b72015-11-29 21:05:26 -0800231 VK_PIPELINE_BIND_POINT_GRAPHICS = 0x00000000,
232 VK_PIPELINE_BIND_POINT_COMPUTE = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700233}
234
235enum VkPrimitiveTopology {
236 VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0x00000000,
237 VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 0x00000001,
238 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 0x00000002,
239 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 0x00000003,
240 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 0x00000004,
241 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 0x00000005,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800242 VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 0x00000006,
243 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 0x00000007,
244 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 0x00000008,
245 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 0x00000009,
Jesse Hall091ed9e2015-11-30 00:55:29 -0800246 VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 0x0000000a,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700247}
248
249enum VkSharingMode {
250 VK_SHARING_MODE_EXCLUSIVE = 0x00000000,
251 VK_SHARING_MODE_CONCURRENT = 0x00000001,
252}
253
254enum VkIndexType {
255 VK_INDEX_TYPE_UINT16 = 0x00000000,
256 VK_INDEX_TYPE_UINT32 = 0x00000001,
257}
258
Jesse Hall23ff73f2015-11-29 14:36:39 -0800259enum VkFilter {
260 VK_FILTER_NEAREST = 0x00000000,
261 VK_FILTER_LINEAR = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700262}
263
Jesse Hall23ff73f2015-11-29 14:36:39 -0800264enum VkSamplerMipmapMode {
265 VK_SAMPLER_MIPMAP_MODE_BASE = 0x00000000, /// Always choose base level
266 VK_SAMPLER_MIPMAP_MODE_NEAREST = 0x00000001, /// Choose nearest mip level
267 VK_SAMPLER_MIPMAP_MODE_LINEAR = 0x00000002, /// Linear filter between mip levels
Jesse Halld27f6aa2015-08-15 17:58:48 -0700268}
269
Jesse Hall23ff73f2015-11-29 14:36:39 -0800270enum VkSamplerAddressMode {
Jesse Hallc7467b72015-11-29 21:05:26 -0800271 VK_SAMPLER_ADDRESS_MODE_REPEAT = 0x00000000,
272 VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 0x00000001,
273 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 0x00000002,
274 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 0x00000003,
275 VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700276}
277
278enum VkCompareOp {
279 VK_COMPARE_OP_NEVER = 0x00000000,
280 VK_COMPARE_OP_LESS = 0x00000001,
281 VK_COMPARE_OP_EQUAL = 0x00000002,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800282 VK_COMPARE_OP_LESS_OR_EQUAL = 0x00000003,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700283 VK_COMPARE_OP_GREATER = 0x00000004,
284 VK_COMPARE_OP_NOT_EQUAL = 0x00000005,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800285 VK_COMPARE_OP_GREATER_OR_EQUAL = 0x00000006,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700286 VK_COMPARE_OP_ALWAYS = 0x00000007,
287}
288
Jesse Hall65ab5522015-11-30 00:07:16 -0800289enum VkPolygonMode {
290 VK_POLYGON_MODE_FILL = 0x00000000,
291 VK_POLYGON_MODE_LINE = 0x00000001,
292 VK_POLYGON_MODE_POINT = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700293}
294
295enum VkFrontFace {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800296 VK_FRONT_FACE_COUNTER_CLOCKWISE = 0x00000000,
297 VK_FRONT_FACE_CLOCKWISE = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700298}
299
Jesse Hall65ab5522015-11-30 00:07:16 -0800300enum VkBlendFactor {
301 VK_BLEND_FACTOR_ZERO = 0x00000000,
302 VK_BLEND_FACTOR_ONE = 0x00000001,
303 VK_BLEND_FACTOR_SRC_COLOR = 0x00000002,
304 VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 0x00000003,
305 VK_BLEND_FACTOR_DST_COLOR = 0x00000004,
306 VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 0x00000005,
307 VK_BLEND_FACTOR_SRC_ALPHA = 0x00000006,
308 VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 0x00000007,
309 VK_BLEND_FACTOR_DST_ALPHA = 0x00000008,
310 VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 0x00000009,
311 VK_BLEND_FACTOR_CONSTANT_COLOR = 0x0000000a,
312 VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 0x0000000b,
313 VK_BLEND_FACTOR_CONSTANT_ALPHA = 0x0000000c,
314 VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 0x0000000d,
315 VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 0x0000000e,
316 VK_BLEND_FACTOR_SRC1_COLOR = 0x0000000f,
317 VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 0x00000010,
318 VK_BLEND_FACTOR_SRC1_ALPHA = 0x00000011,
319 VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 0x00000012,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700320}
321
322enum VkBlendOp {
323 VK_BLEND_OP_ADD = 0x00000000,
324 VK_BLEND_OP_SUBTRACT = 0x00000001,
325 VK_BLEND_OP_REVERSE_SUBTRACT = 0x00000002,
326 VK_BLEND_OP_MIN = 0x00000003,
327 VK_BLEND_OP_MAX = 0x00000004,
328}
329
330enum VkStencilOp {
331 VK_STENCIL_OP_KEEP = 0x00000000,
332 VK_STENCIL_OP_ZERO = 0x00000001,
333 VK_STENCIL_OP_REPLACE = 0x00000002,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800334 VK_STENCIL_OP_INCREMENT_AND_CLAMP = 0x00000003,
335 VK_STENCIL_OP_DECREMENT_AND_CLAMP = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700336 VK_STENCIL_OP_INVERT = 0x00000005,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800337 VK_STENCIL_OP_INCREMENT_AND_WRAP = 0x00000006,
338 VK_STENCIL_OP_DECREMENT_AND_WRAP = 0x00000007,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700339}
340
341enum VkLogicOp {
342 VK_LOGIC_OP_CLEAR = 0x00000000,
343 VK_LOGIC_OP_AND = 0x00000001,
344 VK_LOGIC_OP_AND_REVERSE = 0x00000002,
345 VK_LOGIC_OP_COPY = 0x00000003,
346 VK_LOGIC_OP_AND_INVERTED = 0x00000004,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800347 VK_LOGIC_OP_NO_OP = 0x00000005,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700348 VK_LOGIC_OP_XOR = 0x00000006,
349 VK_LOGIC_OP_OR = 0x00000007,
350 VK_LOGIC_OP_NOR = 0x00000008,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800351 VK_LOGIC_OP_EQUIVALENT = 0x00000009,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700352 VK_LOGIC_OP_INVERT = 0x0000000a,
353 VK_LOGIC_OP_OR_REVERSE = 0x0000000b,
354 VK_LOGIC_OP_COPY_INVERTED = 0x0000000c,
355 VK_LOGIC_OP_OR_INVERTED = 0x0000000d,
356 VK_LOGIC_OP_NAND = 0x0000000e,
357 VK_LOGIC_OP_SET = 0x0000000f,
358}
359
Jesse Hall3fbc8562015-11-29 22:10:52 -0800360enum VkSystemAllocationScope {
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800361 VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0x00000000,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800362 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 0x00000001,
363 VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 0x00000002,
364 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 0x00000003,
365 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 0x00000004,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800366}
367
Jesse Hall3fbc8562015-11-29 22:10:52 -0800368enum VkInternalAllocationType {
369 VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0x00000000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700370}
371
372enum VkPhysicalDeviceType {
373 VK_PHYSICAL_DEVICE_TYPE_OTHER = 0x00000000,
374 VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 0x00000001,
375 VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 0x00000002,
376 VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 0x00000003,
377 VK_PHYSICAL_DEVICE_TYPE_CPU = 0x00000004,
378}
379
Jesse Hall65ab5522015-11-30 00:07:16 -0800380enum VkVertexInputRate {
381 VK_VERTEX_INPUT_RATE_VERTEX = 0x00000000,
382 VK_VERTEX_INPUT_RATE_INSTANCE = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700383}
384
385/// Vulkan format definitions
386enum VkFormat {
387 VK_FORMAT_UNDEFINED = 0x00000000,
388 VK_FORMAT_R4G4_UNORM = 0x00000001,
389 VK_FORMAT_R4G4_USCALED = 0x00000002,
390 VK_FORMAT_R4G4B4A4_UNORM = 0x00000003,
391 VK_FORMAT_R4G4B4A4_USCALED = 0x00000004,
392 VK_FORMAT_R5G6B5_UNORM = 0x00000005,
393 VK_FORMAT_R5G6B5_USCALED = 0x00000006,
394 VK_FORMAT_R5G5B5A1_UNORM = 0x00000007,
395 VK_FORMAT_R5G5B5A1_USCALED = 0x00000008,
396 VK_FORMAT_R8_UNORM = 0x00000009,
397 VK_FORMAT_R8_SNORM = 0x0000000A,
398 VK_FORMAT_R8_USCALED = 0x0000000B,
399 VK_FORMAT_R8_SSCALED = 0x0000000C,
400 VK_FORMAT_R8_UINT = 0x0000000D,
401 VK_FORMAT_R8_SINT = 0x0000000E,
402 VK_FORMAT_R8_SRGB = 0x0000000F,
403 VK_FORMAT_R8G8_UNORM = 0x00000010,
404 VK_FORMAT_R8G8_SNORM = 0x00000011,
405 VK_FORMAT_R8G8_USCALED = 0x00000012,
406 VK_FORMAT_R8G8_SSCALED = 0x00000013,
407 VK_FORMAT_R8G8_UINT = 0x00000014,
408 VK_FORMAT_R8G8_SINT = 0x00000015,
409 VK_FORMAT_R8G8_SRGB = 0x00000016,
410 VK_FORMAT_R8G8B8_UNORM = 0x00000017,
411 VK_FORMAT_R8G8B8_SNORM = 0x00000018,
412 VK_FORMAT_R8G8B8_USCALED = 0x00000019,
413 VK_FORMAT_R8G8B8_SSCALED = 0x0000001A,
414 VK_FORMAT_R8G8B8_UINT = 0x0000001B,
415 VK_FORMAT_R8G8B8_SINT = 0x0000001C,
416 VK_FORMAT_R8G8B8_SRGB = 0x0000001D,
417 VK_FORMAT_R8G8B8A8_UNORM = 0x0000001E,
418 VK_FORMAT_R8G8B8A8_SNORM = 0x0000001F,
419 VK_FORMAT_R8G8B8A8_USCALED = 0x00000020,
420 VK_FORMAT_R8G8B8A8_SSCALED = 0x00000021,
421 VK_FORMAT_R8G8B8A8_UINT = 0x00000022,
422 VK_FORMAT_R8G8B8A8_SINT = 0x00000023,
423 VK_FORMAT_R8G8B8A8_SRGB = 0x00000024,
424 VK_FORMAT_R10G10B10A2_UNORM = 0x00000025,
425 VK_FORMAT_R10G10B10A2_SNORM = 0x00000026,
426 VK_FORMAT_R10G10B10A2_USCALED = 0x00000027,
427 VK_FORMAT_R10G10B10A2_SSCALED = 0x00000028,
428 VK_FORMAT_R10G10B10A2_UINT = 0x00000029,
429 VK_FORMAT_R10G10B10A2_SINT = 0x0000002A,
430 VK_FORMAT_R16_UNORM = 0x0000002B,
431 VK_FORMAT_R16_SNORM = 0x0000002C,
432 VK_FORMAT_R16_USCALED = 0x0000002D,
433 VK_FORMAT_R16_SSCALED = 0x0000002E,
434 VK_FORMAT_R16_UINT = 0x0000002F,
435 VK_FORMAT_R16_SINT = 0x00000030,
436 VK_FORMAT_R16_SFLOAT = 0x00000031,
437 VK_FORMAT_R16G16_UNORM = 0x00000032,
438 VK_FORMAT_R16G16_SNORM = 0x00000033,
439 VK_FORMAT_R16G16_USCALED = 0x00000034,
440 VK_FORMAT_R16G16_SSCALED = 0x00000035,
441 VK_FORMAT_R16G16_UINT = 0x00000036,
442 VK_FORMAT_R16G16_SINT = 0x00000037,
443 VK_FORMAT_R16G16_SFLOAT = 0x00000038,
444 VK_FORMAT_R16G16B16_UNORM = 0x00000039,
445 VK_FORMAT_R16G16B16_SNORM = 0x0000003A,
446 VK_FORMAT_R16G16B16_USCALED = 0x0000003B,
447 VK_FORMAT_R16G16B16_SSCALED = 0x0000003C,
448 VK_FORMAT_R16G16B16_UINT = 0x0000003D,
449 VK_FORMAT_R16G16B16_SINT = 0x0000003E,
450 VK_FORMAT_R16G16B16_SFLOAT = 0x0000003F,
451 VK_FORMAT_R16G16B16A16_UNORM = 0x00000040,
452 VK_FORMAT_R16G16B16A16_SNORM = 0x00000041,
453 VK_FORMAT_R16G16B16A16_USCALED = 0x00000042,
454 VK_FORMAT_R16G16B16A16_SSCALED = 0x00000043,
455 VK_FORMAT_R16G16B16A16_UINT = 0x00000044,
456 VK_FORMAT_R16G16B16A16_SINT = 0x00000045,
457 VK_FORMAT_R16G16B16A16_SFLOAT = 0x00000046,
458 VK_FORMAT_R32_UINT = 0x00000047,
459 VK_FORMAT_R32_SINT = 0x00000048,
460 VK_FORMAT_R32_SFLOAT = 0x00000049,
461 VK_FORMAT_R32G32_UINT = 0x0000004A,
462 VK_FORMAT_R32G32_SINT = 0x0000004B,
463 VK_FORMAT_R32G32_SFLOAT = 0x0000004C,
464 VK_FORMAT_R32G32B32_UINT = 0x0000004D,
465 VK_FORMAT_R32G32B32_SINT = 0x0000004E,
466 VK_FORMAT_R32G32B32_SFLOAT = 0x0000004F,
467 VK_FORMAT_R32G32B32A32_UINT = 0x00000050,
468 VK_FORMAT_R32G32B32A32_SINT = 0x00000051,
469 VK_FORMAT_R32G32B32A32_SFLOAT = 0x00000052,
470 VK_FORMAT_R64_SFLOAT = 0x00000053,
471 VK_FORMAT_R64G64_SFLOAT = 0x00000054,
472 VK_FORMAT_R64G64B64_SFLOAT = 0x00000055,
473 VK_FORMAT_R64G64B64A64_SFLOAT = 0x00000056,
474 VK_FORMAT_R11G11B10_UFLOAT = 0x00000057,
475 VK_FORMAT_R9G9B9E5_UFLOAT = 0x00000058,
476 VK_FORMAT_D16_UNORM = 0x00000059,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700477 VK_FORMAT_D24_UNORM_X8 = 0x0000005A,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700478 VK_FORMAT_D32_SFLOAT = 0x0000005B,
479 VK_FORMAT_S8_UINT = 0x0000005C,
480 VK_FORMAT_D16_UNORM_S8_UINT = 0x0000005D,
481 VK_FORMAT_D24_UNORM_S8_UINT = 0x0000005E,
482 VK_FORMAT_D32_SFLOAT_S8_UINT = 0x0000005F,
483 VK_FORMAT_BC1_RGB_UNORM = 0x00000060,
484 VK_FORMAT_BC1_RGB_SRGB = 0x00000061,
485 VK_FORMAT_BC1_RGBA_UNORM = 0x00000062,
486 VK_FORMAT_BC1_RGBA_SRGB = 0x00000063,
487 VK_FORMAT_BC2_UNORM = 0x00000064,
488 VK_FORMAT_BC2_SRGB = 0x00000065,
489 VK_FORMAT_BC3_UNORM = 0x00000066,
490 VK_FORMAT_BC3_SRGB = 0x00000067,
491 VK_FORMAT_BC4_UNORM = 0x00000068,
492 VK_FORMAT_BC4_SNORM = 0x00000069,
493 VK_FORMAT_BC5_UNORM = 0x0000006A,
494 VK_FORMAT_BC5_SNORM = 0x0000006B,
495 VK_FORMAT_BC6H_UFLOAT = 0x0000006C,
496 VK_FORMAT_BC6H_SFLOAT = 0x0000006D,
497 VK_FORMAT_BC7_UNORM = 0x0000006E,
498 VK_FORMAT_BC7_SRGB = 0x0000006F,
499 VK_FORMAT_ETC2_R8G8B8_UNORM = 0x00000070,
500 VK_FORMAT_ETC2_R8G8B8_SRGB = 0x00000071,
501 VK_FORMAT_ETC2_R8G8B8A1_UNORM = 0x00000072,
502 VK_FORMAT_ETC2_R8G8B8A1_SRGB = 0x00000073,
503 VK_FORMAT_ETC2_R8G8B8A8_UNORM = 0x00000074,
504 VK_FORMAT_ETC2_R8G8B8A8_SRGB = 0x00000075,
505 VK_FORMAT_EAC_R11_UNORM = 0x00000076,
506 VK_FORMAT_EAC_R11_SNORM = 0x00000077,
507 VK_FORMAT_EAC_R11G11_UNORM = 0x00000078,
508 VK_FORMAT_EAC_R11G11_SNORM = 0x00000079,
509 VK_FORMAT_ASTC_4x4_UNORM = 0x0000007A,
510 VK_FORMAT_ASTC_4x4_SRGB = 0x0000007B,
511 VK_FORMAT_ASTC_5x4_UNORM = 0x0000007C,
512 VK_FORMAT_ASTC_5x4_SRGB = 0x0000007D,
513 VK_FORMAT_ASTC_5x5_UNORM = 0x0000007E,
514 VK_FORMAT_ASTC_5x5_SRGB = 0x0000007F,
515 VK_FORMAT_ASTC_6x5_UNORM = 0x00000080,
516 VK_FORMAT_ASTC_6x5_SRGB = 0x00000081,
517 VK_FORMAT_ASTC_6x6_UNORM = 0x00000082,
518 VK_FORMAT_ASTC_6x6_SRGB = 0x00000083,
519 VK_FORMAT_ASTC_8x5_UNORM = 0x00000084,
520 VK_FORMAT_ASTC_8x5_SRGB = 0x00000085,
521 VK_FORMAT_ASTC_8x6_UNORM = 0x00000086,
522 VK_FORMAT_ASTC_8x6_SRGB = 0x00000087,
523 VK_FORMAT_ASTC_8x8_UNORM = 0x00000088,
524 VK_FORMAT_ASTC_8x8_SRGB = 0x00000089,
525 VK_FORMAT_ASTC_10x5_UNORM = 0x0000008A,
526 VK_FORMAT_ASTC_10x5_SRGB = 0x0000008B,
527 VK_FORMAT_ASTC_10x6_UNORM = 0x0000008C,
528 VK_FORMAT_ASTC_10x6_SRGB = 0x0000008D,
529 VK_FORMAT_ASTC_10x8_UNORM = 0x0000008E,
530 VK_FORMAT_ASTC_10x8_SRGB = 0x0000008F,
531 VK_FORMAT_ASTC_10x10_UNORM = 0x00000090,
532 VK_FORMAT_ASTC_10x10_SRGB = 0x00000091,
533 VK_FORMAT_ASTC_12x10_UNORM = 0x00000092,
534 VK_FORMAT_ASTC_12x10_SRGB = 0x00000093,
535 VK_FORMAT_ASTC_12x12_UNORM = 0x00000094,
536 VK_FORMAT_ASTC_12x12_SRGB = 0x00000095,
537 VK_FORMAT_B4G4R4A4_UNORM = 0x00000096,
538 VK_FORMAT_B5G5R5A1_UNORM = 0x00000097,
539 VK_FORMAT_B5G6R5_UNORM = 0x00000098,
540 VK_FORMAT_B5G6R5_USCALED = 0x00000099,
541 VK_FORMAT_B8G8R8_UNORM = 0x0000009A,
542 VK_FORMAT_B8G8R8_SNORM = 0x0000009B,
543 VK_FORMAT_B8G8R8_USCALED = 0x0000009C,
544 VK_FORMAT_B8G8R8_SSCALED = 0x0000009D,
545 VK_FORMAT_B8G8R8_UINT = 0x0000009E,
546 VK_FORMAT_B8G8R8_SINT = 0x0000009F,
547 VK_FORMAT_B8G8R8_SRGB = 0x000000A0,
548 VK_FORMAT_B8G8R8A8_UNORM = 0x000000A1,
549 VK_FORMAT_B8G8R8A8_SNORM = 0x000000A2,
550 VK_FORMAT_B8G8R8A8_USCALED = 0x000000A3,
551 VK_FORMAT_B8G8R8A8_SSCALED = 0x000000A4,
552 VK_FORMAT_B8G8R8A8_UINT = 0x000000A5,
553 VK_FORMAT_B8G8R8A8_SINT = 0x000000A6,
554 VK_FORMAT_B8G8R8A8_SRGB = 0x000000A7,
555 VK_FORMAT_B10G10R10A2_UNORM = 0x000000A8,
556 VK_FORMAT_B10G10R10A2_SNORM = 0x000000A9,
557 VK_FORMAT_B10G10R10A2_USCALED = 0x000000AA,
558 VK_FORMAT_B10G10R10A2_SSCALED = 0x000000AB,
559 VK_FORMAT_B10G10R10A2_UINT = 0x000000AC,
560 VK_FORMAT_B10G10R10A2_SINT = 0x000000AD,
561}
562
Jesse Halld27f6aa2015-08-15 17:58:48 -0700563/// Structure type enumerant
564enum VkStructureType {
565 VK_STRUCTURE_TYPE_APPLICATION_INFO = 0,
Jesse Hallc7467b72015-11-29 21:05:26 -0800566 VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1,
567 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2,
568 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3,
569 VK_STRUCTURE_TYPE_SUBMIT_INFO = 4,
570 VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO = 5,
571 VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6,
572 VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7,
573 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8,
574 VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700575 VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10,
Jesse Hallc7467b72015-11-29 21:05:26 -0800576 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11,
577 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12,
578 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13,
579 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14,
580 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15,
581 VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16,
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800582 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17,
583 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18,
584 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19,
585 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20,
586 VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21,
587 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22,
588 VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23,
589 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24,
590 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25,
591 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26,
592 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27,
593 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28,
594 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29,
595 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30,
596 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31,
597 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32,
598 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33,
599 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO = 34,
600 VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35,
601 VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36,
602 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37,
603 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38,
604 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39,
605 VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOC_INFO = 40,
606 VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 41,
607 VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 42,
608 VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 43,
609 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 44,
610 VK_STRUCTURE_TYPE_MEMORY_BARRIER = 45,
611 VK_STRUCTURE_TYPE_LAYER_INSTANCE_CREATE_INFO = 46,
612 VK_STRUCTURE_TYPE_LAYER_DEVICE_CREATE_INFO = 47,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800613
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800614 //@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800615 VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 0xc0000801,
616
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800617 //@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800618 VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 0xc0000c00,
Jesse Halla6429252015-11-29 18:59:42 -0800619 VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 0xc0000c01,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800620
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800621 //@extension("VK_KHR_display_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800622 VK_STRUCTURE_TYPE_DISPLAY_SWAPCHAIN_CREATE_INFO_KHR = 0xc0001000,
623 VK_STRUCTURE_TYPE_DISPLAY_DISPLAY_PRESENT_INFO_KHR = 0xc0001001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700624}
625
Jesse Hall65ab5522015-11-30 00:07:16 -0800626enum VkSubpassContents {
627 VK_SUBPASS_CONTENTS_INLINE = 0x00000000,
628 VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700629}
630
Jesse Hall091ed9e2015-11-30 00:55:29 -0800631@lastUnused(-10)
Jesse Halld27f6aa2015-08-15 17:58:48 -0700632/// Error and return codes
633enum VkResult {
634 // Return codes for successful operation execution (positive values)
635 VK_SUCCESS = 0x00000000,
Jesse Halla15a4bf2015-11-19 22:48:02 -0800636 VK_NOT_READY = 0x00000001,
637 VK_TIMEOUT = 0x00000002,
638 VK_EVENT_SET = 0x00000003,
639 VK_EVENT_RESET = 0x00000004,
640 VK_INCOMPLETE = 0x00000005,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700641
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800642 //@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800643 VK_SUBOPTIMAL_KHR = 0x40000403,
644
Jesse Halld27f6aa2015-08-15 17:58:48 -0700645 // Error codes (negative values)
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700646 VK_ERROR_OUT_OF_HOST_MEMORY = 0xFFFFFFFF,
647 VK_ERROR_OUT_OF_DEVICE_MEMORY = 0xFFFFFFFE,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700648 VK_ERROR_INITIALIZATION_FAILED = 0xFFFFFFFD,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700649 VK_ERROR_DEVICE_LOST = 0xFFFFFFFC,
650 VK_ERROR_MEMORY_MAP_FAILED = 0xFFFFFFFB,
651 VK_ERROR_LAYER_NOT_PRESENT = 0xFFFFFFFA,
652 VK_ERROR_EXTENSION_NOT_PRESENT = 0xFFFFFFF9,
Jesse Hall606a54e2015-11-19 22:17:28 -0800653 VK_ERROR_FEATURE_NOT_PRESENT = 0xFFFFFFF8,
654 VK_ERROR_INCOMPATIBLE_DRIVER = 0xFFFFFFF7,
Jesse Hall091ed9e2015-11-30 00:55:29 -0800655 VK_ERROR_TOO_MANY_OBJECTS = 0xFFFFFFF6,
Jesse Halla9e57032015-11-30 01:03:10 -0800656 VK_ERROR_FORMAT_NOT_SUPPORTED = 0xFFFFFFF5,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800657
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800658 //@extension("VK_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -0800659 VK_ERROR_SURFACE_LOST_KHR = 0xC0000400,
660
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800661 //@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800662 VK_ERROR_OUT_OF_DATE_KHR = 0xC0000804,
663
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800664 //@extension("VK_KHR_display_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800665 VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = 0xC0001002,
666
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800667 //@extension("VK_KHR_android_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -0800668 VK_ERROR_INVALID_ANDROID_WINDOW_KHR = 0xC002400,
669 VK_ERROR_ANDROID_WINDOW_IN_USE_KHR = 0xC002401,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700670}
671
672enum VkDynamicState {
673 VK_DYNAMIC_STATE_VIEWPORT = 0x00000000,
674 VK_DYNAMIC_STATE_SCISSOR = 0x00000001,
675 VK_DYNAMIC_STATE_LINE_WIDTH = 0x00000002,
676 VK_DYNAMIC_STATE_DEPTH_BIAS = 0x00000003,
677 VK_DYNAMIC_STATE_BLEND_CONSTANTS = 0x00000004,
678 VK_DYNAMIC_STATE_DEPTH_BOUNDS = 0x00000005,
679 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 0x00000006,
680 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 0x00000007,
681 VK_DYNAMIC_STATE_STENCIL_REFERENCE = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700682}
683
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800684@extension("VK_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -0800685enum VkSurfaceTransformKHR {
686 VK_SURFACE_TRANSFORM_NONE_KHR = 0x00000000,
687 VK_SURFACE_TRANSFORM_ROT90_KHR = 0x00000001,
688 VK_SURFACE_TRANSFORM_ROT180_KHR = 0x00000002,
689 VK_SURFACE_TRANSFORM_ROT270_KHR = 0x00000003,
690 VK_SURFACE_TRANSFORM_HMIRROR_KHR = 0x00000004,
691 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_KHR = 0x00000005,
692 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_KHR = 0x00000006,
693 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_KHR = 0x00000007,
694 VK_SURFACE_TRANSFORM_INHERIT_KHR = 0x00000008,
695}
696
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800697@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -0800698enum VkPresentModeKHR {
699 VK_PRESENT_MODE_IMMEDIATE_KHR = 0x00000000,
700 VK_PRESENT_MODE_MAILBOX_KHR = 0x00000001,
701 VK_PRESENT_MODE_FIFO_KHR = 0x00000002,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800702 VK_PRESENT_MODE_FIFO_RELAXED_KHR = 0x00000003,
Michael Lentine88594d72015-11-12 12:49:45 -0800703}
704
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800705@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -0800706enum VkColorSpaceKHR {
707 VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000,
708}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700709
710/////////////////
711// Bitfields //
712/////////////////
713
Jesse Halld27f6aa2015-08-15 17:58:48 -0700714/// Queue capabilities
Jesse Halld8bade02015-11-24 10:24:18 -0800715type VkFlags VkQueueFlags
716bitfield VkQueueFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700717 VK_QUEUE_GRAPHICS_BIT = 0x00000001, /// Queue supports graphics operations
718 VK_QUEUE_COMPUTE_BIT = 0x00000002, /// Queue supports compute operations
Jesse Hall65ab5522015-11-30 00:07:16 -0800719 VK_QUEUE_TRANSFER_BIT = 0x00000004, /// Queue supports transfer operations
Jesse Hallb00daad2015-11-29 19:46:20 -0800720 VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, /// Queue supports sparse resource memory management operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700721}
722
723/// Memory properties passed into vkAllocMemory().
Jesse Halld8bade02015-11-24 10:24:18 -0800724type VkFlags VkMemoryPropertyFlags
725bitfield VkMemoryPropertyFlagBits {
Jesse Halld1af8122015-11-29 23:50:38 -0800726 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001,
727 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002,
728 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004,
729 VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008,
730 VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700731}
732
733/// Memory heap flags
Jesse Halld8bade02015-11-24 10:24:18 -0800734type VkFlags VkMemoryHeapFlags
735bitfield VkMemoryHeapFlagBits {
Jesse Halld1af8122015-11-29 23:50:38 -0800736 VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700737}
738
Jesse Hall3e0dc8f2015-11-30 00:42:57 -0800739/// Access flags
740type VkFlags VkAccessFlags
741bitfield VkAccessFlagBits {
742 VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001,
743 VK_ACCESS_INDEX_READ_BIT = 0x00000002,
744 VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004,
745 VK_ACCESS_UNIFORM_READ_BIT = 0x00000008,
746 VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010,
747 VK_ACCESS_SHADER_READ_BIT = 0x00000020,
748 VK_ACCESS_SHADER_WRITE_BIT = 0x00000040,
749 VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080,
750 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100,
751 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200,
752 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400,
753 VK_ACCESS_TRANSFER_READ_BIT = 0x00000800,
754 VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000,
755 VK_ACCESS_HOST_READ_BIT = 0x00002000,
756 VK_ACCESS_HOST_WRITE_BIT = 0x00004000,
757 VK_ACCESS_MEMORY_READ_BIT = 0x00008000,
758 VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700759}
760
761/// Buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800762type VkFlags VkBufferUsageFlags
763bitfield VkBufferUsageFlagBits {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800764 VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations
765 VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700766 VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, /// Can be used as TBO
767 VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, /// Can be used as IBO
768 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, /// Can be used as UBO
769 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, /// Can be used as SSBO
770 VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, /// Can be used as source of fixed function index fetch (index buffer)
771 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, /// Can be used as source of fixed function vertex fetch (VBO)
772 VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, /// Can be the source of indirect parameters (e.g. indirect buffer, parameter buffer)
773}
774
775/// Buffer creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800776type VkFlags VkBufferCreateFlags
777bitfield VkBufferCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700778 VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Buffer should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700779 VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Buffer should support sparse backing with partial residency
780 VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Buffer should support constent data access to physical memory blocks mapped into multiple locations of sparse buffers
781}
782
783/// Shader stage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800784type VkFlags VkShaderStageFlags
785bitfield VkShaderStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700786 VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
Jesse Hallae38f732015-11-19 21:32:50 -0800787 VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
788 VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700789 VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
790 VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
791 VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
Jesse Hallc7467b72015-11-29 21:05:26 -0800792 VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700793
794 VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
795}
796
Jesse Hallfbf97b02015-11-20 14:17:03 -0800797/// Descriptor pool create flags
Jesse Halld8bade02015-11-24 10:24:18 -0800798type VkFlags VkDescriptorPoolCreateFlags
799bitfield VkDescriptorPoolCreateFlagBits {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800800 VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
801}
802
803/// Descriptor pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -0800804type VkFlags VkDescriptorPoolResetFlags
Jesse Halla6429252015-11-29 18:59:42 -0800805//bitfield VkDescriptorPoolResetFlagBits {
806//}
Jesse Hallfbf97b02015-11-20 14:17:03 -0800807
Jesse Halld27f6aa2015-08-15 17:58:48 -0700808/// Image usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800809type VkFlags VkImageUsageFlags
810bitfield VkImageUsageFlagBits {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800811 VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations
812 VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700813 VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, /// Can be sampled from (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
814 VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, /// Can be used as storage image (STORAGE_IMAGE descriptor type)
815 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, /// Can be used as framebuffer color attachment
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700816 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment
Jesse Halld27f6aa2015-08-15 17:58:48 -0700817 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering
818 VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment
819}
820
821/// Image creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800822type VkFlags VkImageCreateFlags
823bitfield VkImageCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700824 VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Image should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700825 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Image should support sparse backing with partial residency
826 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 -0700827 VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, /// Allows image views to have different format than the base image
828 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 -0700829}
830
Jesse Hallb00daad2015-11-29 19:46:20 -0800831/// Image view creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800832type VkFlags VkImageViewCreateFlags
Jesse Hallb00daad2015-11-29 19:46:20 -0800833//bitfield VkImageViewCreateFlagBits {
834//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700835
836/// Pipeline creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800837type VkFlags VkPipelineCreateFlags
838bitfield VkPipelineCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700839 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
840 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
841 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
842}
843
Jesse Hall65ab5522015-11-30 00:07:16 -0800844/// Color component flags
845type VkFlags VkColorComponentFlags
846bitfield VkColorComponentFlagBits {
847 VK_COLOR_COMPONENT_R_BIT = 0x00000001,
848 VK_COLOR_COMPONENT_G_BIT = 0x00000002,
849 VK_COLOR_COMPONENT_B_BIT = 0x00000004,
850 VK_COLOR_COMPONENT_A_BIT = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700851}
852
853/// Fence creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800854type VkFlags VkFenceCreateFlags
855bitfield VkFenceCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700856 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
857}
858
859/// Semaphore creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800860type VkFlags VkSemaphoreCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800861//bitfield VkSemaphoreCreateFlagBits {
862//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700863
864/// Format capability flags
Jesse Halld8bade02015-11-24 10:24:18 -0800865type VkFlags VkFormatFeatureFlags
866bitfield VkFormatFeatureFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700867 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
868 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type)
869 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images
870 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs)
871 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs)
872 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers
873 VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs)
874 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images
875 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images
876 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images
Jesse Hall3fbc8562015-11-29 22:10:52 -0800877 VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCommandBlitImage
878 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 -0700879}
880
881/// Query control flags
Jesse Halld8bade02015-11-24 10:24:18 -0800882type VkFlags VkQueryControlFlags
883bitfield VkQueryControlFlagBits {
Jesse Hall65ab5522015-11-30 00:07:16 -0800884 VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700885}
886
887/// Query result flags
Jesse Halld8bade02015-11-24 10:24:18 -0800888type VkFlags VkQueryResultFlags
889bitfield VkQueryResultFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700890 VK_QUERY_RESULT_DEFAULT = 0x00000000, /// Results of the queries are immediately written to the destination buffer as 32-bit values
891 VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values
892 VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy
893 VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written
894 VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available
895}
896
897/// Shader module creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800898type VkFlags VkShaderModuleCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800899//bitfield VkShaderModuleCreateFlagBits {
900//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700901
Jesse Halld27f6aa2015-08-15 17:58:48 -0700902/// Event creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800903type VkFlags VkEventCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800904//bitfield VkEventCreateFlagBits {
905//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700906
Jesse Halla15a4bf2015-11-19 22:48:02 -0800907/// Command buffer usage flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800908type VkFlags VkCommandBufferUsageFlags
909bitfield VkCommandBufferUsageFlagBits {
910 VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
911 VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
912 VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700913}
914
915/// Pipeline statistics flags
Jesse Halld8bade02015-11-24 10:24:18 -0800916type VkFlags VkQueryPipelineStatisticFlags
917bitfield VkQueryPipelineStatisticFlagBits {
Jesse Hallae38f732015-11-19 21:32:50 -0800918 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, /// Optional
919 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, /// Optional
920 VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, /// Optional
921 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, /// Optional
922 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, /// Optional
923 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, /// Optional
924 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, /// Optional
925 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, /// Optional
926 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, /// Optional
927 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, /// Optional
928 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, /// Optional
Jesse Halld27f6aa2015-08-15 17:58:48 -0700929}
930
931/// Memory mapping flags
Jesse Halld8bade02015-11-24 10:24:18 -0800932type VkFlags VkMemoryMapFlags
Jesse Halla6429252015-11-29 18:59:42 -0800933//bitfield VkMemoryMapFlagBits {
934//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700935
936/// Bitfield of image aspects
Jesse Halld8bade02015-11-24 10:24:18 -0800937type VkFlags VkImageAspectFlags
938bitfield VkImageAspectFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700939 VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
940 VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
941 VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
942 VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
943}
944
945/// Sparse memory bind flags
Jesse Halld8bade02015-11-24 10:24:18 -0800946type VkFlags VkSparseMemoryBindFlags
Jesse Hall091ed9e2015-11-30 00:55:29 -0800947bitfield VkSparseMemoryBindFlagBits {
948 VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001,
949}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700950
951/// Sparse image memory requirements flags
Jesse Halld8bade02015-11-24 10:24:18 -0800952type VkFlags VkSparseImageFormatFlags
953bitfield VkSparseImageFormatFlagBits {
Jesse Hallb00daad2015-11-29 19:46:20 -0800954 VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices
955 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.
956 VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size
Jesse Halld27f6aa2015-08-15 17:58:48 -0700957}
958
959/// Pipeline stages
Jesse Halld8bade02015-11-24 10:24:18 -0800960type VkFlags VkPipelineStageFlags
961bitfield VkPipelineStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700962 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed
963 VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch
964 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch
965 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading
Jesse Hallae38f732015-11-19 21:32:50 -0800966 VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading
967 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading
Jesse Halld27f6aa2015-08-15 17:58:48 -0700968 VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading
969 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading
970 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests
971 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests
972 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes
973 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading
974 VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700975 VK_PIPELINE_STAGE_HOST_BIT = 0x00002000, /// Indicates host (CPU) is a source/sink of the dependency
Jesse Halld27f6aa2015-08-15 17:58:48 -0700976
Jesse Hall091ed9e2015-11-30 00:55:29 -0800977 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00004000, /// All stages of the graphics pipeline
978 VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00008000, /// All graphics, compute, copy, and transition commands
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700979}
980
981/// Render pass attachment description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800982type VkFlags VkAttachmentDescriptionFlags
983bitfield VkAttachmentDescriptionFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700984 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 -0700985}
986
987/// Subpass description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800988type VkFlags VkSubpassDescriptionFlags
989bitfield VkSubpassDescriptionFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700990}
991
992/// Command pool creation flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800993type VkFlags VkCommandPoolCreateFlags
994bitfield VkCommandPoolCreateFlagBits {
995 VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime
996 VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually
Jesse Halld27f6aa2015-08-15 17:58:48 -0700997}
998
999/// Command pool reset flags
Jesse Hall3fbc8562015-11-29 22:10:52 -08001000type VkFlags VkCommandPoolResetFlags
1001bitfield VkCommandPoolResetFlagBits {
1002 VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool
Jesse Halld27f6aa2015-08-15 17:58:48 -07001003}
1004
Jesse Hall3fbc8562015-11-29 22:10:52 -08001005type VkFlags VkCommandBufferResetFlags
1006bitfield VkCommandBufferResetFlagBits {
1007 VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001008}
1009
Jesse Halld8bade02015-11-24 10:24:18 -08001010type VkFlags VkSampleCountFlags
1011bitfield VkSampleCountFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001012 VK_SAMPLE_COUNT_1_BIT = 0x00000001,
1013 VK_SAMPLE_COUNT_2_BIT = 0x00000002,
1014 VK_SAMPLE_COUNT_4_BIT = 0x00000004,
1015 VK_SAMPLE_COUNT_8_BIT = 0x00000008,
1016 VK_SAMPLE_COUNT_16_BIT = 0x00000010,
1017 VK_SAMPLE_COUNT_32_BIT = 0x00000020,
1018 VK_SAMPLE_COUNT_64_BIT = 0x00000040,
1019}
1020
Jesse Halld8bade02015-11-24 10:24:18 -08001021type VkFlags VkStencilFaceFlags
1022bitfield VkStencilFaceFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001023 VK_STENCIL_FACE_NONE = 0x00000000, /// No faces
1024 VK_STENCIL_FACE_FRONT_BIT = 0x00000001, /// Front face
1025 VK_STENCIL_FACE_BACK_BIT = 0x00000002, /// Back face
Jesse Hallc7467b72015-11-29 21:05:26 -08001026 VK_STENCIL_FRONT_AND_BACK = 0x00000003,
Jesse Halld27f6aa2015-08-15 17:58:48 -07001027}
1028
Jesse Halla6429252015-11-29 18:59:42 -08001029/// Instance creation flags
1030type VkFlags VkInstanceCreateFlags
1031//bitfield VkInstanceCreateFlagBits {
1032//}
1033
1034/// Device creation flags
1035type VkFlags VkDeviceCreateFlags
1036//bitfield VkDeviceCreateFlagBits {
1037//}
1038
1039/// Device queue creation flags
1040type VkFlags VkDeviceQueueCreateFlags
1041//bitfield VkDeviceQueueCreateFlagBits {
1042//}
1043
1044/// Query pool creation flags
1045type VkFlags VkQueryPoolCreateFlags
1046//bitfield VkQueryPoolCreateFlagBits {
1047//}
1048
1049/// Buffer view creation flags
1050type VkFlags VkBufferViewCreateFlags
1051//bitfield VkBufferViewCreateFlagBits {
1052//}
1053
1054/// Pipeline cache creation flags
1055type VkFlags VkPipelineCacheCreateFlags
1056//bitfield VkPipelineCacheCreateFlagBits {
1057//}
1058
1059/// Pipeline shader stage creation flags
1060type VkFlags VkPipelineShaderStageCreateFlags
1061//bitfield VkPipelineShaderStageCreateFlagBits {
1062//}
1063
1064/// Descriptor set layout creation flags
1065type VkFlags VkDescriptorSetLayoutCreateFlags
1066//bitfield VkDescriptorSetLayoutCreateFlagBits {
1067//}
1068
1069/// Pipeline vertex input state creation flags
1070type VkFlags VkPipelineVertexInputStateCreateFlags
1071//bitfield VkPipelineVertexInputStateCreateFlagBits {
1072//}
1073
1074/// Pipeline input assembly state creation flags
1075type VkFlags VkPipelineInputAssemblyStateCreateFlags
1076//bitfield VkPipelineInputAssemblyStateCreateFlagBits {
1077//}
1078
1079/// Tessellation state creation flags
1080type VkFlags VkPipelineTessellationStateCreateFlags
1081//bitfield VkPipelineTessellationStateCreateFlagBits {
1082//}
1083
1084/// Viewport state creation flags
1085type VkFlags VkPipelineViewportStateCreateFlags
1086//bitfield VkPipelineViewportStateCreateFlagBits {
1087//}
1088
Jesse Hall3fbc8562015-11-29 22:10:52 -08001089/// Rasterization state creation flags
1090type VkFlags VkPipelineRasterizationStateCreateFlags
1091//bitfield VkPipelineRasterizationStateCreateFlagBits {
Jesse Halla6429252015-11-29 18:59:42 -08001092//}
1093
1094/// Multisample state creation flags
1095type VkFlags VkPipelineMultisampleStateCreateFlags
1096//bitfield VkPipelineMultisampleStateCreateFlagBits {
1097//}
1098
1099/// Color blend state creation flags
1100type VkFlags VkPipelineColorBlendStateCreateFlags
1101//bitfield VkPipelineColorBlendStateCreateFlagBits {
1102//}
1103
1104/// Depth/stencil state creation flags
1105type VkFlags VkPipelineDepthStencilStateCreateFlags
1106//bitfield VkPipelineDepthStencilStateCreateFlagBits {
1107//}
1108
1109/// Dynamic state creation flags
1110type VkFlags VkPipelineDynamicStateCreateFlags
1111//bitfield VkPipelineDynamicStateCreateFlagBits {
1112//}
1113
1114/// Pipeline layout creation flags
1115type VkFlags VkPipelineLayoutCreateFlags
1116//bitfield VkPipelineLayoutCreateFlagBits {
1117//}
1118
1119/// Sampler creation flags
1120type VkFlags VkSamplerCreateFlags
1121//bitfield VkSamplerCreateFlagBits {
1122//}
1123
1124/// Render pass creation flags
1125type VkFlags VkRenderPassCreateFlags
1126//bitfield VkRenderPassCreateFlagBits {
1127//}
1128
1129/// Framebuffer creation flags
1130type VkFlags VkFramebufferCreateFlags
1131//bitfield VkFramebufferCreateFlagBits {
1132//}
1133
Jesse Halldc6d36c2015-11-29 19:12:15 -08001134/// Dependency flags
1135type VkFlags VkDependencyFlags
1136bitfield VkDependencyFlagBits {
1137 VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
1138}
1139
Jesse Hallc7467b72015-11-29 21:05:26 -08001140/// Cull mode flags
1141type VkFlags VkCullModeFlags
1142bitfield VkCullModeFlagBits {
1143 VK_CULL_MODE_NONE = 0x00000000,
1144 VK_CULL_MODE_FRONT_BIT = 0x00000001,
1145 VK_CULL_MODE_BACK_BIT = 0x00000002,
1146 VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
1147}
1148
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001149@extension("VK_KHR_swapchain")
Jesse Halld8bade02015-11-24 10:24:18 -08001150type VkFlags VkSurfaceTransformFlagsKHR
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001151@extension("VK_KHR_swapchain")
Jesse Halld8bade02015-11-24 10:24:18 -08001152bitfield VkSurfaceTransformFlagBitsKHR {
Michael Lentine88594d72015-11-12 12:49:45 -08001153 VK_SURFACE_TRANSFORM_NONE_BIT_KHR = 0x00000001,
1154 VK_SURFACE_TRANSFORM_ROT90_BIT_KHR = 0x00000002,
1155 VK_SURFACE_TRANSFORM_ROT180_BIT_KHR = 0x00000004,
1156 VK_SURFACE_TRANSFORM_ROT270_BIT_KHR = 0x00000008,
1157 VK_SURFACE_TRANSFORM_HMIRROR_BIT_KHR = 0x00000010,
1158 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_BIT_KHR = 0x00000020,
1159 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_BIT_KHR = 0x00000040,
1160 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_BIT_KHR = 0x00000080,
1161 VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
1162}
Jesse Halld27f6aa2015-08-15 17:58:48 -07001163
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001164@extension("VK_KHR_swapchain")
Jesse Halla6429252015-11-29 18:59:42 -08001165type VkFlags VkCompositeAlphaFlagsKHR
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001166@extension("VK_KHR_swapchain")
Jesse Halla6429252015-11-29 18:59:42 -08001167bitfield VkCompositeAlphaFlagBitsKHR {
1168 VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
1169 VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
1170 VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
1171 VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
1172}
1173
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001174@extension("VK_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001175type VkFlags VkDisplayPlaneAlphaFlagsKHR
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001176@extension("VK_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001177bitfield VkDisplayPlaneAlphaFlagBitsKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08001178 VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000001,
1179 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000002,
1180 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000004,
1181}
1182
1183
Jesse Halld27f6aa2015-08-15 17:58:48 -07001184//////////////////
1185// Structures //
1186//////////////////
1187
1188class VkOffset2D {
1189 s32 x
1190 s32 y
1191}
1192
1193class VkOffset3D {
1194 s32 x
1195 s32 y
1196 s32 z
1197}
1198
1199class VkExtent2D {
1200 s32 width
1201 s32 height
1202}
1203
1204class VkExtent3D {
1205 s32 width
1206 s32 height
1207 s32 depth
1208}
1209
1210class VkViewport {
Jesse Hall65ab5522015-11-30 00:07:16 -08001211 f32 x
1212 f32 y
Jesse Halld27f6aa2015-08-15 17:58:48 -07001213 f32 width
1214 f32 height
1215 f32 minDepth
1216 f32 maxDepth
1217}
1218
1219class VkRect2D {
1220 VkOffset2D offset
1221 VkExtent2D extent
1222}
1223
Jesse Halla15a4bf2015-11-19 22:48:02 -08001224class VkClearRect {
1225 VkRect2D rect
1226 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001227 u32 layerCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001228}
1229
Jesse Hall65ab5522015-11-30 00:07:16 -08001230class VkComponentMapping {
1231 VkComponentSwizzle r
1232 VkComponentSwizzle g
1233 VkComponentSwizzle b
1234 VkComponentSwizzle a
Jesse Halld27f6aa2015-08-15 17:58:48 -07001235}
1236
1237class VkPhysicalDeviceProperties {
1238 u32 apiVersion
1239 u32 driverVersion
Jesse Hall65ab5522015-11-30 00:07:16 -08001240 u32 vendorID
1241 u32 deviceID
Jesse Halld27f6aa2015-08-15 17:58:48 -07001242 VkPhysicalDeviceType deviceType
Jesse Hall65ab5522015-11-30 00:07:16 -08001243 char[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE] deviceName
1244 u8[VK_UUID_SIZE] pipelineCacheUUID
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001245 VkPhysicalDeviceLimits limits
1246 VkPhysicalDeviceSparseProperties sparseProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001247}
1248
1249class VkExtensionProperties {
Jesse Hall65ab5522015-11-30 00:07:16 -08001250 char[VK_MAX_EXTENSION_NAME_SIZE] extensionName /// extension name
Jesse Halld27f6aa2015-08-15 17:58:48 -07001251 u32 specVersion /// version of the extension specification implemented
1252}
1253
1254class VkLayerProperties {
Jesse Hall65ab5522015-11-30 00:07:16 -08001255 char[VK_MAX_EXTENSION_NAME_SIZE] layerName /// layer name
Jesse Hall3fbc8562015-11-29 22:10:52 -08001256 u32 specVersion /// version of the layer specification implemented
1257 u32 implementationVersion /// build or release version of the layer's library
Jesse Hall65ab5522015-11-30 00:07:16 -08001258 char[VK_MAX_DESCRIPTION_SIZE] description /// Free-form description of the layer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001259}
1260
Jesse Halla366a512015-11-19 22:30:07 -08001261class VkSubmitInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001262 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_SUBMIT_INFO
1263 const void* pNext /// Next structure in chain
1264 u32 waitSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001265 const VkSemaphore* pWaitSemaphores
Jesse Hall03b6fe12015-11-24 12:44:21 -08001266 u32 commandBufferCount
Jesse Hall3fbc8562015-11-29 22:10:52 -08001267 const VkCommandBuffer* pCommandBuffers
Jesse Hall03b6fe12015-11-24 12:44:21 -08001268 u32 signalSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001269 const VkSemaphore* pSignalSemaphores
1270}
1271
Jesse Halld27f6aa2015-08-15 17:58:48 -07001272class VkApplicationInfo {
1273 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO
1274 const void* pNext /// Next structure in chain
Jesse Hall3fbc8562015-11-29 22:10:52 -08001275 const char* pApplicationName
1276 u32 applicationVersion
Jesse Halld27f6aa2015-08-15 17:58:48 -07001277 const char* pEngineName
1278 u32 engineVersion
1279 u32 apiVersion
1280}
1281
Jesse Hall3fbc8562015-11-29 22:10:52 -08001282class VkAllocationCallbacks {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001283 void* pUserData
Jesse Hall3fbc8562015-11-29 22:10:52 -08001284 PFN_vkAllocationFunction pfnAllocation
1285 PFN_vkReallocationFunction pfnReallocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001286 PFN_vkFreeFunction pfnFree
Jesse Hall3fbc8562015-11-29 22:10:52 -08001287 PFN_vkInternalAllocationNotification pfnInternalAllocation
Jesse Hall03b6fe12015-11-24 12:44:21 -08001288 PFN_vkInternalFreeNotification pfnInternalFree
Jesse Halld27f6aa2015-08-15 17:58:48 -07001289}
1290
1291class VkDeviceQueueCreateInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001292 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
1293 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001294 VkDeviceQueueCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001295 u32 queueFamilyIndex
Jesse Halldba27f72015-11-30 14:25:46 -08001296 u32 queueCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001297 const f32* pQueuePriorities
Jesse Halld27f6aa2015-08-15 17:58:48 -07001298}
1299
1300class VkDeviceCreateInfo {
1301 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
1302 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001303 VkDeviceCreateFlags flags
Jesse Halldba27f72015-11-30 14:25:46 -08001304 u32 queueCreateInfoCount
1305 const VkDeviceQueueCreateInfo* pQueueCreateInfos
Jesse Hall03b6fe12015-11-24 12:44:21 -08001306 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001307 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001308 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001309 const char* const* ppEnabledExtensionNames
1310 const VkPhysicalDeviceFeatures* pEnabledFeatures
Jesse Halld27f6aa2015-08-15 17:58:48 -07001311}
1312
1313class VkInstanceCreateInfo {
1314 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
1315 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001316 VkInstanceCreateFlags flags
Jesse Hall3fbc8562015-11-29 22:10:52 -08001317 const VkApplicationInfo* pApplicationInfo
Jesse Hall03b6fe12015-11-24 12:44:21 -08001318 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001319 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001320 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001321 const char* const* ppEnabledExtensionNames /// Extension names to be enabled
1322}
1323
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001324class VkQueueFamilyProperties {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001325 VkQueueFlags queueFlags /// Queue flags
1326 u32 queueCount
Jesse Hallacfa5342015-11-19 21:51:33 -08001327 u32 timestampValidBits
Jesse Hall65ab5522015-11-30 00:07:16 -08001328 VkExtent3D minImageTransferGranularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07001329}
1330
1331class VkPhysicalDeviceMemoryProperties {
1332 u32 memoryTypeCount
1333 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes
1334 u32 memoryHeapCount
1335 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps
1336}
1337
Jesse Hall3fbc8562015-11-29 22:10:52 -08001338class VkMemoryAllocateInfo {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001339 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO
1340 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001341 VkDeviceSize allocationSize /// Size of memory allocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001342 u32 memoryTypeIndex /// Index of the of the memory type to allocate from
1343}
1344
1345class VkMemoryRequirements {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001346 VkDeviceSize size /// Specified in bytes
1347 VkDeviceSize alignment /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001348 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object
1349}
1350
1351class VkSparseImageFormatProperties {
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001352 VkImageAspectFlagBits aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001353 VkExtent3D imageGranularity
1354 VkSparseImageFormatFlags flags
1355}
1356
1357class VkSparseImageMemoryRequirements {
Jesse Hallb00daad2015-11-29 19:46:20 -08001358 VkSparseImageFormatProperties formatProperties
Jesse Hall65ab5522015-11-30 00:07:16 -08001359 u32 imageMipTailStartLod
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001360 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment
1361 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment
1362 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07001363}
1364
1365class VkMemoryType {
1366 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type
1367 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from
1368}
1369
1370class VkMemoryHeap {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001371 VkDeviceSize size /// Available memory in the heap
Jesse Halld27f6aa2015-08-15 17:58:48 -07001372 VkMemoryHeapFlags flags /// Flags for the heap
1373}
1374
1375class VkMappedMemoryRange {
1376 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
1377 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001378 VkDeviceMemory memory /// Mapped memory object
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001379 VkDeviceSize offset /// Offset within the mapped memory the range starts from
1380 VkDeviceSize size /// Size of the range within the mapped memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07001381}
1382
1383class VkFormatProperties {
1384 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling
1385 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001386 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001387}
1388
1389class VkImageFormatProperties {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001390 VkExtent3D maxExtent /// max image dimensions for this resource type
1391 u32 maxMipLevels /// max number of mipmap levels for this resource type
Jesse Halla15a4bf2015-11-19 22:48:02 -08001392 u32 maxArrayLayers /// max array layers for this resource type
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001393 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type
1394 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type
1395}
1396
Jesse Halla15a4bf2015-11-19 22:48:02 -08001397class VkDescriptorImageInfo {
1398 VkSampler sampler
1399 VkImageView imageView
1400 VkImageLayout imageLayout
1401}
1402
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001403class VkDescriptorBufferInfo {
1404 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC]
1405 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set.
1406 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001407}
1408
Jesse Halld27f6aa2015-08-15 17:58:48 -07001409class VkWriteDescriptorSet {
1410 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
1411 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001412 VkDescriptorSet dstSet /// Destination descriptor set
1413 u32 dstBinding /// Binding within the destination descriptor set to write
1414 u32 dstArrayElement /// Array element within the destination binding to write
Jesse Hall03b6fe12015-11-24 12:44:21 -08001415 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001416 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 -08001417 const VkDescriptorImageInfo* pImageInfo
1418 const VkDescriptorBufferInfo* pBufferInfo
1419 const VkBufferView* pTexelBufferView
Jesse Halld27f6aa2015-08-15 17:58:48 -07001420}
1421
1422class VkCopyDescriptorSet {
1423 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
1424 const void* pNext /// Pointer to next structure
1425 VkDescriptorSet srcSet /// Source descriptor set
1426 u32 srcBinding /// Binding within the source descriptor set to copy from
1427 u32 srcArrayElement /// Array element within the source binding to copy from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001428 VkDescriptorSet dstSet /// Destination descriptor set
1429 u32 dstBinding /// Binding within the destination descriptor set to copy to
1430 u32 dstArrayElement /// Array element within the destination binding to copy to
Jesse Hall03b6fe12015-11-24 12:44:21 -08001431 u32 descriptorCount /// Number of descriptors to copy
Jesse Halld27f6aa2015-08-15 17:58:48 -07001432}
1433
1434class VkBufferCreateInfo {
1435 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
1436 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001437 VkBufferCreateFlags flags /// Buffer creation flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001438 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001439 VkBufferUsageFlags usage /// Buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001440 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001441 u32 queueFamilyIndexCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001442 const u32* pQueueFamilyIndices
1443}
1444
1445class VkBufferViewCreateInfo {
1446 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
1447 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001448 VkBufferViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001449 VkBuffer buffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001450 VkFormat format /// Optionally specifies format of elements
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001451 VkDeviceSize offset /// Specified in bytes
1452 VkDeviceSize range /// View size specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001453}
1454
1455class VkImageSubresource {
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001456 VkImageAspectFlagBits aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001457 u32 mipLevel
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001458 u32 arrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001459}
1460
1461class VkImageSubresourceRange {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001462 VkImageAspectFlags aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001463 u32 baseMipLevel
Jesse Hall3fbc8562015-11-29 22:10:52 -08001464 u32 levelCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001465 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001466 u32 layerCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001467}
1468
1469class VkMemoryBarrier {
1470 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER
1471 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001472 VkAccessFlags srcAccessMask
1473 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001474}
1475
1476class VkBufferMemoryBarrier {
1477 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
1478 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001479 VkAccessFlags srcAccessMask
1480 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001481 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001482 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001483 VkBuffer buffer /// Buffer to sync
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001484 VkDeviceSize offset /// Offset within the buffer to sync
1485 VkDeviceSize size /// Amount of bytes to sync
Jesse Halld27f6aa2015-08-15 17:58:48 -07001486}
1487
1488class VkImageMemoryBarrier {
1489 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
1490 const void* pNext /// Pointer to next structure.
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001491 VkAccessFlags srcAccessMask
1492 VkAccessFlags dstAccessMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001493 VkImageLayout oldLayout /// Current layout of the image
1494 VkImageLayout newLayout /// New layout to transition the image to
1495 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001496 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001497 VkImage image /// Image to sync
1498 VkImageSubresourceRange subresourceRange /// Subresource range to sync
1499}
1500
1501class VkImageCreateInfo {
1502 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
1503 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001504 VkImageCreateFlags flags /// Image creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001505 VkImageType imageType
1506 VkFormat format
1507 VkExtent3D extent
1508 u32 mipLevels
Jesse Halla15a4bf2015-11-19 22:48:02 -08001509 u32 arrayLayers
Jesse Hall091ed9e2015-11-30 00:55:29 -08001510 VkSampleCountFlagBits samples
Jesse Halld27f6aa2015-08-15 17:58:48 -07001511 VkImageTiling tiling
1512 VkImageUsageFlags usage /// Image usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001513 VkSharingMode sharingMode /// Cross-queue-family sharing mode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001514 u32 queueFamilyIndexCount /// Number of queue families to share across
Jesse Halld27f6aa2015-08-15 17:58:48 -07001515 const u32* pQueueFamilyIndices /// Array of queue family indices to share across
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001516 VkImageLayout initialLayout /// Initial image layout for all subresources
Jesse Halld27f6aa2015-08-15 17:58:48 -07001517}
1518
1519class VkSubresourceLayout {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001520 VkDeviceSize offset /// Specified in bytes
1521 VkDeviceSize size /// Specified in bytes
1522 VkDeviceSize rowPitch /// Specified in bytes
1523 VkDeviceSize depthPitch /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001524}
1525
1526class VkImageViewCreateInfo {
1527 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
1528 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001529 VkImageViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001530 VkImage image
1531 VkImageViewType viewType
1532 VkFormat format
Jesse Hall65ab5522015-11-30 00:07:16 -08001533 VkComponentMapping components
Jesse Halld27f6aa2015-08-15 17:58:48 -07001534 VkImageSubresourceRange subresourceRange
Jesse Halld27f6aa2015-08-15 17:58:48 -07001535}
1536
1537class VkBufferCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001538 VkDeviceSize srcOffset /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001539 VkDeviceSize dstOffset /// Specified in bytes
Jesse Hallb00daad2015-11-29 19:46:20 -08001540 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001541}
1542
Jesse Halla6429252015-11-29 18:59:42 -08001543class VkSparseMemoryBind {
Jesse Hallb00daad2015-11-29 19:46:20 -08001544 VkDeviceSize resourceOffset /// Specified in bytes
1545 VkDeviceSize size /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001546 VkDeviceMemory memory
1547 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001548 VkSparseMemoryBindFlags flags
1549}
1550
Jesse Halla6429252015-11-29 18:59:42 -08001551class VkSparseImageMemoryBind {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001552 VkImageSubresource subresource
1553 VkOffset3D offset
1554 VkExtent3D extent
Jesse Hall3fbc8562015-11-29 22:10:52 -08001555 VkDeviceMemory memory
1556 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001557 VkSparseMemoryBindFlags flags
1558}
1559
Jesse Halla6429252015-11-29 18:59:42 -08001560class VkSparseBufferMemoryBindInfo {
1561 VkBuffer buffer
1562 u32 bindCount
1563 const VkSparseMemoryBind* pBinds
1564}
1565
1566class VkSparseImageOpaqueMemoryBindInfo {
1567 VkImage image
1568 u32 bindCount
1569 const VkSparseMemoryBind* pBinds
1570}
1571
1572class VkSparseImageMemoryBindInfo {
1573 VkImage image
1574 u32 bindCount
1575 const VkSparseMemoryBind* pBinds
1576}
1577
1578class VkBindSparseInfo {
1579 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
1580 const void* pNext
1581 u32 waitSemaphoreCount
1582 const VkSemaphore* pWaitSemaphores
1583 u32 numBufferBinds
1584 const VkSparseBufferMemoryBindInfo* pBufferBinds
1585 u32 numImageOpaqueBinds
1586 const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds
1587 u32 numImageBinds
1588 const VkSparseImageMemoryBindInfo* pImageBinds
1589 u32 signalSemaphoreCount
1590 const VkSemaphore* pSignalSemaphores
1591}
1592
Jesse Hall65ab5522015-11-30 00:07:16 -08001593class VkImageSubresourceLayers {
1594 VkImageAspectFlags aspectMask
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001595 u32 mipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001596 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001597 u32 layerCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001598}
1599
Jesse Halld27f6aa2015-08-15 17:58:48 -07001600class VkImageCopy {
Jesse Hall65ab5522015-11-30 00:07:16 -08001601 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001602 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Hall65ab5522015-11-30 00:07:16 -08001603 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001604 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001605 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images
1606}
1607
1608class VkImageBlit {
Jesse Hall65ab5522015-11-30 00:07:16 -08001609 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001610 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
1611 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Hall65ab5522015-11-30 00:07:16 -08001612 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001613 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
1614 VkExtent3D dstExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001615}
1616
1617class VkBufferImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001618 VkDeviceSize bufferOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001619 u32 bufferRowLength /// Specified in texels
1620 u32 bufferImageHeight
Jesse Hall65ab5522015-11-30 00:07:16 -08001621 VkImageSubresourceLayers imageSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001622 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images
1623 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images
1624}
1625
1626class VkImageResolve {
Jesse Hall65ab5522015-11-30 00:07:16 -08001627 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001628 VkOffset3D srcOffset
Jesse Hall65ab5522015-11-30 00:07:16 -08001629 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001630 VkOffset3D dstOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07001631 VkExtent3D extent
1632}
1633
1634class VkShaderModuleCreateInfo {
1635 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
1636 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001637 VkShaderModuleCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001638 platform.size_t codeSize /// Specified in bytes
Jesse Halla9bb62b2015-11-21 19:31:56 -08001639 const u32* pCode /// Binary code of size codeSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07001640}
1641
Jesse Halld27f6aa2015-08-15 17:58:48 -07001642class VkDescriptorSetLayoutBinding {
Jesse Hall091ed9e2015-11-30 00:55:29 -08001643 u32 binding
Jesse Halld27f6aa2015-08-15 17:58:48 -07001644 VkDescriptorType descriptorType /// Type of the descriptors in this binding
Jesse Halldba27f72015-11-30 14:25:46 -08001645 u32 descriptorCount /// Number of descriptors in this binding
Jesse Halld27f6aa2015-08-15 17:58:48 -07001646 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to
1647 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements)
1648}
1649
1650class VkDescriptorSetLayoutCreateInfo {
1651 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
1652 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001653 VkDescriptorSetLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001654 u32 bindingCount /// Number of bindings in the descriptor set layout
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001655 const VkDescriptorSetLayoutBinding* pBinding /// Array of descriptor set layout bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001656}
1657
Jesse Hall65ab5522015-11-30 00:07:16 -08001658class VkDescriptorPoolSize {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001659 VkDescriptorType type
Jesse Hall03b6fe12015-11-24 12:44:21 -08001660 u32 descriptorCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001661}
1662
1663class VkDescriptorPoolCreateInfo {
1664 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
1665 const void* pNext /// Pointer to next structure
Jesse Hallfbf97b02015-11-20 14:17:03 -08001666 VkDescriptorPoolCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001667 u32 maxSets
Jesse Hall65ab5522015-11-30 00:07:16 -08001668 u32 poolSizeCount
1669 const VkDescriptorPoolSize* pPoolSizes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001670}
1671
Jesse Hall3fbc8562015-11-29 22:10:52 -08001672class VkDescriptorSetAllocateInfo {
Jesse Hallfbf97b02015-11-20 14:17:03 -08001673 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO
1674 const void* pNext /// Pointer to next structure
1675 VkDescriptorPool descriptorPool
Jesse Hall03b6fe12015-11-24 12:44:21 -08001676 u32 setCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001677 const VkDescriptorSetLayout* pSetLayouts
1678}
1679
Jesse Halld27f6aa2015-08-15 17:58:48 -07001680class VkSpecializationMapEntry {
Jesse Hall65ab5522015-11-30 00:07:16 -08001681 u32 constantID /// The SpecConstant ID specified in the BIL
Jesse Halld27f6aa2015-08-15 17:58:48 -07001682 u32 offset /// Offset of the value in the data block
Jesse Hallb00daad2015-11-29 19:46:20 -08001683 platform.size_t size /// Size in bytes of the SpecConstant
Jesse Halld27f6aa2015-08-15 17:58:48 -07001684}
1685
1686class VkSpecializationInfo {
1687 u32 mapEntryCount /// Number of entries in the map
Jesse Hallb00daad2015-11-29 19:46:20 -08001688 const VkSpecializationMapEntry* pMapEntries /// Array of map entries
Jesse Halld27f6aa2015-08-15 17:58:48 -07001689 platform.size_t dataSize /// Size in bytes of pData
1690 const void* pData /// Pointer to SpecConstant data
1691}
1692
1693class VkPipelineShaderStageCreateInfo {
1694 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
1695 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001696 VkPipelineShaderStageCreateFlags flags
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08001697 VkShaderStageFlagBits stage
1698 VkShaderModule module
1699 const char* pName
Jesse Halld27f6aa2015-08-15 17:58:48 -07001700 const VkSpecializationInfo* pSpecializationInfo
1701}
1702
1703class VkComputePipelineCreateInfo {
1704 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
1705 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001706 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001707 VkPipelineShaderStageCreateInfo stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001708 VkPipelineLayout layout /// Interface layout of the pipeline
1709 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
1710 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
1711}
1712
1713class VkVertexInputBindingDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001714 u32 binding /// Vertex buffer binding id
1715 u32 stride /// Distance between vertices in bytes (0 = no advancement)
Jesse Hall65ab5522015-11-30 00:07:16 -08001716 VkVertexInputRate inputRate /// Rate at which binding is incremented
Jesse Halld27f6aa2015-08-15 17:58:48 -07001717}
1718
1719class VkVertexInputAttributeDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001720 u32 location /// location of the shader vertex attrib
1721 u32 binding /// Vertex buffer binding id
1722 VkFormat format /// format of source data
1723 u32 offset /// Offset of first element in bytes from base of vertex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001724}
1725
1726class VkPipelineVertexInputStateCreateInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001727 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
1728 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001729 VkPipelineVertexInputStateCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001730 u32 vertexBindingDescriptionCount /// number of bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001731 const VkVertexInputBindingDescription* pVertexBindingDescriptions
Jesse Hall03b6fe12015-11-24 12:44:21 -08001732 u32 vertexAttributeDescriptionCount /// number of attributes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001733 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
1734}
1735
1736class VkPipelineInputAssemblyStateCreateInfo {
1737 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
1738 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001739 VkPipelineInputAssemblyStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001740 VkPrimitiveTopology topology
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001741 VkBool32 primitiveRestartEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001742}
1743
1744class VkPipelineTessellationStateCreateInfo {
1745 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
1746 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001747 VkPipelineTessellationStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001748 u32 patchControlPoints
1749}
1750
1751class VkPipelineViewportStateCreateInfo {
1752 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
1753 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001754 VkPipelineViewportStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001755 u32 viewportCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001756 const VkViewport* pViewports
1757 u32 scissorCount
1758 const VkRect2D* pScissors
Jesse Halld27f6aa2015-08-15 17:58:48 -07001759}
1760
Jesse Hall3fbc8562015-11-29 22:10:52 -08001761class VkPipelineRasterizationStateCreateInfo {
Jesse Hall65ab5522015-11-30 00:07:16 -08001762 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001763 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001764 VkPipelineRasterizationStateCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001765 VkBool32 depthClampEnable
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001766 VkBool32 rasterizerDiscardEnable
Jesse Hall65ab5522015-11-30 00:07:16 -08001767 VkPolygonMode polygonMode /// optional (GL45)
Jesse Hallc7467b72015-11-29 21:05:26 -08001768 VkCullModeFlags cullMode
Jesse Halld27f6aa2015-08-15 17:58:48 -07001769 VkFrontFace frontFace
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001770 VkBool32 depthBiasEnable
Jesse Halla9bb62b2015-11-21 19:31:56 -08001771 f32 depthBiasConstantFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001772 f32 depthBiasClamp
Jesse Halla9bb62b2015-11-21 19:31:56 -08001773 f32 depthBiasSlopeFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001774 f32 lineWidth
Jesse Halld27f6aa2015-08-15 17:58:48 -07001775}
1776
1777class VkPipelineMultisampleStateCreateInfo {
1778 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
1779 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001780 VkPipelineMultisampleStateCreateFlags flags
Jesse Hall091ed9e2015-11-30 00:55:29 -08001781 VkSampleCountFlagBits rasterizationSamples /// Number of samples used for rasterization
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001782 VkBool32 sampleShadingEnable /// optional (GL45)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001783 f32 minSampleShading /// optional (GL45)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001784 const VkSampleMask* pSampleMask
Jesse Hallacfa5342015-11-19 21:51:33 -08001785 VkBool32 alphaToCoverageEnable
1786 VkBool32 alphaToOneEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001787}
1788
1789class VkPipelineColorBlendAttachmentState {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001790 VkBool32 blendEnable
Jesse Hall65ab5522015-11-30 00:07:16 -08001791 VkBlendFactor srcColorBlendFactor
1792 VkBlendFactor dstColorBlendFactor
1793 VkBlendOp colorBlendOp
1794 VkBlendFactor srcAlphaBlendFactor
1795 VkBlendFactor dstAlphaBlendFactor
1796 VkBlendOp alphaBlendOp
1797 VkColorComponentFlags colorWriteMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001798}
1799
1800class VkPipelineColorBlendStateCreateInfo {
1801 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
1802 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001803 VkPipelineColorBlendStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001804 VkBool32 logicOpEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001805 VkLogicOp logicOp
1806 u32 attachmentCount /// # of pAttachments
1807 const VkPipelineColorBlendAttachmentState* pAttachments
Jesse Hallb00daad2015-11-29 19:46:20 -08001808 f32[4] blendConstants
Jesse Halld27f6aa2015-08-15 17:58:48 -07001809}
1810
1811class VkStencilOpState {
Jesse Hall65ab5522015-11-30 00:07:16 -08001812 VkStencilOp failOp
1813 VkStencilOp passOp
1814 VkStencilOp depthFailOp
1815 VkCompareOp compareOp
1816 u32 compareMask
1817 u32 writeMask
1818 u32 reference
Jesse Halld27f6aa2015-08-15 17:58:48 -07001819}
1820
1821class VkPipelineDepthStencilStateCreateInfo {
1822 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
1823 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001824 VkPipelineDepthStencilStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001825 VkBool32 depthTestEnable
1826 VkBool32 depthWriteEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001827 VkCompareOp depthCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001828 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test)
1829 VkBool32 stencilTestEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001830 VkStencilOpState front
1831 VkStencilOpState back
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001832 f32 minDepthBounds
1833 f32 maxDepthBounds
1834}
1835
1836class VkPipelineDynamicStateCreateInfo {
1837 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
1838 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001839 VkPipelineDynamicStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001840 u32 dynamicStateCount
1841 const VkDynamicState* pDynamicStates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001842}
1843
1844class VkGraphicsPipelineCreateInfo {
Jesse Halla6429252015-11-29 18:59:42 -08001845 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
1846 const void* pNext /// Pointer to next structure
1847 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001848 u32 stageCount
Jesse Halla6429252015-11-29 18:59:42 -08001849 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001850 const VkPipelineVertexInputStateCreateInfo* pVertexInputState
1851 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
1852 const VkPipelineTessellationStateCreateInfo* pTessellationState
1853 const VkPipelineViewportStateCreateInfo* pViewportState
Jesse Hall3fbc8562015-11-29 22:10:52 -08001854 const VkPipelineRasterizationStateCreateInfo* pRasterizationState
Jesse Halld27f6aa2015-08-15 17:58:48 -07001855 const VkPipelineMultisampleStateCreateInfo* pMultisampleState
1856 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState
1857 const VkPipelineColorBlendStateCreateInfo* pColorBlendState
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001858 const VkPipelineDynamicStateCreateInfo* pDynamicState
Jesse Halla6429252015-11-29 18:59:42 -08001859 VkPipelineLayout layout /// Interface layout of the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001860 VkRenderPass renderPass
1861 u32 subpass
Jesse Halla6429252015-11-29 18:59:42 -08001862 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
1863 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 -07001864}
1865
1866class VkPipelineCacheCreateInfo {
Jesse Hallb00daad2015-11-29 19:46:20 -08001867 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
1868 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001869 VkPipelineCacheCreateFlags flags
Jesse Hallb00daad2015-11-29 19:46:20 -08001870 platform.size_t initialDataSize /// Size of initial data to populate cache, in bytes
1871 const void* pInitialData /// Initial data to populate cache
Jesse Halld27f6aa2015-08-15 17:58:48 -07001872}
1873
1874class VkPushConstantRange {
1875 VkShaderStageFlags stageFlags /// Which stages use the range
Jesse Hall03b6fe12015-11-24 12:44:21 -08001876 u32 offset /// Start of the range, in bytes
1877 u32 size /// Length of the range, in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001878}
1879
1880class VkPipelineLayoutCreateInfo {
1881 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
1882 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001883 VkPipelineLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001884 u32 setLayoutCount /// Number of descriptor sets interfaced by the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001885 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the
1886 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline
1887 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages
1888}
1889
1890class VkSamplerCreateInfo {
1891 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
1892 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001893 VkSamplerCreateFlags flags
Jesse Hall23ff73f2015-11-29 14:36:39 -08001894 VkFilter magFilter /// Filter mode for magnification
1895 VkFilter minFilter /// Filter mode for minifiation
1896 VkSamplerMipmapMode mipmapMode /// Mipmap selection mode
1897 VkSamplerAddressMode addressModeU
1898 VkSamplerAddressMode addressModeV
1899 VkSamplerAddressMode addressModeW
Jesse Halld27f6aa2015-08-15 17:58:48 -07001900 f32 mipLodBias
1901 f32 maxAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001902 VkBool32 compareEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001903 VkCompareOp compareOp
1904 f32 minLod
1905 f32 maxLod
1906 VkBorderColor borderColor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001907 VkBool32 unnormalizedCoordinates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001908}
1909
Jesse Hall3fbc8562015-11-29 22:10:52 -08001910class VkCommandPoolCreateInfo {
1911 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001912 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001913 VkCommandPoolCreateFlags flags /// Command pool creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001914 u32 queueFamilyIndex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001915}
1916
Jesse Hall3fbc8562015-11-29 22:10:52 -08001917class VkCommandBufferAllocateInfo {
1918 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOC_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001919 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001920 VkCommandPool commandPool
1921 VkCommandBufferLevel level
Jesse Hall03b6fe12015-11-24 12:44:21 -08001922 u32 bufferCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001923}
1924
Jesse Hall3fbc8562015-11-29 22:10:52 -08001925class VkCommandBufferBeginInfo {
1926 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001927 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001928 VkCommandBufferUsageFlags flags /// Command buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001929 VkRenderPass renderPass /// Render pass for secondary command buffers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001930 u32 subpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07001931 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers
1932}
1933
1934class VkRenderPassBeginInfo {
1935 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
1936 const void* pNext /// Pointer to next structure
1937 VkRenderPass renderPass
1938 VkFramebuffer framebuffer
1939 VkRect2D renderArea
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001940 u32 clearValueCount
1941 const VkClearValue* pClearValues
Jesse Halld27f6aa2015-08-15 17:58:48 -07001942}
1943
1944@union
1945/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared.
1946class VkClearColorValue {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001947 f32[4] float32
1948 s32[4] int32
1949 u32[4] uint32
Jesse Halld27f6aa2015-08-15 17:58:48 -07001950}
1951
1952class VkClearDepthStencilValue {
1953 f32 depth
1954 u32 stencil
1955}
1956
1957@union
1958/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared.
1959class VkClearValue {
1960 VkClearColorValue color
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001961 VkClearDepthStencilValue depthStencil
Jesse Halld27f6aa2015-08-15 17:58:48 -07001962}
1963
Jesse Hallae38f732015-11-19 21:32:50 -08001964class VkClearAttachment {
1965 VkImageAspectFlags aspectMask
1966 u32 colorAttachment
1967 VkClearValue clearValue
1968}
1969
Jesse Halld27f6aa2015-08-15 17:58:48 -07001970class VkAttachmentDescription {
Jesse Halla6429252015-11-29 18:59:42 -08001971 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001972 VkFormat format
Jesse Hall091ed9e2015-11-30 00:55:29 -08001973 VkSampleCountFlagBits samples
Jesse Halld27f6aa2015-08-15 17:58:48 -07001974 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1975 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1976 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1977 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1978 VkImageLayout initialLayout
1979 VkImageLayout finalLayout
1980}
1981
1982class VkAttachmentReference {
1983 u32 attachment
1984 VkImageLayout layout
1985}
1986
1987class VkSubpassDescription {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001988 VkSubpassDescriptionFlags flags
Jesse Halla6429252015-11-29 18:59:42 -08001989 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
Jesse Hall03b6fe12015-11-24 12:44:21 -08001990 u32 inputAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001991 const VkAttachmentReference* pInputAttachments
Jesse Hall03b6fe12015-11-24 12:44:21 -08001992 u32 colorAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001993 const VkAttachmentReference* pColorAttachments
1994 const VkAttachmentReference* pResolveAttachments
Jesse Hallc7467b72015-11-29 21:05:26 -08001995 const VkAttachmentReference* pDepthStencilAttachment
Jesse Hall03b6fe12015-11-24 12:44:21 -08001996 u32 preserveAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001997 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07001998}
1999
2000class VkSubpassDependency {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002001 u32 srcSubpass
Jesse Hall3fbc8562015-11-29 22:10:52 -08002002 u32 dstSubpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07002003 VkPipelineStageFlags srcStageMask
Jesse Hall3fbc8562015-11-29 22:10:52 -08002004 VkPipelineStageFlags dstStageMask
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002005 VkAccessFlags srcAccessMask
2006 VkAccessFlags dstAccessMask
Jesse Halldc6d36c2015-11-29 19:12:15 -08002007 VkDependencyFlags dependencyFlags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002008}
2009
2010class VkRenderPassCreateInfo {
2011 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
2012 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002013 VkRenderPassCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002014 u32 attachmentCount
2015 const VkAttachmentDescription* pAttachments
2016 u32 subpassCount
2017 const VkSubpassDescription* pSubpasses
2018 u32 dependencyCount
2019 const VkSubpassDependency* pDependencies
2020}
2021
2022class VkEventCreateInfo {
2023 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
2024 const void* pNext /// Pointer to next structure
2025 VkEventCreateFlags flags /// Event creation flags
2026}
2027
2028class VkFenceCreateInfo {
2029 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
2030 const void* pNext /// Pointer to next structure
2031 VkFenceCreateFlags flags /// Fence creation flags
2032}
2033
2034class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002035 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
2036 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
2037 VkBool32 imageCubeArray /// image views which are arrays of cube maps
2038 VkBool32 independentBlend /// blending operations are controlled per-attachment
2039 VkBool32 geometryShader /// geometry stage
2040 VkBool32 tessellationShader /// tessellation control and evaluation stage
2041 VkBool32 sampleRateShading /// per-sample shading and interpolation
Jesse Hall3fbc8562015-11-29 22:10:52 -08002042 VkBool32 dualSrcBlend /// blend operations which take two sources
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002043 VkBool32 logicOp /// logic operations
2044 VkBool32 multiDrawIndirect /// multi draw indirect
Jesse Hallae38f732015-11-19 21:32:50 -08002045 VkBool32 depthClamp /// depth clamping
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002046 VkBool32 depthBiasClamp /// depth bias clamping
2047 VkBool32 fillModeNonSolid /// point and wireframe fill modes
2048 VkBool32 depthBounds /// depth bounds test
2049 VkBool32 wideLines /// lines with width greater than 1
2050 VkBool32 largePoints /// points with size greater than 1
Jesse Hallfbf97b02015-11-20 14:17:03 -08002051 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
2052 VkBool32 multiViewport
2053 VkBool32 samplerAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002054 VkBool32 textureCompressionETC2 /// ETC texture compression formats
2055 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
2056 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
Jesse Hall65ab5522015-11-30 00:07:16 -08002057 VkBool32 occlusionQueryPrecise
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002058 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
Jesse Halldc6d36c2015-11-29 19:12:15 -08002059 VkBool32 vertexPipelineStoresAndAtomics
2060 VkBool32 fragmentStoresAndAtomics
2061 VkBool32 shaderTessellationAndGeometryPointSize
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002062 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
2063 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
2064 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
Jesse Halld1af8122015-11-29 23:50:38 -08002065 VkBool32 shaderStorageImageReadWithoutFormat
2066 VkBool32 shaderStorageImageWriteWithoutFormat
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002067 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
2068 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
2069 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
2070 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
2071 VkBool32 shaderClipDistance /// clip distance in shaders
2072 VkBool32 shaderCullDistance /// cull distance in shaders
2073 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
2074 VkBool32 shaderInt64 /// 64-bit integers in shaders
2075 VkBool32 shaderInt16 /// 16-bit integers in shaders
2076 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
Jesse Hall65ab5522015-11-30 00:07:16 -08002077 VkBool32 shaderResourceMinLod /// shader can use texture operations that specify minimum resource LOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002078 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
2079 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
2080 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
2081 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
2082 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
2083 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
2084 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
2085 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
2086 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld1af8122015-11-29 23:50:38 -08002087 VkBool32 variableMultisampleRate
Jesse Halld27f6aa2015-08-15 17:58:48 -07002088}
2089
2090class VkPhysicalDeviceLimits {
2091 /// resource maximum sizes
2092 u32 maxImageDimension1D /// max 1D image dimension
2093 u32 maxImageDimension2D /// max 2D image dimension
2094 u32 maxImageDimension3D /// max 3D image dimension
2095 u32 maxImageDimensionCube /// max cubemap image dimension
2096 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hallb00daad2015-11-29 19:46:20 -08002097 u32 maxTexelBufferElements
Jesse Hallfbf97b02015-11-20 14:17:03 -08002098 u32 maxUniformBufferRange /// max uniform buffer size (bytes)
2099 u32 maxStorageBufferRange /// max storage buffer size (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002100 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
2101 /// memory limits
2102 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall091ed9e2015-11-30 00:55:29 -08002103 u32 maxSamplerAllocationCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002104 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
2105 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002106 /// descriptor set limits
2107 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07002108 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
2109 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
2110 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
2111 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
2112 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
Jesse Halle1b12782015-11-30 11:27:32 -08002113 u32 maxPerStageDescriptorInputAttachments
Jesse Halldba27f72015-11-30 14:25:46 -08002114 u32 maxPerStageResources
Jesse Halld27f6aa2015-08-15 17:58:48 -07002115 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
2116 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002117 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002118 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002119 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002120 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
2121 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
Jesse Halle1b12782015-11-30 11:27:32 -08002122 u32 maxDescriptorSetInputAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002123 /// vertex stage limits
2124 u32 maxVertexInputAttributes /// max num of vertex input attribute slots
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002125 u32 maxVertexInputBindings /// max num of vertex input binding slots
Jesse Halld27f6aa2015-08-15 17:58:48 -07002126 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset
2127 u32 maxVertexInputBindingStride /// max vertex input binding stride
2128 u32 maxVertexOutputComponents /// max num of output components written by vertex shader
2129 /// tessellation control stage limits
Jesse Hall3fbc8562015-11-29 22:10:52 -08002130 u32 maxTessellationGenerationLevel /// max level supported by tess primitive generator
Jesse Hallae38f732015-11-19 21:32:50 -08002131 u32 maxTessellationPatchSize /// max patch size (vertices)
2132 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS
2133 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS
2134 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS
2135 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS
2136 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES
2137 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES
Jesse Halld27f6aa2015-08-15 17:58:48 -07002138 /// geometry stage limits
2139 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader
2140 u32 maxGeometryInputComponents /// max num of input components read in geometry stage
2141 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage
2142 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage
2143 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage
2144 /// fragment stage limits
2145 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage
Jesse Hallfbf97b02015-11-20 14:17:03 -08002146 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage
Jesse Hall3fbc8562015-11-29 22:10:52 -08002147 u32 maxFragmentDualSrcAttachments /// max num of output attachments written when using dual source blending
Jesse Halld27f6aa2015-08-15 17:58:48 -07002148 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers
2149 /// compute stage limits
2150 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes)
2151 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z)
2152 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group
2153 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z)
2154
2155 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y
2156 u32 subTexelPrecisionBits /// num bits of subtexel precision
2157 u32 mipmapPrecisionBits /// num bits of mipmap precision
2158
2159 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices)
Jesse Halldba27f72015-11-30 14:25:46 -08002160 u32 maxDrawIndirectCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07002161
2162 f32 maxSamplerLodBias /// max absolute sampler level of detail bias
2163 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy
2164
2165 u32 maxViewports /// max number of active viewports
Jesse Halld27f6aa2015-08-15 17:58:48 -07002166 u32[2] maxViewportDimensions /// max viewport dimensions (x,y)
2167 f32[2] viewportBoundsRange /// viewport bounds range (min,max)
2168 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport
2169
Jesse Halldc6d36c2015-11-29 19:12:15 -08002170 platform.size_t minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes)
2171 VkDeviceSize minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes)
2172 VkDeviceSize minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes)
2173 VkDeviceSize minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002174
Jesse Hallfbf97b02015-11-20 14:17:03 -08002175 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002176 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset
Jesse Hallfbf97b02015-11-20 14:17:03 -08002177 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002178 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset
2179 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset
2180 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset
2181 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset
2182
2183 u32 maxFramebufferWidth /// max width for a framebuffer
2184 u32 maxFramebufferHeight /// max height for a framebuffer
2185 u32 maxFramebufferLayers /// max layer count for a layered framebuffer
Jesse Hall091ed9e2015-11-30 00:55:29 -08002186 VkSampleCountFlags framebufferColorSampleCounts
2187 VkSampleCountFlags framebufferDepthSampleCounts
2188 VkSampleCountFlags framebufferStencilSampleCounts
2189 VkSampleCountFlags framebufferNoAttachmentSampleCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07002190 u32 maxColorAttachments /// max num of framebuffer color attachments
2191
Jesse Hall091ed9e2015-11-30 00:55:29 -08002192 VkSampleCountFlags sampledImageColorSampleCounts
2193 VkSampleCountFlags sampledImageIntegerSampleCounts
2194 VkSampleCountFlags sampledImageDepthSampleCounts
2195 VkSampleCountFlags sampledImageStencilSampleCounts
2196 VkSampleCountFlags storageImageSampleCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07002197 u32 maxSampleMaskWords /// max num of sample mask words
2198
Jesse Halla9bb62b2015-11-21 19:31:56 -08002199 f32 timestampPeriod
Jesse Halld27f6aa2015-08-15 17:58:48 -07002200
2201 u32 maxClipDistances /// max number of clip distances
2202 u32 maxCullDistances /// max number of cull distances
2203 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
2204
Jesse Hallfbf97b02015-11-20 14:17:03 -08002205 u32 discreteQueuePriorities
2206
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002207 f32[2] pointSizeRange /// range (min,max) of supported point sizes
2208 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07002209 f32 pointSizeGranularity /// granularity of supported point sizes
2210 f32 lineWidthGranularity /// granularity of supported line widths
Jesse Hall03b6fe12015-11-24 12:44:21 -08002211 VkBool32 strictLines
Jesse Hall091ed9e2015-11-30 00:55:29 -08002212 VkBool32 standardSampleLocations
Jesse Halla9bb62b2015-11-21 19:31:56 -08002213
Jesse Hall65ab5522015-11-30 00:07:16 -08002214 VkDeviceSize optimalBufferCopyOffsetAlignment
2215 VkDeviceSize optimalBufferCopyRowPitchAlignment
Jesse Halldba27f72015-11-30 14:25:46 -08002216 VkDeviceSize nonCoherentAtomSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07002217}
2218
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002219class VkPhysicalDeviceSparseProperties {
2220 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 -08002221 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 -07002222 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
2223 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 -07002224 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
2225}
2226
Jesse Halld27f6aa2015-08-15 17:58:48 -07002227class VkSemaphoreCreateInfo {
2228 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
2229 const void* pNext /// Pointer to next structure
2230 VkSemaphoreCreateFlags flags /// Semaphore creation flags
2231}
2232
2233class VkQueryPoolCreateInfo {
2234 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
2235 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002236 VkQueryPoolCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002237 VkQueryType queryType
Jesse Hall65ab5522015-11-30 00:07:16 -08002238 u32 entryCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07002239 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
2240}
2241
2242class VkFramebufferCreateInfo {
2243 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
2244 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002245 VkFramebufferCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002246 VkRenderPass renderPass
2247 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002248 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002249 u32 width
2250 u32 height
2251 u32 layers
2252}
2253
Jesse Hall3fbc8562015-11-29 22:10:52 -08002254class VkDrawIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002255 u32 vertexCount
2256 u32 instanceCount
2257 u32 firstVertex
2258 u32 firstInstance
2259}
2260
Jesse Hall3fbc8562015-11-29 22:10:52 -08002261class VkDrawIndexedIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002262 u32 indexCount
2263 u32 instanceCount
2264 u32 firstIndex
2265 s32 vertexOffset
2266 u32 firstInstance
2267}
2268
Jesse Hall3fbc8562015-11-29 22:10:52 -08002269class VkDispatchIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002270 u32 x
2271 u32 y
2272 u32 z
2273}
2274
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002275@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08002276class VkSurfaceCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002277 u32 minImageCount
2278 u32 maxImageCount
2279 VkExtent2D currentExtent
2280 VkExtent2D minImageExtent
2281 VkExtent2D maxImageExtent
2282 VkSurfaceTransformFlagsKHR supportedTransforms
2283 VkSurfaceTransformKHR currentTransform
Jesse Halla6429252015-11-29 18:59:42 -08002284 VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002285 u32 maxImageArraySize
2286 VkImageUsageFlags supportedUsageFlags
Michael Lentine88594d72015-11-12 12:49:45 -08002287}
2288
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002289@extension("VK_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -08002290class VkSurfaceFormatKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002291 VkFormat format
2292 VkColorSpaceKHR colorSpace
Michael Lentine88594d72015-11-12 12:49:45 -08002293}
2294
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002295@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002296class VkSwapchainCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002297 VkStructureType sType
2298 const void* pNext
2299 VkSurfaceKHR surface
2300 u32 minImageCount
2301 VkFormat imageFormat
2302 VkColorSpaceKHR imageColorSpace
2303 VkExtent2D imageExtent
2304 VkImageUsageFlags imageUsageFlags
2305 VkSurfaceTransformKHR preTransform
Jesse Halla6429252015-11-29 18:59:42 -08002306 VkCompositeAlphaFlagBitsKHR compositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002307 u32 imageArraySize
2308 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08002309 u32 queueFamilyIndexCount
Jesse Hall1356b0d2015-11-23 17:24:58 -08002310 const u32* pQueueFamilyIndices
2311 VkPresentModeKHR presentMode
2312 VkSwapchainKHR oldSwapchain
2313 VkBool32 clipped
Michael Lentine88594d72015-11-12 12:49:45 -08002314}
2315
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002316@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002317class VkPresentInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002318 VkStructureType sType
2319 const void* pNext
Jesse Hallb00daad2015-11-29 19:46:20 -08002320 u32 waitSemaphoreCount
2321 const VkSemaphore* pWaitSemaphores
Jesse Hall1356b0d2015-11-23 17:24:58 -08002322 u32 swapchainCount
Jesse Hall03b6fe12015-11-24 12:44:21 -08002323 const VkSwapchainKHR* pSwapchains
Jesse Hall1356b0d2015-11-23 17:24:58 -08002324 const u32* imageIndices
Jesse Halle1b12782015-11-30 11:27:32 -08002325 VkResult* pResults
Michael Lentine88594d72015-11-12 12:49:45 -08002326}
2327
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002328@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002329class VkDisplayPropertiesKHR {
2330 VkDisplayKHR display
2331 const char* displayName
2332 VkExtent2D physicalDimensions
2333 VkExtent2D physicalResolution
2334 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hall1356b0d2015-11-23 17:24:58 -08002335 VkBool32 planeReorderPossible
Jesse Halla6429252015-11-29 18:59:42 -08002336 VkBool32 persistentContent
Michael Lentine88594d72015-11-12 12:49:45 -08002337}
2338
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002339@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002340class VkDisplayModeParametersKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002341 VkExtent2D visibleRegion
Jesse Halla6429252015-11-29 18:59:42 -08002342 u32 refreshRate
Michael Lentine88594d72015-11-12 12:49:45 -08002343}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002344
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002345@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002346class VkDisplayModePropertiesKHR {
2347 VkDisplayModeKHR displayMode
Jesse Halla6429252015-11-29 18:59:42 -08002348 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002349}
2350
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002351@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002352class VkDisplayModeCreateInfoKHR {
2353 VkStructureType sType
2354 const void* pNext
Jesse Halla6429252015-11-29 18:59:42 -08002355 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002356}
2357
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002358@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002359class VkDisplayPlanePropertiesKHR {
Jesse Halla6429252015-11-29 18:59:42 -08002360 VkDisplayKHR currentDisplay
2361 u32 currentStackIndex
2362}
2363
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002364@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002365class VkDisplayPlaneCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002366 VkDisplayPlaneAlphaFlagsKHR supportedAlpha
2367 VkOffset2D minSrcPosition
2368 VkOffset2D maxSrcPosition
2369 VkExtent2D minSrcExtent
2370 VkExtent2D maxSrcExtent
2371 VkOffset2D minDstPosition
2372 VkOffset2D maxDstPosition
2373 VkExtent2D minDstExtent
2374 VkExtent2D maxDstExtent
2375}
2376
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002377@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002378class VkDisplaySurfaceCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002379 VkStructureType sType
2380 const void* pNext
2381 VkDisplayModeKHR displayMode
2382 u32 planeIndex
2383 u32 planeStackIndex
2384 VkSurfaceTransformKHR transform
2385 f32 globalAlpha
2386 VkDisplayPlaneAlphaFlagsKHR alphaMode
2387 VkExtent2D imageSize
2388}
2389
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002390@extension("VK_KHR_display_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002391class VkDisplaySwapchainCreateInfoKHR {
2392 VkStructureType sType
2393 const void* pNext
2394 const VkSwapchainCreateInfoKHR* pNextSwapchainCreateInfo
2395}
2396
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08002397@extension("VK_KHR_display_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -08002398class VkDisplayPresentInfoKHR {
2399 VkStructureType sType
2400 const void* pNext
2401 VkRect2D srcRect
2402 VkRect2D dstRect
Jesse Halla6429252015-11-29 18:59:42 -08002403 VkBool32 persistent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002404}
2405
2406
Jesse Halld27f6aa2015-08-15 17:58:48 -07002407////////////////
2408// Commands //
2409////////////////
2410
2411// Function pointers. TODO: add support for function pointers.
2412
2413@external type void* PFN_vkVoidFunction
2414@pfn cmd void vkVoidFunction() {
2415}
2416
Jesse Hall3fbc8562015-11-29 22:10:52 -08002417@external type void* PFN_vkAllocationFunction
2418@pfn cmd void* vkAllocationFunction(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002419 void* pUserData,
2420 platform.size_t size,
2421 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002422 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002423 return ?
2424}
2425
Jesse Hall3fbc8562015-11-29 22:10:52 -08002426@external type void* PFN_vkReallocationFunction
2427@pfn cmd void* vkReallocationFunction(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002428 void* pUserData,
2429 void* pOriginal,
2430 platform.size_t size,
2431 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002432 VkSystemAllocationScope allocationScope) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002433 return ?
2434}
2435
2436@external type void* PFN_vkFreeFunction
2437@pfn cmd void vkFreeFunction(
2438 void* pUserData,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002439 void* pMemory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002440}
2441
Jesse Hall3fbc8562015-11-29 22:10:52 -08002442@external type void* PFN_vkInternalAllocationNotification
2443@pfn cmd void vkInternalAllocationNotification(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002444 void* pUserData,
2445 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002446 VkInternalAllocationType allocationType,
2447 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002448}
2449
2450@external type void* PFN_vkInternalFreeNotification
2451@pfn cmd void vkInternalFreeNotification(
2452 void* pUserData,
2453 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002454 VkInternalAllocationType allocationType,
2455 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002456}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002457
2458// Global functions
2459
2460@threadSafety("system")
2461cmd VkResult vkCreateInstance(
2462 const VkInstanceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002463 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002464 VkInstance* pInstance) {
2465 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
2466
2467 instance := ?
2468 pInstance[0] = instance
2469 State.Instances[instance] = new!InstanceObject()
2470
Jesse Hall03b6fe12015-11-24 12:44:21 -08002471 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount]
2472 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount]
Jesse Halld27f6aa2015-08-15 17:58:48 -07002473
2474 return ?
2475}
2476
2477@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002478cmd void vkDestroyInstance(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002479 VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002480 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002481 instanceObject := GetInstance(instance)
2482
2483 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002484}
2485
2486@threadSafety("system")
2487cmd VkResult vkEnumeratePhysicalDevices(
2488 VkInstance instance,
2489 u32* pPhysicalDeviceCount,
2490 VkPhysicalDevice* pPhysicalDevices) {
2491 instanceObject := GetInstance(instance)
2492
2493 physicalDeviceCount := as!u32(?)
2494 pPhysicalDeviceCount[0] = physicalDeviceCount
2495 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2496
2497 for i in (0 .. physicalDeviceCount) {
2498 physicalDevice := ?
2499 physicalDevices[i] = physicalDevice
2500 if !(physicalDevice in State.PhysicalDevices) {
2501 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2502 }
2503 }
2504
2505 return ?
2506}
2507
2508cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2509 VkDevice device,
2510 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002511 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002512 device := GetDevice(device)
2513 }
2514
2515 return ?
2516}
2517
2518cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2519 VkInstance instance,
2520 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002521 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002522 instanceObject := GetInstance(instance)
2523 }
2524
2525 return ?
2526}
2527
Jesse Hall606a54e2015-11-19 22:17:28 -08002528cmd void vkGetPhysicalDeviceProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002529 VkPhysicalDevice physicalDevice,
2530 VkPhysicalDeviceProperties* pProperties) {
2531 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2532
2533 properties := ?
2534 pProperties[0] = properties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002535}
2536
Jesse Hall606a54e2015-11-19 22:17:28 -08002537cmd void vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002538 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002539 u32* pQueueFamilyPropertyCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002540 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002541 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002542 // TODO: Figure out how to express fetch-count-or-properties
2543 // This version fails 'apic validate' with 'fence not allowed in
2544 // *semantic.Branch'. Other attempts have failed with the same or other
2545 // errors.
2546 // if pQueueFamilyProperties != null {
2547 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2548 // for i in (0 .. pCount[0]) {
2549 // queueProperties := as!VkQueueFamilyProperties(?)
2550 // queuesProperties[i] = queueProperties
2551 // }
2552 // } else {
2553 // count := ?
2554 // pCount[0] = count
2555 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002556}
2557
Jesse Hall606a54e2015-11-19 22:17:28 -08002558cmd void vkGetPhysicalDeviceMemoryProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002559 VkPhysicalDevice physicalDevice,
2560 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2561 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2562
2563 memoryProperties := ?
2564 pMemoryProperties[0] = memoryProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002565}
2566
Jesse Hall606a54e2015-11-19 22:17:28 -08002567cmd void vkGetPhysicalDeviceFeatures(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002568 VkPhysicalDevice physicalDevice,
2569 VkPhysicalDeviceFeatures* pFeatures) {
2570 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2571
2572 features := ?
2573 pFeatures[0] = features
Jesse Halld27f6aa2015-08-15 17:58:48 -07002574}
2575
Jesse Hall606a54e2015-11-19 22:17:28 -08002576cmd void vkGetPhysicalDeviceFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002577 VkPhysicalDevice physicalDevice,
2578 VkFormat format,
2579 VkFormatProperties* pFormatProperties) {
2580 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2581
2582 formatProperties := ?
2583 pFormatProperties[0] = formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002584}
2585
Jesse Halla9e57032015-11-30 01:03:10 -08002586cmd VkResult vkGetPhysicalDeviceImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002587 VkPhysicalDevice physicalDevice,
2588 VkFormat format,
2589 VkImageType type,
2590 VkImageTiling tiling,
2591 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002592 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002593 VkImageFormatProperties* pImageFormatProperties) {
2594 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2595
2596 imageFormatProperties := ?
2597 pImageFormatProperties[0] = imageFormatProperties
Jesse Halla9e57032015-11-30 01:03:10 -08002598
2599 return ?
Jesse Halld27f6aa2015-08-15 17:58:48 -07002600}
2601
Jesse Halld27f6aa2015-08-15 17:58:48 -07002602
2603// Device functions
2604
2605@threadSafety("system")
2606cmd VkResult vkCreateDevice(
2607 VkPhysicalDevice physicalDevice,
2608 const VkDeviceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002609 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002610 VkDevice* pDevice) {
2611 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2612 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2613
2614 device := ?
2615 pDevice[0] = device
2616 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2617
2618 return ?
2619}
2620
2621@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002622cmd void vkDestroyDevice(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002623 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002624 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002625 deviceObject := GetDevice(device)
2626
2627 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002628}
2629
2630
2631// Extension discovery functions
2632
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002633cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002634 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002635 VkLayerProperties* pProperties) {
2636 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002637 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002638
2639 properties := pProperties[0:count]
2640 for i in (0 .. count) {
2641 property := ?
2642 properties[i] = property
2643 }
2644
2645 return ?
2646}
2647
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002648cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002649 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002650 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002651 VkExtensionProperties* pProperties) {
2652 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002653 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002654
2655 properties := pProperties[0:count]
2656 for i in (0 .. count) {
2657 property := ?
2658 properties[i] = property
2659 }
2660
2661 return ?
2662}
2663
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002664cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002665 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002666 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002667 VkLayerProperties* pProperties) {
2668 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2669 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002670 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002671
2672 properties := pProperties[0:count]
2673 for i in (0 .. count) {
2674 property := ?
2675 properties[i] = property
2676 }
2677
2678 return ?
2679}
2680
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002681cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002682 VkPhysicalDevice physicalDevice,
2683 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002684 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002685 VkExtensionProperties* pProperties) {
2686 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2687
2688 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002689 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002690
2691 properties := pProperties[0:count]
2692 for i in (0 .. count) {
2693 property := ?
2694 properties[i] = property
2695 }
2696
2697 return ?
2698}
2699
2700
2701// Queue functions
2702
2703@threadSafety("system")
Jesse Hall606a54e2015-11-19 22:17:28 -08002704cmd void vkGetDeviceQueue(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002705 VkDevice device,
2706 u32 queueFamilyIndex,
2707 u32 queueIndex,
2708 VkQueue* pQueue) {
2709 deviceObject := GetDevice(device)
2710
2711 queue := ?
2712 pQueue[0] = queue
2713
2714 if !(queue in State.Queues) {
2715 State.Queues[queue] = new!QueueObject(device: device)
2716 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002717}
2718
2719@threadSafety("app")
2720cmd VkResult vkQueueSubmit(
2721 VkQueue queue,
Jesse Halla366a512015-11-19 22:30:07 -08002722 u32 submitCount,
Jesse Hallb00daad2015-11-29 19:46:20 -08002723 const VkSubmitInfo* pSubmits,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002724 VkFence fence) {
2725 queueObject := GetQueue(queue)
2726
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002727 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002728 fenceObject := GetFence(fence)
2729 assert(fenceObject.device == queueObject.device)
2730 }
2731
Jesse Hall3fbc8562015-11-29 22:10:52 -08002732 // commandBuffers := pcommandBuffers[0:commandBufferCount]
2733 // for i in (0 .. commandBufferCount) {
2734 // commandBuffer := commandBuffers[i]
2735 // commandBufferObject := GetCommandBuffer(commandBuffer)
2736 // assert(commandBufferObject.device == queueObject.device)
Jesse Halla366a512015-11-19 22:30:07 -08002737 //
Jesse Hall3fbc8562015-11-29 22:10:52 -08002738 // validate("QueueCheck", commandBufferObject.queueFlags in queueObject.flags,
2739 // "vkQueueSubmit: enqueued commandBuffer requires missing queue capabilities.")
Jesse Halla366a512015-11-19 22:30:07 -08002740 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002741
2742 return ?
2743}
2744
2745@threadSafety("system")
2746cmd VkResult vkQueueWaitIdle(
2747 VkQueue queue) {
2748 queueObject := GetQueue(queue)
2749
2750 return ?
2751}
2752
2753@threadSafety("system")
2754cmd VkResult vkDeviceWaitIdle(
2755 VkDevice device) {
2756 deviceObject := GetDevice(device)
2757
2758 return ?
2759}
2760
2761
2762// Memory functions
2763
2764@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002765cmd VkResult vkAllocateMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002766 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002767 const VkMemoryAllocateInfo* pAllocateInfo,
2768 const VkAllocationCallbacks* pAllocator,
2769 VkDeviceMemory* pMemory) {
2770 assert(pAllocateInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002771 deviceObject := GetDevice(device)
2772
Jesse Hall3fbc8562015-11-29 22:10:52 -08002773 memory := ?
2774 pMemory[0] = memory
2775 State.DeviceMemories[memory] = new!DeviceMemoryObject(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002776 device: device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002777 allocationSize: pAllocateInfo[0].allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002778
2779 return ?
2780}
2781
2782@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002783cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002784 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002785 VkDeviceMemory memory,
2786 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002787 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002788 memoryObject := GetDeviceMemory(memory)
2789 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002790
2791 // Check that no objects are still bound before freeing.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002792 validate("MemoryCheck", len(memoryObject.boundObjects) == 0,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002793 "vkFreeMemory: objects still bound")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002794 validate("MemoryCheck", len(memoryObject.boundCommandBuffers) == 0,
2795 "vkFreeMemory: commandBuffers still bound")
2796 State.DeviceMemories[memory] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002797}
2798
2799@threadSafety("app")
2800cmd VkResult vkMapMemory(
2801 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002802 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002803 VkDeviceSize offset,
2804 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002805 VkMemoryMapFlags flags,
2806 void** ppData) {
2807 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002808 memoryObject := GetDeviceMemory(memory)
2809 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002810
2811 assert(flags == as!VkMemoryMapFlags(0))
Jesse Hall3fbc8562015-11-29 22:10:52 -08002812 assert((offset + size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002813
2814 return ?
2815}
2816
2817@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002818cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002819 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002820 VkDeviceMemory memory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002821 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002822 memoryObject := GetDeviceMemory(memory)
2823 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002824}
2825
2826cmd VkResult vkFlushMappedMemoryRanges(
2827 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002828 u32 memoryRangeCount
2829 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002830 deviceObject := GetDevice(device)
2831
Jesse Hall3fbc8562015-11-29 22:10:52 -08002832 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2833 for i in (0 .. memoryRangeCount) {
2834 memoryRange := memoryRanges[i]
2835 memoryObject := GetDeviceMemory(memoryRange.memory)
2836 assert(memoryObject.device == device)
2837 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002838 }
2839
2840 return ?
2841}
2842
2843cmd VkResult vkInvalidateMappedMemoryRanges(
2844 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002845 u32 memoryRangeCount,
2846 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002847 deviceObject := GetDevice(device)
2848
Jesse Hall3fbc8562015-11-29 22:10:52 -08002849 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2850 for i in (0 .. memoryRangeCount) {
2851 memoryRange := memoryRanges[i]
2852 memoryObject := GetDeviceMemory(memoryRange.memory)
2853 assert(memoryObject.device == device)
2854 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002855 }
2856
2857 return ?
2858}
2859
2860
2861// Memory management API functions
2862
Jesse Hall606a54e2015-11-19 22:17:28 -08002863cmd void vkGetDeviceMemoryCommitment(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002864 VkDevice device,
2865 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002866 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002867 deviceObject := GetDevice(device)
2868
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002869 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002870 memoryObject := GetDeviceMemory(memory)
2871 assert(memoryObject.device == device)
2872 }
2873
2874 committedMemoryInBytes := ?
2875 pCommittedMemoryInBytes[0] = committedMemoryInBytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07002876}
2877
Jesse Hall606a54e2015-11-19 22:17:28 -08002878cmd void vkGetBufferMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002879 VkDevice device,
2880 VkBuffer buffer,
2881 VkMemoryRequirements* pMemoryRequirements) {
2882 deviceObject := GetDevice(device)
2883 bufferObject := GetBuffer(buffer)
2884 assert(bufferObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002885}
2886
2887cmd VkResult vkBindBufferMemory(
2888 VkDevice device,
2889 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002890 VkDeviceMemory memory,
2891 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002892 deviceObject := GetDevice(device)
2893 bufferObject := GetBuffer(buffer)
2894 assert(bufferObject.device == device)
2895
2896 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002897 if bufferObject.memory != NULL_HANDLE {
2898 memoryObject := GetDeviceMemory(bufferObject.memory)
2899 memoryObject.boundObjects[as!u64(buffer)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002900 }
2901
2902 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002903 if memory != NULL_HANDLE {
2904 memoryObject := GetDeviceMemory(memory)
2905 assert(memoryObject.device == device)
2906 memoryObject.boundObjects[as!u64(buffer)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002907 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002908 bufferObject.memory = memory
2909 bufferObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002910
2911 return ?
2912}
2913
Jesse Hall606a54e2015-11-19 22:17:28 -08002914cmd void vkGetImageMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002915 VkDevice device,
2916 VkImage image,
2917 VkMemoryRequirements* pMemoryRequirements) {
2918 deviceObject := GetDevice(device)
2919 imageObject := GetImage(image)
2920 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002921}
2922
2923cmd VkResult vkBindImageMemory(
2924 VkDevice device,
2925 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002926 VkDeviceMemory memory,
2927 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002928 deviceObject := GetDevice(device)
2929 imageObject := GetImage(image)
2930 assert(imageObject.device == device)
2931
2932 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002933 if imageObject.memory != NULL_HANDLE {
2934 memoryObject := GetDeviceMemory(imageObject.memory)
2935 memoryObject.boundObjects[as!u64(image)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002936 }
2937
2938 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002939 if memory != NULL_HANDLE {
2940 memoryObject := GetDeviceMemory(memory)
2941 assert(memoryObject.device == device)
2942 memoryObject.boundObjects[as!u64(image)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002943 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002944 imageObject.memory = memory
2945 imageObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002946
2947 return ?
2948}
2949
Jesse Hall606a54e2015-11-19 22:17:28 -08002950cmd void vkGetImageSparseMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002951 VkDevice device,
2952 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002953 u32* pSparseMemoryRequirementCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002954 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2955 deviceObject := GetDevice(device)
2956 imageObject := GetImage(image)
2957 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002958}
2959
Jesse Hall606a54e2015-11-19 22:17:28 -08002960cmd void vkGetPhysicalDeviceSparseImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002961 VkPhysicalDevice physicalDevice,
2962 VkFormat format,
2963 VkImageType type,
Jesse Hall091ed9e2015-11-30 00:55:29 -08002964 VkSampleCountFlagBits samples,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002965 VkImageUsageFlags usage,
2966 VkImageTiling tiling,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002967 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002968 VkSparseImageFormatProperties* pProperties) {
2969 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002970}
2971
Jesse Halla6429252015-11-29 18:59:42 -08002972cmd VkResult vkQueueBindSparse(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002973 VkQueue queue,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002974 u32 bindInfoCount,
Jesse Halla6429252015-11-29 18:59:42 -08002975 const VkBindSparseInfo* pBindInfo,
2976 VkFence fence) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002977 queueObject := GetQueue(queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002978
2979 return ?
2980}
2981
2982
2983// Fence functions
2984
2985@threadSafety("system")
2986cmd VkResult vkCreateFence(
2987 VkDevice device,
2988 const VkFenceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002989 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002990 VkFence* pFence) {
2991 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
2992 deviceObject := GetDevice(device)
2993
2994 fence := ?
2995 pFence[0] = fence
2996 State.Fences[fence] = new!FenceObject(
Jesse Halld8bade02015-11-24 10:24:18 -08002997 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT)))
Jesse Halld27f6aa2015-08-15 17:58:48 -07002998
2999 return ?
3000}
3001
3002@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003003cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003004 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003005 VkFence fence,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003006 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003007 deviceObject := GetDevice(device)
3008 fenceObject := GetFence(fence)
3009 assert(fenceObject.device == device)
3010
3011 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003012}
3013
3014@threadSafety("system")
3015cmd VkResult vkResetFences(
3016 VkDevice device,
3017 u32 fenceCount,
3018 const VkFence* pFences) {
3019 deviceObject := GetDevice(device)
3020
3021 fences := pFences[0:fenceCount]
3022 for i in (0 .. fenceCount) {
3023 fence := fences[i]
3024 fenceObject := GetFence(fence)
3025 assert(fenceObject.device == device)
3026 fenceObject.signaled = false
3027 }
3028
3029 return ?
3030}
3031
3032@threadSafety("system")
3033cmd VkResult vkGetFenceStatus(
3034 VkDevice device,
3035 VkFence fence) {
3036 deviceObject := GetDevice(device)
3037 fenceObject := GetFence(fence)
3038 assert(fenceObject.device == device)
3039
3040 return ?
3041}
3042
3043@threadSafety("system")
3044cmd VkResult vkWaitForFences(
3045 VkDevice device,
3046 u32 fenceCount,
3047 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003048 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003049 u64 timeout) { /// timeout in nanoseconds
3050 deviceObject := GetDevice(device)
3051
3052 fences := pFences[0:fenceCount]
3053 for i in (0 .. fenceCount) {
3054 fence := fences[i]
3055 fenceObject := GetFence(fence)
3056 assert(fenceObject.device == device)
3057 }
3058
3059 return ?
3060}
3061
3062
3063// Queue semaphore functions
3064
3065@threadSafety("system")
3066cmd VkResult vkCreateSemaphore(
3067 VkDevice device,
3068 const VkSemaphoreCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003069 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003070 VkSemaphore* pSemaphore) {
3071 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
3072 deviceObject := GetDevice(device)
3073
3074 semaphore := ?
3075 pSemaphore[0] = semaphore
3076 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
3077
3078 return ?
3079}
3080
3081@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003082cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003083 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003084 VkSemaphore semaphore,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003085 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003086 deviceObject := GetDevice(device)
3087 semaphoreObject := GetSemaphore(semaphore)
3088 assert(semaphoreObject.device == device)
3089
3090 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003091}
3092
Jesse Halld27f6aa2015-08-15 17:58:48 -07003093
3094// Event functions
3095
3096@threadSafety("system")
3097cmd VkResult vkCreateEvent(
3098 VkDevice device,
3099 const VkEventCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003100 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003101 VkEvent* pEvent) {
3102 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
3103 deviceObject := GetDevice(device)
3104
3105 event := ?
3106 pEvent[0] = event
3107 State.Events[event] = new!EventObject(device: device)
3108
3109 return ?
3110}
3111
3112@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003113cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003114 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003115 VkEvent event,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003116 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003117 deviceObject := GetDevice(device)
3118 eventObject := GetEvent(event)
3119 assert(eventObject.device == device)
3120
3121 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003122}
3123
3124@threadSafety("system")
3125cmd VkResult vkGetEventStatus(
3126 VkDevice device,
3127 VkEvent event) {
3128 deviceObject := GetDevice(device)
3129 eventObject := GetEvent(event)
3130 assert(eventObject.device == device)
3131
3132 return ?
3133}
3134
3135@threadSafety("system")
3136cmd VkResult vkSetEvent(
3137 VkDevice device,
3138 VkEvent event) {
3139 deviceObject := GetDevice(device)
3140 eventObject := GetEvent(event)
3141 assert(eventObject.device == device)
3142
3143 return ?
3144}
3145
3146@threadSafety("system")
3147cmd VkResult vkResetEvent(
3148 VkDevice device,
3149 VkEvent event) {
3150 deviceObject := GetDevice(device)
3151 eventObject := GetEvent(event)
3152 assert(eventObject.device == device)
3153
3154 return ?
3155}
3156
3157
3158// Query functions
3159
3160@threadSafety("system")
3161cmd VkResult vkCreateQueryPool(
3162 VkDevice device,
3163 const VkQueryPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003164 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003165 VkQueryPool* pQueryPool) {
3166 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
3167 deviceObject := GetDevice(device)
3168
3169 queryPool := ?
3170 pQueryPool[0] = queryPool
3171 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
3172
3173 return ?
3174}
3175
3176@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003177cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003178 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003179 VkQueryPool queryPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003180 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003181 deviceObject := GetDevice(device)
3182 queryPoolObject := GetQueryPool(queryPool)
3183 assert(queryPoolObject.device == device)
3184
3185 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003186}
3187
3188@threadSafety("system")
3189cmd VkResult vkGetQueryPoolResults(
3190 VkDevice device,
3191 VkQueryPool queryPool,
3192 u32 startQuery,
3193 u32 queryCount,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003194 platform.size_t dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003195 void* pData,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003196 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003197 VkQueryResultFlags flags) {
3198 deviceObject := GetDevice(device)
3199 queryPoolObject := GetQueryPool(queryPool)
3200 assert(queryPoolObject.device == device)
3201
Jesse Halld27f6aa2015-08-15 17:58:48 -07003202 data := pData[0:dataSize]
3203
3204 return ?
3205}
3206
3207// Buffer functions
3208
3209@threadSafety("system")
3210cmd VkResult vkCreateBuffer(
3211 VkDevice device,
3212 const VkBufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003213 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003214 VkBuffer* pBuffer) {
3215 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
3216 deviceObject := GetDevice(device)
3217
3218 buffer := ?
3219 pBuffer[0] = buffer
3220 State.Buffers[buffer] = new!BufferObject(device: device)
3221
3222 return ?
3223}
3224
3225@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003226cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003227 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003228 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003229 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003230 deviceObject := GetDevice(device)
3231 bufferObject := GetBuffer(buffer)
3232 assert(bufferObject.device == device)
3233
Jesse Hall3fbc8562015-11-29 22:10:52 -08003234 assert(bufferObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003235 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003236}
3237
3238
3239// Buffer view functions
3240
3241@threadSafety("system")
3242cmd VkResult vkCreateBufferView(
3243 VkDevice device,
3244 const VkBufferViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003245 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003246 VkBufferView* pView) {
3247 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
3248 deviceObject := GetDevice(device)
3249
3250 bufferObject := GetBuffer(pCreateInfo.buffer)
3251 assert(bufferObject.device == device)
3252
3253 view := ?
3254 pView[0] = view
3255 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
3256
3257 return ?
3258}
3259
3260@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003261cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003262 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003263 VkBufferView bufferView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003264 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003265 deviceObject := GetDevice(device)
3266 bufferViewObject := GetBufferView(bufferView)
3267 assert(bufferViewObject.device == device)
3268
3269 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003270}
3271
3272
3273// Image functions
3274
3275@threadSafety("system")
3276cmd VkResult vkCreateImage(
3277 VkDevice device,
3278 const VkImageCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003279 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003280 VkImage* pImage) {
3281 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
3282 deviceObject := GetDevice(device)
3283
3284 image := ?
3285 pImage[0] = image
3286 State.Images[image] = new!ImageObject(device: device)
3287
3288 return ?
3289}
3290
3291@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003292cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003293 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003294 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003295 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003296 deviceObject := GetDevice(device)
3297 imageObject := GetImage(image)
3298 assert(imageObject.device == device)
3299
Jesse Hall3fbc8562015-11-29 22:10:52 -08003300 assert(imageObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003301 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003302}
3303
Jesse Hall606a54e2015-11-19 22:17:28 -08003304cmd void vkGetImageSubresourceLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003305 VkDevice device,
3306 VkImage image,
3307 const VkImageSubresource* pSubresource,
3308 VkSubresourceLayout* pLayout) {
3309 deviceObject := GetDevice(device)
3310 imageObject := GetImage(image)
3311 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003312}
3313
3314
3315// Image view functions
3316
3317@threadSafety("system")
3318cmd VkResult vkCreateImageView(
3319 VkDevice device,
3320 const VkImageViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003321 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003322 VkImageView* pView) {
3323 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
3324 deviceObject := GetDevice(device)
3325
3326 imageObject := GetImage(pCreateInfo.image)
3327 assert(imageObject.device == device)
3328
3329 view := ?
3330 pView[0] = view
3331 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
3332
3333 return ?
3334}
3335
3336@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003337cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003338 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003339 VkImageView imageView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003340 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003341 deviceObject := GetDevice(device)
3342 imageViewObject := GetImageView(imageView)
3343 assert(imageViewObject.device == device)
3344
3345 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003346}
3347
3348
3349// Shader functions
3350
3351cmd VkResult vkCreateShaderModule(
3352 VkDevice device,
3353 const VkShaderModuleCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003354 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003355 VkShaderModule* pShaderModule) {
3356 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
3357 deviceObject := GetDevice(device)
3358
3359 shaderModule := ?
3360 pShaderModule[0] = shaderModule
3361 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
3362
3363 return ?
3364}
3365
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003366cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003367 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003368 VkShaderModule shaderModule,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003369 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003370 deviceObject := GetDevice(device)
3371 shaderModuleObject := GetShaderModule(shaderModule)
3372 assert(shaderModuleObject.device == device)
3373
3374 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003375}
3376
Jesse Halld27f6aa2015-08-15 17:58:48 -07003377
3378// Pipeline functions
3379
3380cmd VkResult vkCreatePipelineCache(
3381 VkDevice device,
3382 const VkPipelineCacheCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003383 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003384 VkPipelineCache* pPipelineCache) {
3385 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
3386 deviceObject := GetDevice(device)
3387
3388 pipelineCache := ?
3389 pPipelineCache[0] = pipelineCache
3390 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
3391
3392 return ?
3393}
3394
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003395cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003396 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003397 VkPipelineCache pipelineCache,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003398 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003399 deviceObject := GetDevice(device)
3400 pipelineCacheObject := GetPipelineCache(pipelineCache)
3401 assert(pipelineCacheObject.device == device)
3402
3403 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003404}
3405
Jesse Halld27f6aa2015-08-15 17:58:48 -07003406cmd VkResult vkGetPipelineCacheData(
3407 VkDevice device,
3408 VkPipelineCache pipelineCache,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003409 platform.size_t* pDataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003410 void* pData) {
3411 deviceObject := GetDevice(device)
3412 pipelineCacheObject := GetPipelineCache(pipelineCache)
3413 assert(pipelineCacheObject.device == device)
3414
3415 return ?
3416}
3417
3418cmd VkResult vkMergePipelineCaches(
3419 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003420 VkPipelineCache dstCache,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003421 u32 srcCacheCount,
3422 const VkPipelineCache* pSrcCaches) {
3423 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003424 dstCacheObject := GetPipelineCache(dstCache)
3425 assert(dstCacheObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003426
3427 srcCaches := pSrcCaches[0:srcCacheCount]
3428 for i in (0 .. srcCacheCount) {
3429 srcCache := srcCaches[i]
3430 srcCacheObject := GetPipelineCache(srcCache)
3431 assert(srcCacheObject.device == device)
3432 }
3433
3434 return ?
3435}
3436
3437cmd VkResult vkCreateGraphicsPipelines(
3438 VkDevice device,
3439 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003440 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003441 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003442 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003443 VkPipeline* pPipelines) {
3444 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003445 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003446 pipelineCacheObject := GetPipelineCache(pipelineCache)
3447 assert(pipelineCacheObject.device == device)
3448 }
3449
Jesse Hall03b6fe12015-11-24 12:44:21 -08003450 createInfos := pCreateInfos[0:createInfoCount]
3451 pipelines := pPipelines[0:createInfoCount]
3452 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003453 pipeline := ?
3454 pipelines[i] = pipeline
3455 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3456 }
3457
3458 return ?
3459}
3460
3461cmd VkResult vkCreateComputePipelines(
3462 VkDevice device,
3463 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003464 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003465 const VkComputePipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003466 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003467 VkPipeline* pPipelines) {
3468 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003469 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003470 pipelineCacheObject := GetPipelineCache(pipelineCache)
3471 assert(pipelineCacheObject.device == device)
3472 }
3473
Jesse Hall03b6fe12015-11-24 12:44:21 -08003474 createInfos := pCreateInfos[0:createInfoCount]
3475 pipelines := pPipelines[0:createInfoCount]
3476 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003477 pipeline := ?
3478 pipelines[i] = pipeline
3479 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3480 }
3481
3482 return ?
3483}
3484
3485@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003486cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003487 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003488 VkPipeline pipeline,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003489 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003490 deviceObject := GetDevice(device)
3491 pipelineObjects := GetPipeline(pipeline)
3492 assert(pipelineObjects.device == device)
3493
3494 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003495}
3496
3497
3498// Pipeline layout functions
3499
3500@threadSafety("system")
3501cmd VkResult vkCreatePipelineLayout(
3502 VkDevice device,
3503 const VkPipelineLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003504 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003505 VkPipelineLayout* pPipelineLayout) {
3506 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3507 deviceObject := GetDevice(device)
3508
3509 pipelineLayout := ?
3510 pPipelineLayout[0] = pipelineLayout
3511 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3512
3513 return ?
3514}
3515
3516@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003517cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003518 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003519 VkPipelineLayout pipelineLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003520 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003521 deviceObject := GetDevice(device)
3522 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3523 assert(pipelineLayoutObjects.device == device)
3524
3525 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003526}
3527
3528
3529// Sampler functions
3530
3531@threadSafety("system")
3532cmd VkResult vkCreateSampler(
3533 VkDevice device,
3534 const VkSamplerCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003535 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003536 VkSampler* pSampler) {
3537 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3538 deviceObject := GetDevice(device)
3539
3540 sampler := ?
3541 pSampler[0] = sampler
3542 State.Samplers[sampler] = new!SamplerObject(device: device)
3543
3544 return ?
3545}
3546
3547@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003548cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003549 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003550 VkSampler sampler,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003551 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003552 deviceObject := GetDevice(device)
3553 samplerObject := GetSampler(sampler)
3554 assert(samplerObject.device == device)
3555
3556 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003557}
3558
3559
3560// Descriptor set functions
3561
3562@threadSafety("system")
3563cmd VkResult vkCreateDescriptorSetLayout(
3564 VkDevice device,
3565 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003566 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003567 VkDescriptorSetLayout* pSetLayout) {
3568 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3569 deviceObject := GetDevice(device)
3570
3571 setLayout := ?
3572 pSetLayout[0] = setLayout
3573 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3574
3575 return ?
3576}
3577
3578@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003579cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003580 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003581 VkDescriptorSetLayout descriptorSetLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003582 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003583 deviceObject := GetDevice(device)
3584 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3585 assert(descriptorSetLayoutObject.device == device)
3586
3587 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003588}
3589
3590@threadSafety("system")
3591cmd VkResult vkCreateDescriptorPool(
3592 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003593 const VkDescriptorPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003594 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003595 VkDescriptorPool* pDescriptorPool) {
3596 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3597 deviceObject := GetDevice(device)
3598
3599 descriptorPool := ?
3600 pDescriptorPool[0] = descriptorPool
3601 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3602
3603 return ?
3604}
3605
3606@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003607cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003608 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003609 VkDescriptorPool descriptorPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003610 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003611 deviceObject := GetDevice(device)
3612 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3613 assert(descriptorPoolObject.device == device)
3614
3615 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003616}
3617
3618@threadSafety("app")
3619cmd VkResult vkResetDescriptorPool(
3620 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003621 VkDescriptorPool descriptorPool,
3622 VkDescriptorPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003623 deviceObject := GetDevice(device)
3624 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3625 assert(descriptorPoolObject.device == device)
3626
3627 return ?
3628}
3629
3630@threadSafety("app")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003631cmd VkResult vkAllocateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003632 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003633 const VkDescriptorSetAllocateInfo* pAllocateInfo,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003634 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003635 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003636 allocInfo := pAllocateInfo[0]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003637 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003638
Jesse Hall03b6fe12015-11-24 12:44:21 -08003639 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount]
3640 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003641 setLayout := setLayouts[i]
3642 setLayoutObject := GetDescriptorSetLayout(setLayout)
3643 assert(setLayoutObject.device == device)
3644 }
3645
Jesse Hall03b6fe12015-11-24 12:44:21 -08003646 descriptorSets := pDescriptorSets[0:allocInfo.setCount]
3647 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003648 descriptorSet := ?
3649 descriptorSets[i] = descriptorSet
3650 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3651 }
3652
3653 return ?
3654}
3655
Jesse Hallf09c6b12015-08-15 19:54:28 -07003656cmd VkResult vkFreeDescriptorSets(
3657 VkDevice device,
3658 VkDescriptorPool descriptorPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003659 u32 descriptorSetCount,
Jesse Hallf09c6b12015-08-15 19:54:28 -07003660 const VkDescriptorSet* pDescriptorSets) {
3661 deviceObject := GetDevice(device)
3662 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3663
Jesse Hall03b6fe12015-11-24 12:44:21 -08003664 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3665 for i in (0 .. descriptorSetCount) {
Jesse Hallf09c6b12015-08-15 19:54:28 -07003666 descriptorSet := descriptorSets[i]
3667 descriptorSetObject := GetDescriptorSet(descriptorSet)
3668 assert(descriptorSetObject.device == device)
3669 State.DescriptorSets[descriptorSet] = null
3670 }
3671
3672 return ?
3673}
3674
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003675cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003676 VkDevice device,
Jesse Hallb00daad2015-11-29 19:46:20 -08003677 u32 descriptorWriteCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003678 const VkWriteDescriptorSet* pDescriptorWrites,
Jesse Hallb00daad2015-11-29 19:46:20 -08003679 u32 descriptorCopyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003680 const VkCopyDescriptorSet* pDescriptorCopies) {
3681 deviceObject := GetDevice(device)
3682
Jesse Hallb00daad2015-11-29 19:46:20 -08003683 descriptorWrites := pDescriptorWrites[0:descriptorWriteCount]
3684 for i in (0 .. descriptorWriteCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003685 descriptorWrite := descriptorWrites[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003686 descriptorWriteObject := GetDescriptorSet(descriptorWrite.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003687 assert(descriptorWriteObject.device == device)
3688 }
3689
Jesse Hallb00daad2015-11-29 19:46:20 -08003690 descriptorCopies := pDescriptorCopies[0:descriptorCopyCount]
3691 for i in (0 .. descriptorCopyCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003692 descriptorCopy := descriptorCopies[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003693 descriptorCopyObject := GetDescriptorSet(descriptorCopy.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003694 assert(descriptorCopyObject.device == device)
3695 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003696}
3697
3698
3699// Framebuffer functions
3700
3701@threadSafety("system")
3702cmd VkResult vkCreateFramebuffer(
3703 VkDevice device,
3704 const VkFramebufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003705 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003706 VkFramebuffer* pFramebuffer) {
3707 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3708 deviceObject := GetDevice(device)
3709
3710 framebuffer := ?
3711 pFramebuffer[0] = framebuffer
3712 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3713
3714 return ?
3715}
3716
3717@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003718cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003719 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003720 VkFramebuffer framebuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003721 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003722 deviceObject := GetDevice(device)
3723 framebufferObject := GetFramebuffer(framebuffer)
3724 assert(framebufferObject.device == device)
3725
3726 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003727}
3728
3729
3730// Renderpass functions
3731
3732@threadSafety("system")
3733cmd VkResult vkCreateRenderPass(
3734 VkDevice device,
3735 const VkRenderPassCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003736 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003737 VkRenderPass* pRenderPass) {
3738 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3739 deviceObject := GetDevice(device)
3740
3741 renderpass := ?
3742 pRenderPass[0] = renderpass
3743 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3744
3745 return ?
3746}
3747
3748@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003749cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003750 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003751 VkRenderPass renderPass,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003752 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003753 deviceObject := GetDevice(device)
3754 renderPassObject := GetRenderPass(renderPass)
3755 assert(renderPassObject.device == device)
3756
3757 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003758}
3759
Jesse Hall606a54e2015-11-19 22:17:28 -08003760cmd void vkGetRenderAreaGranularity(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003761 VkDevice device,
3762 VkRenderPass renderPass,
3763 VkExtent2D* pGranularity) {
3764 deviceObject := GetDevice(device)
3765 renderPassObject := GetRenderPass(renderPass)
3766
3767 granularity := ?
3768 pGranularity[0] = granularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07003769}
3770
3771// Command pool functions
3772
3773cmd VkResult vkCreateCommandPool(
3774 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003775 const VkCommandPoolCreateInfo* pCreateInfo,
3776 const VkAllocationCallbacks* pAllocator,
3777 VkCommandPool* pCommandPool) {
3778 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003779 deviceObject := GetDevice(device)
3780
Jesse Hall3fbc8562015-11-29 22:10:52 -08003781 commandPool := ?
3782 pCommandPool[0] = commandPool
3783 State.CommandPools[commandPool] = new!CommandPoolObject(device: device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003784
3785 return ?
3786}
3787
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003788cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003789 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003790 VkCommandPool commandPool,
3791 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003792 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003793 commandPoolObject := GetCommandPool(commandPool)
3794 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003795
Jesse Hall3fbc8562015-11-29 22:10:52 -08003796 State.CommandPools[commandPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003797}
3798
3799cmd VkResult vkResetCommandPool(
3800 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003801 VkCommandPool commandPool,
3802 VkCommandPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003803 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003804 commandPoolObject := GetCommandPool(commandPool)
3805 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003806
3807 return ?
3808}
3809
3810// Command buffer functions
3811
Jesse Hall3fbc8562015-11-29 22:10:52 -08003812macro void bindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3813 memoryObject := GetDeviceMemory(memory)
3814 memoryObject.boundCommandBuffers[commandBuffer] = commandBuffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07003815
Jesse Hall3fbc8562015-11-29 22:10:52 -08003816 commandBufferObject := GetCommandBuffer(commandBuffer)
3817 commandBufferObject.boundObjects[as!u64(obj)] = memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07003818}
3819
Jesse Hall3fbc8562015-11-29 22:10:52 -08003820macro void unbindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3821 memoryObject := GetDeviceMemory(memory)
3822 memoryObject.boundCommandBuffers[commandBuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003823
Jesse Hall3fbc8562015-11-29 22:10:52 -08003824 commandBufferObject := GetCommandBuffer(commandBuffer)
3825 commandBufferObject.boundObjects[as!u64(obj)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003826}
3827
3828@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003829cmd VkResult vkAllocateCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003830 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003831 const VkCommandBufferAllocateInfo* pAllocateInfo,
3832 VkCommandBuffer* pCommandBuffers) {
3833 assert(pAllocateInfo[0].sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOC_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003834
Jesse Hall3fbc8562015-11-29 22:10:52 -08003835 count := pAllocateInfo[0].bufferCount
3836 commandBuffers := pCommandBuffers[0:count]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003837 for i in (0 .. count) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003838 commandBuffer := ?
3839 commandBuffers[i] = commandBuffer
3840 State.CommandBuffers[commandBuffer] = new!CommandBufferObject(device: device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003841 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003842
3843 return ?
3844}
3845
3846@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003847cmd void vkFreeCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003848 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003849 VkCommandPool commandPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003850 u32 commandBufferCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003851 const VkCommandBuffer* pCommandBuffers) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003852 deviceObject := GetDevice(device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003853
Jesse Hall3fbc8562015-11-29 22:10:52 -08003854 commandBuffers := pCommandBuffers[0:commandBufferCount]
Jesse Hall03b6fe12015-11-24 12:44:21 -08003855 for i in (0 .. commandBufferCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003856 commandBufferObject := GetCommandBuffer(commandBuffers[i])
3857 assert(commandBufferObject.device == device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003858 // TODO: iterate over boundObjects and clear memory bindings
Jesse Hall3fbc8562015-11-29 22:10:52 -08003859 State.CommandBuffers[commandBuffers[i]] = null
Jesse Hallfbf97b02015-11-20 14:17:03 -08003860 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003861}
3862
3863@threadSafety("app")
3864cmd VkResult vkBeginCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003865 VkCommandBuffer commandBuffer,
3866 const VkCommandBufferBeginInfo* pBeginInfo) {
3867 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO)
3868 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003869
3870 // TODO: iterate over boundObjects and clear memory bindings
3871
3872 return ?
3873}
3874
3875@threadSafety("app")
3876cmd VkResult vkEndCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003877 VkCommandBuffer commandBuffer) {
3878 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003879
3880 return ?
3881}
3882
3883@threadSafety("app")
3884cmd VkResult vkResetCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003885 VkCommandBuffer commandBuffer,
3886 VkCommandBufferResetFlags flags) {
3887 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003888
3889 // TODO: iterate over boundObjects and clear memory bindings
3890
3891 return ?
3892}
3893
3894
3895// Command buffer building functions
3896
3897@threadSafety("app")
3898cmd void vkCmdBindPipeline(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003899 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003900 VkPipelineBindPoint pipelineBindPoint,
3901 VkPipeline pipeline) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003902 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003903 pipelineObject := GetPipeline(pipeline)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003904 assert(commandBufferObject.device == pipelineObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003905
Jesse Halld8bade02015-11-24 10:24:18 -08003906 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003907 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3908 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3909 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08003910 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003911}
3912
3913@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003914cmd void vkCmdSetViewport(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003915 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003916 u32 viewportCount,
3917 const VkViewport* pViewports) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003918 commandBufferObject := GetCommandBuffer(commandBuffer)
3919 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003920}
3921
3922@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003923cmd void vkCmdSetScissor(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003924 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003925 u32 scissorCount,
3926 const VkRect2D* pScissors) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003927 commandBufferObject := GetCommandBuffer(commandBuffer)
3928 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003929}
3930
3931@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003932cmd void vkCmdSetLineWidth(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003933 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003934 f32 lineWidth) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003935 commandBufferObject := GetCommandBuffer(commandBuffer)
3936 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003937}
3938
3939@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003940cmd void vkCmdSetDepthBias(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003941 VkCommandBuffer commandBuffer,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003942 f32 depthBiasConstantFactor,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003943 f32 depthBiasClamp,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003944 f32 depthBiasSlopeFactor) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003945 commandBufferObject := GetCommandBuffer(commandBuffer)
3946 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003947}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003948
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003949@threadSafety("app")
3950cmd void vkCmdSetBlendConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003951 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003952 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3953 // an annotation as a quick hack to pass this to the template without
3954 // having to modify the AST and semantic model.
Jesse Hallb00daad2015-11-29 19:46:20 -08003955 @readonly f32[4] blendConstants) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003956 commandBufferObject := GetCommandBuffer(commandBuffer)
3957 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003958}
3959
3960@threadSafety("app")
3961cmd void vkCmdSetDepthBounds(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003962 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003963 f32 minDepthBounds,
3964 f32 maxDepthBounds) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003965 commandBufferObject := GetCommandBuffer(commandBuffer)
3966 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003967}
3968
3969@threadSafety("app")
3970cmd void vkCmdSetStencilCompareMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003971 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003972 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08003973 u32 compareMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003974 commandBufferObject := GetCommandBuffer(commandBuffer)
3975 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003976}
3977
3978@threadSafety("app")
3979cmd void vkCmdSetStencilWriteMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003980 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003981 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08003982 u32 writeMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003983 commandBufferObject := GetCommandBuffer(commandBuffer)
3984 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003985}
3986
3987@threadSafety("app")
3988cmd void vkCmdSetStencilReference(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003989 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003990 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08003991 u32 reference) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003992 commandBufferObject := GetCommandBuffer(commandBuffer)
3993 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003994}
3995
3996@threadSafety("app")
3997cmd void vkCmdBindDescriptorSets(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003998 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003999 VkPipelineBindPoint pipelineBindPoint,
4000 VkPipelineLayout layout,
4001 u32 firstSet,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004002 u32 descriptorSetCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004003 const VkDescriptorSet* pDescriptorSets,
4004 u32 dynamicOffsetCount,
4005 const u32* pDynamicOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004006 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004007
Jesse Hall03b6fe12015-11-24 12:44:21 -08004008 descriptorSets := pDescriptorSets[0:descriptorSetCount]
4009 for i in (0 .. descriptorSetCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004010 descriptorSet := descriptorSets[i]
4011 descriptorSetObject := GetDescriptorSet(descriptorSet)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004012 assert(commandBufferObject.device == descriptorSetObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004013 }
4014
4015 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
4016 for i in (0 .. dynamicOffsetCount) {
4017 dynamicOffset := dynamicOffsets[i]
4018 }
4019
Jesse Halld8bade02015-11-24 10:24:18 -08004020 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004021 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
4022 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
4023 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08004024 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004025}
4026
4027@threadSafety("app")
4028cmd void vkCmdBindIndexBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004029 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004030 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004031 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004032 VkIndexType indexType) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004033 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004034 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004035 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004036
Jesse Hall3fbc8562015-11-29 22:10:52 -08004037 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004038
Jesse Hall3fbc8562015-11-29 22:10:52 -08004039 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004040}
4041
4042@threadSafety("app")
4043cmd void vkCmdBindVertexBuffers(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004044 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004045 u32 startBinding,
4046 u32 bindingCount,
4047 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004048 const VkDeviceSize* pOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004049 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004050
4051 // TODO: check if not [startBinding:startBinding+bindingCount]
4052 buffers := pBuffers[0:bindingCount]
4053 offsets := pOffsets[0:bindingCount]
4054 for i in (0 .. bindingCount) {
4055 buffer := buffers[i]
4056 offset := offsets[i]
4057 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004058 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004059
Jesse Hall3fbc8562015-11-29 22:10:52 -08004060 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004061 }
4062
Jesse Hall3fbc8562015-11-29 22:10:52 -08004063 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004064}
4065
4066@threadSafety("app")
4067cmd void vkCmdDraw(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004068 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004069 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004070 u32 instanceCount,
4071 u32 firstVertex,
4072 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004073 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004074
Jesse Hall3fbc8562015-11-29 22:10:52 -08004075 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004076}
4077
4078@threadSafety("app")
4079cmd void vkCmdDrawIndexed(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004080 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004081 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004082 u32 instanceCount,
4083 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004084 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004085 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004086 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004087
Jesse Hall3fbc8562015-11-29 22:10:52 -08004088 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004089}
4090
4091@threadSafety("app")
4092cmd void vkCmdDrawIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004093 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004094 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004095 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004096 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004097 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004098 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004099 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004100 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004101
Jesse Hall3fbc8562015-11-29 22:10:52 -08004102 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004103
Jesse Hall3fbc8562015-11-29 22:10:52 -08004104 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004105}
4106
4107@threadSafety("app")
4108cmd void vkCmdDrawIndexedIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004109 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004110 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004111 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004112 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004113 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004114 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004115 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004116 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004117
Jesse Hall3fbc8562015-11-29 22:10:52 -08004118 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004119
Jesse Hall3fbc8562015-11-29 22:10:52 -08004120 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004121}
4122
4123@threadSafety("app")
4124cmd void vkCmdDispatch(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004125 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004126 u32 x,
4127 u32 y,
4128 u32 z) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004129 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004130
Jesse Hall3fbc8562015-11-29 22:10:52 -08004131 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004132}
4133
4134@threadSafety("app")
4135cmd void vkCmdDispatchIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004136 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004137 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004138 VkDeviceSize offset) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004139 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004140 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004141 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004142
Jesse Hall3fbc8562015-11-29 22:10:52 -08004143 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004144
Jesse Hall3fbc8562015-11-29 22:10:52 -08004145 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004146}
4147
4148@threadSafety("app")
4149cmd void vkCmdCopyBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004150 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004151 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004152 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004153 u32 regionCount,
4154 const VkBufferCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004155 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004156 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004157 dstBufferObject := GetBuffer(dstBuffer)
4158 assert(commandBufferObject.device == srcBufferObject.device)
4159 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004160
4161 regions := pRegions[0:regionCount]
4162 for i in (0 .. regionCount) {
4163 region := regions[i]
4164 }
4165
Jesse Hall3fbc8562015-11-29 22:10:52 -08004166 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4167 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004168
Jesse Hall65ab5522015-11-30 00:07:16 -08004169 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004170}
4171
4172@threadSafety("app")
4173cmd void vkCmdCopyImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004174 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004175 VkImage srcImage,
4176 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004177 VkImage dstImage,
4178 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004179 u32 regionCount,
4180 const VkImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004181 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004182 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004183 dstImageObject := GetImage(dstImage)
4184 assert(commandBufferObject.device == srcImageObject.device)
4185 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004186
4187 regions := pRegions[0:regionCount]
4188 for i in (0 .. regionCount) {
4189 region := regions[i]
4190 }
4191
Jesse Hall3fbc8562015-11-29 22:10:52 -08004192 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4193 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004194
Jesse Hall65ab5522015-11-30 00:07:16 -08004195 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004196}
4197
4198@threadSafety("app")
4199cmd void vkCmdBlitImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004200 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004201 VkImage srcImage,
4202 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004203 VkImage dstImage,
4204 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004205 u32 regionCount,
4206 const VkImageBlit* pRegions,
Jesse Hall23ff73f2015-11-29 14:36:39 -08004207 VkFilter filter) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004208 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004209 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004210 dstImageObject := GetImage(dstImage)
4211 assert(commandBufferObject.device == srcImageObject.device)
4212 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004213
4214 regions := pRegions[0:regionCount]
4215 for i in (0 .. regionCount) {
4216 region := regions[i]
4217 }
4218
Jesse Hall3fbc8562015-11-29 22:10:52 -08004219 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4220 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004221
Jesse Hall3fbc8562015-11-29 22:10:52 -08004222 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004223}
4224
4225@threadSafety("app")
4226cmd void vkCmdCopyBufferToImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004227 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004228 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004229 VkImage dstImage,
4230 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004231 u32 regionCount,
4232 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004233 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004234 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004235 dstImageObject := GetImage(dstImage)
4236 assert(commandBufferObject.device == srcBufferObject.device)
4237 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004238
4239 regions := pRegions[0:regionCount]
4240 for i in (0 .. regionCount) {
4241 region := regions[i]
4242 }
4243
Jesse Hall3fbc8562015-11-29 22:10:52 -08004244 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4245 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004246
Jesse Hall65ab5522015-11-30 00:07:16 -08004247 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004248}
4249
4250@threadSafety("app")
4251cmd void vkCmdCopyImageToBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004252 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004253 VkImage srcImage,
4254 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004255 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004256 u32 regionCount,
4257 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004258 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004259 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004260 dstBufferObject := GetBuffer(dstBuffer)
4261 assert(commandBufferObject.device == srcImageObject.device)
4262 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004263
4264 regions := pRegions[0:regionCount]
4265 for i in (0 .. regionCount) {
4266 region := regions[i]
4267 }
4268
Jesse Hall3fbc8562015-11-29 22:10:52 -08004269 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4270 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004271
Jesse Hall65ab5522015-11-30 00:07:16 -08004272 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004273}
4274
4275@threadSafety("app")
4276cmd void vkCmdUpdateBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004277 VkCommandBuffer commandBuffer,
4278 VkBuffer dstBuffer,
4279 VkDeviceSize dstOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004280 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004281 const u32* pData) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004282 commandBufferObject := GetCommandBuffer(commandBuffer)
4283 dstBufferObject := GetBuffer(dstBuffer)
4284 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004285
4286 data := pData[0:dataSize]
4287
Jesse Hall3fbc8562015-11-29 22:10:52 -08004288 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004289
Jesse Hall65ab5522015-11-30 00:07:16 -08004290 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004291}
4292
4293@threadSafety("app")
4294cmd void vkCmdFillBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004295 VkCommandBuffer commandBuffer,
4296 VkBuffer dstBuffer,
4297 VkDeviceSize dstOffset,
Jesse Hallb00daad2015-11-29 19:46:20 -08004298 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004299 u32 data) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004300 commandBufferObject := GetCommandBuffer(commandBuffer)
4301 dstBufferObject := GetBuffer(dstBuffer)
4302 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004303
Jesse Hall65ab5522015-11-30 00:07:16 -08004304 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004305}
4306
4307@threadSafety("app")
4308cmd void vkCmdClearColorImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004309 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004310 VkImage image,
4311 VkImageLayout imageLayout,
4312 const VkClearColorValue* pColor,
4313 u32 rangeCount,
4314 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004315 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004316 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004317 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004318
4319 ranges := pRanges[0:rangeCount]
4320 for i in (0 .. rangeCount) {
4321 range := ranges[i]
4322 }
4323
Jesse Hall3fbc8562015-11-29 22:10:52 -08004324 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004325
Jesse Hall3fbc8562015-11-29 22:10:52 -08004326 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004327}
4328
4329@threadSafety("app")
4330cmd void vkCmdClearDepthStencilImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004331 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004332 VkImage image,
4333 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004334 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004335 u32 rangeCount,
4336 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004337 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004338 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004339 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004340
4341 ranges := pRanges[0:rangeCount]
4342 for i in (0 .. rangeCount) {
4343 range := ranges[i]
4344 }
4345
Jesse Hall3fbc8562015-11-29 22:10:52 -08004346 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004347
Jesse Hall3fbc8562015-11-29 22:10:52 -08004348 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004349}
4350
4351@threadSafety("app")
Jesse Hallae38f732015-11-19 21:32:50 -08004352cmd void vkCmdClearAttachments(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004353 VkCommandBuffer commandBuffer,
Jesse Hallae38f732015-11-19 21:32:50 -08004354 u32 attachmentCount,
4355 const VkClearAttachment* pAttachments,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004356 u32 rectCount,
Jesse Halla15a4bf2015-11-19 22:48:02 -08004357 const VkClearRect* pRects) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004358 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004359
4360 rects := pRects[0:rectCount]
4361 for i in (0 .. rectCount) {
4362 rect := rects[i]
4363 }
4364
Jesse Hall3fbc8562015-11-29 22:10:52 -08004365 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004366}
4367
4368@threadSafety("app")
4369cmd void vkCmdResolveImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004370 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004371 VkImage srcImage,
4372 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004373 VkImage dstImage,
4374 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004375 u32 regionCount,
4376 const VkImageResolve* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004377 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004378 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004379 dstImageObject := GetImage(dstImage)
4380 assert(commandBufferObject.device == srcImageObject.device)
4381 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004382
4383 regions := pRegions[0:regionCount]
4384 for i in (0 .. regionCount) {
4385 region := regions[i]
4386 }
4387
Jesse Hall3fbc8562015-11-29 22:10:52 -08004388 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4389 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004390
Jesse Hall3fbc8562015-11-29 22:10:52 -08004391 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004392}
4393
4394@threadSafety("app")
4395cmd void vkCmdSetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004396 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004397 VkEvent event,
4398 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004399 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004400 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004401 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004402}
4403
4404@threadSafety("app")
4405cmd void vkCmdResetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004406 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004407 VkEvent event,
4408 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004409 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004410 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004411 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004412}
4413
4414@threadSafety("app")
4415cmd void vkCmdWaitEvents(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004416 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004417 u32 eventCount,
4418 const VkEvent* pEvents,
4419 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004420 VkPipelineStageFlags dstStageMask,
4421 u32 memoryBarrierCount,
4422 const void* const* ppMemoryBarriers) {
4423 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004424
4425 events := pEvents[0:eventCount]
4426 for i in (0 .. eventCount) {
4427 event := events[i]
4428 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004429 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004430 }
4431
Jesse Hall3fbc8562015-11-29 22:10:52 -08004432 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4433 for i in (0 .. memoryBarrierCount) {
4434 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004435 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004436 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004437 }
4438 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004439 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4440 imageObject := GetImage(imageMemoryBarrier.image)
4441 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004442 }
4443 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004444 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4445 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4446 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004447 }
4448 }
4449 }
4450}
4451
4452@threadSafety("app")
4453cmd void vkCmdPipelineBarrier(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004454 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004455 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004456 VkPipelineStageFlags dstStageMask,
Jesse Halldc6d36c2015-11-29 19:12:15 -08004457 VkDependencyFlags dependencyFlags,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004458 u32 memoryBarrierCount,
4459 const void* const* ppMemoryBarriers) {
4460 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004461
Jesse Hall3fbc8562015-11-29 22:10:52 -08004462 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4463 for i in (0 .. memoryBarrierCount) {
4464 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004465 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004466 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004467 }
4468 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004469 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4470 imageObject := GetImage(imageMemoryBarrier.image)
4471 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004472 }
4473 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004474 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4475 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4476 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004477 }
4478 }
4479 }
4480}
4481
4482@threadSafety("app")
4483cmd void vkCmdBeginQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004484 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004485 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004486 u32 entry,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004487 VkQueryControlFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004488 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004489 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004490 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004491}
4492
4493@threadSafety("app")
4494cmd void vkCmdEndQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004495 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004496 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004497 u32 entry) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004498 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004499 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004500 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004501}
4502
4503@threadSafety("app")
4504cmd void vkCmdResetQueryPool(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004505 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004506 VkQueryPool queryPool,
4507 u32 startQuery,
4508 u32 queryCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004509 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004510 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004511 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004512}
4513
4514@threadSafety("app")
4515cmd void vkCmdWriteTimestamp(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004516 VkCommandBuffer commandBuffer,
Jesse Hall6f39a6d2015-11-24 11:08:36 -08004517 VkPipelineStageFlagBits pipelineStage,
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004518 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004519 u32 entry) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004520 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004521 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004522 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004523}
4524
4525@threadSafety("app")
4526cmd void vkCmdCopyQueryPoolResults(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004527 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004528 VkQueryPool queryPool,
4529 u32 startQuery,
4530 u32 queryCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004531 VkBuffer dstBuffer,
4532 VkDeviceSize dstOffset,
Jesse Halla9bb62b2015-11-21 19:31:56 -08004533 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004534 VkQueryResultFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004535 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004536 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004537 dstBufferObject := GetBuffer(dstBuffer)
4538 assert(commandBufferObject.device == queryPoolObject.device)
4539 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004540}
4541
4542cmd void vkCmdPushConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004543 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004544 VkPipelineLayout layout,
4545 VkShaderStageFlags stageFlags,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004546 u32 offset,
4547 u32 size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004548 const void* values) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004549 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004550 layoutObject := GetPipelineLayout(layout)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004551 assert(commandBufferObject.device == layoutObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004552}
4553
4554@threadSafety("app")
4555cmd void vkCmdBeginRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004556 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004557 const VkRenderPassBeginInfo* pRenderPassBegin,
Jesse Hall65ab5522015-11-30 00:07:16 -08004558 VkSubpassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004559 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004560 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4561 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004562 assert(commandBufferObject.device == renderPassObject.device)
4563 assert(commandBufferObject.device == framebufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004564
Jesse Hall3fbc8562015-11-29 22:10:52 -08004565 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004566}
4567
4568cmd void vkCmdNextSubpass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004569 VkCommandBuffer commandBuffer,
Jesse Hall65ab5522015-11-30 00:07:16 -08004570 VkSubpassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004571 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004572}
4573
4574@threadSafety("app")
4575cmd void vkCmdEndRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004576 VkCommandBuffer commandBuffer) {
4577 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004578
Jesse Hall3fbc8562015-11-29 22:10:52 -08004579 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004580}
4581
4582cmd void vkCmdExecuteCommands(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004583 VkCommandBuffer commandBuffer,
4584 u32 commandBuffersCount,
4585 const VkCommandBuffer* pCommandBuffers) {
4586 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004587
Jesse Hall3fbc8562015-11-29 22:10:52 -08004588 commandBuffers := pCommandBuffers[0:commandBuffersCount]
4589 for i in (0 .. commandBuffersCount) {
4590 secondaryCommandBuffer := commandBuffers[i]
4591 secondaryCommandBufferObject := GetCommandBuffer(secondaryCommandBuffer)
4592 assert(commandBufferObject.device == secondaryCommandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004593 }
4594}
4595
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004596@extension("VK_KHR_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004597cmd void vkDestroySurfaceKHR(
4598 VkInstance instance,
Jesse Hall0e74f002015-11-30 11:37:59 -08004599 VkSurfaceKHR surface,
4600 const VkAllocationCallbacks* pAllocator) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004601 instanceObject := GetInstance(instance)
4602 surfaceObject := GetSurface(surface)
4603 assert(surfaceObject.instance == instance)
Michael Lentine88594d72015-11-12 12:49:45 -08004604
Jesse Hall1356b0d2015-11-23 17:24:58 -08004605 State.Surfaces[surface] = null
Jesse Hall2818f932015-11-19 21:19:17 -08004606}
4607
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004608@extension("VK_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004609cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004610 VkPhysicalDevice physicalDevice,
4611 u32 queueFamilyIndex,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004612 VkSurfaceKHR surface,
Jesse Hallb00daad2015-11-29 19:46:20 -08004613 VkBool32* pSupported) {
4614 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004615
4616 return ?
4617}
4618
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004619@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004620cmd VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
4621 VkPhysicalDevice physicalDevice,
4622 VkSurfaceKHR surface,
4623 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
4624 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4625
4626 surfaceCapabilities := ?
4627 pSurfaceCapabilities[0] = surfaceCapabilities
4628
4629 return ?
4630}
4631
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004632@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004633cmd VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(
4634 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004635 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004636 u32* pSurfaceFormatCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004637 VkSurfaceFormatKHR* pSurfaceFormats) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004638 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004639
4640 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004641 pSurfaceFormatCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004642 surfaceFormats := pSurfaceFormats[0:count]
4643
4644 for i in (0 .. count) {
4645 surfaceFormat := ?
4646 surfaceFormats[i] = surfaceFormat
4647 }
4648
4649 return ?
4650}
4651
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004652@extension("VK_KHR_surface")
Jesse Hallb00daad2015-11-29 19:46:20 -08004653cmd VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(
4654 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004655 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004656 u32* pPresentModeCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004657 VkPresentModeKHR* pPresentModes) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004658 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004659
4660 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004661 pPresentModeCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004662 presentModes := pPresentModes[0:count]
4663
4664 for i in (0 .. count) {
4665 presentMode := ?
4666 presentModes[i] = presentMode
4667 }
4668
4669 return ?
4670}
4671
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004672@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004673cmd VkResult vkCreateSwapchainKHR(
4674 VkDevice device,
4675 const VkSwapchainCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004676 const VkAllocationCallbacks* pAllocator,
Michael Lentine88594d72015-11-12 12:49:45 -08004677 VkSwapchainKHR* pSwapchain) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004678 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
Michael Lentine88594d72015-11-12 12:49:45 -08004679 deviceObject := GetDevice(device)
4680
4681 swapchain := ?
4682 pSwapchain[0] = swapchain
4683 State.Swapchains[swapchain] = new!SwapchainObject(device: device)
4684
4685 return ?
4686}
4687
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004688@extension("VK_KHR_swapchain")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004689cmd void vkDestroySwapchainKHR(
Michael Lentine88594d72015-11-12 12:49:45 -08004690 VkDevice device,
Jesse Hall0e74f002015-11-30 11:37:59 -08004691 VkSwapchainKHR swapchain,
4692 const VkAllocationCallbacks* pAllocator) {
Michael Lentine88594d72015-11-12 12:49:45 -08004693 deviceObject := GetDevice(device)
4694 swapchainObject := GetSwapchain(swapchain)
4695 assert(swapchainObject.device == device)
4696
4697 State.Swapchains[swapchain] = null
Michael Lentine88594d72015-11-12 12:49:45 -08004698}
4699
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004700@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004701cmd VkResult vkGetSwapchainImagesKHR(
4702 VkDevice device,
4703 VkSwapchainKHR swapchain,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004704 u32* pSwapchainImageCount,
Michael Lentine88594d72015-11-12 12:49:45 -08004705 VkImage* pSwapchainImages) {
4706 deviceObject := GetDevice(device)
4707
4708 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004709 pSwapchainImageCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004710 swapchainImages := pSwapchainImages[0:count]
4711
4712 for i in (0 .. count) {
4713 swapchainImage := ?
4714 swapchainImages[i] = swapchainImage
Jesse Hall1356b0d2015-11-23 17:24:58 -08004715 State.Images[swapchainImage] = new!ImageObject(device: device)
Michael Lentine88594d72015-11-12 12:49:45 -08004716 }
4717
4718 return ?
4719}
4720
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004721@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004722cmd VkResult vkAcquireNextImageKHR(
4723 VkDevice device,
4724 VkSwapchainKHR swapchain,
4725 u64 timeout,
4726 VkSemaphore semaphore,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004727 VkFence fence,
Michael Lentine88594d72015-11-12 12:49:45 -08004728 u32* pImageIndex) {
4729 deviceObject := GetDevice(device)
4730 swapchainObject := GetSwapchain(swapchain)
4731
4732 imageIndex := ?
4733 pImageIndex[0] = imageIndex
4734
4735 return ?
4736}
4737
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004738@extension("VK_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004739cmd VkResult vkQueuePresentKHR(
4740 VkQueue queue,
4741 VkPresentInfoKHR* pPresentInfo) {
4742 queueObject := GetQueue(queue)
4743
4744 presentInfo := ?
4745 pPresentInfo[0] = presentInfo
4746
4747 return ?
4748}
4749
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004750@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004751cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
4752 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004753 u32* pPropertyCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004754 VkDisplayPropertiesKHR* pProperties) {
4755 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4756 return ?
4757}
4758
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004759@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004760cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
4761 VkPhysicalDevice physicalDevice,
4762 u32* pPropertyCount,
4763 VkDisplayPlanePropertiesKHR* pProperties) {
4764 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4765 return ?
4766}
4767
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004768@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004769cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR(
4770 VkPhysicalDevice physicalDevice,
4771 u32* pPropertyCount,
4772 VkDisplayKHR* pProperties) {
4773 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4774 return ?
4775}
4776
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004777@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004778cmd VkResult vkGetDisplayModePropertiesKHR(
4779 VkPhysicalDevice physicalDevice,
4780 VkDisplayKHR display,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004781 u32* pPropertyCount,
4782 VkDisplayModePropertiesKHR* pProperties) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004783 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4784 return ?
4785}
4786
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004787@extension("VK_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004788cmd VkResult vkCreateDisplayModeKHR(
4789 VkPhysicalDevice physicalDevice,
4790 VkDisplayKHR display,
4791 const VkDisplayModeCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004792 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004793 VkDisplayModeKHR* pMode) {
4794 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4795 return ?
4796}
4797
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004798@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004799cmd VkResult vkGetDisplayPlaneCapabilitiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004800 VkPhysicalDevice physicalDevice,
Jesse Halla6429252015-11-29 18:59:42 -08004801 VkDisplayModeCreateInfoKHR mode,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004802 u32 planeIndex,
Jesse Halla6429252015-11-29 18:59:42 -08004803 VkDisplayPlaneCapabilitiesKHR* pCapabilities) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004804 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4805 return ?
4806}
4807
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004808@extension("VK_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004809cmd VkResult vkCreateDisplayPlaneSurfaceKHR(
4810 VkInstance instance,
4811 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
Jesse Hall0e74f002015-11-30 11:37:59 -08004812 const VkAllocationCallbacks* pAllocator,
Jesse Halla6429252015-11-29 18:59:42 -08004813 VkSurfaceKHR* pSurface) {
4814 return ?
4815}
4816
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004817@extension("VK_KHR_xlib_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004818cmd VkResult vkCreateXlibSurfaceKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004819 VkInstance instance,
4820 platform.Display* dpy,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004821 platform.Window window,
Jesse Hall0e74f002015-11-30 11:37:59 -08004822 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004823 VkSurfaceKHR* pSurface) {
4824 instanceObject := GetInstance(instance)
4825 return ?
4826}
4827
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004828@extension("VK_KHR_xlib_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004829cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
4830 VkPhysicalDevice physicalDevice,
4831 u32 queueFamilyIndex,
4832 platform.Display* dpy,
Jesse Hall65ab5522015-11-30 00:07:16 -08004833 platform.VisualID visualID) {
Jesse Halla6429252015-11-29 18:59:42 -08004834 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4835 return ?
4836}
4837
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004838@extension("VK_KHR_xcb_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004839cmd VkResult vkCreateXCBSurfaceKHR(
4840 VkInstance instance,
4841 platform.xcb_connection_t* connection,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004842 platform.xcb_window_t window,
Jesse Hall0e74f002015-11-30 11:37:59 -08004843 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004844 VkSurfaceKHR* pSurface) {
4845 instanceObject := GetInstance(instance)
4846 return ?
4847}
4848
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004849@extension("VK_KHR_xlib_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004850cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
4851 VkPhysicalDevice physicalDevice,
4852 u32 queueFamilyIndex,
4853 platform.xcb_connection_t* connection,
4854 platform.xcb_visualid_t visual_id) {
4855 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4856 return ?
4857}
4858
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004859@extension("VK_KHR_wayland_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004860cmd VkResult vkCreateWaylandSurfaceKHR(
4861 VkInstance instance,
4862 platform.wl_display* display,
4863 platform.wl_surface* surface,
Jesse Hall0e74f002015-11-30 11:37:59 -08004864 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004865 VkSurfaceKHR* pSurface) {
4866 instanceObject := GetInstance(instance)
4867 return ?
4868}
4869
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004870@extension("VK_KHR_wayland_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004871cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
4872 VkPhysicalDevice physicalDevice,
4873 u32 queueFamilyIndex,
4874 platform.wl_display* display) {
4875 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4876 return ?
4877}
4878
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004879@extension("VK_KHR_mir_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004880cmd VkResult vkCreateMirSurfaceKHR(
4881 VkInstance instance,
4882 platform.MirConnection* connection,
4883 platform.MirSurface* mirSurface,
Jesse Hall0e74f002015-11-30 11:37:59 -08004884 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004885 VkSurfaceKHR* pSurface) {
4886 instanceObject := GetInstance(instance)
4887 return ?
4888}
4889
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004890@extension("VK_KHR_mir_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004891cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR(
4892 VkPhysicalDevice physicalDevice,
4893 u32 queueFamilyIndex,
4894 platform.MirConnection* connection) {
4895 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4896 return ?
4897}
4898
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004899@extension("VK_KHR_android_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004900cmd VkResult vkCreateAndroidSurfaceKHR(
4901 VkInstance instance,
Jesse Hall0e74f002015-11-30 11:37:59 -08004902 platform.ANativeWindow* window,
4903 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004904 VkSurfaceKHR* pSurface) {
4905 instanceObject := GetInstance(instance)
4906 return ?
4907}
4908
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004909@extension("VK_KHR_win32_surface")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004910cmd VkResult vkCreateWin32SurfaceKHR(
4911 VkInstance instance,
4912 platform.HINSTANCE hinstance,
4913 platform.HWND hwnd,
Jesse Hall0e74f002015-11-30 11:37:59 -08004914 const VkAllocationCallbacks* pAllocator,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004915 VkSurfaceKHR* pSurface) {
4916 instanceObject := GetInstance(instance)
4917 return ?
4918}
4919
Jesse Hall3e0dc8f2015-11-30 00:42:57 -08004920@extension("VK_KHR_win32_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004921cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR(
4922 VkPhysicalDevice physicalDevice,
4923 u32 queueFamilyIndex) {
4924 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4925 return ?
4926}
4927
Jesse Halld27f6aa2015-08-15 17:58:48 -07004928
4929////////////////
4930// Validation //
4931////////////////
4932
4933extern void validate(string layerName, bool condition, string message)
4934
4935
4936/////////////////////////////
4937// Internal State Tracking //
4938/////////////////////////////
4939
4940StateObject State
4941
4942@internal class StateObject {
4943 // Dispatchable objects.
4944 map!(VkInstance, ref!InstanceObject) Instances
4945 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4946 map!(VkDevice, ref!DeviceObject) Devices
4947 map!(VkQueue, ref!QueueObject) Queues
Jesse Hall3fbc8562015-11-29 22:10:52 -08004948 map!(VkCommandBuffer, ref!CommandBufferObject) CommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07004949
4950 // Non-dispatchable objects.
4951 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4952 map!(VkBuffer, ref!BufferObject) Buffers
4953 map!(VkBufferView, ref!BufferViewObject) BufferViews
4954 map!(VkImage, ref!ImageObject) Images
4955 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004956 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
Jesse Halld27f6aa2015-08-15 17:58:48 -07004957 map!(VkPipeline, ref!PipelineObject) Pipelines
4958 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4959 map!(VkSampler, ref!SamplerObject) Samplers
4960 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4961 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4962 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004963 map!(VkFence, ref!FenceObject) Fences
4964 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4965 map!(VkEvent, ref!EventObject) Events
4966 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4967 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4968 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4969 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
Jesse Hall3fbc8562015-11-29 22:10:52 -08004970 map!(VkCommandPool, ref!CommandPoolObject) CommandPools
Jesse Hall1356b0d2015-11-23 17:24:58 -08004971 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces
Michael Lentine88594d72015-11-12 12:49:45 -08004972 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains
Jesse Halld27f6aa2015-08-15 17:58:48 -07004973}
4974
4975@internal class InstanceObject {
4976}
4977
4978@internal class PhysicalDeviceObject {
4979 VkInstance instance
4980}
4981
4982@internal class DeviceObject {
4983 VkPhysicalDevice physicalDevice
4984}
4985
4986@internal class QueueObject {
4987 VkDevice device
4988 VkQueueFlags flags
4989}
4990
Jesse Hall3fbc8562015-11-29 22:10:52 -08004991@internal class CommandBufferObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004992 VkDevice device
4993 map!(u64, VkDeviceMemory) boundObjects
4994 VkQueueFlags queueFlags
4995}
4996
4997@internal class DeviceMemoryObject {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004998 VkDevice device
4999 VkDeviceSize allocationSize
5000 map!(u64, VkDeviceSize) boundObjects
5001 map!(VkCommandBuffer, VkCommandBuffer) boundCommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07005002}
5003
5004@internal class BufferObject {
5005 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005006 VkDeviceMemory memory
5007 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005008}
5009
5010@internal class BufferViewObject {
5011 VkDevice device
5012 VkBuffer buffer
5013}
5014
5015@internal class ImageObject {
5016 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005017 VkDeviceMemory memory
5018 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005019}
5020
5021@internal class ImageViewObject {
5022 VkDevice device
5023 VkImage image
5024}
5025
Jesse Halld27f6aa2015-08-15 17:58:48 -07005026@internal class ShaderObject {
5027 VkDevice device
5028}
5029
5030@internal class ShaderModuleObject {
5031 VkDevice device
5032}
5033
5034@internal class PipelineObject {
5035 VkDevice device
5036}
5037
5038@internal class PipelineLayoutObject {
5039 VkDevice device
5040}
5041
5042@internal class SamplerObject {
5043 VkDevice device
5044}
5045
5046@internal class DescriptorSetObject {
5047 VkDevice device
5048}
5049
5050@internal class DescriptorSetLayoutObject {
5051 VkDevice device
5052}
5053
5054@internal class DescriptorPoolObject {
5055 VkDevice device
5056}
5057
Jesse Halld27f6aa2015-08-15 17:58:48 -07005058@internal class FenceObject {
5059 VkDevice device
5060 bool signaled
5061}
5062
5063@internal class SemaphoreObject {
5064 VkDevice device
5065}
5066
5067@internal class EventObject {
5068 VkDevice device
5069}
5070
5071@internal class QueryPoolObject {
5072 VkDevice device
5073}
5074
5075@internal class FramebufferObject {
5076 VkDevice device
5077}
5078
5079@internal class RenderPassObject {
5080 VkDevice device
5081}
5082
5083@internal class PipelineCacheObject {
5084 VkDevice device
5085}
5086
Jesse Hall3fbc8562015-11-29 22:10:52 -08005087@internal class CommandPoolObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07005088 VkDevice device
5089}
5090
Jesse Hall1356b0d2015-11-23 17:24:58 -08005091@internal class SurfaceObject {
5092 VkInstance instance
5093}
5094
Michael Lentine88594d72015-11-12 12:49:45 -08005095@internal class SwapchainObject {
5096 VkDevice device
5097}
5098
Jesse Halld27f6aa2015-08-15 17:58:48 -07005099macro ref!InstanceObject GetInstance(VkInstance instance) {
5100 assert(instance in State.Instances)
5101 return State.Instances[instance]
5102}
5103
5104macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
5105 assert(physicalDevice in State.PhysicalDevices)
5106 return State.PhysicalDevices[physicalDevice]
5107}
5108
5109macro ref!DeviceObject GetDevice(VkDevice device) {
5110 assert(device in State.Devices)
5111 return State.Devices[device]
5112}
5113
5114macro ref!QueueObject GetQueue(VkQueue queue) {
5115 assert(queue in State.Queues)
5116 return State.Queues[queue]
5117}
5118
Jesse Hall3fbc8562015-11-29 22:10:52 -08005119macro ref!CommandBufferObject GetCommandBuffer(VkCommandBuffer commandBuffer) {
5120 assert(commandBuffer in State.CommandBuffers)
5121 return State.CommandBuffers[commandBuffer]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005122}
5123
Jesse Hall3fbc8562015-11-29 22:10:52 -08005124macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory memory) {
5125 assert(memory in State.DeviceMemories)
5126 return State.DeviceMemories[memory]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005127}
5128
5129macro ref!BufferObject GetBuffer(VkBuffer buffer) {
5130 assert(buffer in State.Buffers)
5131 return State.Buffers[buffer]
5132}
5133
5134macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
5135 assert(bufferView in State.BufferViews)
5136 return State.BufferViews[bufferView]
5137}
5138
5139macro ref!ImageObject GetImage(VkImage image) {
5140 assert(image in State.Images)
5141 return State.Images[image]
5142}
5143
5144macro ref!ImageViewObject GetImageView(VkImageView imageView) {
5145 assert(imageView in State.ImageViews)
5146 return State.ImageViews[imageView]
5147}
5148
Jesse Halld27f6aa2015-08-15 17:58:48 -07005149macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
5150 assert(shaderModule in State.ShaderModules)
5151 return State.ShaderModules[shaderModule]
5152}
5153
5154macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
5155 assert(pipeline in State.Pipelines)
5156 return State.Pipelines[pipeline]
5157}
5158
5159macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
5160 assert(pipelineLayout in State.PipelineLayouts)
5161 return State.PipelineLayouts[pipelineLayout]
5162}
5163
5164macro ref!SamplerObject GetSampler(VkSampler sampler) {
5165 assert(sampler in State.Samplers)
5166 return State.Samplers[sampler]
5167}
5168
5169macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
5170 assert(descriptorSet in State.DescriptorSets)
5171 return State.DescriptorSets[descriptorSet]
5172}
5173
5174macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
5175 assert(descriptorSetLayout in State.DescriptorSetLayouts)
5176 return State.DescriptorSetLayouts[descriptorSetLayout]
5177}
5178
5179macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
5180 assert(descriptorPool in State.DescriptorPools)
5181 return State.DescriptorPools[descriptorPool]
5182}
5183
Jesse Halld27f6aa2015-08-15 17:58:48 -07005184macro ref!FenceObject GetFence(VkFence fence) {
5185 assert(fence in State.Fences)
5186 return State.Fences[fence]
5187}
5188
5189macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
5190 assert(semaphore in State.Semaphores)
5191 return State.Semaphores[semaphore]
5192}
5193
5194macro ref!EventObject GetEvent(VkEvent event) {
5195 assert(event in State.Events)
5196 return State.Events[event]
5197}
5198
5199macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
5200 assert(queryPool in State.QueryPools)
5201 return State.QueryPools[queryPool]
5202}
5203
5204macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
5205 assert(framebuffer in State.Framebuffers)
5206 return State.Framebuffers[framebuffer]
5207}
5208
5209macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
5210 assert(renderPass in State.RenderPasses)
5211 return State.RenderPasses[renderPass]
5212}
5213
5214macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
5215 assert(pipelineCache in State.PipelineCaches)
5216 return State.PipelineCaches[pipelineCache]
5217}
5218
Jesse Hall3fbc8562015-11-29 22:10:52 -08005219macro ref!CommandPoolObject GetCommandPool(VkCommandPool commandPool) {
5220 assert(commandPool in State.CommandPools)
5221 return State.CommandPools[commandPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07005222}
Michael Lentine88594d72015-11-12 12:49:45 -08005223
Jesse Hall1356b0d2015-11-23 17:24:58 -08005224macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) {
5225 assert(surface in State.Surfaces)
5226 return State.Surfaces[surface]
5227}
5228
Michael Lentine88594d72015-11-12 12:49:45 -08005229macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) {
5230 assert(swapchain in State.Swapchains)
5231 return State.Swapchains[swapchain]
5232}
Jesse Halld8bade02015-11-24 10:24:18 -08005233
5234macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) {
5235 return as!VkQueueFlags(as!u32(flags) | as!u32(bit))
5236}