blob: 9575407b306ae29ef8c7b87137a8d56d1b9db4fb [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 Halld1af8122015-11-29 23:50:38 -080030define VERSION_MINOR 197
Jesse Hallae38f732015-11-19 21:32:50 -080031define VERSION_PATCH 0
Jesse Halld27f6aa2015-08-15 17:58:48 -070032
33// API limits
34define VK_MAX_PHYSICAL_DEVICE_NAME 256
35define VK_UUID_LENGTH 16
36define VK_MAX_EXTENSION_NAME 256
37define VK_MAX_DESCRIPTION 256
38define VK_MAX_MEMORY_TYPES 32
39define VK_MAX_MEMORY_HEAPS 16 /// The maximum number of unique memory heaps, each of which supporting 1 or more memory types.
40
41// API keywords
42define VK_TRUE 1
43define VK_FALSE 0
Jesse Hall5ae3abb2015-10-08 14:00:22 -070044
45// API keyword, but needs special handling by some templates
46define NULL_HANDLE 0
Jesse Halld27f6aa2015-08-15 17:58:48 -070047
Jesse Halla6429252015-11-29 18:59:42 -080048@extension("VK_EXT_KHR_surface") define VK_EXT_KHR_SURFACE_REVISION 20
Jesse Hall1356b0d2015-11-23 17:24:58 -080049@extension("VK_EXT_KHR_surface") define VK_EXT_KHR_SURFACE_EXTENSION_NUMBER 1
50@extension("VK_EXT_KHR_surface") define VK_EXT_KHR_SURFACE_EXTENSION_NAME "VK_EXT_KHR_surface"
51
Jesse Halla6429252015-11-29 18:59:42 -080052@extension("VK_EXT_KHR_swapchain") define VK_EXT_KHR_SWAPCHAIN_REVISION 62
Jesse Hall1356b0d2015-11-23 17:24:58 -080053@extension("VK_EXT_KHR_swapchain") define VK_EXT_KHR_SWAPCHAIN_EXTENSION_NUMBER 2
54@extension("VK_EXT_KHR_swapchain") define VK_EXT_KHR_SWAPCHAIN_EXTENSION_NAME "VK_EXT_KHR_swapchain"
55
Jesse Halla6429252015-11-29 18:59:42 -080056@extension("VK_EXT_KHR_display") define VK_EXT_KHR_DISPLAY_REVISION 17
Jesse Hall1356b0d2015-11-23 17:24:58 -080057@extension("VK_EXT_KHR_display") define VK_EXT_KHR_DISPLAY_EXTENSION_NUMBER 3
58@extension("VK_EXT_KHR_display") define VK_EXT_KHR_DISPLAY_EXTENSION_NAME "VK_EXT_KHR_display"
59
Jesse Halla6429252015-11-29 18:59:42 -080060@extension("VK_EXT_KHR_display_swapchain") define VK_EXT_KHR_DISPLAY_REVISION 6
Jesse Hall1356b0d2015-11-23 17:24:58 -080061@extension("VK_EXT_KHR_display_swapchain") define VK_EXT_KHR_DISPLAY_EXTENSION_NUMBER 4
62@extension("VK_EXT_KHR_display_swapchain") define VK_EXT_KHR_DISPLAY_EXTENSION_NAME "VK_EXT_KHR_display_swapchain"
63
Jesse Halla6429252015-11-29 18:59:42 -080064@extension("VK_EXT_KHR_xlib_surface") define VK_EXT_KHR_XLIB_SURFACE_REVISION 3
65@extension("VK_EXT_KHR_xlib_surface") define VK_EXT_KHR_XLIB_SURFACE_NUMBER 5
66@extension("VK_EXT_KHR_xlib_surface") define VK_EXT_KHR_XLIB_SURFACE_NAME "VK_EXT_KHR_xlib_surface"
Jesse Hall1356b0d2015-11-23 17:24:58 -080067
Jesse Halla6429252015-11-29 18:59:42 -080068@extension("VK_EXT_KHR_xcb_surface") define VK_EXT_KHR_XCB_SURFACE_REVISION 3
Jesse Hall1356b0d2015-11-23 17:24:58 -080069@extension("VK_EXT_KHR_xcb_surface") define VK_EXT_KHR_XCB_SURFACE_NUMBER 6
70@extension("VK_EXT_KHR_xcb_surface") define VK_EXT_KHR_XCB_SURFACE_NAME "VK_EXT_KHR_xcb_surface"
71
Jesse Halla6429252015-11-29 18:59:42 -080072@extension("VK_EXT_KHR_wayland_surface") define VK_EXT_KHR_WAYLAND_SURFACE_REVISION 2
Jesse Hall1356b0d2015-11-23 17:24:58 -080073@extension("VK_EXT_KHR_wayland_surface") define VK_EXT_KHR_WAYLAND_SURFACE_NUMBER 7
74@extension("VK_EXT_KHR_wayland_surface") define VK_EXT_KHR_WAYLAND_SURFACE_NAME "VK_EXT_KHR_wayland_surface"
75
Jesse Halla6429252015-11-29 18:59:42 -080076@extension("VK_EXT_KHR_mir_surface") define VK_EXT_KHR_MIR_SURFACE_REVISION 2
Jesse Hall1356b0d2015-11-23 17:24:58 -080077@extension("VK_EXT_KHR_mir_surface") define VK_EXT_KHR_MIR_SURFACE_NUMBER 8
78@extension("VK_EXT_KHR_mir_surface") define VK_EXT_KHR_MIR_SURFACE_NAME "VK_EXT_KHR_mir_surface"
79
80@extension("VK_EXT_KHR_android_surface") define VK_EXT_KHR_ANDROID_SURFACE_REVISION 1
81@extension("VK_EXT_KHR_android_surface") define VK_EXT_KHR_ANDROID_SURFACE_NUMBER 8
82@extension("VK_EXT_KHR_android_surface") define VK_EXT_KHR_ANDROID_SURFACE_NAME "VK_EXT_KHR_android_surface"
83
Jesse Halla6429252015-11-29 18:59:42 -080084@extension("VK_EXT_KHR_win32_surface") define VK_EXT_KHR_WIN32_SURFACE_REVISION 2
Jesse Hall1356b0d2015-11-23 17:24:58 -080085@extension("VK_EXT_KHR_win32_surface") define VK_EXT_KHR_WIN32_SURFACE_NUMBER 9
86@extension("VK_EXT_KHR_win32_surface") define VK_EXT_KHR_WIN32_SURFACE_NAME "VK_EXT_KHR_win32_surface"
87
Jesse Halld27f6aa2015-08-15 17:58:48 -070088
89/////////////
90// Types //
91/////////////
92
Jesse Hall5ae3abb2015-10-08 14:00:22 -070093type u32 VkBool32
94type u32 VkFlags
95type u64 VkDeviceSize
96type u32 VkSampleMask
97
Jesse Halld27f6aa2015-08-15 17:58:48 -070098/// Dispatchable handle types.
99@dispatchHandle type u64 VkInstance
100@dispatchHandle type u64 VkPhysicalDevice
101@dispatchHandle type u64 VkDevice
102@dispatchHandle type u64 VkQueue
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
113@nonDispatchHandle type u64 VkShader
114@nonDispatchHandle type u64 VkPipeline
115@nonDispatchHandle type u64 VkPipelineLayout
116@nonDispatchHandle type u64 VkSampler
117@nonDispatchHandle type u64 VkDescriptorSet
118@nonDispatchHandle type u64 VkDescriptorSetLayout
119@nonDispatchHandle type u64 VkDescriptorPool
Jesse Halld27f6aa2015-08-15 17:58:48 -0700120@nonDispatchHandle type u64 VkFence
121@nonDispatchHandle type u64 VkSemaphore
122@nonDispatchHandle type u64 VkEvent
123@nonDispatchHandle type u64 VkQueryPool
124@nonDispatchHandle type u64 VkFramebuffer
125@nonDispatchHandle type u64 VkRenderPass
126@nonDispatchHandle type u64 VkPipelineCache
Jesse Hall1356b0d2015-11-23 17:24:58 -0800127
128@extension("VK_EXT_KHR_surface") @nonDispatchHandle type u64 VkSurfaceKHR
129
130@extension("VK_EXT_KHR_swapchain") @nonDispatchHandle type u64 VkSwapchainKHR
131
132@extension("VK_EXT_KHR_display") @nonDispatchHandle type u64 VkDisplayKHR
133@extension("VK_EXT_KHR_display") @nonDispatchHandle type u64 VkDisplayModeKHR
Jesse Halld27f6aa2015-08-15 17:58:48 -0700134
135
136/////////////
137// Enums //
138/////////////
139
140enum VkImageLayout {
141 VK_IMAGE_LAYOUT_UNDEFINED = 0x00000000, /// Implicit layout an image is when its contents are undefined due to various reasons (e.g. right after creation)
142 VK_IMAGE_LAYOUT_GENERAL = 0x00000001, /// General layout when image can be used for any kind of access
143 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 0x00000002, /// Optimal layout when image is only used for color attachment read/write
144 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 0x00000003, /// Optimal layout when image is only used for depth/stencil attachment read/write
145 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 0x00000004, /// Optimal layout when image is used for read only depth/stencil attachment and shader access
146 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 0x00000005, /// Optimal layout when image is used for read only shader access
Jesse Hall3fbc8562015-11-29 22:10:52 -0800147 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 0x00000006, /// Optimal layout when image is used only as source of transfer operations
148 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 -0700149 VK_IMAGE_LAYOUT_PREINITIALIZED = 0x00000008, /// Initial layout used when the data is populated by the CPU
Jesse Hall1356b0d2015-11-23 17:24:58 -0800150
151 //@extension("VK_EXT_KHR_swapchain")
Jesse Hall3fbc8562015-11-29 22:10:52 -0800152 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 0xc0000802,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700153}
154
155enum VkAttachmentLoadOp {
156 VK_ATTACHMENT_LOAD_OP_LOAD = 0x00000000,
157 VK_ATTACHMENT_LOAD_OP_CLEAR = 0x00000001,
158 VK_ATTACHMENT_LOAD_OP_DONT_CARE = 0x00000002,
159}
160
161enum VkAttachmentStoreOp {
162 VK_ATTACHMENT_STORE_OP_STORE = 0x00000000,
163 VK_ATTACHMENT_STORE_OP_DONT_CARE = 0x00000001,
164}
165
166enum VkImageType {
167 VK_IMAGE_TYPE_1D = 0x00000000,
168 VK_IMAGE_TYPE_2D = 0x00000001,
169 VK_IMAGE_TYPE_3D = 0x00000002,
170}
171
172enum VkImageTiling {
Jesse Hallc7467b72015-11-29 21:05:26 -0800173 VK_IMAGE_TILING_OPTIMAL = 0x00000000,
174 VK_IMAGE_TILING_LINEAR = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700175}
176
177enum VkImageViewType {
178 VK_IMAGE_VIEW_TYPE_1D = 0x00000000,
179 VK_IMAGE_VIEW_TYPE_2D = 0x00000001,
180 VK_IMAGE_VIEW_TYPE_3D = 0x00000002,
181 VK_IMAGE_VIEW_TYPE_CUBE = 0x00000003,
182 VK_IMAGE_VIEW_TYPE_1D_ARRAY = 0x00000004,
183 VK_IMAGE_VIEW_TYPE_2D_ARRAY = 0x00000005,
184 VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 0x00000006,
185}
186
Jesse Hall3fbc8562015-11-29 22:10:52 -0800187enum VkCommandBufferLevel {
188 VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0x00000000,
189 VK_COMMAND_BUFFER_LEVEL_SECONDARY = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700190}
191
192enum VkChannelSwizzle {
Jesse Hallc7467b72015-11-29 21:05:26 -0800193 VK_CHANNEL_SWIZZLE_IDENTITY = 0x00000000,
194 VK_CHANNEL_SWIZZLE_ZERO = 0x00000001,
195 VK_CHANNEL_SWIZZLE_ONE = 0x00000002,
196 VK_CHANNEL_SWIZZLE_R = 0x00000003,
197 VK_CHANNEL_SWIZZLE_G = 0x00000004,
198 VK_CHANNEL_SWIZZLE_B = 0x00000005,
199 VK_CHANNEL_SWIZZLE_A = 0x00000006,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700200}
201
202enum VkDescriptorType {
203 VK_DESCRIPTOR_TYPE_SAMPLER = 0x00000000,
204 VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 0x00000001,
205 VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 0x00000002,
206 VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 0x00000003,
207 VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 0x00000004,
208 VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 0x00000005,
209 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 0x00000006,
210 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 0x00000007,
211 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 0x00000008,
212 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 0x00000009,
213 VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 0x0000000a,
214}
215
Jesse Halld27f6aa2015-08-15 17:58:48 -0700216enum VkQueryType {
217 VK_QUERY_TYPE_OCCLUSION = 0x00000000,
218 VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, /// Optional
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800219 VK_QUERY_TYPE_TIMESTAMP = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700220}
221
Jesse Halld27f6aa2015-08-15 17:58:48 -0700222enum VkBorderColor {
223 VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0x00000000,
224 VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 0x00000001,
225 VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 0x00000002,
226 VK_BORDER_COLOR_INT_OPAQUE_BLACK = 0x00000003,
227 VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 0x00000004,
228 VK_BORDER_COLOR_INT_OPAQUE_WHITE = 0x00000005,
229}
230
231enum VkPipelineBindPoint {
Jesse Hallc7467b72015-11-29 21:05:26 -0800232 VK_PIPELINE_BIND_POINT_GRAPHICS = 0x00000000,
233 VK_PIPELINE_BIND_POINT_COMPUTE = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700234}
235
236enum VkPrimitiveTopology {
237 VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0x00000000,
238 VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 0x00000001,
239 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 0x00000002,
240 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 0x00000003,
241 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 0x00000004,
242 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 0x00000005,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800243 VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 0x00000006,
244 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 0x00000007,
245 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 0x00000008,
246 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 0x00000009,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700247 VK_PRIMITIVE_TOPOLOGY_PATCH = 0x0000000a,
248}
249
250enum VkSharingMode {
251 VK_SHARING_MODE_EXCLUSIVE = 0x00000000,
252 VK_SHARING_MODE_CONCURRENT = 0x00000001,
253}
254
255enum VkIndexType {
256 VK_INDEX_TYPE_UINT16 = 0x00000000,
257 VK_INDEX_TYPE_UINT32 = 0x00000001,
258}
259
Jesse Hall23ff73f2015-11-29 14:36:39 -0800260enum VkFilter {
261 VK_FILTER_NEAREST = 0x00000000,
262 VK_FILTER_LINEAR = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700263}
264
Jesse Hall23ff73f2015-11-29 14:36:39 -0800265enum VkSamplerMipmapMode {
266 VK_SAMPLER_MIPMAP_MODE_BASE = 0x00000000, /// Always choose base level
267 VK_SAMPLER_MIPMAP_MODE_NEAREST = 0x00000001, /// Choose nearest mip level
268 VK_SAMPLER_MIPMAP_MODE_LINEAR = 0x00000002, /// Linear filter between mip levels
Jesse Halld27f6aa2015-08-15 17:58:48 -0700269}
270
Jesse Hall23ff73f2015-11-29 14:36:39 -0800271enum VkSamplerAddressMode {
Jesse Hallc7467b72015-11-29 21:05:26 -0800272 VK_SAMPLER_ADDRESS_MODE_REPEAT = 0x00000000,
273 VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 0x00000001,
274 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 0x00000002,
275 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 0x00000003,
276 VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700277}
278
279enum VkCompareOp {
280 VK_COMPARE_OP_NEVER = 0x00000000,
281 VK_COMPARE_OP_LESS = 0x00000001,
282 VK_COMPARE_OP_EQUAL = 0x00000002,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800283 VK_COMPARE_OP_LESS_OR_EQUAL = 0x00000003,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700284 VK_COMPARE_OP_GREATER = 0x00000004,
285 VK_COMPARE_OP_NOT_EQUAL = 0x00000005,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800286 VK_COMPARE_OP_GREATER_OR_EQUAL = 0x00000006,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700287 VK_COMPARE_OP_ALWAYS = 0x00000007,
288}
289
290enum VkFillMode {
Jesse Hallc7467b72015-11-29 21:05:26 -0800291 VK_FILL_MODE_SOLID = 0x00000000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700292 VK_FILL_MODE_WIREFRAME = 0x00000001,
Jesse Hallc7467b72015-11-29 21:05:26 -0800293 VK_FILL_MODE_POINTS = 0x00000002,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700294}
295
296enum VkFrontFace {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800297 VK_FRONT_FACE_COUNTER_CLOCKWISE = 0x00000000,
298 VK_FRONT_FACE_CLOCKWISE = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700299}
300
301enum VkBlend {
302 VK_BLEND_ZERO = 0x00000000,
303 VK_BLEND_ONE = 0x00000001,
304 VK_BLEND_SRC_COLOR = 0x00000002,
305 VK_BLEND_ONE_MINUS_SRC_COLOR = 0x00000003,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800306 VK_BLEND_DST_COLOR = 0x00000004,
307 VK_BLEND_ONE_MINUS_DST_COLOR = 0x00000005,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700308 VK_BLEND_SRC_ALPHA = 0x00000006,
309 VK_BLEND_ONE_MINUS_SRC_ALPHA = 0x00000007,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800310 VK_BLEND_DST_ALPHA = 0x00000008,
311 VK_BLEND_ONE_MINUS_DST_ALPHA = 0x00000009,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700312 VK_BLEND_CONSTANT_COLOR = 0x0000000a,
313 VK_BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0000000b,
314 VK_BLEND_CONSTANT_ALPHA = 0x0000000c,
315 VK_BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x0000000d,
316 VK_BLEND_SRC_ALPHA_SATURATE = 0x0000000e,
317 VK_BLEND_SRC1_COLOR = 0x0000000f,
318 VK_BLEND_ONE_MINUS_SRC1_COLOR = 0x00000010,
319 VK_BLEND_SRC1_ALPHA = 0x00000011,
320 VK_BLEND_ONE_MINUS_SRC1_ALPHA = 0x00000012,
321}
322
323enum VkBlendOp {
324 VK_BLEND_OP_ADD = 0x00000000,
325 VK_BLEND_OP_SUBTRACT = 0x00000001,
326 VK_BLEND_OP_REVERSE_SUBTRACT = 0x00000002,
327 VK_BLEND_OP_MIN = 0x00000003,
328 VK_BLEND_OP_MAX = 0x00000004,
329}
330
331enum VkStencilOp {
332 VK_STENCIL_OP_KEEP = 0x00000000,
333 VK_STENCIL_OP_ZERO = 0x00000001,
334 VK_STENCIL_OP_REPLACE = 0x00000002,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800335 VK_STENCIL_OP_INCREMENT_AND_CLAMP = 0x00000003,
336 VK_STENCIL_OP_DECREMENT_AND_CLAMP = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700337 VK_STENCIL_OP_INVERT = 0x00000005,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800338 VK_STENCIL_OP_INCREMENT_AND_WRAP = 0x00000006,
339 VK_STENCIL_OP_DECREMENT_AND_WRAP = 0x00000007,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700340}
341
342enum VkLogicOp {
343 VK_LOGIC_OP_CLEAR = 0x00000000,
344 VK_LOGIC_OP_AND = 0x00000001,
345 VK_LOGIC_OP_AND_REVERSE = 0x00000002,
346 VK_LOGIC_OP_COPY = 0x00000003,
347 VK_LOGIC_OP_AND_INVERTED = 0x00000004,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800348 VK_LOGIC_OP_NO_OP = 0x00000005,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700349 VK_LOGIC_OP_XOR = 0x00000006,
350 VK_LOGIC_OP_OR = 0x00000007,
351 VK_LOGIC_OP_NOR = 0x00000008,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800352 VK_LOGIC_OP_EQUIVALENT = 0x00000009,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700353 VK_LOGIC_OP_INVERT = 0x0000000a,
354 VK_LOGIC_OP_OR_REVERSE = 0x0000000b,
355 VK_LOGIC_OP_COPY_INVERTED = 0x0000000c,
356 VK_LOGIC_OP_OR_INVERTED = 0x0000000d,
357 VK_LOGIC_OP_NAND = 0x0000000e,
358 VK_LOGIC_OP_SET = 0x0000000f,
359}
360
Jesse Hall3fbc8562015-11-29 22:10:52 -0800361enum VkSystemAllocationScope {
362 VK_SYSTEM_ALLOCATION_SCOPE_FUNCTION = 0x00000000,
363 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 0x00000001,
364 VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 0x00000002,
365 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 0x00000003,
366 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 0x00000004,
Jesse Hall03b6fe12015-11-24 12:44:21 -0800367}
368
Jesse Hall3fbc8562015-11-29 22:10:52 -0800369enum VkInternalAllocationType {
370 VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0x00000000,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700371}
372
373enum VkPhysicalDeviceType {
374 VK_PHYSICAL_DEVICE_TYPE_OTHER = 0x00000000,
375 VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 0x00000001,
376 VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 0x00000002,
377 VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 0x00000003,
378 VK_PHYSICAL_DEVICE_TYPE_CPU = 0x00000004,
379}
380
381enum VkVertexInputStepRate {
382 VK_VERTEX_INPUT_STEP_RATE_VERTEX = 0x00000000,
383 VK_VERTEX_INPUT_STEP_RATE_INSTANCE = 0x00000001,
384}
385
386/// Vulkan format definitions
387enum VkFormat {
388 VK_FORMAT_UNDEFINED = 0x00000000,
389 VK_FORMAT_R4G4_UNORM = 0x00000001,
390 VK_FORMAT_R4G4_USCALED = 0x00000002,
391 VK_FORMAT_R4G4B4A4_UNORM = 0x00000003,
392 VK_FORMAT_R4G4B4A4_USCALED = 0x00000004,
393 VK_FORMAT_R5G6B5_UNORM = 0x00000005,
394 VK_FORMAT_R5G6B5_USCALED = 0x00000006,
395 VK_FORMAT_R5G5B5A1_UNORM = 0x00000007,
396 VK_FORMAT_R5G5B5A1_USCALED = 0x00000008,
397 VK_FORMAT_R8_UNORM = 0x00000009,
398 VK_FORMAT_R8_SNORM = 0x0000000A,
399 VK_FORMAT_R8_USCALED = 0x0000000B,
400 VK_FORMAT_R8_SSCALED = 0x0000000C,
401 VK_FORMAT_R8_UINT = 0x0000000D,
402 VK_FORMAT_R8_SINT = 0x0000000E,
403 VK_FORMAT_R8_SRGB = 0x0000000F,
404 VK_FORMAT_R8G8_UNORM = 0x00000010,
405 VK_FORMAT_R8G8_SNORM = 0x00000011,
406 VK_FORMAT_R8G8_USCALED = 0x00000012,
407 VK_FORMAT_R8G8_SSCALED = 0x00000013,
408 VK_FORMAT_R8G8_UINT = 0x00000014,
409 VK_FORMAT_R8G8_SINT = 0x00000015,
410 VK_FORMAT_R8G8_SRGB = 0x00000016,
411 VK_FORMAT_R8G8B8_UNORM = 0x00000017,
412 VK_FORMAT_R8G8B8_SNORM = 0x00000018,
413 VK_FORMAT_R8G8B8_USCALED = 0x00000019,
414 VK_FORMAT_R8G8B8_SSCALED = 0x0000001A,
415 VK_FORMAT_R8G8B8_UINT = 0x0000001B,
416 VK_FORMAT_R8G8B8_SINT = 0x0000001C,
417 VK_FORMAT_R8G8B8_SRGB = 0x0000001D,
418 VK_FORMAT_R8G8B8A8_UNORM = 0x0000001E,
419 VK_FORMAT_R8G8B8A8_SNORM = 0x0000001F,
420 VK_FORMAT_R8G8B8A8_USCALED = 0x00000020,
421 VK_FORMAT_R8G8B8A8_SSCALED = 0x00000021,
422 VK_FORMAT_R8G8B8A8_UINT = 0x00000022,
423 VK_FORMAT_R8G8B8A8_SINT = 0x00000023,
424 VK_FORMAT_R8G8B8A8_SRGB = 0x00000024,
425 VK_FORMAT_R10G10B10A2_UNORM = 0x00000025,
426 VK_FORMAT_R10G10B10A2_SNORM = 0x00000026,
427 VK_FORMAT_R10G10B10A2_USCALED = 0x00000027,
428 VK_FORMAT_R10G10B10A2_SSCALED = 0x00000028,
429 VK_FORMAT_R10G10B10A2_UINT = 0x00000029,
430 VK_FORMAT_R10G10B10A2_SINT = 0x0000002A,
431 VK_FORMAT_R16_UNORM = 0x0000002B,
432 VK_FORMAT_R16_SNORM = 0x0000002C,
433 VK_FORMAT_R16_USCALED = 0x0000002D,
434 VK_FORMAT_R16_SSCALED = 0x0000002E,
435 VK_FORMAT_R16_UINT = 0x0000002F,
436 VK_FORMAT_R16_SINT = 0x00000030,
437 VK_FORMAT_R16_SFLOAT = 0x00000031,
438 VK_FORMAT_R16G16_UNORM = 0x00000032,
439 VK_FORMAT_R16G16_SNORM = 0x00000033,
440 VK_FORMAT_R16G16_USCALED = 0x00000034,
441 VK_FORMAT_R16G16_SSCALED = 0x00000035,
442 VK_FORMAT_R16G16_UINT = 0x00000036,
443 VK_FORMAT_R16G16_SINT = 0x00000037,
444 VK_FORMAT_R16G16_SFLOAT = 0x00000038,
445 VK_FORMAT_R16G16B16_UNORM = 0x00000039,
446 VK_FORMAT_R16G16B16_SNORM = 0x0000003A,
447 VK_FORMAT_R16G16B16_USCALED = 0x0000003B,
448 VK_FORMAT_R16G16B16_SSCALED = 0x0000003C,
449 VK_FORMAT_R16G16B16_UINT = 0x0000003D,
450 VK_FORMAT_R16G16B16_SINT = 0x0000003E,
451 VK_FORMAT_R16G16B16_SFLOAT = 0x0000003F,
452 VK_FORMAT_R16G16B16A16_UNORM = 0x00000040,
453 VK_FORMAT_R16G16B16A16_SNORM = 0x00000041,
454 VK_FORMAT_R16G16B16A16_USCALED = 0x00000042,
455 VK_FORMAT_R16G16B16A16_SSCALED = 0x00000043,
456 VK_FORMAT_R16G16B16A16_UINT = 0x00000044,
457 VK_FORMAT_R16G16B16A16_SINT = 0x00000045,
458 VK_FORMAT_R16G16B16A16_SFLOAT = 0x00000046,
459 VK_FORMAT_R32_UINT = 0x00000047,
460 VK_FORMAT_R32_SINT = 0x00000048,
461 VK_FORMAT_R32_SFLOAT = 0x00000049,
462 VK_FORMAT_R32G32_UINT = 0x0000004A,
463 VK_FORMAT_R32G32_SINT = 0x0000004B,
464 VK_FORMAT_R32G32_SFLOAT = 0x0000004C,
465 VK_FORMAT_R32G32B32_UINT = 0x0000004D,
466 VK_FORMAT_R32G32B32_SINT = 0x0000004E,
467 VK_FORMAT_R32G32B32_SFLOAT = 0x0000004F,
468 VK_FORMAT_R32G32B32A32_UINT = 0x00000050,
469 VK_FORMAT_R32G32B32A32_SINT = 0x00000051,
470 VK_FORMAT_R32G32B32A32_SFLOAT = 0x00000052,
471 VK_FORMAT_R64_SFLOAT = 0x00000053,
472 VK_FORMAT_R64G64_SFLOAT = 0x00000054,
473 VK_FORMAT_R64G64B64_SFLOAT = 0x00000055,
474 VK_FORMAT_R64G64B64A64_SFLOAT = 0x00000056,
475 VK_FORMAT_R11G11B10_UFLOAT = 0x00000057,
476 VK_FORMAT_R9G9B9E5_UFLOAT = 0x00000058,
477 VK_FORMAT_D16_UNORM = 0x00000059,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700478 VK_FORMAT_D24_UNORM_X8 = 0x0000005A,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700479 VK_FORMAT_D32_SFLOAT = 0x0000005B,
480 VK_FORMAT_S8_UINT = 0x0000005C,
481 VK_FORMAT_D16_UNORM_S8_UINT = 0x0000005D,
482 VK_FORMAT_D24_UNORM_S8_UINT = 0x0000005E,
483 VK_FORMAT_D32_SFLOAT_S8_UINT = 0x0000005F,
484 VK_FORMAT_BC1_RGB_UNORM = 0x00000060,
485 VK_FORMAT_BC1_RGB_SRGB = 0x00000061,
486 VK_FORMAT_BC1_RGBA_UNORM = 0x00000062,
487 VK_FORMAT_BC1_RGBA_SRGB = 0x00000063,
488 VK_FORMAT_BC2_UNORM = 0x00000064,
489 VK_FORMAT_BC2_SRGB = 0x00000065,
490 VK_FORMAT_BC3_UNORM = 0x00000066,
491 VK_FORMAT_BC3_SRGB = 0x00000067,
492 VK_FORMAT_BC4_UNORM = 0x00000068,
493 VK_FORMAT_BC4_SNORM = 0x00000069,
494 VK_FORMAT_BC5_UNORM = 0x0000006A,
495 VK_FORMAT_BC5_SNORM = 0x0000006B,
496 VK_FORMAT_BC6H_UFLOAT = 0x0000006C,
497 VK_FORMAT_BC6H_SFLOAT = 0x0000006D,
498 VK_FORMAT_BC7_UNORM = 0x0000006E,
499 VK_FORMAT_BC7_SRGB = 0x0000006F,
500 VK_FORMAT_ETC2_R8G8B8_UNORM = 0x00000070,
501 VK_FORMAT_ETC2_R8G8B8_SRGB = 0x00000071,
502 VK_FORMAT_ETC2_R8G8B8A1_UNORM = 0x00000072,
503 VK_FORMAT_ETC2_R8G8B8A1_SRGB = 0x00000073,
504 VK_FORMAT_ETC2_R8G8B8A8_UNORM = 0x00000074,
505 VK_FORMAT_ETC2_R8G8B8A8_SRGB = 0x00000075,
506 VK_FORMAT_EAC_R11_UNORM = 0x00000076,
507 VK_FORMAT_EAC_R11_SNORM = 0x00000077,
508 VK_FORMAT_EAC_R11G11_UNORM = 0x00000078,
509 VK_FORMAT_EAC_R11G11_SNORM = 0x00000079,
510 VK_FORMAT_ASTC_4x4_UNORM = 0x0000007A,
511 VK_FORMAT_ASTC_4x4_SRGB = 0x0000007B,
512 VK_FORMAT_ASTC_5x4_UNORM = 0x0000007C,
513 VK_FORMAT_ASTC_5x4_SRGB = 0x0000007D,
514 VK_FORMAT_ASTC_5x5_UNORM = 0x0000007E,
515 VK_FORMAT_ASTC_5x5_SRGB = 0x0000007F,
516 VK_FORMAT_ASTC_6x5_UNORM = 0x00000080,
517 VK_FORMAT_ASTC_6x5_SRGB = 0x00000081,
518 VK_FORMAT_ASTC_6x6_UNORM = 0x00000082,
519 VK_FORMAT_ASTC_6x6_SRGB = 0x00000083,
520 VK_FORMAT_ASTC_8x5_UNORM = 0x00000084,
521 VK_FORMAT_ASTC_8x5_SRGB = 0x00000085,
522 VK_FORMAT_ASTC_8x6_UNORM = 0x00000086,
523 VK_FORMAT_ASTC_8x6_SRGB = 0x00000087,
524 VK_FORMAT_ASTC_8x8_UNORM = 0x00000088,
525 VK_FORMAT_ASTC_8x8_SRGB = 0x00000089,
526 VK_FORMAT_ASTC_10x5_UNORM = 0x0000008A,
527 VK_FORMAT_ASTC_10x5_SRGB = 0x0000008B,
528 VK_FORMAT_ASTC_10x6_UNORM = 0x0000008C,
529 VK_FORMAT_ASTC_10x6_SRGB = 0x0000008D,
530 VK_FORMAT_ASTC_10x8_UNORM = 0x0000008E,
531 VK_FORMAT_ASTC_10x8_SRGB = 0x0000008F,
532 VK_FORMAT_ASTC_10x10_UNORM = 0x00000090,
533 VK_FORMAT_ASTC_10x10_SRGB = 0x00000091,
534 VK_FORMAT_ASTC_12x10_UNORM = 0x00000092,
535 VK_FORMAT_ASTC_12x10_SRGB = 0x00000093,
536 VK_FORMAT_ASTC_12x12_UNORM = 0x00000094,
537 VK_FORMAT_ASTC_12x12_SRGB = 0x00000095,
538 VK_FORMAT_B4G4R4A4_UNORM = 0x00000096,
539 VK_FORMAT_B5G5R5A1_UNORM = 0x00000097,
540 VK_FORMAT_B5G6R5_UNORM = 0x00000098,
541 VK_FORMAT_B5G6R5_USCALED = 0x00000099,
542 VK_FORMAT_B8G8R8_UNORM = 0x0000009A,
543 VK_FORMAT_B8G8R8_SNORM = 0x0000009B,
544 VK_FORMAT_B8G8R8_USCALED = 0x0000009C,
545 VK_FORMAT_B8G8R8_SSCALED = 0x0000009D,
546 VK_FORMAT_B8G8R8_UINT = 0x0000009E,
547 VK_FORMAT_B8G8R8_SINT = 0x0000009F,
548 VK_FORMAT_B8G8R8_SRGB = 0x000000A0,
549 VK_FORMAT_B8G8R8A8_UNORM = 0x000000A1,
550 VK_FORMAT_B8G8R8A8_SNORM = 0x000000A2,
551 VK_FORMAT_B8G8R8A8_USCALED = 0x000000A3,
552 VK_FORMAT_B8G8R8A8_SSCALED = 0x000000A4,
553 VK_FORMAT_B8G8R8A8_UINT = 0x000000A5,
554 VK_FORMAT_B8G8R8A8_SINT = 0x000000A6,
555 VK_FORMAT_B8G8R8A8_SRGB = 0x000000A7,
556 VK_FORMAT_B10G10R10A2_UNORM = 0x000000A8,
557 VK_FORMAT_B10G10R10A2_SNORM = 0x000000A9,
558 VK_FORMAT_B10G10R10A2_USCALED = 0x000000AA,
559 VK_FORMAT_B10G10R10A2_SSCALED = 0x000000AB,
560 VK_FORMAT_B10G10R10A2_UINT = 0x000000AC,
561 VK_FORMAT_B10G10R10A2_SINT = 0x000000AD,
562}
563
Jesse Halld27f6aa2015-08-15 17:58:48 -0700564/// Structure type enumerant
565enum VkStructureType {
566 VK_STRUCTURE_TYPE_APPLICATION_INFO = 0,
Jesse Hallc7467b72015-11-29 21:05:26 -0800567 VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1,
568 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2,
569 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3,
570 VK_STRUCTURE_TYPE_SUBMIT_INFO = 4,
571 VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO = 5,
572 VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6,
573 VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7,
574 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8,
575 VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700576 VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10,
Jesse Hallc7467b72015-11-29 21:05:26 -0800577 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11,
578 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12,
579 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13,
580 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14,
581 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15,
582 VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16,
583 VK_STRUCTURE_TYPE_SHADER_CREATE_INFO = 17,
584 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 18,
585 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 19,
586 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 20,
587 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 21,
588 VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 22,
589 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 23,
590 VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO = 24,
591 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 25,
592 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 26,
593 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 27,
594 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 28,
595 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 29,
596 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 30,
597 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 31,
598 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 32,
599 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 33,
600 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 34,
601 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO = 35,
602 VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 36,
603 VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 37,
604 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 38,
605 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 39,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800606 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 40,
607 VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOC_INFO = 41,
608 VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700609 VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43,
Jesse Hallc7467b72015-11-29 21:05:26 -0800610 VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44,
611 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45,
612 VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46,
613 VK_STRUCTURE_TYPE_LAYER_INSTANCE_CREATE_INFO = 47,
614 VK_STRUCTURE_TYPE_LAYER_DEVICE_CREATE_INFO = 48,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800615
616 //@extension("VK_EXT_KHR_swapchain")
617 VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 0xc0000801,
618
619 //@extension("VK_EXT_KHR_display")
620 VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 0xc0000c00,
Jesse Halla6429252015-11-29 18:59:42 -0800621 VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 0xc0000c01,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800622
623 //@extension("VK_EXT_KHR_display_swapchain")
624 VK_STRUCTURE_TYPE_DISPLAY_SWAPCHAIN_CREATE_INFO_KHR = 0xc0001000,
625 VK_STRUCTURE_TYPE_DISPLAY_DISPLAY_PRESENT_INFO_KHR = 0xc0001001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700626}
627
628enum VkRenderPassContents {
629 VK_RENDER_PASS_CONTENTS_INLINE = 0x00000000,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800630 VK_RENDER_PASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700631}
632
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700633@lastUnused(-8)
Jesse Halld27f6aa2015-08-15 17:58:48 -0700634/// Error and return codes
635enum VkResult {
636 // Return codes for successful operation execution (positive values)
637 VK_SUCCESS = 0x00000000,
Jesse Halla15a4bf2015-11-19 22:48:02 -0800638 VK_NOT_READY = 0x00000001,
639 VK_TIMEOUT = 0x00000002,
640 VK_EVENT_SET = 0x00000003,
641 VK_EVENT_RESET = 0x00000004,
642 VK_INCOMPLETE = 0x00000005,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700643
Jesse Hall1356b0d2015-11-23 17:24:58 -0800644 //@extension("VK_EXT_KHR_swapchain")
645 VK_SUBOPTIMAL_KHR = 0x40000403,
646
Jesse Halld27f6aa2015-08-15 17:58:48 -0700647 // Error codes (negative values)
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700648 VK_ERROR_OUT_OF_HOST_MEMORY = 0xFFFFFFFF,
649 VK_ERROR_OUT_OF_DEVICE_MEMORY = 0xFFFFFFFE,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700650 VK_ERROR_INITIALIZATION_FAILED = 0xFFFFFFFD,
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700651 VK_ERROR_DEVICE_LOST = 0xFFFFFFFC,
652 VK_ERROR_MEMORY_MAP_FAILED = 0xFFFFFFFB,
653 VK_ERROR_LAYER_NOT_PRESENT = 0xFFFFFFFA,
654 VK_ERROR_EXTENSION_NOT_PRESENT = 0xFFFFFFF9,
Jesse Hall606a54e2015-11-19 22:17:28 -0800655 VK_ERROR_FEATURE_NOT_PRESENT = 0xFFFFFFF8,
656 VK_ERROR_INCOMPATIBLE_DRIVER = 0xFFFFFFF7,
Jesse Hall1356b0d2015-11-23 17:24:58 -0800657
Jesse Halla6429252015-11-29 18:59:42 -0800658 //@extension("VK_EXT_KHR_surface")
659 VK_ERROR_SURFACE_LOST_KHR = 0xC0000400,
660
Jesse Hall1356b0d2015-11-23 17:24:58 -0800661 //@extension("VK_EXT_KHR_swapchain")
662 VK_ERROR_OUT_OF_DATE_KHR = 0xC0000804,
663
664 //@extension("VK_EXT_KHR_display_swapchain")
665 VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = 0xC0001002,
666
667 //@extension("VK_EXT_KHR_android_surface")
668 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 Hall1356b0d2015-11-23 17:24:58 -0800684@extension("VK_EXT_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
697@extension("VK_EXT_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 Hall1356b0d2015-11-23 17:24:58 -0800705@extension("VK_EXT_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
719 VK_QUEUE_DMA_BIT = 0x00000004, /// Queue supports DMA 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
739/// Memory output flags passed to resource transition commands
Jesse Halld8bade02015-11-24 10:24:18 -0800740type VkFlags VkMemoryOutputFlags
741bitfield VkMemoryOutputFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700742 VK_MEMORY_OUTPUT_HOST_WRITE_BIT = 0x00000001, /// Controls output coherency of host writes
743 VK_MEMORY_OUTPUT_SHADER_WRITE_BIT = 0x00000002, /// Controls output coherency of generic shader writes
744 VK_MEMORY_OUTPUT_COLOR_ATTACHMENT_BIT = 0x00000004, /// Controls output coherency of color attachment writes
745 VK_MEMORY_OUTPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000008, /// Controls output coherency of depth/stencil attachment writes
746 VK_MEMORY_OUTPUT_TRANSFER_BIT = 0x00000010, /// Controls output coherency of transfer operations
747}
748
749/// Memory input flags passed to resource transition commands
Jesse Halld8bade02015-11-24 10:24:18 -0800750type VkFlags VkMemoryInputFlags
751bitfield VkMemoryInputFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700752 VK_MEMORY_INPUT_HOST_READ_BIT = 0x00000001, /// Controls input coherency of host reads
753 VK_MEMORY_INPUT_INDIRECT_COMMAND_BIT = 0x00000002, /// Controls input coherency of indirect command reads
754 VK_MEMORY_INPUT_INDEX_FETCH_BIT = 0x00000004, /// Controls input coherency of index fetches
755 VK_MEMORY_INPUT_VERTEX_ATTRIBUTE_FETCH_BIT = 0x00000008, /// Controls input coherency of vertex attribute fetches
756 VK_MEMORY_INPUT_UNIFORM_READ_BIT = 0x00000010, /// Controls input coherency of uniform buffer reads
757 VK_MEMORY_INPUT_SHADER_READ_BIT = 0x00000020, /// Controls input coherency of generic shader reads
758 VK_MEMORY_INPUT_COLOR_ATTACHMENT_BIT = 0x00000040, /// Controls input coherency of color attachment reads
759 VK_MEMORY_INPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000080, /// Controls input coherency of depth/stencil attachment reads
760 VK_MEMORY_INPUT_INPUT_ATTACHMENT_BIT = 0x00000100, /// Controls input coherency of input attachment reads
761 VK_MEMORY_INPUT_TRANSFER_BIT = 0x00000200, /// Controls input coherency of transfer operations
762}
763
764/// Buffer usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800765type VkFlags VkBufferUsageFlags
766bitfield VkBufferUsageFlagBits {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800767 VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations
768 VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700769 VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, /// Can be used as TBO
770 VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, /// Can be used as IBO
771 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, /// Can be used as UBO
772 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, /// Can be used as SSBO
773 VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, /// Can be used as source of fixed function index fetch (index buffer)
774 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, /// Can be used as source of fixed function vertex fetch (VBO)
775 VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, /// Can be the source of indirect parameters (e.g. indirect buffer, parameter buffer)
776}
777
778/// Buffer creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800779type VkFlags VkBufferCreateFlags
780bitfield VkBufferCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700781 VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Buffer should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700782 VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Buffer should support sparse backing with partial residency
783 VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Buffer should support constent data access to physical memory blocks mapped into multiple locations of sparse buffers
784}
785
786/// Shader stage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800787type VkFlags VkShaderStageFlags
788bitfield VkShaderStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700789 VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
Jesse Hallae38f732015-11-19 21:32:50 -0800790 VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
791 VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700792 VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
793 VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
794 VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
Jesse Hallc7467b72015-11-29 21:05:26 -0800795 VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700796
797 VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
798}
799
Jesse Hallfbf97b02015-11-20 14:17:03 -0800800/// Descriptor pool create flags
Jesse Halld8bade02015-11-24 10:24:18 -0800801type VkFlags VkDescriptorPoolCreateFlags
802bitfield VkDescriptorPoolCreateFlagBits {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800803 VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
804}
805
806/// Descriptor pool reset flags
Jesse Halld8bade02015-11-24 10:24:18 -0800807type VkFlags VkDescriptorPoolResetFlags
Jesse Halla6429252015-11-29 18:59:42 -0800808//bitfield VkDescriptorPoolResetFlagBits {
809//}
Jesse Hallfbf97b02015-11-20 14:17:03 -0800810
Jesse Halld27f6aa2015-08-15 17:58:48 -0700811/// Image usage flags
Jesse Halld8bade02015-11-24 10:24:18 -0800812type VkFlags VkImageUsageFlags
813bitfield VkImageUsageFlagBits {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800814 VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations
815 VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700816 VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, /// Can be sampled from (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
817 VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, /// Can be used as storage image (STORAGE_IMAGE descriptor type)
818 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, /// Can be used as framebuffer color attachment
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700819 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment
Jesse Halld27f6aa2015-08-15 17:58:48 -0700820 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering
821 VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment
822}
823
824/// Image creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800825type VkFlags VkImageCreateFlags
826bitfield VkImageCreateFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700827 VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Image should support sparse backing
Jesse Halld27f6aa2015-08-15 17:58:48 -0700828 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Image should support sparse backing with partial residency
829 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 -0700830 VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, /// Allows image views to have different format than the base image
831 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 -0700832}
833
Jesse Hallb00daad2015-11-29 19:46:20 -0800834/// Image view creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800835type VkFlags VkImageViewCreateFlags
Jesse Hallb00daad2015-11-29 19:46:20 -0800836//bitfield VkImageViewCreateFlagBits {
837//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700838
839/// Pipeline creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800840type VkFlags VkPipelineCreateFlags
841bitfield VkPipelineCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700842 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
843 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
844 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
845}
846
847/// Channel flags
Jesse Halld8bade02015-11-24 10:24:18 -0800848type VkFlags VkChannelFlags
849bitfield VkChannelFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700850 VK_CHANNEL_R_BIT = 0x00000001,
851 VK_CHANNEL_G_BIT = 0x00000002,
852 VK_CHANNEL_B_BIT = 0x00000004,
853 VK_CHANNEL_A_BIT = 0x00000008,
854}
855
856/// Fence creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800857type VkFlags VkFenceCreateFlags
858bitfield VkFenceCreateFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700859 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
860}
861
862/// Semaphore creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800863type VkFlags VkSemaphoreCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800864//bitfield VkSemaphoreCreateFlagBits {
865//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700866
867/// Format capability flags
Jesse Halld8bade02015-11-24 10:24:18 -0800868type VkFlags VkFormatFeatureFlags
869bitfield VkFormatFeatureFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700870 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types)
871 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type)
872 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images
873 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs)
874 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs)
875 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers
876 VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs)
877 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images
878 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images
879 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images
Jesse Hall3fbc8562015-11-29 22:10:52 -0800880 VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCommandBlitImage
881 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 -0700882}
883
884/// Query control flags
Jesse Halld8bade02015-11-24 10:24:18 -0800885type VkFlags VkQueryControlFlags
886bitfield VkQueryControlFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700887 VK_QUERY_CONTROL_CONSERVATIVE_BIT = 0x00000001, /// Allow conservative results to be collected by the query
888}
889
890/// Query result flags
Jesse Halld8bade02015-11-24 10:24:18 -0800891type VkFlags VkQueryResultFlags
892bitfield VkQueryResultFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700893 VK_QUERY_RESULT_DEFAULT = 0x00000000, /// Results of the queries are immediately written to the destination buffer as 32-bit values
894 VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values
895 VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy
896 VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written
897 VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available
898}
899
900/// Shader module creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800901type VkFlags VkShaderModuleCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800902//bitfield VkShaderModuleCreateFlagBits {
903//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700904
905/// Shader creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800906type VkFlags VkShaderCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800907//bitfield VkShaderCreateFlagBits {
908//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700909
910/// Event creation flags
Jesse Halld8bade02015-11-24 10:24:18 -0800911type VkFlags VkEventCreateFlags
Jesse Halla6429252015-11-29 18:59:42 -0800912//bitfield VkEventCreateFlagBits {
913//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700914
Jesse Halla15a4bf2015-11-19 22:48:02 -0800915/// Command buffer usage flags
Jesse Hall3fbc8562015-11-29 22:10:52 -0800916type VkFlags VkCommandBufferUsageFlags
917bitfield VkCommandBufferUsageFlagBits {
918 VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
919 VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
920 VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700921}
922
923/// Pipeline statistics flags
Jesse Halld8bade02015-11-24 10:24:18 -0800924type VkFlags VkQueryPipelineStatisticFlags
925bitfield VkQueryPipelineStatisticFlagBits {
Jesse Hallae38f732015-11-19 21:32:50 -0800926 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, /// Optional
927 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, /// Optional
928 VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, /// Optional
929 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, /// Optional
930 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, /// Optional
931 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, /// Optional
932 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, /// Optional
933 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, /// Optional
934 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, /// Optional
935 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, /// Optional
936 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, /// Optional
Jesse Halld27f6aa2015-08-15 17:58:48 -0700937}
938
939/// Memory mapping flags
Jesse Halld8bade02015-11-24 10:24:18 -0800940type VkFlags VkMemoryMapFlags
Jesse Halla6429252015-11-29 18:59:42 -0800941//bitfield VkMemoryMapFlagBits {
942//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700943
944/// Bitfield of image aspects
Jesse Halld8bade02015-11-24 10:24:18 -0800945type VkFlags VkImageAspectFlags
946bitfield VkImageAspectFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700947 VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
948 VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
949 VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
950 VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
951}
952
953/// Sparse memory bind flags
Jesse Halld8bade02015-11-24 10:24:18 -0800954type VkFlags VkSparseMemoryBindFlags
Jesse Halld1af8122015-11-29 23:50:38 -0800955//bitfield VkSparseMemoryBindFlagBits {
956//}
Jesse Halld27f6aa2015-08-15 17:58:48 -0700957
958/// Sparse image memory requirements flags
Jesse Halld8bade02015-11-24 10:24:18 -0800959type VkFlags VkSparseImageFormatFlags
960bitfield VkSparseImageFormatFlagBits {
Jesse Hallb00daad2015-11-29 19:46:20 -0800961 VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices
962 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.
963 VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size
Jesse Halld27f6aa2015-08-15 17:58:48 -0700964}
965
966/// Pipeline stages
Jesse Halld8bade02015-11-24 10:24:18 -0800967type VkFlags VkPipelineStageFlags
968bitfield VkPipelineStageFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700969 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed
970 VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch
971 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch
972 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading
Jesse Hallae38f732015-11-19 21:32:50 -0800973 VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading
974 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading
Jesse Halld27f6aa2015-08-15 17:58:48 -0700975 VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading
976 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading
977 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests
978 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests
979 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes
980 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading
981 VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700982 VK_PIPELINE_STAGE_HOST_BIT = 0x00002000, /// Indicates host (CPU) is a source/sink of the dependency
Jesse Halld27f6aa2015-08-15 17:58:48 -0700983
984 VK_PIPELINE_STAGE_ALL_GRAPHICS = 0x000007FF, /// All stages of the graphics pipeline
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700985 VK_PIPELINE_STAGE_ALL_GPU_COMMANDS = 0x00001FFF, /// All graphics, compute, copy, and transition commands
986}
987
988/// Render pass attachment description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800989type VkFlags VkAttachmentDescriptionFlags
990bitfield VkAttachmentDescriptionFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700991 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 -0700992}
993
994/// Subpass description flags
Jesse Halld8bade02015-11-24 10:24:18 -0800995type VkFlags VkSubpassDescriptionFlags
996bitfield VkSubpassDescriptionFlagBits {
Jesse Halld27f6aa2015-08-15 17:58:48 -0700997}
998
999/// Command pool creation flags
Jesse Hall3fbc8562015-11-29 22:10:52 -08001000type VkFlags VkCommandPoolCreateFlags
1001bitfield VkCommandPoolCreateFlagBits {
1002 VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime
1003 VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually
Jesse Halld27f6aa2015-08-15 17:58:48 -07001004}
1005
1006/// Command pool reset flags
Jesse Hall3fbc8562015-11-29 22:10:52 -08001007type VkFlags VkCommandPoolResetFlags
1008bitfield VkCommandPoolResetFlagBits {
1009 VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool
Jesse Halld27f6aa2015-08-15 17:58:48 -07001010}
1011
Jesse Hall3fbc8562015-11-29 22:10:52 -08001012type VkFlags VkCommandBufferResetFlags
1013bitfield VkCommandBufferResetFlagBits {
1014 VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001015}
1016
Jesse Halld8bade02015-11-24 10:24:18 -08001017type VkFlags VkSampleCountFlags
1018bitfield VkSampleCountFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001019 VK_SAMPLE_COUNT_1_BIT = 0x00000001,
1020 VK_SAMPLE_COUNT_2_BIT = 0x00000002,
1021 VK_SAMPLE_COUNT_4_BIT = 0x00000004,
1022 VK_SAMPLE_COUNT_8_BIT = 0x00000008,
1023 VK_SAMPLE_COUNT_16_BIT = 0x00000010,
1024 VK_SAMPLE_COUNT_32_BIT = 0x00000020,
1025 VK_SAMPLE_COUNT_64_BIT = 0x00000040,
1026}
1027
Jesse Halld8bade02015-11-24 10:24:18 -08001028type VkFlags VkStencilFaceFlags
1029bitfield VkStencilFaceFlagBits {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001030 VK_STENCIL_FACE_NONE = 0x00000000, /// No faces
1031 VK_STENCIL_FACE_FRONT_BIT = 0x00000001, /// Front face
1032 VK_STENCIL_FACE_BACK_BIT = 0x00000002, /// Back face
Jesse Hallc7467b72015-11-29 21:05:26 -08001033 VK_STENCIL_FRONT_AND_BACK = 0x00000003,
Jesse Halld27f6aa2015-08-15 17:58:48 -07001034}
1035
Jesse Halla6429252015-11-29 18:59:42 -08001036/// Instance creation flags
1037type VkFlags VkInstanceCreateFlags
1038//bitfield VkInstanceCreateFlagBits {
1039//}
1040
1041/// Device creation flags
1042type VkFlags VkDeviceCreateFlags
1043//bitfield VkDeviceCreateFlagBits {
1044//}
1045
1046/// Device queue creation flags
1047type VkFlags VkDeviceQueueCreateFlags
1048//bitfield VkDeviceQueueCreateFlagBits {
1049//}
1050
1051/// Query pool creation flags
1052type VkFlags VkQueryPoolCreateFlags
1053//bitfield VkQueryPoolCreateFlagBits {
1054//}
1055
1056/// Buffer view creation flags
1057type VkFlags VkBufferViewCreateFlags
1058//bitfield VkBufferViewCreateFlagBits {
1059//}
1060
1061/// Pipeline cache creation flags
1062type VkFlags VkPipelineCacheCreateFlags
1063//bitfield VkPipelineCacheCreateFlagBits {
1064//}
1065
1066/// Pipeline shader stage creation flags
1067type VkFlags VkPipelineShaderStageCreateFlags
1068//bitfield VkPipelineShaderStageCreateFlagBits {
1069//}
1070
1071/// Descriptor set layout creation flags
1072type VkFlags VkDescriptorSetLayoutCreateFlags
1073//bitfield VkDescriptorSetLayoutCreateFlagBits {
1074//}
1075
1076/// Pipeline vertex input state creation flags
1077type VkFlags VkPipelineVertexInputStateCreateFlags
1078//bitfield VkPipelineVertexInputStateCreateFlagBits {
1079//}
1080
1081/// Pipeline input assembly state creation flags
1082type VkFlags VkPipelineInputAssemblyStateCreateFlags
1083//bitfield VkPipelineInputAssemblyStateCreateFlagBits {
1084//}
1085
1086/// Tessellation state creation flags
1087type VkFlags VkPipelineTessellationStateCreateFlags
1088//bitfield VkPipelineTessellationStateCreateFlagBits {
1089//}
1090
1091/// Viewport state creation flags
1092type VkFlags VkPipelineViewportStateCreateFlags
1093//bitfield VkPipelineViewportStateCreateFlagBits {
1094//}
1095
Jesse Hall3fbc8562015-11-29 22:10:52 -08001096/// Rasterization state creation flags
1097type VkFlags VkPipelineRasterizationStateCreateFlags
1098//bitfield VkPipelineRasterizationStateCreateFlagBits {
Jesse Halla6429252015-11-29 18:59:42 -08001099//}
1100
1101/// Multisample state creation flags
1102type VkFlags VkPipelineMultisampleStateCreateFlags
1103//bitfield VkPipelineMultisampleStateCreateFlagBits {
1104//}
1105
1106/// Color blend state creation flags
1107type VkFlags VkPipelineColorBlendStateCreateFlags
1108//bitfield VkPipelineColorBlendStateCreateFlagBits {
1109//}
1110
1111/// Depth/stencil state creation flags
1112type VkFlags VkPipelineDepthStencilStateCreateFlags
1113//bitfield VkPipelineDepthStencilStateCreateFlagBits {
1114//}
1115
1116/// Dynamic state creation flags
1117type VkFlags VkPipelineDynamicStateCreateFlags
1118//bitfield VkPipelineDynamicStateCreateFlagBits {
1119//}
1120
1121/// Pipeline layout creation flags
1122type VkFlags VkPipelineLayoutCreateFlags
1123//bitfield VkPipelineLayoutCreateFlagBits {
1124//}
1125
1126/// Sampler creation flags
1127type VkFlags VkSamplerCreateFlags
1128//bitfield VkSamplerCreateFlagBits {
1129//}
1130
1131/// Render pass creation flags
1132type VkFlags VkRenderPassCreateFlags
1133//bitfield VkRenderPassCreateFlagBits {
1134//}
1135
1136/// Framebuffer creation flags
1137type VkFlags VkFramebufferCreateFlags
1138//bitfield VkFramebufferCreateFlagBits {
1139//}
1140
Jesse Halldc6d36c2015-11-29 19:12:15 -08001141/// Dependency flags
1142type VkFlags VkDependencyFlags
1143bitfield VkDependencyFlagBits {
1144 VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
1145}
1146
Jesse Hallc7467b72015-11-29 21:05:26 -08001147/// Cull mode flags
1148type VkFlags VkCullModeFlags
1149bitfield VkCullModeFlagBits {
1150 VK_CULL_MODE_NONE = 0x00000000,
1151 VK_CULL_MODE_FRONT_BIT = 0x00000001,
1152 VK_CULL_MODE_BACK_BIT = 0x00000002,
1153 VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
1154}
1155
Michael Lentine88594d72015-11-12 12:49:45 -08001156@extension("VK_EXT_KHR_swapchain")
Jesse Halld8bade02015-11-24 10:24:18 -08001157type VkFlags VkSurfaceTransformFlagsKHR
1158@extension("VK_EXT_KHR_swapchain")
1159bitfield VkSurfaceTransformFlagBitsKHR {
Michael Lentine88594d72015-11-12 12:49:45 -08001160 VK_SURFACE_TRANSFORM_NONE_BIT_KHR = 0x00000001,
1161 VK_SURFACE_TRANSFORM_ROT90_BIT_KHR = 0x00000002,
1162 VK_SURFACE_TRANSFORM_ROT180_BIT_KHR = 0x00000004,
1163 VK_SURFACE_TRANSFORM_ROT270_BIT_KHR = 0x00000008,
1164 VK_SURFACE_TRANSFORM_HMIRROR_BIT_KHR = 0x00000010,
1165 VK_SURFACE_TRANSFORM_HMIRROR_ROT90_BIT_KHR = 0x00000020,
1166 VK_SURFACE_TRANSFORM_HMIRROR_ROT180_BIT_KHR = 0x00000040,
1167 VK_SURFACE_TRANSFORM_HMIRROR_ROT270_BIT_KHR = 0x00000080,
1168 VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
1169}
Jesse Halld27f6aa2015-08-15 17:58:48 -07001170
Jesse Halla6429252015-11-29 18:59:42 -08001171@extension("VK_EXT_KHR_swapchain")
1172type VkFlags VkCompositeAlphaFlagsKHR
1173@extension("VK_EXT_KHR_swapchain")
1174bitfield VkCompositeAlphaFlagBitsKHR {
1175 VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
1176 VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
1177 VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
1178 VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
1179}
1180
Jesse Hall1356b0d2015-11-23 17:24:58 -08001181@extension("VK_EXT_KHR_display")
Jesse Halld8bade02015-11-24 10:24:18 -08001182type VkFlags VkDisplayPlaneAlphaFlagsKHR
1183@extension("VK_EXT_KHR_display")
1184bitfield VkDisplayPlaneAlphaFlagBitsKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08001185 VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000001,
1186 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000002,
1187 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000004,
1188}
1189
1190
Jesse Halld27f6aa2015-08-15 17:58:48 -07001191//////////////////
1192// Structures //
1193//////////////////
1194
1195class VkOffset2D {
1196 s32 x
1197 s32 y
1198}
1199
1200class VkOffset3D {
1201 s32 x
1202 s32 y
1203 s32 z
1204}
1205
1206class VkExtent2D {
1207 s32 width
1208 s32 height
1209}
1210
1211class VkExtent3D {
1212 s32 width
1213 s32 height
1214 s32 depth
1215}
1216
1217class VkViewport {
1218 f32 originX
1219 f32 originY
1220 f32 width
1221 f32 height
1222 f32 minDepth
1223 f32 maxDepth
1224}
1225
1226class VkRect2D {
1227 VkOffset2D offset
1228 VkExtent2D extent
1229}
1230
Jesse Halla15a4bf2015-11-19 22:48:02 -08001231class VkClearRect {
1232 VkRect2D rect
1233 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001234 u32 layerCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001235}
1236
1237class VkChannelMapping {
1238 VkChannelSwizzle r
1239 VkChannelSwizzle g
1240 VkChannelSwizzle b
1241 VkChannelSwizzle a
1242}
1243
1244class VkPhysicalDeviceProperties {
1245 u32 apiVersion
1246 u32 driverVersion
1247 u32 vendorId
1248 u32 deviceId
1249 VkPhysicalDeviceType deviceType
1250 char[VK_MAX_PHYSICAL_DEVICE_NAME] deviceName
1251 u8[VK_UUID_LENGTH] pipelineCacheUUID
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001252 VkPhysicalDeviceLimits limits
1253 VkPhysicalDeviceSparseProperties sparseProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001254}
1255
1256class VkExtensionProperties {
Jesse Hall3fbc8562015-11-29 22:10:52 -08001257 char[VK_MAX_EXTENSION_NAME] extensionName /// extension name
Jesse Halld27f6aa2015-08-15 17:58:48 -07001258 u32 specVersion /// version of the extension specification implemented
1259}
1260
1261class VkLayerProperties {
Jesse Hall3fbc8562015-11-29 22:10:52 -08001262 char[VK_MAX_EXTENSION_NAME] layerName /// layer name
1263 u32 specVersion /// version of the layer specification implemented
1264 u32 implementationVersion /// build or release version of the layer's library
1265 char[VK_MAX_DESCRIPTION] description /// Free-form description of the layer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001266}
1267
Jesse Halla366a512015-11-19 22:30:07 -08001268class VkSubmitInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001269 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_SUBMIT_INFO
1270 const void* pNext /// Next structure in chain
1271 u32 waitSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001272 const VkSemaphore* pWaitSemaphores
Jesse Hall03b6fe12015-11-24 12:44:21 -08001273 u32 commandBufferCount
Jesse Hall3fbc8562015-11-29 22:10:52 -08001274 const VkCommandBuffer* pCommandBuffers
Jesse Hall03b6fe12015-11-24 12:44:21 -08001275 u32 signalSemaphoreCount
Jesse Halla366a512015-11-19 22:30:07 -08001276 const VkSemaphore* pSignalSemaphores
1277}
1278
Jesse Halld27f6aa2015-08-15 17:58:48 -07001279class VkApplicationInfo {
1280 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO
1281 const void* pNext /// Next structure in chain
Jesse Hall3fbc8562015-11-29 22:10:52 -08001282 const char* pApplicationName
1283 u32 applicationVersion
Jesse Halld27f6aa2015-08-15 17:58:48 -07001284 const char* pEngineName
1285 u32 engineVersion
1286 u32 apiVersion
1287}
1288
Jesse Hall3fbc8562015-11-29 22:10:52 -08001289class VkAllocationCallbacks {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001290 void* pUserData
Jesse Hall3fbc8562015-11-29 22:10:52 -08001291 PFN_vkAllocationFunction pfnAllocation
1292 PFN_vkReallocationFunction pfnReallocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001293 PFN_vkFreeFunction pfnFree
Jesse Hall3fbc8562015-11-29 22:10:52 -08001294 PFN_vkInternalAllocationNotification pfnInternalAllocation
Jesse Hall03b6fe12015-11-24 12:44:21 -08001295 PFN_vkInternalFreeNotification pfnInternalFree
Jesse Halld27f6aa2015-08-15 17:58:48 -07001296}
1297
1298class VkDeviceQueueCreateInfo {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001299 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO
1300 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001301 VkDeviceQueueCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001302 u32 queueFamilyIndex
Jesse Hall03b6fe12015-11-24 12:44:21 -08001303 u32 queuePriorityCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001304 const f32* pQueuePriorities
Jesse Halld27f6aa2015-08-15 17:58:48 -07001305}
1306
1307class VkDeviceCreateInfo {
1308 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO
1309 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001310 VkDeviceCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001311 u32 requestedQueueRecordCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001312 const VkDeviceQueueCreateInfo* pRequestedQueues
Jesse Hall03b6fe12015-11-24 12:44:21 -08001313 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001314 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001315 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001316 const char* const* ppEnabledExtensionNames
1317 const VkPhysicalDeviceFeatures* pEnabledFeatures
Jesse Halld27f6aa2015-08-15 17:58:48 -07001318}
1319
1320class VkInstanceCreateInfo {
1321 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
1322 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001323 VkInstanceCreateFlags flags
Jesse Hall3fbc8562015-11-29 22:10:52 -08001324 const VkApplicationInfo* pApplicationInfo
Jesse Hall03b6fe12015-11-24 12:44:21 -08001325 u32 enabledLayerNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001326 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled
Jesse Hall03b6fe12015-11-24 12:44:21 -08001327 u32 enabledExtensionNameCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001328 const char* const* ppEnabledExtensionNames /// Extension names to be enabled
1329}
1330
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001331class VkQueueFamilyProperties {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001332 VkQueueFlags queueFlags /// Queue flags
1333 u32 queueCount
Jesse Hallacfa5342015-11-19 21:51:33 -08001334 u32 timestampValidBits
Jesse Halld27f6aa2015-08-15 17:58:48 -07001335}
1336
1337class VkPhysicalDeviceMemoryProperties {
1338 u32 memoryTypeCount
1339 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes
1340 u32 memoryHeapCount
1341 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps
1342}
1343
Jesse Hall3fbc8562015-11-29 22:10:52 -08001344class VkMemoryAllocateInfo {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001345 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO
1346 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001347 VkDeviceSize allocationSize /// Size of memory allocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001348 u32 memoryTypeIndex /// Index of the of the memory type to allocate from
1349}
1350
1351class VkMemoryRequirements {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001352 VkDeviceSize size /// Specified in bytes
1353 VkDeviceSize alignment /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001354 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object
1355}
1356
1357class VkSparseImageFormatProperties {
Jesse Halld8bade02015-11-24 10:24:18 -08001358 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001359 VkExtent3D imageGranularity
1360 VkSparseImageFormatFlags flags
1361}
1362
1363class VkSparseImageMemoryRequirements {
Jesse Hallb00daad2015-11-29 19:46:20 -08001364 VkSparseImageFormatProperties formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07001365 u32 imageMipTailStartLOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001366 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment
1367 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment
1368 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07001369}
1370
1371class VkMemoryType {
1372 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type
1373 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from
1374}
1375
1376class VkMemoryHeap {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001377 VkDeviceSize size /// Available memory in the heap
Jesse Halld27f6aa2015-08-15 17:58:48 -07001378 VkMemoryHeapFlags flags /// Flags for the heap
1379}
1380
1381class VkMappedMemoryRange {
1382 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
1383 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001384 VkDeviceMemory memory /// Mapped memory object
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001385 VkDeviceSize offset /// Offset within the mapped memory the range starts from
1386 VkDeviceSize size /// Size of the range within the mapped memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07001387}
1388
1389class VkFormatProperties {
1390 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling
1391 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001392 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001393}
1394
1395class VkImageFormatProperties {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001396 VkExtent3D maxExtent /// max image dimensions for this resource type
1397 u32 maxMipLevels /// max number of mipmap levels for this resource type
Jesse Halla15a4bf2015-11-19 22:48:02 -08001398 u32 maxArrayLayers /// max array layers for this resource type
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001399 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type
1400 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type
1401}
1402
Jesse Halla15a4bf2015-11-19 22:48:02 -08001403class VkDescriptorImageInfo {
1404 VkSampler sampler
1405 VkImageView imageView
1406 VkImageLayout imageLayout
1407}
1408
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001409class VkDescriptorBufferInfo {
1410 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC]
1411 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set.
1412 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001413}
1414
Jesse Halld27f6aa2015-08-15 17:58:48 -07001415class VkWriteDescriptorSet {
1416 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
1417 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001418 VkDescriptorSet dstSet /// Destination descriptor set
1419 u32 dstBinding /// Binding within the destination descriptor set to write
1420 u32 dstArrayElement /// Array element within the destination binding to write
Jesse Hall03b6fe12015-11-24 12:44:21 -08001421 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001422 VkDescriptorType descriptorType /// Descriptor type to write (determines which fields of the array pointed by <pDescriptors> are going to be used)
Jesse Hallfbf97b02015-11-20 14:17:03 -08001423 const VkDescriptorImageInfo* pImageInfo
1424 const VkDescriptorBufferInfo* pBufferInfo
1425 const VkBufferView* pTexelBufferView
Jesse Halld27f6aa2015-08-15 17:58:48 -07001426}
1427
1428class VkCopyDescriptorSet {
1429 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
1430 const void* pNext /// Pointer to next structure
1431 VkDescriptorSet srcSet /// Source descriptor set
1432 u32 srcBinding /// Binding within the source descriptor set to copy from
1433 u32 srcArrayElement /// Array element within the source binding to copy from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001434 VkDescriptorSet dstSet /// Destination descriptor set
1435 u32 dstBinding /// Binding within the destination descriptor set to copy to
1436 u32 dstArrayElement /// Array element within the destination binding to copy to
Jesse Hall03b6fe12015-11-24 12:44:21 -08001437 u32 descriptorCount /// Number of descriptors to copy
Jesse Halld27f6aa2015-08-15 17:58:48 -07001438}
1439
1440class VkBufferCreateInfo {
1441 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
1442 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001443 VkBufferCreateFlags flags /// Buffer creation flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001444 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001445 VkBufferUsageFlags usage /// Buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001446 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001447 u32 queueFamilyIndexCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001448 const u32* pQueueFamilyIndices
1449}
1450
1451class VkBufferViewCreateInfo {
1452 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
1453 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001454 VkBufferViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001455 VkBuffer buffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001456 VkFormat format /// Optionally specifies format of elements
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001457 VkDeviceSize offset /// Specified in bytes
1458 VkDeviceSize range /// View size specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001459}
1460
1461class VkImageSubresource {
Jesse Halld8bade02015-11-24 10:24:18 -08001462 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001463 u32 mipLevel
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001464 u32 arrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001465}
1466
1467class VkImageSubresourceRange {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001468 VkImageAspectFlags aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001469 u32 baseMipLevel
Jesse Hall3fbc8562015-11-29 22:10:52 -08001470 u32 levelCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001471 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001472 u32 layerCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001473}
1474
1475class VkMemoryBarrier {
1476 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER
1477 const void* pNext /// Pointer to next structure.
1478 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1479 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1480}
1481
1482class VkBufferMemoryBarrier {
1483 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
1484 const void* pNext /// Pointer to next structure.
1485 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1486 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1487 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001488 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001489 VkBuffer buffer /// Buffer to sync
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001490 VkDeviceSize offset /// Offset within the buffer to sync
1491 VkDeviceSize size /// Amount of bytes to sync
Jesse Halld27f6aa2015-08-15 17:58:48 -07001492}
1493
1494class VkImageMemoryBarrier {
1495 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
1496 const void* pNext /// Pointer to next structure.
1497 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1498 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1499 VkImageLayout oldLayout /// Current layout of the image
1500 VkImageLayout newLayout /// New layout to transition the image to
1501 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001502 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001503 VkImage image /// Image to sync
1504 VkImageSubresourceRange subresourceRange /// Subresource range to sync
1505}
1506
1507class VkImageCreateInfo {
1508 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
1509 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001510 VkImageCreateFlags flags /// Image creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001511 VkImageType imageType
1512 VkFormat format
1513 VkExtent3D extent
1514 u32 mipLevels
Jesse Halla15a4bf2015-11-19 22:48:02 -08001515 u32 arrayLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001516 u32 samples
1517 VkImageTiling tiling
1518 VkImageUsageFlags usage /// Image usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001519 VkSharingMode sharingMode /// Cross-queue-family sharing mode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001520 u32 queueFamilyIndexCount /// Number of queue families to share across
Jesse Halld27f6aa2015-08-15 17:58:48 -07001521 const u32* pQueueFamilyIndices /// Array of queue family indices to share across
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001522 VkImageLayout initialLayout /// Initial image layout for all subresources
Jesse Halld27f6aa2015-08-15 17:58:48 -07001523}
1524
1525class VkSubresourceLayout {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001526 VkDeviceSize offset /// Specified in bytes
1527 VkDeviceSize size /// Specified in bytes
1528 VkDeviceSize rowPitch /// Specified in bytes
1529 VkDeviceSize depthPitch /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001530}
1531
1532class VkImageViewCreateInfo {
1533 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
1534 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001535 VkImageViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001536 VkImage image
1537 VkImageViewType viewType
1538 VkFormat format
1539 VkChannelMapping channels
1540 VkImageSubresourceRange subresourceRange
Jesse Halld27f6aa2015-08-15 17:58:48 -07001541}
1542
1543class VkBufferCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001544 VkDeviceSize srcOffset /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001545 VkDeviceSize dstOffset /// Specified in bytes
Jesse Hallb00daad2015-11-29 19:46:20 -08001546 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001547}
1548
Jesse Halla6429252015-11-29 18:59:42 -08001549class VkSparseMemoryBind {
Jesse Hallb00daad2015-11-29 19:46:20 -08001550 VkDeviceSize resourceOffset /// Specified in bytes
1551 VkDeviceSize size /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001552 VkDeviceMemory memory
1553 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001554 VkSparseMemoryBindFlags flags
1555}
1556
Jesse Halla6429252015-11-29 18:59:42 -08001557class VkSparseImageMemoryBind {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001558 VkImageSubresource subresource
1559 VkOffset3D offset
1560 VkExtent3D extent
Jesse Hall3fbc8562015-11-29 22:10:52 -08001561 VkDeviceMemory memory
1562 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001563 VkSparseMemoryBindFlags flags
1564}
1565
Jesse Halla6429252015-11-29 18:59:42 -08001566class VkSparseBufferMemoryBindInfo {
1567 VkBuffer buffer
1568 u32 bindCount
1569 const VkSparseMemoryBind* pBinds
1570}
1571
1572class VkSparseImageOpaqueMemoryBindInfo {
1573 VkImage image
1574 u32 bindCount
1575 const VkSparseMemoryBind* pBinds
1576}
1577
1578class VkSparseImageMemoryBindInfo {
1579 VkImage image
1580 u32 bindCount
1581 const VkSparseMemoryBind* pBinds
1582}
1583
1584class VkBindSparseInfo {
1585 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
1586 const void* pNext
1587 u32 waitSemaphoreCount
1588 const VkSemaphore* pWaitSemaphores
1589 u32 numBufferBinds
1590 const VkSparseBufferMemoryBindInfo* pBufferBinds
1591 u32 numImageOpaqueBinds
1592 const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds
1593 u32 numImageBinds
1594 const VkSparseImageMemoryBindInfo* pImageBinds
1595 u32 signalSemaphoreCount
1596 const VkSemaphore* pSignalSemaphores
1597}
1598
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001599class VkImageSubresourceCopy {
Jesse Halla15a4bf2015-11-19 22:48:02 -08001600 VkImageAspectFlags aspect
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001601 u32 mipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001602 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001603 u32 layerCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001604}
1605
Jesse Halld27f6aa2015-08-15 17:58:48 -07001606class VkImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001607 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001608 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Hall3fbc8562015-11-29 22:10:52 -08001609 VkImageSubresourceCopy dstSubresource
1610 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001611 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images
1612}
1613
1614class VkImageBlit {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001615 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001616 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
1617 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Hall3fbc8562015-11-29 22:10:52 -08001618 VkImageSubresourceCopy dstSubresource
1619 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
1620 VkExtent3D dstExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001621}
1622
1623class VkBufferImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001624 VkDeviceSize bufferOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001625 u32 bufferRowLength /// Specified in texels
1626 u32 bufferImageHeight
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001627 VkImageSubresourceCopy imageSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001628 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images
1629 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images
1630}
1631
1632class VkImageResolve {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001633 VkImageSubresourceCopy srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001634 VkOffset3D srcOffset
Jesse Hall3fbc8562015-11-29 22:10:52 -08001635 VkImageSubresourceCopy dstSubresource
1636 VkOffset3D dstOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07001637 VkExtent3D extent
1638}
1639
1640class VkShaderModuleCreateInfo {
1641 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
1642 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001643 VkShaderModuleCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001644 platform.size_t codeSize /// Specified in bytes
Jesse Halla9bb62b2015-11-21 19:31:56 -08001645 const u32* pCode /// Binary code of size codeSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07001646}
1647
1648class VkShaderCreateInfo {
1649 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
1650 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001651 VkShaderCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001652 VkShaderModule module /// Module containing entry point
1653 const char* pName /// Null-terminated entry point name
Jesse Halld8bade02015-11-24 10:24:18 -08001654 VkShaderStageFlagBits stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001655}
1656
1657class VkDescriptorSetLayoutBinding {
1658 VkDescriptorType descriptorType /// Type of the descriptors in this binding
1659 u32 arraySize /// Number of descriptors in this binding
1660 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to
1661 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements)
1662}
1663
1664class VkDescriptorSetLayoutCreateInfo {
1665 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
1666 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001667 VkDescriptorSetLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001668 u32 bindingCount /// Number of bindings in the descriptor set layout
1669 const VkDescriptorSetLayoutBinding* pBindings /// Array of descriptor set layout bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001670}
1671
1672class VkDescriptorTypeCount {
1673 VkDescriptorType type
Jesse Hall03b6fe12015-11-24 12:44:21 -08001674 u32 descriptorCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001675}
1676
1677class VkDescriptorPoolCreateInfo {
1678 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
1679 const void* pNext /// Pointer to next structure
Jesse Hallfbf97b02015-11-20 14:17:03 -08001680 VkDescriptorPoolCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001681 u32 maxSets
Jesse Hall03b6fe12015-11-24 12:44:21 -08001682 u32 typeCount
1683 const VkDescriptorTypeCount* pTypeCounts
Jesse Halld27f6aa2015-08-15 17:58:48 -07001684}
1685
Jesse Hall3fbc8562015-11-29 22:10:52 -08001686class VkDescriptorSetAllocateInfo {
Jesse Hallfbf97b02015-11-20 14:17:03 -08001687 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO
1688 const void* pNext /// Pointer to next structure
1689 VkDescriptorPool descriptorPool
Jesse Hall03b6fe12015-11-24 12:44:21 -08001690 u32 setCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001691 const VkDescriptorSetLayout* pSetLayouts
1692}
1693
Jesse Halld27f6aa2015-08-15 17:58:48 -07001694class VkSpecializationMapEntry {
1695 u32 constantId /// The SpecConstant ID specified in the BIL
Jesse Halld27f6aa2015-08-15 17:58:48 -07001696 u32 offset /// Offset of the value in the data block
Jesse Hallb00daad2015-11-29 19:46:20 -08001697 platform.size_t size /// Size in bytes of the SpecConstant
Jesse Halld27f6aa2015-08-15 17:58:48 -07001698}
1699
1700class VkSpecializationInfo {
1701 u32 mapEntryCount /// Number of entries in the map
Jesse Hallb00daad2015-11-29 19:46:20 -08001702 const VkSpecializationMapEntry* pMapEntries /// Array of map entries
Jesse Halld27f6aa2015-08-15 17:58:48 -07001703 platform.size_t dataSize /// Size in bytes of pData
1704 const void* pData /// Pointer to SpecConstant data
1705}
1706
1707class VkPipelineShaderStageCreateInfo {
1708 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
1709 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001710 VkPipelineShaderStageCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001711 VkShader shader
1712 const VkSpecializationInfo* pSpecializationInfo
1713}
1714
1715class VkComputePipelineCreateInfo {
1716 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
1717 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001718 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001719 VkPipelineShaderStageCreateInfo stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001720 VkPipelineLayout layout /// Interface layout of the pipeline
1721 VkPipeline basePipelineHandle /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of
1722 s32 basePipelineIndex /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of
1723}
1724
1725class VkVertexInputBindingDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001726 u32 binding /// Vertex buffer binding id
1727 u32 stride /// Distance between vertices in bytes (0 = no advancement)
1728 VkVertexInputStepRate stepRate /// Rate at which binding is incremented
Jesse Halld27f6aa2015-08-15 17:58:48 -07001729}
1730
1731class VkVertexInputAttributeDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001732 u32 location /// location of the shader vertex attrib
1733 u32 binding /// Vertex buffer binding id
1734 VkFormat format /// format of source data
1735 u32 offset /// Offset of first element in bytes from base of vertex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001736}
1737
1738class VkPipelineVertexInputStateCreateInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001739 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
1740 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001741 VkPipelineVertexInputStateCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001742 u32 vertexBindingDescriptionCount /// number of bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001743 const VkVertexInputBindingDescription* pVertexBindingDescriptions
Jesse Hall03b6fe12015-11-24 12:44:21 -08001744 u32 vertexAttributeDescriptionCount /// number of attributes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001745 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
1746}
1747
1748class VkPipelineInputAssemblyStateCreateInfo {
1749 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
1750 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001751 VkPipelineInputAssemblyStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001752 VkPrimitiveTopology topology
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001753 VkBool32 primitiveRestartEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001754}
1755
1756class VkPipelineTessellationStateCreateInfo {
1757 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
1758 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001759 VkPipelineTessellationStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001760 u32 patchControlPoints
1761}
1762
1763class VkPipelineViewportStateCreateInfo {
1764 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
1765 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001766 VkPipelineViewportStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001767 u32 viewportCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001768 const VkViewport* pViewports
1769 u32 scissorCount
1770 const VkRect2D* pScissors
Jesse Halld27f6aa2015-08-15 17:58:48 -07001771}
1772
Jesse Hall3fbc8562015-11-29 22:10:52 -08001773class VkPipelineRasterizationStateCreateInfo {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001774 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO
1775 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001776 VkPipelineRasterizationStateCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001777 VkBool32 depthClampEnable
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001778 VkBool32 rasterizerDiscardEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001779 VkFillMode fillMode /// optional (GL45)
Jesse Hallc7467b72015-11-29 21:05:26 -08001780 VkCullModeFlags cullMode
Jesse Halld27f6aa2015-08-15 17:58:48 -07001781 VkFrontFace frontFace
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001782 VkBool32 depthBiasEnable
Jesse Halla9bb62b2015-11-21 19:31:56 -08001783 f32 depthBiasConstantFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001784 f32 depthBiasClamp
Jesse Halla9bb62b2015-11-21 19:31:56 -08001785 f32 depthBiasSlopeFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001786 f32 lineWidth
Jesse Halld27f6aa2015-08-15 17:58:48 -07001787}
1788
1789class VkPipelineMultisampleStateCreateInfo {
1790 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
1791 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001792 VkPipelineMultisampleStateCreateFlags flags
Jesse Hall3fbc8562015-11-29 22:10:52 -08001793 u32 rasterizationSamples /// Number of samples used for rasterization
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001794 VkBool32 sampleShadingEnable /// optional (GL45)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001795 f32 minSampleShading /// optional (GL45)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001796 const VkSampleMask* pSampleMask
Jesse Hallacfa5342015-11-19 21:51:33 -08001797 VkBool32 alphaToCoverageEnable
1798 VkBool32 alphaToOneEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001799}
1800
1801class VkPipelineColorBlendAttachmentState {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001802 VkBool32 blendEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001803 VkBlend srcBlendColor
Jesse Hall3fbc8562015-11-29 22:10:52 -08001804 VkBlend dstBlendColor
Jesse Halld27f6aa2015-08-15 17:58:48 -07001805 VkBlendOp blendOpColor
1806 VkBlend srcBlendAlpha
Jesse Hall3fbc8562015-11-29 22:10:52 -08001807 VkBlend dstBlendAlpha
Jesse Halld27f6aa2015-08-15 17:58:48 -07001808 VkBlendOp blendOpAlpha
1809 VkChannelFlags channelWriteMask
1810}
1811
1812class VkPipelineColorBlendStateCreateInfo {
1813 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
1814 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001815 VkPipelineColorBlendStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001816 VkBool32 logicOpEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001817 VkLogicOp logicOp
1818 u32 attachmentCount /// # of pAttachments
1819 const VkPipelineColorBlendAttachmentState* pAttachments
Jesse Hallb00daad2015-11-29 19:46:20 -08001820 f32[4] blendConstants
Jesse Halld27f6aa2015-08-15 17:58:48 -07001821}
1822
1823class VkStencilOpState {
1824 VkStencilOp stencilFailOp
1825 VkStencilOp stencilPassOp
1826 VkStencilOp stencilDepthFailOp
1827 VkCompareOp stencilCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001828 u32 stencilCompareMask
1829 u32 stencilWriteMask
1830 u32 stencilReference
Jesse Halld27f6aa2015-08-15 17:58:48 -07001831}
1832
1833class VkPipelineDepthStencilStateCreateInfo {
1834 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
1835 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001836 VkPipelineDepthStencilStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001837 VkBool32 depthTestEnable
1838 VkBool32 depthWriteEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001839 VkCompareOp depthCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001840 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test)
1841 VkBool32 stencilTestEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001842 VkStencilOpState front
1843 VkStencilOpState back
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001844 f32 minDepthBounds
1845 f32 maxDepthBounds
1846}
1847
1848class VkPipelineDynamicStateCreateInfo {
1849 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
1850 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001851 VkPipelineDynamicStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001852 u32 dynamicStateCount
1853 const VkDynamicState* pDynamicStates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001854}
1855
1856class VkGraphicsPipelineCreateInfo {
Jesse Halla6429252015-11-29 18:59:42 -08001857 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
1858 const void* pNext /// Pointer to next structure
1859 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001860 u32 stageCount
Jesse Halla6429252015-11-29 18:59:42 -08001861 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001862 const VkPipelineVertexInputStateCreateInfo* pVertexInputState
1863 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
1864 const VkPipelineTessellationStateCreateInfo* pTessellationState
1865 const VkPipelineViewportStateCreateInfo* pViewportState
Jesse Hall3fbc8562015-11-29 22:10:52 -08001866 const VkPipelineRasterizationStateCreateInfo* pRasterizationState
Jesse Halld27f6aa2015-08-15 17:58:48 -07001867 const VkPipelineMultisampleStateCreateInfo* pMultisampleState
1868 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState
1869 const VkPipelineColorBlendStateCreateInfo* pColorBlendState
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001870 const VkPipelineDynamicStateCreateInfo* pDynamicState
Jesse Halla6429252015-11-29 18:59:42 -08001871 VkPipelineLayout layout /// Interface layout of the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001872 VkRenderPass renderPass
1873 u32 subpass
Jesse Halla6429252015-11-29 18:59:42 -08001874 VkPipeline basePipelineHandle /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of
1875 s32 basePipelineIndex /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of
Jesse Halld27f6aa2015-08-15 17:58:48 -07001876}
1877
1878class VkPipelineCacheCreateInfo {
Jesse Hallb00daad2015-11-29 19:46:20 -08001879 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
1880 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001881 VkPipelineCacheCreateFlags flags
Jesse Hallb00daad2015-11-29 19:46:20 -08001882 platform.size_t initialDataSize /// Size of initial data to populate cache, in bytes
1883 const void* pInitialData /// Initial data to populate cache
Jesse Halld27f6aa2015-08-15 17:58:48 -07001884}
1885
1886class VkPushConstantRange {
1887 VkShaderStageFlags stageFlags /// Which stages use the range
Jesse Hall03b6fe12015-11-24 12:44:21 -08001888 u32 offset /// Start of the range, in bytes
1889 u32 size /// Length of the range, in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001890}
1891
1892class VkPipelineLayoutCreateInfo {
1893 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
1894 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001895 VkPipelineLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001896 u32 setLayoutCount /// Number of descriptor sets interfaced by the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001897 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the
1898 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline
1899 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages
1900}
1901
1902class VkSamplerCreateInfo {
1903 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
1904 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001905 VkSamplerCreateFlags flags
Jesse Hall23ff73f2015-11-29 14:36:39 -08001906 VkFilter magFilter /// Filter mode for magnification
1907 VkFilter minFilter /// Filter mode for minifiation
1908 VkSamplerMipmapMode mipmapMode /// Mipmap selection mode
1909 VkSamplerAddressMode addressModeU
1910 VkSamplerAddressMode addressModeV
1911 VkSamplerAddressMode addressModeW
Jesse Halld27f6aa2015-08-15 17:58:48 -07001912 f32 mipLodBias
1913 f32 maxAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001914 VkBool32 compareEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001915 VkCompareOp compareOp
1916 f32 minLod
1917 f32 maxLod
1918 VkBorderColor borderColor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001919 VkBool32 unnormalizedCoordinates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001920}
1921
Jesse Hall3fbc8562015-11-29 22:10:52 -08001922class VkCommandPoolCreateInfo {
1923 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001924 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001925 VkCommandPoolCreateFlags flags /// Command pool creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001926 u32 queueFamilyIndex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001927}
1928
Jesse Hall3fbc8562015-11-29 22:10:52 -08001929class VkCommandBufferAllocateInfo {
1930 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOC_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001931 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001932 VkCommandPool commandPool
1933 VkCommandBufferLevel level
Jesse Hall03b6fe12015-11-24 12:44:21 -08001934 u32 bufferCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001935}
1936
Jesse Hall3fbc8562015-11-29 22:10:52 -08001937class VkCommandBufferBeginInfo {
1938 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001939 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001940 VkCommandBufferUsageFlags flags /// Command buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001941 VkRenderPass renderPass /// Render pass for secondary command buffers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001942 u32 subpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07001943 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers
1944}
1945
1946class VkRenderPassBeginInfo {
1947 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
1948 const void* pNext /// Pointer to next structure
1949 VkRenderPass renderPass
1950 VkFramebuffer framebuffer
1951 VkRect2D renderArea
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001952 u32 clearValueCount
1953 const VkClearValue* pClearValues
Jesse Halld27f6aa2015-08-15 17:58:48 -07001954}
1955
1956@union
1957/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared.
1958class VkClearColorValue {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001959 f32[4] float32
1960 s32[4] int32
1961 u32[4] uint32
Jesse Halld27f6aa2015-08-15 17:58:48 -07001962}
1963
1964class VkClearDepthStencilValue {
1965 f32 depth
1966 u32 stencil
1967}
1968
1969@union
1970/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared.
1971class VkClearValue {
1972 VkClearColorValue color
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001973 VkClearDepthStencilValue depthStencil
Jesse Halld27f6aa2015-08-15 17:58:48 -07001974}
1975
Jesse Hallae38f732015-11-19 21:32:50 -08001976class VkClearAttachment {
1977 VkImageAspectFlags aspectMask
1978 u32 colorAttachment
1979 VkClearValue clearValue
1980}
1981
Jesse Halld27f6aa2015-08-15 17:58:48 -07001982class VkAttachmentDescription {
Jesse Halla6429252015-11-29 18:59:42 -08001983 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001984 VkFormat format
1985 u32 samples
1986 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1987 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1988 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1989 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1990 VkImageLayout initialLayout
1991 VkImageLayout finalLayout
1992}
1993
1994class VkAttachmentReference {
1995 u32 attachment
1996 VkImageLayout layout
1997}
1998
1999class VkSubpassDescription {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002000 VkSubpassDescriptionFlags flags
Jesse Halla6429252015-11-29 18:59:42 -08002001 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
Jesse Hall03b6fe12015-11-24 12:44:21 -08002002 u32 inputAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002003 const VkAttachmentReference* pInputAttachments
Jesse Hall03b6fe12015-11-24 12:44:21 -08002004 u32 colorAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002005 const VkAttachmentReference* pColorAttachments
2006 const VkAttachmentReference* pResolveAttachments
Jesse Hallc7467b72015-11-29 21:05:26 -08002007 const VkAttachmentReference* pDepthStencilAttachment
Jesse Hall03b6fe12015-11-24 12:44:21 -08002008 u32 preserveAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002009 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002010}
2011
2012class VkSubpassDependency {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002013 u32 srcSubpass
Jesse Hall3fbc8562015-11-29 22:10:52 -08002014 u32 dstSubpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07002015 VkPipelineStageFlags srcStageMask
Jesse Hall3fbc8562015-11-29 22:10:52 -08002016 VkPipelineStageFlags dstStageMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07002017 VkMemoryOutputFlags outputMask
2018 VkMemoryInputFlags inputMask
Jesse Halldc6d36c2015-11-29 19:12:15 -08002019 VkDependencyFlags dependencyFlags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002020}
2021
2022class VkRenderPassCreateInfo {
2023 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
2024 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002025 VkRenderPassCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002026 u32 attachmentCount
2027 const VkAttachmentDescription* pAttachments
2028 u32 subpassCount
2029 const VkSubpassDescription* pSubpasses
2030 u32 dependencyCount
2031 const VkSubpassDependency* pDependencies
2032}
2033
2034class VkEventCreateInfo {
2035 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
2036 const void* pNext /// Pointer to next structure
2037 VkEventCreateFlags flags /// Event creation flags
2038}
2039
2040class VkFenceCreateInfo {
2041 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
2042 const void* pNext /// Pointer to next structure
2043 VkFenceCreateFlags flags /// Fence creation flags
2044}
2045
2046class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002047 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
2048 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
2049 VkBool32 imageCubeArray /// image views which are arrays of cube maps
2050 VkBool32 independentBlend /// blending operations are controlled per-attachment
2051 VkBool32 geometryShader /// geometry stage
2052 VkBool32 tessellationShader /// tessellation control and evaluation stage
2053 VkBool32 sampleRateShading /// per-sample shading and interpolation
Jesse Hall3fbc8562015-11-29 22:10:52 -08002054 VkBool32 dualSrcBlend /// blend operations which take two sources
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002055 VkBool32 logicOp /// logic operations
2056 VkBool32 multiDrawIndirect /// multi draw indirect
Jesse Hallae38f732015-11-19 21:32:50 -08002057 VkBool32 depthClamp /// depth clamping
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002058 VkBool32 depthBiasClamp /// depth bias clamping
2059 VkBool32 fillModeNonSolid /// point and wireframe fill modes
2060 VkBool32 depthBounds /// depth bounds test
2061 VkBool32 wideLines /// lines with width greater than 1
2062 VkBool32 largePoints /// points with size greater than 1
Jesse Hallfbf97b02015-11-20 14:17:03 -08002063 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
2064 VkBool32 multiViewport
2065 VkBool32 samplerAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002066 VkBool32 textureCompressionETC2 /// ETC texture compression formats
2067 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
2068 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
2069 VkBool32 occlusionQueryNonConservative /// non-conservative (exact) occlusion queries
2070 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
Jesse Halldc6d36c2015-11-29 19:12:15 -08002071 VkBool32 vertexPipelineStoresAndAtomics
2072 VkBool32 fragmentStoresAndAtomics
2073 VkBool32 shaderTessellationAndGeometryPointSize
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002074 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
2075 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
2076 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
Jesse Halld1af8122015-11-29 23:50:38 -08002077 VkBool32 shaderStorageImageReadWithoutFormat
2078 VkBool32 shaderStorageImageWriteWithoutFormat
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002079 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
2080 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
2081 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
2082 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
2083 VkBool32 shaderClipDistance /// clip distance in shaders
2084 VkBool32 shaderCullDistance /// cull distance in shaders
2085 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
2086 VkBool32 shaderInt64 /// 64-bit integers in shaders
2087 VkBool32 shaderInt16 /// 16-bit integers in shaders
2088 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
2089 VkBool32 shaderResourceMinLOD /// shader can use texture operations that specify minimum resource LOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002090 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
2091 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
2092 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
2093 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
2094 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
2095 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
2096 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
2097 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
2098 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld1af8122015-11-29 23:50:38 -08002099 VkBool32 variableMultisampleRate
Jesse Halld27f6aa2015-08-15 17:58:48 -07002100}
2101
2102class VkPhysicalDeviceLimits {
2103 /// resource maximum sizes
2104 u32 maxImageDimension1D /// max 1D image dimension
2105 u32 maxImageDimension2D /// max 2D image dimension
2106 u32 maxImageDimension3D /// max 3D image dimension
2107 u32 maxImageDimensionCube /// max cubemap image dimension
2108 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002109 VkSampleCountFlags sampleCounts /// sample counts supported for all images supporting rendering and sampling
Jesse Hallb00daad2015-11-29 19:46:20 -08002110 u32 maxTexelBufferElements
Jesse Hallfbf97b02015-11-20 14:17:03 -08002111 u32 maxUniformBufferRange /// max uniform buffer size (bytes)
2112 u32 maxStorageBufferRange /// max storage buffer size (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002113 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
2114 /// memory limits
2115 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002116 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
2117 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002118 /// descriptor set limits
2119 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07002120 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
2121 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
2122 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
2123 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
2124 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
2125 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
2126 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002127 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002128 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002129 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002130 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
2131 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
2132 /// vertex stage limits
2133 u32 maxVertexInputAttributes /// max num of vertex input attribute slots
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002134 u32 maxVertexInputBindings /// max num of vertex input binding slots
Jesse Halld27f6aa2015-08-15 17:58:48 -07002135 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset
2136 u32 maxVertexInputBindingStride /// max vertex input binding stride
2137 u32 maxVertexOutputComponents /// max num of output components written by vertex shader
2138 /// tessellation control stage limits
Jesse Hall3fbc8562015-11-29 22:10:52 -08002139 u32 maxTessellationGenerationLevel /// max level supported by tess primitive generator
Jesse Hallae38f732015-11-19 21:32:50 -08002140 u32 maxTessellationPatchSize /// max patch size (vertices)
2141 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS
2142 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS
2143 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS
2144 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS
2145 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES
2146 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES
Jesse Halld27f6aa2015-08-15 17:58:48 -07002147 /// geometry stage limits
2148 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader
2149 u32 maxGeometryInputComponents /// max num of input components read in geometry stage
2150 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage
2151 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage
2152 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage
2153 /// fragment stage limits
2154 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage
Jesse Hallfbf97b02015-11-20 14:17:03 -08002155 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage
Jesse Hall3fbc8562015-11-29 22:10:52 -08002156 u32 maxFragmentDualSrcAttachments /// max num of output attachments written when using dual source blending
Jesse Halld27f6aa2015-08-15 17:58:48 -07002157 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers
2158 /// compute stage limits
2159 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes)
2160 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z)
2161 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group
2162 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z)
2163
2164 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y
2165 u32 subTexelPrecisionBits /// num bits of subtexel precision
2166 u32 mipmapPrecisionBits /// num bits of mipmap precision
2167
2168 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices)
2169 u32 maxDrawIndirectInstanceCount /// max instance count for indirect draw calls
Jesse Halld27f6aa2015-08-15 17:58:48 -07002170
2171 f32 maxSamplerLodBias /// max absolute sampler level of detail bias
2172 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy
2173
2174 u32 maxViewports /// max number of active viewports
Jesse Halld27f6aa2015-08-15 17:58:48 -07002175 u32[2] maxViewportDimensions /// max viewport dimensions (x,y)
2176 f32[2] viewportBoundsRange /// viewport bounds range (min,max)
2177 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport
2178
Jesse Halldc6d36c2015-11-29 19:12:15 -08002179 platform.size_t minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes)
2180 VkDeviceSize minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes)
2181 VkDeviceSize minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes)
2182 VkDeviceSize minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002183
Jesse Hallfbf97b02015-11-20 14:17:03 -08002184 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002185 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset
Jesse Hallfbf97b02015-11-20 14:17:03 -08002186 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002187 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset
2188 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset
2189 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset
2190 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset
2191
2192 u32 maxFramebufferWidth /// max width for a framebuffer
2193 u32 maxFramebufferHeight /// max height for a framebuffer
2194 u32 maxFramebufferLayers /// max layer count for a layered framebuffer
2195 u32 maxFramebufferColorSamples /// max color sample count for a framebuffer
2196 u32 maxFramebufferDepthSamples /// max depth sample count for a framebuffer
2197 u32 maxFramebufferStencilSamples /// max stencil sample count for a framebuffer
2198 u32 maxColorAttachments /// max num of framebuffer color attachments
2199
2200 u32 maxSampledImageColorSamples /// max num of color samples for a non-integer sampled image
Jesse Hallc7467b72015-11-29 21:05:26 -08002201 u32 maxSampledImageDepthSamples /// max num of depth samples for a sampled image
2202 u32 maxSampledImageStencilSamples /// max num of stencil samples for a sampled image
Jesse Halld27f6aa2015-08-15 17:58:48 -07002203 u32 maxSampledImageIntegerSamples /// max num of samples supported for an integer image
2204 u32 maxStorageImageSamples /// max num of samples for a storage image
2205 u32 maxSampleMaskWords /// max num of sample mask words
2206
Jesse Halla9bb62b2015-11-21 19:31:56 -08002207 f32 timestampPeriod
Jesse Halld27f6aa2015-08-15 17:58:48 -07002208
2209 u32 maxClipDistances /// max number of clip distances
2210 u32 maxCullDistances /// max number of cull distances
2211 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
2212
Jesse Hallfbf97b02015-11-20 14:17:03 -08002213 u32 discreteQueuePriorities
2214
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002215 f32[2] pointSizeRange /// range (min,max) of supported point sizes
2216 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07002217 f32 pointSizeGranularity /// granularity of supported point sizes
2218 f32 lineWidthGranularity /// granularity of supported line widths
Jesse Hall03b6fe12015-11-24 12:44:21 -08002219 VkBool32 strictLines
Jesse Halla9bb62b2015-11-21 19:31:56 -08002220
Jesse Halldc6d36c2015-11-29 19:12:15 -08002221 VkDeviceSize recommendedBufferCopyOffsetAlignment
2222 VkDeviceSize recommendedBufferCopyRowPitchAlignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07002223}
2224
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002225class VkPhysicalDeviceSparseProperties {
2226 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 -08002227 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 -07002228 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
2229 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 -07002230 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
2231}
2232
Jesse Halld27f6aa2015-08-15 17:58:48 -07002233class VkSemaphoreCreateInfo {
2234 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
2235 const void* pNext /// Pointer to next structure
2236 VkSemaphoreCreateFlags flags /// Semaphore creation flags
2237}
2238
2239class VkQueryPoolCreateInfo {
2240 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
2241 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002242 VkQueryPoolCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002243 VkQueryType queryType
2244 u32 slots
2245 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
2246}
2247
2248class VkFramebufferCreateInfo {
2249 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
2250 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002251 VkFramebufferCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002252 VkRenderPass renderPass
2253 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002254 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002255 u32 width
2256 u32 height
2257 u32 layers
2258}
2259
Jesse Hall3fbc8562015-11-29 22:10:52 -08002260class VkDrawIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002261 u32 vertexCount
2262 u32 instanceCount
2263 u32 firstVertex
2264 u32 firstInstance
2265}
2266
Jesse Hall3fbc8562015-11-29 22:10:52 -08002267class VkDrawIndexedIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002268 u32 indexCount
2269 u32 instanceCount
2270 u32 firstIndex
2271 s32 vertexOffset
2272 u32 firstInstance
2273}
2274
Jesse Hall3fbc8562015-11-29 22:10:52 -08002275class VkDispatchIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002276 u32 x
2277 u32 y
2278 u32 z
2279}
2280
Jesse Hallb00daad2015-11-29 19:46:20 -08002281@extension("VK_EXT_KHR_surface")
2282class VkSurfaceCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002283 u32 minImageCount
2284 u32 maxImageCount
2285 VkExtent2D currentExtent
2286 VkExtent2D minImageExtent
2287 VkExtent2D maxImageExtent
2288 VkSurfaceTransformFlagsKHR supportedTransforms
2289 VkSurfaceTransformKHR currentTransform
Jesse Halla6429252015-11-29 18:59:42 -08002290 VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002291 u32 maxImageArraySize
2292 VkImageUsageFlags supportedUsageFlags
Michael Lentine88594d72015-11-12 12:49:45 -08002293}
2294
Jesse Hallb00daad2015-11-29 19:46:20 -08002295@extension("VK_EXT_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -08002296class VkSurfaceFormatKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002297 VkFormat format
2298 VkColorSpaceKHR colorSpace
Michael Lentine88594d72015-11-12 12:49:45 -08002299}
2300
Jesse Hall1356b0d2015-11-23 17:24:58 -08002301@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002302class VkSwapchainCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002303 VkStructureType sType
2304 const void* pNext
2305 VkSurfaceKHR surface
2306 u32 minImageCount
2307 VkFormat imageFormat
2308 VkColorSpaceKHR imageColorSpace
2309 VkExtent2D imageExtent
2310 VkImageUsageFlags imageUsageFlags
2311 VkSurfaceTransformKHR preTransform
Jesse Halla6429252015-11-29 18:59:42 -08002312 VkCompositeAlphaFlagBitsKHR compositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002313 u32 imageArraySize
2314 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08002315 u32 queueFamilyIndexCount
Jesse Hall1356b0d2015-11-23 17:24:58 -08002316 const u32* pQueueFamilyIndices
2317 VkPresentModeKHR presentMode
2318 VkSwapchainKHR oldSwapchain
2319 VkBool32 clipped
Michael Lentine88594d72015-11-12 12:49:45 -08002320}
2321
Jesse Hall1356b0d2015-11-23 17:24:58 -08002322@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002323class VkPresentInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002324 VkStructureType sType
2325 const void* pNext
Jesse Hallb00daad2015-11-29 19:46:20 -08002326 u32 waitSemaphoreCount
2327 const VkSemaphore* pWaitSemaphores
Jesse Hall1356b0d2015-11-23 17:24:58 -08002328 u32 swapchainCount
Jesse Hall03b6fe12015-11-24 12:44:21 -08002329 const VkSwapchainKHR* pSwapchains
Jesse Hall1356b0d2015-11-23 17:24:58 -08002330 const u32* imageIndices
Michael Lentine88594d72015-11-12 12:49:45 -08002331}
2332
Jesse Hall1356b0d2015-11-23 17:24:58 -08002333@extension("VK_EXT_KHR_display")
2334class VkDisplayPropertiesKHR {
2335 VkDisplayKHR display
2336 const char* displayName
2337 VkExtent2D physicalDimensions
2338 VkExtent2D physicalResolution
2339 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hall1356b0d2015-11-23 17:24:58 -08002340 VkBool32 planeReorderPossible
Jesse Halla6429252015-11-29 18:59:42 -08002341 VkBool32 persistentContent
Michael Lentine88594d72015-11-12 12:49:45 -08002342}
2343
Jesse Hall1356b0d2015-11-23 17:24:58 -08002344@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002345class VkDisplayModeParametersKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002346 VkExtent2D visibleRegion
Jesse Halla6429252015-11-29 18:59:42 -08002347 u32 refreshRate
Michael Lentine88594d72015-11-12 12:49:45 -08002348}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002349
Jesse Hall1356b0d2015-11-23 17:24:58 -08002350@extension("VK_EXT_KHR_display")
2351class VkDisplayModePropertiesKHR {
2352 VkDisplayModeKHR displayMode
Jesse Halla6429252015-11-29 18:59:42 -08002353 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002354}
2355
2356@extension("VK_EXT_KHR_display")
2357class VkDisplayModeCreateInfoKHR {
2358 VkStructureType sType
2359 const void* pNext
Jesse Halla6429252015-11-29 18:59:42 -08002360 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002361}
2362
2363@extension("VK_EXT_KHR_display")
2364class VkDisplayPlanePropertiesKHR {
Jesse Halla6429252015-11-29 18:59:42 -08002365 VkDisplayKHR currentDisplay
2366 u32 currentStackIndex
2367}
2368
2369@extension("VK_EXT_KHR_display")
2370class VkDisplayPlaneCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002371 VkDisplayPlaneAlphaFlagsKHR supportedAlpha
2372 VkOffset2D minSrcPosition
2373 VkOffset2D maxSrcPosition
2374 VkExtent2D minSrcExtent
2375 VkExtent2D maxSrcExtent
2376 VkOffset2D minDstPosition
2377 VkOffset2D maxDstPosition
2378 VkExtent2D minDstExtent
2379 VkExtent2D maxDstExtent
2380}
2381
2382@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002383class VkDisplaySurfaceCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002384 VkStructureType sType
2385 const void* pNext
2386 VkDisplayModeKHR displayMode
2387 u32 planeIndex
2388 u32 planeStackIndex
2389 VkSurfaceTransformKHR transform
2390 f32 globalAlpha
2391 VkDisplayPlaneAlphaFlagsKHR alphaMode
2392 VkExtent2D imageSize
2393}
2394
2395@extension("VK_EXT_KHR_display_swapchain")
2396class VkDisplaySwapchainCreateInfoKHR {
2397 VkStructureType sType
2398 const void* pNext
2399 const VkSwapchainCreateInfoKHR* pNextSwapchainCreateInfo
2400}
2401
2402@extension("VK_EXT_KHR_display_swapchain")
2403class VkDisplayPresentInfoKHR {
2404 VkStructureType sType
2405 const void* pNext
2406 VkRect2D srcRect
2407 VkRect2D dstRect
Jesse Halla6429252015-11-29 18:59:42 -08002408 VkBool32 persistent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002409}
2410
2411
Jesse Halld27f6aa2015-08-15 17:58:48 -07002412////////////////
2413// Commands //
2414////////////////
2415
2416// Function pointers. TODO: add support for function pointers.
2417
2418@external type void* PFN_vkVoidFunction
2419@pfn cmd void vkVoidFunction() {
2420}
2421
Jesse Hall3fbc8562015-11-29 22:10:52 -08002422@external type void* PFN_vkAllocationFunction
2423@pfn cmd void* vkAllocationFunction(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002424 void* pUserData,
2425 platform.size_t size,
2426 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002427 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002428 return ?
2429}
2430
Jesse Hall3fbc8562015-11-29 22:10:52 -08002431@external type void* PFN_vkReallocationFunction
2432@pfn cmd void* vkReallocationFunction(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002433 void* pUserData,
2434 void* pOriginal,
2435 platform.size_t size,
2436 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002437 VkSystemAllocationScope allocationScope) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002438 return ?
2439}
2440
2441@external type void* PFN_vkFreeFunction
2442@pfn cmd void vkFreeFunction(
2443 void* pUserData,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002444 void* pMemory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002445}
2446
Jesse Hall3fbc8562015-11-29 22:10:52 -08002447@external type void* PFN_vkInternalAllocationNotification
2448@pfn cmd void vkInternalAllocationNotification(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002449 void* pUserData,
2450 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002451 VkInternalAllocationType allocationType,
2452 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002453}
2454
2455@external type void* PFN_vkInternalFreeNotification
2456@pfn cmd void vkInternalFreeNotification(
2457 void* pUserData,
2458 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002459 VkInternalAllocationType allocationType,
2460 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002461}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002462
2463// Global functions
2464
2465@threadSafety("system")
2466cmd VkResult vkCreateInstance(
2467 const VkInstanceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002468 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002469 VkInstance* pInstance) {
2470 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
2471
2472 instance := ?
2473 pInstance[0] = instance
2474 State.Instances[instance] = new!InstanceObject()
2475
Jesse Hall03b6fe12015-11-24 12:44:21 -08002476 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount]
2477 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount]
Jesse Halld27f6aa2015-08-15 17:58:48 -07002478
2479 return ?
2480}
2481
2482@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002483cmd void vkDestroyInstance(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002484 VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002485 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002486 instanceObject := GetInstance(instance)
2487
2488 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002489}
2490
2491@threadSafety("system")
2492cmd VkResult vkEnumeratePhysicalDevices(
2493 VkInstance instance,
2494 u32* pPhysicalDeviceCount,
2495 VkPhysicalDevice* pPhysicalDevices) {
2496 instanceObject := GetInstance(instance)
2497
2498 physicalDeviceCount := as!u32(?)
2499 pPhysicalDeviceCount[0] = physicalDeviceCount
2500 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2501
2502 for i in (0 .. physicalDeviceCount) {
2503 physicalDevice := ?
2504 physicalDevices[i] = physicalDevice
2505 if !(physicalDevice in State.PhysicalDevices) {
2506 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2507 }
2508 }
2509
2510 return ?
2511}
2512
2513cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2514 VkDevice device,
2515 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002516 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002517 device := GetDevice(device)
2518 }
2519
2520 return ?
2521}
2522
2523cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2524 VkInstance instance,
2525 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002526 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002527 instanceObject := GetInstance(instance)
2528 }
2529
2530 return ?
2531}
2532
Jesse Hall606a54e2015-11-19 22:17:28 -08002533cmd void vkGetPhysicalDeviceProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002534 VkPhysicalDevice physicalDevice,
2535 VkPhysicalDeviceProperties* pProperties) {
2536 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2537
2538 properties := ?
2539 pProperties[0] = properties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002540}
2541
Jesse Hall606a54e2015-11-19 22:17:28 -08002542cmd void vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002543 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002544 u32* pQueueFamilyPropertyCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002545 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002546 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002547 // TODO: Figure out how to express fetch-count-or-properties
2548 // This version fails 'apic validate' with 'fence not allowed in
2549 // *semantic.Branch'. Other attempts have failed with the same or other
2550 // errors.
2551 // if pQueueFamilyProperties != null {
2552 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2553 // for i in (0 .. pCount[0]) {
2554 // queueProperties := as!VkQueueFamilyProperties(?)
2555 // queuesProperties[i] = queueProperties
2556 // }
2557 // } else {
2558 // count := ?
2559 // pCount[0] = count
2560 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002561}
2562
Jesse Hall606a54e2015-11-19 22:17:28 -08002563cmd void vkGetPhysicalDeviceMemoryProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002564 VkPhysicalDevice physicalDevice,
2565 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2566 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2567
2568 memoryProperties := ?
2569 pMemoryProperties[0] = memoryProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002570}
2571
Jesse Hall606a54e2015-11-19 22:17:28 -08002572cmd void vkGetPhysicalDeviceFeatures(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002573 VkPhysicalDevice physicalDevice,
2574 VkPhysicalDeviceFeatures* pFeatures) {
2575 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2576
2577 features := ?
2578 pFeatures[0] = features
Jesse Halld27f6aa2015-08-15 17:58:48 -07002579}
2580
Jesse Hall606a54e2015-11-19 22:17:28 -08002581cmd void vkGetPhysicalDeviceFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002582 VkPhysicalDevice physicalDevice,
2583 VkFormat format,
2584 VkFormatProperties* pFormatProperties) {
2585 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2586
2587 formatProperties := ?
2588 pFormatProperties[0] = formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002589}
2590
Jesse Hall606a54e2015-11-19 22:17:28 -08002591cmd void vkGetPhysicalDeviceImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002592 VkPhysicalDevice physicalDevice,
2593 VkFormat format,
2594 VkImageType type,
2595 VkImageTiling tiling,
2596 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002597 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002598 VkImageFormatProperties* pImageFormatProperties) {
2599 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2600
2601 imageFormatProperties := ?
2602 pImageFormatProperties[0] = imageFormatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002603}
2604
Jesse Halld27f6aa2015-08-15 17:58:48 -07002605
2606// Device functions
2607
2608@threadSafety("system")
2609cmd VkResult vkCreateDevice(
2610 VkPhysicalDevice physicalDevice,
2611 const VkDeviceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002612 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002613 VkDevice* pDevice) {
2614 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2615 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2616
2617 device := ?
2618 pDevice[0] = device
2619 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2620
2621 return ?
2622}
2623
2624@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002625cmd void vkDestroyDevice(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002626 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002627 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002628 deviceObject := GetDevice(device)
2629
2630 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002631}
2632
2633
2634// Extension discovery functions
2635
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002636cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002637 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002638 VkLayerProperties* pProperties) {
2639 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002640 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002641
2642 properties := pProperties[0:count]
2643 for i in (0 .. count) {
2644 property := ?
2645 properties[i] = property
2646 }
2647
2648 return ?
2649}
2650
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002651cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002652 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002653 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002654 VkExtensionProperties* pProperties) {
2655 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002656 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002657
2658 properties := pProperties[0:count]
2659 for i in (0 .. count) {
2660 property := ?
2661 properties[i] = property
2662 }
2663
2664 return ?
2665}
2666
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002667cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002668 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002669 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002670 VkLayerProperties* pProperties) {
2671 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2672 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002673 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002674
2675 properties := pProperties[0:count]
2676 for i in (0 .. count) {
2677 property := ?
2678 properties[i] = property
2679 }
2680
2681 return ?
2682}
2683
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002684cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002685 VkPhysicalDevice physicalDevice,
2686 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002687 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002688 VkExtensionProperties* pProperties) {
2689 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2690
2691 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002692 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002693
2694 properties := pProperties[0:count]
2695 for i in (0 .. count) {
2696 property := ?
2697 properties[i] = property
2698 }
2699
2700 return ?
2701}
2702
2703
2704// Queue functions
2705
2706@threadSafety("system")
Jesse Hall606a54e2015-11-19 22:17:28 -08002707cmd void vkGetDeviceQueue(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002708 VkDevice device,
2709 u32 queueFamilyIndex,
2710 u32 queueIndex,
2711 VkQueue* pQueue) {
2712 deviceObject := GetDevice(device)
2713
2714 queue := ?
2715 pQueue[0] = queue
2716
2717 if !(queue in State.Queues) {
2718 State.Queues[queue] = new!QueueObject(device: device)
2719 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002720}
2721
2722@threadSafety("app")
2723cmd VkResult vkQueueSubmit(
2724 VkQueue queue,
Jesse Halla366a512015-11-19 22:30:07 -08002725 u32 submitCount,
Jesse Hallb00daad2015-11-29 19:46:20 -08002726 const VkSubmitInfo* pSubmits,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002727 VkFence fence) {
2728 queueObject := GetQueue(queue)
2729
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002730 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002731 fenceObject := GetFence(fence)
2732 assert(fenceObject.device == queueObject.device)
2733 }
2734
Jesse Hall3fbc8562015-11-29 22:10:52 -08002735 // commandBuffers := pcommandBuffers[0:commandBufferCount]
2736 // for i in (0 .. commandBufferCount) {
2737 // commandBuffer := commandBuffers[i]
2738 // commandBufferObject := GetCommandBuffer(commandBuffer)
2739 // assert(commandBufferObject.device == queueObject.device)
Jesse Halla366a512015-11-19 22:30:07 -08002740 //
Jesse Hall3fbc8562015-11-29 22:10:52 -08002741 // validate("QueueCheck", commandBufferObject.queueFlags in queueObject.flags,
2742 // "vkQueueSubmit: enqueued commandBuffer requires missing queue capabilities.")
Jesse Halla366a512015-11-19 22:30:07 -08002743 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002744
2745 return ?
2746}
2747
2748@threadSafety("system")
2749cmd VkResult vkQueueWaitIdle(
2750 VkQueue queue) {
2751 queueObject := GetQueue(queue)
2752
2753 return ?
2754}
2755
2756@threadSafety("system")
2757cmd VkResult vkDeviceWaitIdle(
2758 VkDevice device) {
2759 deviceObject := GetDevice(device)
2760
2761 return ?
2762}
2763
2764
2765// Memory functions
2766
2767@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002768cmd VkResult vkAllocateMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002769 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002770 const VkMemoryAllocateInfo* pAllocateInfo,
2771 const VkAllocationCallbacks* pAllocator,
2772 VkDeviceMemory* pMemory) {
2773 assert(pAllocateInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002774 deviceObject := GetDevice(device)
2775
Jesse Hall3fbc8562015-11-29 22:10:52 -08002776 memory := ?
2777 pMemory[0] = memory
2778 State.DeviceMemories[memory] = new!DeviceMemoryObject(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002779 device: device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002780 allocationSize: pAllocateInfo[0].allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002781
2782 return ?
2783}
2784
2785@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002786cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002787 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002788 VkDeviceMemory memory,
2789 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002790 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002791 memoryObject := GetDeviceMemory(memory)
2792 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002793
2794 // Check that no objects are still bound before freeing.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002795 validate("MemoryCheck", len(memoryObject.boundObjects) == 0,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002796 "vkFreeMemory: objects still bound")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002797 validate("MemoryCheck", len(memoryObject.boundCommandBuffers) == 0,
2798 "vkFreeMemory: commandBuffers still bound")
2799 State.DeviceMemories[memory] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002800}
2801
2802@threadSafety("app")
2803cmd VkResult vkMapMemory(
2804 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002805 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002806 VkDeviceSize offset,
2807 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002808 VkMemoryMapFlags flags,
2809 void** ppData) {
2810 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002811 memoryObject := GetDeviceMemory(memory)
2812 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002813
2814 assert(flags == as!VkMemoryMapFlags(0))
Jesse Hall3fbc8562015-11-29 22:10:52 -08002815 assert((offset + size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002816
2817 return ?
2818}
2819
2820@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002821cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002822 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002823 VkDeviceMemory memory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002824 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002825 memoryObject := GetDeviceMemory(memory)
2826 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002827}
2828
2829cmd VkResult vkFlushMappedMemoryRanges(
2830 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002831 u32 memoryRangeCount
2832 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002833 deviceObject := GetDevice(device)
2834
Jesse Hall3fbc8562015-11-29 22:10:52 -08002835 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2836 for i in (0 .. memoryRangeCount) {
2837 memoryRange := memoryRanges[i]
2838 memoryObject := GetDeviceMemory(memoryRange.memory)
2839 assert(memoryObject.device == device)
2840 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002841 }
2842
2843 return ?
2844}
2845
2846cmd VkResult vkInvalidateMappedMemoryRanges(
2847 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002848 u32 memoryRangeCount,
2849 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002850 deviceObject := GetDevice(device)
2851
Jesse Hall3fbc8562015-11-29 22:10:52 -08002852 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2853 for i in (0 .. memoryRangeCount) {
2854 memoryRange := memoryRanges[i]
2855 memoryObject := GetDeviceMemory(memoryRange.memory)
2856 assert(memoryObject.device == device)
2857 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002858 }
2859
2860 return ?
2861}
2862
2863
2864// Memory management API functions
2865
Jesse Hall606a54e2015-11-19 22:17:28 -08002866cmd void vkGetDeviceMemoryCommitment(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002867 VkDevice device,
2868 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002869 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002870 deviceObject := GetDevice(device)
2871
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002872 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002873 memoryObject := GetDeviceMemory(memory)
2874 assert(memoryObject.device == device)
2875 }
2876
2877 committedMemoryInBytes := ?
2878 pCommittedMemoryInBytes[0] = committedMemoryInBytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07002879}
2880
Jesse Hall606a54e2015-11-19 22:17:28 -08002881cmd void vkGetBufferMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002882 VkDevice device,
2883 VkBuffer buffer,
2884 VkMemoryRequirements* pMemoryRequirements) {
2885 deviceObject := GetDevice(device)
2886 bufferObject := GetBuffer(buffer)
2887 assert(bufferObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002888}
2889
2890cmd VkResult vkBindBufferMemory(
2891 VkDevice device,
2892 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002893 VkDeviceMemory memory,
2894 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002895 deviceObject := GetDevice(device)
2896 bufferObject := GetBuffer(buffer)
2897 assert(bufferObject.device == device)
2898
2899 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002900 if bufferObject.memory != NULL_HANDLE {
2901 memoryObject := GetDeviceMemory(bufferObject.memory)
2902 memoryObject.boundObjects[as!u64(buffer)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002903 }
2904
2905 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002906 if memory != NULL_HANDLE {
2907 memoryObject := GetDeviceMemory(memory)
2908 assert(memoryObject.device == device)
2909 memoryObject.boundObjects[as!u64(buffer)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002910 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002911 bufferObject.memory = memory
2912 bufferObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002913
2914 return ?
2915}
2916
Jesse Hall606a54e2015-11-19 22:17:28 -08002917cmd void vkGetImageMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002918 VkDevice device,
2919 VkImage image,
2920 VkMemoryRequirements* pMemoryRequirements) {
2921 deviceObject := GetDevice(device)
2922 imageObject := GetImage(image)
2923 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002924}
2925
2926cmd VkResult vkBindImageMemory(
2927 VkDevice device,
2928 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002929 VkDeviceMemory memory,
2930 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002931 deviceObject := GetDevice(device)
2932 imageObject := GetImage(image)
2933 assert(imageObject.device == device)
2934
2935 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002936 if imageObject.memory != NULL_HANDLE {
2937 memoryObject := GetDeviceMemory(imageObject.memory)
2938 memoryObject.boundObjects[as!u64(image)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002939 }
2940
2941 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002942 if memory != NULL_HANDLE {
2943 memoryObject := GetDeviceMemory(memory)
2944 assert(memoryObject.device == device)
2945 memoryObject.boundObjects[as!u64(image)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002946 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002947 imageObject.memory = memory
2948 imageObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002949
2950 return ?
2951}
2952
Jesse Hall606a54e2015-11-19 22:17:28 -08002953cmd void vkGetImageSparseMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002954 VkDevice device,
2955 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002956 u32* pSparseMemoryRequirementCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002957 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2958 deviceObject := GetDevice(device)
2959 imageObject := GetImage(image)
2960 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002961}
2962
Jesse Hall606a54e2015-11-19 22:17:28 -08002963cmd void vkGetPhysicalDeviceSparseImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002964 VkPhysicalDevice physicalDevice,
2965 VkFormat format,
2966 VkImageType type,
2967 u32 samples,
2968 VkImageUsageFlags usage,
2969 VkImageTiling tiling,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002970 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002971 VkSparseImageFormatProperties* pProperties) {
2972 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002973}
2974
Jesse Halla6429252015-11-29 18:59:42 -08002975cmd VkResult vkQueueBindSparse(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002976 VkQueue queue,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002977 u32 bindInfoCount,
Jesse Halla6429252015-11-29 18:59:42 -08002978 const VkBindSparseInfo* pBindInfo,
2979 VkFence fence) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002980 queueObject := GetQueue(queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002981
2982 return ?
2983}
2984
2985
2986// Fence functions
2987
2988@threadSafety("system")
2989cmd VkResult vkCreateFence(
2990 VkDevice device,
2991 const VkFenceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002992 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002993 VkFence* pFence) {
2994 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
2995 deviceObject := GetDevice(device)
2996
2997 fence := ?
2998 pFence[0] = fence
2999 State.Fences[fence] = new!FenceObject(
Jesse Halld8bade02015-11-24 10:24:18 -08003000 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT)))
Jesse Halld27f6aa2015-08-15 17:58:48 -07003001
3002 return ?
3003}
3004
3005@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003006cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003007 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003008 VkFence fence,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003009 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003010 deviceObject := GetDevice(device)
3011 fenceObject := GetFence(fence)
3012 assert(fenceObject.device == device)
3013
3014 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003015}
3016
3017@threadSafety("system")
3018cmd VkResult vkResetFences(
3019 VkDevice device,
3020 u32 fenceCount,
3021 const VkFence* pFences) {
3022 deviceObject := GetDevice(device)
3023
3024 fences := pFences[0:fenceCount]
3025 for i in (0 .. fenceCount) {
3026 fence := fences[i]
3027 fenceObject := GetFence(fence)
3028 assert(fenceObject.device == device)
3029 fenceObject.signaled = false
3030 }
3031
3032 return ?
3033}
3034
3035@threadSafety("system")
3036cmd VkResult vkGetFenceStatus(
3037 VkDevice device,
3038 VkFence fence) {
3039 deviceObject := GetDevice(device)
3040 fenceObject := GetFence(fence)
3041 assert(fenceObject.device == device)
3042
3043 return ?
3044}
3045
3046@threadSafety("system")
3047cmd VkResult vkWaitForFences(
3048 VkDevice device,
3049 u32 fenceCount,
3050 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003051 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003052 u64 timeout) { /// timeout in nanoseconds
3053 deviceObject := GetDevice(device)
3054
3055 fences := pFences[0:fenceCount]
3056 for i in (0 .. fenceCount) {
3057 fence := fences[i]
3058 fenceObject := GetFence(fence)
3059 assert(fenceObject.device == device)
3060 }
3061
3062 return ?
3063}
3064
3065
3066// Queue semaphore functions
3067
3068@threadSafety("system")
3069cmd VkResult vkCreateSemaphore(
3070 VkDevice device,
3071 const VkSemaphoreCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003072 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003073 VkSemaphore* pSemaphore) {
3074 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
3075 deviceObject := GetDevice(device)
3076
3077 semaphore := ?
3078 pSemaphore[0] = semaphore
3079 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
3080
3081 return ?
3082}
3083
3084@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003085cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003086 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003087 VkSemaphore semaphore,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003088 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003089 deviceObject := GetDevice(device)
3090 semaphoreObject := GetSemaphore(semaphore)
3091 assert(semaphoreObject.device == device)
3092
3093 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003094}
3095
Jesse Halld27f6aa2015-08-15 17:58:48 -07003096
3097// Event functions
3098
3099@threadSafety("system")
3100cmd VkResult vkCreateEvent(
3101 VkDevice device,
3102 const VkEventCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003103 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003104 VkEvent* pEvent) {
3105 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
3106 deviceObject := GetDevice(device)
3107
3108 event := ?
3109 pEvent[0] = event
3110 State.Events[event] = new!EventObject(device: device)
3111
3112 return ?
3113}
3114
3115@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003116cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003117 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003118 VkEvent event,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003119 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003120 deviceObject := GetDevice(device)
3121 eventObject := GetEvent(event)
3122 assert(eventObject.device == device)
3123
3124 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003125}
3126
3127@threadSafety("system")
3128cmd VkResult vkGetEventStatus(
3129 VkDevice device,
3130 VkEvent event) {
3131 deviceObject := GetDevice(device)
3132 eventObject := GetEvent(event)
3133 assert(eventObject.device == device)
3134
3135 return ?
3136}
3137
3138@threadSafety("system")
3139cmd VkResult vkSetEvent(
3140 VkDevice device,
3141 VkEvent event) {
3142 deviceObject := GetDevice(device)
3143 eventObject := GetEvent(event)
3144 assert(eventObject.device == device)
3145
3146 return ?
3147}
3148
3149@threadSafety("system")
3150cmd VkResult vkResetEvent(
3151 VkDevice device,
3152 VkEvent event) {
3153 deviceObject := GetDevice(device)
3154 eventObject := GetEvent(event)
3155 assert(eventObject.device == device)
3156
3157 return ?
3158}
3159
3160
3161// Query functions
3162
3163@threadSafety("system")
3164cmd VkResult vkCreateQueryPool(
3165 VkDevice device,
3166 const VkQueryPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003167 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003168 VkQueryPool* pQueryPool) {
3169 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
3170 deviceObject := GetDevice(device)
3171
3172 queryPool := ?
3173 pQueryPool[0] = queryPool
3174 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
3175
3176 return ?
3177}
3178
3179@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003180cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003181 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003182 VkQueryPool queryPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003183 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003184 deviceObject := GetDevice(device)
3185 queryPoolObject := GetQueryPool(queryPool)
3186 assert(queryPoolObject.device == device)
3187
3188 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003189}
3190
3191@threadSafety("system")
3192cmd VkResult vkGetQueryPoolResults(
3193 VkDevice device,
3194 VkQueryPool queryPool,
3195 u32 startQuery,
3196 u32 queryCount,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003197 platform.size_t dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003198 void* pData,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003199 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003200 VkQueryResultFlags flags) {
3201 deviceObject := GetDevice(device)
3202 queryPoolObject := GetQueryPool(queryPool)
3203 assert(queryPoolObject.device == device)
3204
Jesse Halld27f6aa2015-08-15 17:58:48 -07003205 data := pData[0:dataSize]
3206
3207 return ?
3208}
3209
3210// Buffer functions
3211
3212@threadSafety("system")
3213cmd VkResult vkCreateBuffer(
3214 VkDevice device,
3215 const VkBufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003216 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003217 VkBuffer* pBuffer) {
3218 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
3219 deviceObject := GetDevice(device)
3220
3221 buffer := ?
3222 pBuffer[0] = buffer
3223 State.Buffers[buffer] = new!BufferObject(device: device)
3224
3225 return ?
3226}
3227
3228@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003229cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003230 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003231 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003232 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003233 deviceObject := GetDevice(device)
3234 bufferObject := GetBuffer(buffer)
3235 assert(bufferObject.device == device)
3236
Jesse Hall3fbc8562015-11-29 22:10:52 -08003237 assert(bufferObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003238 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003239}
3240
3241
3242// Buffer view functions
3243
3244@threadSafety("system")
3245cmd VkResult vkCreateBufferView(
3246 VkDevice device,
3247 const VkBufferViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003248 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003249 VkBufferView* pView) {
3250 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
3251 deviceObject := GetDevice(device)
3252
3253 bufferObject := GetBuffer(pCreateInfo.buffer)
3254 assert(bufferObject.device == device)
3255
3256 view := ?
3257 pView[0] = view
3258 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
3259
3260 return ?
3261}
3262
3263@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003264cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003265 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003266 VkBufferView bufferView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003267 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003268 deviceObject := GetDevice(device)
3269 bufferViewObject := GetBufferView(bufferView)
3270 assert(bufferViewObject.device == device)
3271
3272 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003273}
3274
3275
3276// Image functions
3277
3278@threadSafety("system")
3279cmd VkResult vkCreateImage(
3280 VkDevice device,
3281 const VkImageCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003282 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003283 VkImage* pImage) {
3284 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
3285 deviceObject := GetDevice(device)
3286
3287 image := ?
3288 pImage[0] = image
3289 State.Images[image] = new!ImageObject(device: device)
3290
3291 return ?
3292}
3293
3294@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003295cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003296 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003297 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003298 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003299 deviceObject := GetDevice(device)
3300 imageObject := GetImage(image)
3301 assert(imageObject.device == device)
3302
Jesse Hall3fbc8562015-11-29 22:10:52 -08003303 assert(imageObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003304 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003305}
3306
Jesse Hall606a54e2015-11-19 22:17:28 -08003307cmd void vkGetImageSubresourceLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003308 VkDevice device,
3309 VkImage image,
3310 const VkImageSubresource* pSubresource,
3311 VkSubresourceLayout* pLayout) {
3312 deviceObject := GetDevice(device)
3313 imageObject := GetImage(image)
3314 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003315}
3316
3317
3318// Image view functions
3319
3320@threadSafety("system")
3321cmd VkResult vkCreateImageView(
3322 VkDevice device,
3323 const VkImageViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003324 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003325 VkImageView* pView) {
3326 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
3327 deviceObject := GetDevice(device)
3328
3329 imageObject := GetImage(pCreateInfo.image)
3330 assert(imageObject.device == device)
3331
3332 view := ?
3333 pView[0] = view
3334 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
3335
3336 return ?
3337}
3338
3339@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003340cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003341 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003342 VkImageView imageView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003343 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003344 deviceObject := GetDevice(device)
3345 imageViewObject := GetImageView(imageView)
3346 assert(imageViewObject.device == device)
3347
3348 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003349}
3350
3351
3352// Shader functions
3353
3354cmd VkResult vkCreateShaderModule(
3355 VkDevice device,
3356 const VkShaderModuleCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003357 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003358 VkShaderModule* pShaderModule) {
3359 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
3360 deviceObject := GetDevice(device)
3361
3362 shaderModule := ?
3363 pShaderModule[0] = shaderModule
3364 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
3365
3366 return ?
3367}
3368
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003369cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003370 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003371 VkShaderModule shaderModule,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003372 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003373 deviceObject := GetDevice(device)
3374 shaderModuleObject := GetShaderModule(shaderModule)
3375 assert(shaderModuleObject.device == device)
3376
3377 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003378}
3379
3380@threadSafety("system")
3381cmd VkResult vkCreateShader(
3382 VkDevice device,
3383 const VkShaderCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003384 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003385 VkShader* pShader) {
3386 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO)
3387 deviceObject := GetDevice(device)
3388
3389 shader := ?
3390 pShader[0] = shader
3391 State.Shaders[shader] = new!ShaderObject(device: device)
3392
3393 return ?
3394}
3395
3396@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003397cmd void vkDestroyShader(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003398 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003399 VkShader shader,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003400 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003401 deviceObject := GetDevice(device)
3402 shaderObject := GetShader(shader)
3403 assert(shaderObject.device == device)
3404
3405 State.Shaders[shader] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003406}
3407
3408
3409// Pipeline functions
3410
3411cmd VkResult vkCreatePipelineCache(
3412 VkDevice device,
3413 const VkPipelineCacheCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003414 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003415 VkPipelineCache* pPipelineCache) {
3416 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
3417 deviceObject := GetDevice(device)
3418
3419 pipelineCache := ?
3420 pPipelineCache[0] = pipelineCache
3421 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
3422
3423 return ?
3424}
3425
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003426cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003427 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003428 VkPipelineCache pipelineCache,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003429 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003430 deviceObject := GetDevice(device)
3431 pipelineCacheObject := GetPipelineCache(pipelineCache)
3432 assert(pipelineCacheObject.device == device)
3433
3434 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003435}
3436
Jesse Halld27f6aa2015-08-15 17:58:48 -07003437cmd VkResult vkGetPipelineCacheData(
3438 VkDevice device,
3439 VkPipelineCache pipelineCache,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003440 platform.size_t* pDataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003441 void* pData) {
3442 deviceObject := GetDevice(device)
3443 pipelineCacheObject := GetPipelineCache(pipelineCache)
3444 assert(pipelineCacheObject.device == device)
3445
3446 return ?
3447}
3448
3449cmd VkResult vkMergePipelineCaches(
3450 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003451 VkPipelineCache dstCache,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003452 u32 srcCacheCount,
3453 const VkPipelineCache* pSrcCaches) {
3454 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003455 dstCacheObject := GetPipelineCache(dstCache)
3456 assert(dstCacheObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003457
3458 srcCaches := pSrcCaches[0:srcCacheCount]
3459 for i in (0 .. srcCacheCount) {
3460 srcCache := srcCaches[i]
3461 srcCacheObject := GetPipelineCache(srcCache)
3462 assert(srcCacheObject.device == device)
3463 }
3464
3465 return ?
3466}
3467
3468cmd VkResult vkCreateGraphicsPipelines(
3469 VkDevice device,
3470 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003471 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003472 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003473 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003474 VkPipeline* pPipelines) {
3475 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003476 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003477 pipelineCacheObject := GetPipelineCache(pipelineCache)
3478 assert(pipelineCacheObject.device == device)
3479 }
3480
Jesse Hall03b6fe12015-11-24 12:44:21 -08003481 createInfos := pCreateInfos[0:createInfoCount]
3482 pipelines := pPipelines[0:createInfoCount]
3483 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003484 pipeline := ?
3485 pipelines[i] = pipeline
3486 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3487 }
3488
3489 return ?
3490}
3491
3492cmd VkResult vkCreateComputePipelines(
3493 VkDevice device,
3494 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003495 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003496 const VkComputePipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003497 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003498 VkPipeline* pPipelines) {
3499 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003500 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003501 pipelineCacheObject := GetPipelineCache(pipelineCache)
3502 assert(pipelineCacheObject.device == device)
3503 }
3504
Jesse Hall03b6fe12015-11-24 12:44:21 -08003505 createInfos := pCreateInfos[0:createInfoCount]
3506 pipelines := pPipelines[0:createInfoCount]
3507 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003508 pipeline := ?
3509 pipelines[i] = pipeline
3510 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3511 }
3512
3513 return ?
3514}
3515
3516@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003517cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003518 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003519 VkPipeline pipeline,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003520 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003521 deviceObject := GetDevice(device)
3522 pipelineObjects := GetPipeline(pipeline)
3523 assert(pipelineObjects.device == device)
3524
3525 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003526}
3527
3528
3529// Pipeline layout functions
3530
3531@threadSafety("system")
3532cmd VkResult vkCreatePipelineLayout(
3533 VkDevice device,
3534 const VkPipelineLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003535 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003536 VkPipelineLayout* pPipelineLayout) {
3537 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3538 deviceObject := GetDevice(device)
3539
3540 pipelineLayout := ?
3541 pPipelineLayout[0] = pipelineLayout
3542 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3543
3544 return ?
3545}
3546
3547@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003548cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003549 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003550 VkPipelineLayout pipelineLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003551 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003552 deviceObject := GetDevice(device)
3553 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3554 assert(pipelineLayoutObjects.device == device)
3555
3556 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003557}
3558
3559
3560// Sampler functions
3561
3562@threadSafety("system")
3563cmd VkResult vkCreateSampler(
3564 VkDevice device,
3565 const VkSamplerCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003566 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003567 VkSampler* pSampler) {
3568 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3569 deviceObject := GetDevice(device)
3570
3571 sampler := ?
3572 pSampler[0] = sampler
3573 State.Samplers[sampler] = new!SamplerObject(device: device)
3574
3575 return ?
3576}
3577
3578@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003579cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003580 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003581 VkSampler sampler,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003582 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003583 deviceObject := GetDevice(device)
3584 samplerObject := GetSampler(sampler)
3585 assert(samplerObject.device == device)
3586
3587 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003588}
3589
3590
3591// Descriptor set functions
3592
3593@threadSafety("system")
3594cmd VkResult vkCreateDescriptorSetLayout(
3595 VkDevice device,
3596 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003597 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003598 VkDescriptorSetLayout* pSetLayout) {
3599 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3600 deviceObject := GetDevice(device)
3601
3602 setLayout := ?
3603 pSetLayout[0] = setLayout
3604 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3605
3606 return ?
3607}
3608
3609@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003610cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003611 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003612 VkDescriptorSetLayout descriptorSetLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003613 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003614 deviceObject := GetDevice(device)
3615 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3616 assert(descriptorSetLayoutObject.device == device)
3617
3618 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003619}
3620
3621@threadSafety("system")
3622cmd VkResult vkCreateDescriptorPool(
3623 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003624 const VkDescriptorPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003625 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003626 VkDescriptorPool* pDescriptorPool) {
3627 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3628 deviceObject := GetDevice(device)
3629
3630 descriptorPool := ?
3631 pDescriptorPool[0] = descriptorPool
3632 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3633
3634 return ?
3635}
3636
3637@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003638cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003639 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003640 VkDescriptorPool descriptorPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003641 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003642 deviceObject := GetDevice(device)
3643 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3644 assert(descriptorPoolObject.device == device)
3645
3646 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003647}
3648
3649@threadSafety("app")
3650cmd VkResult vkResetDescriptorPool(
3651 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003652 VkDescriptorPool descriptorPool,
3653 VkDescriptorPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003654 deviceObject := GetDevice(device)
3655 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3656 assert(descriptorPoolObject.device == device)
3657
3658 return ?
3659}
3660
3661@threadSafety("app")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003662cmd VkResult vkAllocateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003663 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003664 const VkDescriptorSetAllocateInfo* pAllocateInfo,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003665 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003666 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003667 allocInfo := pAllocateInfo[0]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003668 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003669
Jesse Hall03b6fe12015-11-24 12:44:21 -08003670 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount]
3671 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003672 setLayout := setLayouts[i]
3673 setLayoutObject := GetDescriptorSetLayout(setLayout)
3674 assert(setLayoutObject.device == device)
3675 }
3676
Jesse Hall03b6fe12015-11-24 12:44:21 -08003677 descriptorSets := pDescriptorSets[0:allocInfo.setCount]
3678 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003679 descriptorSet := ?
3680 descriptorSets[i] = descriptorSet
3681 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3682 }
3683
3684 return ?
3685}
3686
Jesse Hallf09c6b12015-08-15 19:54:28 -07003687cmd VkResult vkFreeDescriptorSets(
3688 VkDevice device,
3689 VkDescriptorPool descriptorPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003690 u32 descriptorSetCount,
Jesse Hallf09c6b12015-08-15 19:54:28 -07003691 const VkDescriptorSet* pDescriptorSets) {
3692 deviceObject := GetDevice(device)
3693 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3694
Jesse Hall03b6fe12015-11-24 12:44:21 -08003695 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3696 for i in (0 .. descriptorSetCount) {
Jesse Hallf09c6b12015-08-15 19:54:28 -07003697 descriptorSet := descriptorSets[i]
3698 descriptorSetObject := GetDescriptorSet(descriptorSet)
3699 assert(descriptorSetObject.device == device)
3700 State.DescriptorSets[descriptorSet] = null
3701 }
3702
3703 return ?
3704}
3705
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003706cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003707 VkDevice device,
Jesse Hallb00daad2015-11-29 19:46:20 -08003708 u32 descriptorWriteCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003709 const VkWriteDescriptorSet* pDescriptorWrites,
Jesse Hallb00daad2015-11-29 19:46:20 -08003710 u32 descriptorCopyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003711 const VkCopyDescriptorSet* pDescriptorCopies) {
3712 deviceObject := GetDevice(device)
3713
Jesse Hallb00daad2015-11-29 19:46:20 -08003714 descriptorWrites := pDescriptorWrites[0:descriptorWriteCount]
3715 for i in (0 .. descriptorWriteCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003716 descriptorWrite := descriptorWrites[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003717 descriptorWriteObject := GetDescriptorSet(descriptorWrite.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003718 assert(descriptorWriteObject.device == device)
3719 }
3720
Jesse Hallb00daad2015-11-29 19:46:20 -08003721 descriptorCopies := pDescriptorCopies[0:descriptorCopyCount]
3722 for i in (0 .. descriptorCopyCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003723 descriptorCopy := descriptorCopies[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003724 descriptorCopyObject := GetDescriptorSet(descriptorCopy.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003725 assert(descriptorCopyObject.device == device)
3726 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003727}
3728
3729
3730// Framebuffer functions
3731
3732@threadSafety("system")
3733cmd VkResult vkCreateFramebuffer(
3734 VkDevice device,
3735 const VkFramebufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003736 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003737 VkFramebuffer* pFramebuffer) {
3738 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3739 deviceObject := GetDevice(device)
3740
3741 framebuffer := ?
3742 pFramebuffer[0] = framebuffer
3743 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3744
3745 return ?
3746}
3747
3748@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003749cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003750 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003751 VkFramebuffer framebuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003752 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003753 deviceObject := GetDevice(device)
3754 framebufferObject := GetFramebuffer(framebuffer)
3755 assert(framebufferObject.device == device)
3756
3757 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003758}
3759
3760
3761// Renderpass functions
3762
3763@threadSafety("system")
3764cmd VkResult vkCreateRenderPass(
3765 VkDevice device,
3766 const VkRenderPassCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003767 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003768 VkRenderPass* pRenderPass) {
3769 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3770 deviceObject := GetDevice(device)
3771
3772 renderpass := ?
3773 pRenderPass[0] = renderpass
3774 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3775
3776 return ?
3777}
3778
3779@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003780cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003781 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003782 VkRenderPass renderPass,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003783 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003784 deviceObject := GetDevice(device)
3785 renderPassObject := GetRenderPass(renderPass)
3786 assert(renderPassObject.device == device)
3787
3788 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003789}
3790
Jesse Hall606a54e2015-11-19 22:17:28 -08003791cmd void vkGetRenderAreaGranularity(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003792 VkDevice device,
3793 VkRenderPass renderPass,
3794 VkExtent2D* pGranularity) {
3795 deviceObject := GetDevice(device)
3796 renderPassObject := GetRenderPass(renderPass)
3797
3798 granularity := ?
3799 pGranularity[0] = granularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07003800}
3801
3802// Command pool functions
3803
3804cmd VkResult vkCreateCommandPool(
3805 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003806 const VkCommandPoolCreateInfo* pCreateInfo,
3807 const VkAllocationCallbacks* pAllocator,
3808 VkCommandPool* pCommandPool) {
3809 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003810 deviceObject := GetDevice(device)
3811
Jesse Hall3fbc8562015-11-29 22:10:52 -08003812 commandPool := ?
3813 pCommandPool[0] = commandPool
3814 State.CommandPools[commandPool] = new!CommandPoolObject(device: device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003815
3816 return ?
3817}
3818
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003819cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003820 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003821 VkCommandPool commandPool,
3822 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003823 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003824 commandPoolObject := GetCommandPool(commandPool)
3825 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003826
Jesse Hall3fbc8562015-11-29 22:10:52 -08003827 State.CommandPools[commandPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003828}
3829
3830cmd VkResult vkResetCommandPool(
3831 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003832 VkCommandPool commandPool,
3833 VkCommandPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003834 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003835 commandPoolObject := GetCommandPool(commandPool)
3836 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003837
3838 return ?
3839}
3840
3841// Command buffer functions
3842
Jesse Hall3fbc8562015-11-29 22:10:52 -08003843macro void bindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3844 memoryObject := GetDeviceMemory(memory)
3845 memoryObject.boundCommandBuffers[commandBuffer] = commandBuffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07003846
Jesse Hall3fbc8562015-11-29 22:10:52 -08003847 commandBufferObject := GetCommandBuffer(commandBuffer)
3848 commandBufferObject.boundObjects[as!u64(obj)] = memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07003849}
3850
Jesse Hall3fbc8562015-11-29 22:10:52 -08003851macro void unbindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3852 memoryObject := GetDeviceMemory(memory)
3853 memoryObject.boundCommandBuffers[commandBuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003854
Jesse Hall3fbc8562015-11-29 22:10:52 -08003855 commandBufferObject := GetCommandBuffer(commandBuffer)
3856 commandBufferObject.boundObjects[as!u64(obj)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003857}
3858
3859@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003860cmd VkResult vkAllocateCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003861 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003862 const VkCommandBufferAllocateInfo* pAllocateInfo,
3863 VkCommandBuffer* pCommandBuffers) {
3864 assert(pAllocateInfo[0].sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOC_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003865
Jesse Hall3fbc8562015-11-29 22:10:52 -08003866 count := pAllocateInfo[0].bufferCount
3867 commandBuffers := pCommandBuffers[0:count]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003868 for i in (0 .. count) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003869 commandBuffer := ?
3870 commandBuffers[i] = commandBuffer
3871 State.CommandBuffers[commandBuffer] = new!CommandBufferObject(device: device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003872 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003873
3874 return ?
3875}
3876
3877@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003878cmd void vkFreeCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003879 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003880 VkCommandPool commandPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003881 u32 commandBufferCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003882 const VkCommandBuffer* pCommandBuffers) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003883 deviceObject := GetDevice(device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003884
Jesse Hall3fbc8562015-11-29 22:10:52 -08003885 commandBuffers := pCommandBuffers[0:commandBufferCount]
Jesse Hall03b6fe12015-11-24 12:44:21 -08003886 for i in (0 .. commandBufferCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003887 commandBufferObject := GetCommandBuffer(commandBuffers[i])
3888 assert(commandBufferObject.device == device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003889 // TODO: iterate over boundObjects and clear memory bindings
Jesse Hall3fbc8562015-11-29 22:10:52 -08003890 State.CommandBuffers[commandBuffers[i]] = null
Jesse Hallfbf97b02015-11-20 14:17:03 -08003891 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003892}
3893
3894@threadSafety("app")
3895cmd VkResult vkBeginCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003896 VkCommandBuffer commandBuffer,
3897 const VkCommandBufferBeginInfo* pBeginInfo) {
3898 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO)
3899 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003900
3901 // TODO: iterate over boundObjects and clear memory bindings
3902
3903 return ?
3904}
3905
3906@threadSafety("app")
3907cmd VkResult vkEndCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003908 VkCommandBuffer commandBuffer) {
3909 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003910
3911 return ?
3912}
3913
3914@threadSafety("app")
3915cmd VkResult vkResetCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003916 VkCommandBuffer commandBuffer,
3917 VkCommandBufferResetFlags flags) {
3918 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003919
3920 // TODO: iterate over boundObjects and clear memory bindings
3921
3922 return ?
3923}
3924
3925
3926// Command buffer building functions
3927
3928@threadSafety("app")
3929cmd void vkCmdBindPipeline(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003930 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003931 VkPipelineBindPoint pipelineBindPoint,
3932 VkPipeline pipeline) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003933 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003934 pipelineObject := GetPipeline(pipeline)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003935 assert(commandBufferObject.device == pipelineObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003936
Jesse Halld8bade02015-11-24 10:24:18 -08003937 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003938 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3939 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3940 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08003941 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003942}
3943
3944@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003945cmd void vkCmdSetViewport(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003946 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003947 u32 viewportCount,
3948 const VkViewport* pViewports) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003949 commandBufferObject := GetCommandBuffer(commandBuffer)
3950 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003951}
3952
3953@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003954cmd void vkCmdSetScissor(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003955 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003956 u32 scissorCount,
3957 const VkRect2D* pScissors) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003958 commandBufferObject := GetCommandBuffer(commandBuffer)
3959 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003960}
3961
3962@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003963cmd void vkCmdSetLineWidth(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003964 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003965 f32 lineWidth) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003966 commandBufferObject := GetCommandBuffer(commandBuffer)
3967 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003968}
3969
3970@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003971cmd void vkCmdSetDepthBias(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003972 VkCommandBuffer commandBuffer,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003973 f32 depthBiasConstantFactor,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003974 f32 depthBiasClamp,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003975 f32 depthBiasSlopeFactor) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003976 commandBufferObject := GetCommandBuffer(commandBuffer)
3977 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003978}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003979
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003980@threadSafety("app")
3981cmd void vkCmdSetBlendConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003982 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003983 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3984 // an annotation as a quick hack to pass this to the template without
3985 // having to modify the AST and semantic model.
Jesse Hallb00daad2015-11-29 19:46:20 -08003986 @readonly f32[4] blendConstants) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003987 commandBufferObject := GetCommandBuffer(commandBuffer)
3988 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003989}
3990
3991@threadSafety("app")
3992cmd void vkCmdSetDepthBounds(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003993 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003994 f32 minDepthBounds,
3995 f32 maxDepthBounds) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003996 commandBufferObject := GetCommandBuffer(commandBuffer)
3997 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003998}
3999
4000@threadSafety("app")
4001cmd void vkCmdSetStencilCompareMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004002 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004003 VkStencilFaceFlags faceMask,
4004 u32 stencilCompareMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004005 commandBufferObject := GetCommandBuffer(commandBuffer)
4006 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004007}
4008
4009@threadSafety("app")
4010cmd void vkCmdSetStencilWriteMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004011 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004012 VkStencilFaceFlags faceMask,
4013 u32 stencilWriteMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004014 commandBufferObject := GetCommandBuffer(commandBuffer)
4015 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004016}
4017
4018@threadSafety("app")
4019cmd void vkCmdSetStencilReference(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004020 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004021 VkStencilFaceFlags faceMask,
4022 u32 stencilReference) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004023 commandBufferObject := GetCommandBuffer(commandBuffer)
4024 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004025}
4026
4027@threadSafety("app")
4028cmd void vkCmdBindDescriptorSets(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004029 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004030 VkPipelineBindPoint pipelineBindPoint,
4031 VkPipelineLayout layout,
4032 u32 firstSet,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004033 u32 descriptorSetCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004034 const VkDescriptorSet* pDescriptorSets,
4035 u32 dynamicOffsetCount,
4036 const u32* pDynamicOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004037 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004038
Jesse Hall03b6fe12015-11-24 12:44:21 -08004039 descriptorSets := pDescriptorSets[0:descriptorSetCount]
4040 for i in (0 .. descriptorSetCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004041 descriptorSet := descriptorSets[i]
4042 descriptorSetObject := GetDescriptorSet(descriptorSet)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004043 assert(commandBufferObject.device == descriptorSetObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004044 }
4045
4046 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
4047 for i in (0 .. dynamicOffsetCount) {
4048 dynamicOffset := dynamicOffsets[i]
4049 }
4050
Jesse Halld8bade02015-11-24 10:24:18 -08004051 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004052 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
4053 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
4054 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08004055 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004056}
4057
4058@threadSafety("app")
4059cmd void vkCmdBindIndexBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004060 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004061 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004062 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004063 VkIndexType indexType) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004064 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004065 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004066 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004067
Jesse Hall3fbc8562015-11-29 22:10:52 -08004068 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004069
Jesse Hall3fbc8562015-11-29 22:10:52 -08004070 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004071}
4072
4073@threadSafety("app")
4074cmd void vkCmdBindVertexBuffers(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004075 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004076 u32 startBinding,
4077 u32 bindingCount,
4078 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004079 const VkDeviceSize* pOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004080 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004081
4082 // TODO: check if not [startBinding:startBinding+bindingCount]
4083 buffers := pBuffers[0:bindingCount]
4084 offsets := pOffsets[0:bindingCount]
4085 for i in (0 .. bindingCount) {
4086 buffer := buffers[i]
4087 offset := offsets[i]
4088 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004089 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004090
Jesse Hall3fbc8562015-11-29 22:10:52 -08004091 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004092 }
4093
Jesse Hall3fbc8562015-11-29 22:10:52 -08004094 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004095}
4096
4097@threadSafety("app")
4098cmd void vkCmdDraw(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004099 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004100 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004101 u32 instanceCount,
4102 u32 firstVertex,
4103 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004104 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004105
Jesse Hall3fbc8562015-11-29 22:10:52 -08004106 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004107}
4108
4109@threadSafety("app")
4110cmd void vkCmdDrawIndexed(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004111 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004112 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004113 u32 instanceCount,
4114 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004115 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004116 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004117 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004118
Jesse Hall3fbc8562015-11-29 22:10:52 -08004119 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004120}
4121
4122@threadSafety("app")
4123cmd void vkCmdDrawIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004124 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004125 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004126 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004127 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004128 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004129 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004130 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004131 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004132
Jesse Hall3fbc8562015-11-29 22:10:52 -08004133 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004134
Jesse Hall3fbc8562015-11-29 22:10:52 -08004135 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004136}
4137
4138@threadSafety("app")
4139cmd void vkCmdDrawIndexedIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004140 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004141 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004142 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004143 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004144 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004145 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004146 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004147 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004148
Jesse Hall3fbc8562015-11-29 22:10:52 -08004149 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004150
Jesse Hall3fbc8562015-11-29 22:10:52 -08004151 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004152}
4153
4154@threadSafety("app")
4155cmd void vkCmdDispatch(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004156 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004157 u32 x,
4158 u32 y,
4159 u32 z) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004160 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004161
Jesse Hall3fbc8562015-11-29 22:10:52 -08004162 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004163}
4164
4165@threadSafety("app")
4166cmd void vkCmdDispatchIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004167 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004168 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004169 VkDeviceSize offset) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004170 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004171 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004172 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004173
Jesse Hall3fbc8562015-11-29 22:10:52 -08004174 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004175
Jesse Hall3fbc8562015-11-29 22:10:52 -08004176 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004177}
4178
4179@threadSafety("app")
4180cmd void vkCmdCopyBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004181 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004182 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004183 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004184 u32 regionCount,
4185 const VkBufferCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004186 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004187 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004188 dstBufferObject := GetBuffer(dstBuffer)
4189 assert(commandBufferObject.device == srcBufferObject.device)
4190 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004191
4192 regions := pRegions[0:regionCount]
4193 for i in (0 .. regionCount) {
4194 region := regions[i]
4195 }
4196
Jesse Hall3fbc8562015-11-29 22:10:52 -08004197 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4198 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004199
Jesse Hall3fbc8562015-11-29 22:10:52 -08004200 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004201}
4202
4203@threadSafety("app")
4204cmd void vkCmdCopyImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004205 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004206 VkImage srcImage,
4207 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004208 VkImage dstImage,
4209 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004210 u32 regionCount,
4211 const VkImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004212 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004213 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004214 dstImageObject := GetImage(dstImage)
4215 assert(commandBufferObject.device == srcImageObject.device)
4216 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004217
4218 regions := pRegions[0:regionCount]
4219 for i in (0 .. regionCount) {
4220 region := regions[i]
4221 }
4222
Jesse Hall3fbc8562015-11-29 22:10:52 -08004223 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4224 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004225
Jesse Hall3fbc8562015-11-29 22:10:52 -08004226 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004227}
4228
4229@threadSafety("app")
4230cmd void vkCmdBlitImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004231 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004232 VkImage srcImage,
4233 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004234 VkImage dstImage,
4235 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004236 u32 regionCount,
4237 const VkImageBlit* pRegions,
Jesse Hall23ff73f2015-11-29 14:36:39 -08004238 VkFilter filter) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004239 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004240 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004241 dstImageObject := GetImage(dstImage)
4242 assert(commandBufferObject.device == srcImageObject.device)
4243 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004244
4245 regions := pRegions[0:regionCount]
4246 for i in (0 .. regionCount) {
4247 region := regions[i]
4248 }
4249
Jesse Hall3fbc8562015-11-29 22:10:52 -08004250 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4251 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004252
Jesse Hall3fbc8562015-11-29 22:10:52 -08004253 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004254}
4255
4256@threadSafety("app")
4257cmd void vkCmdCopyBufferToImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004258 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004259 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004260 VkImage dstImage,
4261 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004262 u32 regionCount,
4263 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004264 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004265 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004266 dstImageObject := GetImage(dstImage)
4267 assert(commandBufferObject.device == srcBufferObject.device)
4268 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004269
4270 regions := pRegions[0:regionCount]
4271 for i in (0 .. regionCount) {
4272 region := regions[i]
4273 }
4274
Jesse Hall3fbc8562015-11-29 22:10:52 -08004275 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4276 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004277
Jesse Hall3fbc8562015-11-29 22:10:52 -08004278 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004279}
4280
4281@threadSafety("app")
4282cmd void vkCmdCopyImageToBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004283 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004284 VkImage srcImage,
4285 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004286 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004287 u32 regionCount,
4288 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004289 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004290 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004291 dstBufferObject := GetBuffer(dstBuffer)
4292 assert(commandBufferObject.device == srcImageObject.device)
4293 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004294
4295 regions := pRegions[0:regionCount]
4296 for i in (0 .. regionCount) {
4297 region := regions[i]
4298 }
4299
Jesse Hall3fbc8562015-11-29 22:10:52 -08004300 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4301 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004302
Jesse Hall3fbc8562015-11-29 22:10:52 -08004303 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004304}
4305
4306@threadSafety("app")
4307cmd void vkCmdUpdateBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004308 VkCommandBuffer commandBuffer,
4309 VkBuffer dstBuffer,
4310 VkDeviceSize dstOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004311 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004312 const u32* pData) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004313 commandBufferObject := GetCommandBuffer(commandBuffer)
4314 dstBufferObject := GetBuffer(dstBuffer)
4315 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004316
4317 data := pData[0:dataSize]
4318
Jesse Hall3fbc8562015-11-29 22:10:52 -08004319 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004320
Jesse Hall3fbc8562015-11-29 22:10:52 -08004321 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004322}
4323
4324@threadSafety("app")
4325cmd void vkCmdFillBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004326 VkCommandBuffer commandBuffer,
4327 VkBuffer dstBuffer,
4328 VkDeviceSize dstOffset,
Jesse Hallb00daad2015-11-29 19:46:20 -08004329 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004330 u32 data) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004331 commandBufferObject := GetCommandBuffer(commandBuffer)
4332 dstBufferObject := GetBuffer(dstBuffer)
4333 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004334
Jesse Hall3fbc8562015-11-29 22:10:52 -08004335 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004336}
4337
4338@threadSafety("app")
4339cmd void vkCmdClearColorImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004340 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004341 VkImage image,
4342 VkImageLayout imageLayout,
4343 const VkClearColorValue* pColor,
4344 u32 rangeCount,
4345 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004346 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004347 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004348 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004349
4350 ranges := pRanges[0:rangeCount]
4351 for i in (0 .. rangeCount) {
4352 range := ranges[i]
4353 }
4354
Jesse Hall3fbc8562015-11-29 22:10:52 -08004355 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004356
Jesse Hall3fbc8562015-11-29 22:10:52 -08004357 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004358}
4359
4360@threadSafety("app")
4361cmd void vkCmdClearDepthStencilImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004362 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004363 VkImage image,
4364 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004365 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004366 u32 rangeCount,
4367 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004368 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004369 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004370 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004371
4372 ranges := pRanges[0:rangeCount]
4373 for i in (0 .. rangeCount) {
4374 range := ranges[i]
4375 }
4376
Jesse Hall3fbc8562015-11-29 22:10:52 -08004377 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004378
Jesse Hall3fbc8562015-11-29 22:10:52 -08004379 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004380}
4381
4382@threadSafety("app")
Jesse Hallae38f732015-11-19 21:32:50 -08004383cmd void vkCmdClearAttachments(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004384 VkCommandBuffer commandBuffer,
Jesse Hallae38f732015-11-19 21:32:50 -08004385 u32 attachmentCount,
4386 const VkClearAttachment* pAttachments,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004387 u32 rectCount,
Jesse Halla15a4bf2015-11-19 22:48:02 -08004388 const VkClearRect* pRects) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004389 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004390
4391 rects := pRects[0:rectCount]
4392 for i in (0 .. rectCount) {
4393 rect := rects[i]
4394 }
4395
Jesse Hall3fbc8562015-11-29 22:10:52 -08004396 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004397}
4398
4399@threadSafety("app")
4400cmd void vkCmdResolveImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004401 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004402 VkImage srcImage,
4403 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004404 VkImage dstImage,
4405 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004406 u32 regionCount,
4407 const VkImageResolve* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004408 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004409 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004410 dstImageObject := GetImage(dstImage)
4411 assert(commandBufferObject.device == srcImageObject.device)
4412 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004413
4414 regions := pRegions[0:regionCount]
4415 for i in (0 .. regionCount) {
4416 region := regions[i]
4417 }
4418
Jesse Hall3fbc8562015-11-29 22:10:52 -08004419 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4420 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004421
Jesse Hall3fbc8562015-11-29 22:10:52 -08004422 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004423}
4424
4425@threadSafety("app")
4426cmd void vkCmdSetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004427 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004428 VkEvent event,
4429 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004430 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004431 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004432 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004433}
4434
4435@threadSafety("app")
4436cmd void vkCmdResetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004437 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004438 VkEvent event,
4439 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004440 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004441 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004442 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004443}
4444
4445@threadSafety("app")
4446cmd void vkCmdWaitEvents(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004447 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004448 u32 eventCount,
4449 const VkEvent* pEvents,
4450 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004451 VkPipelineStageFlags dstStageMask,
4452 u32 memoryBarrierCount,
4453 const void* const* ppMemoryBarriers) {
4454 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004455
4456 events := pEvents[0:eventCount]
4457 for i in (0 .. eventCount) {
4458 event := events[i]
4459 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004460 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004461 }
4462
Jesse Hall3fbc8562015-11-29 22:10:52 -08004463 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4464 for i in (0 .. memoryBarrierCount) {
4465 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004466 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004467 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004468 }
4469 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004470 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4471 imageObject := GetImage(imageMemoryBarrier.image)
4472 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004473 }
4474 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004475 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4476 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4477 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004478 }
4479 }
4480 }
4481}
4482
4483@threadSafety("app")
4484cmd void vkCmdPipelineBarrier(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004485 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004486 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004487 VkPipelineStageFlags dstStageMask,
Jesse Halldc6d36c2015-11-29 19:12:15 -08004488 VkDependencyFlags dependencyFlags,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004489 u32 memoryBarrierCount,
4490 const void* const* ppMemoryBarriers) {
4491 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004492
Jesse Hall3fbc8562015-11-29 22:10:52 -08004493 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4494 for i in (0 .. memoryBarrierCount) {
4495 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004496 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004497 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004498 }
4499 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004500 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4501 imageObject := GetImage(imageMemoryBarrier.image)
4502 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004503 }
4504 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004505 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4506 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4507 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004508 }
4509 }
4510 }
4511}
4512
4513@threadSafety("app")
4514cmd void vkCmdBeginQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004515 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004516 VkQueryPool queryPool,
4517 u32 slot,
4518 VkQueryControlFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004519 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004520 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004521 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004522}
4523
4524@threadSafety("app")
4525cmd void vkCmdEndQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004526 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004527 VkQueryPool queryPool,
4528 u32 slot) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004529 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004530 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004531 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004532}
4533
4534@threadSafety("app")
4535cmd void vkCmdResetQueryPool(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004536 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004537 VkQueryPool queryPool,
4538 u32 startQuery,
4539 u32 queryCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004540 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004541 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004542 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004543}
4544
4545@threadSafety("app")
4546cmd void vkCmdWriteTimestamp(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004547 VkCommandBuffer commandBuffer,
Jesse Hall6f39a6d2015-11-24 11:08:36 -08004548 VkPipelineStageFlagBits pipelineStage,
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004549 VkQueryPool queryPool,
4550 u32 slot) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004551 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004552 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004553 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004554}
4555
4556@threadSafety("app")
4557cmd void vkCmdCopyQueryPoolResults(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004558 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004559 VkQueryPool queryPool,
4560 u32 startQuery,
4561 u32 queryCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004562 VkBuffer dstBuffer,
4563 VkDeviceSize dstOffset,
Jesse Halla9bb62b2015-11-21 19:31:56 -08004564 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004565 VkQueryResultFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004566 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004567 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004568 dstBufferObject := GetBuffer(dstBuffer)
4569 assert(commandBufferObject.device == queryPoolObject.device)
4570 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004571}
4572
4573cmd void vkCmdPushConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004574 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004575 VkPipelineLayout layout,
4576 VkShaderStageFlags stageFlags,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004577 u32 offset,
4578 u32 size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004579 const void* values) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004580 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004581 layoutObject := GetPipelineLayout(layout)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004582 assert(commandBufferObject.device == layoutObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004583}
4584
4585@threadSafety("app")
4586cmd void vkCmdBeginRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004587 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004588 const VkRenderPassBeginInfo* pRenderPassBegin,
4589 VkRenderPassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004590 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004591 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4592 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004593 assert(commandBufferObject.device == renderPassObject.device)
4594 assert(commandBufferObject.device == framebufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004595
Jesse Hall3fbc8562015-11-29 22:10:52 -08004596 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004597}
4598
4599cmd void vkCmdNextSubpass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004600 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004601 VkRenderPassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004602 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004603}
4604
4605@threadSafety("app")
4606cmd void vkCmdEndRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004607 VkCommandBuffer commandBuffer) {
4608 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004609
Jesse Hall3fbc8562015-11-29 22:10:52 -08004610 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004611}
4612
4613cmd void vkCmdExecuteCommands(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004614 VkCommandBuffer commandBuffer,
4615 u32 commandBuffersCount,
4616 const VkCommandBuffer* pCommandBuffers) {
4617 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004618
Jesse Hall3fbc8562015-11-29 22:10:52 -08004619 commandBuffers := pCommandBuffers[0:commandBuffersCount]
4620 for i in (0 .. commandBuffersCount) {
4621 secondaryCommandBuffer := commandBuffers[i]
4622 secondaryCommandBufferObject := GetCommandBuffer(secondaryCommandBuffer)
4623 assert(commandBufferObject.device == secondaryCommandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004624 }
4625}
4626
Jesse Hall1356b0d2015-11-23 17:24:58 -08004627@extension("VK_EXT_KHR_surface")
4628cmd void vkDestroySurfaceKHR(
4629 VkInstance instance,
4630 VkSurfaceKHR surface) {
4631 instanceObject := GetInstance(instance)
4632 surfaceObject := GetSurface(surface)
4633 assert(surfaceObject.instance == instance)
Michael Lentine88594d72015-11-12 12:49:45 -08004634
Jesse Hall1356b0d2015-11-23 17:24:58 -08004635 State.Surfaces[surface] = null
Jesse Hall2818f932015-11-19 21:19:17 -08004636}
4637
Jesse Hall1356b0d2015-11-23 17:24:58 -08004638@extension("VK_EXT_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004639cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004640 VkPhysicalDevice physicalDevice,
4641 u32 queueFamilyIndex,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004642 VkSurfaceKHR surface,
Jesse Hallb00daad2015-11-29 19:46:20 -08004643 VkBool32* pSupported) {
4644 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004645
4646 return ?
4647}
4648
Jesse Hallb00daad2015-11-29 19:46:20 -08004649@extension("VK_EXT_KHR_surface")
4650cmd VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
4651 VkPhysicalDevice physicalDevice,
4652 VkSurfaceKHR surface,
4653 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
4654 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4655
4656 surfaceCapabilities := ?
4657 pSurfaceCapabilities[0] = surfaceCapabilities
4658
4659 return ?
4660}
4661
4662@extension("VK_EXT_KHR_surface")
4663cmd VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(
4664 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004665 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004666 u32* pSurfaceFormatCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004667 VkSurfaceFormatKHR* pSurfaceFormats) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004668 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004669
4670 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004671 pSurfaceFormatCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004672 surfaceFormats := pSurfaceFormats[0:count]
4673
4674 for i in (0 .. count) {
4675 surfaceFormat := ?
4676 surfaceFormats[i] = surfaceFormat
4677 }
4678
4679 return ?
4680}
4681
Jesse Hallb00daad2015-11-29 19:46:20 -08004682@extension("VK_EXT_KHR_surface")
4683cmd VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(
4684 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004685 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004686 u32* pPresentModeCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004687 VkPresentModeKHR* pPresentModes) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004688 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004689
4690 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004691 pPresentModeCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004692 presentModes := pPresentModes[0:count]
4693
4694 for i in (0 .. count) {
4695 presentMode := ?
4696 presentModes[i] = presentMode
4697 }
4698
4699 return ?
4700}
4701
Jesse Hall1356b0d2015-11-23 17:24:58 -08004702@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004703cmd VkResult vkCreateSwapchainKHR(
4704 VkDevice device,
4705 const VkSwapchainCreateInfoKHR* pCreateInfo,
4706 VkSwapchainKHR* pSwapchain) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004707 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
Michael Lentine88594d72015-11-12 12:49:45 -08004708 deviceObject := GetDevice(device)
4709
4710 swapchain := ?
4711 pSwapchain[0] = swapchain
4712 State.Swapchains[swapchain] = new!SwapchainObject(device: device)
4713
4714 return ?
4715}
4716
Jesse Hall1356b0d2015-11-23 17:24:58 -08004717@extension("VK_EXT_KHR_swapchain")
4718cmd void vkDestroySwapchainKHR(
Michael Lentine88594d72015-11-12 12:49:45 -08004719 VkDevice device,
4720 VkSwapchainKHR swapchain) {
4721 deviceObject := GetDevice(device)
4722 swapchainObject := GetSwapchain(swapchain)
4723 assert(swapchainObject.device == device)
4724
4725 State.Swapchains[swapchain] = null
Michael Lentine88594d72015-11-12 12:49:45 -08004726}
4727
Jesse Hall1356b0d2015-11-23 17:24:58 -08004728@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004729cmd VkResult vkGetSwapchainImagesKHR(
4730 VkDevice device,
4731 VkSwapchainKHR swapchain,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004732 u32* pSwapchainImageCount,
Michael Lentine88594d72015-11-12 12:49:45 -08004733 VkImage* pSwapchainImages) {
4734 deviceObject := GetDevice(device)
4735
4736 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004737 pSwapchainImageCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004738 swapchainImages := pSwapchainImages[0:count]
4739
4740 for i in (0 .. count) {
4741 swapchainImage := ?
4742 swapchainImages[i] = swapchainImage
Jesse Hall1356b0d2015-11-23 17:24:58 -08004743 State.Images[swapchainImage] = new!ImageObject(device: device)
Michael Lentine88594d72015-11-12 12:49:45 -08004744 }
4745
4746 return ?
4747}
4748
Jesse Hall1356b0d2015-11-23 17:24:58 -08004749@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004750cmd VkResult vkAcquireNextImageKHR(
4751 VkDevice device,
4752 VkSwapchainKHR swapchain,
4753 u64 timeout,
4754 VkSemaphore semaphore,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004755 VkFence fence,
Michael Lentine88594d72015-11-12 12:49:45 -08004756 u32* pImageIndex) {
4757 deviceObject := GetDevice(device)
4758 swapchainObject := GetSwapchain(swapchain)
4759
4760 imageIndex := ?
4761 pImageIndex[0] = imageIndex
4762
4763 return ?
4764}
4765
Jesse Hall1356b0d2015-11-23 17:24:58 -08004766@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004767cmd VkResult vkQueuePresentKHR(
4768 VkQueue queue,
4769 VkPresentInfoKHR* pPresentInfo) {
4770 queueObject := GetQueue(queue)
4771
4772 presentInfo := ?
4773 pPresentInfo[0] = presentInfo
4774
4775 return ?
4776}
4777
Jesse Hall1356b0d2015-11-23 17:24:58 -08004778@extension("VK_EXT_KHR_display")
4779cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
4780 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004781 u32* pPropertyCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004782 VkDisplayPropertiesKHR* pProperties) {
4783 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4784 return ?
4785}
4786
4787@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004788cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
4789 VkPhysicalDevice physicalDevice,
4790 u32* pPropertyCount,
4791 VkDisplayPlanePropertiesKHR* pProperties) {
4792 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4793 return ?
4794}
4795
4796@extension("VK_EXT_KHR_display")
4797cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR(
4798 VkPhysicalDevice physicalDevice,
4799 u32* pPropertyCount,
4800 VkDisplayKHR* pProperties) {
4801 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4802 return ?
4803}
4804
4805@extension("VK_EXT_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004806cmd VkResult vkGetDisplayModePropertiesKHR(
4807 VkPhysicalDevice physicalDevice,
4808 VkDisplayKHR display,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004809 u32* pPropertyCount,
4810 VkDisplayModePropertiesKHR* pProperties) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004811 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4812 return ?
4813}
4814
4815@extension("VK_EXT_KHR_display")
4816cmd VkResult vkCreateDisplayModeKHR(
4817 VkPhysicalDevice physicalDevice,
4818 VkDisplayKHR display,
4819 const VkDisplayModeCreateInfoKHR* pCreateInfo,
4820 VkDisplayModeKHR* pMode) {
4821 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4822 return ?
4823}
4824
4825@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004826cmd VkResult vkGetDisplayPlaneCapabilitiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004827 VkPhysicalDevice physicalDevice,
Jesse Halla6429252015-11-29 18:59:42 -08004828 VkDisplayModeCreateInfoKHR mode,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004829 u32 planeIndex,
Jesse Halla6429252015-11-29 18:59:42 -08004830 VkDisplayPlaneCapabilitiesKHR* pCapabilities) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004831 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4832 return ?
4833}
4834
Jesse Halla6429252015-11-29 18:59:42 -08004835@extension("VK_EXT_KHR_display")
4836cmd VkResult vkCreateDisplayPlaneSurfaceKHR(
4837 VkInstance instance,
4838 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
4839 VkSurfaceKHR* pSurface) {
4840 return ?
4841}
4842
4843@extension("VK_EXT_KHR_xlib_surface")
4844cmd VkResult vkCreateXlibSurfaceKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004845 VkInstance instance,
4846 platform.Display* dpy,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004847 platform.Window window,
4848 VkSurfaceKHR* pSurface) {
4849 instanceObject := GetInstance(instance)
4850 return ?
4851}
4852
Jesse Halla6429252015-11-29 18:59:42 -08004853@extension("VK_EXT_KHR_xlib_surface")
4854cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
4855 VkPhysicalDevice physicalDevice,
4856 u32 queueFamilyIndex,
4857 platform.Display* dpy,
4858 platform.VisualID visualId) {
4859 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4860 return ?
4861}
4862
Jesse Hall1356b0d2015-11-23 17:24:58 -08004863@extension("VK_EXT_KHR_xcb_surface")
4864cmd VkResult vkCreateXCBSurfaceKHR(
4865 VkInstance instance,
4866 platform.xcb_connection_t* connection,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004867 platform.xcb_window_t window,
4868 VkSurfaceKHR* pSurface) {
4869 instanceObject := GetInstance(instance)
4870 return ?
4871}
4872
Jesse Halla6429252015-11-29 18:59:42 -08004873@extension("VK_EXT_KHR_xlib_surface")
4874cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
4875 VkPhysicalDevice physicalDevice,
4876 u32 queueFamilyIndex,
4877 platform.xcb_connection_t* connection,
4878 platform.xcb_visualid_t visual_id) {
4879 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4880 return ?
4881}
4882
Jesse Hall1356b0d2015-11-23 17:24:58 -08004883@extension("VK_EXT_KHR_wayland_surface")
4884cmd VkResult vkCreateWaylandSurfaceKHR(
4885 VkInstance instance,
4886 platform.wl_display* display,
4887 platform.wl_surface* surface,
4888 VkSurfaceKHR* pSurface) {
4889 instanceObject := GetInstance(instance)
4890 return ?
4891}
4892
Jesse Halla6429252015-11-29 18:59:42 -08004893@extension("VK_EXT_KHR_wayland_surface")
4894cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
4895 VkPhysicalDevice physicalDevice,
4896 u32 queueFamilyIndex,
4897 platform.wl_display* display) {
4898 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4899 return ?
4900}
4901
Jesse Hall1356b0d2015-11-23 17:24:58 -08004902@extension("VK_EXT_KHR_mir_surface")
4903cmd VkResult vkCreateMirSurfaceKHR(
4904 VkInstance instance,
4905 platform.MirConnection* connection,
4906 platform.MirSurface* mirSurface,
4907 VkSurfaceKHR* pSurface) {
4908 instanceObject := GetInstance(instance)
4909 return ?
4910}
4911
Jesse Halla6429252015-11-29 18:59:42 -08004912@extension("VK_EXT_KHR_mir_surface")
4913cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR(
4914 VkPhysicalDevice physicalDevice,
4915 u32 queueFamilyIndex,
4916 platform.MirConnection* connection) {
4917 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4918 return ?
4919}
4920
Jesse Hall1356b0d2015-11-23 17:24:58 -08004921@extension("VK_EXT_KHR_android_surface")
4922cmd VkResult vkCreateAndroidSurfaceKHR(
4923 VkInstance instance,
4924 platform.ANativeWindow* window
4925 VkSurfaceKHR* pSurface) {
4926 instanceObject := GetInstance(instance)
4927 return ?
4928}
4929
4930@extension("VK_EXT_KHR_win32_surface")
4931cmd VkResult vkCreateWin32SurfaceKHR(
4932 VkInstance instance,
4933 platform.HINSTANCE hinstance,
4934 platform.HWND hwnd,
4935 VkSurfaceKHR* pSurface) {
4936 instanceObject := GetInstance(instance)
4937 return ?
4938}
4939
Jesse Halla6429252015-11-29 18:59:42 -08004940@extension("VK_EXT_KHR_win32_surface")
4941cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR(
4942 VkPhysicalDevice physicalDevice,
4943 u32 queueFamilyIndex) {
4944 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4945 return ?
4946}
4947
Jesse Halld27f6aa2015-08-15 17:58:48 -07004948
4949////////////////
4950// Validation //
4951////////////////
4952
4953extern void validate(string layerName, bool condition, string message)
4954
4955
4956/////////////////////////////
4957// Internal State Tracking //
4958/////////////////////////////
4959
4960StateObject State
4961
4962@internal class StateObject {
4963 // Dispatchable objects.
4964 map!(VkInstance, ref!InstanceObject) Instances
4965 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4966 map!(VkDevice, ref!DeviceObject) Devices
4967 map!(VkQueue, ref!QueueObject) Queues
Jesse Hall3fbc8562015-11-29 22:10:52 -08004968 map!(VkCommandBuffer, ref!CommandBufferObject) CommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07004969
4970 // Non-dispatchable objects.
4971 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4972 map!(VkBuffer, ref!BufferObject) Buffers
4973 map!(VkBufferView, ref!BufferViewObject) BufferViews
4974 map!(VkImage, ref!ImageObject) Images
4975 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004976 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
4977 map!(VkShader, ref!ShaderObject) Shaders
4978 map!(VkPipeline, ref!PipelineObject) Pipelines
4979 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4980 map!(VkSampler, ref!SamplerObject) Samplers
4981 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4982 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4983 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004984 map!(VkFence, ref!FenceObject) Fences
4985 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4986 map!(VkEvent, ref!EventObject) Events
4987 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4988 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4989 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4990 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
Jesse Hall3fbc8562015-11-29 22:10:52 -08004991 map!(VkCommandPool, ref!CommandPoolObject) CommandPools
Jesse Hall1356b0d2015-11-23 17:24:58 -08004992 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces
Michael Lentine88594d72015-11-12 12:49:45 -08004993 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains
Jesse Halld27f6aa2015-08-15 17:58:48 -07004994}
4995
4996@internal class InstanceObject {
4997}
4998
4999@internal class PhysicalDeviceObject {
5000 VkInstance instance
5001}
5002
5003@internal class DeviceObject {
5004 VkPhysicalDevice physicalDevice
5005}
5006
5007@internal class QueueObject {
5008 VkDevice device
5009 VkQueueFlags flags
5010}
5011
Jesse Hall3fbc8562015-11-29 22:10:52 -08005012@internal class CommandBufferObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07005013 VkDevice device
5014 map!(u64, VkDeviceMemory) boundObjects
5015 VkQueueFlags queueFlags
5016}
5017
5018@internal class DeviceMemoryObject {
Jesse Hall3fbc8562015-11-29 22:10:52 -08005019 VkDevice device
5020 VkDeviceSize allocationSize
5021 map!(u64, VkDeviceSize) boundObjects
5022 map!(VkCommandBuffer, VkCommandBuffer) boundCommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07005023}
5024
5025@internal class BufferObject {
5026 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005027 VkDeviceMemory memory
5028 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005029}
5030
5031@internal class BufferViewObject {
5032 VkDevice device
5033 VkBuffer buffer
5034}
5035
5036@internal class ImageObject {
5037 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005038 VkDeviceMemory memory
5039 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005040}
5041
5042@internal class ImageViewObject {
5043 VkDevice device
5044 VkImage image
5045}
5046
Jesse Halld27f6aa2015-08-15 17:58:48 -07005047@internal class ShaderObject {
5048 VkDevice device
5049}
5050
5051@internal class ShaderModuleObject {
5052 VkDevice device
5053}
5054
5055@internal class PipelineObject {
5056 VkDevice device
5057}
5058
5059@internal class PipelineLayoutObject {
5060 VkDevice device
5061}
5062
5063@internal class SamplerObject {
5064 VkDevice device
5065}
5066
5067@internal class DescriptorSetObject {
5068 VkDevice device
5069}
5070
5071@internal class DescriptorSetLayoutObject {
5072 VkDevice device
5073}
5074
5075@internal class DescriptorPoolObject {
5076 VkDevice device
5077}
5078
Jesse Halld27f6aa2015-08-15 17:58:48 -07005079@internal class FenceObject {
5080 VkDevice device
5081 bool signaled
5082}
5083
5084@internal class SemaphoreObject {
5085 VkDevice device
5086}
5087
5088@internal class EventObject {
5089 VkDevice device
5090}
5091
5092@internal class QueryPoolObject {
5093 VkDevice device
5094}
5095
5096@internal class FramebufferObject {
5097 VkDevice device
5098}
5099
5100@internal class RenderPassObject {
5101 VkDevice device
5102}
5103
5104@internal class PipelineCacheObject {
5105 VkDevice device
5106}
5107
Jesse Hall3fbc8562015-11-29 22:10:52 -08005108@internal class CommandPoolObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07005109 VkDevice device
5110}
5111
Jesse Hall1356b0d2015-11-23 17:24:58 -08005112@internal class SurfaceObject {
5113 VkInstance instance
5114}
5115
Michael Lentine88594d72015-11-12 12:49:45 -08005116@internal class SwapchainObject {
5117 VkDevice device
5118}
5119
Jesse Halld27f6aa2015-08-15 17:58:48 -07005120macro ref!InstanceObject GetInstance(VkInstance instance) {
5121 assert(instance in State.Instances)
5122 return State.Instances[instance]
5123}
5124
5125macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
5126 assert(physicalDevice in State.PhysicalDevices)
5127 return State.PhysicalDevices[physicalDevice]
5128}
5129
5130macro ref!DeviceObject GetDevice(VkDevice device) {
5131 assert(device in State.Devices)
5132 return State.Devices[device]
5133}
5134
5135macro ref!QueueObject GetQueue(VkQueue queue) {
5136 assert(queue in State.Queues)
5137 return State.Queues[queue]
5138}
5139
Jesse Hall3fbc8562015-11-29 22:10:52 -08005140macro ref!CommandBufferObject GetCommandBuffer(VkCommandBuffer commandBuffer) {
5141 assert(commandBuffer in State.CommandBuffers)
5142 return State.CommandBuffers[commandBuffer]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005143}
5144
Jesse Hall3fbc8562015-11-29 22:10:52 -08005145macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory memory) {
5146 assert(memory in State.DeviceMemories)
5147 return State.DeviceMemories[memory]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005148}
5149
5150macro ref!BufferObject GetBuffer(VkBuffer buffer) {
5151 assert(buffer in State.Buffers)
5152 return State.Buffers[buffer]
5153}
5154
5155macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
5156 assert(bufferView in State.BufferViews)
5157 return State.BufferViews[bufferView]
5158}
5159
5160macro ref!ImageObject GetImage(VkImage image) {
5161 assert(image in State.Images)
5162 return State.Images[image]
5163}
5164
5165macro ref!ImageViewObject GetImageView(VkImageView imageView) {
5166 assert(imageView in State.ImageViews)
5167 return State.ImageViews[imageView]
5168}
5169
Jesse Halld27f6aa2015-08-15 17:58:48 -07005170macro ref!ShaderObject GetShader(VkShader shader) {
5171 assert(shader in State.Shaders)
5172 return State.Shaders[shader]
5173}
5174
5175macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
5176 assert(shaderModule in State.ShaderModules)
5177 return State.ShaderModules[shaderModule]
5178}
5179
5180macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
5181 assert(pipeline in State.Pipelines)
5182 return State.Pipelines[pipeline]
5183}
5184
5185macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
5186 assert(pipelineLayout in State.PipelineLayouts)
5187 return State.PipelineLayouts[pipelineLayout]
5188}
5189
5190macro ref!SamplerObject GetSampler(VkSampler sampler) {
5191 assert(sampler in State.Samplers)
5192 return State.Samplers[sampler]
5193}
5194
5195macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
5196 assert(descriptorSet in State.DescriptorSets)
5197 return State.DescriptorSets[descriptorSet]
5198}
5199
5200macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
5201 assert(descriptorSetLayout in State.DescriptorSetLayouts)
5202 return State.DescriptorSetLayouts[descriptorSetLayout]
5203}
5204
5205macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
5206 assert(descriptorPool in State.DescriptorPools)
5207 return State.DescriptorPools[descriptorPool]
5208}
5209
Jesse Halld27f6aa2015-08-15 17:58:48 -07005210macro ref!FenceObject GetFence(VkFence fence) {
5211 assert(fence in State.Fences)
5212 return State.Fences[fence]
5213}
5214
5215macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
5216 assert(semaphore in State.Semaphores)
5217 return State.Semaphores[semaphore]
5218}
5219
5220macro ref!EventObject GetEvent(VkEvent event) {
5221 assert(event in State.Events)
5222 return State.Events[event]
5223}
5224
5225macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
5226 assert(queryPool in State.QueryPools)
5227 return State.QueryPools[queryPool]
5228}
5229
5230macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
5231 assert(framebuffer in State.Framebuffers)
5232 return State.Framebuffers[framebuffer]
5233}
5234
5235macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
5236 assert(renderPass in State.RenderPasses)
5237 return State.RenderPasses[renderPass]
5238}
5239
5240macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
5241 assert(pipelineCache in State.PipelineCaches)
5242 return State.PipelineCaches[pipelineCache]
5243}
5244
Jesse Hall3fbc8562015-11-29 22:10:52 -08005245macro ref!CommandPoolObject GetCommandPool(VkCommandPool commandPool) {
5246 assert(commandPool in State.CommandPools)
5247 return State.CommandPools[commandPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07005248}
Michael Lentine88594d72015-11-12 12:49:45 -08005249
Jesse Hall1356b0d2015-11-23 17:24:58 -08005250macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) {
5251 assert(surface in State.Surfaces)
5252 return State.Surfaces[surface]
5253}
5254
Michael Lentine88594d72015-11-12 12:49:45 -08005255macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) {
5256 assert(swapchain in State.Swapchains)
5257 return State.Swapchains[swapchain]
5258}
Jesse Halld8bade02015-11-24 10:24:18 -08005259
5260macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) {
5261 return as!VkQueueFlags(as!u32(flags) | as!u32(bit))
5262}