blob: ab887fa21e26233770f83b155a8ddbe26b68adae [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 Hall65ab5522015-11-30 00:07:16 -080030define VERSION_MINOR 198
Jesse Hallae38f732015-11-19 21:32:50 -080031define VERSION_PATCH 0
Jesse Halld27f6aa2015-08-15 17:58:48 -070032
33// API limits
Jesse Hall65ab5522015-11-30 00:07:16 -080034define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256
35define VK_UUID_SIZE 16
36define VK_MAX_EXTENSION_NAME_SIZE 256
37define VK_MAX_DESCRIPTION_SIZE 256
38define VK_MAX_MEMORY_TYPES 32
39define VK_MAX_MEMORY_HEAPS 16 /// The maximum number of unique memory heaps, each of which supporting 1 or more memory types.
Jesse Halld27f6aa2015-08-15 17:58:48 -070040
41// API keywords
42define VK_TRUE 1
43define VK_FALSE 0
Jesse Hall5ae3abb2015-10-08 14:00:22 -070044
45// API keyword, but needs special handling by some templates
46define NULL_HANDLE 0
Jesse Halld27f6aa2015-08-15 17:58:48 -070047
Jesse 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
Jesse Hall65ab5522015-11-30 00:07:16 -0800192enum VkComponentSwizzle {
193 VK_COMPONENT_SWIZZLE_IDENTITY = 0x00000000,
194 VK_COMPONENT_SWIZZLE_ZERO = 0x00000001,
195 VK_COMPONENT_SWIZZLE_ONE = 0x00000002,
196 VK_COMPONENT_SWIZZLE_R = 0x00000003,
197 VK_COMPONENT_SWIZZLE_G = 0x00000004,
198 VK_COMPONENT_SWIZZLE_B = 0x00000005,
199 VK_COMPONENT_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
Jesse Hall65ab5522015-11-30 00:07:16 -0800290enum VkPolygonMode {
291 VK_POLYGON_MODE_FILL = 0x00000000,
292 VK_POLYGON_MODE_LINE = 0x00000001,
293 VK_POLYGON_MODE_POINT = 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
Jesse Hall65ab5522015-11-30 00:07:16 -0800301enum VkBlendFactor {
302 VK_BLEND_FACTOR_ZERO = 0x00000000,
303 VK_BLEND_FACTOR_ONE = 0x00000001,
304 VK_BLEND_FACTOR_SRC_COLOR = 0x00000002,
305 VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 0x00000003,
306 VK_BLEND_FACTOR_DST_COLOR = 0x00000004,
307 VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 0x00000005,
308 VK_BLEND_FACTOR_SRC_ALPHA = 0x00000006,
309 VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 0x00000007,
310 VK_BLEND_FACTOR_DST_ALPHA = 0x00000008,
311 VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 0x00000009,
312 VK_BLEND_FACTOR_CONSTANT_COLOR = 0x0000000a,
313 VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 0x0000000b,
314 VK_BLEND_FACTOR_CONSTANT_ALPHA = 0x0000000c,
315 VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 0x0000000d,
316 VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 0x0000000e,
317 VK_BLEND_FACTOR_SRC1_COLOR = 0x0000000f,
318 VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 0x00000010,
319 VK_BLEND_FACTOR_SRC1_ALPHA = 0x00000011,
320 VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 0x00000012,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700321}
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
Jesse Hall65ab5522015-11-30 00:07:16 -0800381enum VkVertexInputRate {
382 VK_VERTEX_INPUT_RATE_VERTEX = 0x00000000,
383 VK_VERTEX_INPUT_RATE_INSTANCE = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700384}
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,
Jesse Hall65ab5522015-11-30 00:07:16 -0800590 VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 24,
Jesse Hallc7467b72015-11-29 21:05:26 -0800591 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
Jesse Hall65ab5522015-11-30 00:07:16 -0800628enum VkSubpassContents {
629 VK_SUBPASS_CONTENTS_INLINE = 0x00000000,
630 VK_SUBPASS_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
Jesse Hall65ab5522015-11-30 00:07:16 -0800719 VK_QUEUE_TRANSFER_BIT = 0x00000004, /// Queue supports transfer operations
Jesse Hallb00daad2015-11-29 19:46:20 -0800720 VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, /// Queue supports sparse resource memory management operations
Jesse Halld27f6aa2015-08-15 17:58:48 -0700721}
722
723/// Memory properties passed into vkAllocMemory().
Jesse Halld8bade02015-11-24 10:24:18 -0800724type VkFlags VkMemoryPropertyFlags
725bitfield VkMemoryPropertyFlagBits {
Jesse Halld1af8122015-11-29 23:50:38 -0800726 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001,
727 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002,
728 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004,
729 VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008,
730 VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700731}
732
733/// Memory heap flags
Jesse Halld8bade02015-11-24 10:24:18 -0800734type VkFlags VkMemoryHeapFlags
735bitfield VkMemoryHeapFlagBits {
Jesse Halld1af8122015-11-29 23:50:38 -0800736 VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700737}
738
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
Jesse Hall65ab5522015-11-30 00:07:16 -0800847/// Color component flags
848type VkFlags VkColorComponentFlags
849bitfield VkColorComponentFlagBits {
850 VK_COLOR_COMPONENT_R_BIT = 0x00000001,
851 VK_COLOR_COMPONENT_G_BIT = 0x00000002,
852 VK_COLOR_COMPONENT_B_BIT = 0x00000004,
853 VK_COLOR_COMPONENT_A_BIT = 0x00000008,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700854}
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 Hall65ab5522015-11-30 00:07:16 -0800887 VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001,
Jesse Halld27f6aa2015-08-15 17:58:48 -0700888}
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 {
Jesse Hall65ab5522015-11-30 00:07:16 -08001218 f32 x
1219 f32 y
Jesse Halld27f6aa2015-08-15 17:58:48 -07001220 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
Jesse Hall65ab5522015-11-30 00:07:16 -08001237class VkComponentMapping {
1238 VkComponentSwizzle r
1239 VkComponentSwizzle g
1240 VkComponentSwizzle b
1241 VkComponentSwizzle a
Jesse Halld27f6aa2015-08-15 17:58:48 -07001242}
1243
1244class VkPhysicalDeviceProperties {
1245 u32 apiVersion
1246 u32 driverVersion
Jesse Hall65ab5522015-11-30 00:07:16 -08001247 u32 vendorID
1248 u32 deviceID
Jesse Halld27f6aa2015-08-15 17:58:48 -07001249 VkPhysicalDeviceType deviceType
Jesse Hall65ab5522015-11-30 00:07:16 -08001250 char[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE] deviceName
1251 u8[VK_UUID_SIZE] 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 Hall65ab5522015-11-30 00:07:16 -08001257 char[VK_MAX_EXTENSION_NAME_SIZE] extensionName /// extension name
Jesse Halld27f6aa2015-08-15 17:58:48 -07001258 u32 specVersion /// version of the extension specification implemented
1259}
1260
1261class VkLayerProperties {
Jesse Hall65ab5522015-11-30 00:07:16 -08001262 char[VK_MAX_EXTENSION_NAME_SIZE] layerName /// layer name
Jesse Hall3fbc8562015-11-29 22:10:52 -08001263 u32 specVersion /// version of the layer specification implemented
1264 u32 implementationVersion /// build or release version of the layer's library
Jesse Hall65ab5522015-11-30 00:07:16 -08001265 char[VK_MAX_DESCRIPTION_SIZE] 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 Hall65ab5522015-11-30 00:07:16 -08001335 VkExtent3D minImageTransferGranularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07001336}
1337
1338class VkPhysicalDeviceMemoryProperties {
1339 u32 memoryTypeCount
1340 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes
1341 u32 memoryHeapCount
1342 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps
1343}
1344
Jesse Hall3fbc8562015-11-29 22:10:52 -08001345class VkMemoryAllocateInfo {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001346 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO
1347 const void* pNext /// Pointer to next structure
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001348 VkDeviceSize allocationSize /// Size of memory allocation
Jesse Halld27f6aa2015-08-15 17:58:48 -07001349 u32 memoryTypeIndex /// Index of the of the memory type to allocate from
1350}
1351
1352class VkMemoryRequirements {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001353 VkDeviceSize size /// Specified in bytes
1354 VkDeviceSize alignment /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001355 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object
1356}
1357
1358class VkSparseImageFormatProperties {
Jesse Halld8bade02015-11-24 10:24:18 -08001359 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001360 VkExtent3D imageGranularity
1361 VkSparseImageFormatFlags flags
1362}
1363
1364class VkSparseImageMemoryRequirements {
Jesse Hallb00daad2015-11-29 19:46:20 -08001365 VkSparseImageFormatProperties formatProperties
Jesse Hall65ab5522015-11-30 00:07:16 -08001366 u32 imageMipTailStartLod
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001367 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment
1368 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment
1369 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07001370}
1371
1372class VkMemoryType {
1373 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type
1374 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from
1375}
1376
1377class VkMemoryHeap {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001378 VkDeviceSize size /// Available memory in the heap
Jesse Halld27f6aa2015-08-15 17:58:48 -07001379 VkMemoryHeapFlags flags /// Flags for the heap
1380}
1381
1382class VkMappedMemoryRange {
1383 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE
1384 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001385 VkDeviceMemory memory /// Mapped memory object
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001386 VkDeviceSize offset /// Offset within the mapped memory the range starts from
1387 VkDeviceSize size /// Size of the range within the mapped memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07001388}
1389
1390class VkFormatProperties {
1391 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling
1392 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001393 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001394}
1395
1396class VkImageFormatProperties {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001397 VkExtent3D maxExtent /// max image dimensions for this resource type
1398 u32 maxMipLevels /// max number of mipmap levels for this resource type
Jesse Halla15a4bf2015-11-19 22:48:02 -08001399 u32 maxArrayLayers /// max array layers for this resource type
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001400 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type
1401 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type
1402}
1403
Jesse Halla15a4bf2015-11-19 22:48:02 -08001404class VkDescriptorImageInfo {
1405 VkSampler sampler
1406 VkImageView imageView
1407 VkImageLayout imageLayout
1408}
1409
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001410class VkDescriptorBufferInfo {
1411 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC]
1412 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set.
1413 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update.
Jesse Halld27f6aa2015-08-15 17:58:48 -07001414}
1415
Jesse Halld27f6aa2015-08-15 17:58:48 -07001416class VkWriteDescriptorSet {
1417 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET
1418 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001419 VkDescriptorSet dstSet /// Destination descriptor set
1420 u32 dstBinding /// Binding within the destination descriptor set to write
1421 u32 dstArrayElement /// Array element within the destination binding to write
Jesse Hall03b6fe12015-11-24 12:44:21 -08001422 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001423 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 -08001424 const VkDescriptorImageInfo* pImageInfo
1425 const VkDescriptorBufferInfo* pBufferInfo
1426 const VkBufferView* pTexelBufferView
Jesse Halld27f6aa2015-08-15 17:58:48 -07001427}
1428
1429class VkCopyDescriptorSet {
1430 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET
1431 const void* pNext /// Pointer to next structure
1432 VkDescriptorSet srcSet /// Source descriptor set
1433 u32 srcBinding /// Binding within the source descriptor set to copy from
1434 u32 srcArrayElement /// Array element within the source binding to copy from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001435 VkDescriptorSet dstSet /// Destination descriptor set
1436 u32 dstBinding /// Binding within the destination descriptor set to copy to
1437 u32 dstArrayElement /// Array element within the destination binding to copy to
Jesse Hall03b6fe12015-11-24 12:44:21 -08001438 u32 descriptorCount /// Number of descriptors to copy
Jesse Halld27f6aa2015-08-15 17:58:48 -07001439}
1440
1441class VkBufferCreateInfo {
1442 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
1443 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001444 VkBufferCreateFlags flags /// Buffer creation flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001445 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001446 VkBufferUsageFlags usage /// Buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001447 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001448 u32 queueFamilyIndexCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001449 const u32* pQueueFamilyIndices
1450}
1451
1452class VkBufferViewCreateInfo {
1453 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO
1454 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001455 VkBufferViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001456 VkBuffer buffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001457 VkFormat format /// Optionally specifies format of elements
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001458 VkDeviceSize offset /// Specified in bytes
1459 VkDeviceSize range /// View size specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001460}
1461
1462class VkImageSubresource {
Jesse Halld8bade02015-11-24 10:24:18 -08001463 VkImageAspectFlagBits aspect
Jesse Halld27f6aa2015-08-15 17:58:48 -07001464 u32 mipLevel
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001465 u32 arrayLayer
Jesse Halld27f6aa2015-08-15 17:58:48 -07001466}
1467
1468class VkImageSubresourceRange {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001469 VkImageAspectFlags aspectMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001470 u32 baseMipLevel
Jesse Hall3fbc8562015-11-29 22:10:52 -08001471 u32 levelCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001472 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001473 u32 layerCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001474}
1475
1476class VkMemoryBarrier {
1477 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER
1478 const void* pNext /// Pointer to next structure.
1479 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1480 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1481}
1482
1483class VkBufferMemoryBarrier {
1484 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER
1485 const void* pNext /// Pointer to next structure.
1486 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1487 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1488 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001489 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001490 VkBuffer buffer /// Buffer to sync
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001491 VkDeviceSize offset /// Offset within the buffer to sync
1492 VkDeviceSize size /// Amount of bytes to sync
Jesse Halld27f6aa2015-08-15 17:58:48 -07001493}
1494
1495class VkImageMemoryBarrier {
1496 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
1497 const void* pNext /// Pointer to next structure.
1498 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync
1499 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to
1500 VkImageLayout oldLayout /// Current layout of the image
1501 VkImageLayout newLayout /// New layout to transition the image to
1502 u32 srcQueueFamilyIndex /// Queue family to transition ownership from
Jesse Hall3fbc8562015-11-29 22:10:52 -08001503 u32 dstQueueFamilyIndex /// Queue family to transition ownership to
Jesse Halld27f6aa2015-08-15 17:58:48 -07001504 VkImage image /// Image to sync
1505 VkImageSubresourceRange subresourceRange /// Subresource range to sync
1506}
1507
1508class VkImageCreateInfo {
1509 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
1510 const void* pNext /// Pointer to next structure.
Jesse Halla6429252015-11-29 18:59:42 -08001511 VkImageCreateFlags flags /// Image creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001512 VkImageType imageType
1513 VkFormat format
1514 VkExtent3D extent
1515 u32 mipLevels
Jesse Halla15a4bf2015-11-19 22:48:02 -08001516 u32 arrayLayers
Jesse Halld27f6aa2015-08-15 17:58:48 -07001517 u32 samples
1518 VkImageTiling tiling
1519 VkImageUsageFlags usage /// Image usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001520 VkSharingMode sharingMode /// Cross-queue-family sharing mode
Jesse Hall03b6fe12015-11-24 12:44:21 -08001521 u32 queueFamilyIndexCount /// Number of queue families to share across
Jesse Halld27f6aa2015-08-15 17:58:48 -07001522 const u32* pQueueFamilyIndices /// Array of queue family indices to share across
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001523 VkImageLayout initialLayout /// Initial image layout for all subresources
Jesse Halld27f6aa2015-08-15 17:58:48 -07001524}
1525
1526class VkSubresourceLayout {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001527 VkDeviceSize offset /// Specified in bytes
1528 VkDeviceSize size /// Specified in bytes
1529 VkDeviceSize rowPitch /// Specified in bytes
1530 VkDeviceSize depthPitch /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001531}
1532
1533class VkImageViewCreateInfo {
1534 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
1535 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001536 VkImageViewCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001537 VkImage image
1538 VkImageViewType viewType
1539 VkFormat format
Jesse Hall65ab5522015-11-30 00:07:16 -08001540 VkComponentMapping components
Jesse Halld27f6aa2015-08-15 17:58:48 -07001541 VkImageSubresourceRange subresourceRange
Jesse Halld27f6aa2015-08-15 17:58:48 -07001542}
1543
1544class VkBufferCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001545 VkDeviceSize srcOffset /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001546 VkDeviceSize dstOffset /// Specified in bytes
Jesse Hallb00daad2015-11-29 19:46:20 -08001547 VkDeviceSize size /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001548}
1549
Jesse Halla6429252015-11-29 18:59:42 -08001550class VkSparseMemoryBind {
Jesse Hallb00daad2015-11-29 19:46:20 -08001551 VkDeviceSize resourceOffset /// Specified in bytes
1552 VkDeviceSize size /// Specified in bytes
Jesse Hall3fbc8562015-11-29 22:10:52 -08001553 VkDeviceMemory memory
1554 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001555 VkSparseMemoryBindFlags flags
1556}
1557
Jesse Halla6429252015-11-29 18:59:42 -08001558class VkSparseImageMemoryBind {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001559 VkImageSubresource subresource
1560 VkOffset3D offset
1561 VkExtent3D extent
Jesse Hall3fbc8562015-11-29 22:10:52 -08001562 VkDeviceMemory memory
1563 VkDeviceSize memoryOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001564 VkSparseMemoryBindFlags flags
1565}
1566
Jesse Halla6429252015-11-29 18:59:42 -08001567class VkSparseBufferMemoryBindInfo {
1568 VkBuffer buffer
1569 u32 bindCount
1570 const VkSparseMemoryBind* pBinds
1571}
1572
1573class VkSparseImageOpaqueMemoryBindInfo {
1574 VkImage image
1575 u32 bindCount
1576 const VkSparseMemoryBind* pBinds
1577}
1578
1579class VkSparseImageMemoryBindInfo {
1580 VkImage image
1581 u32 bindCount
1582 const VkSparseMemoryBind* pBinds
1583}
1584
1585class VkBindSparseInfo {
1586 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BIND_SPARSE_INFO
1587 const void* pNext
1588 u32 waitSemaphoreCount
1589 const VkSemaphore* pWaitSemaphores
1590 u32 numBufferBinds
1591 const VkSparseBufferMemoryBindInfo* pBufferBinds
1592 u32 numImageOpaqueBinds
1593 const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds
1594 u32 numImageBinds
1595 const VkSparseImageMemoryBindInfo* pImageBinds
1596 u32 signalSemaphoreCount
1597 const VkSemaphore* pSignalSemaphores
1598}
1599
Jesse Hall65ab5522015-11-30 00:07:16 -08001600class VkImageSubresourceLayers {
1601 VkImageAspectFlags aspectMask
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001602 u32 mipLevel
Jesse Halla15a4bf2015-11-19 22:48:02 -08001603 u32 baseArrayLayer
Jesse Hall3fbc8562015-11-29 22:10:52 -08001604 u32 layerCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001605}
1606
Jesse Halld27f6aa2015-08-15 17:58:48 -07001607class VkImageCopy {
Jesse Hall65ab5522015-11-30 00:07:16 -08001608 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001609 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Hall65ab5522015-11-30 00:07:16 -08001610 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001611 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001612 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images
1613}
1614
1615class VkImageBlit {
Jesse Hall65ab5522015-11-30 00:07:16 -08001616 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001617 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images
1618 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Hall65ab5522015-11-30 00:07:16 -08001619 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001620 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images
1621 VkExtent3D dstExtent /// Specified in pixels for both compressed and uncompressed images
Jesse Halld27f6aa2015-08-15 17:58:48 -07001622}
1623
1624class VkBufferImageCopy {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001625 VkDeviceSize bufferOffset /// Specified in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001626 u32 bufferRowLength /// Specified in texels
1627 u32 bufferImageHeight
Jesse Hall65ab5522015-11-30 00:07:16 -08001628 VkImageSubresourceLayers imageSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001629 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images
1630 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images
1631}
1632
1633class VkImageResolve {
Jesse Hall65ab5522015-11-30 00:07:16 -08001634 VkImageSubresourceLayers srcSubresource
Jesse Halld27f6aa2015-08-15 17:58:48 -07001635 VkOffset3D srcOffset
Jesse Hall65ab5522015-11-30 00:07:16 -08001636 VkImageSubresourceLayers dstSubresource
Jesse Hall3fbc8562015-11-29 22:10:52 -08001637 VkOffset3D dstOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07001638 VkExtent3D extent
1639}
1640
1641class VkShaderModuleCreateInfo {
1642 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO
1643 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001644 VkShaderModuleCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001645 platform.size_t codeSize /// Specified in bytes
Jesse Halla9bb62b2015-11-21 19:31:56 -08001646 const u32* pCode /// Binary code of size codeSize
Jesse Halld27f6aa2015-08-15 17:58:48 -07001647}
1648
1649class VkShaderCreateInfo {
1650 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO
1651 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001652 VkShaderCreateFlags flags /// Reserved
Jesse Halld27f6aa2015-08-15 17:58:48 -07001653 VkShaderModule module /// Module containing entry point
1654 const char* pName /// Null-terminated entry point name
Jesse Halld8bade02015-11-24 10:24:18 -08001655 VkShaderStageFlagBits stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001656}
1657
1658class VkDescriptorSetLayoutBinding {
1659 VkDescriptorType descriptorType /// Type of the descriptors in this binding
1660 u32 arraySize /// Number of descriptors in this binding
1661 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to
1662 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements)
1663}
1664
1665class VkDescriptorSetLayoutCreateInfo {
1666 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO
1667 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001668 VkDescriptorSetLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001669 u32 bindingCount /// Number of bindings in the descriptor set layout
1670 const VkDescriptorSetLayoutBinding* pBindings /// Array of descriptor set layout bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001671}
1672
Jesse Hall65ab5522015-11-30 00:07:16 -08001673class VkDescriptorPoolSize {
Jesse Halld27f6aa2015-08-15 17:58:48 -07001674 VkDescriptorType type
Jesse Hall03b6fe12015-11-24 12:44:21 -08001675 u32 descriptorCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001676}
1677
1678class VkDescriptorPoolCreateInfo {
1679 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO
1680 const void* pNext /// Pointer to next structure
Jesse Hallfbf97b02015-11-20 14:17:03 -08001681 VkDescriptorPoolCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001682 u32 maxSets
Jesse Hall65ab5522015-11-30 00:07:16 -08001683 u32 poolSizeCount
1684 const VkDescriptorPoolSize* pPoolSizes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001685}
1686
Jesse Hall3fbc8562015-11-29 22:10:52 -08001687class VkDescriptorSetAllocateInfo {
Jesse Hallfbf97b02015-11-20 14:17:03 -08001688 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO
1689 const void* pNext /// Pointer to next structure
1690 VkDescriptorPool descriptorPool
Jesse Hall03b6fe12015-11-24 12:44:21 -08001691 u32 setCount
Jesse Hallfbf97b02015-11-20 14:17:03 -08001692 const VkDescriptorSetLayout* pSetLayouts
1693}
1694
Jesse Halld27f6aa2015-08-15 17:58:48 -07001695class VkSpecializationMapEntry {
Jesse Hall65ab5522015-11-30 00:07:16 -08001696 u32 constantID /// The SpecConstant ID specified in the BIL
Jesse Halld27f6aa2015-08-15 17:58:48 -07001697 u32 offset /// Offset of the value in the data block
Jesse Hallb00daad2015-11-29 19:46:20 -08001698 platform.size_t size /// Size in bytes of the SpecConstant
Jesse Halld27f6aa2015-08-15 17:58:48 -07001699}
1700
1701class VkSpecializationInfo {
1702 u32 mapEntryCount /// Number of entries in the map
Jesse Hallb00daad2015-11-29 19:46:20 -08001703 const VkSpecializationMapEntry* pMapEntries /// Array of map entries
Jesse Halld27f6aa2015-08-15 17:58:48 -07001704 platform.size_t dataSize /// Size in bytes of pData
1705 const void* pData /// Pointer to SpecConstant data
1706}
1707
1708class VkPipelineShaderStageCreateInfo {
1709 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO
1710 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001711 VkPipelineShaderStageCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001712 VkShader shader
1713 const VkSpecializationInfo* pSpecializationInfo
1714}
1715
1716class VkComputePipelineCreateInfo {
1717 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO
1718 const void* pNext /// Pointer to next structure
Jesse Halld27f6aa2015-08-15 17:58:48 -07001719 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001720 VkPipelineShaderStageCreateInfo stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001721 VkPipelineLayout layout /// Interface layout of the pipeline
1722 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
1723 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
1724}
1725
1726class VkVertexInputBindingDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001727 u32 binding /// Vertex buffer binding id
1728 u32 stride /// Distance between vertices in bytes (0 = no advancement)
Jesse Hall65ab5522015-11-30 00:07:16 -08001729 VkVertexInputRate inputRate /// Rate at which binding is incremented
Jesse Halld27f6aa2015-08-15 17:58:48 -07001730}
1731
1732class VkVertexInputAttributeDescription {
Jesse Hallb00daad2015-11-29 19:46:20 -08001733 u32 location /// location of the shader vertex attrib
1734 u32 binding /// Vertex buffer binding id
1735 VkFormat format /// format of source data
1736 u32 offset /// Offset of first element in bytes from base of vertex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001737}
1738
1739class VkPipelineVertexInputStateCreateInfo {
Jesse Hall03b6fe12015-11-24 12:44:21 -08001740 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO
1741 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001742 VkPipelineVertexInputStateCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001743 u32 vertexBindingDescriptionCount /// number of bindings
Jesse Halld27f6aa2015-08-15 17:58:48 -07001744 const VkVertexInputBindingDescription* pVertexBindingDescriptions
Jesse Hall03b6fe12015-11-24 12:44:21 -08001745 u32 vertexAttributeDescriptionCount /// number of attributes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001746 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions
1747}
1748
1749class VkPipelineInputAssemblyStateCreateInfo {
1750 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO
1751 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001752 VkPipelineInputAssemblyStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001753 VkPrimitiveTopology topology
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001754 VkBool32 primitiveRestartEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001755}
1756
1757class VkPipelineTessellationStateCreateInfo {
1758 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
1759 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001760 VkPipelineTessellationStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001761 u32 patchControlPoints
1762}
1763
1764class VkPipelineViewportStateCreateInfo {
1765 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
1766 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001767 VkPipelineViewportStateCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001768 u32 viewportCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001769 const VkViewport* pViewports
1770 u32 scissorCount
1771 const VkRect2D* pScissors
Jesse Halld27f6aa2015-08-15 17:58:48 -07001772}
1773
Jesse Hall3fbc8562015-11-29 22:10:52 -08001774class VkPipelineRasterizationStateCreateInfo {
Jesse Hall65ab5522015-11-30 00:07:16 -08001775 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001776 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001777 VkPipelineRasterizationStateCreateFlags flags
Jesse Hallae38f732015-11-19 21:32:50 -08001778 VkBool32 depthClampEnable
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001779 VkBool32 rasterizerDiscardEnable
Jesse Hall65ab5522015-11-30 00:07:16 -08001780 VkPolygonMode polygonMode /// optional (GL45)
Jesse Hallc7467b72015-11-29 21:05:26 -08001781 VkCullModeFlags cullMode
Jesse Halld27f6aa2015-08-15 17:58:48 -07001782 VkFrontFace frontFace
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001783 VkBool32 depthBiasEnable
Jesse Halla9bb62b2015-11-21 19:31:56 -08001784 f32 depthBiasConstantFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001785 f32 depthBiasClamp
Jesse Halla9bb62b2015-11-21 19:31:56 -08001786 f32 depthBiasSlopeFactor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001787 f32 lineWidth
Jesse Halld27f6aa2015-08-15 17:58:48 -07001788}
1789
1790class VkPipelineMultisampleStateCreateInfo {
1791 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO
1792 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001793 VkPipelineMultisampleStateCreateFlags flags
Jesse Hall3fbc8562015-11-29 22:10:52 -08001794 u32 rasterizationSamples /// Number of samples used for rasterization
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001795 VkBool32 sampleShadingEnable /// optional (GL45)
Jesse Halld27f6aa2015-08-15 17:58:48 -07001796 f32 minSampleShading /// optional (GL45)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001797 const VkSampleMask* pSampleMask
Jesse Hallacfa5342015-11-19 21:51:33 -08001798 VkBool32 alphaToCoverageEnable
1799 VkBool32 alphaToOneEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001800}
1801
1802class VkPipelineColorBlendAttachmentState {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001803 VkBool32 blendEnable
Jesse Hall65ab5522015-11-30 00:07:16 -08001804 VkBlendFactor srcColorBlendFactor
1805 VkBlendFactor dstColorBlendFactor
1806 VkBlendOp colorBlendOp
1807 VkBlendFactor srcAlphaBlendFactor
1808 VkBlendFactor dstAlphaBlendFactor
1809 VkBlendOp alphaBlendOp
1810 VkColorComponentFlags colorWriteMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07001811}
1812
1813class VkPipelineColorBlendStateCreateInfo {
1814 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO
1815 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001816 VkPipelineColorBlendStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001817 VkBool32 logicOpEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001818 VkLogicOp logicOp
1819 u32 attachmentCount /// # of pAttachments
1820 const VkPipelineColorBlendAttachmentState* pAttachments
Jesse Hallb00daad2015-11-29 19:46:20 -08001821 f32[4] blendConstants
Jesse Halld27f6aa2015-08-15 17:58:48 -07001822}
1823
1824class VkStencilOpState {
Jesse Hall65ab5522015-11-30 00:07:16 -08001825 VkStencilOp failOp
1826 VkStencilOp passOp
1827 VkStencilOp depthFailOp
1828 VkCompareOp compareOp
1829 u32 compareMask
1830 u32 writeMask
1831 u32 reference
Jesse Halld27f6aa2015-08-15 17:58:48 -07001832}
1833
1834class VkPipelineDepthStencilStateCreateInfo {
1835 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
1836 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001837 VkPipelineDepthStencilStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001838 VkBool32 depthTestEnable
1839 VkBool32 depthWriteEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001840 VkCompareOp depthCompareOp
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001841 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test)
1842 VkBool32 stencilTestEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001843 VkStencilOpState front
1844 VkStencilOpState back
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001845 f32 minDepthBounds
1846 f32 maxDepthBounds
1847}
1848
1849class VkPipelineDynamicStateCreateInfo {
1850 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO
1851 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001852 VkPipelineDynamicStateCreateFlags flags
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001853 u32 dynamicStateCount
1854 const VkDynamicState* pDynamicStates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001855}
1856
1857class VkGraphicsPipelineCreateInfo {
Jesse Halla6429252015-11-29 18:59:42 -08001858 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
1859 const void* pNext /// Pointer to next structure
1860 VkPipelineCreateFlags flags /// Pipeline creation flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001861 u32 stageCount
Jesse Halla6429252015-11-29 18:59:42 -08001862 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage
Jesse Halld27f6aa2015-08-15 17:58:48 -07001863 const VkPipelineVertexInputStateCreateInfo* pVertexInputState
1864 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState
1865 const VkPipelineTessellationStateCreateInfo* pTessellationState
1866 const VkPipelineViewportStateCreateInfo* pViewportState
Jesse Hall3fbc8562015-11-29 22:10:52 -08001867 const VkPipelineRasterizationStateCreateInfo* pRasterizationState
Jesse Halld27f6aa2015-08-15 17:58:48 -07001868 const VkPipelineMultisampleStateCreateInfo* pMultisampleState
1869 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState
1870 const VkPipelineColorBlendStateCreateInfo* pColorBlendState
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001871 const VkPipelineDynamicStateCreateInfo* pDynamicState
Jesse Halla6429252015-11-29 18:59:42 -08001872 VkPipelineLayout layout /// Interface layout of the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001873 VkRenderPass renderPass
1874 u32 subpass
Jesse Halla6429252015-11-29 18:59:42 -08001875 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
1876 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 -07001877}
1878
1879class VkPipelineCacheCreateInfo {
Jesse Hallb00daad2015-11-29 19:46:20 -08001880 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
1881 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001882 VkPipelineCacheCreateFlags flags
Jesse Hallb00daad2015-11-29 19:46:20 -08001883 platform.size_t initialDataSize /// Size of initial data to populate cache, in bytes
1884 const void* pInitialData /// Initial data to populate cache
Jesse Halld27f6aa2015-08-15 17:58:48 -07001885}
1886
1887class VkPushConstantRange {
1888 VkShaderStageFlags stageFlags /// Which stages use the range
Jesse Hall03b6fe12015-11-24 12:44:21 -08001889 u32 offset /// Start of the range, in bytes
1890 u32 size /// Length of the range, in bytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07001891}
1892
1893class VkPipelineLayoutCreateInfo {
1894 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO
1895 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001896 VkPipelineLayoutCreateFlags flags
Jesse Hall03b6fe12015-11-24 12:44:21 -08001897 u32 setLayoutCount /// Number of descriptor sets interfaced by the pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07001898 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the
1899 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline
1900 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages
1901}
1902
1903class VkSamplerCreateInfo {
1904 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
1905 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08001906 VkSamplerCreateFlags flags
Jesse Hall23ff73f2015-11-29 14:36:39 -08001907 VkFilter magFilter /// Filter mode for magnification
1908 VkFilter minFilter /// Filter mode for minifiation
1909 VkSamplerMipmapMode mipmapMode /// Mipmap selection mode
1910 VkSamplerAddressMode addressModeU
1911 VkSamplerAddressMode addressModeV
1912 VkSamplerAddressMode addressModeW
Jesse Halld27f6aa2015-08-15 17:58:48 -07001913 f32 mipLodBias
1914 f32 maxAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001915 VkBool32 compareEnable
Jesse Halld27f6aa2015-08-15 17:58:48 -07001916 VkCompareOp compareOp
1917 f32 minLod
1918 f32 maxLod
1919 VkBorderColor borderColor
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001920 VkBool32 unnormalizedCoordinates
Jesse Halld27f6aa2015-08-15 17:58:48 -07001921}
1922
Jesse Hall3fbc8562015-11-29 22:10:52 -08001923class VkCommandPoolCreateInfo {
1924 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001925 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001926 VkCommandPoolCreateFlags flags /// Command pool creation flags
Jesse Halla6429252015-11-29 18:59:42 -08001927 u32 queueFamilyIndex
Jesse Halld27f6aa2015-08-15 17:58:48 -07001928}
1929
Jesse Hall3fbc8562015-11-29 22:10:52 -08001930class VkCommandBufferAllocateInfo {
1931 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOC_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001932 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001933 VkCommandPool commandPool
1934 VkCommandBufferLevel level
Jesse Hall03b6fe12015-11-24 12:44:21 -08001935 u32 bufferCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07001936}
1937
Jesse Hall3fbc8562015-11-29 22:10:52 -08001938class VkCommandBufferBeginInfo {
1939 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
Jesse Halld27f6aa2015-08-15 17:58:48 -07001940 const void* pNext /// Pointer to next structure
Jesse Hall3fbc8562015-11-29 22:10:52 -08001941 VkCommandBufferUsageFlags flags /// Command buffer usage flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001942 VkRenderPass renderPass /// Render pass for secondary command buffers
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001943 u32 subpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07001944 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers
1945}
1946
1947class VkRenderPassBeginInfo {
1948 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
1949 const void* pNext /// Pointer to next structure
1950 VkRenderPass renderPass
1951 VkFramebuffer framebuffer
1952 VkRect2D renderArea
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001953 u32 clearValueCount
1954 const VkClearValue* pClearValues
Jesse Halld27f6aa2015-08-15 17:58:48 -07001955}
1956
1957@union
1958/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared.
1959class VkClearColorValue {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001960 f32[4] float32
1961 s32[4] int32
1962 u32[4] uint32
Jesse Halld27f6aa2015-08-15 17:58:48 -07001963}
1964
1965class VkClearDepthStencilValue {
1966 f32 depth
1967 u32 stencil
1968}
1969
1970@union
1971/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared.
1972class VkClearValue {
1973 VkClearColorValue color
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001974 VkClearDepthStencilValue depthStencil
Jesse Halld27f6aa2015-08-15 17:58:48 -07001975}
1976
Jesse Hallae38f732015-11-19 21:32:50 -08001977class VkClearAttachment {
1978 VkImageAspectFlags aspectMask
1979 u32 colorAttachment
1980 VkClearValue clearValue
1981}
1982
Jesse Halld27f6aa2015-08-15 17:58:48 -07001983class VkAttachmentDescription {
Jesse Halla6429252015-11-29 18:59:42 -08001984 VkAttachmentDescriptionFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07001985 VkFormat format
1986 u32 samples
1987 VkAttachmentLoadOp loadOp /// Load op for color or depth data
1988 VkAttachmentStoreOp storeOp /// Store op for color or depth data
1989 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data
1990 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data
1991 VkImageLayout initialLayout
1992 VkImageLayout finalLayout
1993}
1994
1995class VkAttachmentReference {
1996 u32 attachment
1997 VkImageLayout layout
1998}
1999
2000class VkSubpassDescription {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002001 VkSubpassDescriptionFlags flags
Jesse Halla6429252015-11-29 18:59:42 -08002002 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now
Jesse Hall03b6fe12015-11-24 12:44:21 -08002003 u32 inputAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002004 const VkAttachmentReference* pInputAttachments
Jesse Hall03b6fe12015-11-24 12:44:21 -08002005 u32 colorAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002006 const VkAttachmentReference* pColorAttachments
2007 const VkAttachmentReference* pResolveAttachments
Jesse Hallc7467b72015-11-29 21:05:26 -08002008 const VkAttachmentReference* pDepthStencilAttachment
Jesse Hall03b6fe12015-11-24 12:44:21 -08002009 u32 preserveAttachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002010 const VkAttachmentReference* pPreserveAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002011}
2012
2013class VkSubpassDependency {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002014 u32 srcSubpass
Jesse Hall3fbc8562015-11-29 22:10:52 -08002015 u32 dstSubpass
Jesse Halld27f6aa2015-08-15 17:58:48 -07002016 VkPipelineStageFlags srcStageMask
Jesse Hall3fbc8562015-11-29 22:10:52 -08002017 VkPipelineStageFlags dstStageMask
Jesse Halld27f6aa2015-08-15 17:58:48 -07002018 VkMemoryOutputFlags outputMask
2019 VkMemoryInputFlags inputMask
Jesse Halldc6d36c2015-11-29 19:12:15 -08002020 VkDependencyFlags dependencyFlags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002021}
2022
2023class VkRenderPassCreateInfo {
2024 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO
2025 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002026 VkRenderPassCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002027 u32 attachmentCount
2028 const VkAttachmentDescription* pAttachments
2029 u32 subpassCount
2030 const VkSubpassDescription* pSubpasses
2031 u32 dependencyCount
2032 const VkSubpassDependency* pDependencies
2033}
2034
2035class VkEventCreateInfo {
2036 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO
2037 const void* pNext /// Pointer to next structure
2038 VkEventCreateFlags flags /// Event creation flags
2039}
2040
2041class VkFenceCreateInfo {
2042 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
2043 const void* pNext /// Pointer to next structure
2044 VkFenceCreateFlags flags /// Fence creation flags
2045}
2046
2047class VkPhysicalDeviceFeatures {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002048 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined
2049 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls
2050 VkBool32 imageCubeArray /// image views which are arrays of cube maps
2051 VkBool32 independentBlend /// blending operations are controlled per-attachment
2052 VkBool32 geometryShader /// geometry stage
2053 VkBool32 tessellationShader /// tessellation control and evaluation stage
2054 VkBool32 sampleRateShading /// per-sample shading and interpolation
Jesse Hall3fbc8562015-11-29 22:10:52 -08002055 VkBool32 dualSrcBlend /// blend operations which take two sources
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002056 VkBool32 logicOp /// logic operations
2057 VkBool32 multiDrawIndirect /// multi draw indirect
Jesse Hallae38f732015-11-19 21:32:50 -08002058 VkBool32 depthClamp /// depth clamping
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002059 VkBool32 depthBiasClamp /// depth bias clamping
2060 VkBool32 fillModeNonSolid /// point and wireframe fill modes
2061 VkBool32 depthBounds /// depth bounds test
2062 VkBool32 wideLines /// lines with width greater than 1
2063 VkBool32 largePoints /// points with size greater than 1
Jesse Hallfbf97b02015-11-20 14:17:03 -08002064 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value
2065 VkBool32 multiViewport
2066 VkBool32 samplerAnisotropy
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002067 VkBool32 textureCompressionETC2 /// ETC texture compression formats
2068 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats
2069 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats
Jesse Hall65ab5522015-11-30 00:07:16 -08002070 VkBool32 occlusionQueryPrecise
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002071 VkBool32 pipelineStatisticsQuery /// pipeline statistics query
Jesse Halldc6d36c2015-11-29 19:12:15 -08002072 VkBool32 vertexPipelineStoresAndAtomics
2073 VkBool32 fragmentStoresAndAtomics
2074 VkBool32 shaderTessellationAndGeometryPointSize
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002075 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets
2076 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images
2077 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images
Jesse Halld1af8122015-11-29 23:50:38 -08002078 VkBool32 shaderStorageImageReadWithoutFormat
2079 VkBool32 shaderStorageImageWriteWithoutFormat
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002080 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices
2081 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices
2082 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices
2083 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices
2084 VkBool32 shaderClipDistance /// clip distance in shaders
2085 VkBool32 shaderCullDistance /// cull distance in shaders
2086 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders
2087 VkBool32 shaderInt64 /// 64-bit integers in shaders
2088 VkBool32 shaderInt16 /// 16-bit integers in shaders
2089 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support)
Jesse Hall65ab5522015-11-30 00:07:16 -08002090 VkBool32 shaderResourceMinLod /// shader can use texture operations that specify minimum resource LOD
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002091 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level
2092 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers
2093 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images
2094 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images
2095 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples
2096 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples
2097 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples
2098 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples
2099 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in)
Jesse Halld1af8122015-11-29 23:50:38 -08002100 VkBool32 variableMultisampleRate
Jesse Halld27f6aa2015-08-15 17:58:48 -07002101}
2102
2103class VkPhysicalDeviceLimits {
2104 /// resource maximum sizes
2105 u32 maxImageDimension1D /// max 1D image dimension
2106 u32 maxImageDimension2D /// max 2D image dimension
2107 u32 maxImageDimension3D /// max 3D image dimension
2108 u32 maxImageDimensionCube /// max cubemap image dimension
2109 u32 maxImageArrayLayers /// max layers for image arrays
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002110 VkSampleCountFlags sampleCounts /// sample counts supported for all images supporting rendering and sampling
Jesse Hallb00daad2015-11-29 19:46:20 -08002111 u32 maxTexelBufferElements
Jesse Hallfbf97b02015-11-20 14:17:03 -08002112 u32 maxUniformBufferRange /// max uniform buffer size (bytes)
2113 u32 maxStorageBufferRange /// max storage buffer size (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002114 u32 maxPushConstantsSize /// max size of the push constants pool (bytes)
2115 /// memory limits
2116 u32 maxMemoryAllocationCount /// max number of device memory allocations supported
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002117 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage
2118 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002119 /// descriptor set limits
2120 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline
Jesse Halld27f6aa2015-08-15 17:58:48 -07002121 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set
2122 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set
2123 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set
2124 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set
2125 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set
2126 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set
2127 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002128 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002129 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002130 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set
Jesse Halld27f6aa2015-08-15 17:58:48 -07002131 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set
2132 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set
2133 /// vertex stage limits
2134 u32 maxVertexInputAttributes /// max num of vertex input attribute slots
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002135 u32 maxVertexInputBindings /// max num of vertex input binding slots
Jesse Halld27f6aa2015-08-15 17:58:48 -07002136 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset
2137 u32 maxVertexInputBindingStride /// max vertex input binding stride
2138 u32 maxVertexOutputComponents /// max num of output components written by vertex shader
2139 /// tessellation control stage limits
Jesse Hall3fbc8562015-11-29 22:10:52 -08002140 u32 maxTessellationGenerationLevel /// max level supported by tess primitive generator
Jesse Hallae38f732015-11-19 21:32:50 -08002141 u32 maxTessellationPatchSize /// max patch size (vertices)
2142 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS
2143 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS
2144 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS
2145 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS
2146 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES
2147 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES
Jesse Halld27f6aa2015-08-15 17:58:48 -07002148 /// geometry stage limits
2149 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader
2150 u32 maxGeometryInputComponents /// max num of input components read in geometry stage
2151 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage
2152 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage
2153 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage
2154 /// fragment stage limits
2155 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage
Jesse Hallfbf97b02015-11-20 14:17:03 -08002156 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage
Jesse Hall3fbc8562015-11-29 22:10:52 -08002157 u32 maxFragmentDualSrcAttachments /// max num of output attachments written when using dual source blending
Jesse Halld27f6aa2015-08-15 17:58:48 -07002158 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers
2159 /// compute stage limits
2160 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes)
2161 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z)
2162 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group
2163 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z)
2164
2165 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y
2166 u32 subTexelPrecisionBits /// num bits of subtexel precision
2167 u32 mipmapPrecisionBits /// num bits of mipmap precision
2168
2169 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices)
2170 u32 maxDrawIndirectInstanceCount /// max instance count for indirect draw calls
Jesse Halld27f6aa2015-08-15 17:58:48 -07002171
2172 f32 maxSamplerLodBias /// max absolute sampler level of detail bias
2173 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy
2174
2175 u32 maxViewports /// max number of active viewports
Jesse Halld27f6aa2015-08-15 17:58:48 -07002176 u32[2] maxViewportDimensions /// max viewport dimensions (x,y)
2177 f32[2] viewportBoundsRange /// viewport bounds range (min,max)
2178 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport
2179
Jesse Halldc6d36c2015-11-29 19:12:15 -08002180 platform.size_t minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes)
2181 VkDeviceSize minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes)
2182 VkDeviceSize minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes)
2183 VkDeviceSize minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002184
Jesse Hallfbf97b02015-11-20 14:17:03 -08002185 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002186 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset
Jesse Hallfbf97b02015-11-20 14:17:03 -08002187 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002188 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset
2189 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset
2190 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset
2191 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset
2192
2193 u32 maxFramebufferWidth /// max width for a framebuffer
2194 u32 maxFramebufferHeight /// max height for a framebuffer
2195 u32 maxFramebufferLayers /// max layer count for a layered framebuffer
2196 u32 maxFramebufferColorSamples /// max color sample count for a framebuffer
2197 u32 maxFramebufferDepthSamples /// max depth sample count for a framebuffer
2198 u32 maxFramebufferStencilSamples /// max stencil sample count for a framebuffer
2199 u32 maxColorAttachments /// max num of framebuffer color attachments
2200
2201 u32 maxSampledImageColorSamples /// max num of color samples for a non-integer sampled image
Jesse Hallc7467b72015-11-29 21:05:26 -08002202 u32 maxSampledImageDepthSamples /// max num of depth samples for a sampled image
2203 u32 maxSampledImageStencilSamples /// max num of stencil samples for a sampled image
Jesse Halld27f6aa2015-08-15 17:58:48 -07002204 u32 maxSampledImageIntegerSamples /// max num of samples supported for an integer image
2205 u32 maxStorageImageSamples /// max num of samples for a storage image
2206 u32 maxSampleMaskWords /// max num of sample mask words
2207
Jesse Halla9bb62b2015-11-21 19:31:56 -08002208 f32 timestampPeriod
Jesse Halld27f6aa2015-08-15 17:58:48 -07002209
2210 u32 maxClipDistances /// max number of clip distances
2211 u32 maxCullDistances /// max number of cull distances
2212 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping
2213
Jesse Hallfbf97b02015-11-20 14:17:03 -08002214 u32 discreteQueuePriorities
2215
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002216 f32[2] pointSizeRange /// range (min,max) of supported point sizes
2217 f32[2] lineWidthRange /// range (min,max) of supported line widths
Jesse Halld27f6aa2015-08-15 17:58:48 -07002218 f32 pointSizeGranularity /// granularity of supported point sizes
2219 f32 lineWidthGranularity /// granularity of supported line widths
Jesse Hall03b6fe12015-11-24 12:44:21 -08002220 VkBool32 strictLines
Jesse Halla9bb62b2015-11-21 19:31:56 -08002221
Jesse Hall65ab5522015-11-30 00:07:16 -08002222 VkDeviceSize optimalBufferCopyOffsetAlignment
2223 VkDeviceSize optimalBufferCopyRowPitchAlignment
Jesse Halld27f6aa2015-08-15 17:58:48 -07002224}
2225
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002226class VkPhysicalDeviceSparseProperties {
2227 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 -08002228 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 -07002229 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format)
2230 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 -07002231 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
2232}
2233
Jesse Halld27f6aa2015-08-15 17:58:48 -07002234class VkSemaphoreCreateInfo {
2235 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
2236 const void* pNext /// Pointer to next structure
2237 VkSemaphoreCreateFlags flags /// Semaphore creation flags
2238}
2239
2240class VkQueryPoolCreateInfo {
2241 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO
2242 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002243 VkQueryPoolCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002244 VkQueryType queryType
Jesse Hall65ab5522015-11-30 00:07:16 -08002245 u32 entryCount
Jesse Halld27f6aa2015-08-15 17:58:48 -07002246 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional
2247}
2248
2249class VkFramebufferCreateInfo {
2250 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
2251 const void* pNext /// Pointer to next structure
Jesse Halla6429252015-11-29 18:59:42 -08002252 VkFramebufferCreateFlags flags
Jesse Halld27f6aa2015-08-15 17:58:48 -07002253 VkRenderPass renderPass
2254 u32 attachmentCount
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002255 const VkImageView* pAttachments
Jesse Halld27f6aa2015-08-15 17:58:48 -07002256 u32 width
2257 u32 height
2258 u32 layers
2259}
2260
Jesse Hall3fbc8562015-11-29 22:10:52 -08002261class VkDrawIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002262 u32 vertexCount
2263 u32 instanceCount
2264 u32 firstVertex
2265 u32 firstInstance
2266}
2267
Jesse Hall3fbc8562015-11-29 22:10:52 -08002268class VkDrawIndexedIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002269 u32 indexCount
2270 u32 instanceCount
2271 u32 firstIndex
2272 s32 vertexOffset
2273 u32 firstInstance
2274}
2275
Jesse Hall3fbc8562015-11-29 22:10:52 -08002276class VkDispatchIndirectCommand {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002277 u32 x
2278 u32 y
2279 u32 z
2280}
2281
Jesse Hallb00daad2015-11-29 19:46:20 -08002282@extension("VK_EXT_KHR_surface")
2283class VkSurfaceCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002284 u32 minImageCount
2285 u32 maxImageCount
2286 VkExtent2D currentExtent
2287 VkExtent2D minImageExtent
2288 VkExtent2D maxImageExtent
2289 VkSurfaceTransformFlagsKHR supportedTransforms
2290 VkSurfaceTransformKHR currentTransform
Jesse Halla6429252015-11-29 18:59:42 -08002291 VkCompositeAlphaFlagsKHR supportedCompositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002292 u32 maxImageArraySize
2293 VkImageUsageFlags supportedUsageFlags
Michael Lentine88594d72015-11-12 12:49:45 -08002294}
2295
Jesse Hallb00daad2015-11-29 19:46:20 -08002296@extension("VK_EXT_KHR_surface")
Michael Lentine88594d72015-11-12 12:49:45 -08002297class VkSurfaceFormatKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002298 VkFormat format
2299 VkColorSpaceKHR colorSpace
Michael Lentine88594d72015-11-12 12:49:45 -08002300}
2301
Jesse Hall1356b0d2015-11-23 17:24:58 -08002302@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002303class VkSwapchainCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002304 VkStructureType sType
2305 const void* pNext
2306 VkSurfaceKHR surface
2307 u32 minImageCount
2308 VkFormat imageFormat
2309 VkColorSpaceKHR imageColorSpace
2310 VkExtent2D imageExtent
2311 VkImageUsageFlags imageUsageFlags
2312 VkSurfaceTransformKHR preTransform
Jesse Halla6429252015-11-29 18:59:42 -08002313 VkCompositeAlphaFlagBitsKHR compositeAlpha
Jesse Hall1356b0d2015-11-23 17:24:58 -08002314 u32 imageArraySize
2315 VkSharingMode sharingMode
Jesse Hall03b6fe12015-11-24 12:44:21 -08002316 u32 queueFamilyIndexCount
Jesse Hall1356b0d2015-11-23 17:24:58 -08002317 const u32* pQueueFamilyIndices
2318 VkPresentModeKHR presentMode
2319 VkSwapchainKHR oldSwapchain
2320 VkBool32 clipped
Michael Lentine88594d72015-11-12 12:49:45 -08002321}
2322
Jesse Hall1356b0d2015-11-23 17:24:58 -08002323@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08002324class VkPresentInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002325 VkStructureType sType
2326 const void* pNext
Jesse Hallb00daad2015-11-29 19:46:20 -08002327 u32 waitSemaphoreCount
2328 const VkSemaphore* pWaitSemaphores
Jesse Hall1356b0d2015-11-23 17:24:58 -08002329 u32 swapchainCount
Jesse Hall03b6fe12015-11-24 12:44:21 -08002330 const VkSwapchainKHR* pSwapchains
Jesse Hall1356b0d2015-11-23 17:24:58 -08002331 const u32* imageIndices
Michael Lentine88594d72015-11-12 12:49:45 -08002332}
2333
Jesse Hall1356b0d2015-11-23 17:24:58 -08002334@extension("VK_EXT_KHR_display")
2335class VkDisplayPropertiesKHR {
2336 VkDisplayKHR display
2337 const char* displayName
2338 VkExtent2D physicalDimensions
2339 VkExtent2D physicalResolution
2340 VkSurfaceTransformFlagsKHR supportedTransforms
Jesse Hall1356b0d2015-11-23 17:24:58 -08002341 VkBool32 planeReorderPossible
Jesse Halla6429252015-11-29 18:59:42 -08002342 VkBool32 persistentContent
Michael Lentine88594d72015-11-12 12:49:45 -08002343}
2344
Jesse Hall1356b0d2015-11-23 17:24:58 -08002345@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002346class VkDisplayModeParametersKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002347 VkExtent2D visibleRegion
Jesse Halla6429252015-11-29 18:59:42 -08002348 u32 refreshRate
Michael Lentine88594d72015-11-12 12:49:45 -08002349}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002350
Jesse Hall1356b0d2015-11-23 17:24:58 -08002351@extension("VK_EXT_KHR_display")
2352class VkDisplayModePropertiesKHR {
2353 VkDisplayModeKHR displayMode
Jesse Halla6429252015-11-29 18:59:42 -08002354 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002355}
2356
2357@extension("VK_EXT_KHR_display")
2358class VkDisplayModeCreateInfoKHR {
2359 VkStructureType sType
2360 const void* pNext
Jesse Halla6429252015-11-29 18:59:42 -08002361 VkDisplayModeParametersKHR parameters
Jesse Hall1356b0d2015-11-23 17:24:58 -08002362}
2363
2364@extension("VK_EXT_KHR_display")
2365class VkDisplayPlanePropertiesKHR {
Jesse Halla6429252015-11-29 18:59:42 -08002366 VkDisplayKHR currentDisplay
2367 u32 currentStackIndex
2368}
2369
2370@extension("VK_EXT_KHR_display")
2371class VkDisplayPlaneCapabilitiesKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002372 VkDisplayPlaneAlphaFlagsKHR supportedAlpha
2373 VkOffset2D minSrcPosition
2374 VkOffset2D maxSrcPosition
2375 VkExtent2D minSrcExtent
2376 VkExtent2D maxSrcExtent
2377 VkOffset2D minDstPosition
2378 VkOffset2D maxDstPosition
2379 VkExtent2D minDstExtent
2380 VkExtent2D maxDstExtent
2381}
2382
2383@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08002384class VkDisplaySurfaceCreateInfoKHR {
Jesse Hall1356b0d2015-11-23 17:24:58 -08002385 VkStructureType sType
2386 const void* pNext
2387 VkDisplayModeKHR displayMode
2388 u32 planeIndex
2389 u32 planeStackIndex
2390 VkSurfaceTransformKHR transform
2391 f32 globalAlpha
2392 VkDisplayPlaneAlphaFlagsKHR alphaMode
2393 VkExtent2D imageSize
2394}
2395
2396@extension("VK_EXT_KHR_display_swapchain")
2397class VkDisplaySwapchainCreateInfoKHR {
2398 VkStructureType sType
2399 const void* pNext
2400 const VkSwapchainCreateInfoKHR* pNextSwapchainCreateInfo
2401}
2402
2403@extension("VK_EXT_KHR_display_swapchain")
2404class VkDisplayPresentInfoKHR {
2405 VkStructureType sType
2406 const void* pNext
2407 VkRect2D srcRect
2408 VkRect2D dstRect
Jesse Halla6429252015-11-29 18:59:42 -08002409 VkBool32 persistent
Jesse Hall1356b0d2015-11-23 17:24:58 -08002410}
2411
2412
Jesse Halld27f6aa2015-08-15 17:58:48 -07002413////////////////
2414// Commands //
2415////////////////
2416
2417// Function pointers. TODO: add support for function pointers.
2418
2419@external type void* PFN_vkVoidFunction
2420@pfn cmd void vkVoidFunction() {
2421}
2422
Jesse Hall3fbc8562015-11-29 22:10:52 -08002423@external type void* PFN_vkAllocationFunction
2424@pfn cmd void* vkAllocationFunction(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002425 void* pUserData,
2426 platform.size_t size,
2427 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002428 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002429 return ?
2430}
2431
Jesse Hall3fbc8562015-11-29 22:10:52 -08002432@external type void* PFN_vkReallocationFunction
2433@pfn cmd void* vkReallocationFunction(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002434 void* pUserData,
2435 void* pOriginal,
2436 platform.size_t size,
2437 platform.size_t alignment,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002438 VkSystemAllocationScope allocationScope) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002439 return ?
2440}
2441
2442@external type void* PFN_vkFreeFunction
2443@pfn cmd void vkFreeFunction(
2444 void* pUserData,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002445 void* pMemory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002446}
2447
Jesse Hall3fbc8562015-11-29 22:10:52 -08002448@external type void* PFN_vkInternalAllocationNotification
2449@pfn cmd void vkInternalAllocationNotification(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002450 void* pUserData,
2451 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002452 VkInternalAllocationType allocationType,
2453 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002454}
2455
2456@external type void* PFN_vkInternalFreeNotification
2457@pfn cmd void vkInternalFreeNotification(
2458 void* pUserData,
2459 platform.size_t size,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002460 VkInternalAllocationType allocationType,
2461 VkSystemAllocationScope allocationScope) {
Jesse Hall03b6fe12015-11-24 12:44:21 -08002462}
Jesse Halld27f6aa2015-08-15 17:58:48 -07002463
2464// Global functions
2465
2466@threadSafety("system")
2467cmd VkResult vkCreateInstance(
2468 const VkInstanceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002469 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002470 VkInstance* pInstance) {
2471 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
2472
2473 instance := ?
2474 pInstance[0] = instance
2475 State.Instances[instance] = new!InstanceObject()
2476
Jesse Hall03b6fe12015-11-24 12:44:21 -08002477 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount]
2478 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount]
Jesse Halld27f6aa2015-08-15 17:58:48 -07002479
2480 return ?
2481}
2482
2483@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002484cmd void vkDestroyInstance(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002485 VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002486 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002487 instanceObject := GetInstance(instance)
2488
2489 State.Instances[instance] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002490}
2491
2492@threadSafety("system")
2493cmd VkResult vkEnumeratePhysicalDevices(
2494 VkInstance instance,
2495 u32* pPhysicalDeviceCount,
2496 VkPhysicalDevice* pPhysicalDevices) {
2497 instanceObject := GetInstance(instance)
2498
2499 physicalDeviceCount := as!u32(?)
2500 pPhysicalDeviceCount[0] = physicalDeviceCount
2501 physicalDevices := pPhysicalDevices[0:physicalDeviceCount]
2502
2503 for i in (0 .. physicalDeviceCount) {
2504 physicalDevice := ?
2505 physicalDevices[i] = physicalDevice
2506 if !(physicalDevice in State.PhysicalDevices) {
2507 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance)
2508 }
2509 }
2510
2511 return ?
2512}
2513
2514cmd PFN_vkVoidFunction vkGetDeviceProcAddr(
2515 VkDevice device,
2516 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002517 if device != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002518 device := GetDevice(device)
2519 }
2520
2521 return ?
2522}
2523
2524cmd PFN_vkVoidFunction vkGetInstanceProcAddr(
2525 VkInstance instance,
2526 const char* pName) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002527 if instance != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002528 instanceObject := GetInstance(instance)
2529 }
2530
2531 return ?
2532}
2533
Jesse Hall606a54e2015-11-19 22:17:28 -08002534cmd void vkGetPhysicalDeviceProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002535 VkPhysicalDevice physicalDevice,
2536 VkPhysicalDeviceProperties* pProperties) {
2537 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2538
2539 properties := ?
2540 pProperties[0] = properties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002541}
2542
Jesse Hall606a54e2015-11-19 22:17:28 -08002543cmd void vkGetPhysicalDeviceQueueFamilyProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002544 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002545 u32* pQueueFamilyPropertyCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002546 VkQueueFamilyProperties* pQueueFamilyProperties) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002547 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002548 // TODO: Figure out how to express fetch-count-or-properties
2549 // This version fails 'apic validate' with 'fence not allowed in
2550 // *semantic.Branch'. Other attempts have failed with the same or other
2551 // errors.
2552 // if pQueueFamilyProperties != null {
2553 // queuesProperties := pQueueFamilyProperties[0:pCount[0]]
2554 // for i in (0 .. pCount[0]) {
2555 // queueProperties := as!VkQueueFamilyProperties(?)
2556 // queuesProperties[i] = queueProperties
2557 // }
2558 // } else {
2559 // count := ?
2560 // pCount[0] = count
2561 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002562}
2563
Jesse Hall606a54e2015-11-19 22:17:28 -08002564cmd void vkGetPhysicalDeviceMemoryProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002565 VkPhysicalDevice physicalDevice,
2566 VkPhysicalDeviceMemoryProperties* pMemoryProperties) {
2567 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2568
2569 memoryProperties := ?
2570 pMemoryProperties[0] = memoryProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002571}
2572
Jesse Hall606a54e2015-11-19 22:17:28 -08002573cmd void vkGetPhysicalDeviceFeatures(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002574 VkPhysicalDevice physicalDevice,
2575 VkPhysicalDeviceFeatures* pFeatures) {
2576 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2577
2578 features := ?
2579 pFeatures[0] = features
Jesse Halld27f6aa2015-08-15 17:58:48 -07002580}
2581
Jesse Hall606a54e2015-11-19 22:17:28 -08002582cmd void vkGetPhysicalDeviceFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002583 VkPhysicalDevice physicalDevice,
2584 VkFormat format,
2585 VkFormatProperties* pFormatProperties) {
2586 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2587
2588 formatProperties := ?
2589 pFormatProperties[0] = formatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002590}
2591
Jesse Hall606a54e2015-11-19 22:17:28 -08002592cmd void vkGetPhysicalDeviceImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002593 VkPhysicalDevice physicalDevice,
2594 VkFormat format,
2595 VkImageType type,
2596 VkImageTiling tiling,
2597 VkImageUsageFlags usage,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002598 VkImageCreateFlags flags,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002599 VkImageFormatProperties* pImageFormatProperties) {
2600 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2601
2602 imageFormatProperties := ?
2603 pImageFormatProperties[0] = imageFormatProperties
Jesse Halld27f6aa2015-08-15 17:58:48 -07002604}
2605
Jesse Halld27f6aa2015-08-15 17:58:48 -07002606
2607// Device functions
2608
2609@threadSafety("system")
2610cmd VkResult vkCreateDevice(
2611 VkPhysicalDevice physicalDevice,
2612 const VkDeviceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002613 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002614 VkDevice* pDevice) {
2615 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
2616 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2617
2618 device := ?
2619 pDevice[0] = device
2620 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice)
2621
2622 return ?
2623}
2624
2625@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002626cmd void vkDestroyDevice(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002627 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002628 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002629 deviceObject := GetDevice(device)
2630
2631 State.Devices[device] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002632}
2633
2634
2635// Extension discovery functions
2636
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002637cmd VkResult vkEnumerateInstanceLayerProperties(
Jesse Hall03b6fe12015-11-24 12:44:21 -08002638 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002639 VkLayerProperties* pProperties) {
2640 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002641 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002642
2643 properties := pProperties[0:count]
2644 for i in (0 .. count) {
2645 property := ?
2646 properties[i] = property
2647 }
2648
2649 return ?
2650}
2651
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002652cmd VkResult vkEnumerateInstanceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002653 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002654 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002655 VkExtensionProperties* pProperties) {
2656 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002657 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002658
2659 properties := pProperties[0:count]
2660 for i in (0 .. count) {
2661 property := ?
2662 properties[i] = property
2663 }
2664
2665 return ?
2666}
2667
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002668cmd VkResult vkEnumerateDeviceLayerProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002669 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002670 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002671 VkLayerProperties* pProperties) {
2672 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2673 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002674 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002675
2676 properties := pProperties[0:count]
2677 for i in (0 .. count) {
2678 property := ?
2679 properties[i] = property
2680 }
2681
2682 return ?
2683}
2684
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002685cmd VkResult vkEnumerateDeviceExtensionProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002686 VkPhysicalDevice physicalDevice,
2687 const char* pLayerName,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002688 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002689 VkExtensionProperties* pProperties) {
2690 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
2691
2692 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08002693 pPropertyCount[0] = count
Jesse Halld27f6aa2015-08-15 17:58:48 -07002694
2695 properties := pProperties[0:count]
2696 for i in (0 .. count) {
2697 property := ?
2698 properties[i] = property
2699 }
2700
2701 return ?
2702}
2703
2704
2705// Queue functions
2706
2707@threadSafety("system")
Jesse Hall606a54e2015-11-19 22:17:28 -08002708cmd void vkGetDeviceQueue(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002709 VkDevice device,
2710 u32 queueFamilyIndex,
2711 u32 queueIndex,
2712 VkQueue* pQueue) {
2713 deviceObject := GetDevice(device)
2714
2715 queue := ?
2716 pQueue[0] = queue
2717
2718 if !(queue in State.Queues) {
2719 State.Queues[queue] = new!QueueObject(device: device)
2720 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002721}
2722
2723@threadSafety("app")
2724cmd VkResult vkQueueSubmit(
2725 VkQueue queue,
Jesse Halla366a512015-11-19 22:30:07 -08002726 u32 submitCount,
Jesse Hallb00daad2015-11-29 19:46:20 -08002727 const VkSubmitInfo* pSubmits,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002728 VkFence fence) {
2729 queueObject := GetQueue(queue)
2730
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002731 if fence != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002732 fenceObject := GetFence(fence)
2733 assert(fenceObject.device == queueObject.device)
2734 }
2735
Jesse Hall3fbc8562015-11-29 22:10:52 -08002736 // commandBuffers := pcommandBuffers[0:commandBufferCount]
2737 // for i in (0 .. commandBufferCount) {
2738 // commandBuffer := commandBuffers[i]
2739 // commandBufferObject := GetCommandBuffer(commandBuffer)
2740 // assert(commandBufferObject.device == queueObject.device)
Jesse Halla366a512015-11-19 22:30:07 -08002741 //
Jesse Hall3fbc8562015-11-29 22:10:52 -08002742 // validate("QueueCheck", commandBufferObject.queueFlags in queueObject.flags,
2743 // "vkQueueSubmit: enqueued commandBuffer requires missing queue capabilities.")
Jesse Halla366a512015-11-19 22:30:07 -08002744 // }
Jesse Halld27f6aa2015-08-15 17:58:48 -07002745
2746 return ?
2747}
2748
2749@threadSafety("system")
2750cmd VkResult vkQueueWaitIdle(
2751 VkQueue queue) {
2752 queueObject := GetQueue(queue)
2753
2754 return ?
2755}
2756
2757@threadSafety("system")
2758cmd VkResult vkDeviceWaitIdle(
2759 VkDevice device) {
2760 deviceObject := GetDevice(device)
2761
2762 return ?
2763}
2764
2765
2766// Memory functions
2767
2768@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002769cmd VkResult vkAllocateMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002770 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002771 const VkMemoryAllocateInfo* pAllocateInfo,
2772 const VkAllocationCallbacks* pAllocator,
2773 VkDeviceMemory* pMemory) {
2774 assert(pAllocateInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002775 deviceObject := GetDevice(device)
2776
Jesse Hall3fbc8562015-11-29 22:10:52 -08002777 memory := ?
2778 pMemory[0] = memory
2779 State.DeviceMemories[memory] = new!DeviceMemoryObject(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002780 device: device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002781 allocationSize: pAllocateInfo[0].allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002782
2783 return ?
2784}
2785
2786@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002787cmd void vkFreeMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002788 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002789 VkDeviceMemory memory,
2790 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002791 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002792 memoryObject := GetDeviceMemory(memory)
2793 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002794
2795 // Check that no objects are still bound before freeing.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002796 validate("MemoryCheck", len(memoryObject.boundObjects) == 0,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002797 "vkFreeMemory: objects still bound")
Jesse Hall3fbc8562015-11-29 22:10:52 -08002798 validate("MemoryCheck", len(memoryObject.boundCommandBuffers) == 0,
2799 "vkFreeMemory: commandBuffers still bound")
2800 State.DeviceMemories[memory] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002801}
2802
2803@threadSafety("app")
2804cmd VkResult vkMapMemory(
2805 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002806 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002807 VkDeviceSize offset,
2808 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002809 VkMemoryMapFlags flags,
2810 void** ppData) {
2811 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002812 memoryObject := GetDeviceMemory(memory)
2813 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002814
2815 assert(flags == as!VkMemoryMapFlags(0))
Jesse Hall3fbc8562015-11-29 22:10:52 -08002816 assert((offset + size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002817
2818 return ?
2819}
2820
2821@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002822cmd void vkUnmapMemory(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002823 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002824 VkDeviceMemory memory) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002825 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08002826 memoryObject := GetDeviceMemory(memory)
2827 assert(memoryObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002828}
2829
2830cmd VkResult vkFlushMappedMemoryRanges(
2831 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002832 u32 memoryRangeCount
2833 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002834 deviceObject := GetDevice(device)
2835
Jesse Hall3fbc8562015-11-29 22:10:52 -08002836 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2837 for i in (0 .. memoryRangeCount) {
2838 memoryRange := memoryRanges[i]
2839 memoryObject := GetDeviceMemory(memoryRange.memory)
2840 assert(memoryObject.device == device)
2841 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002842 }
2843
2844 return ?
2845}
2846
2847cmd VkResult vkInvalidateMappedMemoryRanges(
2848 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002849 u32 memoryRangeCount,
2850 const VkMappedMemoryRange* pMemoryRanges) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002851 deviceObject := GetDevice(device)
2852
Jesse Hall3fbc8562015-11-29 22:10:52 -08002853 memoryRanges := pMemoryRanges[0:memoryRangeCount]
2854 for i in (0 .. memoryRangeCount) {
2855 memoryRange := memoryRanges[i]
2856 memoryObject := GetDeviceMemory(memoryRange.memory)
2857 assert(memoryObject.device == device)
2858 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002859 }
2860
2861 return ?
2862}
2863
2864
2865// Memory management API functions
2866
Jesse Hall606a54e2015-11-19 22:17:28 -08002867cmd void vkGetDeviceMemoryCommitment(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002868 VkDevice device,
2869 VkDeviceMemory memory,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002870 VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002871 deviceObject := GetDevice(device)
2872
Jesse Hall5ae3abb2015-10-08 14:00:22 -07002873 if memory != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002874 memoryObject := GetDeviceMemory(memory)
2875 assert(memoryObject.device == device)
2876 }
2877
2878 committedMemoryInBytes := ?
2879 pCommittedMemoryInBytes[0] = committedMemoryInBytes
Jesse Halld27f6aa2015-08-15 17:58:48 -07002880}
2881
Jesse Hall606a54e2015-11-19 22:17:28 -08002882cmd void vkGetBufferMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002883 VkDevice device,
2884 VkBuffer buffer,
2885 VkMemoryRequirements* pMemoryRequirements) {
2886 deviceObject := GetDevice(device)
2887 bufferObject := GetBuffer(buffer)
2888 assert(bufferObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002889}
2890
2891cmd VkResult vkBindBufferMemory(
2892 VkDevice device,
2893 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002894 VkDeviceMemory memory,
2895 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002896 deviceObject := GetDevice(device)
2897 bufferObject := GetBuffer(buffer)
2898 assert(bufferObject.device == device)
2899
2900 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002901 if bufferObject.memory != NULL_HANDLE {
2902 memoryObject := GetDeviceMemory(bufferObject.memory)
2903 memoryObject.boundObjects[as!u64(buffer)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002904 }
2905
2906 // Bind buffer to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002907 if memory != NULL_HANDLE {
2908 memoryObject := GetDeviceMemory(memory)
2909 assert(memoryObject.device == device)
2910 memoryObject.boundObjects[as!u64(buffer)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002911 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002912 bufferObject.memory = memory
2913 bufferObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002914
2915 return ?
2916}
2917
Jesse Hall606a54e2015-11-19 22:17:28 -08002918cmd void vkGetImageMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002919 VkDevice device,
2920 VkImage image,
2921 VkMemoryRequirements* pMemoryRequirements) {
2922 deviceObject := GetDevice(device)
2923 imageObject := GetImage(image)
2924 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002925}
2926
2927cmd VkResult vkBindImageMemory(
2928 VkDevice device,
2929 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002930 VkDeviceMemory memory,
2931 VkDeviceSize memoryOffset) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002932 deviceObject := GetDevice(device)
2933 imageObject := GetImage(image)
2934 assert(imageObject.device == device)
2935
2936 // Unbind image from previous memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002937 if imageObject.memory != NULL_HANDLE {
2938 memoryObject := GetDeviceMemory(imageObject.memory)
2939 memoryObject.boundObjects[as!u64(image)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07002940 }
2941
2942 // Bind image to given memory object, if not VK_NULL_HANDLE.
Jesse Hall3fbc8562015-11-29 22:10:52 -08002943 if memory != NULL_HANDLE {
2944 memoryObject := GetDeviceMemory(memory)
2945 assert(memoryObject.device == device)
2946 memoryObject.boundObjects[as!u64(image)] = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002947 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08002948 imageObject.memory = memory
2949 imageObject.memoryOffset = memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07002950
2951 return ?
2952}
2953
Jesse Hall606a54e2015-11-19 22:17:28 -08002954cmd void vkGetImageSparseMemoryRequirements(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002955 VkDevice device,
2956 VkImage image,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002957 u32* pSparseMemoryRequirementCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002958 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
2959 deviceObject := GetDevice(device)
2960 imageObject := GetImage(image)
2961 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002962}
2963
Jesse Hall606a54e2015-11-19 22:17:28 -08002964cmd void vkGetPhysicalDeviceSparseImageFormatProperties(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002965 VkPhysicalDevice physicalDevice,
2966 VkFormat format,
2967 VkImageType type,
2968 u32 samples,
2969 VkImageUsageFlags usage,
2970 VkImageTiling tiling,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002971 u32* pPropertyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002972 VkSparseImageFormatProperties* pProperties) {
2973 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002974}
2975
Jesse Halla6429252015-11-29 18:59:42 -08002976cmd VkResult vkQueueBindSparse(
Jesse Halld27f6aa2015-08-15 17:58:48 -07002977 VkQueue queue,
Jesse Hall03b6fe12015-11-24 12:44:21 -08002978 u32 bindInfoCount,
Jesse Halla6429252015-11-29 18:59:42 -08002979 const VkBindSparseInfo* pBindInfo,
2980 VkFence fence) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07002981 queueObject := GetQueue(queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07002982
2983 return ?
2984}
2985
2986
2987// Fence functions
2988
2989@threadSafety("system")
2990cmd VkResult vkCreateFence(
2991 VkDevice device,
2992 const VkFenceCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08002993 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07002994 VkFence* pFence) {
2995 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO)
2996 deviceObject := GetDevice(device)
2997
2998 fence := ?
2999 pFence[0] = fence
3000 State.Fences[fence] = new!FenceObject(
Jesse Halld8bade02015-11-24 10:24:18 -08003001 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT)))
Jesse Halld27f6aa2015-08-15 17:58:48 -07003002
3003 return ?
3004}
3005
3006@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003007cmd void vkDestroyFence(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003008 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003009 VkFence fence,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003010 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003011 deviceObject := GetDevice(device)
3012 fenceObject := GetFence(fence)
3013 assert(fenceObject.device == device)
3014
3015 State.Fences[fence] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003016}
3017
3018@threadSafety("system")
3019cmd VkResult vkResetFences(
3020 VkDevice device,
3021 u32 fenceCount,
3022 const VkFence* pFences) {
3023 deviceObject := GetDevice(device)
3024
3025 fences := pFences[0:fenceCount]
3026 for i in (0 .. fenceCount) {
3027 fence := fences[i]
3028 fenceObject := GetFence(fence)
3029 assert(fenceObject.device == device)
3030 fenceObject.signaled = false
3031 }
3032
3033 return ?
3034}
3035
3036@threadSafety("system")
3037cmd VkResult vkGetFenceStatus(
3038 VkDevice device,
3039 VkFence fence) {
3040 deviceObject := GetDevice(device)
3041 fenceObject := GetFence(fence)
3042 assert(fenceObject.device == device)
3043
3044 return ?
3045}
3046
3047@threadSafety("system")
3048cmd VkResult vkWaitForFences(
3049 VkDevice device,
3050 u32 fenceCount,
3051 const VkFence* pFences,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003052 VkBool32 waitAll,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003053 u64 timeout) { /// timeout in nanoseconds
3054 deviceObject := GetDevice(device)
3055
3056 fences := pFences[0:fenceCount]
3057 for i in (0 .. fenceCount) {
3058 fence := fences[i]
3059 fenceObject := GetFence(fence)
3060 assert(fenceObject.device == device)
3061 }
3062
3063 return ?
3064}
3065
3066
3067// Queue semaphore functions
3068
3069@threadSafety("system")
3070cmd VkResult vkCreateSemaphore(
3071 VkDevice device,
3072 const VkSemaphoreCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003073 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003074 VkSemaphore* pSemaphore) {
3075 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO)
3076 deviceObject := GetDevice(device)
3077
3078 semaphore := ?
3079 pSemaphore[0] = semaphore
3080 State.Semaphores[semaphore] = new!SemaphoreObject(device: device)
3081
3082 return ?
3083}
3084
3085@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003086cmd void vkDestroySemaphore(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003087 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003088 VkSemaphore semaphore,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003089 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003090 deviceObject := GetDevice(device)
3091 semaphoreObject := GetSemaphore(semaphore)
3092 assert(semaphoreObject.device == device)
3093
3094 State.Semaphores[semaphore] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003095}
3096
Jesse Halld27f6aa2015-08-15 17:58:48 -07003097
3098// Event functions
3099
3100@threadSafety("system")
3101cmd VkResult vkCreateEvent(
3102 VkDevice device,
3103 const VkEventCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003104 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003105 VkEvent* pEvent) {
3106 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO)
3107 deviceObject := GetDevice(device)
3108
3109 event := ?
3110 pEvent[0] = event
3111 State.Events[event] = new!EventObject(device: device)
3112
3113 return ?
3114}
3115
3116@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003117cmd void vkDestroyEvent(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003118 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003119 VkEvent event,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003120 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003121 deviceObject := GetDevice(device)
3122 eventObject := GetEvent(event)
3123 assert(eventObject.device == device)
3124
3125 State.Events[event] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003126}
3127
3128@threadSafety("system")
3129cmd VkResult vkGetEventStatus(
3130 VkDevice device,
3131 VkEvent event) {
3132 deviceObject := GetDevice(device)
3133 eventObject := GetEvent(event)
3134 assert(eventObject.device == device)
3135
3136 return ?
3137}
3138
3139@threadSafety("system")
3140cmd VkResult vkSetEvent(
3141 VkDevice device,
3142 VkEvent event) {
3143 deviceObject := GetDevice(device)
3144 eventObject := GetEvent(event)
3145 assert(eventObject.device == device)
3146
3147 return ?
3148}
3149
3150@threadSafety("system")
3151cmd VkResult vkResetEvent(
3152 VkDevice device,
3153 VkEvent event) {
3154 deviceObject := GetDevice(device)
3155 eventObject := GetEvent(event)
3156 assert(eventObject.device == device)
3157
3158 return ?
3159}
3160
3161
3162// Query functions
3163
3164@threadSafety("system")
3165cmd VkResult vkCreateQueryPool(
3166 VkDevice device,
3167 const VkQueryPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003168 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003169 VkQueryPool* pQueryPool) {
3170 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO)
3171 deviceObject := GetDevice(device)
3172
3173 queryPool := ?
3174 pQueryPool[0] = queryPool
3175 State.QueryPools[queryPool] = new!QueryPoolObject(device: device)
3176
3177 return ?
3178}
3179
3180@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003181cmd void vkDestroyQueryPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003182 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003183 VkQueryPool queryPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003184 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003185 deviceObject := GetDevice(device)
3186 queryPoolObject := GetQueryPool(queryPool)
3187 assert(queryPoolObject.device == device)
3188
3189 State.QueryPools[queryPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003190}
3191
3192@threadSafety("system")
3193cmd VkResult vkGetQueryPoolResults(
3194 VkDevice device,
3195 VkQueryPool queryPool,
3196 u32 startQuery,
3197 u32 queryCount,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003198 platform.size_t dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003199 void* pData,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003200 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003201 VkQueryResultFlags flags) {
3202 deviceObject := GetDevice(device)
3203 queryPoolObject := GetQueryPool(queryPool)
3204 assert(queryPoolObject.device == device)
3205
Jesse Halld27f6aa2015-08-15 17:58:48 -07003206 data := pData[0:dataSize]
3207
3208 return ?
3209}
3210
3211// Buffer functions
3212
3213@threadSafety("system")
3214cmd VkResult vkCreateBuffer(
3215 VkDevice device,
3216 const VkBufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003217 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003218 VkBuffer* pBuffer) {
3219 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
3220 deviceObject := GetDevice(device)
3221
3222 buffer := ?
3223 pBuffer[0] = buffer
3224 State.Buffers[buffer] = new!BufferObject(device: device)
3225
3226 return ?
3227}
3228
3229@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003230cmd void vkDestroyBuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003231 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003232 VkBuffer buffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003233 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003234 deviceObject := GetDevice(device)
3235 bufferObject := GetBuffer(buffer)
3236 assert(bufferObject.device == device)
3237
Jesse Hall3fbc8562015-11-29 22:10:52 -08003238 assert(bufferObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003239 State.Buffers[buffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003240}
3241
3242
3243// Buffer view functions
3244
3245@threadSafety("system")
3246cmd VkResult vkCreateBufferView(
3247 VkDevice device,
3248 const VkBufferViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003249 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003250 VkBufferView* pView) {
3251 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO)
3252 deviceObject := GetDevice(device)
3253
3254 bufferObject := GetBuffer(pCreateInfo.buffer)
3255 assert(bufferObject.device == device)
3256
3257 view := ?
3258 pView[0] = view
3259 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer)
3260
3261 return ?
3262}
3263
3264@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003265cmd void vkDestroyBufferView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003266 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003267 VkBufferView bufferView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003268 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003269 deviceObject := GetDevice(device)
3270 bufferViewObject := GetBufferView(bufferView)
3271 assert(bufferViewObject.device == device)
3272
3273 State.BufferViews[bufferView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003274}
3275
3276
3277// Image functions
3278
3279@threadSafety("system")
3280cmd VkResult vkCreateImage(
3281 VkDevice device,
3282 const VkImageCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003283 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003284 VkImage* pImage) {
3285 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO)
3286 deviceObject := GetDevice(device)
3287
3288 image := ?
3289 pImage[0] = image
3290 State.Images[image] = new!ImageObject(device: device)
3291
3292 return ?
3293}
3294
3295@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003296cmd void vkDestroyImage(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003297 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003298 VkImage image,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003299 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003300 deviceObject := GetDevice(device)
3301 imageObject := GetImage(image)
3302 assert(imageObject.device == device)
3303
Jesse Hall3fbc8562015-11-29 22:10:52 -08003304 assert(imageObject.memory == 0)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003305 State.Images[image] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003306}
3307
Jesse Hall606a54e2015-11-19 22:17:28 -08003308cmd void vkGetImageSubresourceLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003309 VkDevice device,
3310 VkImage image,
3311 const VkImageSubresource* pSubresource,
3312 VkSubresourceLayout* pLayout) {
3313 deviceObject := GetDevice(device)
3314 imageObject := GetImage(image)
3315 assert(imageObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003316}
3317
3318
3319// Image view functions
3320
3321@threadSafety("system")
3322cmd VkResult vkCreateImageView(
3323 VkDevice device,
3324 const VkImageViewCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003325 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003326 VkImageView* pView) {
3327 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO)
3328 deviceObject := GetDevice(device)
3329
3330 imageObject := GetImage(pCreateInfo.image)
3331 assert(imageObject.device == device)
3332
3333 view := ?
3334 pView[0] = view
3335 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image)
3336
3337 return ?
3338}
3339
3340@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003341cmd void vkDestroyImageView(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003342 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003343 VkImageView imageView,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003344 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003345 deviceObject := GetDevice(device)
3346 imageViewObject := GetImageView(imageView)
3347 assert(imageViewObject.device == device)
3348
3349 State.ImageViews[imageView] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003350}
3351
3352
3353// Shader functions
3354
3355cmd VkResult vkCreateShaderModule(
3356 VkDevice device,
3357 const VkShaderModuleCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003358 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003359 VkShaderModule* pShaderModule) {
3360 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO)
3361 deviceObject := GetDevice(device)
3362
3363 shaderModule := ?
3364 pShaderModule[0] = shaderModule
3365 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device)
3366
3367 return ?
3368}
3369
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003370cmd void vkDestroyShaderModule(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003371 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003372 VkShaderModule shaderModule,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003373 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003374 deviceObject := GetDevice(device)
3375 shaderModuleObject := GetShaderModule(shaderModule)
3376 assert(shaderModuleObject.device == device)
3377
3378 State.ShaderModules[shaderModule] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003379}
3380
3381@threadSafety("system")
3382cmd VkResult vkCreateShader(
3383 VkDevice device,
3384 const VkShaderCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003385 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003386 VkShader* pShader) {
3387 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO)
3388 deviceObject := GetDevice(device)
3389
3390 shader := ?
3391 pShader[0] = shader
3392 State.Shaders[shader] = new!ShaderObject(device: device)
3393
3394 return ?
3395}
3396
3397@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003398cmd void vkDestroyShader(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003399 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003400 VkShader shader,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003401 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003402 deviceObject := GetDevice(device)
3403 shaderObject := GetShader(shader)
3404 assert(shaderObject.device == device)
3405
3406 State.Shaders[shader] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003407}
3408
3409
3410// Pipeline functions
3411
3412cmd VkResult vkCreatePipelineCache(
3413 VkDevice device,
3414 const VkPipelineCacheCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003415 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003416 VkPipelineCache* pPipelineCache) {
3417 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO)
3418 deviceObject := GetDevice(device)
3419
3420 pipelineCache := ?
3421 pPipelineCache[0] = pipelineCache
3422 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device)
3423
3424 return ?
3425}
3426
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003427cmd void vkDestroyPipelineCache(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003428 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003429 VkPipelineCache pipelineCache,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003430 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003431 deviceObject := GetDevice(device)
3432 pipelineCacheObject := GetPipelineCache(pipelineCache)
3433 assert(pipelineCacheObject.device == device)
3434
3435 State.PipelineCaches[pipelineCache] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003436}
3437
Jesse Halld27f6aa2015-08-15 17:58:48 -07003438cmd VkResult vkGetPipelineCacheData(
3439 VkDevice device,
3440 VkPipelineCache pipelineCache,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003441 platform.size_t* pDataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003442 void* pData) {
3443 deviceObject := GetDevice(device)
3444 pipelineCacheObject := GetPipelineCache(pipelineCache)
3445 assert(pipelineCacheObject.device == device)
3446
3447 return ?
3448}
3449
3450cmd VkResult vkMergePipelineCaches(
3451 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003452 VkPipelineCache dstCache,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003453 u32 srcCacheCount,
3454 const VkPipelineCache* pSrcCaches) {
3455 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003456 dstCacheObject := GetPipelineCache(dstCache)
3457 assert(dstCacheObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003458
3459 srcCaches := pSrcCaches[0:srcCacheCount]
3460 for i in (0 .. srcCacheCount) {
3461 srcCache := srcCaches[i]
3462 srcCacheObject := GetPipelineCache(srcCache)
3463 assert(srcCacheObject.device == device)
3464 }
3465
3466 return ?
3467}
3468
3469cmd VkResult vkCreateGraphicsPipelines(
3470 VkDevice device,
3471 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003472 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003473 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003474 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003475 VkPipeline* pPipelines) {
3476 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003477 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003478 pipelineCacheObject := GetPipelineCache(pipelineCache)
3479 assert(pipelineCacheObject.device == device)
3480 }
3481
Jesse Hall03b6fe12015-11-24 12:44:21 -08003482 createInfos := pCreateInfos[0:createInfoCount]
3483 pipelines := pPipelines[0:createInfoCount]
3484 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003485 pipeline := ?
3486 pipelines[i] = pipeline
3487 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3488 }
3489
3490 return ?
3491}
3492
3493cmd VkResult vkCreateComputePipelines(
3494 VkDevice device,
3495 VkPipelineCache pipelineCache,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003496 u32 createInfoCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003497 const VkComputePipelineCreateInfo* pCreateInfos,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003498 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003499 VkPipeline* pPipelines) {
3500 deviceObject := GetDevice(device)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003501 if pipelineCache != NULL_HANDLE {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003502 pipelineCacheObject := GetPipelineCache(pipelineCache)
3503 assert(pipelineCacheObject.device == device)
3504 }
3505
Jesse Hall03b6fe12015-11-24 12:44:21 -08003506 createInfos := pCreateInfos[0:createInfoCount]
3507 pipelines := pPipelines[0:createInfoCount]
3508 for i in (0 .. createInfoCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003509 pipeline := ?
3510 pipelines[i] = pipeline
3511 State.Pipelines[pipeline] = new!PipelineObject(device: device)
3512 }
3513
3514 return ?
3515}
3516
3517@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003518cmd void vkDestroyPipeline(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003519 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003520 VkPipeline pipeline,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003521 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003522 deviceObject := GetDevice(device)
3523 pipelineObjects := GetPipeline(pipeline)
3524 assert(pipelineObjects.device == device)
3525
3526 State.Pipelines[pipeline] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003527}
3528
3529
3530// Pipeline layout functions
3531
3532@threadSafety("system")
3533cmd VkResult vkCreatePipelineLayout(
3534 VkDevice device,
3535 const VkPipelineLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003536 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003537 VkPipelineLayout* pPipelineLayout) {
3538 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO)
3539 deviceObject := GetDevice(device)
3540
3541 pipelineLayout := ?
3542 pPipelineLayout[0] = pipelineLayout
3543 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device)
3544
3545 return ?
3546}
3547
3548@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003549cmd void vkDestroyPipelineLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003550 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003551 VkPipelineLayout pipelineLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003552 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003553 deviceObject := GetDevice(device)
3554 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout)
3555 assert(pipelineLayoutObjects.device == device)
3556
3557 State.PipelineLayouts[pipelineLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003558}
3559
3560
3561// Sampler functions
3562
3563@threadSafety("system")
3564cmd VkResult vkCreateSampler(
3565 VkDevice device,
3566 const VkSamplerCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003567 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003568 VkSampler* pSampler) {
3569 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
3570 deviceObject := GetDevice(device)
3571
3572 sampler := ?
3573 pSampler[0] = sampler
3574 State.Samplers[sampler] = new!SamplerObject(device: device)
3575
3576 return ?
3577}
3578
3579@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003580cmd void vkDestroySampler(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003581 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003582 VkSampler sampler,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003583 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003584 deviceObject := GetDevice(device)
3585 samplerObject := GetSampler(sampler)
3586 assert(samplerObject.device == device)
3587
3588 State.Samplers[sampler] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003589}
3590
3591
3592// Descriptor set functions
3593
3594@threadSafety("system")
3595cmd VkResult vkCreateDescriptorSetLayout(
3596 VkDevice device,
3597 const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003598 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003599 VkDescriptorSetLayout* pSetLayout) {
3600 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO)
3601 deviceObject := GetDevice(device)
3602
3603 setLayout := ?
3604 pSetLayout[0] = setLayout
3605 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device)
3606
3607 return ?
3608}
3609
3610@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003611cmd void vkDestroyDescriptorSetLayout(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003612 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003613 VkDescriptorSetLayout descriptorSetLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003614 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003615 deviceObject := GetDevice(device)
3616 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout)
3617 assert(descriptorSetLayoutObject.device == device)
3618
3619 State.DescriptorSetLayouts[descriptorSetLayout] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003620}
3621
3622@threadSafety("system")
3623cmd VkResult vkCreateDescriptorPool(
3624 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003625 const VkDescriptorPoolCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003626 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003627 VkDescriptorPool* pDescriptorPool) {
3628 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO)
3629 deviceObject := GetDevice(device)
3630
3631 descriptorPool := ?
3632 pDescriptorPool[0] = descriptorPool
3633 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device)
3634
3635 return ?
3636}
3637
3638@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003639cmd void vkDestroyDescriptorPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003640 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003641 VkDescriptorPool descriptorPool,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003642 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003643 deviceObject := GetDevice(device)
3644 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3645 assert(descriptorPoolObject.device == device)
3646
3647 State.DescriptorPools[descriptorPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003648}
3649
3650@threadSafety("app")
3651cmd VkResult vkResetDescriptorPool(
3652 VkDevice device,
Jesse Hallfbf97b02015-11-20 14:17:03 -08003653 VkDescriptorPool descriptorPool,
3654 VkDescriptorPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003655 deviceObject := GetDevice(device)
3656 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3657 assert(descriptorPoolObject.device == device)
3658
3659 return ?
3660}
3661
3662@threadSafety("app")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003663cmd VkResult vkAllocateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003664 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003665 const VkDescriptorSetAllocateInfo* pAllocateInfo,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003666 VkDescriptorSet* pDescriptorSets) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003667 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003668 allocInfo := pAllocateInfo[0]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003669 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003670
Jesse Hall03b6fe12015-11-24 12:44:21 -08003671 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount]
3672 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003673 setLayout := setLayouts[i]
3674 setLayoutObject := GetDescriptorSetLayout(setLayout)
3675 assert(setLayoutObject.device == device)
3676 }
3677
Jesse Hall03b6fe12015-11-24 12:44:21 -08003678 descriptorSets := pDescriptorSets[0:allocInfo.setCount]
3679 for i in (0 .. allocInfo.setCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003680 descriptorSet := ?
3681 descriptorSets[i] = descriptorSet
3682 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device)
3683 }
3684
3685 return ?
3686}
3687
Jesse Hallf09c6b12015-08-15 19:54:28 -07003688cmd VkResult vkFreeDescriptorSets(
3689 VkDevice device,
3690 VkDescriptorPool descriptorPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003691 u32 descriptorSetCount,
Jesse Hallf09c6b12015-08-15 19:54:28 -07003692 const VkDescriptorSet* pDescriptorSets) {
3693 deviceObject := GetDevice(device)
3694 descriptorPoolObject := GetDescriptorPool(descriptorPool)
3695
Jesse Hall03b6fe12015-11-24 12:44:21 -08003696 descriptorSets := pDescriptorSets[0:descriptorSetCount]
3697 for i in (0 .. descriptorSetCount) {
Jesse Hallf09c6b12015-08-15 19:54:28 -07003698 descriptorSet := descriptorSets[i]
3699 descriptorSetObject := GetDescriptorSet(descriptorSet)
3700 assert(descriptorSetObject.device == device)
3701 State.DescriptorSets[descriptorSet] = null
3702 }
3703
3704 return ?
3705}
3706
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003707cmd void vkUpdateDescriptorSets(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003708 VkDevice device,
Jesse Hallb00daad2015-11-29 19:46:20 -08003709 u32 descriptorWriteCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003710 const VkWriteDescriptorSet* pDescriptorWrites,
Jesse Hallb00daad2015-11-29 19:46:20 -08003711 u32 descriptorCopyCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003712 const VkCopyDescriptorSet* pDescriptorCopies) {
3713 deviceObject := GetDevice(device)
3714
Jesse Hallb00daad2015-11-29 19:46:20 -08003715 descriptorWrites := pDescriptorWrites[0:descriptorWriteCount]
3716 for i in (0 .. descriptorWriteCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003717 descriptorWrite := descriptorWrites[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003718 descriptorWriteObject := GetDescriptorSet(descriptorWrite.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003719 assert(descriptorWriteObject.device == device)
3720 }
3721
Jesse Hallb00daad2015-11-29 19:46:20 -08003722 descriptorCopies := pDescriptorCopies[0:descriptorCopyCount]
3723 for i in (0 .. descriptorCopyCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003724 descriptorCopy := descriptorCopies[i]
Jesse Hall3fbc8562015-11-29 22:10:52 -08003725 descriptorCopyObject := GetDescriptorSet(descriptorCopy.dstSet)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003726 assert(descriptorCopyObject.device == device)
3727 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003728}
3729
3730
3731// Framebuffer functions
3732
3733@threadSafety("system")
3734cmd VkResult vkCreateFramebuffer(
3735 VkDevice device,
3736 const VkFramebufferCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003737 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003738 VkFramebuffer* pFramebuffer) {
3739 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO)
3740 deviceObject := GetDevice(device)
3741
3742 framebuffer := ?
3743 pFramebuffer[0] = framebuffer
3744 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device)
3745
3746 return ?
3747}
3748
3749@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003750cmd void vkDestroyFramebuffer(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003751 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003752 VkFramebuffer framebuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003753 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003754 deviceObject := GetDevice(device)
3755 framebufferObject := GetFramebuffer(framebuffer)
3756 assert(framebufferObject.device == device)
3757
3758 State.Framebuffers[framebuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003759}
3760
3761
3762// Renderpass functions
3763
3764@threadSafety("system")
3765cmd VkResult vkCreateRenderPass(
3766 VkDevice device,
3767 const VkRenderPassCreateInfo* pCreateInfo,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003768 const VkAllocationCallbacks* pAllocator,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003769 VkRenderPass* pRenderPass) {
3770 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
3771 deviceObject := GetDevice(device)
3772
3773 renderpass := ?
3774 pRenderPass[0] = renderpass
3775 State.RenderPasses[renderpass] = new!RenderPassObject(device: device)
3776
3777 return ?
3778}
3779
3780@threadSafety("system")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003781cmd void vkDestroyRenderPass(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003782 VkDevice device,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003783 VkRenderPass renderPass,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003784 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003785 deviceObject := GetDevice(device)
3786 renderPassObject := GetRenderPass(renderPass)
3787 assert(renderPassObject.device == device)
3788
3789 State.RenderPasses[renderPass] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003790}
3791
Jesse Hall606a54e2015-11-19 22:17:28 -08003792cmd void vkGetRenderAreaGranularity(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003793 VkDevice device,
3794 VkRenderPass renderPass,
3795 VkExtent2D* pGranularity) {
3796 deviceObject := GetDevice(device)
3797 renderPassObject := GetRenderPass(renderPass)
3798
3799 granularity := ?
3800 pGranularity[0] = granularity
Jesse Halld27f6aa2015-08-15 17:58:48 -07003801}
3802
3803// Command pool functions
3804
3805cmd VkResult vkCreateCommandPool(
3806 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003807 const VkCommandPoolCreateInfo* pCreateInfo,
3808 const VkAllocationCallbacks* pAllocator,
3809 VkCommandPool* pCommandPool) {
3810 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003811 deviceObject := GetDevice(device)
3812
Jesse Hall3fbc8562015-11-29 22:10:52 -08003813 commandPool := ?
3814 pCommandPool[0] = commandPool
3815 State.CommandPools[commandPool] = new!CommandPoolObject(device: device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003816
3817 return ?
3818}
3819
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003820cmd void vkDestroyCommandPool(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003821 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003822 VkCommandPool commandPool,
3823 const VkAllocationCallbacks* pAllocator) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003824 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003825 commandPoolObject := GetCommandPool(commandPool)
3826 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003827
Jesse Hall3fbc8562015-11-29 22:10:52 -08003828 State.CommandPools[commandPool] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003829}
3830
3831cmd VkResult vkResetCommandPool(
3832 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003833 VkCommandPool commandPool,
3834 VkCommandPoolResetFlags flags) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003835 deviceObject := GetDevice(device)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003836 commandPoolObject := GetCommandPool(commandPool)
3837 assert(commandPoolObject.device == device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003838
3839 return ?
3840}
3841
3842// Command buffer functions
3843
Jesse Hall3fbc8562015-11-29 22:10:52 -08003844macro void bindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3845 memoryObject := GetDeviceMemory(memory)
3846 memoryObject.boundCommandBuffers[commandBuffer] = commandBuffer
Jesse Halld27f6aa2015-08-15 17:58:48 -07003847
Jesse Hall3fbc8562015-11-29 22:10:52 -08003848 commandBufferObject := GetCommandBuffer(commandBuffer)
3849 commandBufferObject.boundObjects[as!u64(obj)] = memory
Jesse Halld27f6aa2015-08-15 17:58:48 -07003850}
3851
Jesse Hall3fbc8562015-11-29 22:10:52 -08003852macro void unbindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) {
3853 memoryObject := GetDeviceMemory(memory)
3854 memoryObject.boundCommandBuffers[commandBuffer] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003855
Jesse Hall3fbc8562015-11-29 22:10:52 -08003856 commandBufferObject := GetCommandBuffer(commandBuffer)
3857 commandBufferObject.boundObjects[as!u64(obj)] = null
Jesse Halld27f6aa2015-08-15 17:58:48 -07003858}
3859
3860@threadSafety("system")
Jesse Hall3fbc8562015-11-29 22:10:52 -08003861cmd VkResult vkAllocateCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003862 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003863 const VkCommandBufferAllocateInfo* pAllocateInfo,
3864 VkCommandBuffer* pCommandBuffers) {
3865 assert(pAllocateInfo[0].sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOC_INFO)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003866
Jesse Hall3fbc8562015-11-29 22:10:52 -08003867 count := pAllocateInfo[0].bufferCount
3868 commandBuffers := pCommandBuffers[0:count]
Jesse Hallfbf97b02015-11-20 14:17:03 -08003869 for i in (0 .. count) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003870 commandBuffer := ?
3871 commandBuffers[i] = commandBuffer
3872 State.CommandBuffers[commandBuffer] = new!CommandBufferObject(device: device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003873 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003874
3875 return ?
3876}
3877
3878@threadSafety("system")
Jesse Hallfbf97b02015-11-20 14:17:03 -08003879cmd void vkFreeCommandBuffers(
Jesse Halld27f6aa2015-08-15 17:58:48 -07003880 VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003881 VkCommandPool commandPool,
Jesse Hall03b6fe12015-11-24 12:44:21 -08003882 u32 commandBufferCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08003883 const VkCommandBuffer* pCommandBuffers) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003884 deviceObject := GetDevice(device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003885
Jesse Hall3fbc8562015-11-29 22:10:52 -08003886 commandBuffers := pCommandBuffers[0:commandBufferCount]
Jesse Hall03b6fe12015-11-24 12:44:21 -08003887 for i in (0 .. commandBufferCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003888 commandBufferObject := GetCommandBuffer(commandBuffers[i])
3889 assert(commandBufferObject.device == device)
Jesse Hallfbf97b02015-11-20 14:17:03 -08003890 // TODO: iterate over boundObjects and clear memory bindings
Jesse Hall3fbc8562015-11-29 22:10:52 -08003891 State.CommandBuffers[commandBuffers[i]] = null
Jesse Hallfbf97b02015-11-20 14:17:03 -08003892 }
Jesse Halld27f6aa2015-08-15 17:58:48 -07003893}
3894
3895@threadSafety("app")
3896cmd VkResult vkBeginCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003897 VkCommandBuffer commandBuffer,
3898 const VkCommandBufferBeginInfo* pBeginInfo) {
3899 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO)
3900 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003901
3902 // TODO: iterate over boundObjects and clear memory bindings
3903
3904 return ?
3905}
3906
3907@threadSafety("app")
3908cmd VkResult vkEndCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003909 VkCommandBuffer commandBuffer) {
3910 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003911
3912 return ?
3913}
3914
3915@threadSafety("app")
3916cmd VkResult vkResetCommandBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003917 VkCommandBuffer commandBuffer,
3918 VkCommandBufferResetFlags flags) {
3919 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003920
3921 // TODO: iterate over boundObjects and clear memory bindings
3922
3923 return ?
3924}
3925
3926
3927// Command buffer building functions
3928
3929@threadSafety("app")
3930cmd void vkCmdBindPipeline(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003931 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07003932 VkPipelineBindPoint pipelineBindPoint,
3933 VkPipeline pipeline) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003934 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003935 pipelineObject := GetPipeline(pipeline)
Jesse Hall3fbc8562015-11-29 22:10:52 -08003936 assert(commandBufferObject.device == pipelineObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003937
Jesse Halld8bade02015-11-24 10:24:18 -08003938 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07003939 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
3940 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
3941 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08003942 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003943}
3944
3945@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003946cmd void vkCmdSetViewport(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003947 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003948 u32 viewportCount,
3949 const VkViewport* pViewports) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003950 commandBufferObject := GetCommandBuffer(commandBuffer)
3951 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003952}
3953
3954@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003955cmd void vkCmdSetScissor(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003956 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003957 u32 scissorCount,
3958 const VkRect2D* pScissors) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003959 commandBufferObject := GetCommandBuffer(commandBuffer)
3960 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003961}
3962
3963@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003964cmd void vkCmdSetLineWidth(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003965 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003966 f32 lineWidth) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003967 commandBufferObject := GetCommandBuffer(commandBuffer)
3968 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07003969}
3970
3971@threadSafety("app")
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003972cmd void vkCmdSetDepthBias(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003973 VkCommandBuffer commandBuffer,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003974 f32 depthBiasConstantFactor,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003975 f32 depthBiasClamp,
Jesse Halla9bb62b2015-11-21 19:31:56 -08003976 f32 depthBiasSlopeFactor) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003977 commandBufferObject := GetCommandBuffer(commandBuffer)
3978 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003979}
Jesse Halld27f6aa2015-08-15 17:58:48 -07003980
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003981@threadSafety("app")
3982cmd void vkCmdSetBlendConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003983 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003984 // TODO(jessehall): apic only supports 'const' on pointer types. Using
3985 // an annotation as a quick hack to pass this to the template without
3986 // having to modify the AST and semantic model.
Jesse Hallb00daad2015-11-29 19:46:20 -08003987 @readonly f32[4] blendConstants) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003988 commandBufferObject := GetCommandBuffer(commandBuffer)
3989 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003990}
3991
3992@threadSafety("app")
3993cmd void vkCmdSetDepthBounds(
Jesse Hall3fbc8562015-11-29 22:10:52 -08003994 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003995 f32 minDepthBounds,
3996 f32 maxDepthBounds) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08003997 commandBufferObject := GetCommandBuffer(commandBuffer)
3998 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07003999}
4000
4001@threadSafety("app")
4002cmd void vkCmdSetStencilCompareMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004003 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004004 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08004005 u32 compareMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004006 commandBufferObject := GetCommandBuffer(commandBuffer)
4007 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004008}
4009
4010@threadSafety("app")
4011cmd void vkCmdSetStencilWriteMask(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004012 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004013 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08004014 u32 writeMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004015 commandBufferObject := GetCommandBuffer(commandBuffer)
4016 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004017}
4018
4019@threadSafety("app")
4020cmd void vkCmdSetStencilReference(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004021 VkCommandBuffer commandBuffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004022 VkStencilFaceFlags faceMask,
Jesse Hall65ab5522015-11-30 00:07:16 -08004023 u32 reference) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004024 commandBufferObject := GetCommandBuffer(commandBuffer)
4025 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004026}
4027
4028@threadSafety("app")
4029cmd void vkCmdBindDescriptorSets(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004030 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004031 VkPipelineBindPoint pipelineBindPoint,
4032 VkPipelineLayout layout,
4033 u32 firstSet,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004034 u32 descriptorSetCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004035 const VkDescriptorSet* pDescriptorSets,
4036 u32 dynamicOffsetCount,
4037 const u32* pDynamicOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004038 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004039
Jesse Hall03b6fe12015-11-24 12:44:21 -08004040 descriptorSets := pDescriptorSets[0:descriptorSetCount]
4041 for i in (0 .. descriptorSetCount) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004042 descriptorSet := descriptorSets[i]
4043 descriptorSetObject := GetDescriptorSet(descriptorSet)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004044 assert(commandBufferObject.device == descriptorSetObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004045 }
4046
4047 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount]
4048 for i in (0 .. dynamicOffsetCount) {
4049 dynamicOffset := dynamicOffsets[i]
4050 }
4051
Jesse Halld8bade02015-11-24 10:24:18 -08004052 queue := switch (pipelineBindPoint) {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004053 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT
4054 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT
4055 }
Jesse Hall3fbc8562015-11-29 22:10:52 -08004056 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004057}
4058
4059@threadSafety("app")
4060cmd void vkCmdBindIndexBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004061 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004062 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004063 VkDeviceSize offset,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004064 VkIndexType indexType) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004065 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004066 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004067 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004068
Jesse Hall3fbc8562015-11-29 22:10:52 -08004069 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004070
Jesse Hall3fbc8562015-11-29 22:10:52 -08004071 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004072}
4073
4074@threadSafety("app")
4075cmd void vkCmdBindVertexBuffers(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004076 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004077 u32 startBinding,
4078 u32 bindingCount,
4079 const VkBuffer* pBuffers,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004080 const VkDeviceSize* pOffsets) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004081 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004082
4083 // TODO: check if not [startBinding:startBinding+bindingCount]
4084 buffers := pBuffers[0:bindingCount]
4085 offsets := pOffsets[0:bindingCount]
4086 for i in (0 .. bindingCount) {
4087 buffer := buffers[i]
4088 offset := offsets[i]
4089 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004090 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004091
Jesse Hall3fbc8562015-11-29 22:10:52 -08004092 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004093 }
4094
Jesse Hall3fbc8562015-11-29 22:10:52 -08004095 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004096}
4097
4098@threadSafety("app")
4099cmd void vkCmdDraw(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004100 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004101 u32 vertexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004102 u32 instanceCount,
4103 u32 firstVertex,
4104 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004105 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004106
Jesse Hall3fbc8562015-11-29 22:10:52 -08004107 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004108}
4109
4110@threadSafety("app")
4111cmd void vkCmdDrawIndexed(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004112 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004113 u32 indexCount,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004114 u32 instanceCount,
4115 u32 firstIndex,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004116 s32 vertexOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004117 u32 firstInstance) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004118 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004119
Jesse Hall3fbc8562015-11-29 22:10:52 -08004120 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004121}
4122
4123@threadSafety("app")
4124cmd void vkCmdDrawIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004125 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004126 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004127 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004128 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004129 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004130 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004131 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004132 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004133
Jesse Hall3fbc8562015-11-29 22:10:52 -08004134 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004135
Jesse Hall3fbc8562015-11-29 22:10:52 -08004136 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004137}
4138
4139@threadSafety("app")
4140cmd void vkCmdDrawIndexedIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004141 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004142 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004143 VkDeviceSize offset,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004144 u32 drawCount,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004145 u32 stride) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004146 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004147 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004148 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004149
Jesse Hall3fbc8562015-11-29 22:10:52 -08004150 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004151
Jesse Hall3fbc8562015-11-29 22:10:52 -08004152 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004153}
4154
4155@threadSafety("app")
4156cmd void vkCmdDispatch(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004157 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004158 u32 x,
4159 u32 y,
4160 u32 z) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004161 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004162
Jesse Hall3fbc8562015-11-29 22:10:52 -08004163 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004164}
4165
4166@threadSafety("app")
4167cmd void vkCmdDispatchIndirect(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004168 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004169 VkBuffer buffer,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004170 VkDeviceSize offset) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004171 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004172 bufferObject := GetBuffer(buffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004173 assert(commandBufferObject.device == bufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004174
Jesse Hall3fbc8562015-11-29 22:10:52 -08004175 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004176
Jesse Hall3fbc8562015-11-29 22:10:52 -08004177 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004178}
4179
4180@threadSafety("app")
4181cmd void vkCmdCopyBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004182 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004183 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004184 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004185 u32 regionCount,
4186 const VkBufferCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004187 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004188 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004189 dstBufferObject := GetBuffer(dstBuffer)
4190 assert(commandBufferObject.device == srcBufferObject.device)
4191 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004192
4193 regions := pRegions[0:regionCount]
4194 for i in (0 .. regionCount) {
4195 region := regions[i]
4196 }
4197
Jesse Hall3fbc8562015-11-29 22:10:52 -08004198 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4199 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004200
Jesse Hall65ab5522015-11-30 00:07:16 -08004201 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004202}
4203
4204@threadSafety("app")
4205cmd void vkCmdCopyImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004206 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004207 VkImage srcImage,
4208 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004209 VkImage dstImage,
4210 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004211 u32 regionCount,
4212 const VkImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004213 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004214 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004215 dstImageObject := GetImage(dstImage)
4216 assert(commandBufferObject.device == srcImageObject.device)
4217 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004218
4219 regions := pRegions[0:regionCount]
4220 for i in (0 .. regionCount) {
4221 region := regions[i]
4222 }
4223
Jesse Hall3fbc8562015-11-29 22:10:52 -08004224 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4225 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004226
Jesse Hall65ab5522015-11-30 00:07:16 -08004227 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004228}
4229
4230@threadSafety("app")
4231cmd void vkCmdBlitImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004232 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004233 VkImage srcImage,
4234 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004235 VkImage dstImage,
4236 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004237 u32 regionCount,
4238 const VkImageBlit* pRegions,
Jesse Hall23ff73f2015-11-29 14:36:39 -08004239 VkFilter filter) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004240 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004241 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004242 dstImageObject := GetImage(dstImage)
4243 assert(commandBufferObject.device == srcImageObject.device)
4244 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004245
4246 regions := pRegions[0:regionCount]
4247 for i in (0 .. regionCount) {
4248 region := regions[i]
4249 }
4250
Jesse Hall3fbc8562015-11-29 22:10:52 -08004251 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4252 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004253
Jesse Hall3fbc8562015-11-29 22:10:52 -08004254 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004255}
4256
4257@threadSafety("app")
4258cmd void vkCmdCopyBufferToImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004259 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004260 VkBuffer srcBuffer,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004261 VkImage dstImage,
4262 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004263 u32 regionCount,
4264 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004265 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004266 srcBufferObject := GetBuffer(srcBuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004267 dstImageObject := GetImage(dstImage)
4268 assert(commandBufferObject.device == srcBufferObject.device)
4269 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004270
4271 regions := pRegions[0:regionCount]
4272 for i in (0 .. regionCount) {
4273 region := regions[i]
4274 }
4275
Jesse Hall3fbc8562015-11-29 22:10:52 -08004276 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory)
4277 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004278
Jesse Hall65ab5522015-11-30 00:07:16 -08004279 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004280}
4281
4282@threadSafety("app")
4283cmd void vkCmdCopyImageToBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004284 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004285 VkImage srcImage,
4286 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004287 VkBuffer dstBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004288 u32 regionCount,
4289 const VkBufferImageCopy* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004290 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004291 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004292 dstBufferObject := GetBuffer(dstBuffer)
4293 assert(commandBufferObject.device == srcImageObject.device)
4294 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004295
4296 regions := pRegions[0:regionCount]
4297 for i in (0 .. regionCount) {
4298 region := regions[i]
4299 }
4300
Jesse Hall3fbc8562015-11-29 22:10:52 -08004301 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4302 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004303
Jesse Hall65ab5522015-11-30 00:07:16 -08004304 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004305}
4306
4307@threadSafety("app")
4308cmd void vkCmdUpdateBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004309 VkCommandBuffer commandBuffer,
4310 VkBuffer dstBuffer,
4311 VkDeviceSize dstOffset,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004312 VkDeviceSize dataSize,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004313 const u32* pData) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004314 commandBufferObject := GetCommandBuffer(commandBuffer)
4315 dstBufferObject := GetBuffer(dstBuffer)
4316 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004317
4318 data := pData[0:dataSize]
4319
Jesse Hall3fbc8562015-11-29 22:10:52 -08004320 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004321
Jesse Hall65ab5522015-11-30 00:07:16 -08004322 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004323}
4324
4325@threadSafety("app")
4326cmd void vkCmdFillBuffer(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004327 VkCommandBuffer commandBuffer,
4328 VkBuffer dstBuffer,
4329 VkDeviceSize dstOffset,
Jesse Hallb00daad2015-11-29 19:46:20 -08004330 VkDeviceSize size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004331 u32 data) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004332 commandBufferObject := GetCommandBuffer(commandBuffer)
4333 dstBufferObject := GetBuffer(dstBuffer)
4334 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004335
Jesse Hall65ab5522015-11-30 00:07:16 -08004336 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004337}
4338
4339@threadSafety("app")
4340cmd void vkCmdClearColorImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004341 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004342 VkImage image,
4343 VkImageLayout imageLayout,
4344 const VkClearColorValue* pColor,
4345 u32 rangeCount,
4346 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004347 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004348 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004349 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004350
4351 ranges := pRanges[0:rangeCount]
4352 for i in (0 .. rangeCount) {
4353 range := ranges[i]
4354 }
4355
Jesse Hall3fbc8562015-11-29 22:10:52 -08004356 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004357
Jesse Hall3fbc8562015-11-29 22:10:52 -08004358 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004359}
4360
4361@threadSafety("app")
4362cmd void vkCmdClearDepthStencilImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004363 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004364 VkImage image,
4365 VkImageLayout imageLayout,
Jesse Hall5ae3abb2015-10-08 14:00:22 -07004366 const VkClearDepthStencilValue* pDepthStencil,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004367 u32 rangeCount,
4368 const VkImageSubresourceRange* pRanges) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004369 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004370 imageObject := GetImage(image)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004371 assert(commandBufferObject.device == imageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004372
4373 ranges := pRanges[0:rangeCount]
4374 for i in (0 .. rangeCount) {
4375 range := ranges[i]
4376 }
4377
Jesse Hall3fbc8562015-11-29 22:10:52 -08004378 bindCommandBuffer(commandBuffer, image, imageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004379
Jesse Hall3fbc8562015-11-29 22:10:52 -08004380 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004381}
4382
4383@threadSafety("app")
Jesse Hallae38f732015-11-19 21:32:50 -08004384cmd void vkCmdClearAttachments(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004385 VkCommandBuffer commandBuffer,
Jesse Hallae38f732015-11-19 21:32:50 -08004386 u32 attachmentCount,
4387 const VkClearAttachment* pAttachments,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004388 u32 rectCount,
Jesse Halla15a4bf2015-11-19 22:48:02 -08004389 const VkClearRect* pRects) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004390 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004391
4392 rects := pRects[0:rectCount]
4393 for i in (0 .. rectCount) {
4394 rect := rects[i]
4395 }
4396
Jesse Hall3fbc8562015-11-29 22:10:52 -08004397 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004398}
4399
4400@threadSafety("app")
4401cmd void vkCmdResolveImage(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004402 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004403 VkImage srcImage,
4404 VkImageLayout srcImageLayout,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004405 VkImage dstImage,
4406 VkImageLayout dstImageLayout,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004407 u32 regionCount,
4408 const VkImageResolve* pRegions) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004409 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004410 srcImageObject := GetImage(srcImage)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004411 dstImageObject := GetImage(dstImage)
4412 assert(commandBufferObject.device == srcImageObject.device)
4413 assert(commandBufferObject.device == dstImageObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004414
4415 regions := pRegions[0:regionCount]
4416 for i in (0 .. regionCount) {
4417 region := regions[i]
4418 }
4419
Jesse Hall3fbc8562015-11-29 22:10:52 -08004420 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory)
4421 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004422
Jesse Hall3fbc8562015-11-29 22:10:52 -08004423 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004424}
4425
4426@threadSafety("app")
4427cmd void vkCmdSetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004428 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004429 VkEvent event,
4430 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004431 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004432 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004433 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004434}
4435
4436@threadSafety("app")
4437cmd void vkCmdResetEvent(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004438 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004439 VkEvent event,
4440 VkPipelineStageFlags stageMask) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004441 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004442 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004443 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004444}
4445
4446@threadSafety("app")
4447cmd void vkCmdWaitEvents(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004448 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004449 u32 eventCount,
4450 const VkEvent* pEvents,
4451 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004452 VkPipelineStageFlags dstStageMask,
4453 u32 memoryBarrierCount,
4454 const void* const* ppMemoryBarriers) {
4455 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004456
4457 events := pEvents[0:eventCount]
4458 for i in (0 .. eventCount) {
4459 event := events[i]
4460 eventObject := GetEvent(event)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004461 assert(commandBufferObject.device == eventObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004462 }
4463
Jesse Hall3fbc8562015-11-29 22:10:52 -08004464 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4465 for i in (0 .. memoryBarrierCount) {
4466 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004467 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004468 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004469 }
4470 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004471 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4472 imageObject := GetImage(imageMemoryBarrier.image)
4473 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004474 }
4475 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004476 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4477 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4478 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004479 }
4480 }
4481 }
4482}
4483
4484@threadSafety("app")
4485cmd void vkCmdPipelineBarrier(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004486 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004487 VkPipelineStageFlags srcStageMask,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004488 VkPipelineStageFlags dstStageMask,
Jesse Halldc6d36c2015-11-29 19:12:15 -08004489 VkDependencyFlags dependencyFlags,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004490 u32 memoryBarrierCount,
4491 const void* const* ppMemoryBarriers) {
4492 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004493
Jesse Hall3fbc8562015-11-29 22:10:52 -08004494 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount]
4495 for i in (0 .. memoryBarrierCount) {
4496 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType {
Jesse Halld27f6aa2015-08-15 17:58:48 -07004497 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004498 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0]
Jesse Halld27f6aa2015-08-15 17:58:48 -07004499 }
4500 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004501 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0]
4502 imageObject := GetImage(imageMemoryBarrier.image)
4503 assert(imageObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004504 }
4505 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004506 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0]
4507 bufferObject := GetBuffer(bufferMemoryBarrier.buffer)
4508 assert(bufferObject.device == commandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004509 }
4510 }
4511 }
4512}
4513
4514@threadSafety("app")
4515cmd void vkCmdBeginQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004516 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004517 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004518 u32 entry,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004519 VkQueryControlFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004520 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004521 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004522 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004523}
4524
4525@threadSafety("app")
4526cmd void vkCmdEndQuery(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004527 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004528 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004529 u32 entry) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004530 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004531 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004532 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004533}
4534
4535@threadSafety("app")
4536cmd void vkCmdResetQueryPool(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004537 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004538 VkQueryPool queryPool,
4539 u32 startQuery,
4540 u32 queryCount) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004541 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004542 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004543 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004544}
4545
4546@threadSafety("app")
4547cmd void vkCmdWriteTimestamp(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004548 VkCommandBuffer commandBuffer,
Jesse Hall6f39a6d2015-11-24 11:08:36 -08004549 VkPipelineStageFlagBits pipelineStage,
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004550 VkQueryPool queryPool,
Jesse Hall65ab5522015-11-30 00:07:16 -08004551 u32 entry) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004552 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halla3a7a1d2015-11-24 11:37:23 -08004553 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004554 assert(commandBufferObject.device == queryPoolObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004555}
4556
4557@threadSafety("app")
4558cmd void vkCmdCopyQueryPoolResults(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004559 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004560 VkQueryPool queryPool,
4561 u32 startQuery,
4562 u32 queryCount,
Jesse Hall3fbc8562015-11-29 22:10:52 -08004563 VkBuffer dstBuffer,
4564 VkDeviceSize dstOffset,
Jesse Halla9bb62b2015-11-21 19:31:56 -08004565 VkDeviceSize stride,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004566 VkQueryResultFlags flags) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004567 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004568 queryPoolObject := GetQueryPool(queryPool)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004569 dstBufferObject := GetBuffer(dstBuffer)
4570 assert(commandBufferObject.device == queryPoolObject.device)
4571 assert(commandBufferObject.device == dstBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004572}
4573
4574cmd void vkCmdPushConstants(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004575 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004576 VkPipelineLayout layout,
4577 VkShaderStageFlags stageFlags,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004578 u32 offset,
4579 u32 size,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004580 const void* values) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004581 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004582 layoutObject := GetPipelineLayout(layout)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004583 assert(commandBufferObject.device == layoutObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004584}
4585
4586@threadSafety("app")
4587cmd void vkCmdBeginRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004588 VkCommandBuffer commandBuffer,
Jesse Halld27f6aa2015-08-15 17:58:48 -07004589 const VkRenderPassBeginInfo* pRenderPassBegin,
Jesse Hall65ab5522015-11-30 00:07:16 -08004590 VkSubpassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004591 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004592 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass)
4593 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer)
Jesse Hall3fbc8562015-11-29 22:10:52 -08004594 assert(commandBufferObject.device == renderPassObject.device)
4595 assert(commandBufferObject.device == framebufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004596
Jesse Hall3fbc8562015-11-29 22:10:52 -08004597 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004598}
4599
4600cmd void vkCmdNextSubpass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004601 VkCommandBuffer commandBuffer,
Jesse Hall65ab5522015-11-30 00:07:16 -08004602 VkSubpassContents contents) {
Jesse Hall3fbc8562015-11-29 22:10:52 -08004603 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004604}
4605
4606@threadSafety("app")
4607cmd void vkCmdEndRenderPass(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004608 VkCommandBuffer commandBuffer) {
4609 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004610
Jesse Hall3fbc8562015-11-29 22:10:52 -08004611 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004612}
4613
4614cmd void vkCmdExecuteCommands(
Jesse Hall3fbc8562015-11-29 22:10:52 -08004615 VkCommandBuffer commandBuffer,
4616 u32 commandBuffersCount,
4617 const VkCommandBuffer* pCommandBuffers) {
4618 commandBufferObject := GetCommandBuffer(commandBuffer)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004619
Jesse Hall3fbc8562015-11-29 22:10:52 -08004620 commandBuffers := pCommandBuffers[0:commandBuffersCount]
4621 for i in (0 .. commandBuffersCount) {
4622 secondaryCommandBuffer := commandBuffers[i]
4623 secondaryCommandBufferObject := GetCommandBuffer(secondaryCommandBuffer)
4624 assert(commandBufferObject.device == secondaryCommandBufferObject.device)
Jesse Halld27f6aa2015-08-15 17:58:48 -07004625 }
4626}
4627
Jesse Hall1356b0d2015-11-23 17:24:58 -08004628@extension("VK_EXT_KHR_surface")
4629cmd void vkDestroySurfaceKHR(
4630 VkInstance instance,
4631 VkSurfaceKHR surface) {
4632 instanceObject := GetInstance(instance)
4633 surfaceObject := GetSurface(surface)
4634 assert(surfaceObject.instance == instance)
Michael Lentine88594d72015-11-12 12:49:45 -08004635
Jesse Hall1356b0d2015-11-23 17:24:58 -08004636 State.Surfaces[surface] = null
Jesse Hall2818f932015-11-19 21:19:17 -08004637}
4638
Jesse Hall1356b0d2015-11-23 17:24:58 -08004639@extension("VK_EXT_KHR_surface")
Jesse Halla6429252015-11-29 18:59:42 -08004640cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004641 VkPhysicalDevice physicalDevice,
4642 u32 queueFamilyIndex,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004643 VkSurfaceKHR surface,
Jesse Hallb00daad2015-11-29 19:46:20 -08004644 VkBool32* pSupported) {
4645 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004646
4647 return ?
4648}
4649
Jesse Hallb00daad2015-11-29 19:46:20 -08004650@extension("VK_EXT_KHR_surface")
4651cmd VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
4652 VkPhysicalDevice physicalDevice,
4653 VkSurfaceKHR surface,
4654 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) {
4655 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4656
4657 surfaceCapabilities := ?
4658 pSurfaceCapabilities[0] = surfaceCapabilities
4659
4660 return ?
4661}
4662
4663@extension("VK_EXT_KHR_surface")
4664cmd VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(
4665 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004666 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004667 u32* pSurfaceFormatCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004668 VkSurfaceFormatKHR* pSurfaceFormats) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004669 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004670
4671 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004672 pSurfaceFormatCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004673 surfaceFormats := pSurfaceFormats[0:count]
4674
4675 for i in (0 .. count) {
4676 surfaceFormat := ?
4677 surfaceFormats[i] = surfaceFormat
4678 }
4679
4680 return ?
4681}
4682
Jesse Hallb00daad2015-11-29 19:46:20 -08004683@extension("VK_EXT_KHR_surface")
4684cmd VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(
4685 VkPhysicalDevice physicalDevice,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004686 VkSurfaceKHR surface,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004687 u32* pPresentModeCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004688 VkPresentModeKHR* pPresentModes) {
Jesse Hallb00daad2015-11-29 19:46:20 -08004689 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
Michael Lentine88594d72015-11-12 12:49:45 -08004690
4691 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004692 pPresentModeCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004693 presentModes := pPresentModes[0:count]
4694
4695 for i in (0 .. count) {
4696 presentMode := ?
4697 presentModes[i] = presentMode
4698 }
4699
4700 return ?
4701}
4702
Jesse Hall1356b0d2015-11-23 17:24:58 -08004703@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004704cmd VkResult vkCreateSwapchainKHR(
4705 VkDevice device,
4706 const VkSwapchainCreateInfoKHR* pCreateInfo,
4707 VkSwapchainKHR* pSwapchain) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004708 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
Michael Lentine88594d72015-11-12 12:49:45 -08004709 deviceObject := GetDevice(device)
4710
4711 swapchain := ?
4712 pSwapchain[0] = swapchain
4713 State.Swapchains[swapchain] = new!SwapchainObject(device: device)
4714
4715 return ?
4716}
4717
Jesse Hall1356b0d2015-11-23 17:24:58 -08004718@extension("VK_EXT_KHR_swapchain")
4719cmd void vkDestroySwapchainKHR(
Michael Lentine88594d72015-11-12 12:49:45 -08004720 VkDevice device,
4721 VkSwapchainKHR swapchain) {
4722 deviceObject := GetDevice(device)
4723 swapchainObject := GetSwapchain(swapchain)
4724 assert(swapchainObject.device == device)
4725
4726 State.Swapchains[swapchain] = null
Michael Lentine88594d72015-11-12 12:49:45 -08004727}
4728
Jesse Hall1356b0d2015-11-23 17:24:58 -08004729@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004730cmd VkResult vkGetSwapchainImagesKHR(
4731 VkDevice device,
4732 VkSwapchainKHR swapchain,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004733 u32* pSwapchainImageCount,
Michael Lentine88594d72015-11-12 12:49:45 -08004734 VkImage* pSwapchainImages) {
4735 deviceObject := GetDevice(device)
4736
4737 count := as!u32(?)
Jesse Hall03b6fe12015-11-24 12:44:21 -08004738 pSwapchainImageCount[0] = count
Michael Lentine88594d72015-11-12 12:49:45 -08004739 swapchainImages := pSwapchainImages[0:count]
4740
4741 for i in (0 .. count) {
4742 swapchainImage := ?
4743 swapchainImages[i] = swapchainImage
Jesse Hall1356b0d2015-11-23 17:24:58 -08004744 State.Images[swapchainImage] = new!ImageObject(device: device)
Michael Lentine88594d72015-11-12 12:49:45 -08004745 }
4746
4747 return ?
4748}
4749
Jesse Hall1356b0d2015-11-23 17:24:58 -08004750@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004751cmd VkResult vkAcquireNextImageKHR(
4752 VkDevice device,
4753 VkSwapchainKHR swapchain,
4754 u64 timeout,
4755 VkSemaphore semaphore,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004756 VkFence fence,
Michael Lentine88594d72015-11-12 12:49:45 -08004757 u32* pImageIndex) {
4758 deviceObject := GetDevice(device)
4759 swapchainObject := GetSwapchain(swapchain)
4760
4761 imageIndex := ?
4762 pImageIndex[0] = imageIndex
4763
4764 return ?
4765}
4766
Jesse Hall1356b0d2015-11-23 17:24:58 -08004767@extension("VK_EXT_KHR_swapchain")
Michael Lentine88594d72015-11-12 12:49:45 -08004768cmd VkResult vkQueuePresentKHR(
4769 VkQueue queue,
4770 VkPresentInfoKHR* pPresentInfo) {
4771 queueObject := GetQueue(queue)
4772
4773 presentInfo := ?
4774 pPresentInfo[0] = presentInfo
4775
4776 return ?
4777}
4778
Jesse Hall1356b0d2015-11-23 17:24:58 -08004779@extension("VK_EXT_KHR_display")
4780cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
4781 VkPhysicalDevice physicalDevice,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004782 u32* pPropertyCount,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004783 VkDisplayPropertiesKHR* pProperties) {
4784 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4785 return ?
4786}
4787
4788@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004789cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
4790 VkPhysicalDevice physicalDevice,
4791 u32* pPropertyCount,
4792 VkDisplayPlanePropertiesKHR* pProperties) {
4793 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4794 return ?
4795}
4796
4797@extension("VK_EXT_KHR_display")
4798cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR(
4799 VkPhysicalDevice physicalDevice,
4800 u32* pPropertyCount,
4801 VkDisplayKHR* pProperties) {
4802 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4803 return ?
4804}
4805
4806@extension("VK_EXT_KHR_display")
Jesse Hall1356b0d2015-11-23 17:24:58 -08004807cmd VkResult vkGetDisplayModePropertiesKHR(
4808 VkPhysicalDevice physicalDevice,
4809 VkDisplayKHR display,
Jesse Hall03b6fe12015-11-24 12:44:21 -08004810 u32* pPropertyCount,
4811 VkDisplayModePropertiesKHR* pProperties) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004812 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4813 return ?
4814}
4815
4816@extension("VK_EXT_KHR_display")
4817cmd VkResult vkCreateDisplayModeKHR(
4818 VkPhysicalDevice physicalDevice,
4819 VkDisplayKHR display,
4820 const VkDisplayModeCreateInfoKHR* pCreateInfo,
4821 VkDisplayModeKHR* pMode) {
4822 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4823 return ?
4824}
4825
4826@extension("VK_EXT_KHR_display")
Jesse Halla6429252015-11-29 18:59:42 -08004827cmd VkResult vkGetDisplayPlaneCapabilitiesKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004828 VkPhysicalDevice physicalDevice,
Jesse Halla6429252015-11-29 18:59:42 -08004829 VkDisplayModeCreateInfoKHR mode,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004830 u32 planeIndex,
Jesse Halla6429252015-11-29 18:59:42 -08004831 VkDisplayPlaneCapabilitiesKHR* pCapabilities) {
Jesse Hall1356b0d2015-11-23 17:24:58 -08004832 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4833 return ?
4834}
4835
Jesse Halla6429252015-11-29 18:59:42 -08004836@extension("VK_EXT_KHR_display")
4837cmd VkResult vkCreateDisplayPlaneSurfaceKHR(
4838 VkInstance instance,
4839 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
4840 VkSurfaceKHR* pSurface) {
4841 return ?
4842}
4843
4844@extension("VK_EXT_KHR_xlib_surface")
4845cmd VkResult vkCreateXlibSurfaceKHR(
Jesse Hall1356b0d2015-11-23 17:24:58 -08004846 VkInstance instance,
4847 platform.Display* dpy,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004848 platform.Window window,
4849 VkSurfaceKHR* pSurface) {
4850 instanceObject := GetInstance(instance)
4851 return ?
4852}
4853
Jesse Halla6429252015-11-29 18:59:42 -08004854@extension("VK_EXT_KHR_xlib_surface")
4855cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
4856 VkPhysicalDevice physicalDevice,
4857 u32 queueFamilyIndex,
4858 platform.Display* dpy,
Jesse Hall65ab5522015-11-30 00:07:16 -08004859 platform.VisualID visualID) {
Jesse Halla6429252015-11-29 18:59:42 -08004860 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4861 return ?
4862}
4863
Jesse Hall1356b0d2015-11-23 17:24:58 -08004864@extension("VK_EXT_KHR_xcb_surface")
4865cmd VkResult vkCreateXCBSurfaceKHR(
4866 VkInstance instance,
4867 platform.xcb_connection_t* connection,
Jesse Hall1356b0d2015-11-23 17:24:58 -08004868 platform.xcb_window_t window,
4869 VkSurfaceKHR* pSurface) {
4870 instanceObject := GetInstance(instance)
4871 return ?
4872}
4873
Jesse Halla6429252015-11-29 18:59:42 -08004874@extension("VK_EXT_KHR_xlib_surface")
4875cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
4876 VkPhysicalDevice physicalDevice,
4877 u32 queueFamilyIndex,
4878 platform.xcb_connection_t* connection,
4879 platform.xcb_visualid_t visual_id) {
4880 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4881 return ?
4882}
4883
Jesse Hall1356b0d2015-11-23 17:24:58 -08004884@extension("VK_EXT_KHR_wayland_surface")
4885cmd VkResult vkCreateWaylandSurfaceKHR(
4886 VkInstance instance,
4887 platform.wl_display* display,
4888 platform.wl_surface* surface,
4889 VkSurfaceKHR* pSurface) {
4890 instanceObject := GetInstance(instance)
4891 return ?
4892}
4893
Jesse Halla6429252015-11-29 18:59:42 -08004894@extension("VK_EXT_KHR_wayland_surface")
4895cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
4896 VkPhysicalDevice physicalDevice,
4897 u32 queueFamilyIndex,
4898 platform.wl_display* display) {
4899 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4900 return ?
4901}
4902
Jesse Hall1356b0d2015-11-23 17:24:58 -08004903@extension("VK_EXT_KHR_mir_surface")
4904cmd VkResult vkCreateMirSurfaceKHR(
4905 VkInstance instance,
4906 platform.MirConnection* connection,
4907 platform.MirSurface* mirSurface,
4908 VkSurfaceKHR* pSurface) {
4909 instanceObject := GetInstance(instance)
4910 return ?
4911}
4912
Jesse Halla6429252015-11-29 18:59:42 -08004913@extension("VK_EXT_KHR_mir_surface")
4914cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR(
4915 VkPhysicalDevice physicalDevice,
4916 u32 queueFamilyIndex,
4917 platform.MirConnection* connection) {
4918 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4919 return ?
4920}
4921
Jesse Hall1356b0d2015-11-23 17:24:58 -08004922@extension("VK_EXT_KHR_android_surface")
4923cmd VkResult vkCreateAndroidSurfaceKHR(
4924 VkInstance instance,
4925 platform.ANativeWindow* window
4926 VkSurfaceKHR* pSurface) {
4927 instanceObject := GetInstance(instance)
4928 return ?
4929}
4930
4931@extension("VK_EXT_KHR_win32_surface")
4932cmd VkResult vkCreateWin32SurfaceKHR(
4933 VkInstance instance,
4934 platform.HINSTANCE hinstance,
4935 platform.HWND hwnd,
4936 VkSurfaceKHR* pSurface) {
4937 instanceObject := GetInstance(instance)
4938 return ?
4939}
4940
Jesse Halla6429252015-11-29 18:59:42 -08004941@extension("VK_EXT_KHR_win32_surface")
4942cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR(
4943 VkPhysicalDevice physicalDevice,
4944 u32 queueFamilyIndex) {
4945 physicalDeviceObject := GetPhysicalDevice(physicalDevice)
4946 return ?
4947}
4948
Jesse Halld27f6aa2015-08-15 17:58:48 -07004949
4950////////////////
4951// Validation //
4952////////////////
4953
4954extern void validate(string layerName, bool condition, string message)
4955
4956
4957/////////////////////////////
4958// Internal State Tracking //
4959/////////////////////////////
4960
4961StateObject State
4962
4963@internal class StateObject {
4964 // Dispatchable objects.
4965 map!(VkInstance, ref!InstanceObject) Instances
4966 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices
4967 map!(VkDevice, ref!DeviceObject) Devices
4968 map!(VkQueue, ref!QueueObject) Queues
Jesse Hall3fbc8562015-11-29 22:10:52 -08004969 map!(VkCommandBuffer, ref!CommandBufferObject) CommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07004970
4971 // Non-dispatchable objects.
4972 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories
4973 map!(VkBuffer, ref!BufferObject) Buffers
4974 map!(VkBufferView, ref!BufferViewObject) BufferViews
4975 map!(VkImage, ref!ImageObject) Images
4976 map!(VkImageView, ref!ImageViewObject) ImageViews
Jesse Halld27f6aa2015-08-15 17:58:48 -07004977 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules
4978 map!(VkShader, ref!ShaderObject) Shaders
4979 map!(VkPipeline, ref!PipelineObject) Pipelines
4980 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts
4981 map!(VkSampler, ref!SamplerObject) Samplers
4982 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets
4983 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts
4984 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools
Jesse Halld27f6aa2015-08-15 17:58:48 -07004985 map!(VkFence, ref!FenceObject) Fences
4986 map!(VkSemaphore, ref!SemaphoreObject) Semaphores
4987 map!(VkEvent, ref!EventObject) Events
4988 map!(VkQueryPool, ref!QueryPoolObject) QueryPools
4989 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers
4990 map!(VkRenderPass, ref!RenderPassObject) RenderPasses
4991 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches
Jesse Hall3fbc8562015-11-29 22:10:52 -08004992 map!(VkCommandPool, ref!CommandPoolObject) CommandPools
Jesse Hall1356b0d2015-11-23 17:24:58 -08004993 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces
Michael Lentine88594d72015-11-12 12:49:45 -08004994 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains
Jesse Halld27f6aa2015-08-15 17:58:48 -07004995}
4996
4997@internal class InstanceObject {
4998}
4999
5000@internal class PhysicalDeviceObject {
5001 VkInstance instance
5002}
5003
5004@internal class DeviceObject {
5005 VkPhysicalDevice physicalDevice
5006}
5007
5008@internal class QueueObject {
5009 VkDevice device
5010 VkQueueFlags flags
5011}
5012
Jesse Hall3fbc8562015-11-29 22:10:52 -08005013@internal class CommandBufferObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07005014 VkDevice device
5015 map!(u64, VkDeviceMemory) boundObjects
5016 VkQueueFlags queueFlags
5017}
5018
5019@internal class DeviceMemoryObject {
Jesse Hall3fbc8562015-11-29 22:10:52 -08005020 VkDevice device
5021 VkDeviceSize allocationSize
5022 map!(u64, VkDeviceSize) boundObjects
5023 map!(VkCommandBuffer, VkCommandBuffer) boundCommandBuffers
Jesse Halld27f6aa2015-08-15 17:58:48 -07005024}
5025
5026@internal class BufferObject {
5027 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005028 VkDeviceMemory memory
5029 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005030}
5031
5032@internal class BufferViewObject {
5033 VkDevice device
5034 VkBuffer buffer
5035}
5036
5037@internal class ImageObject {
5038 VkDevice device
Jesse Hall3fbc8562015-11-29 22:10:52 -08005039 VkDeviceMemory memory
5040 VkDeviceSize memoryOffset
Jesse Halld27f6aa2015-08-15 17:58:48 -07005041}
5042
5043@internal class ImageViewObject {
5044 VkDevice device
5045 VkImage image
5046}
5047
Jesse Halld27f6aa2015-08-15 17:58:48 -07005048@internal class ShaderObject {
5049 VkDevice device
5050}
5051
5052@internal class ShaderModuleObject {
5053 VkDevice device
5054}
5055
5056@internal class PipelineObject {
5057 VkDevice device
5058}
5059
5060@internal class PipelineLayoutObject {
5061 VkDevice device
5062}
5063
5064@internal class SamplerObject {
5065 VkDevice device
5066}
5067
5068@internal class DescriptorSetObject {
5069 VkDevice device
5070}
5071
5072@internal class DescriptorSetLayoutObject {
5073 VkDevice device
5074}
5075
5076@internal class DescriptorPoolObject {
5077 VkDevice device
5078}
5079
Jesse Halld27f6aa2015-08-15 17:58:48 -07005080@internal class FenceObject {
5081 VkDevice device
5082 bool signaled
5083}
5084
5085@internal class SemaphoreObject {
5086 VkDevice device
5087}
5088
5089@internal class EventObject {
5090 VkDevice device
5091}
5092
5093@internal class QueryPoolObject {
5094 VkDevice device
5095}
5096
5097@internal class FramebufferObject {
5098 VkDevice device
5099}
5100
5101@internal class RenderPassObject {
5102 VkDevice device
5103}
5104
5105@internal class PipelineCacheObject {
5106 VkDevice device
5107}
5108
Jesse Hall3fbc8562015-11-29 22:10:52 -08005109@internal class CommandPoolObject {
Jesse Halld27f6aa2015-08-15 17:58:48 -07005110 VkDevice device
5111}
5112
Jesse Hall1356b0d2015-11-23 17:24:58 -08005113@internal class SurfaceObject {
5114 VkInstance instance
5115}
5116
Michael Lentine88594d72015-11-12 12:49:45 -08005117@internal class SwapchainObject {
5118 VkDevice device
5119}
5120
Jesse Halld27f6aa2015-08-15 17:58:48 -07005121macro ref!InstanceObject GetInstance(VkInstance instance) {
5122 assert(instance in State.Instances)
5123 return State.Instances[instance]
5124}
5125
5126macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) {
5127 assert(physicalDevice in State.PhysicalDevices)
5128 return State.PhysicalDevices[physicalDevice]
5129}
5130
5131macro ref!DeviceObject GetDevice(VkDevice device) {
5132 assert(device in State.Devices)
5133 return State.Devices[device]
5134}
5135
5136macro ref!QueueObject GetQueue(VkQueue queue) {
5137 assert(queue in State.Queues)
5138 return State.Queues[queue]
5139}
5140
Jesse Hall3fbc8562015-11-29 22:10:52 -08005141macro ref!CommandBufferObject GetCommandBuffer(VkCommandBuffer commandBuffer) {
5142 assert(commandBuffer in State.CommandBuffers)
5143 return State.CommandBuffers[commandBuffer]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005144}
5145
Jesse Hall3fbc8562015-11-29 22:10:52 -08005146macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory memory) {
5147 assert(memory in State.DeviceMemories)
5148 return State.DeviceMemories[memory]
Jesse Halld27f6aa2015-08-15 17:58:48 -07005149}
5150
5151macro ref!BufferObject GetBuffer(VkBuffer buffer) {
5152 assert(buffer in State.Buffers)
5153 return State.Buffers[buffer]
5154}
5155
5156macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) {
5157 assert(bufferView in State.BufferViews)
5158 return State.BufferViews[bufferView]
5159}
5160
5161macro ref!ImageObject GetImage(VkImage image) {
5162 assert(image in State.Images)
5163 return State.Images[image]
5164}
5165
5166macro ref!ImageViewObject GetImageView(VkImageView imageView) {
5167 assert(imageView in State.ImageViews)
5168 return State.ImageViews[imageView]
5169}
5170
Jesse Halld27f6aa2015-08-15 17:58:48 -07005171macro ref!ShaderObject GetShader(VkShader shader) {
5172 assert(shader in State.Shaders)
5173 return State.Shaders[shader]
5174}
5175
5176macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) {
5177 assert(shaderModule in State.ShaderModules)
5178 return State.ShaderModules[shaderModule]
5179}
5180
5181macro ref!PipelineObject GetPipeline(VkPipeline pipeline) {
5182 assert(pipeline in State.Pipelines)
5183 return State.Pipelines[pipeline]
5184}
5185
5186macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) {
5187 assert(pipelineLayout in State.PipelineLayouts)
5188 return State.PipelineLayouts[pipelineLayout]
5189}
5190
5191macro ref!SamplerObject GetSampler(VkSampler sampler) {
5192 assert(sampler in State.Samplers)
5193 return State.Samplers[sampler]
5194}
5195
5196macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) {
5197 assert(descriptorSet in State.DescriptorSets)
5198 return State.DescriptorSets[descriptorSet]
5199}
5200
5201macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) {
5202 assert(descriptorSetLayout in State.DescriptorSetLayouts)
5203 return State.DescriptorSetLayouts[descriptorSetLayout]
5204}
5205
5206macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) {
5207 assert(descriptorPool in State.DescriptorPools)
5208 return State.DescriptorPools[descriptorPool]
5209}
5210
Jesse Halld27f6aa2015-08-15 17:58:48 -07005211macro ref!FenceObject GetFence(VkFence fence) {
5212 assert(fence in State.Fences)
5213 return State.Fences[fence]
5214}
5215
5216macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) {
5217 assert(semaphore in State.Semaphores)
5218 return State.Semaphores[semaphore]
5219}
5220
5221macro ref!EventObject GetEvent(VkEvent event) {
5222 assert(event in State.Events)
5223 return State.Events[event]
5224}
5225
5226macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) {
5227 assert(queryPool in State.QueryPools)
5228 return State.QueryPools[queryPool]
5229}
5230
5231macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) {
5232 assert(framebuffer in State.Framebuffers)
5233 return State.Framebuffers[framebuffer]
5234}
5235
5236macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) {
5237 assert(renderPass in State.RenderPasses)
5238 return State.RenderPasses[renderPass]
5239}
5240
5241macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) {
5242 assert(pipelineCache in State.PipelineCaches)
5243 return State.PipelineCaches[pipelineCache]
5244}
5245
Jesse Hall3fbc8562015-11-29 22:10:52 -08005246macro ref!CommandPoolObject GetCommandPool(VkCommandPool commandPool) {
5247 assert(commandPool in State.CommandPools)
5248 return State.CommandPools[commandPool]
Jesse Hallf09c6b12015-08-15 19:54:28 -07005249}
Michael Lentine88594d72015-11-12 12:49:45 -08005250
Jesse Hall1356b0d2015-11-23 17:24:58 -08005251macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) {
5252 assert(surface in State.Surfaces)
5253 return State.Surfaces[surface]
5254}
5255
Michael Lentine88594d72015-11-12 12:49:45 -08005256macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) {
5257 assert(swapchain in State.Swapchains)
5258 return State.Swapchains[swapchain]
5259}
Jesse Halld8bade02015-11-24 10:24:18 -08005260
5261macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) {
5262 return as!VkQueueFlags(as!u32(flags) | as!u32(bit))
5263}