vulkan.api revision d1af812f20e0793d94702817d441ab799bf46df7
1// 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 30define VERSION_MINOR 197 31define VERSION_PATCH 0 32 33// API limits 34define VK_MAX_PHYSICAL_DEVICE_NAME 256 35define VK_UUID_LENGTH 16 36define VK_MAX_EXTENSION_NAME 256 37define VK_MAX_DESCRIPTION 256 38define VK_MAX_MEMORY_TYPES 32 39define VK_MAX_MEMORY_HEAPS 16 /// The maximum number of unique memory heaps, each of which supporting 1 or more memory types. 40 41// API keywords 42define VK_TRUE 1 43define VK_FALSE 0 44 45// API keyword, but needs special handling by some templates 46define NULL_HANDLE 0 47 48@extension("VK_EXT_KHR_surface") define VK_EXT_KHR_SURFACE_REVISION 20 49@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 52@extension("VK_EXT_KHR_swapchain") define VK_EXT_KHR_SWAPCHAIN_REVISION 62 53@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 56@extension("VK_EXT_KHR_display") define VK_EXT_KHR_DISPLAY_REVISION 17 57@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 60@extension("VK_EXT_KHR_display_swapchain") define VK_EXT_KHR_DISPLAY_REVISION 6 61@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 64@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" 67 68@extension("VK_EXT_KHR_xcb_surface") define VK_EXT_KHR_XCB_SURFACE_REVISION 3 69@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 72@extension("VK_EXT_KHR_wayland_surface") define VK_EXT_KHR_WAYLAND_SURFACE_REVISION 2 73@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 76@extension("VK_EXT_KHR_mir_surface") define VK_EXT_KHR_MIR_SURFACE_REVISION 2 77@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 84@extension("VK_EXT_KHR_win32_surface") define VK_EXT_KHR_WIN32_SURFACE_REVISION 2 85@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 88 89///////////// 90// Types // 91///////////// 92 93type u32 VkBool32 94type u32 VkFlags 95type u64 VkDeviceSize 96type u32 VkSampleMask 97 98/// Dispatchable handle types. 99@dispatchHandle type u64 VkInstance 100@dispatchHandle type u64 VkPhysicalDevice 101@dispatchHandle type u64 VkDevice 102@dispatchHandle type u64 VkQueue 103@dispatchHandle type u64 VkCommandBuffer 104 105/// Non dispatchable handle types. 106@nonDispatchHandle type u64 VkDeviceMemory 107@nonDispatchHandle type u64 VkCommandPool 108@nonDispatchHandle type u64 VkBuffer 109@nonDispatchHandle type u64 VkBufferView 110@nonDispatchHandle type u64 VkImage 111@nonDispatchHandle type u64 VkImageView 112@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 120@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 127 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 134 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 147 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 149 VK_IMAGE_LAYOUT_PREINITIALIZED = 0x00000008, /// Initial layout used when the data is populated by the CPU 150 151 //@extension("VK_EXT_KHR_swapchain") 152 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 0xc0000802, 153} 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 { 173 VK_IMAGE_TILING_OPTIMAL = 0x00000000, 174 VK_IMAGE_TILING_LINEAR = 0x00000001, 175} 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 187enum VkCommandBufferLevel { 188 VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0x00000000, 189 VK_COMMAND_BUFFER_LEVEL_SECONDARY = 0x00000001, 190} 191 192enum VkChannelSwizzle { 193 VK_CHANNEL_SWIZZLE_IDENTITY = 0x00000000, 194 VK_CHANNEL_SWIZZLE_ZERO = 0x00000001, 195 VK_CHANNEL_SWIZZLE_ONE = 0x00000002, 196 VK_CHANNEL_SWIZZLE_R = 0x00000003, 197 VK_CHANNEL_SWIZZLE_G = 0x00000004, 198 VK_CHANNEL_SWIZZLE_B = 0x00000005, 199 VK_CHANNEL_SWIZZLE_A = 0x00000006, 200} 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 216enum VkQueryType { 217 VK_QUERY_TYPE_OCCLUSION = 0x00000000, 218 VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, /// Optional 219 VK_QUERY_TYPE_TIMESTAMP = 0x00000002, 220} 221 222enum 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 { 232 VK_PIPELINE_BIND_POINT_GRAPHICS = 0x00000000, 233 VK_PIPELINE_BIND_POINT_COMPUTE = 0x00000001, 234} 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, 243 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, 247 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 260enum VkFilter { 261 VK_FILTER_NEAREST = 0x00000000, 262 VK_FILTER_LINEAR = 0x00000001, 263} 264 265enum 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 269} 270 271enum VkSamplerAddressMode { 272 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, 277} 278 279enum VkCompareOp { 280 VK_COMPARE_OP_NEVER = 0x00000000, 281 VK_COMPARE_OP_LESS = 0x00000001, 282 VK_COMPARE_OP_EQUAL = 0x00000002, 283 VK_COMPARE_OP_LESS_OR_EQUAL = 0x00000003, 284 VK_COMPARE_OP_GREATER = 0x00000004, 285 VK_COMPARE_OP_NOT_EQUAL = 0x00000005, 286 VK_COMPARE_OP_GREATER_OR_EQUAL = 0x00000006, 287 VK_COMPARE_OP_ALWAYS = 0x00000007, 288} 289 290enum VkFillMode { 291 VK_FILL_MODE_SOLID = 0x00000000, 292 VK_FILL_MODE_WIREFRAME = 0x00000001, 293 VK_FILL_MODE_POINTS = 0x00000002, 294} 295 296enum VkFrontFace { 297 VK_FRONT_FACE_COUNTER_CLOCKWISE = 0x00000000, 298 VK_FRONT_FACE_CLOCKWISE = 0x00000001, 299} 300 301enum VkBlend { 302 VK_BLEND_ZERO = 0x00000000, 303 VK_BLEND_ONE = 0x00000001, 304 VK_BLEND_SRC_COLOR = 0x00000002, 305 VK_BLEND_ONE_MINUS_SRC_COLOR = 0x00000003, 306 VK_BLEND_DST_COLOR = 0x00000004, 307 VK_BLEND_ONE_MINUS_DST_COLOR = 0x00000005, 308 VK_BLEND_SRC_ALPHA = 0x00000006, 309 VK_BLEND_ONE_MINUS_SRC_ALPHA = 0x00000007, 310 VK_BLEND_DST_ALPHA = 0x00000008, 311 VK_BLEND_ONE_MINUS_DST_ALPHA = 0x00000009, 312 VK_BLEND_CONSTANT_COLOR = 0x0000000a, 313 VK_BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0000000b, 314 VK_BLEND_CONSTANT_ALPHA = 0x0000000c, 315 VK_BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x0000000d, 316 VK_BLEND_SRC_ALPHA_SATURATE = 0x0000000e, 317 VK_BLEND_SRC1_COLOR = 0x0000000f, 318 VK_BLEND_ONE_MINUS_SRC1_COLOR = 0x00000010, 319 VK_BLEND_SRC1_ALPHA = 0x00000011, 320 VK_BLEND_ONE_MINUS_SRC1_ALPHA = 0x00000012, 321} 322 323enum VkBlendOp { 324 VK_BLEND_OP_ADD = 0x00000000, 325 VK_BLEND_OP_SUBTRACT = 0x00000001, 326 VK_BLEND_OP_REVERSE_SUBTRACT = 0x00000002, 327 VK_BLEND_OP_MIN = 0x00000003, 328 VK_BLEND_OP_MAX = 0x00000004, 329} 330 331enum VkStencilOp { 332 VK_STENCIL_OP_KEEP = 0x00000000, 333 VK_STENCIL_OP_ZERO = 0x00000001, 334 VK_STENCIL_OP_REPLACE = 0x00000002, 335 VK_STENCIL_OP_INCREMENT_AND_CLAMP = 0x00000003, 336 VK_STENCIL_OP_DECREMENT_AND_CLAMP = 0x00000004, 337 VK_STENCIL_OP_INVERT = 0x00000005, 338 VK_STENCIL_OP_INCREMENT_AND_WRAP = 0x00000006, 339 VK_STENCIL_OP_DECREMENT_AND_WRAP = 0x00000007, 340} 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, 348 VK_LOGIC_OP_NO_OP = 0x00000005, 349 VK_LOGIC_OP_XOR = 0x00000006, 350 VK_LOGIC_OP_OR = 0x00000007, 351 VK_LOGIC_OP_NOR = 0x00000008, 352 VK_LOGIC_OP_EQUIVALENT = 0x00000009, 353 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 361enum 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, 367} 368 369enum VkInternalAllocationType { 370 VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0x00000000, 371} 372 373enum VkPhysicalDeviceType { 374 VK_PHYSICAL_DEVICE_TYPE_OTHER = 0x00000000, 375 VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 0x00000001, 376 VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 0x00000002, 377 VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 0x00000003, 378 VK_PHYSICAL_DEVICE_TYPE_CPU = 0x00000004, 379} 380 381enum VkVertexInputStepRate { 382 VK_VERTEX_INPUT_STEP_RATE_VERTEX = 0x00000000, 383 VK_VERTEX_INPUT_STEP_RATE_INSTANCE = 0x00000001, 384} 385 386/// Vulkan format definitions 387enum VkFormat { 388 VK_FORMAT_UNDEFINED = 0x00000000, 389 VK_FORMAT_R4G4_UNORM = 0x00000001, 390 VK_FORMAT_R4G4_USCALED = 0x00000002, 391 VK_FORMAT_R4G4B4A4_UNORM = 0x00000003, 392 VK_FORMAT_R4G4B4A4_USCALED = 0x00000004, 393 VK_FORMAT_R5G6B5_UNORM = 0x00000005, 394 VK_FORMAT_R5G6B5_USCALED = 0x00000006, 395 VK_FORMAT_R5G5B5A1_UNORM = 0x00000007, 396 VK_FORMAT_R5G5B5A1_USCALED = 0x00000008, 397 VK_FORMAT_R8_UNORM = 0x00000009, 398 VK_FORMAT_R8_SNORM = 0x0000000A, 399 VK_FORMAT_R8_USCALED = 0x0000000B, 400 VK_FORMAT_R8_SSCALED = 0x0000000C, 401 VK_FORMAT_R8_UINT = 0x0000000D, 402 VK_FORMAT_R8_SINT = 0x0000000E, 403 VK_FORMAT_R8_SRGB = 0x0000000F, 404 VK_FORMAT_R8G8_UNORM = 0x00000010, 405 VK_FORMAT_R8G8_SNORM = 0x00000011, 406 VK_FORMAT_R8G8_USCALED = 0x00000012, 407 VK_FORMAT_R8G8_SSCALED = 0x00000013, 408 VK_FORMAT_R8G8_UINT = 0x00000014, 409 VK_FORMAT_R8G8_SINT = 0x00000015, 410 VK_FORMAT_R8G8_SRGB = 0x00000016, 411 VK_FORMAT_R8G8B8_UNORM = 0x00000017, 412 VK_FORMAT_R8G8B8_SNORM = 0x00000018, 413 VK_FORMAT_R8G8B8_USCALED = 0x00000019, 414 VK_FORMAT_R8G8B8_SSCALED = 0x0000001A, 415 VK_FORMAT_R8G8B8_UINT = 0x0000001B, 416 VK_FORMAT_R8G8B8_SINT = 0x0000001C, 417 VK_FORMAT_R8G8B8_SRGB = 0x0000001D, 418 VK_FORMAT_R8G8B8A8_UNORM = 0x0000001E, 419 VK_FORMAT_R8G8B8A8_SNORM = 0x0000001F, 420 VK_FORMAT_R8G8B8A8_USCALED = 0x00000020, 421 VK_FORMAT_R8G8B8A8_SSCALED = 0x00000021, 422 VK_FORMAT_R8G8B8A8_UINT = 0x00000022, 423 VK_FORMAT_R8G8B8A8_SINT = 0x00000023, 424 VK_FORMAT_R8G8B8A8_SRGB = 0x00000024, 425 VK_FORMAT_R10G10B10A2_UNORM = 0x00000025, 426 VK_FORMAT_R10G10B10A2_SNORM = 0x00000026, 427 VK_FORMAT_R10G10B10A2_USCALED = 0x00000027, 428 VK_FORMAT_R10G10B10A2_SSCALED = 0x00000028, 429 VK_FORMAT_R10G10B10A2_UINT = 0x00000029, 430 VK_FORMAT_R10G10B10A2_SINT = 0x0000002A, 431 VK_FORMAT_R16_UNORM = 0x0000002B, 432 VK_FORMAT_R16_SNORM = 0x0000002C, 433 VK_FORMAT_R16_USCALED = 0x0000002D, 434 VK_FORMAT_R16_SSCALED = 0x0000002E, 435 VK_FORMAT_R16_UINT = 0x0000002F, 436 VK_FORMAT_R16_SINT = 0x00000030, 437 VK_FORMAT_R16_SFLOAT = 0x00000031, 438 VK_FORMAT_R16G16_UNORM = 0x00000032, 439 VK_FORMAT_R16G16_SNORM = 0x00000033, 440 VK_FORMAT_R16G16_USCALED = 0x00000034, 441 VK_FORMAT_R16G16_SSCALED = 0x00000035, 442 VK_FORMAT_R16G16_UINT = 0x00000036, 443 VK_FORMAT_R16G16_SINT = 0x00000037, 444 VK_FORMAT_R16G16_SFLOAT = 0x00000038, 445 VK_FORMAT_R16G16B16_UNORM = 0x00000039, 446 VK_FORMAT_R16G16B16_SNORM = 0x0000003A, 447 VK_FORMAT_R16G16B16_USCALED = 0x0000003B, 448 VK_FORMAT_R16G16B16_SSCALED = 0x0000003C, 449 VK_FORMAT_R16G16B16_UINT = 0x0000003D, 450 VK_FORMAT_R16G16B16_SINT = 0x0000003E, 451 VK_FORMAT_R16G16B16_SFLOAT = 0x0000003F, 452 VK_FORMAT_R16G16B16A16_UNORM = 0x00000040, 453 VK_FORMAT_R16G16B16A16_SNORM = 0x00000041, 454 VK_FORMAT_R16G16B16A16_USCALED = 0x00000042, 455 VK_FORMAT_R16G16B16A16_SSCALED = 0x00000043, 456 VK_FORMAT_R16G16B16A16_UINT = 0x00000044, 457 VK_FORMAT_R16G16B16A16_SINT = 0x00000045, 458 VK_FORMAT_R16G16B16A16_SFLOAT = 0x00000046, 459 VK_FORMAT_R32_UINT = 0x00000047, 460 VK_FORMAT_R32_SINT = 0x00000048, 461 VK_FORMAT_R32_SFLOAT = 0x00000049, 462 VK_FORMAT_R32G32_UINT = 0x0000004A, 463 VK_FORMAT_R32G32_SINT = 0x0000004B, 464 VK_FORMAT_R32G32_SFLOAT = 0x0000004C, 465 VK_FORMAT_R32G32B32_UINT = 0x0000004D, 466 VK_FORMAT_R32G32B32_SINT = 0x0000004E, 467 VK_FORMAT_R32G32B32_SFLOAT = 0x0000004F, 468 VK_FORMAT_R32G32B32A32_UINT = 0x00000050, 469 VK_FORMAT_R32G32B32A32_SINT = 0x00000051, 470 VK_FORMAT_R32G32B32A32_SFLOAT = 0x00000052, 471 VK_FORMAT_R64_SFLOAT = 0x00000053, 472 VK_FORMAT_R64G64_SFLOAT = 0x00000054, 473 VK_FORMAT_R64G64B64_SFLOAT = 0x00000055, 474 VK_FORMAT_R64G64B64A64_SFLOAT = 0x00000056, 475 VK_FORMAT_R11G11B10_UFLOAT = 0x00000057, 476 VK_FORMAT_R9G9B9E5_UFLOAT = 0x00000058, 477 VK_FORMAT_D16_UNORM = 0x00000059, 478 VK_FORMAT_D24_UNORM_X8 = 0x0000005A, 479 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 564/// Structure type enumerant 565enum VkStructureType { 566 VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, 567 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, 576 VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, 577 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, 578 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, 579 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, 580 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, 581 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, 582 VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, 583 VK_STRUCTURE_TYPE_SHADER_CREATE_INFO = 17, 584 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 18, 585 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 19, 586 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 20, 587 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 21, 588 VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 22, 589 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 23, 590 VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO = 24, 591 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 25, 592 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 26, 593 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 27, 594 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 28, 595 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 29, 596 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 30, 597 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 31, 598 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 32, 599 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 33, 600 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 34, 601 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO = 35, 602 VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 36, 603 VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 37, 604 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 38, 605 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 39, 606 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, 609 VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, 610 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, 615 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, 621 VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 0xc0000c01, 622 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, 626} 627 628enum VkRenderPassContents { 629 VK_RENDER_PASS_CONTENTS_INLINE = 0x00000000, 630 VK_RENDER_PASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 0x00000001, 631} 632 633@lastUnused(-8) 634/// Error and return codes 635enum VkResult { 636 // Return codes for successful operation execution (positive values) 637 VK_SUCCESS = 0x00000000, 638 VK_NOT_READY = 0x00000001, 639 VK_TIMEOUT = 0x00000002, 640 VK_EVENT_SET = 0x00000003, 641 VK_EVENT_RESET = 0x00000004, 642 VK_INCOMPLETE = 0x00000005, 643 644 //@extension("VK_EXT_KHR_swapchain") 645 VK_SUBOPTIMAL_KHR = 0x40000403, 646 647 // Error codes (negative values) 648 VK_ERROR_OUT_OF_HOST_MEMORY = 0xFFFFFFFF, 649 VK_ERROR_OUT_OF_DEVICE_MEMORY = 0xFFFFFFFE, 650 VK_ERROR_INITIALIZATION_FAILED = 0xFFFFFFFD, 651 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, 655 VK_ERROR_FEATURE_NOT_PRESENT = 0xFFFFFFF8, 656 VK_ERROR_INCOMPATIBLE_DRIVER = 0xFFFFFFF7, 657 658 //@extension("VK_EXT_KHR_surface") 659 VK_ERROR_SURFACE_LOST_KHR = 0xC0000400, 660 661 //@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, 670} 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, 682} 683 684@extension("VK_EXT_KHR_surface") 685enum 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") 698enum VkPresentModeKHR { 699 VK_PRESENT_MODE_IMMEDIATE_KHR = 0x00000000, 700 VK_PRESENT_MODE_MAILBOX_KHR = 0x00000001, 701 VK_PRESENT_MODE_FIFO_KHR = 0x00000002, 702 VK_PRESENT_MODE_FIFO_RELAXED_KHR = 0x00000003, 703} 704 705@extension("VK_EXT_KHR_swapchain") 706enum VkColorSpaceKHR { 707 VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000, 708} 709 710///////////////// 711// Bitfields // 712///////////////// 713 714/// Queue capabilities 715type VkFlags VkQueueFlags 716bitfield VkQueueFlagBits { 717 VK_QUEUE_GRAPHICS_BIT = 0x00000001, /// Queue supports graphics operations 718 VK_QUEUE_COMPUTE_BIT = 0x00000002, /// Queue supports compute operations 719 VK_QUEUE_DMA_BIT = 0x00000004, /// Queue supports DMA operations 720 VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, /// Queue supports sparse resource memory management operations 721} 722 723/// Memory properties passed into vkAllocMemory(). 724type VkFlags VkMemoryPropertyFlags 725bitfield VkMemoryPropertyFlagBits { 726 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, 731} 732 733/// Memory heap flags 734type VkFlags VkMemoryHeapFlags 735bitfield VkMemoryHeapFlagBits { 736 VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001, 737} 738 739/// Memory output flags passed to resource transition commands 740type VkFlags VkMemoryOutputFlags 741bitfield VkMemoryOutputFlagBits { 742 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 750type VkFlags VkMemoryInputFlags 751bitfield VkMemoryInputFlagBits { 752 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 765type VkFlags VkBufferUsageFlags 766bitfield VkBufferUsageFlagBits { 767 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 769 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 779type VkFlags VkBufferCreateFlags 780bitfield VkBufferCreateFlagBits { 781 VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Buffer should support sparse backing 782 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 787type VkFlags VkShaderStageFlags 788bitfield VkShaderStageFlagBits { 789 VK_SHADER_STAGE_VERTEX_BIT = 0x00000001, 790 VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002, 791 VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004, 792 VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008, 793 VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, 794 VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020, 795 VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F, 796 797 VK_SHADER_STAGE_ALL = 0x7FFFFFFF, 798} 799 800/// Descriptor pool create flags 801type VkFlags VkDescriptorPoolCreateFlags 802bitfield VkDescriptorPoolCreateFlagBits { 803 VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001, 804} 805 806/// Descriptor pool reset flags 807type VkFlags VkDescriptorPoolResetFlags 808//bitfield VkDescriptorPoolResetFlagBits { 809//} 810 811/// Image usage flags 812type VkFlags VkImageUsageFlags 813bitfield VkImageUsageFlagBits { 814 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 816 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 819 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment 820 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 825type VkFlags VkImageCreateFlags 826bitfield VkImageCreateFlagBits { 827 VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Image should support sparse backing 828 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 830 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 832} 833 834/// Image view creation flags 835type VkFlags VkImageViewCreateFlags 836//bitfield VkImageViewCreateFlagBits { 837//} 838 839/// Pipeline creation flags 840type VkFlags VkPipelineCreateFlags 841bitfield VkPipelineCreateFlagBits { 842 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001, 843 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002, 844 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004, 845} 846 847/// Channel flags 848type VkFlags VkChannelFlags 849bitfield VkChannelFlagBits { 850 VK_CHANNEL_R_BIT = 0x00000001, 851 VK_CHANNEL_G_BIT = 0x00000002, 852 VK_CHANNEL_B_BIT = 0x00000004, 853 VK_CHANNEL_A_BIT = 0x00000008, 854} 855 856/// Fence creation flags 857type VkFlags VkFenceCreateFlags 858bitfield VkFenceCreateFlagBits { 859 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001, 860} 861 862/// Semaphore creation flags 863type VkFlags VkSemaphoreCreateFlags 864//bitfield VkSemaphoreCreateFlagBits { 865//} 866 867/// Format capability flags 868type VkFlags VkFormatFeatureFlags 869bitfield VkFormatFeatureFlagBits { 870 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 880 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 882} 883 884/// Query control flags 885type VkFlags VkQueryControlFlags 886bitfield VkQueryControlFlagBits { 887 VK_QUERY_CONTROL_CONSERVATIVE_BIT = 0x00000001, /// Allow conservative results to be collected by the query 888} 889 890/// Query result flags 891type VkFlags VkQueryResultFlags 892bitfield VkQueryResultFlagBits { 893 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 901type VkFlags VkShaderModuleCreateFlags 902//bitfield VkShaderModuleCreateFlagBits { 903//} 904 905/// Shader creation flags 906type VkFlags VkShaderCreateFlags 907//bitfield VkShaderCreateFlagBits { 908//} 909 910/// Event creation flags 911type VkFlags VkEventCreateFlags 912//bitfield VkEventCreateFlagBits { 913//} 914 915/// Command buffer usage flags 916type 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, 921} 922 923/// Pipeline statistics flags 924type VkFlags VkQueryPipelineStatisticFlags 925bitfield VkQueryPipelineStatisticFlagBits { 926 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 937} 938 939/// Memory mapping flags 940type VkFlags VkMemoryMapFlags 941//bitfield VkMemoryMapFlagBits { 942//} 943 944/// Bitfield of image aspects 945type VkFlags VkImageAspectFlags 946bitfield VkImageAspectFlagBits { 947 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 954type VkFlags VkSparseMemoryBindFlags 955//bitfield VkSparseMemoryBindFlagBits { 956//} 957 958/// Sparse image memory requirements flags 959type VkFlags VkSparseImageFormatFlags 960bitfield VkSparseImageFormatFlagBits { 961 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 964} 965 966/// Pipeline stages 967type VkFlags VkPipelineStageFlags 968bitfield VkPipelineStageFlagBits { 969 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 973 VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading 974 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading 975 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 982 VK_PIPELINE_STAGE_HOST_BIT = 0x00002000, /// Indicates host (CPU) is a source/sink of the dependency 983 984 VK_PIPELINE_STAGE_ALL_GRAPHICS = 0x000007FF, /// All stages of the graphics pipeline 985 VK_PIPELINE_STAGE_ALL_GPU_COMMANDS = 0x00001FFF, /// All graphics, compute, copy, and transition commands 986} 987 988/// Render pass attachment description flags 989type VkFlags VkAttachmentDescriptionFlags 990bitfield VkAttachmentDescriptionFlagBits { 991 VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001, /// The attachment may alias physical memory of another attachment in the same renderpass 992} 993 994/// Subpass description flags 995type VkFlags VkSubpassDescriptionFlags 996bitfield VkSubpassDescriptionFlagBits { 997} 998 999/// Command pool creation flags 1000type 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 1004} 1005 1006/// Command pool reset flags 1007type VkFlags VkCommandPoolResetFlags 1008bitfield VkCommandPoolResetFlagBits { 1009 VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool 1010} 1011 1012type VkFlags VkCommandBufferResetFlags 1013bitfield VkCommandBufferResetFlagBits { 1014 VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer 1015} 1016 1017type VkFlags VkSampleCountFlags 1018bitfield VkSampleCountFlagBits { 1019 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 1028type VkFlags VkStencilFaceFlags 1029bitfield VkStencilFaceFlagBits { 1030 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 1033 VK_STENCIL_FRONT_AND_BACK = 0x00000003, 1034} 1035 1036/// 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 1096/// Rasterization state creation flags 1097type VkFlags VkPipelineRasterizationStateCreateFlags 1098//bitfield VkPipelineRasterizationStateCreateFlagBits { 1099//} 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 1141/// Dependency flags 1142type VkFlags VkDependencyFlags 1143bitfield VkDependencyFlagBits { 1144 VK_DEPENDENCY_BY_REGION_BIT = 0x00000001, 1145} 1146 1147/// 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 1156@extension("VK_EXT_KHR_swapchain") 1157type VkFlags VkSurfaceTransformFlagsKHR 1158@extension("VK_EXT_KHR_swapchain") 1159bitfield VkSurfaceTransformFlagBitsKHR { 1160 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} 1170 1171@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 1181@extension("VK_EXT_KHR_display") 1182type VkFlags VkDisplayPlaneAlphaFlagsKHR 1183@extension("VK_EXT_KHR_display") 1184bitfield VkDisplayPlaneAlphaFlagBitsKHR { 1185 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 1191////////////////// 1192// Structures // 1193////////////////// 1194 1195class VkOffset2D { 1196 s32 x 1197 s32 y 1198} 1199 1200class VkOffset3D { 1201 s32 x 1202 s32 y 1203 s32 z 1204} 1205 1206class VkExtent2D { 1207 s32 width 1208 s32 height 1209} 1210 1211class VkExtent3D { 1212 s32 width 1213 s32 height 1214 s32 depth 1215} 1216 1217class VkViewport { 1218 f32 originX 1219 f32 originY 1220 f32 width 1221 f32 height 1222 f32 minDepth 1223 f32 maxDepth 1224} 1225 1226class VkRect2D { 1227 VkOffset2D offset 1228 VkExtent2D extent 1229} 1230 1231class VkClearRect { 1232 VkRect2D rect 1233 u32 baseArrayLayer 1234 u32 layerCount 1235} 1236 1237class VkChannelMapping { 1238 VkChannelSwizzle r 1239 VkChannelSwizzle g 1240 VkChannelSwizzle b 1241 VkChannelSwizzle a 1242} 1243 1244class VkPhysicalDeviceProperties { 1245 u32 apiVersion 1246 u32 driverVersion 1247 u32 vendorId 1248 u32 deviceId 1249 VkPhysicalDeviceType deviceType 1250 char[VK_MAX_PHYSICAL_DEVICE_NAME] deviceName 1251 u8[VK_UUID_LENGTH] pipelineCacheUUID 1252 VkPhysicalDeviceLimits limits 1253 VkPhysicalDeviceSparseProperties sparseProperties 1254} 1255 1256class VkExtensionProperties { 1257 char[VK_MAX_EXTENSION_NAME] extensionName /// extension name 1258 u32 specVersion /// version of the extension specification implemented 1259} 1260 1261class VkLayerProperties { 1262 char[VK_MAX_EXTENSION_NAME] layerName /// layer name 1263 u32 specVersion /// version of the layer specification implemented 1264 u32 implementationVersion /// build or release version of the layer's library 1265 char[VK_MAX_DESCRIPTION] description /// Free-form description of the layer 1266} 1267 1268class VkSubmitInfo { 1269 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_SUBMIT_INFO 1270 const void* pNext /// Next structure in chain 1271 u32 waitSemaphoreCount 1272 const VkSemaphore* pWaitSemaphores 1273 u32 commandBufferCount 1274 const VkCommandBuffer* pCommandBuffers 1275 u32 signalSemaphoreCount 1276 const VkSemaphore* pSignalSemaphores 1277} 1278 1279class VkApplicationInfo { 1280 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO 1281 const void* pNext /// Next structure in chain 1282 const char* pApplicationName 1283 u32 applicationVersion 1284 const char* pEngineName 1285 u32 engineVersion 1286 u32 apiVersion 1287} 1288 1289class VkAllocationCallbacks { 1290 void* pUserData 1291 PFN_vkAllocationFunction pfnAllocation 1292 PFN_vkReallocationFunction pfnReallocation 1293 PFN_vkFreeFunction pfnFree 1294 PFN_vkInternalAllocationNotification pfnInternalAllocation 1295 PFN_vkInternalFreeNotification pfnInternalFree 1296} 1297 1298class VkDeviceQueueCreateInfo { 1299 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO 1300 const void* pNext /// Pointer to next structure 1301 VkDeviceQueueCreateFlags flags 1302 u32 queueFamilyIndex 1303 u32 queuePriorityCount 1304 const f32* pQueuePriorities 1305} 1306 1307class VkDeviceCreateInfo { 1308 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO 1309 const void* pNext /// Pointer to next structure 1310 VkDeviceCreateFlags flags 1311 u32 requestedQueueRecordCount 1312 const VkDeviceQueueCreateInfo* pRequestedQueues 1313 u32 enabledLayerNameCount 1314 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled 1315 u32 enabledExtensionNameCount 1316 const char* const* ppEnabledExtensionNames 1317 const VkPhysicalDeviceFeatures* pEnabledFeatures 1318} 1319 1320class VkInstanceCreateInfo { 1321 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO 1322 const void* pNext /// Pointer to next structure 1323 VkInstanceCreateFlags flags 1324 const VkApplicationInfo* pApplicationInfo 1325 u32 enabledLayerNameCount 1326 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled 1327 u32 enabledExtensionNameCount 1328 const char* const* ppEnabledExtensionNames /// Extension names to be enabled 1329} 1330 1331class VkQueueFamilyProperties { 1332 VkQueueFlags queueFlags /// Queue flags 1333 u32 queueCount 1334 u32 timestampValidBits 1335} 1336 1337class VkPhysicalDeviceMemoryProperties { 1338 u32 memoryTypeCount 1339 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes 1340 u32 memoryHeapCount 1341 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps 1342} 1343 1344class VkMemoryAllocateInfo { 1345 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO 1346 const void* pNext /// Pointer to next structure 1347 VkDeviceSize allocationSize /// Size of memory allocation 1348 u32 memoryTypeIndex /// Index of the of the memory type to allocate from 1349} 1350 1351class VkMemoryRequirements { 1352 VkDeviceSize size /// Specified in bytes 1353 VkDeviceSize alignment /// Specified in bytes 1354 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object 1355} 1356 1357class VkSparseImageFormatProperties { 1358 VkImageAspectFlagBits aspect 1359 VkExtent3D imageGranularity 1360 VkSparseImageFormatFlags flags 1361} 1362 1363class VkSparseImageMemoryRequirements { 1364 VkSparseImageFormatProperties formatProperties 1365 u32 imageMipTailStartLOD 1366 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment 1367 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment 1368 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment 1369} 1370 1371class VkMemoryType { 1372 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type 1373 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from 1374} 1375 1376class VkMemoryHeap { 1377 VkDeviceSize size /// Available memory in the heap 1378 VkMemoryHeapFlags flags /// Flags for the heap 1379} 1380 1381class VkMappedMemoryRange { 1382 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE 1383 const void* pNext /// Pointer to next structure 1384 VkDeviceMemory memory /// Mapped memory object 1385 VkDeviceSize offset /// Offset within the mapped memory the range starts from 1386 VkDeviceSize size /// Size of the range within the mapped memory 1387} 1388 1389class VkFormatProperties { 1390 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling 1391 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling 1392 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers 1393} 1394 1395class VkImageFormatProperties { 1396 VkExtent3D maxExtent /// max image dimensions for this resource type 1397 u32 maxMipLevels /// max number of mipmap levels for this resource type 1398 u32 maxArrayLayers /// max array layers for this resource type 1399 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type 1400 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type 1401} 1402 1403class VkDescriptorImageInfo { 1404 VkSampler sampler 1405 VkImageView imageView 1406 VkImageLayout imageLayout 1407} 1408 1409class VkDescriptorBufferInfo { 1410 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC] 1411 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set. 1412 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update. 1413} 1414 1415class VkWriteDescriptorSet { 1416 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET 1417 const void* pNext /// Pointer to next structure 1418 VkDescriptorSet dstSet /// Destination descriptor set 1419 u32 dstBinding /// Binding within the destination descriptor set to write 1420 u32 dstArrayElement /// Array element within the destination binding to write 1421 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>) 1422 VkDescriptorType descriptorType /// Descriptor type to write (determines which fields of the array pointed by <pDescriptors> are going to be used) 1423 const VkDescriptorImageInfo* pImageInfo 1424 const VkDescriptorBufferInfo* pBufferInfo 1425 const VkBufferView* pTexelBufferView 1426} 1427 1428class VkCopyDescriptorSet { 1429 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET 1430 const void* pNext /// Pointer to next structure 1431 VkDescriptorSet srcSet /// Source descriptor set 1432 u32 srcBinding /// Binding within the source descriptor set to copy from 1433 u32 srcArrayElement /// Array element within the source binding to copy from 1434 VkDescriptorSet dstSet /// Destination descriptor set 1435 u32 dstBinding /// Binding within the destination descriptor set to copy to 1436 u32 dstArrayElement /// Array element within the destination binding to copy to 1437 u32 descriptorCount /// Number of descriptors to copy 1438} 1439 1440class VkBufferCreateInfo { 1441 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO 1442 const void* pNext /// Pointer to next structure. 1443 VkBufferCreateFlags flags /// Buffer creation flags 1444 VkDeviceSize size /// Specified in bytes 1445 VkBufferUsageFlags usage /// Buffer usage flags 1446 VkSharingMode sharingMode 1447 u32 queueFamilyIndexCount 1448 const u32* pQueueFamilyIndices 1449} 1450 1451class VkBufferViewCreateInfo { 1452 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO 1453 const void* pNext /// Pointer to next structure. 1454 VkBufferViewCreateFlags flags 1455 VkBuffer buffer 1456 VkFormat format /// Optionally specifies format of elements 1457 VkDeviceSize offset /// Specified in bytes 1458 VkDeviceSize range /// View size specified in bytes 1459} 1460 1461class VkImageSubresource { 1462 VkImageAspectFlagBits aspect 1463 u32 mipLevel 1464 u32 arrayLayer 1465} 1466 1467class VkImageSubresourceRange { 1468 VkImageAspectFlags aspectMask 1469 u32 baseMipLevel 1470 u32 levelCount 1471 u32 baseArrayLayer 1472 u32 layerCount 1473} 1474 1475class VkMemoryBarrier { 1476 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER 1477 const void* pNext /// Pointer to next structure. 1478 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync 1479 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to 1480} 1481 1482class VkBufferMemoryBarrier { 1483 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER 1484 const void* pNext /// Pointer to next structure. 1485 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync 1486 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to 1487 u32 srcQueueFamilyIndex /// Queue family to transition ownership from 1488 u32 dstQueueFamilyIndex /// Queue family to transition ownership to 1489 VkBuffer buffer /// Buffer to sync 1490 VkDeviceSize offset /// Offset within the buffer to sync 1491 VkDeviceSize size /// Amount of bytes to sync 1492} 1493 1494class VkImageMemoryBarrier { 1495 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER 1496 const void* pNext /// Pointer to next structure. 1497 VkMemoryOutputFlags outputMask /// Outputs the barrier should sync 1498 VkMemoryInputFlags inputMask /// Inputs the barrier should sync to 1499 VkImageLayout oldLayout /// Current layout of the image 1500 VkImageLayout newLayout /// New layout to transition the image to 1501 u32 srcQueueFamilyIndex /// Queue family to transition ownership from 1502 u32 dstQueueFamilyIndex /// Queue family to transition ownership to 1503 VkImage image /// Image to sync 1504 VkImageSubresourceRange subresourceRange /// Subresource range to sync 1505} 1506 1507class VkImageCreateInfo { 1508 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO 1509 const void* pNext /// Pointer to next structure. 1510 VkImageCreateFlags flags /// Image creation flags 1511 VkImageType imageType 1512 VkFormat format 1513 VkExtent3D extent 1514 u32 mipLevels 1515 u32 arrayLayers 1516 u32 samples 1517 VkImageTiling tiling 1518 VkImageUsageFlags usage /// Image usage flags 1519 VkSharingMode sharingMode /// Cross-queue-family sharing mode 1520 u32 queueFamilyIndexCount /// Number of queue families to share across 1521 const u32* pQueueFamilyIndices /// Array of queue family indices to share across 1522 VkImageLayout initialLayout /// Initial image layout for all subresources 1523} 1524 1525class VkSubresourceLayout { 1526 VkDeviceSize offset /// Specified in bytes 1527 VkDeviceSize size /// Specified in bytes 1528 VkDeviceSize rowPitch /// Specified in bytes 1529 VkDeviceSize depthPitch /// Specified in bytes 1530} 1531 1532class VkImageViewCreateInfo { 1533 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO 1534 const void* pNext /// Pointer to next structure 1535 VkImageViewCreateFlags flags 1536 VkImage image 1537 VkImageViewType viewType 1538 VkFormat format 1539 VkChannelMapping channels 1540 VkImageSubresourceRange subresourceRange 1541} 1542 1543class VkBufferCopy { 1544 VkDeviceSize srcOffset /// Specified in bytes 1545 VkDeviceSize dstOffset /// Specified in bytes 1546 VkDeviceSize size /// Specified in bytes 1547} 1548 1549class VkSparseMemoryBind { 1550 VkDeviceSize resourceOffset /// Specified in bytes 1551 VkDeviceSize size /// Specified in bytes 1552 VkDeviceMemory memory 1553 VkDeviceSize memoryOffset /// Specified in bytes 1554 VkSparseMemoryBindFlags flags 1555} 1556 1557class VkSparseImageMemoryBind { 1558 VkImageSubresource subresource 1559 VkOffset3D offset 1560 VkExtent3D extent 1561 VkDeviceMemory memory 1562 VkDeviceSize memoryOffset /// Specified in bytes 1563 VkSparseMemoryBindFlags flags 1564} 1565 1566class VkSparseBufferMemoryBindInfo { 1567 VkBuffer buffer 1568 u32 bindCount 1569 const VkSparseMemoryBind* pBinds 1570} 1571 1572class VkSparseImageOpaqueMemoryBindInfo { 1573 VkImage image 1574 u32 bindCount 1575 const VkSparseMemoryBind* pBinds 1576} 1577 1578class VkSparseImageMemoryBindInfo { 1579 VkImage image 1580 u32 bindCount 1581 const VkSparseMemoryBind* pBinds 1582} 1583 1584class VkBindSparseInfo { 1585 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BIND_SPARSE_INFO 1586 const void* pNext 1587 u32 waitSemaphoreCount 1588 const VkSemaphore* pWaitSemaphores 1589 u32 numBufferBinds 1590 const VkSparseBufferMemoryBindInfo* pBufferBinds 1591 u32 numImageOpaqueBinds 1592 const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds 1593 u32 numImageBinds 1594 const VkSparseImageMemoryBindInfo* pImageBinds 1595 u32 signalSemaphoreCount 1596 const VkSemaphore* pSignalSemaphores 1597} 1598 1599class VkImageSubresourceCopy { 1600 VkImageAspectFlags aspect 1601 u32 mipLevel 1602 u32 baseArrayLayer 1603 u32 layerCount 1604} 1605 1606class VkImageCopy { 1607 VkImageSubresourceCopy srcSubresource 1608 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images 1609 VkImageSubresourceCopy dstSubresource 1610 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images 1611 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images 1612} 1613 1614class VkImageBlit { 1615 VkImageSubresourceCopy srcSubresource 1616 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images 1617 VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images 1618 VkImageSubresourceCopy dstSubresource 1619 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images 1620 VkExtent3D dstExtent /// Specified in pixels for both compressed and uncompressed images 1621} 1622 1623class VkBufferImageCopy { 1624 VkDeviceSize bufferOffset /// Specified in bytes 1625 u32 bufferRowLength /// Specified in texels 1626 u32 bufferImageHeight 1627 VkImageSubresourceCopy imageSubresource 1628 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images 1629 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images 1630} 1631 1632class VkImageResolve { 1633 VkImageSubresourceCopy srcSubresource 1634 VkOffset3D srcOffset 1635 VkImageSubresourceCopy dstSubresource 1636 VkOffset3D dstOffset 1637 VkExtent3D extent 1638} 1639 1640class VkShaderModuleCreateInfo { 1641 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO 1642 const void* pNext /// Pointer to next structure 1643 VkShaderModuleCreateFlags flags /// Reserved 1644 platform.size_t codeSize /// Specified in bytes 1645 const u32* pCode /// Binary code of size codeSize 1646} 1647 1648class VkShaderCreateInfo { 1649 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO 1650 const void* pNext /// Pointer to next structure 1651 VkShaderCreateFlags flags /// Reserved 1652 VkShaderModule module /// Module containing entry point 1653 const char* pName /// Null-terminated entry point name 1654 VkShaderStageFlagBits stage 1655} 1656 1657class VkDescriptorSetLayoutBinding { 1658 VkDescriptorType descriptorType /// Type of the descriptors in this binding 1659 u32 arraySize /// Number of descriptors in this binding 1660 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to 1661 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements) 1662} 1663 1664class VkDescriptorSetLayoutCreateInfo { 1665 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO 1666 const void* pNext /// Pointer to next structure 1667 VkDescriptorSetLayoutCreateFlags flags 1668 u32 bindingCount /// Number of bindings in the descriptor set layout 1669 const VkDescriptorSetLayoutBinding* pBindings /// Array of descriptor set layout bindings 1670} 1671 1672class VkDescriptorTypeCount { 1673 VkDescriptorType type 1674 u32 descriptorCount 1675} 1676 1677class VkDescriptorPoolCreateInfo { 1678 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO 1679 const void* pNext /// Pointer to next structure 1680 VkDescriptorPoolCreateFlags flags 1681 u32 maxSets 1682 u32 typeCount 1683 const VkDescriptorTypeCount* pTypeCounts 1684} 1685 1686class VkDescriptorSetAllocateInfo { 1687 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOC_INFO 1688 const void* pNext /// Pointer to next structure 1689 VkDescriptorPool descriptorPool 1690 u32 setCount 1691 const VkDescriptorSetLayout* pSetLayouts 1692} 1693 1694class VkSpecializationMapEntry { 1695 u32 constantId /// The SpecConstant ID specified in the BIL 1696 u32 offset /// Offset of the value in the data block 1697 platform.size_t size /// Size in bytes of the SpecConstant 1698} 1699 1700class VkSpecializationInfo { 1701 u32 mapEntryCount /// Number of entries in the map 1702 const VkSpecializationMapEntry* pMapEntries /// Array of map entries 1703 platform.size_t dataSize /// Size in bytes of pData 1704 const void* pData /// Pointer to SpecConstant data 1705} 1706 1707class VkPipelineShaderStageCreateInfo { 1708 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO 1709 const void* pNext /// Pointer to next structure 1710 VkPipelineShaderStageCreateFlags flags 1711 VkShader shader 1712 const VkSpecializationInfo* pSpecializationInfo 1713} 1714 1715class VkComputePipelineCreateInfo { 1716 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO 1717 const void* pNext /// Pointer to next structure 1718 VkPipelineCreateFlags flags /// Pipeline creation flags 1719 VkPipelineShaderStageCreateInfo stage 1720 VkPipelineLayout layout /// Interface layout of the pipeline 1721 VkPipeline basePipelineHandle /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of 1722 s32 basePipelineIndex /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of 1723} 1724 1725class VkVertexInputBindingDescription { 1726 u32 binding /// Vertex buffer binding id 1727 u32 stride /// Distance between vertices in bytes (0 = no advancement) 1728 VkVertexInputStepRate stepRate /// Rate at which binding is incremented 1729} 1730 1731class VkVertexInputAttributeDescription { 1732 u32 location /// location of the shader vertex attrib 1733 u32 binding /// Vertex buffer binding id 1734 VkFormat format /// format of source data 1735 u32 offset /// Offset of first element in bytes from base of vertex 1736} 1737 1738class VkPipelineVertexInputStateCreateInfo { 1739 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO 1740 const void* pNext /// Pointer to next structure 1741 VkPipelineVertexInputStateCreateFlags flags 1742 u32 vertexBindingDescriptionCount /// number of bindings 1743 const VkVertexInputBindingDescription* pVertexBindingDescriptions 1744 u32 vertexAttributeDescriptionCount /// number of attributes 1745 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions 1746} 1747 1748class VkPipelineInputAssemblyStateCreateInfo { 1749 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO 1750 const void* pNext /// Pointer to next structure 1751 VkPipelineInputAssemblyStateCreateFlags flags 1752 VkPrimitiveTopology topology 1753 VkBool32 primitiveRestartEnable 1754} 1755 1756class VkPipelineTessellationStateCreateInfo { 1757 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO 1758 const void* pNext /// Pointer to next structure 1759 VkPipelineTessellationStateCreateFlags flags 1760 u32 patchControlPoints 1761} 1762 1763class VkPipelineViewportStateCreateInfo { 1764 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO 1765 const void* pNext /// Pointer to next structure 1766 VkPipelineViewportStateCreateFlags flags 1767 u32 viewportCount 1768 const VkViewport* pViewports 1769 u32 scissorCount 1770 const VkRect2D* pScissors 1771} 1772 1773class VkPipelineRasterizationStateCreateInfo { 1774 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO 1775 const void* pNext /// Pointer to next structure 1776 VkPipelineRasterizationStateCreateFlags flags 1777 VkBool32 depthClampEnable 1778 VkBool32 rasterizerDiscardEnable 1779 VkFillMode fillMode /// optional (GL45) 1780 VkCullModeFlags cullMode 1781 VkFrontFace frontFace 1782 VkBool32 depthBiasEnable 1783 f32 depthBiasConstantFactor 1784 f32 depthBiasClamp 1785 f32 depthBiasSlopeFactor 1786 f32 lineWidth 1787} 1788 1789class VkPipelineMultisampleStateCreateInfo { 1790 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO 1791 const void* pNext /// Pointer to next structure 1792 VkPipelineMultisampleStateCreateFlags flags 1793 u32 rasterizationSamples /// Number of samples used for rasterization 1794 VkBool32 sampleShadingEnable /// optional (GL45) 1795 f32 minSampleShading /// optional (GL45) 1796 const VkSampleMask* pSampleMask 1797 VkBool32 alphaToCoverageEnable 1798 VkBool32 alphaToOneEnable 1799} 1800 1801class VkPipelineColorBlendAttachmentState { 1802 VkBool32 blendEnable 1803 VkBlend srcBlendColor 1804 VkBlend dstBlendColor 1805 VkBlendOp blendOpColor 1806 VkBlend srcBlendAlpha 1807 VkBlend dstBlendAlpha 1808 VkBlendOp blendOpAlpha 1809 VkChannelFlags channelWriteMask 1810} 1811 1812class VkPipelineColorBlendStateCreateInfo { 1813 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO 1814 const void* pNext /// Pointer to next structure 1815 VkPipelineColorBlendStateCreateFlags flags 1816 VkBool32 logicOpEnable 1817 VkLogicOp logicOp 1818 u32 attachmentCount /// # of pAttachments 1819 const VkPipelineColorBlendAttachmentState* pAttachments 1820 f32[4] blendConstants 1821} 1822 1823class VkStencilOpState { 1824 VkStencilOp stencilFailOp 1825 VkStencilOp stencilPassOp 1826 VkStencilOp stencilDepthFailOp 1827 VkCompareOp stencilCompareOp 1828 u32 stencilCompareMask 1829 u32 stencilWriteMask 1830 u32 stencilReference 1831} 1832 1833class VkPipelineDepthStencilStateCreateInfo { 1834 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO 1835 const void* pNext /// Pointer to next structure 1836 VkPipelineDepthStencilStateCreateFlags flags 1837 VkBool32 depthTestEnable 1838 VkBool32 depthWriteEnable 1839 VkCompareOp depthCompareOp 1840 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test) 1841 VkBool32 stencilTestEnable 1842 VkStencilOpState front 1843 VkStencilOpState back 1844 f32 minDepthBounds 1845 f32 maxDepthBounds 1846} 1847 1848class VkPipelineDynamicStateCreateInfo { 1849 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO 1850 const void* pNext /// Pointer to next structure 1851 VkPipelineDynamicStateCreateFlags flags 1852 u32 dynamicStateCount 1853 const VkDynamicState* pDynamicStates 1854} 1855 1856class VkGraphicsPipelineCreateInfo { 1857 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO 1858 const void* pNext /// Pointer to next structure 1859 VkPipelineCreateFlags flags /// Pipeline creation flags 1860 u32 stageCount 1861 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage 1862 const VkPipelineVertexInputStateCreateInfo* pVertexInputState 1863 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState 1864 const VkPipelineTessellationStateCreateInfo* pTessellationState 1865 const VkPipelineViewportStateCreateInfo* pViewportState 1866 const VkPipelineRasterizationStateCreateInfo* pRasterizationState 1867 const VkPipelineMultisampleStateCreateInfo* pMultisampleState 1868 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState 1869 const VkPipelineColorBlendStateCreateInfo* pColorBlendState 1870 const VkPipelineDynamicStateCreateInfo* pDynamicState 1871 VkPipelineLayout layout /// Interface layout of the pipeline 1872 VkRenderPass renderPass 1873 u32 subpass 1874 VkPipeline basePipelineHandle /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is nonzero, it specifies the handle of the base pipeline this is a derivative of 1875 s32 basePipelineIndex /// If VK_PIPELINE_CREATE_DERIVATIVE_BIT is set and this value is not -1, it specifies an index into pCreateInfos of the base pipeline this is a derivative of 1876} 1877 1878class VkPipelineCacheCreateInfo { 1879 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO 1880 const void* pNext /// Pointer to next structure 1881 VkPipelineCacheCreateFlags flags 1882 platform.size_t initialDataSize /// Size of initial data to populate cache, in bytes 1883 const void* pInitialData /// Initial data to populate cache 1884} 1885 1886class VkPushConstantRange { 1887 VkShaderStageFlags stageFlags /// Which stages use the range 1888 u32 offset /// Start of the range, in bytes 1889 u32 size /// Length of the range, in bytes 1890} 1891 1892class VkPipelineLayoutCreateInfo { 1893 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO 1894 const void* pNext /// Pointer to next structure 1895 VkPipelineLayoutCreateFlags flags 1896 u32 setLayoutCount /// Number of descriptor sets interfaced by the pipeline 1897 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the 1898 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline 1899 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages 1900} 1901 1902class VkSamplerCreateInfo { 1903 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO 1904 const void* pNext /// Pointer to next structure 1905 VkSamplerCreateFlags flags 1906 VkFilter magFilter /// Filter mode for magnification 1907 VkFilter minFilter /// Filter mode for minifiation 1908 VkSamplerMipmapMode mipmapMode /// Mipmap selection mode 1909 VkSamplerAddressMode addressModeU 1910 VkSamplerAddressMode addressModeV 1911 VkSamplerAddressMode addressModeW 1912 f32 mipLodBias 1913 f32 maxAnisotropy 1914 VkBool32 compareEnable 1915 VkCompareOp compareOp 1916 f32 minLod 1917 f32 maxLod 1918 VkBorderColor borderColor 1919 VkBool32 unnormalizedCoordinates 1920} 1921 1922class VkCommandPoolCreateInfo { 1923 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO 1924 const void* pNext /// Pointer to next structure 1925 VkCommandPoolCreateFlags flags /// Command pool creation flags 1926 u32 queueFamilyIndex 1927} 1928 1929class VkCommandBufferAllocateInfo { 1930 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOC_INFO 1931 const void* pNext /// Pointer to next structure 1932 VkCommandPool commandPool 1933 VkCommandBufferLevel level 1934 u32 bufferCount 1935} 1936 1937class VkCommandBufferBeginInfo { 1938 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO 1939 const void* pNext /// Pointer to next structure 1940 VkCommandBufferUsageFlags flags /// Command buffer usage flags 1941 VkRenderPass renderPass /// Render pass for secondary command buffers 1942 u32 subpass 1943 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers 1944} 1945 1946class VkRenderPassBeginInfo { 1947 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO 1948 const void* pNext /// Pointer to next structure 1949 VkRenderPass renderPass 1950 VkFramebuffer framebuffer 1951 VkRect2D renderArea 1952 u32 clearValueCount 1953 const VkClearValue* pClearValues 1954} 1955 1956@union 1957/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared. 1958class VkClearColorValue { 1959 f32[4] float32 1960 s32[4] int32 1961 u32[4] uint32 1962} 1963 1964class VkClearDepthStencilValue { 1965 f32 depth 1966 u32 stencil 1967} 1968 1969@union 1970/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared. 1971class VkClearValue { 1972 VkClearColorValue color 1973 VkClearDepthStencilValue depthStencil 1974} 1975 1976class VkClearAttachment { 1977 VkImageAspectFlags aspectMask 1978 u32 colorAttachment 1979 VkClearValue clearValue 1980} 1981 1982class VkAttachmentDescription { 1983 VkAttachmentDescriptionFlags flags 1984 VkFormat format 1985 u32 samples 1986 VkAttachmentLoadOp loadOp /// Load op for color or depth data 1987 VkAttachmentStoreOp storeOp /// Store op for color or depth data 1988 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data 1989 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data 1990 VkImageLayout initialLayout 1991 VkImageLayout finalLayout 1992} 1993 1994class VkAttachmentReference { 1995 u32 attachment 1996 VkImageLayout layout 1997} 1998 1999class VkSubpassDescription { 2000 VkSubpassDescriptionFlags flags 2001 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now 2002 u32 inputAttachmentCount 2003 const VkAttachmentReference* pInputAttachments 2004 u32 colorAttachmentCount 2005 const VkAttachmentReference* pColorAttachments 2006 const VkAttachmentReference* pResolveAttachments 2007 const VkAttachmentReference* pDepthStencilAttachment 2008 u32 preserveAttachmentCount 2009 const VkAttachmentReference* pPreserveAttachments 2010} 2011 2012class VkSubpassDependency { 2013 u32 srcSubpass 2014 u32 dstSubpass 2015 VkPipelineStageFlags srcStageMask 2016 VkPipelineStageFlags dstStageMask 2017 VkMemoryOutputFlags outputMask 2018 VkMemoryInputFlags inputMask 2019 VkDependencyFlags dependencyFlags 2020} 2021 2022class VkRenderPassCreateInfo { 2023 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO 2024 const void* pNext /// Pointer to next structure 2025 VkRenderPassCreateFlags flags 2026 u32 attachmentCount 2027 const VkAttachmentDescription* pAttachments 2028 u32 subpassCount 2029 const VkSubpassDescription* pSubpasses 2030 u32 dependencyCount 2031 const VkSubpassDependency* pDependencies 2032} 2033 2034class VkEventCreateInfo { 2035 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO 2036 const void* pNext /// Pointer to next structure 2037 VkEventCreateFlags flags /// Event creation flags 2038} 2039 2040class VkFenceCreateInfo { 2041 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO 2042 const void* pNext /// Pointer to next structure 2043 VkFenceCreateFlags flags /// Fence creation flags 2044} 2045 2046class VkPhysicalDeviceFeatures { 2047 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined 2048 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls 2049 VkBool32 imageCubeArray /// image views which are arrays of cube maps 2050 VkBool32 independentBlend /// blending operations are controlled per-attachment 2051 VkBool32 geometryShader /// geometry stage 2052 VkBool32 tessellationShader /// tessellation control and evaluation stage 2053 VkBool32 sampleRateShading /// per-sample shading and interpolation 2054 VkBool32 dualSrcBlend /// blend operations which take two sources 2055 VkBool32 logicOp /// logic operations 2056 VkBool32 multiDrawIndirect /// multi draw indirect 2057 VkBool32 depthClamp /// depth clamping 2058 VkBool32 depthBiasClamp /// depth bias clamping 2059 VkBool32 fillModeNonSolid /// point and wireframe fill modes 2060 VkBool32 depthBounds /// depth bounds test 2061 VkBool32 wideLines /// lines with width greater than 1 2062 VkBool32 largePoints /// points with size greater than 1 2063 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value 2064 VkBool32 multiViewport 2065 VkBool32 samplerAnisotropy 2066 VkBool32 textureCompressionETC2 /// ETC texture compression formats 2067 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats 2068 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats 2069 VkBool32 occlusionQueryNonConservative /// non-conservative (exact) occlusion queries 2070 VkBool32 pipelineStatisticsQuery /// pipeline statistics query 2071 VkBool32 vertexPipelineStoresAndAtomics 2072 VkBool32 fragmentStoresAndAtomics 2073 VkBool32 shaderTessellationAndGeometryPointSize 2074 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets 2075 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images 2076 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images 2077 VkBool32 shaderStorageImageReadWithoutFormat 2078 VkBool32 shaderStorageImageWriteWithoutFormat 2079 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices 2080 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices 2081 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices 2082 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices 2083 VkBool32 shaderClipDistance /// clip distance in shaders 2084 VkBool32 shaderCullDistance /// cull distance in shaders 2085 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders 2086 VkBool32 shaderInt64 /// 64-bit integers in shaders 2087 VkBool32 shaderInt16 /// 16-bit integers in shaders 2088 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support) 2089 VkBool32 shaderResourceMinLOD /// shader can use texture operations that specify minimum resource LOD 2090 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level 2091 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers 2092 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images 2093 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images 2094 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples 2095 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples 2096 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples 2097 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples 2098 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in) 2099 VkBool32 variableMultisampleRate 2100} 2101 2102class VkPhysicalDeviceLimits { 2103 /// resource maximum sizes 2104 u32 maxImageDimension1D /// max 1D image dimension 2105 u32 maxImageDimension2D /// max 2D image dimension 2106 u32 maxImageDimension3D /// max 3D image dimension 2107 u32 maxImageDimensionCube /// max cubemap image dimension 2108 u32 maxImageArrayLayers /// max layers for image arrays 2109 VkSampleCountFlags sampleCounts /// sample counts supported for all images supporting rendering and sampling 2110 u32 maxTexelBufferElements 2111 u32 maxUniformBufferRange /// max uniform buffer size (bytes) 2112 u32 maxStorageBufferRange /// max storage buffer size (bytes) 2113 u32 maxPushConstantsSize /// max size of the push constants pool (bytes) 2114 /// memory limits 2115 u32 maxMemoryAllocationCount /// max number of device memory allocations supported 2116 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage 2117 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes) 2118 /// descriptor set limits 2119 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline 2120 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set 2121 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set 2122 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set 2123 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set 2124 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set 2125 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set 2126 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set 2127 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set 2128 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set 2129 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set 2130 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set 2131 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set 2132 /// vertex stage limits 2133 u32 maxVertexInputAttributes /// max num of vertex input attribute slots 2134 u32 maxVertexInputBindings /// max num of vertex input binding slots 2135 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset 2136 u32 maxVertexInputBindingStride /// max vertex input binding stride 2137 u32 maxVertexOutputComponents /// max num of output components written by vertex shader 2138 /// tessellation control stage limits 2139 u32 maxTessellationGenerationLevel /// max level supported by tess primitive generator 2140 u32 maxTessellationPatchSize /// max patch size (vertices) 2141 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS 2142 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS 2143 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS 2144 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS 2145 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES 2146 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES 2147 /// geometry stage limits 2148 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader 2149 u32 maxGeometryInputComponents /// max num of input components read in geometry stage 2150 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage 2151 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage 2152 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage 2153 /// fragment stage limits 2154 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage 2155 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage 2156 u32 maxFragmentDualSrcAttachments /// max num of output attachments written when using dual source blending 2157 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers 2158 /// compute stage limits 2159 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes) 2160 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z) 2161 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group 2162 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z) 2163 2164 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y 2165 u32 subTexelPrecisionBits /// num bits of subtexel precision 2166 u32 mipmapPrecisionBits /// num bits of mipmap precision 2167 2168 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices) 2169 u32 maxDrawIndirectInstanceCount /// max instance count for indirect draw calls 2170 2171 f32 maxSamplerLodBias /// max absolute sampler level of detail bias 2172 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy 2173 2174 u32 maxViewports /// max number of active viewports 2175 u32[2] maxViewportDimensions /// max viewport dimensions (x,y) 2176 f32[2] viewportBoundsRange /// viewport bounds range (min,max) 2177 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport 2178 2179 platform.size_t minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes) 2180 VkDeviceSize minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes) 2181 VkDeviceSize minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes) 2182 VkDeviceSize minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes) 2183 2184 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset 2185 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset 2186 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset 2187 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset 2188 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset 2189 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset 2190 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset 2191 2192 u32 maxFramebufferWidth /// max width for a framebuffer 2193 u32 maxFramebufferHeight /// max height for a framebuffer 2194 u32 maxFramebufferLayers /// max layer count for a layered framebuffer 2195 u32 maxFramebufferColorSamples /// max color sample count for a framebuffer 2196 u32 maxFramebufferDepthSamples /// max depth sample count for a framebuffer 2197 u32 maxFramebufferStencilSamples /// max stencil sample count for a framebuffer 2198 u32 maxColorAttachments /// max num of framebuffer color attachments 2199 2200 u32 maxSampledImageColorSamples /// max num of color samples for a non-integer sampled image 2201 u32 maxSampledImageDepthSamples /// max num of depth samples for a sampled image 2202 u32 maxSampledImageStencilSamples /// max num of stencil samples for a sampled image 2203 u32 maxSampledImageIntegerSamples /// max num of samples supported for an integer image 2204 u32 maxStorageImageSamples /// max num of samples for a storage image 2205 u32 maxSampleMaskWords /// max num of sample mask words 2206 2207 f32 timestampPeriod 2208 2209 u32 maxClipDistances /// max number of clip distances 2210 u32 maxCullDistances /// max number of cull distances 2211 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping 2212 2213 u32 discreteQueuePriorities 2214 2215 f32[2] pointSizeRange /// range (min,max) of supported point sizes 2216 f32[2] lineWidthRange /// range (min,max) of supported line widths 2217 f32 pointSizeGranularity /// granularity of supported point sizes 2218 f32 lineWidthGranularity /// granularity of supported line widths 2219 VkBool32 strictLines 2220 2221 VkDeviceSize recommendedBufferCopyOffsetAlignment 2222 VkDeviceSize recommendedBufferCopyRowPitchAlignment 2223} 2224 2225class VkPhysicalDeviceSparseProperties { 2226 VkBool32 residencyStandard2DBlockShape /// Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard block shapes (based on pixel format) 2227 VkBool32 residencyStandard2DMultisampleBlockShape /// Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard block shapes (based on pixel format) 2228 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format) 2229 VkBool32 residencyAlignedMipSize /// Sparse resources support: Images with mip-level dimensions that are NOT a multiple of the block size will be placed in the mip tail 2230 VkBool32 residencyNonResidentStrict /// Sparse resources support: GPU can safely access non-resident regions of a resource, all reads return as if data is 0, writes are discarded 2231} 2232 2233class VkSemaphoreCreateInfo { 2234 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO 2235 const void* pNext /// Pointer to next structure 2236 VkSemaphoreCreateFlags flags /// Semaphore creation flags 2237} 2238 2239class VkQueryPoolCreateInfo { 2240 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO 2241 const void* pNext /// Pointer to next structure 2242 VkQueryPoolCreateFlags flags 2243 VkQueryType queryType 2244 u32 slots 2245 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional 2246} 2247 2248class VkFramebufferCreateInfo { 2249 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO 2250 const void* pNext /// Pointer to next structure 2251 VkFramebufferCreateFlags flags 2252 VkRenderPass renderPass 2253 u32 attachmentCount 2254 const VkImageView* pAttachments 2255 u32 width 2256 u32 height 2257 u32 layers 2258} 2259 2260class VkDrawIndirectCommand { 2261 u32 vertexCount 2262 u32 instanceCount 2263 u32 firstVertex 2264 u32 firstInstance 2265} 2266 2267class VkDrawIndexedIndirectCommand { 2268 u32 indexCount 2269 u32 instanceCount 2270 u32 firstIndex 2271 s32 vertexOffset 2272 u32 firstInstance 2273} 2274 2275class VkDispatchIndirectCommand { 2276 u32 x 2277 u32 y 2278 u32 z 2279} 2280 2281@extension("VK_EXT_KHR_surface") 2282class VkSurfaceCapabilitiesKHR { 2283 u32 minImageCount 2284 u32 maxImageCount 2285 VkExtent2D currentExtent 2286 VkExtent2D minImageExtent 2287 VkExtent2D maxImageExtent 2288 VkSurfaceTransformFlagsKHR supportedTransforms 2289 VkSurfaceTransformKHR currentTransform 2290 VkCompositeAlphaFlagsKHR supportedCompositeAlpha 2291 u32 maxImageArraySize 2292 VkImageUsageFlags supportedUsageFlags 2293} 2294 2295@extension("VK_EXT_KHR_surface") 2296class VkSurfaceFormatKHR { 2297 VkFormat format 2298 VkColorSpaceKHR colorSpace 2299} 2300 2301@extension("VK_EXT_KHR_swapchain") 2302class VkSwapchainCreateInfoKHR { 2303 VkStructureType sType 2304 const void* pNext 2305 VkSurfaceKHR surface 2306 u32 minImageCount 2307 VkFormat imageFormat 2308 VkColorSpaceKHR imageColorSpace 2309 VkExtent2D imageExtent 2310 VkImageUsageFlags imageUsageFlags 2311 VkSurfaceTransformKHR preTransform 2312 VkCompositeAlphaFlagBitsKHR compositeAlpha 2313 u32 imageArraySize 2314 VkSharingMode sharingMode 2315 u32 queueFamilyIndexCount 2316 const u32* pQueueFamilyIndices 2317 VkPresentModeKHR presentMode 2318 VkSwapchainKHR oldSwapchain 2319 VkBool32 clipped 2320} 2321 2322@extension("VK_EXT_KHR_swapchain") 2323class VkPresentInfoKHR { 2324 VkStructureType sType 2325 const void* pNext 2326 u32 waitSemaphoreCount 2327 const VkSemaphore* pWaitSemaphores 2328 u32 swapchainCount 2329 const VkSwapchainKHR* pSwapchains 2330 const u32* imageIndices 2331} 2332 2333@extension("VK_EXT_KHR_display") 2334class VkDisplayPropertiesKHR { 2335 VkDisplayKHR display 2336 const char* displayName 2337 VkExtent2D physicalDimensions 2338 VkExtent2D physicalResolution 2339 VkSurfaceTransformFlagsKHR supportedTransforms 2340 VkBool32 planeReorderPossible 2341 VkBool32 persistentContent 2342} 2343 2344@extension("VK_EXT_KHR_display") 2345class VkDisplayModeParametersKHR { 2346 VkExtent2D visibleRegion 2347 u32 refreshRate 2348} 2349 2350@extension("VK_EXT_KHR_display") 2351class VkDisplayModePropertiesKHR { 2352 VkDisplayModeKHR displayMode 2353 VkDisplayModeParametersKHR parameters 2354} 2355 2356@extension("VK_EXT_KHR_display") 2357class VkDisplayModeCreateInfoKHR { 2358 VkStructureType sType 2359 const void* pNext 2360 VkDisplayModeParametersKHR parameters 2361} 2362 2363@extension("VK_EXT_KHR_display") 2364class VkDisplayPlanePropertiesKHR { 2365 VkDisplayKHR currentDisplay 2366 u32 currentStackIndex 2367} 2368 2369@extension("VK_EXT_KHR_display") 2370class VkDisplayPlaneCapabilitiesKHR { 2371 VkDisplayPlaneAlphaFlagsKHR supportedAlpha 2372 VkOffset2D minSrcPosition 2373 VkOffset2D maxSrcPosition 2374 VkExtent2D minSrcExtent 2375 VkExtent2D maxSrcExtent 2376 VkOffset2D minDstPosition 2377 VkOffset2D maxDstPosition 2378 VkExtent2D minDstExtent 2379 VkExtent2D maxDstExtent 2380} 2381 2382@extension("VK_EXT_KHR_display") 2383class VkDisplaySurfaceCreateInfoKHR { 2384 VkStructureType sType 2385 const void* pNext 2386 VkDisplayModeKHR displayMode 2387 u32 planeIndex 2388 u32 planeStackIndex 2389 VkSurfaceTransformKHR transform 2390 f32 globalAlpha 2391 VkDisplayPlaneAlphaFlagsKHR alphaMode 2392 VkExtent2D imageSize 2393} 2394 2395@extension("VK_EXT_KHR_display_swapchain") 2396class VkDisplaySwapchainCreateInfoKHR { 2397 VkStructureType sType 2398 const void* pNext 2399 const VkSwapchainCreateInfoKHR* pNextSwapchainCreateInfo 2400} 2401 2402@extension("VK_EXT_KHR_display_swapchain") 2403class VkDisplayPresentInfoKHR { 2404 VkStructureType sType 2405 const void* pNext 2406 VkRect2D srcRect 2407 VkRect2D dstRect 2408 VkBool32 persistent 2409} 2410 2411 2412//////////////// 2413// Commands // 2414//////////////// 2415 2416// Function pointers. TODO: add support for function pointers. 2417 2418@external type void* PFN_vkVoidFunction 2419@pfn cmd void vkVoidFunction() { 2420} 2421 2422@external type void* PFN_vkAllocationFunction 2423@pfn cmd void* vkAllocationFunction( 2424 void* pUserData, 2425 platform.size_t size, 2426 platform.size_t alignment, 2427 VkSystemAllocationScope allocationScope) { 2428 return ? 2429} 2430 2431@external type void* PFN_vkReallocationFunction 2432@pfn cmd void* vkReallocationFunction( 2433 void* pUserData, 2434 void* pOriginal, 2435 platform.size_t size, 2436 platform.size_t alignment, 2437 VkSystemAllocationScope allocationScope) { 2438 return ? 2439} 2440 2441@external type void* PFN_vkFreeFunction 2442@pfn cmd void vkFreeFunction( 2443 void* pUserData, 2444 void* pMemory) { 2445} 2446 2447@external type void* PFN_vkInternalAllocationNotification 2448@pfn cmd void vkInternalAllocationNotification( 2449 void* pUserData, 2450 platform.size_t size, 2451 VkInternalAllocationType allocationType, 2452 VkSystemAllocationScope allocationScope) { 2453} 2454 2455@external type void* PFN_vkInternalFreeNotification 2456@pfn cmd void vkInternalFreeNotification( 2457 void* pUserData, 2458 platform.size_t size, 2459 VkInternalAllocationType allocationType, 2460 VkSystemAllocationScope allocationScope) { 2461} 2462 2463// Global functions 2464 2465@threadSafety("system") 2466cmd VkResult vkCreateInstance( 2467 const VkInstanceCreateInfo* pCreateInfo, 2468 const VkAllocationCallbacks* pAllocator, 2469 VkInstance* pInstance) { 2470 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO) 2471 2472 instance := ? 2473 pInstance[0] = instance 2474 State.Instances[instance] = new!InstanceObject() 2475 2476 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerNameCount] 2477 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionNameCount] 2478 2479 return ? 2480} 2481 2482@threadSafety("system") 2483cmd void vkDestroyInstance( 2484 VkInstance instance, 2485 const VkAllocationCallbacks* pAllocator) { 2486 instanceObject := GetInstance(instance) 2487 2488 State.Instances[instance] = null 2489} 2490 2491@threadSafety("system") 2492cmd VkResult vkEnumeratePhysicalDevices( 2493 VkInstance instance, 2494 u32* pPhysicalDeviceCount, 2495 VkPhysicalDevice* pPhysicalDevices) { 2496 instanceObject := GetInstance(instance) 2497 2498 physicalDeviceCount := as!u32(?) 2499 pPhysicalDeviceCount[0] = physicalDeviceCount 2500 physicalDevices := pPhysicalDevices[0:physicalDeviceCount] 2501 2502 for i in (0 .. physicalDeviceCount) { 2503 physicalDevice := ? 2504 physicalDevices[i] = physicalDevice 2505 if !(physicalDevice in State.PhysicalDevices) { 2506 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance) 2507 } 2508 } 2509 2510 return ? 2511} 2512 2513cmd PFN_vkVoidFunction vkGetDeviceProcAddr( 2514 VkDevice device, 2515 const char* pName) { 2516 if device != NULL_HANDLE { 2517 device := GetDevice(device) 2518 } 2519 2520 return ? 2521} 2522 2523cmd PFN_vkVoidFunction vkGetInstanceProcAddr( 2524 VkInstance instance, 2525 const char* pName) { 2526 if instance != NULL_HANDLE { 2527 instanceObject := GetInstance(instance) 2528 } 2529 2530 return ? 2531} 2532 2533cmd void vkGetPhysicalDeviceProperties( 2534 VkPhysicalDevice physicalDevice, 2535 VkPhysicalDeviceProperties* pProperties) { 2536 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2537 2538 properties := ? 2539 pProperties[0] = properties 2540} 2541 2542cmd void vkGetPhysicalDeviceQueueFamilyProperties( 2543 VkPhysicalDevice physicalDevice, 2544 u32* pQueueFamilyPropertyCount, 2545 VkQueueFamilyProperties* pQueueFamilyProperties) { 2546 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2547 // TODO: Figure out how to express fetch-count-or-properties 2548 // This version fails 'apic validate' with 'fence not allowed in 2549 // *semantic.Branch'. Other attempts have failed with the same or other 2550 // errors. 2551 // if pQueueFamilyProperties != null { 2552 // queuesProperties := pQueueFamilyProperties[0:pCount[0]] 2553 // for i in (0 .. pCount[0]) { 2554 // queueProperties := as!VkQueueFamilyProperties(?) 2555 // queuesProperties[i] = queueProperties 2556 // } 2557 // } else { 2558 // count := ? 2559 // pCount[0] = count 2560 // } 2561} 2562 2563cmd void vkGetPhysicalDeviceMemoryProperties( 2564 VkPhysicalDevice physicalDevice, 2565 VkPhysicalDeviceMemoryProperties* pMemoryProperties) { 2566 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2567 2568 memoryProperties := ? 2569 pMemoryProperties[0] = memoryProperties 2570} 2571 2572cmd void vkGetPhysicalDeviceFeatures( 2573 VkPhysicalDevice physicalDevice, 2574 VkPhysicalDeviceFeatures* pFeatures) { 2575 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2576 2577 features := ? 2578 pFeatures[0] = features 2579} 2580 2581cmd void vkGetPhysicalDeviceFormatProperties( 2582 VkPhysicalDevice physicalDevice, 2583 VkFormat format, 2584 VkFormatProperties* pFormatProperties) { 2585 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2586 2587 formatProperties := ? 2588 pFormatProperties[0] = formatProperties 2589} 2590 2591cmd void vkGetPhysicalDeviceImageFormatProperties( 2592 VkPhysicalDevice physicalDevice, 2593 VkFormat format, 2594 VkImageType type, 2595 VkImageTiling tiling, 2596 VkImageUsageFlags usage, 2597 VkImageCreateFlags flags, 2598 VkImageFormatProperties* pImageFormatProperties) { 2599 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2600 2601 imageFormatProperties := ? 2602 pImageFormatProperties[0] = imageFormatProperties 2603} 2604 2605 2606// Device functions 2607 2608@threadSafety("system") 2609cmd VkResult vkCreateDevice( 2610 VkPhysicalDevice physicalDevice, 2611 const VkDeviceCreateInfo* pCreateInfo, 2612 const VkAllocationCallbacks* pAllocator, 2613 VkDevice* pDevice) { 2614 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO) 2615 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2616 2617 device := ? 2618 pDevice[0] = device 2619 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice) 2620 2621 return ? 2622} 2623 2624@threadSafety("system") 2625cmd void vkDestroyDevice( 2626 VkDevice device, 2627 const VkAllocationCallbacks* pAllocator) { 2628 deviceObject := GetDevice(device) 2629 2630 State.Devices[device] = null 2631} 2632 2633 2634// Extension discovery functions 2635 2636cmd VkResult vkEnumerateInstanceLayerProperties( 2637 u32* pPropertyCount, 2638 VkLayerProperties* pProperties) { 2639 count := as!u32(?) 2640 pPropertyCount[0] = count 2641 2642 properties := pProperties[0:count] 2643 for i in (0 .. count) { 2644 property := ? 2645 properties[i] = property 2646 } 2647 2648 return ? 2649} 2650 2651cmd VkResult vkEnumerateInstanceExtensionProperties( 2652 const char* pLayerName, 2653 u32* pPropertyCount, 2654 VkExtensionProperties* pProperties) { 2655 count := as!u32(?) 2656 pPropertyCount[0] = count 2657 2658 properties := pProperties[0:count] 2659 for i in (0 .. count) { 2660 property := ? 2661 properties[i] = property 2662 } 2663 2664 return ? 2665} 2666 2667cmd VkResult vkEnumerateDeviceLayerProperties( 2668 VkPhysicalDevice physicalDevice, 2669 u32* pPropertyCount, 2670 VkLayerProperties* pProperties) { 2671 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2672 count := as!u32(?) 2673 pPropertyCount[0] = count 2674 2675 properties := pProperties[0:count] 2676 for i in (0 .. count) { 2677 property := ? 2678 properties[i] = property 2679 } 2680 2681 return ? 2682} 2683 2684cmd VkResult vkEnumerateDeviceExtensionProperties( 2685 VkPhysicalDevice physicalDevice, 2686 const char* pLayerName, 2687 u32* pPropertyCount, 2688 VkExtensionProperties* pProperties) { 2689 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2690 2691 count := as!u32(?) 2692 pPropertyCount[0] = count 2693 2694 properties := pProperties[0:count] 2695 for i in (0 .. count) { 2696 property := ? 2697 properties[i] = property 2698 } 2699 2700 return ? 2701} 2702 2703 2704// Queue functions 2705 2706@threadSafety("system") 2707cmd void vkGetDeviceQueue( 2708 VkDevice device, 2709 u32 queueFamilyIndex, 2710 u32 queueIndex, 2711 VkQueue* pQueue) { 2712 deviceObject := GetDevice(device) 2713 2714 queue := ? 2715 pQueue[0] = queue 2716 2717 if !(queue in State.Queues) { 2718 State.Queues[queue] = new!QueueObject(device: device) 2719 } 2720} 2721 2722@threadSafety("app") 2723cmd VkResult vkQueueSubmit( 2724 VkQueue queue, 2725 u32 submitCount, 2726 const VkSubmitInfo* pSubmits, 2727 VkFence fence) { 2728 queueObject := GetQueue(queue) 2729 2730 if fence != NULL_HANDLE { 2731 fenceObject := GetFence(fence) 2732 assert(fenceObject.device == queueObject.device) 2733 } 2734 2735 // commandBuffers := pcommandBuffers[0:commandBufferCount] 2736 // for i in (0 .. commandBufferCount) { 2737 // commandBuffer := commandBuffers[i] 2738 // commandBufferObject := GetCommandBuffer(commandBuffer) 2739 // assert(commandBufferObject.device == queueObject.device) 2740 // 2741 // validate("QueueCheck", commandBufferObject.queueFlags in queueObject.flags, 2742 // "vkQueueSubmit: enqueued commandBuffer requires missing queue capabilities.") 2743 // } 2744 2745 return ? 2746} 2747 2748@threadSafety("system") 2749cmd VkResult vkQueueWaitIdle( 2750 VkQueue queue) { 2751 queueObject := GetQueue(queue) 2752 2753 return ? 2754} 2755 2756@threadSafety("system") 2757cmd VkResult vkDeviceWaitIdle( 2758 VkDevice device) { 2759 deviceObject := GetDevice(device) 2760 2761 return ? 2762} 2763 2764 2765// Memory functions 2766 2767@threadSafety("system") 2768cmd VkResult vkAllocateMemory( 2769 VkDevice device, 2770 const VkMemoryAllocateInfo* pAllocateInfo, 2771 const VkAllocationCallbacks* pAllocator, 2772 VkDeviceMemory* pMemory) { 2773 assert(pAllocateInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO) 2774 deviceObject := GetDevice(device) 2775 2776 memory := ? 2777 pMemory[0] = memory 2778 State.DeviceMemories[memory] = new!DeviceMemoryObject( 2779 device: device, 2780 allocationSize: pAllocateInfo[0].allocationSize) 2781 2782 return ? 2783} 2784 2785@threadSafety("system") 2786cmd void vkFreeMemory( 2787 VkDevice device, 2788 VkDeviceMemory memory, 2789 const VkAllocationCallbacks* pAllocator) { 2790 deviceObject := GetDevice(device) 2791 memoryObject := GetDeviceMemory(memory) 2792 assert(memoryObject.device == device) 2793 2794 // Check that no objects are still bound before freeing. 2795 validate("MemoryCheck", len(memoryObject.boundObjects) == 0, 2796 "vkFreeMemory: objects still bound") 2797 validate("MemoryCheck", len(memoryObject.boundCommandBuffers) == 0, 2798 "vkFreeMemory: commandBuffers still bound") 2799 State.DeviceMemories[memory] = null 2800} 2801 2802@threadSafety("app") 2803cmd VkResult vkMapMemory( 2804 VkDevice device, 2805 VkDeviceMemory memory, 2806 VkDeviceSize offset, 2807 VkDeviceSize size, 2808 VkMemoryMapFlags flags, 2809 void** ppData) { 2810 deviceObject := GetDevice(device) 2811 memoryObject := GetDeviceMemory(memory) 2812 assert(memoryObject.device == device) 2813 2814 assert(flags == as!VkMemoryMapFlags(0)) 2815 assert((offset + size) <= memoryObject.allocationSize) 2816 2817 return ? 2818} 2819 2820@threadSafety("app") 2821cmd void vkUnmapMemory( 2822 VkDevice device, 2823 VkDeviceMemory memory) { 2824 deviceObject := GetDevice(device) 2825 memoryObject := GetDeviceMemory(memory) 2826 assert(memoryObject.device == device) 2827} 2828 2829cmd VkResult vkFlushMappedMemoryRanges( 2830 VkDevice device, 2831 u32 memoryRangeCount 2832 const VkMappedMemoryRange* pMemoryRanges) { 2833 deviceObject := GetDevice(device) 2834 2835 memoryRanges := pMemoryRanges[0:memoryRangeCount] 2836 for i in (0 .. memoryRangeCount) { 2837 memoryRange := memoryRanges[i] 2838 memoryObject := GetDeviceMemory(memoryRange.memory) 2839 assert(memoryObject.device == device) 2840 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize) 2841 } 2842 2843 return ? 2844} 2845 2846cmd VkResult vkInvalidateMappedMemoryRanges( 2847 VkDevice device, 2848 u32 memoryRangeCount, 2849 const VkMappedMemoryRange* pMemoryRanges) { 2850 deviceObject := GetDevice(device) 2851 2852 memoryRanges := pMemoryRanges[0:memoryRangeCount] 2853 for i in (0 .. memoryRangeCount) { 2854 memoryRange := memoryRanges[i] 2855 memoryObject := GetDeviceMemory(memoryRange.memory) 2856 assert(memoryObject.device == device) 2857 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize) 2858 } 2859 2860 return ? 2861} 2862 2863 2864// Memory management API functions 2865 2866cmd void vkGetDeviceMemoryCommitment( 2867 VkDevice device, 2868 VkDeviceMemory memory, 2869 VkDeviceSize* pCommittedMemoryInBytes) { 2870 deviceObject := GetDevice(device) 2871 2872 if memory != NULL_HANDLE { 2873 memoryObject := GetDeviceMemory(memory) 2874 assert(memoryObject.device == device) 2875 } 2876 2877 committedMemoryInBytes := ? 2878 pCommittedMemoryInBytes[0] = committedMemoryInBytes 2879} 2880 2881cmd void vkGetBufferMemoryRequirements( 2882 VkDevice device, 2883 VkBuffer buffer, 2884 VkMemoryRequirements* pMemoryRequirements) { 2885 deviceObject := GetDevice(device) 2886 bufferObject := GetBuffer(buffer) 2887 assert(bufferObject.device == device) 2888} 2889 2890cmd VkResult vkBindBufferMemory( 2891 VkDevice device, 2892 VkBuffer buffer, 2893 VkDeviceMemory memory, 2894 VkDeviceSize memoryOffset) { 2895 deviceObject := GetDevice(device) 2896 bufferObject := GetBuffer(buffer) 2897 assert(bufferObject.device == device) 2898 2899 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE. 2900 if bufferObject.memory != NULL_HANDLE { 2901 memoryObject := GetDeviceMemory(bufferObject.memory) 2902 memoryObject.boundObjects[as!u64(buffer)] = null 2903 } 2904 2905 // Bind buffer to given memory object, if not VK_NULL_HANDLE. 2906 if memory != NULL_HANDLE { 2907 memoryObject := GetDeviceMemory(memory) 2908 assert(memoryObject.device == device) 2909 memoryObject.boundObjects[as!u64(buffer)] = memoryOffset 2910 } 2911 bufferObject.memory = memory 2912 bufferObject.memoryOffset = memoryOffset 2913 2914 return ? 2915} 2916 2917cmd void vkGetImageMemoryRequirements( 2918 VkDevice device, 2919 VkImage image, 2920 VkMemoryRequirements* pMemoryRequirements) { 2921 deviceObject := GetDevice(device) 2922 imageObject := GetImage(image) 2923 assert(imageObject.device == device) 2924} 2925 2926cmd VkResult vkBindImageMemory( 2927 VkDevice device, 2928 VkImage image, 2929 VkDeviceMemory memory, 2930 VkDeviceSize memoryOffset) { 2931 deviceObject := GetDevice(device) 2932 imageObject := GetImage(image) 2933 assert(imageObject.device == device) 2934 2935 // Unbind image from previous memory object, if not VK_NULL_HANDLE. 2936 if imageObject.memory != NULL_HANDLE { 2937 memoryObject := GetDeviceMemory(imageObject.memory) 2938 memoryObject.boundObjects[as!u64(image)] = null 2939 } 2940 2941 // Bind image to given memory object, if not VK_NULL_HANDLE. 2942 if memory != NULL_HANDLE { 2943 memoryObject := GetDeviceMemory(memory) 2944 assert(memoryObject.device == device) 2945 memoryObject.boundObjects[as!u64(image)] = memoryOffset 2946 } 2947 imageObject.memory = memory 2948 imageObject.memoryOffset = memoryOffset 2949 2950 return ? 2951} 2952 2953cmd void vkGetImageSparseMemoryRequirements( 2954 VkDevice device, 2955 VkImage image, 2956 u32* pSparseMemoryRequirementCount, 2957 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) { 2958 deviceObject := GetDevice(device) 2959 imageObject := GetImage(image) 2960 assert(imageObject.device == device) 2961} 2962 2963cmd void vkGetPhysicalDeviceSparseImageFormatProperties( 2964 VkPhysicalDevice physicalDevice, 2965 VkFormat format, 2966 VkImageType type, 2967 u32 samples, 2968 VkImageUsageFlags usage, 2969 VkImageTiling tiling, 2970 u32* pPropertyCount, 2971 VkSparseImageFormatProperties* pProperties) { 2972 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2973} 2974 2975cmd VkResult vkQueueBindSparse( 2976 VkQueue queue, 2977 u32 bindInfoCount, 2978 const VkBindSparseInfo* pBindInfo, 2979 VkFence fence) { 2980 queueObject := GetQueue(queue) 2981 2982 return ? 2983} 2984 2985 2986// Fence functions 2987 2988@threadSafety("system") 2989cmd VkResult vkCreateFence( 2990 VkDevice device, 2991 const VkFenceCreateInfo* pCreateInfo, 2992 const VkAllocationCallbacks* pAllocator, 2993 VkFence* pFence) { 2994 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO) 2995 deviceObject := GetDevice(device) 2996 2997 fence := ? 2998 pFence[0] = fence 2999 State.Fences[fence] = new!FenceObject( 3000 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT))) 3001 3002 return ? 3003} 3004 3005@threadSafety("system") 3006cmd void vkDestroyFence( 3007 VkDevice device, 3008 VkFence fence, 3009 const VkAllocationCallbacks* pAllocator) { 3010 deviceObject := GetDevice(device) 3011 fenceObject := GetFence(fence) 3012 assert(fenceObject.device == device) 3013 3014 State.Fences[fence] = null 3015} 3016 3017@threadSafety("system") 3018cmd VkResult vkResetFences( 3019 VkDevice device, 3020 u32 fenceCount, 3021 const VkFence* pFences) { 3022 deviceObject := GetDevice(device) 3023 3024 fences := pFences[0:fenceCount] 3025 for i in (0 .. fenceCount) { 3026 fence := fences[i] 3027 fenceObject := GetFence(fence) 3028 assert(fenceObject.device == device) 3029 fenceObject.signaled = false 3030 } 3031 3032 return ? 3033} 3034 3035@threadSafety("system") 3036cmd VkResult vkGetFenceStatus( 3037 VkDevice device, 3038 VkFence fence) { 3039 deviceObject := GetDevice(device) 3040 fenceObject := GetFence(fence) 3041 assert(fenceObject.device == device) 3042 3043 return ? 3044} 3045 3046@threadSafety("system") 3047cmd VkResult vkWaitForFences( 3048 VkDevice device, 3049 u32 fenceCount, 3050 const VkFence* pFences, 3051 VkBool32 waitAll, 3052 u64 timeout) { /// timeout in nanoseconds 3053 deviceObject := GetDevice(device) 3054 3055 fences := pFences[0:fenceCount] 3056 for i in (0 .. fenceCount) { 3057 fence := fences[i] 3058 fenceObject := GetFence(fence) 3059 assert(fenceObject.device == device) 3060 } 3061 3062 return ? 3063} 3064 3065 3066// Queue semaphore functions 3067 3068@threadSafety("system") 3069cmd VkResult vkCreateSemaphore( 3070 VkDevice device, 3071 const VkSemaphoreCreateInfo* pCreateInfo, 3072 const VkAllocationCallbacks* pAllocator, 3073 VkSemaphore* pSemaphore) { 3074 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO) 3075 deviceObject := GetDevice(device) 3076 3077 semaphore := ? 3078 pSemaphore[0] = semaphore 3079 State.Semaphores[semaphore] = new!SemaphoreObject(device: device) 3080 3081 return ? 3082} 3083 3084@threadSafety("system") 3085cmd void vkDestroySemaphore( 3086 VkDevice device, 3087 VkSemaphore semaphore, 3088 const VkAllocationCallbacks* pAllocator) { 3089 deviceObject := GetDevice(device) 3090 semaphoreObject := GetSemaphore(semaphore) 3091 assert(semaphoreObject.device == device) 3092 3093 State.Semaphores[semaphore] = null 3094} 3095 3096 3097// Event functions 3098 3099@threadSafety("system") 3100cmd VkResult vkCreateEvent( 3101 VkDevice device, 3102 const VkEventCreateInfo* pCreateInfo, 3103 const VkAllocationCallbacks* pAllocator, 3104 VkEvent* pEvent) { 3105 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO) 3106 deviceObject := GetDevice(device) 3107 3108 event := ? 3109 pEvent[0] = event 3110 State.Events[event] = new!EventObject(device: device) 3111 3112 return ? 3113} 3114 3115@threadSafety("system") 3116cmd void vkDestroyEvent( 3117 VkDevice device, 3118 VkEvent event, 3119 const VkAllocationCallbacks* pAllocator) { 3120 deviceObject := GetDevice(device) 3121 eventObject := GetEvent(event) 3122 assert(eventObject.device == device) 3123 3124 State.Events[event] = null 3125} 3126 3127@threadSafety("system") 3128cmd VkResult vkGetEventStatus( 3129 VkDevice device, 3130 VkEvent event) { 3131 deviceObject := GetDevice(device) 3132 eventObject := GetEvent(event) 3133 assert(eventObject.device == device) 3134 3135 return ? 3136} 3137 3138@threadSafety("system") 3139cmd VkResult vkSetEvent( 3140 VkDevice device, 3141 VkEvent event) { 3142 deviceObject := GetDevice(device) 3143 eventObject := GetEvent(event) 3144 assert(eventObject.device == device) 3145 3146 return ? 3147} 3148 3149@threadSafety("system") 3150cmd VkResult vkResetEvent( 3151 VkDevice device, 3152 VkEvent event) { 3153 deviceObject := GetDevice(device) 3154 eventObject := GetEvent(event) 3155 assert(eventObject.device == device) 3156 3157 return ? 3158} 3159 3160 3161// Query functions 3162 3163@threadSafety("system") 3164cmd VkResult vkCreateQueryPool( 3165 VkDevice device, 3166 const VkQueryPoolCreateInfo* pCreateInfo, 3167 const VkAllocationCallbacks* pAllocator, 3168 VkQueryPool* pQueryPool) { 3169 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO) 3170 deviceObject := GetDevice(device) 3171 3172 queryPool := ? 3173 pQueryPool[0] = queryPool 3174 State.QueryPools[queryPool] = new!QueryPoolObject(device: device) 3175 3176 return ? 3177} 3178 3179@threadSafety("system") 3180cmd void vkDestroyQueryPool( 3181 VkDevice device, 3182 VkQueryPool queryPool, 3183 const VkAllocationCallbacks* pAllocator) { 3184 deviceObject := GetDevice(device) 3185 queryPoolObject := GetQueryPool(queryPool) 3186 assert(queryPoolObject.device == device) 3187 3188 State.QueryPools[queryPool] = null 3189} 3190 3191@threadSafety("system") 3192cmd VkResult vkGetQueryPoolResults( 3193 VkDevice device, 3194 VkQueryPool queryPool, 3195 u32 startQuery, 3196 u32 queryCount, 3197 platform.size_t dataSize, 3198 void* pData, 3199 VkDeviceSize stride, 3200 VkQueryResultFlags flags) { 3201 deviceObject := GetDevice(device) 3202 queryPoolObject := GetQueryPool(queryPool) 3203 assert(queryPoolObject.device == device) 3204 3205 data := pData[0:dataSize] 3206 3207 return ? 3208} 3209 3210// Buffer functions 3211 3212@threadSafety("system") 3213cmd VkResult vkCreateBuffer( 3214 VkDevice device, 3215 const VkBufferCreateInfo* pCreateInfo, 3216 const VkAllocationCallbacks* pAllocator, 3217 VkBuffer* pBuffer) { 3218 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO) 3219 deviceObject := GetDevice(device) 3220 3221 buffer := ? 3222 pBuffer[0] = buffer 3223 State.Buffers[buffer] = new!BufferObject(device: device) 3224 3225 return ? 3226} 3227 3228@threadSafety("system") 3229cmd void vkDestroyBuffer( 3230 VkDevice device, 3231 VkBuffer buffer, 3232 const VkAllocationCallbacks* pAllocator) { 3233 deviceObject := GetDevice(device) 3234 bufferObject := GetBuffer(buffer) 3235 assert(bufferObject.device == device) 3236 3237 assert(bufferObject.memory == 0) 3238 State.Buffers[buffer] = null 3239} 3240 3241 3242// Buffer view functions 3243 3244@threadSafety("system") 3245cmd VkResult vkCreateBufferView( 3246 VkDevice device, 3247 const VkBufferViewCreateInfo* pCreateInfo, 3248 const VkAllocationCallbacks* pAllocator, 3249 VkBufferView* pView) { 3250 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO) 3251 deviceObject := GetDevice(device) 3252 3253 bufferObject := GetBuffer(pCreateInfo.buffer) 3254 assert(bufferObject.device == device) 3255 3256 view := ? 3257 pView[0] = view 3258 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer) 3259 3260 return ? 3261} 3262 3263@threadSafety("system") 3264cmd void vkDestroyBufferView( 3265 VkDevice device, 3266 VkBufferView bufferView, 3267 const VkAllocationCallbacks* pAllocator) { 3268 deviceObject := GetDevice(device) 3269 bufferViewObject := GetBufferView(bufferView) 3270 assert(bufferViewObject.device == device) 3271 3272 State.BufferViews[bufferView] = null 3273} 3274 3275 3276// Image functions 3277 3278@threadSafety("system") 3279cmd VkResult vkCreateImage( 3280 VkDevice device, 3281 const VkImageCreateInfo* pCreateInfo, 3282 const VkAllocationCallbacks* pAllocator, 3283 VkImage* pImage) { 3284 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO) 3285 deviceObject := GetDevice(device) 3286 3287 image := ? 3288 pImage[0] = image 3289 State.Images[image] = new!ImageObject(device: device) 3290 3291 return ? 3292} 3293 3294@threadSafety("system") 3295cmd void vkDestroyImage( 3296 VkDevice device, 3297 VkImage image, 3298 const VkAllocationCallbacks* pAllocator) { 3299 deviceObject := GetDevice(device) 3300 imageObject := GetImage(image) 3301 assert(imageObject.device == device) 3302 3303 assert(imageObject.memory == 0) 3304 State.Images[image] = null 3305} 3306 3307cmd void vkGetImageSubresourceLayout( 3308 VkDevice device, 3309 VkImage image, 3310 const VkImageSubresource* pSubresource, 3311 VkSubresourceLayout* pLayout) { 3312 deviceObject := GetDevice(device) 3313 imageObject := GetImage(image) 3314 assert(imageObject.device == device) 3315} 3316 3317 3318// Image view functions 3319 3320@threadSafety("system") 3321cmd VkResult vkCreateImageView( 3322 VkDevice device, 3323 const VkImageViewCreateInfo* pCreateInfo, 3324 const VkAllocationCallbacks* pAllocator, 3325 VkImageView* pView) { 3326 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO) 3327 deviceObject := GetDevice(device) 3328 3329 imageObject := GetImage(pCreateInfo.image) 3330 assert(imageObject.device == device) 3331 3332 view := ? 3333 pView[0] = view 3334 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image) 3335 3336 return ? 3337} 3338 3339@threadSafety("system") 3340cmd void vkDestroyImageView( 3341 VkDevice device, 3342 VkImageView imageView, 3343 const VkAllocationCallbacks* pAllocator) { 3344 deviceObject := GetDevice(device) 3345 imageViewObject := GetImageView(imageView) 3346 assert(imageViewObject.device == device) 3347 3348 State.ImageViews[imageView] = null 3349} 3350 3351 3352// Shader functions 3353 3354cmd VkResult vkCreateShaderModule( 3355 VkDevice device, 3356 const VkShaderModuleCreateInfo* pCreateInfo, 3357 const VkAllocationCallbacks* pAllocator, 3358 VkShaderModule* pShaderModule) { 3359 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO) 3360 deviceObject := GetDevice(device) 3361 3362 shaderModule := ? 3363 pShaderModule[0] = shaderModule 3364 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device) 3365 3366 return ? 3367} 3368 3369cmd void vkDestroyShaderModule( 3370 VkDevice device, 3371 VkShaderModule shaderModule, 3372 const VkAllocationCallbacks* pAllocator) { 3373 deviceObject := GetDevice(device) 3374 shaderModuleObject := GetShaderModule(shaderModule) 3375 assert(shaderModuleObject.device == device) 3376 3377 State.ShaderModules[shaderModule] = null 3378} 3379 3380@threadSafety("system") 3381cmd VkResult vkCreateShader( 3382 VkDevice device, 3383 const VkShaderCreateInfo* pCreateInfo, 3384 const VkAllocationCallbacks* pAllocator, 3385 VkShader* pShader) { 3386 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO) 3387 deviceObject := GetDevice(device) 3388 3389 shader := ? 3390 pShader[0] = shader 3391 State.Shaders[shader] = new!ShaderObject(device: device) 3392 3393 return ? 3394} 3395 3396@threadSafety("system") 3397cmd void vkDestroyShader( 3398 VkDevice device, 3399 VkShader shader, 3400 const VkAllocationCallbacks* pAllocator) { 3401 deviceObject := GetDevice(device) 3402 shaderObject := GetShader(shader) 3403 assert(shaderObject.device == device) 3404 3405 State.Shaders[shader] = null 3406} 3407 3408 3409// Pipeline functions 3410 3411cmd VkResult vkCreatePipelineCache( 3412 VkDevice device, 3413 const VkPipelineCacheCreateInfo* pCreateInfo, 3414 const VkAllocationCallbacks* pAllocator, 3415 VkPipelineCache* pPipelineCache) { 3416 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO) 3417 deviceObject := GetDevice(device) 3418 3419 pipelineCache := ? 3420 pPipelineCache[0] = pipelineCache 3421 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device) 3422 3423 return ? 3424} 3425 3426cmd void vkDestroyPipelineCache( 3427 VkDevice device, 3428 VkPipelineCache pipelineCache, 3429 const VkAllocationCallbacks* pAllocator) { 3430 deviceObject := GetDevice(device) 3431 pipelineCacheObject := GetPipelineCache(pipelineCache) 3432 assert(pipelineCacheObject.device == device) 3433 3434 State.PipelineCaches[pipelineCache] = null 3435} 3436 3437cmd VkResult vkGetPipelineCacheData( 3438 VkDevice device, 3439 VkPipelineCache pipelineCache, 3440 platform.size_t* pDataSize, 3441 void* pData) { 3442 deviceObject := GetDevice(device) 3443 pipelineCacheObject := GetPipelineCache(pipelineCache) 3444 assert(pipelineCacheObject.device == device) 3445 3446 return ? 3447} 3448 3449cmd VkResult vkMergePipelineCaches( 3450 VkDevice device, 3451 VkPipelineCache dstCache, 3452 u32 srcCacheCount, 3453 const VkPipelineCache* pSrcCaches) { 3454 deviceObject := GetDevice(device) 3455 dstCacheObject := GetPipelineCache(dstCache) 3456 assert(dstCacheObject.device == device) 3457 3458 srcCaches := pSrcCaches[0:srcCacheCount] 3459 for i in (0 .. srcCacheCount) { 3460 srcCache := srcCaches[i] 3461 srcCacheObject := GetPipelineCache(srcCache) 3462 assert(srcCacheObject.device == device) 3463 } 3464 3465 return ? 3466} 3467 3468cmd VkResult vkCreateGraphicsPipelines( 3469 VkDevice device, 3470 VkPipelineCache pipelineCache, 3471 u32 createInfoCount, 3472 const VkGraphicsPipelineCreateInfo* pCreateInfos, 3473 const VkAllocationCallbacks* pAllocator, 3474 VkPipeline* pPipelines) { 3475 deviceObject := GetDevice(device) 3476 if pipelineCache != NULL_HANDLE { 3477 pipelineCacheObject := GetPipelineCache(pipelineCache) 3478 assert(pipelineCacheObject.device == device) 3479 } 3480 3481 createInfos := pCreateInfos[0:createInfoCount] 3482 pipelines := pPipelines[0:createInfoCount] 3483 for i in (0 .. createInfoCount) { 3484 pipeline := ? 3485 pipelines[i] = pipeline 3486 State.Pipelines[pipeline] = new!PipelineObject(device: device) 3487 } 3488 3489 return ? 3490} 3491 3492cmd VkResult vkCreateComputePipelines( 3493 VkDevice device, 3494 VkPipelineCache pipelineCache, 3495 u32 createInfoCount, 3496 const VkComputePipelineCreateInfo* pCreateInfos, 3497 const VkAllocationCallbacks* pAllocator, 3498 VkPipeline* pPipelines) { 3499 deviceObject := GetDevice(device) 3500 if pipelineCache != NULL_HANDLE { 3501 pipelineCacheObject := GetPipelineCache(pipelineCache) 3502 assert(pipelineCacheObject.device == device) 3503 } 3504 3505 createInfos := pCreateInfos[0:createInfoCount] 3506 pipelines := pPipelines[0:createInfoCount] 3507 for i in (0 .. createInfoCount) { 3508 pipeline := ? 3509 pipelines[i] = pipeline 3510 State.Pipelines[pipeline] = new!PipelineObject(device: device) 3511 } 3512 3513 return ? 3514} 3515 3516@threadSafety("system") 3517cmd void vkDestroyPipeline( 3518 VkDevice device, 3519 VkPipeline pipeline, 3520 const VkAllocationCallbacks* pAllocator) { 3521 deviceObject := GetDevice(device) 3522 pipelineObjects := GetPipeline(pipeline) 3523 assert(pipelineObjects.device == device) 3524 3525 State.Pipelines[pipeline] = null 3526} 3527 3528 3529// Pipeline layout functions 3530 3531@threadSafety("system") 3532cmd VkResult vkCreatePipelineLayout( 3533 VkDevice device, 3534 const VkPipelineLayoutCreateInfo* pCreateInfo, 3535 const VkAllocationCallbacks* pAllocator, 3536 VkPipelineLayout* pPipelineLayout) { 3537 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO) 3538 deviceObject := GetDevice(device) 3539 3540 pipelineLayout := ? 3541 pPipelineLayout[0] = pipelineLayout 3542 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device) 3543 3544 return ? 3545} 3546 3547@threadSafety("system") 3548cmd void vkDestroyPipelineLayout( 3549 VkDevice device, 3550 VkPipelineLayout pipelineLayout, 3551 const VkAllocationCallbacks* pAllocator) { 3552 deviceObject := GetDevice(device) 3553 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout) 3554 assert(pipelineLayoutObjects.device == device) 3555 3556 State.PipelineLayouts[pipelineLayout] = null 3557} 3558 3559 3560// Sampler functions 3561 3562@threadSafety("system") 3563cmd VkResult vkCreateSampler( 3564 VkDevice device, 3565 const VkSamplerCreateInfo* pCreateInfo, 3566 const VkAllocationCallbacks* pAllocator, 3567 VkSampler* pSampler) { 3568 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO) 3569 deviceObject := GetDevice(device) 3570 3571 sampler := ? 3572 pSampler[0] = sampler 3573 State.Samplers[sampler] = new!SamplerObject(device: device) 3574 3575 return ? 3576} 3577 3578@threadSafety("system") 3579cmd void vkDestroySampler( 3580 VkDevice device, 3581 VkSampler sampler, 3582 const VkAllocationCallbacks* pAllocator) { 3583 deviceObject := GetDevice(device) 3584 samplerObject := GetSampler(sampler) 3585 assert(samplerObject.device == device) 3586 3587 State.Samplers[sampler] = null 3588} 3589 3590 3591// Descriptor set functions 3592 3593@threadSafety("system") 3594cmd VkResult vkCreateDescriptorSetLayout( 3595 VkDevice device, 3596 const VkDescriptorSetLayoutCreateInfo* pCreateInfo, 3597 const VkAllocationCallbacks* pAllocator, 3598 VkDescriptorSetLayout* pSetLayout) { 3599 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO) 3600 deviceObject := GetDevice(device) 3601 3602 setLayout := ? 3603 pSetLayout[0] = setLayout 3604 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device) 3605 3606 return ? 3607} 3608 3609@threadSafety("system") 3610cmd void vkDestroyDescriptorSetLayout( 3611 VkDevice device, 3612 VkDescriptorSetLayout descriptorSetLayout, 3613 const VkAllocationCallbacks* pAllocator) { 3614 deviceObject := GetDevice(device) 3615 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout) 3616 assert(descriptorSetLayoutObject.device == device) 3617 3618 State.DescriptorSetLayouts[descriptorSetLayout] = null 3619} 3620 3621@threadSafety("system") 3622cmd VkResult vkCreateDescriptorPool( 3623 VkDevice device, 3624 const VkDescriptorPoolCreateInfo* pCreateInfo, 3625 const VkAllocationCallbacks* pAllocator, 3626 VkDescriptorPool* pDescriptorPool) { 3627 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO) 3628 deviceObject := GetDevice(device) 3629 3630 descriptorPool := ? 3631 pDescriptorPool[0] = descriptorPool 3632 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device) 3633 3634 return ? 3635} 3636 3637@threadSafety("system") 3638cmd void vkDestroyDescriptorPool( 3639 VkDevice device, 3640 VkDescriptorPool descriptorPool, 3641 const VkAllocationCallbacks* pAllocator) { 3642 deviceObject := GetDevice(device) 3643 descriptorPoolObject := GetDescriptorPool(descriptorPool) 3644 assert(descriptorPoolObject.device == device) 3645 3646 State.DescriptorPools[descriptorPool] = null 3647} 3648 3649@threadSafety("app") 3650cmd VkResult vkResetDescriptorPool( 3651 VkDevice device, 3652 VkDescriptorPool descriptorPool, 3653 VkDescriptorPoolResetFlags flags) { 3654 deviceObject := GetDevice(device) 3655 descriptorPoolObject := GetDescriptorPool(descriptorPool) 3656 assert(descriptorPoolObject.device == device) 3657 3658 return ? 3659} 3660 3661@threadSafety("app") 3662cmd VkResult vkAllocateDescriptorSets( 3663 VkDevice device, 3664 const VkDescriptorSetAllocateInfo* pAllocateInfo, 3665 VkDescriptorSet* pDescriptorSets) { 3666 deviceObject := GetDevice(device) 3667 allocInfo := pAllocateInfo[0] 3668 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool) 3669 3670 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount] 3671 for i in (0 .. allocInfo.setCount) { 3672 setLayout := setLayouts[i] 3673 setLayoutObject := GetDescriptorSetLayout(setLayout) 3674 assert(setLayoutObject.device == device) 3675 } 3676 3677 descriptorSets := pDescriptorSets[0:allocInfo.setCount] 3678 for i in (0 .. allocInfo.setCount) { 3679 descriptorSet := ? 3680 descriptorSets[i] = descriptorSet 3681 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device) 3682 } 3683 3684 return ? 3685} 3686 3687cmd VkResult vkFreeDescriptorSets( 3688 VkDevice device, 3689 VkDescriptorPool descriptorPool, 3690 u32 descriptorSetCount, 3691 const VkDescriptorSet* pDescriptorSets) { 3692 deviceObject := GetDevice(device) 3693 descriptorPoolObject := GetDescriptorPool(descriptorPool) 3694 3695 descriptorSets := pDescriptorSets[0:descriptorSetCount] 3696 for i in (0 .. descriptorSetCount) { 3697 descriptorSet := descriptorSets[i] 3698 descriptorSetObject := GetDescriptorSet(descriptorSet) 3699 assert(descriptorSetObject.device == device) 3700 State.DescriptorSets[descriptorSet] = null 3701 } 3702 3703 return ? 3704} 3705 3706cmd void vkUpdateDescriptorSets( 3707 VkDevice device, 3708 u32 descriptorWriteCount, 3709 const VkWriteDescriptorSet* pDescriptorWrites, 3710 u32 descriptorCopyCount, 3711 const VkCopyDescriptorSet* pDescriptorCopies) { 3712 deviceObject := GetDevice(device) 3713 3714 descriptorWrites := pDescriptorWrites[0:descriptorWriteCount] 3715 for i in (0 .. descriptorWriteCount) { 3716 descriptorWrite := descriptorWrites[i] 3717 descriptorWriteObject := GetDescriptorSet(descriptorWrite.dstSet) 3718 assert(descriptorWriteObject.device == device) 3719 } 3720 3721 descriptorCopies := pDescriptorCopies[0:descriptorCopyCount] 3722 for i in (0 .. descriptorCopyCount) { 3723 descriptorCopy := descriptorCopies[i] 3724 descriptorCopyObject := GetDescriptorSet(descriptorCopy.dstSet) 3725 assert(descriptorCopyObject.device == device) 3726 } 3727} 3728 3729 3730// Framebuffer functions 3731 3732@threadSafety("system") 3733cmd VkResult vkCreateFramebuffer( 3734 VkDevice device, 3735 const VkFramebufferCreateInfo* pCreateInfo, 3736 const VkAllocationCallbacks* pAllocator, 3737 VkFramebuffer* pFramebuffer) { 3738 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO) 3739 deviceObject := GetDevice(device) 3740 3741 framebuffer := ? 3742 pFramebuffer[0] = framebuffer 3743 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device) 3744 3745 return ? 3746} 3747 3748@threadSafety("system") 3749cmd void vkDestroyFramebuffer( 3750 VkDevice device, 3751 VkFramebuffer framebuffer, 3752 const VkAllocationCallbacks* pAllocator) { 3753 deviceObject := GetDevice(device) 3754 framebufferObject := GetFramebuffer(framebuffer) 3755 assert(framebufferObject.device == device) 3756 3757 State.Framebuffers[framebuffer] = null 3758} 3759 3760 3761// Renderpass functions 3762 3763@threadSafety("system") 3764cmd VkResult vkCreateRenderPass( 3765 VkDevice device, 3766 const VkRenderPassCreateInfo* pCreateInfo, 3767 const VkAllocationCallbacks* pAllocator, 3768 VkRenderPass* pRenderPass) { 3769 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO) 3770 deviceObject := GetDevice(device) 3771 3772 renderpass := ? 3773 pRenderPass[0] = renderpass 3774 State.RenderPasses[renderpass] = new!RenderPassObject(device: device) 3775 3776 return ? 3777} 3778 3779@threadSafety("system") 3780cmd void vkDestroyRenderPass( 3781 VkDevice device, 3782 VkRenderPass renderPass, 3783 const VkAllocationCallbacks* pAllocator) { 3784 deviceObject := GetDevice(device) 3785 renderPassObject := GetRenderPass(renderPass) 3786 assert(renderPassObject.device == device) 3787 3788 State.RenderPasses[renderPass] = null 3789} 3790 3791cmd void vkGetRenderAreaGranularity( 3792 VkDevice device, 3793 VkRenderPass renderPass, 3794 VkExtent2D* pGranularity) { 3795 deviceObject := GetDevice(device) 3796 renderPassObject := GetRenderPass(renderPass) 3797 3798 granularity := ? 3799 pGranularity[0] = granularity 3800} 3801 3802// Command pool functions 3803 3804cmd VkResult vkCreateCommandPool( 3805 VkDevice device, 3806 const VkCommandPoolCreateInfo* pCreateInfo, 3807 const VkAllocationCallbacks* pAllocator, 3808 VkCommandPool* pCommandPool) { 3809 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO) 3810 deviceObject := GetDevice(device) 3811 3812 commandPool := ? 3813 pCommandPool[0] = commandPool 3814 State.CommandPools[commandPool] = new!CommandPoolObject(device: device) 3815 3816 return ? 3817} 3818 3819cmd void vkDestroyCommandPool( 3820 VkDevice device, 3821 VkCommandPool commandPool, 3822 const VkAllocationCallbacks* pAllocator) { 3823 deviceObject := GetDevice(device) 3824 commandPoolObject := GetCommandPool(commandPool) 3825 assert(commandPoolObject.device == device) 3826 3827 State.CommandPools[commandPool] = null 3828} 3829 3830cmd VkResult vkResetCommandPool( 3831 VkDevice device, 3832 VkCommandPool commandPool, 3833 VkCommandPoolResetFlags flags) { 3834 deviceObject := GetDevice(device) 3835 commandPoolObject := GetCommandPool(commandPool) 3836 assert(commandPoolObject.device == device) 3837 3838 return ? 3839} 3840 3841// Command buffer functions 3842 3843macro void bindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) { 3844 memoryObject := GetDeviceMemory(memory) 3845 memoryObject.boundCommandBuffers[commandBuffer] = commandBuffer 3846 3847 commandBufferObject := GetCommandBuffer(commandBuffer) 3848 commandBufferObject.boundObjects[as!u64(obj)] = memory 3849} 3850 3851macro void unbindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) { 3852 memoryObject := GetDeviceMemory(memory) 3853 memoryObject.boundCommandBuffers[commandBuffer] = null 3854 3855 commandBufferObject := GetCommandBuffer(commandBuffer) 3856 commandBufferObject.boundObjects[as!u64(obj)] = null 3857} 3858 3859@threadSafety("system") 3860cmd VkResult vkAllocateCommandBuffers( 3861 VkDevice device, 3862 const VkCommandBufferAllocateInfo* pAllocateInfo, 3863 VkCommandBuffer* pCommandBuffers) { 3864 assert(pAllocateInfo[0].sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOC_INFO) 3865 3866 count := pAllocateInfo[0].bufferCount 3867 commandBuffers := pCommandBuffers[0:count] 3868 for i in (0 .. count) { 3869 commandBuffer := ? 3870 commandBuffers[i] = commandBuffer 3871 State.CommandBuffers[commandBuffer] = new!CommandBufferObject(device: device) 3872 } 3873 3874 return ? 3875} 3876 3877@threadSafety("system") 3878cmd void vkFreeCommandBuffers( 3879 VkDevice device, 3880 VkCommandPool commandPool, 3881 u32 commandBufferCount, 3882 const VkCommandBuffer* pCommandBuffers) { 3883 deviceObject := GetDevice(device) 3884 3885 commandBuffers := pCommandBuffers[0:commandBufferCount] 3886 for i in (0 .. commandBufferCount) { 3887 commandBufferObject := GetCommandBuffer(commandBuffers[i]) 3888 assert(commandBufferObject.device == device) 3889 // TODO: iterate over boundObjects and clear memory bindings 3890 State.CommandBuffers[commandBuffers[i]] = null 3891 } 3892} 3893 3894@threadSafety("app") 3895cmd VkResult vkBeginCommandBuffer( 3896 VkCommandBuffer commandBuffer, 3897 const VkCommandBufferBeginInfo* pBeginInfo) { 3898 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO) 3899 commandBufferObject := GetCommandBuffer(commandBuffer) 3900 3901 // TODO: iterate over boundObjects and clear memory bindings 3902 3903 return ? 3904} 3905 3906@threadSafety("app") 3907cmd VkResult vkEndCommandBuffer( 3908 VkCommandBuffer commandBuffer) { 3909 commandBufferObject := GetCommandBuffer(commandBuffer) 3910 3911 return ? 3912} 3913 3914@threadSafety("app") 3915cmd VkResult vkResetCommandBuffer( 3916 VkCommandBuffer commandBuffer, 3917 VkCommandBufferResetFlags flags) { 3918 commandBufferObject := GetCommandBuffer(commandBuffer) 3919 3920 // TODO: iterate over boundObjects and clear memory bindings 3921 3922 return ? 3923} 3924 3925 3926// Command buffer building functions 3927 3928@threadSafety("app") 3929cmd void vkCmdBindPipeline( 3930 VkCommandBuffer commandBuffer, 3931 VkPipelineBindPoint pipelineBindPoint, 3932 VkPipeline pipeline) { 3933 commandBufferObject := GetCommandBuffer(commandBuffer) 3934 pipelineObject := GetPipeline(pipeline) 3935 assert(commandBufferObject.device == pipelineObject.device) 3936 3937 queue := switch (pipelineBindPoint) { 3938 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT 3939 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT 3940 } 3941 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue) 3942} 3943 3944@threadSafety("app") 3945cmd void vkCmdSetViewport( 3946 VkCommandBuffer commandBuffer, 3947 u32 viewportCount, 3948 const VkViewport* pViewports) { 3949 commandBufferObject := GetCommandBuffer(commandBuffer) 3950 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 3951} 3952 3953@threadSafety("app") 3954cmd void vkCmdSetScissor( 3955 VkCommandBuffer commandBuffer, 3956 u32 scissorCount, 3957 const VkRect2D* pScissors) { 3958 commandBufferObject := GetCommandBuffer(commandBuffer) 3959 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 3960} 3961 3962@threadSafety("app") 3963cmd void vkCmdSetLineWidth( 3964 VkCommandBuffer commandBuffer, 3965 f32 lineWidth) { 3966 commandBufferObject := GetCommandBuffer(commandBuffer) 3967 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 3968} 3969 3970@threadSafety("app") 3971cmd void vkCmdSetDepthBias( 3972 VkCommandBuffer commandBuffer, 3973 f32 depthBiasConstantFactor, 3974 f32 depthBiasClamp, 3975 f32 depthBiasSlopeFactor) { 3976 commandBufferObject := GetCommandBuffer(commandBuffer) 3977 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 3978} 3979 3980@threadSafety("app") 3981cmd void vkCmdSetBlendConstants( 3982 VkCommandBuffer commandBuffer, 3983 // TODO(jessehall): apic only supports 'const' on pointer types. Using 3984 // an annotation as a quick hack to pass this to the template without 3985 // having to modify the AST and semantic model. 3986 @readonly f32[4] blendConstants) { 3987 commandBufferObject := GetCommandBuffer(commandBuffer) 3988 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 3989} 3990 3991@threadSafety("app") 3992cmd void vkCmdSetDepthBounds( 3993 VkCommandBuffer commandBuffer, 3994 f32 minDepthBounds, 3995 f32 maxDepthBounds) { 3996 commandBufferObject := GetCommandBuffer(commandBuffer) 3997 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 3998} 3999 4000@threadSafety("app") 4001cmd void vkCmdSetStencilCompareMask( 4002 VkCommandBuffer commandBuffer, 4003 VkStencilFaceFlags faceMask, 4004 u32 stencilCompareMask) { 4005 commandBufferObject := GetCommandBuffer(commandBuffer) 4006 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4007} 4008 4009@threadSafety("app") 4010cmd void vkCmdSetStencilWriteMask( 4011 VkCommandBuffer commandBuffer, 4012 VkStencilFaceFlags faceMask, 4013 u32 stencilWriteMask) { 4014 commandBufferObject := GetCommandBuffer(commandBuffer) 4015 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4016} 4017 4018@threadSafety("app") 4019cmd void vkCmdSetStencilReference( 4020 VkCommandBuffer commandBuffer, 4021 VkStencilFaceFlags faceMask, 4022 u32 stencilReference) { 4023 commandBufferObject := GetCommandBuffer(commandBuffer) 4024 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4025} 4026 4027@threadSafety("app") 4028cmd void vkCmdBindDescriptorSets( 4029 VkCommandBuffer commandBuffer, 4030 VkPipelineBindPoint pipelineBindPoint, 4031 VkPipelineLayout layout, 4032 u32 firstSet, 4033 u32 descriptorSetCount, 4034 const VkDescriptorSet* pDescriptorSets, 4035 u32 dynamicOffsetCount, 4036 const u32* pDynamicOffsets) { 4037 commandBufferObject := GetCommandBuffer(commandBuffer) 4038 4039 descriptorSets := pDescriptorSets[0:descriptorSetCount] 4040 for i in (0 .. descriptorSetCount) { 4041 descriptorSet := descriptorSets[i] 4042 descriptorSetObject := GetDescriptorSet(descriptorSet) 4043 assert(commandBufferObject.device == descriptorSetObject.device) 4044 } 4045 4046 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount] 4047 for i in (0 .. dynamicOffsetCount) { 4048 dynamicOffset := dynamicOffsets[i] 4049 } 4050 4051 queue := switch (pipelineBindPoint) { 4052 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT 4053 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT 4054 } 4055 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue) 4056} 4057 4058@threadSafety("app") 4059cmd void vkCmdBindIndexBuffer( 4060 VkCommandBuffer commandBuffer, 4061 VkBuffer buffer, 4062 VkDeviceSize offset, 4063 VkIndexType indexType) { 4064 commandBufferObject := GetCommandBuffer(commandBuffer) 4065 bufferObject := GetBuffer(buffer) 4066 assert(commandBufferObject.device == bufferObject.device) 4067 4068 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory) 4069 4070 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4071} 4072 4073@threadSafety("app") 4074cmd void vkCmdBindVertexBuffers( 4075 VkCommandBuffer commandBuffer, 4076 u32 startBinding, 4077 u32 bindingCount, 4078 const VkBuffer* pBuffers, 4079 const VkDeviceSize* pOffsets) { 4080 commandBufferObject := GetCommandBuffer(commandBuffer) 4081 4082 // TODO: check if not [startBinding:startBinding+bindingCount] 4083 buffers := pBuffers[0:bindingCount] 4084 offsets := pOffsets[0:bindingCount] 4085 for i in (0 .. bindingCount) { 4086 buffer := buffers[i] 4087 offset := offsets[i] 4088 bufferObject := GetBuffer(buffer) 4089 assert(commandBufferObject.device == bufferObject.device) 4090 4091 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory) 4092 } 4093 4094 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4095} 4096 4097@threadSafety("app") 4098cmd void vkCmdDraw( 4099 VkCommandBuffer commandBuffer, 4100 u32 vertexCount, 4101 u32 instanceCount, 4102 u32 firstVertex, 4103 u32 firstInstance) { 4104 commandBufferObject := GetCommandBuffer(commandBuffer) 4105 4106 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4107} 4108 4109@threadSafety("app") 4110cmd void vkCmdDrawIndexed( 4111 VkCommandBuffer commandBuffer, 4112 u32 indexCount, 4113 u32 instanceCount, 4114 u32 firstIndex, 4115 s32 vertexOffset, 4116 u32 firstInstance) { 4117 commandBufferObject := GetCommandBuffer(commandBuffer) 4118 4119 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4120} 4121 4122@threadSafety("app") 4123cmd void vkCmdDrawIndirect( 4124 VkCommandBuffer commandBuffer, 4125 VkBuffer buffer, 4126 VkDeviceSize offset, 4127 u32 drawCount, 4128 u32 stride) { 4129 commandBufferObject := GetCommandBuffer(commandBuffer) 4130 bufferObject := GetBuffer(buffer) 4131 assert(commandBufferObject.device == bufferObject.device) 4132 4133 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory) 4134 4135 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4136} 4137 4138@threadSafety("app") 4139cmd void vkCmdDrawIndexedIndirect( 4140 VkCommandBuffer commandBuffer, 4141 VkBuffer buffer, 4142 VkDeviceSize offset, 4143 u32 drawCount, 4144 u32 stride) { 4145 commandBufferObject := GetCommandBuffer(commandBuffer) 4146 bufferObject := GetBuffer(buffer) 4147 assert(commandBufferObject.device == bufferObject.device) 4148 4149 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory) 4150 4151 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4152} 4153 4154@threadSafety("app") 4155cmd void vkCmdDispatch( 4156 VkCommandBuffer commandBuffer, 4157 u32 x, 4158 u32 y, 4159 u32 z) { 4160 commandBufferObject := GetCommandBuffer(commandBuffer) 4161 4162 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT) 4163} 4164 4165@threadSafety("app") 4166cmd void vkCmdDispatchIndirect( 4167 VkCommandBuffer commandBuffer, 4168 VkBuffer buffer, 4169 VkDeviceSize offset) { 4170 commandBufferObject := GetCommandBuffer(commandBuffer) 4171 bufferObject := GetBuffer(buffer) 4172 assert(commandBufferObject.device == bufferObject.device) 4173 4174 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory) 4175 4176 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT) 4177} 4178 4179@threadSafety("app") 4180cmd void vkCmdCopyBuffer( 4181 VkCommandBuffer commandBuffer, 4182 VkBuffer srcBuffer, 4183 VkBuffer dstBuffer, 4184 u32 regionCount, 4185 const VkBufferCopy* pRegions) { 4186 commandBufferObject := GetCommandBuffer(commandBuffer) 4187 srcBufferObject := GetBuffer(srcBuffer) 4188 dstBufferObject := GetBuffer(dstBuffer) 4189 assert(commandBufferObject.device == srcBufferObject.device) 4190 assert(commandBufferObject.device == dstBufferObject.device) 4191 4192 regions := pRegions[0:regionCount] 4193 for i in (0 .. regionCount) { 4194 region := regions[i] 4195 } 4196 4197 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory) 4198 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory) 4199 4200 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT) 4201} 4202 4203@threadSafety("app") 4204cmd void vkCmdCopyImage( 4205 VkCommandBuffer commandBuffer, 4206 VkImage srcImage, 4207 VkImageLayout srcImageLayout, 4208 VkImage dstImage, 4209 VkImageLayout dstImageLayout, 4210 u32 regionCount, 4211 const VkImageCopy* pRegions) { 4212 commandBufferObject := GetCommandBuffer(commandBuffer) 4213 srcImageObject := GetImage(srcImage) 4214 dstImageObject := GetImage(dstImage) 4215 assert(commandBufferObject.device == srcImageObject.device) 4216 assert(commandBufferObject.device == dstImageObject.device) 4217 4218 regions := pRegions[0:regionCount] 4219 for i in (0 .. regionCount) { 4220 region := regions[i] 4221 } 4222 4223 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory) 4224 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory) 4225 4226 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT) 4227} 4228 4229@threadSafety("app") 4230cmd void vkCmdBlitImage( 4231 VkCommandBuffer commandBuffer, 4232 VkImage srcImage, 4233 VkImageLayout srcImageLayout, 4234 VkImage dstImage, 4235 VkImageLayout dstImageLayout, 4236 u32 regionCount, 4237 const VkImageBlit* pRegions, 4238 VkFilter filter) { 4239 commandBufferObject := GetCommandBuffer(commandBuffer) 4240 srcImageObject := GetImage(srcImage) 4241 dstImageObject := GetImage(dstImage) 4242 assert(commandBufferObject.device == srcImageObject.device) 4243 assert(commandBufferObject.device == dstImageObject.device) 4244 4245 regions := pRegions[0:regionCount] 4246 for i in (0 .. regionCount) { 4247 region := regions[i] 4248 } 4249 4250 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory) 4251 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory) 4252 4253 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4254} 4255 4256@threadSafety("app") 4257cmd void vkCmdCopyBufferToImage( 4258 VkCommandBuffer commandBuffer, 4259 VkBuffer srcBuffer, 4260 VkImage dstImage, 4261 VkImageLayout dstImageLayout, 4262 u32 regionCount, 4263 const VkBufferImageCopy* pRegions) { 4264 commandBufferObject := GetCommandBuffer(commandBuffer) 4265 srcBufferObject := GetBuffer(srcBuffer) 4266 dstImageObject := GetImage(dstImage) 4267 assert(commandBufferObject.device == srcBufferObject.device) 4268 assert(commandBufferObject.device == dstImageObject.device) 4269 4270 regions := pRegions[0:regionCount] 4271 for i in (0 .. regionCount) { 4272 region := regions[i] 4273 } 4274 4275 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory) 4276 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory) 4277 4278 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT) 4279} 4280 4281@threadSafety("app") 4282cmd void vkCmdCopyImageToBuffer( 4283 VkCommandBuffer commandBuffer, 4284 VkImage srcImage, 4285 VkImageLayout srcImageLayout, 4286 VkBuffer dstBuffer, 4287 u32 regionCount, 4288 const VkBufferImageCopy* pRegions) { 4289 commandBufferObject := GetCommandBuffer(commandBuffer) 4290 srcImageObject := GetImage(srcImage) 4291 dstBufferObject := GetBuffer(dstBuffer) 4292 assert(commandBufferObject.device == srcImageObject.device) 4293 assert(commandBufferObject.device == dstBufferObject.device) 4294 4295 regions := pRegions[0:regionCount] 4296 for i in (0 .. regionCount) { 4297 region := regions[i] 4298 } 4299 4300 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory) 4301 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory) 4302 4303 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT) 4304} 4305 4306@threadSafety("app") 4307cmd void vkCmdUpdateBuffer( 4308 VkCommandBuffer commandBuffer, 4309 VkBuffer dstBuffer, 4310 VkDeviceSize dstOffset, 4311 VkDeviceSize dataSize, 4312 const u32* pData) { 4313 commandBufferObject := GetCommandBuffer(commandBuffer) 4314 dstBufferObject := GetBuffer(dstBuffer) 4315 assert(commandBufferObject.device == dstBufferObject.device) 4316 4317 data := pData[0:dataSize] 4318 4319 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory) 4320 4321 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT) 4322} 4323 4324@threadSafety("app") 4325cmd void vkCmdFillBuffer( 4326 VkCommandBuffer commandBuffer, 4327 VkBuffer dstBuffer, 4328 VkDeviceSize dstOffset, 4329 VkDeviceSize size, 4330 u32 data) { 4331 commandBufferObject := GetCommandBuffer(commandBuffer) 4332 dstBufferObject := GetBuffer(dstBuffer) 4333 assert(commandBufferObject.device == dstBufferObject.device) 4334 4335 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_DMA_BIT) 4336} 4337 4338@threadSafety("app") 4339cmd void vkCmdClearColorImage( 4340 VkCommandBuffer commandBuffer, 4341 VkImage image, 4342 VkImageLayout imageLayout, 4343 const VkClearColorValue* pColor, 4344 u32 rangeCount, 4345 const VkImageSubresourceRange* pRanges) { 4346 commandBufferObject := GetCommandBuffer(commandBuffer) 4347 imageObject := GetImage(image) 4348 assert(commandBufferObject.device == imageObject.device) 4349 4350 ranges := pRanges[0:rangeCount] 4351 for i in (0 .. rangeCount) { 4352 range := ranges[i] 4353 } 4354 4355 bindCommandBuffer(commandBuffer, image, imageObject.memory) 4356 4357 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4358} 4359 4360@threadSafety("app") 4361cmd void vkCmdClearDepthStencilImage( 4362 VkCommandBuffer commandBuffer, 4363 VkImage image, 4364 VkImageLayout imageLayout, 4365 const VkClearDepthStencilValue* pDepthStencil, 4366 u32 rangeCount, 4367 const VkImageSubresourceRange* pRanges) { 4368 commandBufferObject := GetCommandBuffer(commandBuffer) 4369 imageObject := GetImage(image) 4370 assert(commandBufferObject.device == imageObject.device) 4371 4372 ranges := pRanges[0:rangeCount] 4373 for i in (0 .. rangeCount) { 4374 range := ranges[i] 4375 } 4376 4377 bindCommandBuffer(commandBuffer, image, imageObject.memory) 4378 4379 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4380} 4381 4382@threadSafety("app") 4383cmd void vkCmdClearAttachments( 4384 VkCommandBuffer commandBuffer, 4385 u32 attachmentCount, 4386 const VkClearAttachment* pAttachments, 4387 u32 rectCount, 4388 const VkClearRect* pRects) { 4389 commandBufferObject := GetCommandBuffer(commandBuffer) 4390 4391 rects := pRects[0:rectCount] 4392 for i in (0 .. rectCount) { 4393 rect := rects[i] 4394 } 4395 4396 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4397} 4398 4399@threadSafety("app") 4400cmd void vkCmdResolveImage( 4401 VkCommandBuffer commandBuffer, 4402 VkImage srcImage, 4403 VkImageLayout srcImageLayout, 4404 VkImage dstImage, 4405 VkImageLayout dstImageLayout, 4406 u32 regionCount, 4407 const VkImageResolve* pRegions) { 4408 commandBufferObject := GetCommandBuffer(commandBuffer) 4409 srcImageObject := GetImage(srcImage) 4410 dstImageObject := GetImage(dstImage) 4411 assert(commandBufferObject.device == srcImageObject.device) 4412 assert(commandBufferObject.device == dstImageObject.device) 4413 4414 regions := pRegions[0:regionCount] 4415 for i in (0 .. regionCount) { 4416 region := regions[i] 4417 } 4418 4419 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory) 4420 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory) 4421 4422 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4423} 4424 4425@threadSafety("app") 4426cmd void vkCmdSetEvent( 4427 VkCommandBuffer commandBuffer, 4428 VkEvent event, 4429 VkPipelineStageFlags stageMask) { 4430 commandBufferObject := GetCommandBuffer(commandBuffer) 4431 eventObject := GetEvent(event) 4432 assert(commandBufferObject.device == eventObject.device) 4433} 4434 4435@threadSafety("app") 4436cmd void vkCmdResetEvent( 4437 VkCommandBuffer commandBuffer, 4438 VkEvent event, 4439 VkPipelineStageFlags stageMask) { 4440 commandBufferObject := GetCommandBuffer(commandBuffer) 4441 eventObject := GetEvent(event) 4442 assert(commandBufferObject.device == eventObject.device) 4443} 4444 4445@threadSafety("app") 4446cmd void vkCmdWaitEvents( 4447 VkCommandBuffer commandBuffer, 4448 u32 eventCount, 4449 const VkEvent* pEvents, 4450 VkPipelineStageFlags srcStageMask, 4451 VkPipelineStageFlags dstStageMask, 4452 u32 memoryBarrierCount, 4453 const void* const* ppMemoryBarriers) { 4454 commandBufferObject := GetCommandBuffer(commandBuffer) 4455 4456 events := pEvents[0:eventCount] 4457 for i in (0 .. eventCount) { 4458 event := events[i] 4459 eventObject := GetEvent(event) 4460 assert(commandBufferObject.device == eventObject.device) 4461 } 4462 4463 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount] 4464 for i in (0 .. memoryBarrierCount) { 4465 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType { 4466 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: { 4467 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0] 4468 } 4469 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: { 4470 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0] 4471 imageObject := GetImage(imageMemoryBarrier.image) 4472 assert(imageObject.device == commandBufferObject.device) 4473 } 4474 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: { 4475 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0] 4476 bufferObject := GetBuffer(bufferMemoryBarrier.buffer) 4477 assert(bufferObject.device == commandBufferObject.device) 4478 } 4479 } 4480 } 4481} 4482 4483@threadSafety("app") 4484cmd void vkCmdPipelineBarrier( 4485 VkCommandBuffer commandBuffer, 4486 VkPipelineStageFlags srcStageMask, 4487 VkPipelineStageFlags dstStageMask, 4488 VkDependencyFlags dependencyFlags, 4489 u32 memoryBarrierCount, 4490 const void* const* ppMemoryBarriers) { 4491 commandBufferObject := GetCommandBuffer(commandBuffer) 4492 4493 pMemoryBarriers := ppMemoryBarriers[0:memoryBarrierCount] 4494 for i in (0 .. memoryBarrierCount) { 4495 switch as!VkMemoryBarrier const*(pMemoryBarriers[i])[0].sType { 4496 case VK_STRUCTURE_TYPE_MEMORY_BARRIER: { 4497 memoryBarrier := as!VkMemoryBarrier const*(pMemoryBarriers[i])[0] 4498 } 4499 case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: { 4500 imageMemoryBarrier := as!VkImageMemoryBarrier const*(pMemoryBarriers[i])[0] 4501 imageObject := GetImage(imageMemoryBarrier.image) 4502 assert(imageObject.device == commandBufferObject.device) 4503 } 4504 case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: { 4505 bufferMemoryBarrier := as!VkBufferMemoryBarrier const*(pMemoryBarriers[i])[0] 4506 bufferObject := GetBuffer(bufferMemoryBarrier.buffer) 4507 assert(bufferObject.device == commandBufferObject.device) 4508 } 4509 } 4510 } 4511} 4512 4513@threadSafety("app") 4514cmd void vkCmdBeginQuery( 4515 VkCommandBuffer commandBuffer, 4516 VkQueryPool queryPool, 4517 u32 slot, 4518 VkQueryControlFlags flags) { 4519 commandBufferObject := GetCommandBuffer(commandBuffer) 4520 queryPoolObject := GetQueryPool(queryPool) 4521 assert(commandBufferObject.device == queryPoolObject.device) 4522} 4523 4524@threadSafety("app") 4525cmd void vkCmdEndQuery( 4526 VkCommandBuffer commandBuffer, 4527 VkQueryPool queryPool, 4528 u32 slot) { 4529 commandBufferObject := GetCommandBuffer(commandBuffer) 4530 queryPoolObject := GetQueryPool(queryPool) 4531 assert(commandBufferObject.device == queryPoolObject.device) 4532} 4533 4534@threadSafety("app") 4535cmd void vkCmdResetQueryPool( 4536 VkCommandBuffer commandBuffer, 4537 VkQueryPool queryPool, 4538 u32 startQuery, 4539 u32 queryCount) { 4540 commandBufferObject := GetCommandBuffer(commandBuffer) 4541 queryPoolObject := GetQueryPool(queryPool) 4542 assert(commandBufferObject.device == queryPoolObject.device) 4543} 4544 4545@threadSafety("app") 4546cmd void vkCmdWriteTimestamp( 4547 VkCommandBuffer commandBuffer, 4548 VkPipelineStageFlagBits pipelineStage, 4549 VkQueryPool queryPool, 4550 u32 slot) { 4551 commandBufferObject := GetCommandBuffer(commandBuffer) 4552 queryPoolObject := GetQueryPool(queryPool) 4553 assert(commandBufferObject.device == queryPoolObject.device) 4554} 4555 4556@threadSafety("app") 4557cmd void vkCmdCopyQueryPoolResults( 4558 VkCommandBuffer commandBuffer, 4559 VkQueryPool queryPool, 4560 u32 startQuery, 4561 u32 queryCount, 4562 VkBuffer dstBuffer, 4563 VkDeviceSize dstOffset, 4564 VkDeviceSize stride, 4565 VkQueryResultFlags flags) { 4566 commandBufferObject := GetCommandBuffer(commandBuffer) 4567 queryPoolObject := GetQueryPool(queryPool) 4568 dstBufferObject := GetBuffer(dstBuffer) 4569 assert(commandBufferObject.device == queryPoolObject.device) 4570 assert(commandBufferObject.device == dstBufferObject.device) 4571} 4572 4573cmd void vkCmdPushConstants( 4574 VkCommandBuffer commandBuffer, 4575 VkPipelineLayout layout, 4576 VkShaderStageFlags stageFlags, 4577 u32 offset, 4578 u32 size, 4579 const void* values) { 4580 commandBufferObject := GetCommandBuffer(commandBuffer) 4581 layoutObject := GetPipelineLayout(layout) 4582 assert(commandBufferObject.device == layoutObject.device) 4583} 4584 4585@threadSafety("app") 4586cmd void vkCmdBeginRenderPass( 4587 VkCommandBuffer commandBuffer, 4588 const VkRenderPassBeginInfo* pRenderPassBegin, 4589 VkRenderPassContents contents) { 4590 commandBufferObject := GetCommandBuffer(commandBuffer) 4591 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass) 4592 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer) 4593 assert(commandBufferObject.device == renderPassObject.device) 4594 assert(commandBufferObject.device == framebufferObject.device) 4595 4596 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4597} 4598 4599cmd void vkCmdNextSubpass( 4600 VkCommandBuffer commandBuffer, 4601 VkRenderPassContents contents) { 4602 commandBufferObject := GetCommandBuffer(commandBuffer) 4603} 4604 4605@threadSafety("app") 4606cmd void vkCmdEndRenderPass( 4607 VkCommandBuffer commandBuffer) { 4608 commandBufferObject := GetCommandBuffer(commandBuffer) 4609 4610 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4611} 4612 4613cmd void vkCmdExecuteCommands( 4614 VkCommandBuffer commandBuffer, 4615 u32 commandBuffersCount, 4616 const VkCommandBuffer* pCommandBuffers) { 4617 commandBufferObject := GetCommandBuffer(commandBuffer) 4618 4619 commandBuffers := pCommandBuffers[0:commandBuffersCount] 4620 for i in (0 .. commandBuffersCount) { 4621 secondaryCommandBuffer := commandBuffers[i] 4622 secondaryCommandBufferObject := GetCommandBuffer(secondaryCommandBuffer) 4623 assert(commandBufferObject.device == secondaryCommandBufferObject.device) 4624 } 4625} 4626 4627@extension("VK_EXT_KHR_surface") 4628cmd void vkDestroySurfaceKHR( 4629 VkInstance instance, 4630 VkSurfaceKHR surface) { 4631 instanceObject := GetInstance(instance) 4632 surfaceObject := GetSurface(surface) 4633 assert(surfaceObject.instance == instance) 4634 4635 State.Surfaces[surface] = null 4636} 4637 4638@extension("VK_EXT_KHR_surface") 4639cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR( 4640 VkPhysicalDevice physicalDevice, 4641 u32 queueFamilyIndex, 4642 VkSurfaceKHR surface, 4643 VkBool32* pSupported) { 4644 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4645 4646 return ? 4647} 4648 4649@extension("VK_EXT_KHR_surface") 4650cmd VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR( 4651 VkPhysicalDevice physicalDevice, 4652 VkSurfaceKHR surface, 4653 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) { 4654 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4655 4656 surfaceCapabilities := ? 4657 pSurfaceCapabilities[0] = surfaceCapabilities 4658 4659 return ? 4660} 4661 4662@extension("VK_EXT_KHR_surface") 4663cmd VkResult vkGetPhysicalDeviceSurfaceFormatsKHR( 4664 VkPhysicalDevice physicalDevice, 4665 VkSurfaceKHR surface, 4666 u32* pSurfaceFormatCount, 4667 VkSurfaceFormatKHR* pSurfaceFormats) { 4668 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4669 4670 count := as!u32(?) 4671 pSurfaceFormatCount[0] = count 4672 surfaceFormats := pSurfaceFormats[0:count] 4673 4674 for i in (0 .. count) { 4675 surfaceFormat := ? 4676 surfaceFormats[i] = surfaceFormat 4677 } 4678 4679 return ? 4680} 4681 4682@extension("VK_EXT_KHR_surface") 4683cmd VkResult vkGetPhysicalDeviceSurfacePresentModesKHR( 4684 VkPhysicalDevice physicalDevice, 4685 VkSurfaceKHR surface, 4686 u32* pPresentModeCount, 4687 VkPresentModeKHR* pPresentModes) { 4688 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4689 4690 count := as!u32(?) 4691 pPresentModeCount[0] = count 4692 presentModes := pPresentModes[0:count] 4693 4694 for i in (0 .. count) { 4695 presentMode := ? 4696 presentModes[i] = presentMode 4697 } 4698 4699 return ? 4700} 4701 4702@extension("VK_EXT_KHR_swapchain") 4703cmd VkResult vkCreateSwapchainKHR( 4704 VkDevice device, 4705 const VkSwapchainCreateInfoKHR* pCreateInfo, 4706 VkSwapchainKHR* pSwapchain) { 4707 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR) 4708 deviceObject := GetDevice(device) 4709 4710 swapchain := ? 4711 pSwapchain[0] = swapchain 4712 State.Swapchains[swapchain] = new!SwapchainObject(device: device) 4713 4714 return ? 4715} 4716 4717@extension("VK_EXT_KHR_swapchain") 4718cmd void vkDestroySwapchainKHR( 4719 VkDevice device, 4720 VkSwapchainKHR swapchain) { 4721 deviceObject := GetDevice(device) 4722 swapchainObject := GetSwapchain(swapchain) 4723 assert(swapchainObject.device == device) 4724 4725 State.Swapchains[swapchain] = null 4726} 4727 4728@extension("VK_EXT_KHR_swapchain") 4729cmd VkResult vkGetSwapchainImagesKHR( 4730 VkDevice device, 4731 VkSwapchainKHR swapchain, 4732 u32* pSwapchainImageCount, 4733 VkImage* pSwapchainImages) { 4734 deviceObject := GetDevice(device) 4735 4736 count := as!u32(?) 4737 pSwapchainImageCount[0] = count 4738 swapchainImages := pSwapchainImages[0:count] 4739 4740 for i in (0 .. count) { 4741 swapchainImage := ? 4742 swapchainImages[i] = swapchainImage 4743 State.Images[swapchainImage] = new!ImageObject(device: device) 4744 } 4745 4746 return ? 4747} 4748 4749@extension("VK_EXT_KHR_swapchain") 4750cmd VkResult vkAcquireNextImageKHR( 4751 VkDevice device, 4752 VkSwapchainKHR swapchain, 4753 u64 timeout, 4754 VkSemaphore semaphore, 4755 VkFence fence, 4756 u32* pImageIndex) { 4757 deviceObject := GetDevice(device) 4758 swapchainObject := GetSwapchain(swapchain) 4759 4760 imageIndex := ? 4761 pImageIndex[0] = imageIndex 4762 4763 return ? 4764} 4765 4766@extension("VK_EXT_KHR_swapchain") 4767cmd VkResult vkQueuePresentKHR( 4768 VkQueue queue, 4769 VkPresentInfoKHR* pPresentInfo) { 4770 queueObject := GetQueue(queue) 4771 4772 presentInfo := ? 4773 pPresentInfo[0] = presentInfo 4774 4775 return ? 4776} 4777 4778@extension("VK_EXT_KHR_display") 4779cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR( 4780 VkPhysicalDevice physicalDevice, 4781 u32* pPropertyCount, 4782 VkDisplayPropertiesKHR* pProperties) { 4783 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4784 return ? 4785} 4786 4787@extension("VK_EXT_KHR_display") 4788cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR( 4789 VkPhysicalDevice physicalDevice, 4790 u32* pPropertyCount, 4791 VkDisplayPlanePropertiesKHR* pProperties) { 4792 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4793 return ? 4794} 4795 4796@extension("VK_EXT_KHR_display") 4797cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR( 4798 VkPhysicalDevice physicalDevice, 4799 u32* pPropertyCount, 4800 VkDisplayKHR* pProperties) { 4801 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4802 return ? 4803} 4804 4805@extension("VK_EXT_KHR_display") 4806cmd VkResult vkGetDisplayModePropertiesKHR( 4807 VkPhysicalDevice physicalDevice, 4808 VkDisplayKHR display, 4809 u32* pPropertyCount, 4810 VkDisplayModePropertiesKHR* pProperties) { 4811 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4812 return ? 4813} 4814 4815@extension("VK_EXT_KHR_display") 4816cmd VkResult vkCreateDisplayModeKHR( 4817 VkPhysicalDevice physicalDevice, 4818 VkDisplayKHR display, 4819 const VkDisplayModeCreateInfoKHR* pCreateInfo, 4820 VkDisplayModeKHR* pMode) { 4821 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4822 return ? 4823} 4824 4825@extension("VK_EXT_KHR_display") 4826cmd VkResult vkGetDisplayPlaneCapabilitiesKHR( 4827 VkPhysicalDevice physicalDevice, 4828 VkDisplayModeCreateInfoKHR mode, 4829 u32 planeIndex, 4830 VkDisplayPlaneCapabilitiesKHR* pCapabilities) { 4831 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4832 return ? 4833} 4834 4835@extension("VK_EXT_KHR_display") 4836cmd VkResult vkCreateDisplayPlaneSurfaceKHR( 4837 VkInstance instance, 4838 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, 4839 VkSurfaceKHR* pSurface) { 4840 return ? 4841} 4842 4843@extension("VK_EXT_KHR_xlib_surface") 4844cmd VkResult vkCreateXlibSurfaceKHR( 4845 VkInstance instance, 4846 platform.Display* dpy, 4847 platform.Window window, 4848 VkSurfaceKHR* pSurface) { 4849 instanceObject := GetInstance(instance) 4850 return ? 4851} 4852 4853@extension("VK_EXT_KHR_xlib_surface") 4854cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR( 4855 VkPhysicalDevice physicalDevice, 4856 u32 queueFamilyIndex, 4857 platform.Display* dpy, 4858 platform.VisualID visualId) { 4859 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4860 return ? 4861} 4862 4863@extension("VK_EXT_KHR_xcb_surface") 4864cmd VkResult vkCreateXCBSurfaceKHR( 4865 VkInstance instance, 4866 platform.xcb_connection_t* connection, 4867 platform.xcb_window_t window, 4868 VkSurfaceKHR* pSurface) { 4869 instanceObject := GetInstance(instance) 4870 return ? 4871} 4872 4873@extension("VK_EXT_KHR_xlib_surface") 4874cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR( 4875 VkPhysicalDevice physicalDevice, 4876 u32 queueFamilyIndex, 4877 platform.xcb_connection_t* connection, 4878 platform.xcb_visualid_t visual_id) { 4879 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4880 return ? 4881} 4882 4883@extension("VK_EXT_KHR_wayland_surface") 4884cmd VkResult vkCreateWaylandSurfaceKHR( 4885 VkInstance instance, 4886 platform.wl_display* display, 4887 platform.wl_surface* surface, 4888 VkSurfaceKHR* pSurface) { 4889 instanceObject := GetInstance(instance) 4890 return ? 4891} 4892 4893@extension("VK_EXT_KHR_wayland_surface") 4894cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR( 4895 VkPhysicalDevice physicalDevice, 4896 u32 queueFamilyIndex, 4897 platform.wl_display* display) { 4898 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4899 return ? 4900} 4901 4902@extension("VK_EXT_KHR_mir_surface") 4903cmd VkResult vkCreateMirSurfaceKHR( 4904 VkInstance instance, 4905 platform.MirConnection* connection, 4906 platform.MirSurface* mirSurface, 4907 VkSurfaceKHR* pSurface) { 4908 instanceObject := GetInstance(instance) 4909 return ? 4910} 4911 4912@extension("VK_EXT_KHR_mir_surface") 4913cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR( 4914 VkPhysicalDevice physicalDevice, 4915 u32 queueFamilyIndex, 4916 platform.MirConnection* connection) { 4917 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4918 return ? 4919} 4920 4921@extension("VK_EXT_KHR_android_surface") 4922cmd VkResult vkCreateAndroidSurfaceKHR( 4923 VkInstance instance, 4924 platform.ANativeWindow* window 4925 VkSurfaceKHR* pSurface) { 4926 instanceObject := GetInstance(instance) 4927 return ? 4928} 4929 4930@extension("VK_EXT_KHR_win32_surface") 4931cmd VkResult vkCreateWin32SurfaceKHR( 4932 VkInstance instance, 4933 platform.HINSTANCE hinstance, 4934 platform.HWND hwnd, 4935 VkSurfaceKHR* pSurface) { 4936 instanceObject := GetInstance(instance) 4937 return ? 4938} 4939 4940@extension("VK_EXT_KHR_win32_surface") 4941cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR( 4942 VkPhysicalDevice physicalDevice, 4943 u32 queueFamilyIndex) { 4944 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4945 return ? 4946} 4947 4948 4949//////////////// 4950// Validation // 4951//////////////// 4952 4953extern void validate(string layerName, bool condition, string message) 4954 4955 4956///////////////////////////// 4957// Internal State Tracking // 4958///////////////////////////// 4959 4960StateObject State 4961 4962@internal class StateObject { 4963 // Dispatchable objects. 4964 map!(VkInstance, ref!InstanceObject) Instances 4965 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices 4966 map!(VkDevice, ref!DeviceObject) Devices 4967 map!(VkQueue, ref!QueueObject) Queues 4968 map!(VkCommandBuffer, ref!CommandBufferObject) CommandBuffers 4969 4970 // Non-dispatchable objects. 4971 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories 4972 map!(VkBuffer, ref!BufferObject) Buffers 4973 map!(VkBufferView, ref!BufferViewObject) BufferViews 4974 map!(VkImage, ref!ImageObject) Images 4975 map!(VkImageView, ref!ImageViewObject) ImageViews 4976 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules 4977 map!(VkShader, ref!ShaderObject) Shaders 4978 map!(VkPipeline, ref!PipelineObject) Pipelines 4979 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts 4980 map!(VkSampler, ref!SamplerObject) Samplers 4981 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets 4982 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts 4983 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools 4984 map!(VkFence, ref!FenceObject) Fences 4985 map!(VkSemaphore, ref!SemaphoreObject) Semaphores 4986 map!(VkEvent, ref!EventObject) Events 4987 map!(VkQueryPool, ref!QueryPoolObject) QueryPools 4988 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers 4989 map!(VkRenderPass, ref!RenderPassObject) RenderPasses 4990 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches 4991 map!(VkCommandPool, ref!CommandPoolObject) CommandPools 4992 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces 4993 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains 4994} 4995 4996@internal class InstanceObject { 4997} 4998 4999@internal class PhysicalDeviceObject { 5000 VkInstance instance 5001} 5002 5003@internal class DeviceObject { 5004 VkPhysicalDevice physicalDevice 5005} 5006 5007@internal class QueueObject { 5008 VkDevice device 5009 VkQueueFlags flags 5010} 5011 5012@internal class CommandBufferObject { 5013 VkDevice device 5014 map!(u64, VkDeviceMemory) boundObjects 5015 VkQueueFlags queueFlags 5016} 5017 5018@internal class DeviceMemoryObject { 5019 VkDevice device 5020 VkDeviceSize allocationSize 5021 map!(u64, VkDeviceSize) boundObjects 5022 map!(VkCommandBuffer, VkCommandBuffer) boundCommandBuffers 5023} 5024 5025@internal class BufferObject { 5026 VkDevice device 5027 VkDeviceMemory memory 5028 VkDeviceSize memoryOffset 5029} 5030 5031@internal class BufferViewObject { 5032 VkDevice device 5033 VkBuffer buffer 5034} 5035 5036@internal class ImageObject { 5037 VkDevice device 5038 VkDeviceMemory memory 5039 VkDeviceSize memoryOffset 5040} 5041 5042@internal class ImageViewObject { 5043 VkDevice device 5044 VkImage image 5045} 5046 5047@internal class ShaderObject { 5048 VkDevice device 5049} 5050 5051@internal class ShaderModuleObject { 5052 VkDevice device 5053} 5054 5055@internal class PipelineObject { 5056 VkDevice device 5057} 5058 5059@internal class PipelineLayoutObject { 5060 VkDevice device 5061} 5062 5063@internal class SamplerObject { 5064 VkDevice device 5065} 5066 5067@internal class DescriptorSetObject { 5068 VkDevice device 5069} 5070 5071@internal class DescriptorSetLayoutObject { 5072 VkDevice device 5073} 5074 5075@internal class DescriptorPoolObject { 5076 VkDevice device 5077} 5078 5079@internal class FenceObject { 5080 VkDevice device 5081 bool signaled 5082} 5083 5084@internal class SemaphoreObject { 5085 VkDevice device 5086} 5087 5088@internal class EventObject { 5089 VkDevice device 5090} 5091 5092@internal class QueryPoolObject { 5093 VkDevice device 5094} 5095 5096@internal class FramebufferObject { 5097 VkDevice device 5098} 5099 5100@internal class RenderPassObject { 5101 VkDevice device 5102} 5103 5104@internal class PipelineCacheObject { 5105 VkDevice device 5106} 5107 5108@internal class CommandPoolObject { 5109 VkDevice device 5110} 5111 5112@internal class SurfaceObject { 5113 VkInstance instance 5114} 5115 5116@internal class SwapchainObject { 5117 VkDevice device 5118} 5119 5120macro ref!InstanceObject GetInstance(VkInstance instance) { 5121 assert(instance in State.Instances) 5122 return State.Instances[instance] 5123} 5124 5125macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) { 5126 assert(physicalDevice in State.PhysicalDevices) 5127 return State.PhysicalDevices[physicalDevice] 5128} 5129 5130macro ref!DeviceObject GetDevice(VkDevice device) { 5131 assert(device in State.Devices) 5132 return State.Devices[device] 5133} 5134 5135macro ref!QueueObject GetQueue(VkQueue queue) { 5136 assert(queue in State.Queues) 5137 return State.Queues[queue] 5138} 5139 5140macro ref!CommandBufferObject GetCommandBuffer(VkCommandBuffer commandBuffer) { 5141 assert(commandBuffer in State.CommandBuffers) 5142 return State.CommandBuffers[commandBuffer] 5143} 5144 5145macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory memory) { 5146 assert(memory in State.DeviceMemories) 5147 return State.DeviceMemories[memory] 5148} 5149 5150macro ref!BufferObject GetBuffer(VkBuffer buffer) { 5151 assert(buffer in State.Buffers) 5152 return State.Buffers[buffer] 5153} 5154 5155macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) { 5156 assert(bufferView in State.BufferViews) 5157 return State.BufferViews[bufferView] 5158} 5159 5160macro ref!ImageObject GetImage(VkImage image) { 5161 assert(image in State.Images) 5162 return State.Images[image] 5163} 5164 5165macro ref!ImageViewObject GetImageView(VkImageView imageView) { 5166 assert(imageView in State.ImageViews) 5167 return State.ImageViews[imageView] 5168} 5169 5170macro ref!ShaderObject GetShader(VkShader shader) { 5171 assert(shader in State.Shaders) 5172 return State.Shaders[shader] 5173} 5174 5175macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) { 5176 assert(shaderModule in State.ShaderModules) 5177 return State.ShaderModules[shaderModule] 5178} 5179 5180macro ref!PipelineObject GetPipeline(VkPipeline pipeline) { 5181 assert(pipeline in State.Pipelines) 5182 return State.Pipelines[pipeline] 5183} 5184 5185macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) { 5186 assert(pipelineLayout in State.PipelineLayouts) 5187 return State.PipelineLayouts[pipelineLayout] 5188} 5189 5190macro ref!SamplerObject GetSampler(VkSampler sampler) { 5191 assert(sampler in State.Samplers) 5192 return State.Samplers[sampler] 5193} 5194 5195macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) { 5196 assert(descriptorSet in State.DescriptorSets) 5197 return State.DescriptorSets[descriptorSet] 5198} 5199 5200macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) { 5201 assert(descriptorSetLayout in State.DescriptorSetLayouts) 5202 return State.DescriptorSetLayouts[descriptorSetLayout] 5203} 5204 5205macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) { 5206 assert(descriptorPool in State.DescriptorPools) 5207 return State.DescriptorPools[descriptorPool] 5208} 5209 5210macro ref!FenceObject GetFence(VkFence fence) { 5211 assert(fence in State.Fences) 5212 return State.Fences[fence] 5213} 5214 5215macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) { 5216 assert(semaphore in State.Semaphores) 5217 return State.Semaphores[semaphore] 5218} 5219 5220macro ref!EventObject GetEvent(VkEvent event) { 5221 assert(event in State.Events) 5222 return State.Events[event] 5223} 5224 5225macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) { 5226 assert(queryPool in State.QueryPools) 5227 return State.QueryPools[queryPool] 5228} 5229 5230macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) { 5231 assert(framebuffer in State.Framebuffers) 5232 return State.Framebuffers[framebuffer] 5233} 5234 5235macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) { 5236 assert(renderPass in State.RenderPasses) 5237 return State.RenderPasses[renderPass] 5238} 5239 5240macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) { 5241 assert(pipelineCache in State.PipelineCaches) 5242 return State.PipelineCaches[pipelineCache] 5243} 5244 5245macro ref!CommandPoolObject GetCommandPool(VkCommandPool commandPool) { 5246 assert(commandPool in State.CommandPools) 5247 return State.CommandPools[commandPool] 5248} 5249 5250macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) { 5251 assert(surface in State.Surfaces) 5252 return State.Surfaces[surface] 5253} 5254 5255macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) { 5256 assert(swapchain in State.Swapchains) 5257 return State.Swapchains[swapchain] 5258} 5259 5260macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) { 5261 return as!VkQueueFlags(as!u32(flags) | as!u32(bit)) 5262} 5263