vulkan.api revision b262ddcfaba592ca153beddb120aeb68b64e6e63
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 1 30define VERSION_MINOR 0 31define VERSION_PATCH 3 32 33// API limits 34define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256 35define VK_UUID_SIZE 16 36define VK_MAX_EXTENSION_NAME_SIZE 256 37define VK_MAX_DESCRIPTION_SIZE 256 38define VK_MAX_MEMORY_TYPES 32 39define VK_MAX_MEMORY_HEAPS 16 /// The maximum number of unique memory heaps, each of which supporting 1 or more memory types. 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_KHR_surface") define VK_KHR_SURFACE_SPEC_VERSION 25 49@extension("VK_KHR_surface") define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface" 50 51@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_SPEC_VERSION 67 52@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain" 53 54@extension("VK_KHR_display") define VK_KHR_DISPLAY_SPEC_VERSION 21 55@extension("VK_KHR_display") define VK_KHR_DISPLAY_EXTENSION_NAME "VK_KHR_display" 56 57@extension("VK_KHR_display_swapchain") define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 9 58@extension("VK_KHR_display_swapchain") define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain" 59 60@extension("VK_KHR_xlib_surface") define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 61@extension("VK_KHR_xlib_surface") define VK_KHR_XLIB_SURFACE_NAME "VK_KHR_xlib_surface" 62 63@extension("VK_KHR_xcb_surface") define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 64@extension("VK_KHR_xcb_surface") define VK_KHR_XCB_SURFACE_NAME "VK_KHR_xcb_surface" 65 66@extension("VK_KHR_wayland_surface") define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 5 67@extension("VK_KHR_wayland_surface") define VK_KHR_WAYLAND_SURFACE_NAME "VK_KHR_wayland_surface" 68 69@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_SPEC_VERSION 4 70@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_NAME "VK_KHR_mir_surface" 71 72@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6 73@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_NAME "VK_KHR_android_surface" 74 75@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_SPEC_VERSION 5 76@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_NAME "VK_KHR_win32_surface" 77 78@extension("VK_ANDROID_native_buffer") define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 5 79@extension("VK_ANDROID_native_buffer") define VK_ANDROID_NATIVE_BUFFER_NAME "VK_ANDROID_native_buffer" 80 81@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_SPEC_VERSION 1 82@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_NAME "VK_EXT_debug_report" 83 84 85///////////// 86// Types // 87///////////// 88 89type u32 VkBool32 90type u32 VkFlags 91type u64 VkDeviceSize 92type u32 VkSampleMask 93 94/// Dispatchable handle types. 95@dispatchHandle type u64 VkInstance 96@dispatchHandle type u64 VkPhysicalDevice 97@dispatchHandle type u64 VkDevice 98@dispatchHandle type u64 VkQueue 99@dispatchHandle type u64 VkCommandBuffer 100 101/// Non dispatchable handle types. 102@nonDispatchHandle type u64 VkDeviceMemory 103@nonDispatchHandle type u64 VkCommandPool 104@nonDispatchHandle type u64 VkBuffer 105@nonDispatchHandle type u64 VkBufferView 106@nonDispatchHandle type u64 VkImage 107@nonDispatchHandle type u64 VkImageView 108@nonDispatchHandle type u64 VkShaderModule 109@nonDispatchHandle type u64 VkPipeline 110@nonDispatchHandle type u64 VkPipelineLayout 111@nonDispatchHandle type u64 VkSampler 112@nonDispatchHandle type u64 VkDescriptorSet 113@nonDispatchHandle type u64 VkDescriptorSetLayout 114@nonDispatchHandle type u64 VkDescriptorPool 115@nonDispatchHandle type u64 VkFence 116@nonDispatchHandle type u64 VkSemaphore 117@nonDispatchHandle type u64 VkEvent 118@nonDispatchHandle type u64 VkQueryPool 119@nonDispatchHandle type u64 VkFramebuffer 120@nonDispatchHandle type u64 VkRenderPass 121@nonDispatchHandle type u64 VkPipelineCache 122 123@extension("VK_KHR_surface") @nonDispatchHandle type u64 VkSurfaceKHR 124 125@extension("VK_KHR_swapchain") @nonDispatchHandle type u64 VkSwapchainKHR 126 127@extension("VK_KHR_display") @nonDispatchHandle type u64 VkDisplayKHR 128@extension("VK_KHR_display") @nonDispatchHandle type u64 VkDisplayModeKHR 129 130@extension("VK_EXT_debug_report") @nonDispatchHandle type u64 VkDebugReportCallbackEXT 131 132 133///////////// 134// Enums // 135///////////// 136 137enum VkImageLayout { 138 VK_IMAGE_LAYOUT_UNDEFINED = 0x00000000, /// Implicit layout an image is when its contents are undefined due to various reasons (e.g. right after creation) 139 VK_IMAGE_LAYOUT_GENERAL = 0x00000001, /// General layout when image can be used for any kind of access 140 VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 0x00000002, /// Optimal layout when image is only used for color attachment read/write 141 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 0x00000003, /// Optimal layout when image is only used for depth/stencil attachment read/write 142 VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 0x00000004, /// Optimal layout when image is used for read only depth/stencil attachment and shader access 143 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 0x00000005, /// Optimal layout when image is used for read only shader access 144 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 0x00000006, /// Optimal layout when image is used only as source of transfer operations 145 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 0x00000007, /// Optimal layout when image is used only as destination of transfer operations 146 VK_IMAGE_LAYOUT_PREINITIALIZED = 0x00000008, /// Initial layout used when the data is populated by the CPU 147 148 //@extension("VK_KHR_swapchain") 149 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, 150} 151 152enum VkAttachmentLoadOp { 153 VK_ATTACHMENT_LOAD_OP_LOAD = 0x00000000, 154 VK_ATTACHMENT_LOAD_OP_CLEAR = 0x00000001, 155 VK_ATTACHMENT_LOAD_OP_DONT_CARE = 0x00000002, 156} 157 158enum VkAttachmentStoreOp { 159 VK_ATTACHMENT_STORE_OP_STORE = 0x00000000, 160 VK_ATTACHMENT_STORE_OP_DONT_CARE = 0x00000001, 161} 162 163enum VkImageType { 164 VK_IMAGE_TYPE_1D = 0x00000000, 165 VK_IMAGE_TYPE_2D = 0x00000001, 166 VK_IMAGE_TYPE_3D = 0x00000002, 167} 168 169enum VkImageTiling { 170 VK_IMAGE_TILING_OPTIMAL = 0x00000000, 171 VK_IMAGE_TILING_LINEAR = 0x00000001, 172} 173 174enum VkImageViewType { 175 VK_IMAGE_VIEW_TYPE_1D = 0x00000000, 176 VK_IMAGE_VIEW_TYPE_2D = 0x00000001, 177 VK_IMAGE_VIEW_TYPE_3D = 0x00000002, 178 VK_IMAGE_VIEW_TYPE_CUBE = 0x00000003, 179 VK_IMAGE_VIEW_TYPE_1D_ARRAY = 0x00000004, 180 VK_IMAGE_VIEW_TYPE_2D_ARRAY = 0x00000005, 181 VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 0x00000006, 182} 183 184enum VkCommandBufferLevel { 185 VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0x00000000, 186 VK_COMMAND_BUFFER_LEVEL_SECONDARY = 0x00000001, 187} 188 189enum VkComponentSwizzle { 190 VK_COMPONENT_SWIZZLE_IDENTITY = 0x00000000, 191 VK_COMPONENT_SWIZZLE_ZERO = 0x00000001, 192 VK_COMPONENT_SWIZZLE_ONE = 0x00000002, 193 VK_COMPONENT_SWIZZLE_R = 0x00000003, 194 VK_COMPONENT_SWIZZLE_G = 0x00000004, 195 VK_COMPONENT_SWIZZLE_B = 0x00000005, 196 VK_COMPONENT_SWIZZLE_A = 0x00000006, 197} 198 199enum VkDescriptorType { 200 VK_DESCRIPTOR_TYPE_SAMPLER = 0x00000000, 201 VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 0x00000001, 202 VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 0x00000002, 203 VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 0x00000003, 204 VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 0x00000004, 205 VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 0x00000005, 206 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 0x00000006, 207 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 0x00000007, 208 VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 0x00000008, 209 VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 0x00000009, 210 VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 0x0000000a, 211} 212 213enum VkQueryType { 214 VK_QUERY_TYPE_OCCLUSION = 0x00000000, 215 VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, /// Optional 216 VK_QUERY_TYPE_TIMESTAMP = 0x00000002, 217} 218 219enum VkBorderColor { 220 VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0x00000000, 221 VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 0x00000001, 222 VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 0x00000002, 223 VK_BORDER_COLOR_INT_OPAQUE_BLACK = 0x00000003, 224 VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 0x00000004, 225 VK_BORDER_COLOR_INT_OPAQUE_WHITE = 0x00000005, 226} 227 228enum VkPipelineBindPoint { 229 VK_PIPELINE_BIND_POINT_GRAPHICS = 0x00000000, 230 VK_PIPELINE_BIND_POINT_COMPUTE = 0x00000001, 231} 232 233enum VkPrimitiveTopology { 234 VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0x00000000, 235 VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 0x00000001, 236 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 0x00000002, 237 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 0x00000003, 238 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 0x00000004, 239 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 0x00000005, 240 VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 0x00000006, 241 VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 0x00000007, 242 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 0x00000008, 243 VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 0x00000009, 244 VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 0x0000000a, 245} 246 247enum VkSharingMode { 248 VK_SHARING_MODE_EXCLUSIVE = 0x00000000, 249 VK_SHARING_MODE_CONCURRENT = 0x00000001, 250} 251 252enum VkIndexType { 253 VK_INDEX_TYPE_UINT16 = 0x00000000, 254 VK_INDEX_TYPE_UINT32 = 0x00000001, 255} 256 257enum VkFilter { 258 VK_FILTER_NEAREST = 0x00000000, 259 VK_FILTER_LINEAR = 0x00000001, 260} 261 262enum VkSamplerMipmapMode { 263 VK_SAMPLER_MIPMAP_MODE_NEAREST = 0x00000001, /// Choose nearest mip level 264 VK_SAMPLER_MIPMAP_MODE_LINEAR = 0x00000002, /// Linear filter between mip levels 265} 266 267enum VkSamplerAddressMode { 268 VK_SAMPLER_ADDRESS_MODE_REPEAT = 0x00000000, 269 VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 0x00000001, 270 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 0x00000002, 271 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 0x00000003, 272 VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 0x00000004, 273} 274 275enum VkCompareOp { 276 VK_COMPARE_OP_NEVER = 0x00000000, 277 VK_COMPARE_OP_LESS = 0x00000001, 278 VK_COMPARE_OP_EQUAL = 0x00000002, 279 VK_COMPARE_OP_LESS_OR_EQUAL = 0x00000003, 280 VK_COMPARE_OP_GREATER = 0x00000004, 281 VK_COMPARE_OP_NOT_EQUAL = 0x00000005, 282 VK_COMPARE_OP_GREATER_OR_EQUAL = 0x00000006, 283 VK_COMPARE_OP_ALWAYS = 0x00000007, 284} 285 286enum VkPolygonMode { 287 VK_POLYGON_MODE_FILL = 0x00000000, 288 VK_POLYGON_MODE_LINE = 0x00000001, 289 VK_POLYGON_MODE_POINT = 0x00000002, 290} 291 292enum VkFrontFace { 293 VK_FRONT_FACE_COUNTER_CLOCKWISE = 0x00000000, 294 VK_FRONT_FACE_CLOCKWISE = 0x00000001, 295} 296 297enum VkBlendFactor { 298 VK_BLEND_FACTOR_ZERO = 0x00000000, 299 VK_BLEND_FACTOR_ONE = 0x00000001, 300 VK_BLEND_FACTOR_SRC_COLOR = 0x00000002, 301 VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 0x00000003, 302 VK_BLEND_FACTOR_DST_COLOR = 0x00000004, 303 VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 0x00000005, 304 VK_BLEND_FACTOR_SRC_ALPHA = 0x00000006, 305 VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 0x00000007, 306 VK_BLEND_FACTOR_DST_ALPHA = 0x00000008, 307 VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 0x00000009, 308 VK_BLEND_FACTOR_CONSTANT_COLOR = 0x0000000a, 309 VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 0x0000000b, 310 VK_BLEND_FACTOR_CONSTANT_ALPHA = 0x0000000c, 311 VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 0x0000000d, 312 VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 0x0000000e, 313 VK_BLEND_FACTOR_SRC1_COLOR = 0x0000000f, 314 VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 0x00000010, 315 VK_BLEND_FACTOR_SRC1_ALPHA = 0x00000011, 316 VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 0x00000012, 317} 318 319enum VkBlendOp { 320 VK_BLEND_OP_ADD = 0x00000000, 321 VK_BLEND_OP_SUBTRACT = 0x00000001, 322 VK_BLEND_OP_REVERSE_SUBTRACT = 0x00000002, 323 VK_BLEND_OP_MIN = 0x00000003, 324 VK_BLEND_OP_MAX = 0x00000004, 325} 326 327enum VkStencilOp { 328 VK_STENCIL_OP_KEEP = 0x00000000, 329 VK_STENCIL_OP_ZERO = 0x00000001, 330 VK_STENCIL_OP_REPLACE = 0x00000002, 331 VK_STENCIL_OP_INCREMENT_AND_CLAMP = 0x00000003, 332 VK_STENCIL_OP_DECREMENT_AND_CLAMP = 0x00000004, 333 VK_STENCIL_OP_INVERT = 0x00000005, 334 VK_STENCIL_OP_INCREMENT_AND_WRAP = 0x00000006, 335 VK_STENCIL_OP_DECREMENT_AND_WRAP = 0x00000007, 336} 337 338enum VkLogicOp { 339 VK_LOGIC_OP_CLEAR = 0x00000000, 340 VK_LOGIC_OP_AND = 0x00000001, 341 VK_LOGIC_OP_AND_REVERSE = 0x00000002, 342 VK_LOGIC_OP_COPY = 0x00000003, 343 VK_LOGIC_OP_AND_INVERTED = 0x00000004, 344 VK_LOGIC_OP_NO_OP = 0x00000005, 345 VK_LOGIC_OP_XOR = 0x00000006, 346 VK_LOGIC_OP_OR = 0x00000007, 347 VK_LOGIC_OP_NOR = 0x00000008, 348 VK_LOGIC_OP_EQUIVALENT = 0x00000009, 349 VK_LOGIC_OP_INVERT = 0x0000000a, 350 VK_LOGIC_OP_OR_REVERSE = 0x0000000b, 351 VK_LOGIC_OP_COPY_INVERTED = 0x0000000c, 352 VK_LOGIC_OP_OR_INVERTED = 0x0000000d, 353 VK_LOGIC_OP_NAND = 0x0000000e, 354 VK_LOGIC_OP_SET = 0x0000000f, 355} 356 357enum VkSystemAllocationScope { 358 VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0x00000000, 359 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 0x00000001, 360 VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 0x00000002, 361 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 0x00000003, 362 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 0x00000004, 363} 364 365enum VkInternalAllocationType { 366 VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0x00000000, 367} 368 369enum VkPhysicalDeviceType { 370 VK_PHYSICAL_DEVICE_TYPE_OTHER = 0x00000000, 371 VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 0x00000001, 372 VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 0x00000002, 373 VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 0x00000003, 374 VK_PHYSICAL_DEVICE_TYPE_CPU = 0x00000004, 375} 376 377enum VkVertexInputRate { 378 VK_VERTEX_INPUT_RATE_VERTEX = 0x00000000, 379 VK_VERTEX_INPUT_RATE_INSTANCE = 0x00000001, 380} 381 382/// Vulkan format definitions 383enum VkFormat { 384 VK_FORMAT_UNDEFINED = 0, 385 VK_FORMAT_R4G4_UNORM_PACK8 = 1, 386 VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2, 387 VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3, 388 VK_FORMAT_R5G6B5_UNORM_PACK16 = 4, 389 VK_FORMAT_B5G6R5_UNORM_PACK16 = 5, 390 VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6, 391 VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7, 392 VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8, 393 VK_FORMAT_R8_UNORM = 9, 394 VK_FORMAT_R8_SNORM = 10, 395 VK_FORMAT_R8_USCALED = 11, 396 VK_FORMAT_R8_SSCALED = 12, 397 VK_FORMAT_R8_UINT = 13, 398 VK_FORMAT_R8_SINT = 14, 399 VK_FORMAT_R8_SRGB = 15, 400 VK_FORMAT_R8G8_UNORM = 16, 401 VK_FORMAT_R8G8_SNORM = 17, 402 VK_FORMAT_R8G8_USCALED = 18, 403 VK_FORMAT_R8G8_SSCALED = 19, 404 VK_FORMAT_R8G8_UINT = 20, 405 VK_FORMAT_R8G8_SINT = 21, 406 VK_FORMAT_R8G8_SRGB = 22, 407 VK_FORMAT_R8G8B8_UNORM = 23, 408 VK_FORMAT_R8G8B8_SNORM = 24, 409 VK_FORMAT_R8G8B8_USCALED = 25, 410 VK_FORMAT_R8G8B8_SSCALED = 26, 411 VK_FORMAT_R8G8B8_UINT = 27, 412 VK_FORMAT_R8G8B8_SINT = 28, 413 VK_FORMAT_R8G8B8_SRGB = 29, 414 VK_FORMAT_B8G8R8_UNORM = 30, 415 VK_FORMAT_B8G8R8_SNORM = 31, 416 VK_FORMAT_B8G8R8_USCALED = 32, 417 VK_FORMAT_B8G8R8_SSCALED = 33, 418 VK_FORMAT_B8G8R8_UINT = 34, 419 VK_FORMAT_B8G8R8_SINT = 35, 420 VK_FORMAT_B8G8R8_SRGB = 36, 421 VK_FORMAT_R8G8B8A8_UNORM = 37, 422 VK_FORMAT_R8G8B8A8_SNORM = 38, 423 VK_FORMAT_R8G8B8A8_USCALED = 39, 424 VK_FORMAT_R8G8B8A8_SSCALED = 40, 425 VK_FORMAT_R8G8B8A8_UINT = 41, 426 VK_FORMAT_R8G8B8A8_SINT = 42, 427 VK_FORMAT_R8G8B8A8_SRGB = 43, 428 VK_FORMAT_B8G8R8A8_UNORM = 44, 429 VK_FORMAT_B8G8R8A8_SNORM = 45, 430 VK_FORMAT_B8G8R8A8_USCALED = 46, 431 VK_FORMAT_B8G8R8A8_SSCALED = 47, 432 VK_FORMAT_B8G8R8A8_UINT = 48, 433 VK_FORMAT_B8G8R8A8_SINT = 49, 434 VK_FORMAT_B8G8R8A8_SRGB = 50, 435 VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51, 436 VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52, 437 VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53, 438 VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54, 439 VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55, 440 VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56, 441 VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57, 442 VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58, 443 VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59, 444 VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60, 445 VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61, 446 VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62, 447 VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63, 448 VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64, 449 VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65, 450 VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66, 451 VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67, 452 VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68, 453 VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69, 454 VK_FORMAT_R16_UNORM = 70, 455 VK_FORMAT_R16_SNORM = 71, 456 VK_FORMAT_R16_USCALED = 72, 457 VK_FORMAT_R16_SSCALED = 73, 458 VK_FORMAT_R16_UINT = 74, 459 VK_FORMAT_R16_SINT = 75, 460 VK_FORMAT_R16_SFLOAT = 76, 461 VK_FORMAT_R16G16_UNORM = 77, 462 VK_FORMAT_R16G16_SNORM = 78, 463 VK_FORMAT_R16G16_USCALED = 79, 464 VK_FORMAT_R16G16_SSCALED = 80, 465 VK_FORMAT_R16G16_UINT = 81, 466 VK_FORMAT_R16G16_SINT = 82, 467 VK_FORMAT_R16G16_SFLOAT = 83, 468 VK_FORMAT_R16G16B16_UNORM = 84, 469 VK_FORMAT_R16G16B16_SNORM = 85, 470 VK_FORMAT_R16G16B16_USCALED = 86, 471 VK_FORMAT_R16G16B16_SSCALED = 87, 472 VK_FORMAT_R16G16B16_UINT = 88, 473 VK_FORMAT_R16G16B16_SINT = 89, 474 VK_FORMAT_R16G16B16_SFLOAT = 90, 475 VK_FORMAT_R16G16B16A16_UNORM = 91, 476 VK_FORMAT_R16G16B16A16_SNORM = 92, 477 VK_FORMAT_R16G16B16A16_USCALED = 93, 478 VK_FORMAT_R16G16B16A16_SSCALED = 94, 479 VK_FORMAT_R16G16B16A16_UINT = 95, 480 VK_FORMAT_R16G16B16A16_SINT = 96, 481 VK_FORMAT_R16G16B16A16_SFLOAT = 97, 482 VK_FORMAT_R32_UINT = 98, 483 VK_FORMAT_R32_SINT = 99, 484 VK_FORMAT_R32_SFLOAT = 100, 485 VK_FORMAT_R32G32_UINT = 101, 486 VK_FORMAT_R32G32_SINT = 102, 487 VK_FORMAT_R32G32_SFLOAT = 103, 488 VK_FORMAT_R32G32B32_UINT = 104, 489 VK_FORMAT_R32G32B32_SINT = 105, 490 VK_FORMAT_R32G32B32_SFLOAT = 106, 491 VK_FORMAT_R32G32B32A32_UINT = 107, 492 VK_FORMAT_R32G32B32A32_SINT = 108, 493 VK_FORMAT_R32G32B32A32_SFLOAT = 109, 494 VK_FORMAT_R64_UINT = 110, 495 VK_FORMAT_R64_SINT = 111, 496 VK_FORMAT_R64_SFLOAT = 112, 497 VK_FORMAT_R64G64_UINT = 113, 498 VK_FORMAT_R64G64_SINT = 114, 499 VK_FORMAT_R64G64_SFLOAT = 115, 500 VK_FORMAT_R64G64B64_UINT = 116, 501 VK_FORMAT_R64G64B64_SINT = 117, 502 VK_FORMAT_R64G64B64_SFLOAT = 118, 503 VK_FORMAT_R64G64B64A64_UINT = 119, 504 VK_FORMAT_R64G64B64A64_SINT = 120, 505 VK_FORMAT_R64G64B64A64_SFLOAT = 121, 506 VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122, 507 VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123, 508 VK_FORMAT_D16_UNORM = 124, 509 VK_FORMAT_X8_D24_UNORM_PACK32 = 125, 510 VK_FORMAT_D32_SFLOAT = 126, 511 VK_FORMAT_S8_UINT = 127, 512 VK_FORMAT_D16_UNORM_S8_UINT = 128, 513 VK_FORMAT_D24_UNORM_S8_UINT = 129, 514 VK_FORMAT_D32_SFLOAT_S8_UINT = 130, 515 VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131, 516 VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132, 517 VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133, 518 VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134, 519 VK_FORMAT_BC2_UNORM_BLOCK = 135, 520 VK_FORMAT_BC2_SRGB_BLOCK = 136, 521 VK_FORMAT_BC3_UNORM_BLOCK = 137, 522 VK_FORMAT_BC3_SRGB_BLOCK = 138, 523 VK_FORMAT_BC4_UNORM_BLOCK = 139, 524 VK_FORMAT_BC4_SNORM_BLOCK = 140, 525 VK_FORMAT_BC5_UNORM_BLOCK = 141, 526 VK_FORMAT_BC5_SNORM_BLOCK = 142, 527 VK_FORMAT_BC6H_UFLOAT_BLOCK = 143, 528 VK_FORMAT_BC6H_SFLOAT_BLOCK = 144, 529 VK_FORMAT_BC7_UNORM_BLOCK = 145, 530 VK_FORMAT_BC7_SRGB_BLOCK = 146, 531 VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147, 532 VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148, 533 VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149, 534 VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150, 535 VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151, 536 VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152, 537 VK_FORMAT_EAC_R11_UNORM_BLOCK = 153, 538 VK_FORMAT_EAC_R11_SNORM_BLOCK = 154, 539 VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155, 540 VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156, 541 VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157, 542 VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158, 543 VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159, 544 VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160, 545 VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161, 546 VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162, 547 VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, 548 VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, 549 VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, 550 VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, 551 VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, 552 VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, 553 VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, 554 VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170, 555 VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171, 556 VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172, 557 VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173, 558 VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174, 559 VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175, 560 VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176, 561 VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177, 562 VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178, 563 VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179, 564 VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180, 565 VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181, 566 VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182, 567 VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183, 568 VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184, 569} 570 571/// Structure type enumerant 572enum VkStructureType { 573 VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, 574 VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, 575 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, 576 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, 577 VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, 578 VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, 579 VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, 580 VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, 581 VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, 582 VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, 583 VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, 584 VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, 585 VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, 586 VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, 587 VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, 588 VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, 589 VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, 590 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, 591 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, 592 VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, 593 VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, 594 VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, 595 VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, 596 VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, 597 VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, 598 VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, 599 VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, 600 VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, 601 VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, 602 VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, 603 VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, 604 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, 605 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, 606 VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, 607 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, 608 VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, 609 VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, 610 VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, 611 VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, 612 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, 613 VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, 614 VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41, 615 VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42, 616 VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, 617 VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44, 618 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45, 619 VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, 620 VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, 621 VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48, 622 623 //@extension("VK_KHR_swapchain") 624 VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, 625 VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, 626 627 //@extension("VK_KHR_display") 628 VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000, 629 VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001, 630 631 //@extension("VK_KHR_display_swapchain") 632 VK_STRUCTURE_TYPE_DISPLAY_DISPLAY_PRESENT_INFO_KHR = 1000003000, 633 634 //@extension("VK_KHR_xlib_surface") 635 VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, 636 637 //@extension("VK_KHR_xcb_surface") 638 VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, 639 640 //@extension("VK_KHR_wayland_surface") 641 VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, 642 643 //@extension("VK_KHR_mir_surface") 644 VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000, 645 646 //@extension("VK_KHR_android_surface") 647 VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000, 648 649 //@extension("VK_KHR_win32_surface") 650 VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, 651 652 //@extension("VK_ANDROID_native_buffer") 653 VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID = 1000010000, 654 655 //@extension("VK_EXT_debug_report") 656 VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = 1000011000, 657} 658 659enum VkSubpassContents { 660 VK_SUBPASS_CONTENTS_INLINE = 0x00000000, 661 VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 0x00000001, 662} 663 664enum VkPipelineCacheHeaderVersion { 665 VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, 666} 667 668@lastUnused(-11) 669/// Error and return codes 670enum VkResult { 671 // Return codes for successful operation execution (positive values) 672 VK_SUCCESS = 0, 673 VK_NOT_READY = 1, 674 VK_TIMEOUT = 2, 675 VK_EVENT_SET = 3, 676 VK_EVENT_RESET = 4, 677 VK_INCOMPLETE = 5, 678 679 //@extension("VK_KHR_swapchain") 680 VK_SUBOPTIMAL_KHR = 1000001003, 681 682 // Error codes (negative values) 683 VK_ERROR_OUT_OF_HOST_MEMORY = 0xFFFFFFFF, // -1 684 VK_ERROR_OUT_OF_DEVICE_MEMORY = 0xFFFFFFFE, // -2 685 VK_ERROR_INITIALIZATION_FAILED = 0xFFFFFFFD, // -3 686 VK_ERROR_DEVICE_LOST = 0xFFFFFFFC, // -4 687 VK_ERROR_MEMORY_MAP_FAILED = 0xFFFFFFFB, // -5 688 VK_ERROR_LAYER_NOT_PRESENT = 0xFFFFFFFA, // -6 689 VK_ERROR_EXTENSION_NOT_PRESENT = 0xFFFFFFF9, // -7 690 VK_ERROR_FEATURE_NOT_PRESENT = 0xFFFFFFF8, // -8 691 VK_ERROR_INCOMPATIBLE_DRIVER = 0xFFFFFFF7, // -9 692 VK_ERROR_TOO_MANY_OBJECTS = 0xFFFFFFF6, // -10 693 VK_ERROR_FORMAT_NOT_SUPPORTED = 0xFFFFFFF5, // -11 694 695 //@extension("VK_KHR_surface") 696 VK_ERROR_SURFACE_LOST_KHR = 0xC4653600, // -1000000000 697 698 //@extension("VK_KHR_surface") 699 VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = 0xC46535FF, // -1000008001 700 701 //@extension("VK_KHR_swapchain") 702 VK_ERROR_OUT_OF_DATE_KHR = 0xC4653214, // -1000001004 703 704 //@extension("VK_KHR_display_swapchain") 705 VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = 0xC4652A47, // -1000003001 706 707 //@extension("VK_EXT_debug_report") 708 VK_ERROR_VALIDATION_FAILED_EXT = 0xC4650B07, // -1000011001 709} 710 711enum VkDynamicState { 712 VK_DYNAMIC_STATE_VIEWPORT = 0x00000000, 713 VK_DYNAMIC_STATE_SCISSOR = 0x00000001, 714 VK_DYNAMIC_STATE_LINE_WIDTH = 0x00000002, 715 VK_DYNAMIC_STATE_DEPTH_BIAS = 0x00000003, 716 VK_DYNAMIC_STATE_BLEND_CONSTANTS = 0x00000004, 717 VK_DYNAMIC_STATE_DEPTH_BOUNDS = 0x00000005, 718 VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 0x00000006, 719 VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 0x00000007, 720 VK_DYNAMIC_STATE_STENCIL_REFERENCE = 0x00000008, 721} 722 723@extension("VK_KHR_surface") 724enum VkPresentModeKHR { 725 VK_PRESENT_MODE_IMMEDIATE_KHR = 0x00000000, 726 VK_PRESENT_MODE_MAILBOX_KHR = 0x00000001, 727 VK_PRESENT_MODE_FIFO_KHR = 0x00000002, 728 VK_PRESENT_MODE_FIFO_RELAXED_KHR = 0x00000003, 729} 730 731@extension("VK_KHR_surface") 732enum VkColorSpaceKHR { 733 VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000, 734} 735 736@extension("VK_EXT_debug_report") 737enum VkDebugReportObjectTypeEXT { 738 VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, 739 VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1, 740 VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2, 741 VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3, 742 VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4, 743 VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5, 744 VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6, 745 VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7, 746 VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8, 747 VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9, 748 VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10, 749 VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11, 750 VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12, 751 VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13, 752 VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14, 753 VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15, 754 VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16, 755 VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17, 756 VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18, 757 VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19, 758 VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20, 759 VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21, 760 VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22, 761 VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23, 762 VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24, 763 VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25, 764 VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, 765 VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, 766 VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28, 767} 768 769@extension("VK_EXT_debug_report") 770enum VkDebugReportErrorEXT { 771 VK_DEBUG_REPORT_ERROR_NONE_EXT = 0, 772 VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1, 773} 774 775 776///////////////// 777// Bitfields // 778///////////////// 779 780/// Queue capabilities 781type VkFlags VkQueueFlags 782bitfield VkQueueFlagBits { 783 VK_QUEUE_GRAPHICS_BIT = 0x00000001, /// Queue supports graphics operations 784 VK_QUEUE_COMPUTE_BIT = 0x00000002, /// Queue supports compute operations 785 VK_QUEUE_TRANSFER_BIT = 0x00000004, /// Queue supports transfer operations 786 VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, /// Queue supports sparse resource memory management operations 787} 788 789/// Memory properties passed into vkAllocMemory(). 790type VkFlags VkMemoryPropertyFlags 791bitfield VkMemoryPropertyFlagBits { 792 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001, 793 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002, 794 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004, 795 VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008, 796 VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, 797} 798 799/// Memory heap flags 800type VkFlags VkMemoryHeapFlags 801bitfield VkMemoryHeapFlagBits { 802 VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001, 803} 804 805/// Access flags 806type VkFlags VkAccessFlags 807bitfield VkAccessFlagBits { 808 VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001, 809 VK_ACCESS_INDEX_READ_BIT = 0x00000002, 810 VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004, 811 VK_ACCESS_UNIFORM_READ_BIT = 0x00000008, 812 VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010, 813 VK_ACCESS_SHADER_READ_BIT = 0x00000020, 814 VK_ACCESS_SHADER_WRITE_BIT = 0x00000040, 815 VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080, 816 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100, 817 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200, 818 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400, 819 VK_ACCESS_TRANSFER_READ_BIT = 0x00000800, 820 VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000, 821 VK_ACCESS_HOST_READ_BIT = 0x00002000, 822 VK_ACCESS_HOST_WRITE_BIT = 0x00004000, 823 VK_ACCESS_MEMORY_READ_BIT = 0x00008000, 824 VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000, 825} 826 827/// Buffer usage flags 828type VkFlags VkBufferUsageFlags 829bitfield VkBufferUsageFlagBits { 830 VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations 831 VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations 832 VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, /// Can be used as TBO 833 VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, /// Can be used as IBO 834 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, /// Can be used as UBO 835 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, /// Can be used as SSBO 836 VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, /// Can be used as source of fixed function index fetch (index buffer) 837 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, /// Can be used as source of fixed function vertex fetch (VBO) 838 VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, /// Can be the source of indirect parameters (e.g. indirect buffer, parameter buffer) 839} 840 841/// Buffer creation flags 842type VkFlags VkBufferCreateFlags 843bitfield VkBufferCreateFlagBits { 844 VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Buffer should support sparse backing 845 VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Buffer should support sparse backing with partial residency 846 VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Buffer should support constent data access to physical memory blocks mapped into multiple locations of sparse buffers 847} 848 849/// Shader stage flags 850type VkFlags VkShaderStageFlags 851bitfield VkShaderStageFlagBits { 852 VK_SHADER_STAGE_VERTEX_BIT = 0x00000001, 853 VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002, 854 VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004, 855 VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008, 856 VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, 857 VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020, 858 VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F, 859 860 VK_SHADER_STAGE_ALL = 0x7FFFFFFF, 861} 862 863/// Descriptor pool create flags 864type VkFlags VkDescriptorPoolCreateFlags 865bitfield VkDescriptorPoolCreateFlagBits { 866 VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001, 867} 868 869/// Descriptor pool reset flags 870type VkFlags VkDescriptorPoolResetFlags 871//bitfield VkDescriptorPoolResetFlagBits { 872//} 873 874/// Image usage flags 875type VkFlags VkImageUsageFlags 876bitfield VkImageUsageFlagBits { 877 VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, /// Can be used as a source of transfer operations 878 VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, /// Can be used as a destination of transfer operations 879 VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, /// Can be sampled from (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types) 880 VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, /// Can be used as storage image (STORAGE_IMAGE descriptor type) 881 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, /// Can be used as framebuffer color attachment 882 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment 883 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering 884 VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment 885} 886 887/// Image creation flags 888type VkFlags VkImageCreateFlags 889bitfield VkImageCreateFlagBits { 890 VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, /// Image should support sparse backing 891 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Image should support sparse backing with partial residency 892 VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Image should support constent data access to physical memory blocks mapped into multiple locations of sparse images 893 VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, /// Allows image views to have different format than the base image 894 VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, /// Allows creating image views with cube type from the created image 895} 896 897/// Image view creation flags 898type VkFlags VkImageViewCreateFlags 899//bitfield VkImageViewCreateFlagBits { 900//} 901 902/// Pipeline creation flags 903type VkFlags VkPipelineCreateFlags 904bitfield VkPipelineCreateFlagBits { 905 VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001, 906 VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002, 907 VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004, 908} 909 910/// Color component flags 911type VkFlags VkColorComponentFlags 912bitfield VkColorComponentFlagBits { 913 VK_COLOR_COMPONENT_R_BIT = 0x00000001, 914 VK_COLOR_COMPONENT_G_BIT = 0x00000002, 915 VK_COLOR_COMPONENT_B_BIT = 0x00000004, 916 VK_COLOR_COMPONENT_A_BIT = 0x00000008, 917} 918 919/// Fence creation flags 920type VkFlags VkFenceCreateFlags 921bitfield VkFenceCreateFlagBits { 922 VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001, 923} 924 925/// Semaphore creation flags 926type VkFlags VkSemaphoreCreateFlags 927//bitfield VkSemaphoreCreateFlagBits { 928//} 929 930/// Format capability flags 931type VkFlags VkFormatFeatureFlags 932bitfield VkFormatFeatureFlagBits { 933 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types) 934 VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type) 935 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images 936 VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs) 937 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs) 938 VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers 939 VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs) 940 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images 941 VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images 942 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images 943 VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, /// Format can be used as the source image of blits with vkCommandBlitImage 944 VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, /// Format can be used as the destination image of blits with vkCommandBlitImage 945 VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000, 946} 947 948/// Query control flags 949type VkFlags VkQueryControlFlags 950bitfield VkQueryControlFlagBits { 951 VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001, 952} 953 954/// Query result flags 955type VkFlags VkQueryResultFlags 956bitfield VkQueryResultFlagBits { 957 VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values 958 VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy 959 VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written 960 VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available 961} 962 963/// Shader module creation flags 964type VkFlags VkShaderModuleCreateFlags 965//bitfield VkShaderModuleCreateFlagBits { 966//} 967 968/// Event creation flags 969type VkFlags VkEventCreateFlags 970//bitfield VkEventCreateFlagBits { 971//} 972 973/// Command buffer usage flags 974type VkFlags VkCommandBufferUsageFlags 975bitfield VkCommandBufferUsageFlagBits { 976 VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001, 977 VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002, 978 VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004, 979} 980 981/// Pipeline statistics flags 982type VkFlags VkQueryPipelineStatisticFlags 983bitfield VkQueryPipelineStatisticFlagBits { 984 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, /// Optional 985 VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, /// Optional 986 VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, /// Optional 987 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, /// Optional 988 VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, /// Optional 989 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, /// Optional 990 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, /// Optional 991 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, /// Optional 992 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, /// Optional 993 VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, /// Optional 994 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, /// Optional 995} 996 997/// Memory mapping flags 998type VkFlags VkMemoryMapFlags 999//bitfield VkMemoryMapFlagBits { 1000//} 1001 1002/// Bitfield of image aspects 1003type VkFlags VkImageAspectFlags 1004bitfield VkImageAspectFlagBits { 1005 VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001, 1006 VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002, 1007 VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004, 1008 VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008, 1009} 1010 1011/// Sparse memory bind flags 1012type VkFlags VkSparseMemoryBindFlags 1013bitfield VkSparseMemoryBindFlagBits { 1014 VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001, 1015} 1016 1017/// Sparse image memory requirements flags 1018type VkFlags VkSparseImageFormatFlags 1019bitfield VkSparseImageFormatFlagBits { 1020 VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices 1021 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. 1022 VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size 1023} 1024 1025/// Pipeline stages 1026type VkFlags VkPipelineStageFlags 1027bitfield VkPipelineStageFlagBits { 1028 VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed 1029 VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch 1030 VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch 1031 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading 1032 VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading 1033 VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading 1034 VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading 1035 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading 1036 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests 1037 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests 1038 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes 1039 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading 1040 VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations 1041 VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 0x00002000, 1042 VK_PIPELINE_STAGE_HOST_BIT = 0x00004000, /// Indicates host (CPU) is a source/sink of the dependency 1043 1044 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000, /// All stages of the graphics pipeline 1045 VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000, /// All graphics, compute, copy, and transition commands 1046} 1047 1048/// Render pass attachment description flags 1049type VkFlags VkAttachmentDescriptionFlags 1050bitfield VkAttachmentDescriptionFlagBits { 1051 VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001, /// The attachment may alias physical memory of another attachment in the same renderpass 1052} 1053 1054/// Subpass description flags 1055type VkFlags VkSubpassDescriptionFlags 1056bitfield VkSubpassDescriptionFlagBits { 1057} 1058 1059/// Command pool creation flags 1060type VkFlags VkCommandPoolCreateFlags 1061bitfield VkCommandPoolCreateFlagBits { 1062 VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime 1063 VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually 1064} 1065 1066/// Command pool reset flags 1067type VkFlags VkCommandPoolResetFlags 1068bitfield VkCommandPoolResetFlagBits { 1069 VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the pool 1070} 1071 1072type VkFlags VkCommandBufferResetFlags 1073bitfield VkCommandBufferResetFlagBits { 1074 VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, /// Release resources owned by the buffer 1075} 1076 1077type VkFlags VkSampleCountFlags 1078bitfield VkSampleCountFlagBits { 1079 VK_SAMPLE_COUNT_1_BIT = 0x00000001, 1080 VK_SAMPLE_COUNT_2_BIT = 0x00000002, 1081 VK_SAMPLE_COUNT_4_BIT = 0x00000004, 1082 VK_SAMPLE_COUNT_8_BIT = 0x00000008, 1083 VK_SAMPLE_COUNT_16_BIT = 0x00000010, 1084 VK_SAMPLE_COUNT_32_BIT = 0x00000020, 1085 VK_SAMPLE_COUNT_64_BIT = 0x00000040, 1086} 1087 1088type VkFlags VkStencilFaceFlags 1089bitfield VkStencilFaceFlagBits { 1090 VK_STENCIL_FACE_FRONT_BIT = 0x00000001, /// Front face 1091 VK_STENCIL_FACE_BACK_BIT = 0x00000002, /// Back face 1092 VK_STENCIL_FRONT_AND_BACK = 0x00000003, 1093} 1094 1095/// Instance creation flags 1096type VkFlags VkInstanceCreateFlags 1097//bitfield VkInstanceCreateFlagBits { 1098//} 1099 1100/// Device creation flags 1101type VkFlags VkDeviceCreateFlags 1102//bitfield VkDeviceCreateFlagBits { 1103//} 1104 1105/// Device queue creation flags 1106type VkFlags VkDeviceQueueCreateFlags 1107//bitfield VkDeviceQueueCreateFlagBits { 1108//} 1109 1110/// Query pool creation flags 1111type VkFlags VkQueryPoolCreateFlags 1112//bitfield VkQueryPoolCreateFlagBits { 1113//} 1114 1115/// Buffer view creation flags 1116type VkFlags VkBufferViewCreateFlags 1117//bitfield VkBufferViewCreateFlagBits { 1118//} 1119 1120/// Pipeline cache creation flags 1121type VkFlags VkPipelineCacheCreateFlags 1122//bitfield VkPipelineCacheCreateFlagBits { 1123//} 1124 1125/// Pipeline shader stage creation flags 1126type VkFlags VkPipelineShaderStageCreateFlags 1127//bitfield VkPipelineShaderStageCreateFlagBits { 1128//} 1129 1130/// Descriptor set layout creation flags 1131type VkFlags VkDescriptorSetLayoutCreateFlags 1132//bitfield VkDescriptorSetLayoutCreateFlagBits { 1133//} 1134 1135/// Pipeline vertex input state creation flags 1136type VkFlags VkPipelineVertexInputStateCreateFlags 1137//bitfield VkPipelineVertexInputStateCreateFlagBits { 1138//} 1139 1140/// Pipeline input assembly state creation flags 1141type VkFlags VkPipelineInputAssemblyStateCreateFlags 1142//bitfield VkPipelineInputAssemblyStateCreateFlagBits { 1143//} 1144 1145/// Tessellation state creation flags 1146type VkFlags VkPipelineTessellationStateCreateFlags 1147//bitfield VkPipelineTessellationStateCreateFlagBits { 1148//} 1149 1150/// Viewport state creation flags 1151type VkFlags VkPipelineViewportStateCreateFlags 1152//bitfield VkPipelineViewportStateCreateFlagBits { 1153//} 1154 1155/// Rasterization state creation flags 1156type VkFlags VkPipelineRasterizationStateCreateFlags 1157//bitfield VkPipelineRasterizationStateCreateFlagBits { 1158//} 1159 1160/// Multisample state creation flags 1161type VkFlags VkPipelineMultisampleStateCreateFlags 1162//bitfield VkPipelineMultisampleStateCreateFlagBits { 1163//} 1164 1165/// Color blend state creation flags 1166type VkFlags VkPipelineColorBlendStateCreateFlags 1167//bitfield VkPipelineColorBlendStateCreateFlagBits { 1168//} 1169 1170/// Depth/stencil state creation flags 1171type VkFlags VkPipelineDepthStencilStateCreateFlags 1172//bitfield VkPipelineDepthStencilStateCreateFlagBits { 1173//} 1174 1175/// Dynamic state creation flags 1176type VkFlags VkPipelineDynamicStateCreateFlags 1177//bitfield VkPipelineDynamicStateCreateFlagBits { 1178//} 1179 1180/// Pipeline layout creation flags 1181type VkFlags VkPipelineLayoutCreateFlags 1182//bitfield VkPipelineLayoutCreateFlagBits { 1183//} 1184 1185/// Sampler creation flags 1186type VkFlags VkSamplerCreateFlags 1187//bitfield VkSamplerCreateFlagBits { 1188//} 1189 1190/// Render pass creation flags 1191type VkFlags VkRenderPassCreateFlags 1192//bitfield VkRenderPassCreateFlagBits { 1193//} 1194 1195/// Framebuffer creation flags 1196type VkFlags VkFramebufferCreateFlags 1197//bitfield VkFramebufferCreateFlagBits { 1198//} 1199 1200/// Dependency flags 1201type VkFlags VkDependencyFlags 1202bitfield VkDependencyFlagBits { 1203 VK_DEPENDENCY_BY_REGION_BIT = 0x00000001, 1204} 1205 1206/// Cull mode flags 1207type VkFlags VkCullModeFlags 1208bitfield VkCullModeFlagBits { 1209 VK_CULL_MODE_NONE = 0x00000000, 1210 VK_CULL_MODE_FRONT_BIT = 0x00000001, 1211 VK_CULL_MODE_BACK_BIT = 0x00000002, 1212 VK_CULL_MODE_FRONT_AND_BACK = 0x00000003, 1213} 1214 1215@extension("VK_KHR_surface") 1216type VkFlags VkSurfaceTransformFlagsKHR 1217@extension("VK_KHR_surface") 1218bitfield VkSurfaceTransformFlagBitsKHR { 1219 VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 0x00000001, 1220 VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 0x00000002, 1221 VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 0x00000004, 1222 VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 0x00000008, 1223 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 0x00000010, 1224 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 0x00000020, 1225 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040, 1226 VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080, 1227 VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100, 1228} 1229 1230@extension("VK_KHR_surface") 1231type VkFlags VkCompositeAlphaFlagsKHR 1232@extension("VK_KHR_surface") 1233bitfield VkCompositeAlphaFlagBitsKHR { 1234 VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, 1235 VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002, 1236 VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004, 1237 VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008, 1238} 1239 1240@extension("VK_KHR_swapchain") 1241type VkFlags VkSwapchainCreateFlagsKHR 1242//@extension("VK_KHR_swapchain") 1243//bitfield VkSwapchainCreateFlagBitsKHR { 1244//} 1245 1246@extension("VK_KHR_display") 1247type VkFlags VkDisplayPlaneAlphaFlagsKHR 1248@extension("VK_KHR_display") 1249bitfield VkDisplayPlaneAlphaFlagBitsKHR { 1250 VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, 1251 VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002, 1252 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004, 1253 VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008, 1254} 1255 1256@extension("VK_KHR_display") 1257type VkFlags VkDisplaySurfaceCreateFlagsKHR 1258//@extension("VK_KHR_display") 1259//bitfield VkDisplaySurfaceCreateFlagBitsKHR { 1260//} 1261 1262@extension("VK_KHR_display") 1263type VkFlags VkDisplayModeCreateFlagsKHR 1264//@extension("VK_KHR_display") 1265//bitfield VkDisplayModeCreateFlagBitsKHR { 1266//} 1267 1268@extension("VK_KHR_xlib_surface") 1269type VkFlags VkXlibSurfaceCreateFlagsKHR 1270//@extension("VK_KHR_xlib_surface") 1271//bitfield VkXlibSurfaceCreateFlagBitsKHR { 1272//} 1273 1274@extension("VK_KHR_xcb_surface") 1275type VkFlags VkXcbSurfaceCreateFlagsKHR 1276//@extension("VK_KHR_xcb_surface") 1277//bitfield VkXcbSurfaceCreateFlagBitsKHR { 1278//} 1279 1280@extension("VK_KHR_wayland_surface") 1281type VkFlags VkWaylandSurfaceCreateFlagsKHR 1282//@extension("VK_KHR_wayland_surface") 1283//bitfield VkWaylandSurfaceCreateFlagBitsKHR { 1284//} 1285 1286@extension("VK_KHR_mir_surface") 1287type VkFlags VkMirSurfaceCreateFlagsKHR 1288//@extension("VK_KHR_mir_surface") 1289//bitfield VkMirSurfaceCreateFlagBitsKHR { 1290//} 1291 1292@extension("VK_KHR_android_surface") 1293type VkFlags VkAndroidSurfaceCreateFlagsKHR 1294//@extension("VK_KHR_android_surface") 1295//bitfield VkAndroidSurfaceCreateFlagBitsKHR { 1296//} 1297 1298@extension("VK_KHR_win32_surface") 1299type VkFlags VkWin32SurfaceCreateFlagsKHR 1300//@extension("VK_KHR_win32_surface") 1301//bitfield VkWin32SurfaceCreateFlagBitsKHR { 1302//} 1303 1304@extension("VK_EXT_debug_report") 1305type VkFlags VkDebugReportFlagsEXT 1306@extension("VK_EXT_debug_report") 1307bitfield VkDebugReportFlagBitsEXT { 1308 VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001, 1309 VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002, 1310 VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004, 1311 VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008, 1312 VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010, 1313} 1314 1315 1316////////////////// 1317// Structures // 1318////////////////// 1319 1320class VkOffset2D { 1321 s32 x 1322 s32 y 1323} 1324 1325class VkOffset3D { 1326 s32 x 1327 s32 y 1328 s32 z 1329} 1330 1331class VkExtent2D { 1332 u32 width 1333 u32 height 1334} 1335 1336class VkExtent3D { 1337 u32 width 1338 u32 height 1339 u32 depth 1340} 1341 1342class VkViewport { 1343 f32 x 1344 f32 y 1345 f32 width 1346 f32 height 1347 f32 minDepth 1348 f32 maxDepth 1349} 1350 1351class VkRect2D { 1352 VkOffset2D offset 1353 VkExtent2D extent 1354} 1355 1356class VkClearRect { 1357 VkRect2D rect 1358 u32 baseArrayLayer 1359 u32 layerCount 1360} 1361 1362class VkComponentMapping { 1363 VkComponentSwizzle r 1364 VkComponentSwizzle g 1365 VkComponentSwizzle b 1366 VkComponentSwizzle a 1367} 1368 1369class VkPhysicalDeviceProperties { 1370 u32 apiVersion 1371 u32 driverVersion 1372 u32 vendorID 1373 u32 deviceID 1374 VkPhysicalDeviceType deviceType 1375 char[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE] deviceName 1376 u8[VK_UUID_SIZE] pipelineCacheUUID 1377 VkPhysicalDeviceLimits limits 1378 VkPhysicalDeviceSparseProperties sparseProperties 1379} 1380 1381class VkExtensionProperties { 1382 char[VK_MAX_EXTENSION_NAME_SIZE] extensionName /// extension name 1383 u32 specVersion /// version of the extension specification implemented 1384} 1385 1386class VkLayerProperties { 1387 char[VK_MAX_EXTENSION_NAME_SIZE] layerName /// layer name 1388 u32 specVersion /// version of the layer specification implemented 1389 u32 implementationVersion /// build or release version of the layer's library 1390 char[VK_MAX_DESCRIPTION_SIZE] description /// Free-form description of the layer 1391} 1392 1393class VkSubmitInfo { 1394 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_SUBMIT_INFO 1395 const void* pNext /// Next structure in chain 1396 u32 waitSemaphoreCount 1397 const VkSemaphore* pWaitSemaphores 1398 const VkPipelineStageFlags* pWaitDstStageMask 1399 u32 commandBufferCount 1400 const VkCommandBuffer* pCommandBuffers 1401 u32 signalSemaphoreCount 1402 const VkSemaphore* pSignalSemaphores 1403} 1404 1405class VkApplicationInfo { 1406 VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO 1407 const void* pNext /// Next structure in chain 1408 const char* pApplicationName 1409 u32 applicationVersion 1410 const char* pEngineName 1411 u32 engineVersion 1412 u32 apiVersion 1413} 1414 1415class VkAllocationCallbacks { 1416 void* pUserData 1417 PFN_vkAllocationFunction pfnAllocation 1418 PFN_vkReallocationFunction pfnReallocation 1419 PFN_vkFreeFunction pfnFree 1420 PFN_vkInternalAllocationNotification pfnInternalAllocation 1421 PFN_vkInternalFreeNotification pfnInternalFree 1422} 1423 1424class VkDeviceQueueCreateInfo { 1425 VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO 1426 const void* pNext /// Pointer to next structure 1427 VkDeviceQueueCreateFlags flags 1428 u32 queueFamilyIndex 1429 u32 queueCount 1430 const f32* pQueuePriorities 1431} 1432 1433class VkDeviceCreateInfo { 1434 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO 1435 const void* pNext /// Pointer to next structure 1436 VkDeviceCreateFlags flags 1437 u32 queueCreateInfoCount 1438 const VkDeviceQueueCreateInfo* pQueueCreateInfos 1439 u32 enabledLayerCount 1440 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled 1441 u32 enabledExtensionCount 1442 const char* const* ppEnabledExtensionNames 1443 const VkPhysicalDeviceFeatures* pEnabledFeatures 1444} 1445 1446class VkInstanceCreateInfo { 1447 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO 1448 const void* pNext /// Pointer to next structure 1449 VkInstanceCreateFlags flags 1450 const VkApplicationInfo* pApplicationInfo 1451 u32 enabledLayerCount 1452 const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled 1453 u32 enabledExtensionCount 1454 const char* const* ppEnabledExtensionNames /// Extension names to be enabled 1455} 1456 1457class VkQueueFamilyProperties { 1458 VkQueueFlags queueFlags /// Queue flags 1459 u32 queueCount 1460 u32 timestampValidBits 1461 VkExtent3D minImageTransferGranularity 1462} 1463 1464class VkPhysicalDeviceMemoryProperties { 1465 u32 memoryTypeCount 1466 VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes 1467 u32 memoryHeapCount 1468 VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps 1469} 1470 1471class VkMemoryAllocateInfo { 1472 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO 1473 const void* pNext /// Pointer to next structure 1474 VkDeviceSize allocationSize /// Size of memory allocation 1475 u32 memoryTypeIndex /// Index of the of the memory type to allocate from 1476} 1477 1478class VkMemoryRequirements { 1479 VkDeviceSize size /// Specified in bytes 1480 VkDeviceSize alignment /// Specified in bytes 1481 u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object 1482} 1483 1484class VkSparseImageFormatProperties { 1485 VkImageAspectFlagBits aspectMask 1486 VkExtent3D imageGranularity 1487 VkSparseImageFormatFlags flags 1488} 1489 1490class VkSparseImageMemoryRequirements { 1491 VkSparseImageFormatProperties formatProperties 1492 u32 imageMipTailFirstLod 1493 VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment 1494 VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment 1495 VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment 1496} 1497 1498class VkMemoryType { 1499 VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type 1500 u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from 1501} 1502 1503class VkMemoryHeap { 1504 VkDeviceSize size /// Available memory in the heap 1505 VkMemoryHeapFlags flags /// Flags for the heap 1506} 1507 1508class VkMappedMemoryRange { 1509 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE 1510 const void* pNext /// Pointer to next structure 1511 VkDeviceMemory memory /// Mapped memory object 1512 VkDeviceSize offset /// Offset within the mapped memory the range starts from 1513 VkDeviceSize size /// Size of the range within the mapped memory 1514} 1515 1516class VkFormatProperties { 1517 VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling 1518 VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling 1519 VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers 1520} 1521 1522class VkImageFormatProperties { 1523 VkExtent3D maxExtent /// max image dimensions for this resource type 1524 u32 maxMipLevels /// max number of mipmap levels for this resource type 1525 u32 maxArrayLayers /// max array layers for this resource type 1526 VkSampleCountFlags sampleCounts /// supported sample counts for this resource type 1527 VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type 1528} 1529 1530class VkDescriptorImageInfo { 1531 VkSampler sampler 1532 VkImageView imageView 1533 VkImageLayout imageLayout 1534} 1535 1536class VkDescriptorBufferInfo { 1537 VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC] 1538 VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set. 1539 VkDeviceSize range /// Size in bytes of the buffer resource for this descriptor update. 1540} 1541 1542class VkWriteDescriptorSet { 1543 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET 1544 const void* pNext /// Pointer to next structure 1545 VkDescriptorSet dstSet /// Destination descriptor set 1546 u32 dstBinding /// Binding within the destination descriptor set to write 1547 u32 dstArrayElement /// Array element within the destination binding to write 1548 u32 descriptorCount /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>) 1549 VkDescriptorType descriptorType /// Descriptor type to write (determines which fields of the array pointed by <pDescriptors> are going to be used) 1550 const VkDescriptorImageInfo* pImageInfo 1551 const VkDescriptorBufferInfo* pBufferInfo 1552 const VkBufferView* pTexelBufferView 1553} 1554 1555class VkCopyDescriptorSet { 1556 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET 1557 const void* pNext /// Pointer to next structure 1558 VkDescriptorSet srcSet /// Source descriptor set 1559 u32 srcBinding /// Binding within the source descriptor set to copy from 1560 u32 srcArrayElement /// Array element within the source binding to copy from 1561 VkDescriptorSet dstSet /// Destination descriptor set 1562 u32 dstBinding /// Binding within the destination descriptor set to copy to 1563 u32 dstArrayElement /// Array element within the destination binding to copy to 1564 u32 descriptorCount /// Number of descriptors to copy 1565} 1566 1567class VkBufferCreateInfo { 1568 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO 1569 const void* pNext /// Pointer to next structure. 1570 VkBufferCreateFlags flags /// Buffer creation flags 1571 VkDeviceSize size /// Specified in bytes 1572 VkBufferUsageFlags usage /// Buffer usage flags 1573 VkSharingMode sharingMode 1574 u32 queueFamilyIndexCount 1575 const u32* pQueueFamilyIndices 1576} 1577 1578class VkBufferViewCreateInfo { 1579 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO 1580 const void* pNext /// Pointer to next structure. 1581 VkBufferViewCreateFlags flags 1582 VkBuffer buffer 1583 VkFormat format /// Optionally specifies format of elements 1584 VkDeviceSize offset /// Specified in bytes 1585 VkDeviceSize range /// View size specified in bytes 1586} 1587 1588class VkImageSubresource { 1589 VkImageAspectFlagBits aspectMask 1590 u32 mipLevel 1591 u32 arrayLayer 1592} 1593 1594class VkImageSubresourceRange { 1595 VkImageAspectFlags aspectMask 1596 u32 baseMipLevel 1597 u32 levelCount 1598 u32 baseArrayLayer 1599 u32 layerCount 1600} 1601 1602class VkMemoryBarrier { 1603 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER 1604 const void* pNext /// Pointer to next structure. 1605 VkAccessFlags srcAccessMask 1606 VkAccessFlags dstAccessMask 1607} 1608 1609class VkBufferMemoryBarrier { 1610 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER 1611 const void* pNext /// Pointer to next structure. 1612 VkAccessFlags srcAccessMask 1613 VkAccessFlags dstAccessMask 1614 u32 srcQueueFamilyIndex /// Queue family to transition ownership from 1615 u32 dstQueueFamilyIndex /// Queue family to transition ownership to 1616 VkBuffer buffer /// Buffer to sync 1617 VkDeviceSize offset /// Offset within the buffer to sync 1618 VkDeviceSize size /// Amount of bytes to sync 1619} 1620 1621class VkImageMemoryBarrier { 1622 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER 1623 const void* pNext /// Pointer to next structure. 1624 VkAccessFlags srcAccessMask 1625 VkAccessFlags dstAccessMask 1626 VkImageLayout oldLayout /// Current layout of the image 1627 VkImageLayout newLayout /// New layout to transition the image to 1628 u32 srcQueueFamilyIndex /// Queue family to transition ownership from 1629 u32 dstQueueFamilyIndex /// Queue family to transition ownership to 1630 VkImage image /// Image to sync 1631 VkImageSubresourceRange subresourceRange /// Subresource range to sync 1632} 1633 1634class VkImageCreateInfo { 1635 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO 1636 const void* pNext /// Pointer to next structure. 1637 VkImageCreateFlags flags /// Image creation flags 1638 VkImageType imageType 1639 VkFormat format 1640 VkExtent3D extent 1641 u32 mipLevels 1642 u32 arrayLayers 1643 VkSampleCountFlagBits samples 1644 VkImageTiling tiling 1645 VkImageUsageFlags usage /// Image usage flags 1646 VkSharingMode sharingMode /// Cross-queue-family sharing mode 1647 u32 queueFamilyIndexCount /// Number of queue families to share across 1648 const u32* pQueueFamilyIndices /// Array of queue family indices to share across 1649 VkImageLayout initialLayout /// Initial image layout for all subresources 1650} 1651 1652class VkSubresourceLayout { 1653 VkDeviceSize offset /// Specified in bytes 1654 VkDeviceSize size /// Specified in bytes 1655 VkDeviceSize rowPitch /// Specified in bytes 1656 VkDeviceSize arrayPitch /// Specified in bytes 1657 VkDeviceSize depthPitch /// Specified in bytes 1658} 1659 1660class VkImageViewCreateInfo { 1661 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO 1662 const void* pNext /// Pointer to next structure 1663 VkImageViewCreateFlags flags 1664 VkImage image 1665 VkImageViewType viewType 1666 VkFormat format 1667 VkComponentMapping components 1668 VkImageSubresourceRange subresourceRange 1669} 1670 1671class VkBufferCopy { 1672 VkDeviceSize srcOffset /// Specified in bytes 1673 VkDeviceSize dstOffset /// Specified in bytes 1674 VkDeviceSize size /// Specified in bytes 1675} 1676 1677class VkSparseMemoryBind { 1678 VkDeviceSize resourceOffset /// Specified in bytes 1679 VkDeviceSize size /// Specified in bytes 1680 VkDeviceMemory memory 1681 VkDeviceSize memoryOffset /// Specified in bytes 1682 VkSparseMemoryBindFlags flags 1683} 1684 1685class VkSparseImageMemoryBind { 1686 VkImageSubresource subresource 1687 VkOffset3D offset 1688 VkExtent3D extent 1689 VkDeviceMemory memory 1690 VkDeviceSize memoryOffset /// Specified in bytes 1691 VkSparseMemoryBindFlags flags 1692} 1693 1694class VkSparseBufferMemoryBindInfo { 1695 VkBuffer buffer 1696 u32 bindCount 1697 const VkSparseMemoryBind* pBinds 1698} 1699 1700class VkSparseImageOpaqueMemoryBindInfo { 1701 VkImage image 1702 u32 bindCount 1703 const VkSparseMemoryBind* pBinds 1704} 1705 1706class VkSparseImageMemoryBindInfo { 1707 VkImage image 1708 u32 bindCount 1709 const VkSparseMemoryBind* pBinds 1710} 1711 1712class VkBindSparseInfo { 1713 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BIND_SPARSE_INFO 1714 const void* pNext 1715 u32 waitSemaphoreCount 1716 const VkSemaphore* pWaitSemaphores 1717 u32 numBufferBinds 1718 const VkSparseBufferMemoryBindInfo* pBufferBinds 1719 u32 numImageOpaqueBinds 1720 const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds 1721 u32 numImageBinds 1722 const VkSparseImageMemoryBindInfo* pImageBinds 1723 u32 signalSemaphoreCount 1724 const VkSemaphore* pSignalSemaphores 1725} 1726 1727class VkImageSubresourceLayers { 1728 VkImageAspectFlags aspectMask 1729 u32 mipLevel 1730 u32 baseArrayLayer 1731 u32 layerCount 1732} 1733 1734class VkImageCopy { 1735 VkImageSubresourceLayers srcSubresource 1736 VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images 1737 VkImageSubresourceLayers dstSubresource 1738 VkOffset3D dstOffset /// Specified in pixels for both compressed and uncompressed images 1739 VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images 1740} 1741 1742class VkImageBlit { 1743 VkImageSubresourceLayers srcSubresource 1744 VkOffset3D[2] srcOffsets 1745 VkImageSubresourceLayers dstSubresource 1746 VkOffset3D[2] dstOffsets 1747} 1748 1749class VkBufferImageCopy { 1750 VkDeviceSize bufferOffset /// Specified in bytes 1751 u32 bufferRowLength /// Specified in texels 1752 u32 bufferImageHeight 1753 VkImageSubresourceLayers imageSubresource 1754 VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images 1755 VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images 1756} 1757 1758class VkImageResolve { 1759 VkImageSubresourceLayers srcSubresource 1760 VkOffset3D srcOffset 1761 VkImageSubresourceLayers dstSubresource 1762 VkOffset3D dstOffset 1763 VkExtent3D extent 1764} 1765 1766class VkShaderModuleCreateInfo { 1767 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO 1768 const void* pNext /// Pointer to next structure 1769 VkShaderModuleCreateFlags flags /// Reserved 1770 platform.size_t codeSize /// Specified in bytes 1771 const u32* pCode /// Binary code of size codeSize 1772} 1773 1774class VkDescriptorSetLayoutBinding { 1775 u32 binding 1776 VkDescriptorType descriptorType /// Type of the descriptors in this binding 1777 u32 descriptorCount /// Number of descriptors in this binding 1778 VkShaderStageFlags stageFlags /// Shader stages this binding is visible to 1779 const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements) 1780} 1781 1782class VkDescriptorSetLayoutCreateInfo { 1783 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO 1784 const void* pNext /// Pointer to next structure 1785 VkDescriptorSetLayoutCreateFlags flags 1786 u32 bindingCount /// Number of bindings in the descriptor set layout 1787 const VkDescriptorSetLayoutBinding* pBindings /// Array of descriptor set layout bindings 1788} 1789 1790class VkDescriptorPoolSize { 1791 VkDescriptorType type 1792 u32 descriptorCount 1793} 1794 1795class VkDescriptorPoolCreateInfo { 1796 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO 1797 const void* pNext /// Pointer to next structure 1798 VkDescriptorPoolCreateFlags flags 1799 u32 maxSets 1800 u32 poolSizeCount 1801 const VkDescriptorPoolSize* pPoolSizes 1802} 1803 1804class VkDescriptorSetAllocateInfo { 1805 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO 1806 const void* pNext /// Pointer to next structure 1807 VkDescriptorPool descriptorPool 1808 u32 setCount 1809 const VkDescriptorSetLayout* pSetLayouts 1810} 1811 1812class VkSpecializationMapEntry { 1813 u32 constantID /// The SpecConstant ID specified in the BIL 1814 u32 offset /// Offset of the value in the data block 1815 platform.size_t size /// Size in bytes of the SpecConstant 1816} 1817 1818class VkSpecializationInfo { 1819 u32 mapEntryCount /// Number of entries in the map 1820 const VkSpecializationMapEntry* pMapEntries /// Array of map entries 1821 platform.size_t dataSize /// Size in bytes of pData 1822 const void* pData /// Pointer to SpecConstant data 1823} 1824 1825class VkPipelineShaderStageCreateInfo { 1826 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO 1827 const void* pNext /// Pointer to next structure 1828 VkPipelineShaderStageCreateFlags flags 1829 VkShaderStageFlagBits stage 1830 VkShaderModule module 1831 const char* pName 1832 const VkSpecializationInfo* pSpecializationInfo 1833} 1834 1835class VkComputePipelineCreateInfo { 1836 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO 1837 const void* pNext /// Pointer to next structure 1838 VkPipelineCreateFlags flags /// Pipeline creation flags 1839 VkPipelineShaderStageCreateInfo stage 1840 VkPipelineLayout layout /// Interface layout of the pipeline 1841 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 1842 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 1843} 1844 1845class VkVertexInputBindingDescription { 1846 u32 binding /// Vertex buffer binding id 1847 u32 stride /// Distance between vertices in bytes (0 = no advancement) 1848 VkVertexInputRate inputRate /// Rate at which binding is incremented 1849} 1850 1851class VkVertexInputAttributeDescription { 1852 u32 location /// location of the shader vertex attrib 1853 u32 binding /// Vertex buffer binding id 1854 VkFormat format /// format of source data 1855 u32 offset /// Offset of first element in bytes from base of vertex 1856} 1857 1858class VkPipelineVertexInputStateCreateInfo { 1859 VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO 1860 const void* pNext /// Pointer to next structure 1861 VkPipelineVertexInputStateCreateFlags flags 1862 u32 vertexBindingDescriptionCount /// number of bindings 1863 const VkVertexInputBindingDescription* pVertexBindingDescriptions 1864 u32 vertexAttributeDescriptionCount /// number of attributes 1865 const VkVertexInputAttributeDescription* pVertexAttributeDescriptions 1866} 1867 1868class VkPipelineInputAssemblyStateCreateInfo { 1869 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO 1870 const void* pNext /// Pointer to next structure 1871 VkPipelineInputAssemblyStateCreateFlags flags 1872 VkPrimitiveTopology topology 1873 VkBool32 primitiveRestartEnable 1874} 1875 1876class VkPipelineTessellationStateCreateInfo { 1877 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO 1878 const void* pNext /// Pointer to next structure 1879 VkPipelineTessellationStateCreateFlags flags 1880 u32 patchControlPoints 1881} 1882 1883class VkPipelineViewportStateCreateInfo { 1884 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO 1885 const void* pNext /// Pointer to next structure 1886 VkPipelineViewportStateCreateFlags flags 1887 u32 viewportCount 1888 const VkViewport* pViewports 1889 u32 scissorCount 1890 const VkRect2D* pScissors 1891} 1892 1893class VkPipelineRasterizationStateCreateInfo { 1894 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO 1895 const void* pNext /// Pointer to next structure 1896 VkPipelineRasterizationStateCreateFlags flags 1897 VkBool32 depthClampEnable 1898 VkBool32 rasterizerDiscardEnable 1899 VkPolygonMode polygonMode /// optional (GL45) 1900 VkCullModeFlags cullMode 1901 VkFrontFace frontFace 1902 VkBool32 depthBiasEnable 1903 f32 depthBiasConstantFactor 1904 f32 depthBiasClamp 1905 f32 depthBiasSlopeFactor 1906 f32 lineWidth 1907} 1908 1909class VkPipelineMultisampleStateCreateInfo { 1910 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO 1911 const void* pNext /// Pointer to next structure 1912 VkPipelineMultisampleStateCreateFlags flags 1913 VkSampleCountFlagBits rasterizationSamples /// Number of samples used for rasterization 1914 VkBool32 sampleShadingEnable /// optional (GL45) 1915 f32 minSampleShading /// optional (GL45) 1916 const VkSampleMask* pSampleMask 1917 VkBool32 alphaToCoverageEnable 1918 VkBool32 alphaToOneEnable 1919} 1920 1921class VkPipelineColorBlendAttachmentState { 1922 VkBool32 blendEnable 1923 VkBlendFactor srcColorBlendFactor 1924 VkBlendFactor dstColorBlendFactor 1925 VkBlendOp colorBlendOp 1926 VkBlendFactor srcAlphaBlendFactor 1927 VkBlendFactor dstAlphaBlendFactor 1928 VkBlendOp alphaBlendOp 1929 VkColorComponentFlags colorWriteMask 1930} 1931 1932class VkPipelineColorBlendStateCreateInfo { 1933 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO 1934 const void* pNext /// Pointer to next structure 1935 VkPipelineColorBlendStateCreateFlags flags 1936 VkBool32 logicOpEnable 1937 VkLogicOp logicOp 1938 u32 attachmentCount /// # of pAttachments 1939 const VkPipelineColorBlendAttachmentState* pAttachments 1940 f32[4] blendConstants 1941} 1942 1943class VkStencilOpState { 1944 VkStencilOp failOp 1945 VkStencilOp passOp 1946 VkStencilOp depthFailOp 1947 VkCompareOp compareOp 1948 u32 compareMask 1949 u32 writeMask 1950 u32 reference 1951} 1952 1953class VkPipelineDepthStencilStateCreateInfo { 1954 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO 1955 const void* pNext /// Pointer to next structure 1956 VkPipelineDepthStencilStateCreateFlags flags 1957 VkBool32 depthTestEnable 1958 VkBool32 depthWriteEnable 1959 VkCompareOp depthCompareOp 1960 VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test) 1961 VkBool32 stencilTestEnable 1962 VkStencilOpState front 1963 VkStencilOpState back 1964 f32 minDepthBounds 1965 f32 maxDepthBounds 1966} 1967 1968class VkPipelineDynamicStateCreateInfo { 1969 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO 1970 const void* pNext /// Pointer to next structure 1971 VkPipelineDynamicStateCreateFlags flags 1972 u32 dynamicStateCount 1973 const VkDynamicState* pDynamicStates 1974} 1975 1976class VkGraphicsPipelineCreateInfo { 1977 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO 1978 const void* pNext /// Pointer to next structure 1979 VkPipelineCreateFlags flags /// Pipeline creation flags 1980 u32 stageCount 1981 const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage 1982 const VkPipelineVertexInputStateCreateInfo* pVertexInputState 1983 const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState 1984 const VkPipelineTessellationStateCreateInfo* pTessellationState 1985 const VkPipelineViewportStateCreateInfo* pViewportState 1986 const VkPipelineRasterizationStateCreateInfo* pRasterizationState 1987 const VkPipelineMultisampleStateCreateInfo* pMultisampleState 1988 const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState 1989 const VkPipelineColorBlendStateCreateInfo* pColorBlendState 1990 const VkPipelineDynamicStateCreateInfo* pDynamicState 1991 VkPipelineLayout layout /// Interface layout of the pipeline 1992 VkRenderPass renderPass 1993 u32 subpass 1994 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 1995 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 1996} 1997 1998class VkPipelineCacheCreateInfo { 1999 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO 2000 const void* pNext /// Pointer to next structure 2001 VkPipelineCacheCreateFlags flags 2002 platform.size_t initialDataSize /// Size of initial data to populate cache, in bytes 2003 const void* pInitialData /// Initial data to populate cache 2004} 2005 2006class VkPushConstantRange { 2007 VkShaderStageFlags stageFlags /// Which stages use the range 2008 u32 offset /// Start of the range, in bytes 2009 u32 size /// Length of the range, in bytes 2010} 2011 2012class VkPipelineLayoutCreateInfo { 2013 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO 2014 const void* pNext /// Pointer to next structure 2015 VkPipelineLayoutCreateFlags flags 2016 u32 descriptorSetCount /// Number of descriptor sets interfaced by the pipeline 2017 const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the 2018 u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline 2019 const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages 2020} 2021 2022class VkSamplerCreateInfo { 2023 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO 2024 const void* pNext /// Pointer to next structure 2025 VkSamplerCreateFlags flags 2026 VkFilter magFilter /// Filter mode for magnification 2027 VkFilter minFilter /// Filter mode for minifiation 2028 VkSamplerMipmapMode mipmapMode /// Mipmap selection mode 2029 VkSamplerAddressMode addressModeU 2030 VkSamplerAddressMode addressModeV 2031 VkSamplerAddressMode addressModeW 2032 f32 mipLodBias 2033 VkBool32 anisotropyEnable 2034 f32 maxAnisotropy 2035 VkBool32 compareEnable 2036 VkCompareOp compareOp 2037 f32 minLod 2038 f32 maxLod 2039 VkBorderColor borderColor 2040 VkBool32 unnormalizedCoordinates 2041} 2042 2043class VkCommandPoolCreateInfo { 2044 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO 2045 const void* pNext /// Pointer to next structure 2046 VkCommandPoolCreateFlags flags /// Command pool creation flags 2047 u32 queueFamilyIndex 2048} 2049 2050class VkCommandBufferAllocateInfo { 2051 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO 2052 const void* pNext /// Pointer to next structure 2053 VkCommandPool commandPool 2054 VkCommandBufferLevel level 2055 u32 commandBufferCount 2056} 2057 2058class VkCommandBufferInheritanceInfo { 2059 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO 2060 const void* pNext /// Pointer to next structure 2061 VkRenderPass renderPass /// Render pass for secondary command buffers 2062 u32 subpass 2063 VkFramebuffer framebuffer /// Framebuffer for secondary command buffers 2064 VkBool32 occlusionQueryEnable 2065 VkQueryControlFlags queryFlags 2066 VkQueryPipelineStatisticFlags pipelineStatistics 2067} 2068 2069class VkCommandBufferBeginInfo { 2070 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO 2071 const void* pNext /// Pointer to next structure 2072 VkCommandBufferUsageFlags flags /// Command buffer usage flags 2073 const VkCommandBufferInheritanceInfo* pInheritanceInfo 2074} 2075 2076class VkRenderPassBeginInfo { 2077 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO 2078 const void* pNext /// Pointer to next structure 2079 VkRenderPass renderPass 2080 VkFramebuffer framebuffer 2081 VkRect2D renderArea 2082 u32 clearValueCount 2083 const VkClearValue* pClearValues 2084} 2085 2086@union 2087/// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared. 2088class VkClearColorValue { 2089 f32[4] float32 2090 s32[4] int32 2091 u32[4] uint32 2092} 2093 2094class VkClearDepthStencilValue { 2095 f32 depth 2096 u32 stencil 2097} 2098 2099@union 2100/// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared. 2101class VkClearValue { 2102 VkClearColorValue color 2103 VkClearDepthStencilValue depthStencil 2104} 2105 2106class VkClearAttachment { 2107 VkImageAspectFlags aspectMask 2108 u32 colorAttachment 2109 VkClearValue clearValue 2110} 2111 2112class VkAttachmentDescription { 2113 VkAttachmentDescriptionFlags flags 2114 VkFormat format 2115 VkSampleCountFlagBits samples 2116 VkAttachmentLoadOp loadOp /// Load op for color or depth data 2117 VkAttachmentStoreOp storeOp /// Store op for color or depth data 2118 VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data 2119 VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data 2120 VkImageLayout initialLayout 2121 VkImageLayout finalLayout 2122} 2123 2124class VkAttachmentReference { 2125 u32 attachment 2126 VkImageLayout layout 2127} 2128 2129class VkSubpassDescription { 2130 VkSubpassDescriptionFlags flags 2131 VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now 2132 u32 inputAttachmentCount 2133 const VkAttachmentReference* pInputAttachments 2134 u32 colorAttachmentCount 2135 const VkAttachmentReference* pColorAttachments 2136 const VkAttachmentReference* pResolveAttachments 2137 const VkAttachmentReference* pDepthStencilAttachment 2138 u32 preserveAttachmentCount 2139 const u32* pPreserveAttachments 2140} 2141 2142class VkSubpassDependency { 2143 u32 srcSubpass 2144 u32 dstSubpass 2145 VkPipelineStageFlags srcStageMask 2146 VkPipelineStageFlags dstStageMask 2147 VkAccessFlags srcAccessMask 2148 VkAccessFlags dstAccessMask 2149 VkDependencyFlags dependencyFlags 2150} 2151 2152class VkRenderPassCreateInfo { 2153 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO 2154 const void* pNext /// Pointer to next structure 2155 VkRenderPassCreateFlags flags 2156 u32 attachmentCount 2157 const VkAttachmentDescription* pAttachments 2158 u32 subpassCount 2159 const VkSubpassDescription* pSubpasses 2160 u32 dependencyCount 2161 const VkSubpassDependency* pDependencies 2162} 2163 2164class VkEventCreateInfo { 2165 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO 2166 const void* pNext /// Pointer to next structure 2167 VkEventCreateFlags flags /// Event creation flags 2168} 2169 2170class VkFenceCreateInfo { 2171 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO 2172 const void* pNext /// Pointer to next structure 2173 VkFenceCreateFlags flags /// Fence creation flags 2174} 2175 2176class VkPhysicalDeviceFeatures { 2177 VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined 2178 VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls 2179 VkBool32 imageCubeArray /// image views which are arrays of cube maps 2180 VkBool32 independentBlend /// blending operations are controlled per-attachment 2181 VkBool32 geometryShader /// geometry stage 2182 VkBool32 tessellationShader /// tessellation control and evaluation stage 2183 VkBool32 sampleRateShading /// per-sample shading and interpolation 2184 VkBool32 dualSrcBlend /// blend operations which take two sources 2185 VkBool32 logicOp /// logic operations 2186 VkBool32 multiDrawIndirect /// multi draw indirect 2187 VkBool32 drawIndirectFirstInstance 2188 VkBool32 depthClamp /// depth clamping 2189 VkBool32 depthBiasClamp /// depth bias clamping 2190 VkBool32 fillModeNonSolid /// point and wireframe fill modes 2191 VkBool32 depthBounds /// depth bounds test 2192 VkBool32 wideLines /// lines with width greater than 1 2193 VkBool32 largePoints /// points with size greater than 1 2194 VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value 2195 VkBool32 multiViewport 2196 VkBool32 samplerAnisotropy 2197 VkBool32 textureCompressionETC2 /// ETC texture compression formats 2198 VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats 2199 VkBool32 textureCompressionBC /// BC1-7 texture compressed formats 2200 VkBool32 occlusionQueryPrecise 2201 VkBool32 pipelineStatisticsQuery /// pipeline statistics query 2202 VkBool32 vertexPipelineStoresAndAtomics 2203 VkBool32 fragmentStoresAndAtomics 2204 VkBool32 shaderTessellationAndGeometryPointSize 2205 VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets 2206 VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images 2207 VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images 2208 VkBool32 shaderStorageImageReadWithoutFormat 2209 VkBool32 shaderStorageImageWriteWithoutFormat 2210 VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices 2211 VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices 2212 VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices 2213 VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices 2214 VkBool32 shaderClipDistance /// clip distance in shaders 2215 VkBool32 shaderCullDistance /// cull distance in shaders 2216 VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders 2217 VkBool32 shaderInt64 /// 64-bit integers in shaders 2218 VkBool32 shaderInt16 /// 16-bit integers in shaders 2219 VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support) 2220 VkBool32 shaderResourceMinLod /// shader can use texture operations that specify minimum resource LOD 2221 VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level 2222 VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers 2223 VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images 2224 VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images 2225 VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples 2226 VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples 2227 VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples 2228 VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples 2229 VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in) 2230 VkBool32 variableMultisampleRate 2231 VkBool32 inheritedQueries 2232} 2233 2234class VkPhysicalDeviceLimits { 2235 /// resource maximum sizes 2236 u32 maxImageDimension1D /// max 1D image dimension 2237 u32 maxImageDimension2D /// max 2D image dimension 2238 u32 maxImageDimension3D /// max 3D image dimension 2239 u32 maxImageDimensionCube /// max cubemap image dimension 2240 u32 maxImageArrayLayers /// max layers for image arrays 2241 u32 maxTexelBufferElements 2242 u32 maxUniformBufferRange /// max uniform buffer size (bytes) 2243 u32 maxStorageBufferRange /// max storage buffer size (bytes) 2244 u32 maxPushConstantsSize /// max size of the push constants pool (bytes) 2245 /// memory limits 2246 u32 maxMemoryAllocationCount /// max number of device memory allocations supported 2247 u32 maxSamplerAllocationCount 2248 VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage 2249 VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes) 2250 /// descriptor set limits 2251 u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline 2252 u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set 2253 u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set 2254 u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set 2255 u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set 2256 u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set 2257 u32 maxPerStageDescriptorInputAttachments 2258 u32 maxPerStageResources 2259 u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set 2260 u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set 2261 u32 maxDescriptorSetUniformBuffersDynamic /// max num of dynamic uniform buffers allowed in all stages in a descriptor set 2262 u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set 2263 u32 maxDescriptorSetStorageBuffersDynamic /// max num of dynamic storage buffers allowed in all stages in a descriptor set 2264 u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set 2265 u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set 2266 u32 maxDescriptorSetInputAttachments 2267 /// vertex stage limits 2268 u32 maxVertexInputAttributes /// max num of vertex input attribute slots 2269 u32 maxVertexInputBindings /// max num of vertex input binding slots 2270 u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset 2271 u32 maxVertexInputBindingStride /// max vertex input binding stride 2272 u32 maxVertexOutputComponents /// max num of output components written by vertex shader 2273 /// tessellation control stage limits 2274 u32 maxTessellationGenerationLevel /// max level supported by tess primitive generator 2275 u32 maxTessellationPatchSize /// max patch size (vertices) 2276 u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS 2277 u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS 2278 u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS 2279 u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS 2280 u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES 2281 u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES 2282 /// geometry stage limits 2283 u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader 2284 u32 maxGeometryInputComponents /// max num of input components read in geometry stage 2285 u32 maxGeometryOutputComponents /// max num of output components written in geometry stage 2286 u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage 2287 u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage 2288 /// fragment stage limits 2289 u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage 2290 u32 maxFragmentOutputAttachments /// max num of output attachments written in fragment stage 2291 u32 maxFragmentDualSrcAttachments /// max num of output attachments written when using dual source blending 2292 u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers 2293 /// compute stage limits 2294 u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes) 2295 u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z) 2296 u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group 2297 u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z) 2298 2299 u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y 2300 u32 subTexelPrecisionBits /// num bits of subtexel precision 2301 u32 mipmapPrecisionBits /// num bits of mipmap precision 2302 2303 u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices) 2304 u32 maxDrawIndirectCount 2305 2306 f32 maxSamplerLodBias /// max absolute sampler level of detail bias 2307 f32 maxSamplerAnisotropy /// max degree of sampler anisotropy 2308 2309 u32 maxViewports /// max number of active viewports 2310 u32[2] maxViewportDimensions /// max viewport dimensions (x,y) 2311 f32[2] viewportBoundsRange /// viewport bounds range (min,max) 2312 u32 viewportSubPixelBits /// num bits of subpixel precision for viewport 2313 2314 platform.size_t minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes) 2315 VkDeviceSize minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes) 2316 VkDeviceSize minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes) 2317 VkDeviceSize minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes) 2318 2319 s32 minTexelOffset /// min texel offset for OpTextureSampleOffset 2320 u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset 2321 s32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset 2322 u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset 2323 f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset 2324 f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset 2325 u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset 2326 2327 u32 maxFramebufferWidth /// max width for a framebuffer 2328 u32 maxFramebufferHeight /// max height for a framebuffer 2329 u32 maxFramebufferLayers /// max layer count for a layered framebuffer 2330 VkSampleCountFlags framebufferColorSampleCounts 2331 VkSampleCountFlags framebufferDepthSampleCounts 2332 VkSampleCountFlags framebufferStencilSampleCounts 2333 VkSampleCountFlags framebufferNoAttachmentSampleCounts 2334 u32 maxColorAttachments /// max num of framebuffer color attachments 2335 2336 VkSampleCountFlags sampledImageColorSampleCounts 2337 VkSampleCountFlags sampledImageIntegerSampleCounts 2338 VkSampleCountFlags sampledImageDepthSampleCounts 2339 VkSampleCountFlags sampledImageStencilSampleCounts 2340 VkSampleCountFlags storageImageSampleCounts 2341 u32 maxSampleMaskWords /// max num of sample mask words 2342 VkBool32 timestampComputeAndGraphics 2343 2344 f32 timestampPeriod 2345 2346 u32 maxClipDistances /// max number of clip distances 2347 u32 maxCullDistances /// max number of cull distances 2348 u32 maxCombinedClipAndCullDistances /// max combined number of user clipping 2349 2350 u32 discreteQueuePriorities 2351 2352 f32[2] pointSizeRange /// range (min,max) of supported point sizes 2353 f32[2] lineWidthRange /// range (min,max) of supported line widths 2354 f32 pointSizeGranularity /// granularity of supported point sizes 2355 f32 lineWidthGranularity /// granularity of supported line widths 2356 VkBool32 strictLines 2357 VkBool32 standardSampleLocations 2358 2359 VkDeviceSize optimalBufferCopyOffsetAlignment 2360 VkDeviceSize optimalBufferCopyRowPitchAlignment 2361 VkDeviceSize nonCoherentAtomSize 2362} 2363 2364class VkPhysicalDeviceSparseProperties { 2365 VkBool32 residencyStandard2DBlockShape /// Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard block shapes (based on pixel format) 2366 VkBool32 residencyStandard2DMultisampleBlockShape /// Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard block shapes (based on pixel format) 2367 VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format) 2368 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 2369 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 2370} 2371 2372class VkSemaphoreCreateInfo { 2373 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO 2374 const void* pNext /// Pointer to next structure 2375 VkSemaphoreCreateFlags flags /// Semaphore creation flags 2376} 2377 2378class VkQueryPoolCreateInfo { 2379 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO 2380 const void* pNext /// Pointer to next structure 2381 VkQueryPoolCreateFlags flags 2382 VkQueryType queryType 2383 u32 queryCount 2384 VkQueryPipelineStatisticFlags pipelineStatistics /// Optional 2385} 2386 2387class VkFramebufferCreateInfo { 2388 VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO 2389 const void* pNext /// Pointer to next structure 2390 VkFramebufferCreateFlags flags 2391 VkRenderPass renderPass 2392 u32 attachmentCount 2393 const VkImageView* pAttachments 2394 u32 width 2395 u32 height 2396 u32 layers 2397} 2398 2399class VkDrawIndirectCommand { 2400 u32 vertexCount 2401 u32 instanceCount 2402 u32 firstVertex 2403 u32 firstInstance 2404} 2405 2406class VkDrawIndexedIndirectCommand { 2407 u32 indexCount 2408 u32 instanceCount 2409 u32 firstIndex 2410 s32 vertexOffset 2411 u32 firstInstance 2412} 2413 2414class VkDispatchIndirectCommand { 2415 u32 x 2416 u32 y 2417 u32 z 2418} 2419 2420@extension("VK_KHR_surface") 2421class VkSurfaceCapabilitiesKHR { 2422 u32 minImageCount 2423 u32 maxImageCount 2424 VkExtent2D currentExtent 2425 VkExtent2D minImageExtent 2426 VkExtent2D maxImageExtent 2427 u32 maxImageArrayLayers 2428 VkSurfaceTransformFlagsKHR supportedTransforms 2429 VkSurfaceTransformFlagBitsKHR currentTransform 2430 VkCompositeAlphaFlagsKHR supportedCompositeAlpha 2431 VkImageUsageFlags supportedUsageFlags 2432} 2433 2434@extension("VK_KHR_surface") 2435class VkSurfaceFormatKHR { 2436 VkFormat format 2437 VkColorSpaceKHR colorSpace 2438} 2439 2440@extension("VK_KHR_swapchain") 2441class VkSwapchainCreateInfoKHR { 2442 VkStructureType sType 2443 const void* pNext 2444 VkSwapchainCreateFlagsKHR flags 2445 VkSurfaceKHR surface 2446 u32 minImageCount 2447 VkFormat imageFormat 2448 VkColorSpaceKHR imageColorSpace 2449 VkExtent2D imageExtent 2450 u32 imageArrayLayers 2451 VkImageUsageFlags imageUsage 2452 VkSharingMode sharingMode 2453 u32 queueFamilyIndexCount 2454 const u32* pQueueFamilyIndices 2455 VkSurfaceTransformFlagBitsKHR preTransform 2456 VkCompositeAlphaFlagBitsKHR compositeAlpha 2457 VkPresentModeKHR presentMode 2458 VkBool32 clipped 2459 VkSwapchainKHR oldSwapchain 2460} 2461 2462@extension("VK_KHR_swapchain") 2463class VkPresentInfoKHR { 2464 VkStructureType sType 2465 const void* pNext 2466 u32 waitSemaphoreCount 2467 const VkSemaphore* pWaitSemaphores 2468 u32 swapchainCount 2469 const VkSwapchainKHR* pSwapchains 2470 const u32* pImageIndices 2471 VkResult* pResults 2472} 2473 2474@extension("VK_KHR_display") 2475class VkDisplayPropertiesKHR { 2476 VkDisplayKHR display 2477 const char* displayName 2478 VkExtent2D physicalDimensions 2479 VkExtent2D physicalResolution 2480 VkSurfaceTransformFlagsKHR supportedTransforms 2481 VkBool32 planeReorderPossible 2482 VkBool32 persistentContent 2483} 2484 2485@extension("VK_KHR_display") 2486class VkDisplayModeParametersKHR { 2487 VkExtent2D visibleRegion 2488 u32 refreshRate 2489} 2490 2491@extension("VK_KHR_display") 2492class VkDisplayModePropertiesKHR { 2493 VkDisplayModeKHR displayMode 2494 VkDisplayModeParametersKHR parameters 2495} 2496 2497@extension("VK_KHR_display") 2498class VkDisplayModeCreateInfoKHR { 2499 VkStructureType sType 2500 const void* pNext 2501 VkDisplayModeCreateFlagsKHR flags 2502 VkDisplayModeParametersKHR parameters 2503} 2504 2505@extension("VK_KHR_display") 2506class VkDisplayPlanePropertiesKHR { 2507 VkDisplayKHR currentDisplay 2508 u32 currentStackIndex 2509} 2510 2511@extension("VK_KHR_display") 2512class VkDisplayPlaneCapabilitiesKHR { 2513 VkDisplayPlaneAlphaFlagsKHR supportedAlpha 2514 VkOffset2D minSrcPosition 2515 VkOffset2D maxSrcPosition 2516 VkExtent2D minSrcExtent 2517 VkExtent2D maxSrcExtent 2518 VkOffset2D minDstPosition 2519 VkOffset2D maxDstPosition 2520 VkExtent2D minDstExtent 2521 VkExtent2D maxDstExtent 2522} 2523 2524@extension("VK_KHR_display") 2525class VkDisplaySurfaceCreateInfoKHR { 2526 VkStructureType sType 2527 const void* pNext 2528 VkDisplaySurfaceCreateFlagsKHR flags 2529 VkDisplayModeKHR displayMode 2530 u32 planeIndex 2531 u32 planeStackIndex 2532 VkSurfaceTransformFlagBitsKHR transform 2533 f32 globalAlpha 2534 VkDisplayPlaneAlphaFlagBitsKHR alphaMode 2535 VkExtent2D imageExtent 2536} 2537 2538@extension("VK_KHR_display_swapchain") 2539class VkDisplayPresentInfoKHR { 2540 VkStructureType sType 2541 const void* pNext 2542 VkRect2D srcRect 2543 VkRect2D dstRect 2544 VkBool32 persistent 2545} 2546 2547@extension("VK_KHR_xlib_surface") 2548class VkXlibSurfaceCreateInfoKHR { 2549 VkStructureType sType 2550 const void* pNext 2551 VkXlibSurfaceCreateFlagsKHR flags 2552 platform.Display* dpy 2553 platform.Window window 2554} 2555 2556@extension("VK_KHR_xcb_surface") 2557class VkXcbSurfaceCreateInfoKHR { 2558 VkStructureType sType 2559 const void* pNext 2560 VkXcbSurfaceCreateFlagsKHR flags 2561 platform.xcb_connection_t* connection 2562 platform.xcb_window_t window 2563} 2564 2565@extension("VK_KHR_wayland_surface") 2566class VkWaylandSurfaceCreateInfoKHR { 2567 VkStructureType sType 2568 const void* pNext 2569 VkWaylandSurfaceCreateFlagsKHR flags 2570 platform.wl_display* display 2571 platform.wl_surface* surface 2572} 2573 2574@extension("VK_KHR_mir_surface") 2575class VkMirSurfaceCreateInfoKHR { 2576 VkStructureType sType 2577 const void* pNext 2578 VkMirSurfaceCreateFlagsKHR flags 2579 platform.MirConnection* connection 2580 platform.MirSurface* mirSurface 2581} 2582 2583@extension("VK_KHR_android_surface") 2584class VkAndroidSurfaceCreateInfoKHR { 2585 VkStructureType sType 2586 const void* pNext 2587 VkAndroidSurfaceCreateFlagsKHR flags 2588 platform.ANativeWindow* window 2589} 2590 2591@extension("VK_KHR_win32_surface") 2592class VkWin32SurfaceCreateInfoKHR { 2593 VkStructureType sType 2594 const void* pNext 2595 VkWin32SurfaceCreateFlagsKHR flags 2596 platform.HINSTANCE hinstance 2597 platform.HWND hwnd 2598} 2599 2600@extension("VK_ANDROID_native_buffer") 2601class VkNativeBufferANDROID { 2602 VkStructureType sType 2603 const void* pNext 2604 platform.buffer_handle_t handle 2605 int stride 2606 int format 2607 int usage 2608} 2609 2610@extension("VK_EXT_debug_report") 2611class VkDebugReportCallbackCreateInfoEXT { 2612 VkStructureType sType 2613 const void* pNext 2614 VkDebugReportFlagsEXT flags 2615 PFN_vkDebugReportCallbackEXT pfnCallback 2616 void* pUserData 2617} 2618 2619 2620//////////////// 2621// Commands // 2622//////////////// 2623 2624// Function pointers. TODO: add support for function pointers. 2625 2626@external type void* PFN_vkVoidFunction 2627@pfn cmd void vkVoidFunction() { 2628} 2629 2630@external type void* PFN_vkAllocationFunction 2631@pfn cmd void* vkAllocationFunction( 2632 void* pUserData, 2633 platform.size_t size, 2634 platform.size_t alignment, 2635 VkSystemAllocationScope allocationScope) { 2636 return ? 2637} 2638 2639@external type void* PFN_vkReallocationFunction 2640@pfn cmd void* vkReallocationFunction( 2641 void* pUserData, 2642 void* pOriginal, 2643 platform.size_t size, 2644 platform.size_t alignment, 2645 VkSystemAllocationScope allocationScope) { 2646 return ? 2647} 2648 2649@external type void* PFN_vkFreeFunction 2650@pfn cmd void vkFreeFunction( 2651 void* pUserData, 2652 void* pMemory) { 2653} 2654 2655@external type void* PFN_vkInternalAllocationNotification 2656@pfn cmd void vkInternalAllocationNotification( 2657 void* pUserData, 2658 platform.size_t size, 2659 VkInternalAllocationType allocationType, 2660 VkSystemAllocationScope allocationScope) { 2661} 2662 2663@external type void* PFN_vkInternalFreeNotification 2664@pfn cmd void vkInternalFreeNotification( 2665 void* pUserData, 2666 platform.size_t size, 2667 VkInternalAllocationType allocationType, 2668 VkSystemAllocationScope allocationScope) { 2669} 2670 2671// Global functions 2672 2673@threadSafety("system") 2674cmd VkResult vkCreateInstance( 2675 const VkInstanceCreateInfo* pCreateInfo, 2676 const VkAllocationCallbacks* pAllocator, 2677 VkInstance* pInstance) { 2678 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO) 2679 2680 instance := ? 2681 pInstance[0] = instance 2682 State.Instances[instance] = new!InstanceObject() 2683 2684 layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.enabledLayerCount] 2685 extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.enabledExtensionCount] 2686 2687 return ? 2688} 2689 2690@threadSafety("system") 2691cmd void vkDestroyInstance( 2692 VkInstance instance, 2693 const VkAllocationCallbacks* pAllocator) { 2694 instanceObject := GetInstance(instance) 2695 2696 State.Instances[instance] = null 2697} 2698 2699@threadSafety("system") 2700cmd VkResult vkEnumeratePhysicalDevices( 2701 VkInstance instance, 2702 u32* pPhysicalDeviceCount, 2703 VkPhysicalDevice* pPhysicalDevices) { 2704 instanceObject := GetInstance(instance) 2705 2706 physicalDeviceCount := as!u32(?) 2707 pPhysicalDeviceCount[0] = physicalDeviceCount 2708 physicalDevices := pPhysicalDevices[0:physicalDeviceCount] 2709 2710 for i in (0 .. physicalDeviceCount) { 2711 physicalDevice := ? 2712 physicalDevices[i] = physicalDevice 2713 if !(physicalDevice in State.PhysicalDevices) { 2714 State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance) 2715 } 2716 } 2717 2718 return ? 2719} 2720 2721cmd PFN_vkVoidFunction vkGetDeviceProcAddr( 2722 VkDevice device, 2723 const char* pName) { 2724 if device != NULL_HANDLE { 2725 device := GetDevice(device) 2726 } 2727 2728 return ? 2729} 2730 2731cmd PFN_vkVoidFunction vkGetInstanceProcAddr( 2732 VkInstance instance, 2733 const char* pName) { 2734 if instance != NULL_HANDLE { 2735 instanceObject := GetInstance(instance) 2736 } 2737 2738 return ? 2739} 2740 2741cmd void vkGetPhysicalDeviceProperties( 2742 VkPhysicalDevice physicalDevice, 2743 VkPhysicalDeviceProperties* pProperties) { 2744 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2745 2746 properties := ? 2747 pProperties[0] = properties 2748} 2749 2750cmd void vkGetPhysicalDeviceQueueFamilyProperties( 2751 VkPhysicalDevice physicalDevice, 2752 u32* pQueueFamilyPropertyCount, 2753 VkQueueFamilyProperties* pQueueFamilyProperties) { 2754 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2755 // TODO: Figure out how to express fetch-count-or-properties 2756 // This version fails 'apic validate' with 'fence not allowed in 2757 // *semantic.Branch'. Other attempts have failed with the same or other 2758 // errors. 2759 // if pQueueFamilyProperties != null { 2760 // queuesProperties := pQueueFamilyProperties[0:pCount[0]] 2761 // for i in (0 .. pCount[0]) { 2762 // queueProperties := as!VkQueueFamilyProperties(?) 2763 // queuesProperties[i] = queueProperties 2764 // } 2765 // } else { 2766 // count := ? 2767 // pCount[0] = count 2768 // } 2769} 2770 2771cmd void vkGetPhysicalDeviceMemoryProperties( 2772 VkPhysicalDevice physicalDevice, 2773 VkPhysicalDeviceMemoryProperties* pMemoryProperties) { 2774 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2775 2776 memoryProperties := ? 2777 pMemoryProperties[0] = memoryProperties 2778} 2779 2780cmd void vkGetPhysicalDeviceFeatures( 2781 VkPhysicalDevice physicalDevice, 2782 VkPhysicalDeviceFeatures* pFeatures) { 2783 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2784 2785 features := ? 2786 pFeatures[0] = features 2787} 2788 2789cmd void vkGetPhysicalDeviceFormatProperties( 2790 VkPhysicalDevice physicalDevice, 2791 VkFormat format, 2792 VkFormatProperties* pFormatProperties) { 2793 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2794 2795 formatProperties := ? 2796 pFormatProperties[0] = formatProperties 2797} 2798 2799cmd VkResult vkGetPhysicalDeviceImageFormatProperties( 2800 VkPhysicalDevice physicalDevice, 2801 VkFormat format, 2802 VkImageType type, 2803 VkImageTiling tiling, 2804 VkImageUsageFlags usage, 2805 VkImageCreateFlags flags, 2806 VkImageFormatProperties* pImageFormatProperties) { 2807 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2808 2809 imageFormatProperties := ? 2810 pImageFormatProperties[0] = imageFormatProperties 2811 2812 return ? 2813} 2814 2815 2816// Device functions 2817 2818@threadSafety("system") 2819cmd VkResult vkCreateDevice( 2820 VkPhysicalDevice physicalDevice, 2821 const VkDeviceCreateInfo* pCreateInfo, 2822 const VkAllocationCallbacks* pAllocator, 2823 VkDevice* pDevice) { 2824 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO) 2825 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2826 2827 device := ? 2828 pDevice[0] = device 2829 State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice) 2830 2831 return ? 2832} 2833 2834@threadSafety("system") 2835cmd void vkDestroyDevice( 2836 VkDevice device, 2837 const VkAllocationCallbacks* pAllocator) { 2838 deviceObject := GetDevice(device) 2839 2840 State.Devices[device] = null 2841} 2842 2843 2844// Extension discovery functions 2845 2846cmd VkResult vkEnumerateInstanceLayerProperties( 2847 u32* pPropertyCount, 2848 VkLayerProperties* pProperties) { 2849 count := as!u32(?) 2850 pPropertyCount[0] = count 2851 2852 properties := pProperties[0:count] 2853 for i in (0 .. count) { 2854 property := ? 2855 properties[i] = property 2856 } 2857 2858 return ? 2859} 2860 2861cmd VkResult vkEnumerateInstanceExtensionProperties( 2862 const char* pLayerName, 2863 u32* pPropertyCount, 2864 VkExtensionProperties* pProperties) { 2865 count := as!u32(?) 2866 pPropertyCount[0] = count 2867 2868 properties := pProperties[0:count] 2869 for i in (0 .. count) { 2870 property := ? 2871 properties[i] = property 2872 } 2873 2874 return ? 2875} 2876 2877cmd VkResult vkEnumerateDeviceLayerProperties( 2878 VkPhysicalDevice physicalDevice, 2879 u32* pPropertyCount, 2880 VkLayerProperties* pProperties) { 2881 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2882 count := as!u32(?) 2883 pPropertyCount[0] = count 2884 2885 properties := pProperties[0:count] 2886 for i in (0 .. count) { 2887 property := ? 2888 properties[i] = property 2889 } 2890 2891 return ? 2892} 2893 2894cmd VkResult vkEnumerateDeviceExtensionProperties( 2895 VkPhysicalDevice physicalDevice, 2896 const char* pLayerName, 2897 u32* pPropertyCount, 2898 VkExtensionProperties* pProperties) { 2899 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 2900 2901 count := as!u32(?) 2902 pPropertyCount[0] = count 2903 2904 properties := pProperties[0:count] 2905 for i in (0 .. count) { 2906 property := ? 2907 properties[i] = property 2908 } 2909 2910 return ? 2911} 2912 2913 2914// Queue functions 2915 2916@threadSafety("system") 2917cmd void vkGetDeviceQueue( 2918 VkDevice device, 2919 u32 queueFamilyIndex, 2920 u32 queueIndex, 2921 VkQueue* pQueue) { 2922 deviceObject := GetDevice(device) 2923 2924 queue := ? 2925 pQueue[0] = queue 2926 2927 if !(queue in State.Queues) { 2928 State.Queues[queue] = new!QueueObject(device: device) 2929 } 2930} 2931 2932@threadSafety("app") 2933cmd VkResult vkQueueSubmit( 2934 VkQueue queue, 2935 u32 submitCount, 2936 const VkSubmitInfo* pSubmits, 2937 VkFence fence) { 2938 queueObject := GetQueue(queue) 2939 2940 if fence != NULL_HANDLE { 2941 fenceObject := GetFence(fence) 2942 assert(fenceObject.device == queueObject.device) 2943 } 2944 2945 // commandBuffers := pcommandBuffers[0:commandBufferCount] 2946 // for i in (0 .. commandBufferCount) { 2947 // commandBuffer := commandBuffers[i] 2948 // commandBufferObject := GetCommandBuffer(commandBuffer) 2949 // assert(commandBufferObject.device == queueObject.device) 2950 // 2951 // validate("QueueCheck", commandBufferObject.queueFlags in queueObject.flags, 2952 // "vkQueueSubmit: enqueued commandBuffer requires missing queue capabilities.") 2953 // } 2954 2955 return ? 2956} 2957 2958@threadSafety("system") 2959cmd VkResult vkQueueWaitIdle( 2960 VkQueue queue) { 2961 queueObject := GetQueue(queue) 2962 2963 return ? 2964} 2965 2966@threadSafety("system") 2967cmd VkResult vkDeviceWaitIdle( 2968 VkDevice device) { 2969 deviceObject := GetDevice(device) 2970 2971 return ? 2972} 2973 2974 2975// Memory functions 2976 2977@threadSafety("system") 2978cmd VkResult vkAllocateMemory( 2979 VkDevice device, 2980 const VkMemoryAllocateInfo* pAllocateInfo, 2981 const VkAllocationCallbacks* pAllocator, 2982 VkDeviceMemory* pMemory) { 2983 assert(pAllocateInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO) 2984 deviceObject := GetDevice(device) 2985 2986 memory := ? 2987 pMemory[0] = memory 2988 State.DeviceMemories[memory] = new!DeviceMemoryObject( 2989 device: device, 2990 allocationSize: pAllocateInfo[0].allocationSize) 2991 2992 return ? 2993} 2994 2995@threadSafety("system") 2996cmd void vkFreeMemory( 2997 VkDevice device, 2998 VkDeviceMemory memory, 2999 const VkAllocationCallbacks* pAllocator) { 3000 deviceObject := GetDevice(device) 3001 memoryObject := GetDeviceMemory(memory) 3002 assert(memoryObject.device == device) 3003 3004 // Check that no objects are still bound before freeing. 3005 validate("MemoryCheck", len(memoryObject.boundObjects) == 0, 3006 "vkFreeMemory: objects still bound") 3007 validate("MemoryCheck", len(memoryObject.boundCommandBuffers) == 0, 3008 "vkFreeMemory: commandBuffers still bound") 3009 State.DeviceMemories[memory] = null 3010} 3011 3012@threadSafety("app") 3013cmd VkResult vkMapMemory( 3014 VkDevice device, 3015 VkDeviceMemory memory, 3016 VkDeviceSize offset, 3017 VkDeviceSize size, 3018 VkMemoryMapFlags flags, 3019 void** ppData) { 3020 deviceObject := GetDevice(device) 3021 memoryObject := GetDeviceMemory(memory) 3022 assert(memoryObject.device == device) 3023 3024 assert(flags == as!VkMemoryMapFlags(0)) 3025 assert((offset + size) <= memoryObject.allocationSize) 3026 3027 return ? 3028} 3029 3030@threadSafety("app") 3031cmd void vkUnmapMemory( 3032 VkDevice device, 3033 VkDeviceMemory memory) { 3034 deviceObject := GetDevice(device) 3035 memoryObject := GetDeviceMemory(memory) 3036 assert(memoryObject.device == device) 3037} 3038 3039cmd VkResult vkFlushMappedMemoryRanges( 3040 VkDevice device, 3041 u32 memoryRangeCount 3042 const VkMappedMemoryRange* pMemoryRanges) { 3043 deviceObject := GetDevice(device) 3044 3045 memoryRanges := pMemoryRanges[0:memoryRangeCount] 3046 for i in (0 .. memoryRangeCount) { 3047 memoryRange := memoryRanges[i] 3048 memoryObject := GetDeviceMemory(memoryRange.memory) 3049 assert(memoryObject.device == device) 3050 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize) 3051 } 3052 3053 return ? 3054} 3055 3056cmd VkResult vkInvalidateMappedMemoryRanges( 3057 VkDevice device, 3058 u32 memoryRangeCount, 3059 const VkMappedMemoryRange* pMemoryRanges) { 3060 deviceObject := GetDevice(device) 3061 3062 memoryRanges := pMemoryRanges[0:memoryRangeCount] 3063 for i in (0 .. memoryRangeCount) { 3064 memoryRange := memoryRanges[i] 3065 memoryObject := GetDeviceMemory(memoryRange.memory) 3066 assert(memoryObject.device == device) 3067 assert((memoryRange.offset + memoryRange.size) <= memoryObject.allocationSize) 3068 } 3069 3070 return ? 3071} 3072 3073 3074// Memory management API functions 3075 3076cmd void vkGetDeviceMemoryCommitment( 3077 VkDevice device, 3078 VkDeviceMemory memory, 3079 VkDeviceSize* pCommittedMemoryInBytes) { 3080 deviceObject := GetDevice(device) 3081 3082 if memory != NULL_HANDLE { 3083 memoryObject := GetDeviceMemory(memory) 3084 assert(memoryObject.device == device) 3085 } 3086 3087 committedMemoryInBytes := ? 3088 pCommittedMemoryInBytes[0] = committedMemoryInBytes 3089} 3090 3091cmd void vkGetBufferMemoryRequirements( 3092 VkDevice device, 3093 VkBuffer buffer, 3094 VkMemoryRequirements* pMemoryRequirements) { 3095 deviceObject := GetDevice(device) 3096 bufferObject := GetBuffer(buffer) 3097 assert(bufferObject.device == device) 3098} 3099 3100cmd VkResult vkBindBufferMemory( 3101 VkDevice device, 3102 VkBuffer buffer, 3103 VkDeviceMemory memory, 3104 VkDeviceSize memoryOffset) { 3105 deviceObject := GetDevice(device) 3106 bufferObject := GetBuffer(buffer) 3107 assert(bufferObject.device == device) 3108 3109 // Unbind buffer from previous memory object, if not VK_NULL_HANDLE. 3110 if bufferObject.memory != NULL_HANDLE { 3111 memoryObject := GetDeviceMemory(bufferObject.memory) 3112 memoryObject.boundObjects[as!u64(buffer)] = null 3113 } 3114 3115 // Bind buffer to given memory object, if not VK_NULL_HANDLE. 3116 if memory != NULL_HANDLE { 3117 memoryObject := GetDeviceMemory(memory) 3118 assert(memoryObject.device == device) 3119 memoryObject.boundObjects[as!u64(buffer)] = memoryOffset 3120 } 3121 bufferObject.memory = memory 3122 bufferObject.memoryOffset = memoryOffset 3123 3124 return ? 3125} 3126 3127cmd void vkGetImageMemoryRequirements( 3128 VkDevice device, 3129 VkImage image, 3130 VkMemoryRequirements* pMemoryRequirements) { 3131 deviceObject := GetDevice(device) 3132 imageObject := GetImage(image) 3133 assert(imageObject.device == device) 3134} 3135 3136cmd VkResult vkBindImageMemory( 3137 VkDevice device, 3138 VkImage image, 3139 VkDeviceMemory memory, 3140 VkDeviceSize memoryOffset) { 3141 deviceObject := GetDevice(device) 3142 imageObject := GetImage(image) 3143 assert(imageObject.device == device) 3144 3145 // Unbind image from previous memory object, if not VK_NULL_HANDLE. 3146 if imageObject.memory != NULL_HANDLE { 3147 memoryObject := GetDeviceMemory(imageObject.memory) 3148 memoryObject.boundObjects[as!u64(image)] = null 3149 } 3150 3151 // Bind image to given memory object, if not VK_NULL_HANDLE. 3152 if memory != NULL_HANDLE { 3153 memoryObject := GetDeviceMemory(memory) 3154 assert(memoryObject.device == device) 3155 memoryObject.boundObjects[as!u64(image)] = memoryOffset 3156 } 3157 imageObject.memory = memory 3158 imageObject.memoryOffset = memoryOffset 3159 3160 return ? 3161} 3162 3163cmd void vkGetImageSparseMemoryRequirements( 3164 VkDevice device, 3165 VkImage image, 3166 u32* pSparseMemoryRequirementCount, 3167 VkSparseImageMemoryRequirements* pSparseMemoryRequirements) { 3168 deviceObject := GetDevice(device) 3169 imageObject := GetImage(image) 3170 assert(imageObject.device == device) 3171} 3172 3173cmd void vkGetPhysicalDeviceSparseImageFormatProperties( 3174 VkPhysicalDevice physicalDevice, 3175 VkFormat format, 3176 VkImageType type, 3177 VkSampleCountFlagBits samples, 3178 VkImageUsageFlags usage, 3179 VkImageTiling tiling, 3180 u32* pPropertyCount, 3181 VkSparseImageFormatProperties* pProperties) { 3182 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 3183} 3184 3185cmd VkResult vkQueueBindSparse( 3186 VkQueue queue, 3187 u32 bindInfoCount, 3188 const VkBindSparseInfo* pBindInfo, 3189 VkFence fence) { 3190 queueObject := GetQueue(queue) 3191 3192 return ? 3193} 3194 3195 3196// Fence functions 3197 3198@threadSafety("system") 3199cmd VkResult vkCreateFence( 3200 VkDevice device, 3201 const VkFenceCreateInfo* pCreateInfo, 3202 const VkAllocationCallbacks* pAllocator, 3203 VkFence* pFence) { 3204 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO) 3205 deviceObject := GetDevice(device) 3206 3207 fence := ? 3208 pFence[0] = fence 3209 State.Fences[fence] = new!FenceObject( 3210 device: device, signaled: (pCreateInfo.flags == as!VkFenceCreateFlags(VK_FENCE_CREATE_SIGNALED_BIT))) 3211 3212 return ? 3213} 3214 3215@threadSafety("system") 3216cmd void vkDestroyFence( 3217 VkDevice device, 3218 VkFence fence, 3219 const VkAllocationCallbacks* pAllocator) { 3220 deviceObject := GetDevice(device) 3221 fenceObject := GetFence(fence) 3222 assert(fenceObject.device == device) 3223 3224 State.Fences[fence] = null 3225} 3226 3227@threadSafety("system") 3228cmd VkResult vkResetFences( 3229 VkDevice device, 3230 u32 fenceCount, 3231 const VkFence* pFences) { 3232 deviceObject := GetDevice(device) 3233 3234 fences := pFences[0:fenceCount] 3235 for i in (0 .. fenceCount) { 3236 fence := fences[i] 3237 fenceObject := GetFence(fence) 3238 assert(fenceObject.device == device) 3239 fenceObject.signaled = false 3240 } 3241 3242 return ? 3243} 3244 3245@threadSafety("system") 3246cmd VkResult vkGetFenceStatus( 3247 VkDevice device, 3248 VkFence fence) { 3249 deviceObject := GetDevice(device) 3250 fenceObject := GetFence(fence) 3251 assert(fenceObject.device == device) 3252 3253 return ? 3254} 3255 3256@threadSafety("system") 3257cmd VkResult vkWaitForFences( 3258 VkDevice device, 3259 u32 fenceCount, 3260 const VkFence* pFences, 3261 VkBool32 waitAll, 3262 u64 timeout) { /// timeout in nanoseconds 3263 deviceObject := GetDevice(device) 3264 3265 fences := pFences[0:fenceCount] 3266 for i in (0 .. fenceCount) { 3267 fence := fences[i] 3268 fenceObject := GetFence(fence) 3269 assert(fenceObject.device == device) 3270 } 3271 3272 return ? 3273} 3274 3275 3276// Queue semaphore functions 3277 3278@threadSafety("system") 3279cmd VkResult vkCreateSemaphore( 3280 VkDevice device, 3281 const VkSemaphoreCreateInfo* pCreateInfo, 3282 const VkAllocationCallbacks* pAllocator, 3283 VkSemaphore* pSemaphore) { 3284 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO) 3285 deviceObject := GetDevice(device) 3286 3287 semaphore := ? 3288 pSemaphore[0] = semaphore 3289 State.Semaphores[semaphore] = new!SemaphoreObject(device: device) 3290 3291 return ? 3292} 3293 3294@threadSafety("system") 3295cmd void vkDestroySemaphore( 3296 VkDevice device, 3297 VkSemaphore semaphore, 3298 const VkAllocationCallbacks* pAllocator) { 3299 deviceObject := GetDevice(device) 3300 semaphoreObject := GetSemaphore(semaphore) 3301 assert(semaphoreObject.device == device) 3302 3303 State.Semaphores[semaphore] = null 3304} 3305 3306 3307// Event functions 3308 3309@threadSafety("system") 3310cmd VkResult vkCreateEvent( 3311 VkDevice device, 3312 const VkEventCreateInfo* pCreateInfo, 3313 const VkAllocationCallbacks* pAllocator, 3314 VkEvent* pEvent) { 3315 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO) 3316 deviceObject := GetDevice(device) 3317 3318 event := ? 3319 pEvent[0] = event 3320 State.Events[event] = new!EventObject(device: device) 3321 3322 return ? 3323} 3324 3325@threadSafety("system") 3326cmd void vkDestroyEvent( 3327 VkDevice device, 3328 VkEvent event, 3329 const VkAllocationCallbacks* pAllocator) { 3330 deviceObject := GetDevice(device) 3331 eventObject := GetEvent(event) 3332 assert(eventObject.device == device) 3333 3334 State.Events[event] = null 3335} 3336 3337@threadSafety("system") 3338cmd VkResult vkGetEventStatus( 3339 VkDevice device, 3340 VkEvent event) { 3341 deviceObject := GetDevice(device) 3342 eventObject := GetEvent(event) 3343 assert(eventObject.device == device) 3344 3345 return ? 3346} 3347 3348@threadSafety("system") 3349cmd VkResult vkSetEvent( 3350 VkDevice device, 3351 VkEvent event) { 3352 deviceObject := GetDevice(device) 3353 eventObject := GetEvent(event) 3354 assert(eventObject.device == device) 3355 3356 return ? 3357} 3358 3359@threadSafety("system") 3360cmd VkResult vkResetEvent( 3361 VkDevice device, 3362 VkEvent event) { 3363 deviceObject := GetDevice(device) 3364 eventObject := GetEvent(event) 3365 assert(eventObject.device == device) 3366 3367 return ? 3368} 3369 3370 3371// Query functions 3372 3373@threadSafety("system") 3374cmd VkResult vkCreateQueryPool( 3375 VkDevice device, 3376 const VkQueryPoolCreateInfo* pCreateInfo, 3377 const VkAllocationCallbacks* pAllocator, 3378 VkQueryPool* pQueryPool) { 3379 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO) 3380 deviceObject := GetDevice(device) 3381 3382 queryPool := ? 3383 pQueryPool[0] = queryPool 3384 State.QueryPools[queryPool] = new!QueryPoolObject(device: device) 3385 3386 return ? 3387} 3388 3389@threadSafety("system") 3390cmd void vkDestroyQueryPool( 3391 VkDevice device, 3392 VkQueryPool queryPool, 3393 const VkAllocationCallbacks* pAllocator) { 3394 deviceObject := GetDevice(device) 3395 queryPoolObject := GetQueryPool(queryPool) 3396 assert(queryPoolObject.device == device) 3397 3398 State.QueryPools[queryPool] = null 3399} 3400 3401@threadSafety("system") 3402cmd VkResult vkGetQueryPoolResults( 3403 VkDevice device, 3404 VkQueryPool queryPool, 3405 u32 firstQuery, 3406 u32 queryCount, 3407 platform.size_t dataSize, 3408 void* pData, 3409 VkDeviceSize stride, 3410 VkQueryResultFlags flags) { 3411 deviceObject := GetDevice(device) 3412 queryPoolObject := GetQueryPool(queryPool) 3413 assert(queryPoolObject.device == device) 3414 3415 data := pData[0:dataSize] 3416 3417 return ? 3418} 3419 3420// Buffer functions 3421 3422@threadSafety("system") 3423cmd VkResult vkCreateBuffer( 3424 VkDevice device, 3425 const VkBufferCreateInfo* pCreateInfo, 3426 const VkAllocationCallbacks* pAllocator, 3427 VkBuffer* pBuffer) { 3428 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO) 3429 deviceObject := GetDevice(device) 3430 3431 buffer := ? 3432 pBuffer[0] = buffer 3433 State.Buffers[buffer] = new!BufferObject(device: device) 3434 3435 return ? 3436} 3437 3438@threadSafety("system") 3439cmd void vkDestroyBuffer( 3440 VkDevice device, 3441 VkBuffer buffer, 3442 const VkAllocationCallbacks* pAllocator) { 3443 deviceObject := GetDevice(device) 3444 bufferObject := GetBuffer(buffer) 3445 assert(bufferObject.device == device) 3446 3447 assert(bufferObject.memory == 0) 3448 State.Buffers[buffer] = null 3449} 3450 3451 3452// Buffer view functions 3453 3454@threadSafety("system") 3455cmd VkResult vkCreateBufferView( 3456 VkDevice device, 3457 const VkBufferViewCreateInfo* pCreateInfo, 3458 const VkAllocationCallbacks* pAllocator, 3459 VkBufferView* pView) { 3460 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO) 3461 deviceObject := GetDevice(device) 3462 3463 bufferObject := GetBuffer(pCreateInfo.buffer) 3464 assert(bufferObject.device == device) 3465 3466 view := ? 3467 pView[0] = view 3468 State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer) 3469 3470 return ? 3471} 3472 3473@threadSafety("system") 3474cmd void vkDestroyBufferView( 3475 VkDevice device, 3476 VkBufferView bufferView, 3477 const VkAllocationCallbacks* pAllocator) { 3478 deviceObject := GetDevice(device) 3479 bufferViewObject := GetBufferView(bufferView) 3480 assert(bufferViewObject.device == device) 3481 3482 State.BufferViews[bufferView] = null 3483} 3484 3485 3486// Image functions 3487 3488@threadSafety("system") 3489cmd VkResult vkCreateImage( 3490 VkDevice device, 3491 const VkImageCreateInfo* pCreateInfo, 3492 const VkAllocationCallbacks* pAllocator, 3493 VkImage* pImage) { 3494 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO) 3495 deviceObject := GetDevice(device) 3496 3497 image := ? 3498 pImage[0] = image 3499 State.Images[image] = new!ImageObject(device: device) 3500 3501 return ? 3502} 3503 3504@threadSafety("system") 3505cmd void vkDestroyImage( 3506 VkDevice device, 3507 VkImage image, 3508 const VkAllocationCallbacks* pAllocator) { 3509 deviceObject := GetDevice(device) 3510 imageObject := GetImage(image) 3511 assert(imageObject.device == device) 3512 3513 assert(imageObject.memory == 0) 3514 State.Images[image] = null 3515} 3516 3517cmd void vkGetImageSubresourceLayout( 3518 VkDevice device, 3519 VkImage image, 3520 const VkImageSubresource* pSubresource, 3521 VkSubresourceLayout* pLayout) { 3522 deviceObject := GetDevice(device) 3523 imageObject := GetImage(image) 3524 assert(imageObject.device == device) 3525} 3526 3527 3528// Image view functions 3529 3530@threadSafety("system") 3531cmd VkResult vkCreateImageView( 3532 VkDevice device, 3533 const VkImageViewCreateInfo* pCreateInfo, 3534 const VkAllocationCallbacks* pAllocator, 3535 VkImageView* pView) { 3536 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO) 3537 deviceObject := GetDevice(device) 3538 3539 imageObject := GetImage(pCreateInfo.image) 3540 assert(imageObject.device == device) 3541 3542 view := ? 3543 pView[0] = view 3544 State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image) 3545 3546 return ? 3547} 3548 3549@threadSafety("system") 3550cmd void vkDestroyImageView( 3551 VkDevice device, 3552 VkImageView imageView, 3553 const VkAllocationCallbacks* pAllocator) { 3554 deviceObject := GetDevice(device) 3555 imageViewObject := GetImageView(imageView) 3556 assert(imageViewObject.device == device) 3557 3558 State.ImageViews[imageView] = null 3559} 3560 3561 3562// Shader functions 3563 3564cmd VkResult vkCreateShaderModule( 3565 VkDevice device, 3566 const VkShaderModuleCreateInfo* pCreateInfo, 3567 const VkAllocationCallbacks* pAllocator, 3568 VkShaderModule* pShaderModule) { 3569 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO) 3570 deviceObject := GetDevice(device) 3571 3572 shaderModule := ? 3573 pShaderModule[0] = shaderModule 3574 State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device) 3575 3576 return ? 3577} 3578 3579cmd void vkDestroyShaderModule( 3580 VkDevice device, 3581 VkShaderModule shaderModule, 3582 const VkAllocationCallbacks* pAllocator) { 3583 deviceObject := GetDevice(device) 3584 shaderModuleObject := GetShaderModule(shaderModule) 3585 assert(shaderModuleObject.device == device) 3586 3587 State.ShaderModules[shaderModule] = null 3588} 3589 3590 3591// Pipeline functions 3592 3593cmd VkResult vkCreatePipelineCache( 3594 VkDevice device, 3595 const VkPipelineCacheCreateInfo* pCreateInfo, 3596 const VkAllocationCallbacks* pAllocator, 3597 VkPipelineCache* pPipelineCache) { 3598 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO) 3599 deviceObject := GetDevice(device) 3600 3601 pipelineCache := ? 3602 pPipelineCache[0] = pipelineCache 3603 State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device) 3604 3605 return ? 3606} 3607 3608cmd void vkDestroyPipelineCache( 3609 VkDevice device, 3610 VkPipelineCache pipelineCache, 3611 const VkAllocationCallbacks* pAllocator) { 3612 deviceObject := GetDevice(device) 3613 pipelineCacheObject := GetPipelineCache(pipelineCache) 3614 assert(pipelineCacheObject.device == device) 3615 3616 State.PipelineCaches[pipelineCache] = null 3617} 3618 3619cmd VkResult vkGetPipelineCacheData( 3620 VkDevice device, 3621 VkPipelineCache pipelineCache, 3622 platform.size_t* pDataSize, 3623 void* pData) { 3624 deviceObject := GetDevice(device) 3625 pipelineCacheObject := GetPipelineCache(pipelineCache) 3626 assert(pipelineCacheObject.device == device) 3627 3628 return ? 3629} 3630 3631cmd VkResult vkMergePipelineCaches( 3632 VkDevice device, 3633 VkPipelineCache dstCache, 3634 u32 srcCacheCount, 3635 const VkPipelineCache* pSrcCaches) { 3636 deviceObject := GetDevice(device) 3637 dstCacheObject := GetPipelineCache(dstCache) 3638 assert(dstCacheObject.device == device) 3639 3640 srcCaches := pSrcCaches[0:srcCacheCount] 3641 for i in (0 .. srcCacheCount) { 3642 srcCache := srcCaches[i] 3643 srcCacheObject := GetPipelineCache(srcCache) 3644 assert(srcCacheObject.device == device) 3645 } 3646 3647 return ? 3648} 3649 3650cmd VkResult vkCreateGraphicsPipelines( 3651 VkDevice device, 3652 VkPipelineCache pipelineCache, 3653 u32 createInfoCount, 3654 const VkGraphicsPipelineCreateInfo* pCreateInfos, 3655 const VkAllocationCallbacks* pAllocator, 3656 VkPipeline* pPipelines) { 3657 deviceObject := GetDevice(device) 3658 if pipelineCache != NULL_HANDLE { 3659 pipelineCacheObject := GetPipelineCache(pipelineCache) 3660 assert(pipelineCacheObject.device == device) 3661 } 3662 3663 createInfos := pCreateInfos[0:createInfoCount] 3664 pipelines := pPipelines[0:createInfoCount] 3665 for i in (0 .. createInfoCount) { 3666 pipeline := ? 3667 pipelines[i] = pipeline 3668 State.Pipelines[pipeline] = new!PipelineObject(device: device) 3669 } 3670 3671 return ? 3672} 3673 3674cmd VkResult vkCreateComputePipelines( 3675 VkDevice device, 3676 VkPipelineCache pipelineCache, 3677 u32 createInfoCount, 3678 const VkComputePipelineCreateInfo* pCreateInfos, 3679 const VkAllocationCallbacks* pAllocator, 3680 VkPipeline* pPipelines) { 3681 deviceObject := GetDevice(device) 3682 if pipelineCache != NULL_HANDLE { 3683 pipelineCacheObject := GetPipelineCache(pipelineCache) 3684 assert(pipelineCacheObject.device == device) 3685 } 3686 3687 createInfos := pCreateInfos[0:createInfoCount] 3688 pipelines := pPipelines[0:createInfoCount] 3689 for i in (0 .. createInfoCount) { 3690 pipeline := ? 3691 pipelines[i] = pipeline 3692 State.Pipelines[pipeline] = new!PipelineObject(device: device) 3693 } 3694 3695 return ? 3696} 3697 3698@threadSafety("system") 3699cmd void vkDestroyPipeline( 3700 VkDevice device, 3701 VkPipeline pipeline, 3702 const VkAllocationCallbacks* pAllocator) { 3703 deviceObject := GetDevice(device) 3704 pipelineObjects := GetPipeline(pipeline) 3705 assert(pipelineObjects.device == device) 3706 3707 State.Pipelines[pipeline] = null 3708} 3709 3710 3711// Pipeline layout functions 3712 3713@threadSafety("system") 3714cmd VkResult vkCreatePipelineLayout( 3715 VkDevice device, 3716 const VkPipelineLayoutCreateInfo* pCreateInfo, 3717 const VkAllocationCallbacks* pAllocator, 3718 VkPipelineLayout* pPipelineLayout) { 3719 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO) 3720 deviceObject := GetDevice(device) 3721 3722 pipelineLayout := ? 3723 pPipelineLayout[0] = pipelineLayout 3724 State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device) 3725 3726 return ? 3727} 3728 3729@threadSafety("system") 3730cmd void vkDestroyPipelineLayout( 3731 VkDevice device, 3732 VkPipelineLayout pipelineLayout, 3733 const VkAllocationCallbacks* pAllocator) { 3734 deviceObject := GetDevice(device) 3735 pipelineLayoutObjects := GetPipelineLayout(pipelineLayout) 3736 assert(pipelineLayoutObjects.device == device) 3737 3738 State.PipelineLayouts[pipelineLayout] = null 3739} 3740 3741 3742// Sampler functions 3743 3744@threadSafety("system") 3745cmd VkResult vkCreateSampler( 3746 VkDevice device, 3747 const VkSamplerCreateInfo* pCreateInfo, 3748 const VkAllocationCallbacks* pAllocator, 3749 VkSampler* pSampler) { 3750 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO) 3751 deviceObject := GetDevice(device) 3752 3753 sampler := ? 3754 pSampler[0] = sampler 3755 State.Samplers[sampler] = new!SamplerObject(device: device) 3756 3757 return ? 3758} 3759 3760@threadSafety("system") 3761cmd void vkDestroySampler( 3762 VkDevice device, 3763 VkSampler sampler, 3764 const VkAllocationCallbacks* pAllocator) { 3765 deviceObject := GetDevice(device) 3766 samplerObject := GetSampler(sampler) 3767 assert(samplerObject.device == device) 3768 3769 State.Samplers[sampler] = null 3770} 3771 3772 3773// Descriptor set functions 3774 3775@threadSafety("system") 3776cmd VkResult vkCreateDescriptorSetLayout( 3777 VkDevice device, 3778 const VkDescriptorSetLayoutCreateInfo* pCreateInfo, 3779 const VkAllocationCallbacks* pAllocator, 3780 VkDescriptorSetLayout* pSetLayout) { 3781 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO) 3782 deviceObject := GetDevice(device) 3783 3784 setLayout := ? 3785 pSetLayout[0] = setLayout 3786 State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device) 3787 3788 return ? 3789} 3790 3791@threadSafety("system") 3792cmd void vkDestroyDescriptorSetLayout( 3793 VkDevice device, 3794 VkDescriptorSetLayout descriptorSetLayout, 3795 const VkAllocationCallbacks* pAllocator) { 3796 deviceObject := GetDevice(device) 3797 descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout) 3798 assert(descriptorSetLayoutObject.device == device) 3799 3800 State.DescriptorSetLayouts[descriptorSetLayout] = null 3801} 3802 3803@threadSafety("system") 3804cmd VkResult vkCreateDescriptorPool( 3805 VkDevice device, 3806 const VkDescriptorPoolCreateInfo* pCreateInfo, 3807 const VkAllocationCallbacks* pAllocator, 3808 VkDescriptorPool* pDescriptorPool) { 3809 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO) 3810 deviceObject := GetDevice(device) 3811 3812 descriptorPool := ? 3813 pDescriptorPool[0] = descriptorPool 3814 State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device) 3815 3816 return ? 3817} 3818 3819@threadSafety("system") 3820cmd void vkDestroyDescriptorPool( 3821 VkDevice device, 3822 VkDescriptorPool descriptorPool, 3823 const VkAllocationCallbacks* pAllocator) { 3824 deviceObject := GetDevice(device) 3825 descriptorPoolObject := GetDescriptorPool(descriptorPool) 3826 assert(descriptorPoolObject.device == device) 3827 3828 State.DescriptorPools[descriptorPool] = null 3829} 3830 3831@threadSafety("app") 3832cmd VkResult vkResetDescriptorPool( 3833 VkDevice device, 3834 VkDescriptorPool descriptorPool, 3835 VkDescriptorPoolResetFlags flags) { 3836 deviceObject := GetDevice(device) 3837 descriptorPoolObject := GetDescriptorPool(descriptorPool) 3838 assert(descriptorPoolObject.device == device) 3839 3840 return ? 3841} 3842 3843@threadSafety("app") 3844cmd VkResult vkAllocateDescriptorSets( 3845 VkDevice device, 3846 const VkDescriptorSetAllocateInfo* pAllocateInfo, 3847 VkDescriptorSet* pDescriptorSets) { 3848 deviceObject := GetDevice(device) 3849 allocInfo := pAllocateInfo[0] 3850 descriptorPoolObject := GetDescriptorPool(allocInfo.descriptorPool) 3851 3852 setLayouts := allocInfo.pSetLayouts[0:allocInfo.setCount] 3853 for i in (0 .. allocInfo.setCount) { 3854 setLayout := setLayouts[i] 3855 setLayoutObject := GetDescriptorSetLayout(setLayout) 3856 assert(setLayoutObject.device == device) 3857 } 3858 3859 descriptorSets := pDescriptorSets[0:allocInfo.setCount] 3860 for i in (0 .. allocInfo.setCount) { 3861 descriptorSet := ? 3862 descriptorSets[i] = descriptorSet 3863 State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device) 3864 } 3865 3866 return ? 3867} 3868 3869cmd VkResult vkFreeDescriptorSets( 3870 VkDevice device, 3871 VkDescriptorPool descriptorPool, 3872 u32 descriptorSetCount, 3873 const VkDescriptorSet* pDescriptorSets) { 3874 deviceObject := GetDevice(device) 3875 descriptorPoolObject := GetDescriptorPool(descriptorPool) 3876 3877 descriptorSets := pDescriptorSets[0:descriptorSetCount] 3878 for i in (0 .. descriptorSetCount) { 3879 descriptorSet := descriptorSets[i] 3880 descriptorSetObject := GetDescriptorSet(descriptorSet) 3881 assert(descriptorSetObject.device == device) 3882 State.DescriptorSets[descriptorSet] = null 3883 } 3884 3885 return ? 3886} 3887 3888cmd void vkUpdateDescriptorSets( 3889 VkDevice device, 3890 u32 descriptorWriteCount, 3891 const VkWriteDescriptorSet* pDescriptorWrites, 3892 u32 descriptorCopyCount, 3893 const VkCopyDescriptorSet* pDescriptorCopies) { 3894 deviceObject := GetDevice(device) 3895 3896 descriptorWrites := pDescriptorWrites[0:descriptorWriteCount] 3897 for i in (0 .. descriptorWriteCount) { 3898 descriptorWrite := descriptorWrites[i] 3899 descriptorWriteObject := GetDescriptorSet(descriptorWrite.dstSet) 3900 assert(descriptorWriteObject.device == device) 3901 } 3902 3903 descriptorCopies := pDescriptorCopies[0:descriptorCopyCount] 3904 for i in (0 .. descriptorCopyCount) { 3905 descriptorCopy := descriptorCopies[i] 3906 descriptorCopyObject := GetDescriptorSet(descriptorCopy.dstSet) 3907 assert(descriptorCopyObject.device == device) 3908 } 3909} 3910 3911 3912// Framebuffer functions 3913 3914@threadSafety("system") 3915cmd VkResult vkCreateFramebuffer( 3916 VkDevice device, 3917 const VkFramebufferCreateInfo* pCreateInfo, 3918 const VkAllocationCallbacks* pAllocator, 3919 VkFramebuffer* pFramebuffer) { 3920 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO) 3921 deviceObject := GetDevice(device) 3922 3923 framebuffer := ? 3924 pFramebuffer[0] = framebuffer 3925 State.Framebuffers[framebuffer] = new!FramebufferObject(device: device) 3926 3927 return ? 3928} 3929 3930@threadSafety("system") 3931cmd void vkDestroyFramebuffer( 3932 VkDevice device, 3933 VkFramebuffer framebuffer, 3934 const VkAllocationCallbacks* pAllocator) { 3935 deviceObject := GetDevice(device) 3936 framebufferObject := GetFramebuffer(framebuffer) 3937 assert(framebufferObject.device == device) 3938 3939 State.Framebuffers[framebuffer] = null 3940} 3941 3942 3943// Renderpass functions 3944 3945@threadSafety("system") 3946cmd VkResult vkCreateRenderPass( 3947 VkDevice device, 3948 const VkRenderPassCreateInfo* pCreateInfo, 3949 const VkAllocationCallbacks* pAllocator, 3950 VkRenderPass* pRenderPass) { 3951 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO) 3952 deviceObject := GetDevice(device) 3953 3954 renderpass := ? 3955 pRenderPass[0] = renderpass 3956 State.RenderPasses[renderpass] = new!RenderPassObject(device: device) 3957 3958 return ? 3959} 3960 3961@threadSafety("system") 3962cmd void vkDestroyRenderPass( 3963 VkDevice device, 3964 VkRenderPass renderPass, 3965 const VkAllocationCallbacks* pAllocator) { 3966 deviceObject := GetDevice(device) 3967 renderPassObject := GetRenderPass(renderPass) 3968 assert(renderPassObject.device == device) 3969 3970 State.RenderPasses[renderPass] = null 3971} 3972 3973cmd void vkGetRenderAreaGranularity( 3974 VkDevice device, 3975 VkRenderPass renderPass, 3976 VkExtent2D* pGranularity) { 3977 deviceObject := GetDevice(device) 3978 renderPassObject := GetRenderPass(renderPass) 3979 3980 granularity := ? 3981 pGranularity[0] = granularity 3982} 3983 3984// Command pool functions 3985 3986cmd VkResult vkCreateCommandPool( 3987 VkDevice device, 3988 const VkCommandPoolCreateInfo* pCreateInfo, 3989 const VkAllocationCallbacks* pAllocator, 3990 VkCommandPool* pCommandPool) { 3991 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO) 3992 deviceObject := GetDevice(device) 3993 3994 commandPool := ? 3995 pCommandPool[0] = commandPool 3996 State.CommandPools[commandPool] = new!CommandPoolObject(device: device) 3997 3998 return ? 3999} 4000 4001cmd void vkDestroyCommandPool( 4002 VkDevice device, 4003 VkCommandPool commandPool, 4004 const VkAllocationCallbacks* pAllocator) { 4005 deviceObject := GetDevice(device) 4006 commandPoolObject := GetCommandPool(commandPool) 4007 assert(commandPoolObject.device == device) 4008 4009 State.CommandPools[commandPool] = null 4010} 4011 4012cmd VkResult vkResetCommandPool( 4013 VkDevice device, 4014 VkCommandPool commandPool, 4015 VkCommandPoolResetFlags flags) { 4016 deviceObject := GetDevice(device) 4017 commandPoolObject := GetCommandPool(commandPool) 4018 assert(commandPoolObject.device == device) 4019 4020 return ? 4021} 4022 4023// Command buffer functions 4024 4025macro void bindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) { 4026 memoryObject := GetDeviceMemory(memory) 4027 memoryObject.boundCommandBuffers[commandBuffer] = commandBuffer 4028 4029 commandBufferObject := GetCommandBuffer(commandBuffer) 4030 commandBufferObject.boundObjects[as!u64(obj)] = memory 4031} 4032 4033macro void unbindCommandBuffer(VkCommandBuffer commandBuffer, any obj, VkDeviceMemory memory) { 4034 memoryObject := GetDeviceMemory(memory) 4035 memoryObject.boundCommandBuffers[commandBuffer] = null 4036 4037 commandBufferObject := GetCommandBuffer(commandBuffer) 4038 commandBufferObject.boundObjects[as!u64(obj)] = null 4039} 4040 4041@threadSafety("system") 4042cmd VkResult vkAllocateCommandBuffers( 4043 VkDevice device, 4044 const VkCommandBufferAllocateInfo* pAllocateInfo, 4045 VkCommandBuffer* pCommandBuffers) { 4046 assert(pAllocateInfo[0].sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO) 4047 4048 count := pAllocateInfo[0].commandBufferCount 4049 commandBuffers := pCommandBuffers[0:count] 4050 for i in (0 .. count) { 4051 commandBuffer := ? 4052 commandBuffers[i] = commandBuffer 4053 State.CommandBuffers[commandBuffer] = new!CommandBufferObject(device: device) 4054 } 4055 4056 return ? 4057} 4058 4059@threadSafety("system") 4060cmd void vkFreeCommandBuffers( 4061 VkDevice device, 4062 VkCommandPool commandPool, 4063 u32 commandBufferCount, 4064 const VkCommandBuffer* pCommandBuffers) { 4065 deviceObject := GetDevice(device) 4066 4067 commandBuffers := pCommandBuffers[0:commandBufferCount] 4068 for i in (0 .. commandBufferCount) { 4069 commandBufferObject := GetCommandBuffer(commandBuffers[i]) 4070 assert(commandBufferObject.device == device) 4071 // TODO: iterate over boundObjects and clear memory bindings 4072 State.CommandBuffers[commandBuffers[i]] = null 4073 } 4074} 4075 4076@threadSafety("app") 4077cmd VkResult vkBeginCommandBuffer( 4078 VkCommandBuffer commandBuffer, 4079 const VkCommandBufferBeginInfo* pBeginInfo) { 4080 assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO) 4081 commandBufferObject := GetCommandBuffer(commandBuffer) 4082 4083 // TODO: iterate over boundObjects and clear memory bindings 4084 4085 return ? 4086} 4087 4088@threadSafety("app") 4089cmd VkResult vkEndCommandBuffer( 4090 VkCommandBuffer commandBuffer) { 4091 commandBufferObject := GetCommandBuffer(commandBuffer) 4092 4093 return ? 4094} 4095 4096@threadSafety("app") 4097cmd VkResult vkResetCommandBuffer( 4098 VkCommandBuffer commandBuffer, 4099 VkCommandBufferResetFlags flags) { 4100 commandBufferObject := GetCommandBuffer(commandBuffer) 4101 4102 // TODO: iterate over boundObjects and clear memory bindings 4103 4104 return ? 4105} 4106 4107 4108// Command buffer building functions 4109 4110@threadSafety("app") 4111cmd void vkCmdBindPipeline( 4112 VkCommandBuffer commandBuffer, 4113 VkPipelineBindPoint pipelineBindPoint, 4114 VkPipeline pipeline) { 4115 commandBufferObject := GetCommandBuffer(commandBuffer) 4116 pipelineObject := GetPipeline(pipeline) 4117 assert(commandBufferObject.device == pipelineObject.device) 4118 4119 queue := switch (pipelineBindPoint) { 4120 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT 4121 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT 4122 } 4123 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue) 4124} 4125 4126@threadSafety("app") 4127cmd void vkCmdSetViewport( 4128 VkCommandBuffer commandBuffer, 4129 u32 firstViewport, 4130 u32 viewportCount, 4131 const VkViewport* pViewports) { 4132 commandBufferObject := GetCommandBuffer(commandBuffer) 4133 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4134} 4135 4136@threadSafety("app") 4137cmd void vkCmdSetScissor( 4138 VkCommandBuffer commandBuffer, 4139 u32 firstScissor, 4140 u32 scissorCount, 4141 const VkRect2D* pScissors) { 4142 commandBufferObject := GetCommandBuffer(commandBuffer) 4143 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4144} 4145 4146@threadSafety("app") 4147cmd void vkCmdSetLineWidth( 4148 VkCommandBuffer commandBuffer, 4149 f32 lineWidth) { 4150 commandBufferObject := GetCommandBuffer(commandBuffer) 4151 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4152} 4153 4154@threadSafety("app") 4155cmd void vkCmdSetDepthBias( 4156 VkCommandBuffer commandBuffer, 4157 f32 depthBiasConstantFactor, 4158 f32 depthBiasClamp, 4159 f32 depthBiasSlopeFactor) { 4160 commandBufferObject := GetCommandBuffer(commandBuffer) 4161 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4162} 4163 4164@threadSafety("app") 4165cmd void vkCmdSetBlendConstants( 4166 VkCommandBuffer commandBuffer, 4167 // TODO(jessehall): apic only supports 'const' on pointer types. Using 4168 // an annotation as a quick hack to pass this to the template without 4169 // having to modify the AST and semantic model. 4170 @readonly f32[4] blendConstants) { 4171 commandBufferObject := GetCommandBuffer(commandBuffer) 4172 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4173} 4174 4175@threadSafety("app") 4176cmd void vkCmdSetDepthBounds( 4177 VkCommandBuffer commandBuffer, 4178 f32 minDepthBounds, 4179 f32 maxDepthBounds) { 4180 commandBufferObject := GetCommandBuffer(commandBuffer) 4181 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4182} 4183 4184@threadSafety("app") 4185cmd void vkCmdSetStencilCompareMask( 4186 VkCommandBuffer commandBuffer, 4187 VkStencilFaceFlags faceMask, 4188 u32 compareMask) { 4189 commandBufferObject := GetCommandBuffer(commandBuffer) 4190 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4191} 4192 4193@threadSafety("app") 4194cmd void vkCmdSetStencilWriteMask( 4195 VkCommandBuffer commandBuffer, 4196 VkStencilFaceFlags faceMask, 4197 u32 writeMask) { 4198 commandBufferObject := GetCommandBuffer(commandBuffer) 4199 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4200} 4201 4202@threadSafety("app") 4203cmd void vkCmdSetStencilReference( 4204 VkCommandBuffer commandBuffer, 4205 VkStencilFaceFlags faceMask, 4206 u32 reference) { 4207 commandBufferObject := GetCommandBuffer(commandBuffer) 4208 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4209} 4210 4211@threadSafety("app") 4212cmd void vkCmdBindDescriptorSets( 4213 VkCommandBuffer commandBuffer, 4214 VkPipelineBindPoint pipelineBindPoint, 4215 VkPipelineLayout layout, 4216 u32 firstSet, 4217 u32 descriptorSetCount, 4218 const VkDescriptorSet* pDescriptorSets, 4219 u32 dynamicOffsetCount, 4220 const u32* pDynamicOffsets) { 4221 commandBufferObject := GetCommandBuffer(commandBuffer) 4222 4223 descriptorSets := pDescriptorSets[0:descriptorSetCount] 4224 for i in (0 .. descriptorSetCount) { 4225 descriptorSet := descriptorSets[i] 4226 descriptorSetObject := GetDescriptorSet(descriptorSet) 4227 assert(commandBufferObject.device == descriptorSetObject.device) 4228 } 4229 4230 dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount] 4231 for i in (0 .. dynamicOffsetCount) { 4232 dynamicOffset := dynamicOffsets[i] 4233 } 4234 4235 queue := switch (pipelineBindPoint) { 4236 case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT 4237 case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT 4238 } 4239 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, queue) 4240} 4241 4242@threadSafety("app") 4243cmd void vkCmdBindIndexBuffer( 4244 VkCommandBuffer commandBuffer, 4245 VkBuffer buffer, 4246 VkDeviceSize offset, 4247 VkIndexType indexType) { 4248 commandBufferObject := GetCommandBuffer(commandBuffer) 4249 bufferObject := GetBuffer(buffer) 4250 assert(commandBufferObject.device == bufferObject.device) 4251 4252 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory) 4253 4254 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4255} 4256 4257@threadSafety("app") 4258cmd void vkCmdBindVertexBuffers( 4259 VkCommandBuffer commandBuffer, 4260 u32 firstBinding, 4261 u32 bindingCount, 4262 const VkBuffer* pBuffers, 4263 const VkDeviceSize* pOffsets) { 4264 commandBufferObject := GetCommandBuffer(commandBuffer) 4265 4266 // TODO: check if not [firstBinding:firstBinding+bindingCount] 4267 buffers := pBuffers[0:bindingCount] 4268 offsets := pOffsets[0:bindingCount] 4269 for i in (0 .. bindingCount) { 4270 buffer := buffers[i] 4271 offset := offsets[i] 4272 bufferObject := GetBuffer(buffer) 4273 assert(commandBufferObject.device == bufferObject.device) 4274 4275 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory) 4276 } 4277 4278 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4279} 4280 4281@threadSafety("app") 4282cmd void vkCmdDraw( 4283 VkCommandBuffer commandBuffer, 4284 u32 vertexCount, 4285 u32 instanceCount, 4286 u32 firstVertex, 4287 u32 firstInstance) { 4288 commandBufferObject := GetCommandBuffer(commandBuffer) 4289 4290 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4291} 4292 4293@threadSafety("app") 4294cmd void vkCmdDrawIndexed( 4295 VkCommandBuffer commandBuffer, 4296 u32 indexCount, 4297 u32 instanceCount, 4298 u32 firstIndex, 4299 s32 vertexOffset, 4300 u32 firstInstance) { 4301 commandBufferObject := GetCommandBuffer(commandBuffer) 4302 4303 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4304} 4305 4306@threadSafety("app") 4307cmd void vkCmdDrawIndirect( 4308 VkCommandBuffer commandBuffer, 4309 VkBuffer buffer, 4310 VkDeviceSize offset, 4311 u32 drawCount, 4312 u32 stride) { 4313 commandBufferObject := GetCommandBuffer(commandBuffer) 4314 bufferObject := GetBuffer(buffer) 4315 assert(commandBufferObject.device == bufferObject.device) 4316 4317 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory) 4318 4319 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4320} 4321 4322@threadSafety("app") 4323cmd void vkCmdDrawIndexedIndirect( 4324 VkCommandBuffer commandBuffer, 4325 VkBuffer buffer, 4326 VkDeviceSize offset, 4327 u32 drawCount, 4328 u32 stride) { 4329 commandBufferObject := GetCommandBuffer(commandBuffer) 4330 bufferObject := GetBuffer(buffer) 4331 assert(commandBufferObject.device == bufferObject.device) 4332 4333 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory) 4334 4335 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4336} 4337 4338@threadSafety("app") 4339cmd void vkCmdDispatch( 4340 VkCommandBuffer commandBuffer, 4341 u32 x, 4342 u32 y, 4343 u32 z) { 4344 commandBufferObject := GetCommandBuffer(commandBuffer) 4345 4346 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT) 4347} 4348 4349@threadSafety("app") 4350cmd void vkCmdDispatchIndirect( 4351 VkCommandBuffer commandBuffer, 4352 VkBuffer buffer, 4353 VkDeviceSize offset) { 4354 commandBufferObject := GetCommandBuffer(commandBuffer) 4355 bufferObject := GetBuffer(buffer) 4356 assert(commandBufferObject.device == bufferObject.device) 4357 4358 bindCommandBuffer(commandBuffer, buffer, bufferObject.memory) 4359 4360 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_COMPUTE_BIT) 4361} 4362 4363@threadSafety("app") 4364cmd void vkCmdCopyBuffer( 4365 VkCommandBuffer commandBuffer, 4366 VkBuffer srcBuffer, 4367 VkBuffer dstBuffer, 4368 u32 regionCount, 4369 const VkBufferCopy* pRegions) { 4370 commandBufferObject := GetCommandBuffer(commandBuffer) 4371 srcBufferObject := GetBuffer(srcBuffer) 4372 dstBufferObject := GetBuffer(dstBuffer) 4373 assert(commandBufferObject.device == srcBufferObject.device) 4374 assert(commandBufferObject.device == dstBufferObject.device) 4375 4376 regions := pRegions[0:regionCount] 4377 for i in (0 .. regionCount) { 4378 region := regions[i] 4379 } 4380 4381 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory) 4382 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory) 4383 4384 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT) 4385} 4386 4387@threadSafety("app") 4388cmd void vkCmdCopyImage( 4389 VkCommandBuffer commandBuffer, 4390 VkImage srcImage, 4391 VkImageLayout srcImageLayout, 4392 VkImage dstImage, 4393 VkImageLayout dstImageLayout, 4394 u32 regionCount, 4395 const VkImageCopy* pRegions) { 4396 commandBufferObject := GetCommandBuffer(commandBuffer) 4397 srcImageObject := GetImage(srcImage) 4398 dstImageObject := GetImage(dstImage) 4399 assert(commandBufferObject.device == srcImageObject.device) 4400 assert(commandBufferObject.device == dstImageObject.device) 4401 4402 regions := pRegions[0:regionCount] 4403 for i in (0 .. regionCount) { 4404 region := regions[i] 4405 } 4406 4407 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory) 4408 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory) 4409 4410 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT) 4411} 4412 4413@threadSafety("app") 4414cmd void vkCmdBlitImage( 4415 VkCommandBuffer commandBuffer, 4416 VkImage srcImage, 4417 VkImageLayout srcImageLayout, 4418 VkImage dstImage, 4419 VkImageLayout dstImageLayout, 4420 u32 regionCount, 4421 const VkImageBlit* pRegions, 4422 VkFilter filter) { 4423 commandBufferObject := GetCommandBuffer(commandBuffer) 4424 srcImageObject := GetImage(srcImage) 4425 dstImageObject := GetImage(dstImage) 4426 assert(commandBufferObject.device == srcImageObject.device) 4427 assert(commandBufferObject.device == dstImageObject.device) 4428 4429 regions := pRegions[0:regionCount] 4430 for i in (0 .. regionCount) { 4431 region := regions[i] 4432 } 4433 4434 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory) 4435 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory) 4436 4437 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4438} 4439 4440@threadSafety("app") 4441cmd void vkCmdCopyBufferToImage( 4442 VkCommandBuffer commandBuffer, 4443 VkBuffer srcBuffer, 4444 VkImage dstImage, 4445 VkImageLayout dstImageLayout, 4446 u32 regionCount, 4447 const VkBufferImageCopy* pRegions) { 4448 commandBufferObject := GetCommandBuffer(commandBuffer) 4449 srcBufferObject := GetBuffer(srcBuffer) 4450 dstImageObject := GetImage(dstImage) 4451 assert(commandBufferObject.device == srcBufferObject.device) 4452 assert(commandBufferObject.device == dstImageObject.device) 4453 4454 regions := pRegions[0:regionCount] 4455 for i in (0 .. regionCount) { 4456 region := regions[i] 4457 } 4458 4459 bindCommandBuffer(commandBuffer, srcBuffer, srcBufferObject.memory) 4460 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory) 4461 4462 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT) 4463} 4464 4465@threadSafety("app") 4466cmd void vkCmdCopyImageToBuffer( 4467 VkCommandBuffer commandBuffer, 4468 VkImage srcImage, 4469 VkImageLayout srcImageLayout, 4470 VkBuffer dstBuffer, 4471 u32 regionCount, 4472 const VkBufferImageCopy* pRegions) { 4473 commandBufferObject := GetCommandBuffer(commandBuffer) 4474 srcImageObject := GetImage(srcImage) 4475 dstBufferObject := GetBuffer(dstBuffer) 4476 assert(commandBufferObject.device == srcImageObject.device) 4477 assert(commandBufferObject.device == dstBufferObject.device) 4478 4479 regions := pRegions[0:regionCount] 4480 for i in (0 .. regionCount) { 4481 region := regions[i] 4482 } 4483 4484 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory) 4485 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory) 4486 4487 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT) 4488} 4489 4490@threadSafety("app") 4491cmd void vkCmdUpdateBuffer( 4492 VkCommandBuffer commandBuffer, 4493 VkBuffer dstBuffer, 4494 VkDeviceSize dstOffset, 4495 VkDeviceSize dataSize, 4496 const u32* pData) { 4497 commandBufferObject := GetCommandBuffer(commandBuffer) 4498 dstBufferObject := GetBuffer(dstBuffer) 4499 assert(commandBufferObject.device == dstBufferObject.device) 4500 4501 data := pData[0:dataSize] 4502 4503 bindCommandBuffer(commandBuffer, dstBuffer, dstBufferObject.memory) 4504 4505 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT) 4506} 4507 4508@threadSafety("app") 4509cmd void vkCmdFillBuffer( 4510 VkCommandBuffer commandBuffer, 4511 VkBuffer dstBuffer, 4512 VkDeviceSize dstOffset, 4513 VkDeviceSize size, 4514 u32 data) { 4515 commandBufferObject := GetCommandBuffer(commandBuffer) 4516 dstBufferObject := GetBuffer(dstBuffer) 4517 assert(commandBufferObject.device == dstBufferObject.device) 4518 4519 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_TRANSFER_BIT) 4520} 4521 4522@threadSafety("app") 4523cmd void vkCmdClearColorImage( 4524 VkCommandBuffer commandBuffer, 4525 VkImage image, 4526 VkImageLayout imageLayout, 4527 const VkClearColorValue* pColor, 4528 u32 rangeCount, 4529 const VkImageSubresourceRange* pRanges) { 4530 commandBufferObject := GetCommandBuffer(commandBuffer) 4531 imageObject := GetImage(image) 4532 assert(commandBufferObject.device == imageObject.device) 4533 4534 ranges := pRanges[0:rangeCount] 4535 for i in (0 .. rangeCount) { 4536 range := ranges[i] 4537 } 4538 4539 bindCommandBuffer(commandBuffer, image, imageObject.memory) 4540 4541 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4542} 4543 4544@threadSafety("app") 4545cmd void vkCmdClearDepthStencilImage( 4546 VkCommandBuffer commandBuffer, 4547 VkImage image, 4548 VkImageLayout imageLayout, 4549 const VkClearDepthStencilValue* pDepthStencil, 4550 u32 rangeCount, 4551 const VkImageSubresourceRange* pRanges) { 4552 commandBufferObject := GetCommandBuffer(commandBuffer) 4553 imageObject := GetImage(image) 4554 assert(commandBufferObject.device == imageObject.device) 4555 4556 ranges := pRanges[0:rangeCount] 4557 for i in (0 .. rangeCount) { 4558 range := ranges[i] 4559 } 4560 4561 bindCommandBuffer(commandBuffer, image, imageObject.memory) 4562 4563 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4564} 4565 4566@threadSafety("app") 4567cmd void vkCmdClearAttachments( 4568 VkCommandBuffer commandBuffer, 4569 u32 attachmentCount, 4570 const VkClearAttachment* pAttachments, 4571 u32 rectCount, 4572 const VkClearRect* pRects) { 4573 commandBufferObject := GetCommandBuffer(commandBuffer) 4574 4575 rects := pRects[0:rectCount] 4576 for i in (0 .. rectCount) { 4577 rect := rects[i] 4578 } 4579 4580 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4581} 4582 4583@threadSafety("app") 4584cmd void vkCmdResolveImage( 4585 VkCommandBuffer commandBuffer, 4586 VkImage srcImage, 4587 VkImageLayout srcImageLayout, 4588 VkImage dstImage, 4589 VkImageLayout dstImageLayout, 4590 u32 regionCount, 4591 const VkImageResolve* pRegions) { 4592 commandBufferObject := GetCommandBuffer(commandBuffer) 4593 srcImageObject := GetImage(srcImage) 4594 dstImageObject := GetImage(dstImage) 4595 assert(commandBufferObject.device == srcImageObject.device) 4596 assert(commandBufferObject.device == dstImageObject.device) 4597 4598 regions := pRegions[0:regionCount] 4599 for i in (0 .. regionCount) { 4600 region := regions[i] 4601 } 4602 4603 bindCommandBuffer(commandBuffer, srcImage, srcImageObject.memory) 4604 bindCommandBuffer(commandBuffer, dstImage, dstImageObject.memory) 4605 4606 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4607} 4608 4609@threadSafety("app") 4610cmd void vkCmdSetEvent( 4611 VkCommandBuffer commandBuffer, 4612 VkEvent event, 4613 VkPipelineStageFlags stageMask) { 4614 commandBufferObject := GetCommandBuffer(commandBuffer) 4615 eventObject := GetEvent(event) 4616 assert(commandBufferObject.device == eventObject.device) 4617} 4618 4619@threadSafety("app") 4620cmd void vkCmdResetEvent( 4621 VkCommandBuffer commandBuffer, 4622 VkEvent event, 4623 VkPipelineStageFlags stageMask) { 4624 commandBufferObject := GetCommandBuffer(commandBuffer) 4625 eventObject := GetEvent(event) 4626 assert(commandBufferObject.device == eventObject.device) 4627} 4628 4629@threadSafety("app") 4630cmd void vkCmdWaitEvents( 4631 VkCommandBuffer commandBuffer, 4632 u32 eventCount, 4633 const VkEvent* pEvents, 4634 VkPipelineStageFlags srcStageMask, 4635 VkPipelineStageFlags dstStageMask, 4636 u32 memoryBarrierCount, 4637 const VkMemoryBarrier* pMemoryBarriers, 4638 u32 bufferMemoryBarrierCount, 4639 const VkBufferMemoryBarrier* pBufferMemoryBarriers, 4640 u32 imageMemoryBarrierCount, 4641 const VkImageMemoryBarrier* pImageMemoryBarriers) { 4642 commandBufferObject := GetCommandBuffer(commandBuffer) 4643 4644 events := pEvents[0:eventCount] 4645 for i in (0 .. eventCount) { 4646 event := events[i] 4647 eventObject := GetEvent(event) 4648 assert(commandBufferObject.device == eventObject.device) 4649 } 4650 4651 memoryBarriers := pMemoryBarriers[0:memoryBarrierCount] 4652 for i in (0 .. memoryBarrierCount) { 4653 memoryBarrier := memoryBarriers[i] 4654 } 4655 bufferMemoryBarriers := pBufferMemoryBarriers[0:bufferMemoryBarrierCount] 4656 for i in (0 .. bufferMemoryBarrierCount) { 4657 bufferMemoryBarrier := bufferMemoryBarriers[i] 4658 bufferObject := GetBuffer(bufferMemoryBarrier.buffer) 4659 assert(bufferObject.device == commandBufferObject.device) 4660 } 4661 imageMemoryBarriers := pImageMemoryBarriers[0:imageMemoryBarrierCount] 4662 for i in (0 .. imageMemoryBarrierCount) { 4663 imageMemoryBarrier := imageMemoryBarriers[i] 4664 imageObject := GetImage(imageMemoryBarrier.image) 4665 assert(imageObject.device == commandBufferObject.device) 4666 } 4667} 4668 4669@threadSafety("app") 4670cmd void vkCmdPipelineBarrier( 4671 VkCommandBuffer commandBuffer, 4672 VkPipelineStageFlags srcStageMask, 4673 VkPipelineStageFlags dstStageMask, 4674 VkDependencyFlags dependencyFlags, 4675 u32 memoryBarrierCount, 4676 const VkMemoryBarrier* pMemoryBarriers, 4677 u32 bufferMemoryBarrierCount, 4678 const VkBufferMemoryBarrier* pBufferMemoryBarriers, 4679 u32 imageMemoryBarrierCount, 4680 const VkImageMemoryBarrier* pImageMemoryBarriers) { 4681 commandBufferObject := GetCommandBuffer(commandBuffer) 4682 4683 memoryBarriers := pMemoryBarriers[0:memoryBarrierCount] 4684 for i in (0 .. memoryBarrierCount) { 4685 memoryBarrier := memoryBarriers[i] 4686 } 4687 bufferMemoryBarriers := pBufferMemoryBarriers[0:bufferMemoryBarrierCount] 4688 for i in (0 .. bufferMemoryBarrierCount) { 4689 bufferMemoryBarrier := bufferMemoryBarriers[i] 4690 bufferObject := GetBuffer(bufferMemoryBarrier.buffer) 4691 assert(bufferObject.device == commandBufferObject.device) 4692 } 4693 imageMemoryBarriers := pImageMemoryBarriers[0:imageMemoryBarrierCount] 4694 for i in (0 .. imageMemoryBarrierCount) { 4695 imageMemoryBarrier := imageMemoryBarriers[i] 4696 imageObject := GetImage(imageMemoryBarrier.image) 4697 assert(imageObject.device == commandBufferObject.device) 4698 } 4699} 4700 4701@threadSafety("app") 4702cmd void vkCmdBeginQuery( 4703 VkCommandBuffer commandBuffer, 4704 VkQueryPool queryPool, 4705 u32 query, 4706 VkQueryControlFlags flags) { 4707 commandBufferObject := GetCommandBuffer(commandBuffer) 4708 queryPoolObject := GetQueryPool(queryPool) 4709 assert(commandBufferObject.device == queryPoolObject.device) 4710} 4711 4712@threadSafety("app") 4713cmd void vkCmdEndQuery( 4714 VkCommandBuffer commandBuffer, 4715 VkQueryPool queryPool, 4716 u32 query) { 4717 commandBufferObject := GetCommandBuffer(commandBuffer) 4718 queryPoolObject := GetQueryPool(queryPool) 4719 assert(commandBufferObject.device == queryPoolObject.device) 4720} 4721 4722@threadSafety("app") 4723cmd void vkCmdResetQueryPool( 4724 VkCommandBuffer commandBuffer, 4725 VkQueryPool queryPool, 4726 u32 firstQuery, 4727 u32 queryCount) { 4728 commandBufferObject := GetCommandBuffer(commandBuffer) 4729 queryPoolObject := GetQueryPool(queryPool) 4730 assert(commandBufferObject.device == queryPoolObject.device) 4731} 4732 4733@threadSafety("app") 4734cmd void vkCmdWriteTimestamp( 4735 VkCommandBuffer commandBuffer, 4736 VkPipelineStageFlagBits pipelineStage, 4737 VkQueryPool queryPool, 4738 u32 query) { 4739 commandBufferObject := GetCommandBuffer(commandBuffer) 4740 queryPoolObject := GetQueryPool(queryPool) 4741 assert(commandBufferObject.device == queryPoolObject.device) 4742} 4743 4744@threadSafety("app") 4745cmd void vkCmdCopyQueryPoolResults( 4746 VkCommandBuffer commandBuffer, 4747 VkQueryPool queryPool, 4748 u32 firstQuery, 4749 u32 queryCount, 4750 VkBuffer dstBuffer, 4751 VkDeviceSize dstOffset, 4752 VkDeviceSize stride, 4753 VkQueryResultFlags flags) { 4754 commandBufferObject := GetCommandBuffer(commandBuffer) 4755 queryPoolObject := GetQueryPool(queryPool) 4756 dstBufferObject := GetBuffer(dstBuffer) 4757 assert(commandBufferObject.device == queryPoolObject.device) 4758 assert(commandBufferObject.device == dstBufferObject.device) 4759} 4760 4761cmd void vkCmdPushConstants( 4762 VkCommandBuffer commandBuffer, 4763 VkPipelineLayout layout, 4764 VkShaderStageFlags stageFlags, 4765 u32 offset, 4766 u32 size, 4767 const void* pValues) { 4768 commandBufferObject := GetCommandBuffer(commandBuffer) 4769 layoutObject := GetPipelineLayout(layout) 4770 assert(commandBufferObject.device == layoutObject.device) 4771} 4772 4773@threadSafety("app") 4774cmd void vkCmdBeginRenderPass( 4775 VkCommandBuffer commandBuffer, 4776 const VkRenderPassBeginInfo* pRenderPassBegin, 4777 VkSubpassContents contents) { 4778 commandBufferObject := GetCommandBuffer(commandBuffer) 4779 renderPassObject := GetRenderPass(pRenderPassBegin.renderPass) 4780 framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer) 4781 assert(commandBufferObject.device == renderPassObject.device) 4782 assert(commandBufferObject.device == framebufferObject.device) 4783 4784 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4785} 4786 4787cmd void vkCmdNextSubpass( 4788 VkCommandBuffer commandBuffer, 4789 VkSubpassContents contents) { 4790 commandBufferObject := GetCommandBuffer(commandBuffer) 4791} 4792 4793@threadSafety("app") 4794cmd void vkCmdEndRenderPass( 4795 VkCommandBuffer commandBuffer) { 4796 commandBufferObject := GetCommandBuffer(commandBuffer) 4797 4798 commandBufferObject.queueFlags = AddQueueFlag(commandBufferObject.queueFlags, VK_QUEUE_GRAPHICS_BIT) 4799} 4800 4801cmd void vkCmdExecuteCommands( 4802 VkCommandBuffer commandBuffer, 4803 u32 commandBufferCount, 4804 const VkCommandBuffer* pCommandBuffers) { 4805 commandBufferObject := GetCommandBuffer(commandBuffer) 4806 4807 commandBuffers := pCommandBuffers[0:commandBufferCount] 4808 for i in (0 .. commandBufferCount) { 4809 secondaryCommandBuffer := commandBuffers[i] 4810 secondaryCommandBufferObject := GetCommandBuffer(secondaryCommandBuffer) 4811 assert(commandBufferObject.device == secondaryCommandBufferObject.device) 4812 } 4813} 4814 4815@extension("VK_KHR_surface") 4816cmd void vkDestroySurfaceKHR( 4817 VkInstance instance, 4818 VkSurfaceKHR surface, 4819 const VkAllocationCallbacks* pAllocator) { 4820 instanceObject := GetInstance(instance) 4821 surfaceObject := GetSurface(surface) 4822 assert(surfaceObject.instance == instance) 4823 4824 State.Surfaces[surface] = null 4825} 4826 4827@extension("VK_KHR_surface") 4828cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR( 4829 VkPhysicalDevice physicalDevice, 4830 u32 queueFamilyIndex, 4831 VkSurfaceKHR surface, 4832 VkBool32* pSupported) { 4833 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4834 4835 return ? 4836} 4837 4838@extension("VK_KHR_surface") 4839cmd VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR( 4840 VkPhysicalDevice physicalDevice, 4841 VkSurfaceKHR surface, 4842 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) { 4843 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4844 4845 surfaceCapabilities := ? 4846 pSurfaceCapabilities[0] = surfaceCapabilities 4847 4848 return ? 4849} 4850 4851@extension("VK_KHR_surface") 4852cmd VkResult vkGetPhysicalDeviceSurfaceFormatsKHR( 4853 VkPhysicalDevice physicalDevice, 4854 VkSurfaceKHR surface, 4855 u32* pSurfaceFormatCount, 4856 VkSurfaceFormatKHR* pSurfaceFormats) { 4857 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4858 4859 count := as!u32(?) 4860 pSurfaceFormatCount[0] = count 4861 surfaceFormats := pSurfaceFormats[0:count] 4862 4863 for i in (0 .. count) { 4864 surfaceFormat := ? 4865 surfaceFormats[i] = surfaceFormat 4866 } 4867 4868 return ? 4869} 4870 4871@extension("VK_KHR_surface") 4872cmd VkResult vkGetPhysicalDeviceSurfacePresentModesKHR( 4873 VkPhysicalDevice physicalDevice, 4874 VkSurfaceKHR surface, 4875 u32* pPresentModeCount, 4876 VkPresentModeKHR* pPresentModes) { 4877 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4878 4879 count := as!u32(?) 4880 pPresentModeCount[0] = count 4881 presentModes := pPresentModes[0:count] 4882 4883 for i in (0 .. count) { 4884 presentMode := ? 4885 presentModes[i] = presentMode 4886 } 4887 4888 return ? 4889} 4890 4891@extension("VK_KHR_swapchain") 4892cmd VkResult vkCreateSwapchainKHR( 4893 VkDevice device, 4894 const VkSwapchainCreateInfoKHR* pCreateInfo, 4895 const VkAllocationCallbacks* pAllocator, 4896 VkSwapchainKHR* pSwapchain) { 4897 assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR) 4898 deviceObject := GetDevice(device) 4899 4900 swapchain := ? 4901 pSwapchain[0] = swapchain 4902 State.Swapchains[swapchain] = new!SwapchainObject(device: device) 4903 4904 return ? 4905} 4906 4907@extension("VK_KHR_swapchain") 4908cmd void vkDestroySwapchainKHR( 4909 VkDevice device, 4910 VkSwapchainKHR swapchain, 4911 const VkAllocationCallbacks* pAllocator) { 4912 deviceObject := GetDevice(device) 4913 swapchainObject := GetSwapchain(swapchain) 4914 assert(swapchainObject.device == device) 4915 4916 State.Swapchains[swapchain] = null 4917} 4918 4919@extension("VK_KHR_swapchain") 4920cmd VkResult vkGetSwapchainImagesKHR( 4921 VkDevice device, 4922 VkSwapchainKHR swapchain, 4923 u32* pSwapchainImageCount, 4924 VkImage* pSwapchainImages) { 4925 deviceObject := GetDevice(device) 4926 4927 count := as!u32(?) 4928 pSwapchainImageCount[0] = count 4929 swapchainImages := pSwapchainImages[0:count] 4930 4931 for i in (0 .. count) { 4932 swapchainImage := ? 4933 swapchainImages[i] = swapchainImage 4934 State.Images[swapchainImage] = new!ImageObject(device: device) 4935 } 4936 4937 return ? 4938} 4939 4940@extension("VK_KHR_swapchain") 4941cmd VkResult vkAcquireNextImageKHR( 4942 VkDevice device, 4943 VkSwapchainKHR swapchain, 4944 u64 timeout, 4945 VkSemaphore semaphore, 4946 VkFence fence, 4947 u32* pImageIndex) { 4948 deviceObject := GetDevice(device) 4949 swapchainObject := GetSwapchain(swapchain) 4950 4951 imageIndex := ? 4952 pImageIndex[0] = imageIndex 4953 4954 return ? 4955} 4956 4957@extension("VK_KHR_swapchain") 4958cmd VkResult vkQueuePresentKHR( 4959 VkQueue queue, 4960 const VkPresentInfoKHR* pPresentInfo) { 4961 queueObject := GetQueue(queue) 4962 4963 presentInfo := ? 4964 pPresentInfo[0] = presentInfo 4965 4966 return ? 4967} 4968 4969@extension("VK_KHR_display") 4970cmd VkResult vkGetPhysicalDeviceDisplayPropertiesKHR( 4971 VkPhysicalDevice physicalDevice, 4972 u32* pPropertyCount, 4973 VkDisplayPropertiesKHR* pProperties) { 4974 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4975 return ? 4976} 4977 4978@extension("VK_KHR_display") 4979cmd VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR( 4980 VkPhysicalDevice physicalDevice, 4981 u32* pPropertyCount, 4982 VkDisplayPlanePropertiesKHR* pProperties) { 4983 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4984 return ? 4985} 4986 4987@extension("VK_KHR_display") 4988cmd VkResult vkGetDisplayPlaneSupportedDisplaysKHR( 4989 VkPhysicalDevice physicalDevice, 4990 u32 planeIndex, 4991 u32* pDisplayCount, 4992 VkDisplayKHR* pDisplays) { 4993 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 4994 return ? 4995} 4996 4997@extension("VK_KHR_display") 4998cmd VkResult vkGetDisplayModePropertiesKHR( 4999 VkPhysicalDevice physicalDevice, 5000 VkDisplayKHR display, 5001 u32* pPropertyCount, 5002 VkDisplayModePropertiesKHR* pProperties) { 5003 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 5004 return ? 5005} 5006 5007@extension("VK_KHR_display") 5008cmd VkResult vkCreateDisplayModeKHR( 5009 VkPhysicalDevice physicalDevice, 5010 VkDisplayKHR display, 5011 const VkDisplayModeCreateInfoKHR* pCreateInfo, 5012 const VkAllocationCallbacks* pAllocator, 5013 VkDisplayModeKHR* pMode) { 5014 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 5015 return ? 5016} 5017 5018@extension("VK_KHR_display") 5019cmd VkResult vkGetDisplayPlaneCapabilitiesKHR( 5020 VkPhysicalDevice physicalDevice, 5021 VkDisplayModeKHR mode, 5022 u32 planeIndex, 5023 VkDisplayPlaneCapabilitiesKHR* pCapabilities) { 5024 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 5025 return ? 5026} 5027 5028@extension("VK_KHR_display") 5029cmd VkResult vkCreateDisplayPlaneSurfaceKHR( 5030 VkInstance instance, 5031 const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, 5032 const VkAllocationCallbacks* pAllocator, 5033 VkSurfaceKHR* pSurface) { 5034 return ? 5035} 5036 5037@extension("VK_KHR_display_swapchain") 5038cmd VkResult vkCreateSharedSwapchainsKHR( 5039 VkDevice device, 5040 u32 swapchainCount, 5041 const VkSwapchainCreateInfoKHR* pCreateInfos, 5042 const VkAllocationCallbacks* pAllocator, 5043 VkSwapchainKHR* pSwapchains) { 5044 return ? 5045} 5046 5047@extension("VK_KHR_xlib_surface") 5048cmd VkResult vkCreateXlibSurfaceKHR( 5049 VkInstance instance, 5050 const VkXlibSurfaceCreateInfoKHR* pCreateInfo, 5051 const VkAllocationCallbacks* pAllocator, 5052 VkSurfaceKHR* pSurface) { 5053 instanceObject := GetInstance(instance) 5054 return ? 5055} 5056 5057@extension("VK_KHR_xlib_surface") 5058cmd VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR( 5059 VkPhysicalDevice physicalDevice, 5060 u32 queueFamilyIndex, 5061 platform.Display* dpy, 5062 platform.VisualID visualID) { 5063 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 5064 return ? 5065} 5066 5067@extension("VK_KHR_xcb_surface") 5068cmd VkResult vkCreateXcbSurfaceKHR( 5069 VkInstance instance, 5070 const VkXcbSurfaceCreateInfoKHR* pCreateInfo, 5071 const VkAllocationCallbacks* pAllocator, 5072 VkSurfaceKHR* pSurface) { 5073 instanceObject := GetInstance(instance) 5074 return ? 5075} 5076 5077@extension("VK_KHR_xcb_surface") 5078cmd VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR( 5079 VkPhysicalDevice physicalDevice, 5080 u32 queueFamilyIndex, 5081 platform.xcb_connection_t* connection, 5082 platform.xcb_visualid_t visual_id) { 5083 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 5084 return ? 5085} 5086 5087@extension("VK_KHR_wayland_surface") 5088cmd VkResult vkCreateWaylandSurfaceKHR( 5089 VkInstance instance, 5090 const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, 5091 const VkAllocationCallbacks* pAllocator, 5092 VkSurfaceKHR* pSurface) { 5093 instanceObject := GetInstance(instance) 5094 return ? 5095} 5096 5097@extension("VK_KHR_wayland_surface") 5098cmd VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR( 5099 VkPhysicalDevice physicalDevice, 5100 u32 queueFamilyIndex, 5101 platform.wl_display* display) { 5102 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 5103 return ? 5104} 5105 5106@extension("VK_KHR_mir_surface") 5107cmd VkResult vkCreateMirSurfaceKHR( 5108 VkInstance instance, 5109 const VkMirSurfaceCreateInfoKHR* pCreateInfo, 5110 const VkAllocationCallbacks* pAllocator, 5111 VkSurfaceKHR* pSurface) { 5112 instanceObject := GetInstance(instance) 5113 return ? 5114} 5115 5116@extension("VK_KHR_mir_surface") 5117cmd VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR( 5118 VkPhysicalDevice physicalDevice, 5119 u32 queueFamilyIndex, 5120 platform.MirConnection* connection) { 5121 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 5122 return ? 5123} 5124 5125@extension("VK_KHR_android_surface") 5126cmd VkResult vkCreateAndroidSurfaceKHR( 5127 VkInstance instance, 5128 const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, 5129 const VkAllocationCallbacks* pAllocator, 5130 VkSurfaceKHR* pSurface) { 5131 instanceObject := GetInstance(instance) 5132 return ? 5133} 5134 5135@extension("VK_KHR_win32_surface") 5136cmd VkResult vkCreateWin32SurfaceKHR( 5137 VkInstance instance, 5138 const VkWin32SurfaceCreateInfoKHR* pCreateInfo, 5139 const VkAllocationCallbacks* pAllocator, 5140 VkSurfaceKHR* pSurface) { 5141 instanceObject := GetInstance(instance) 5142 return ? 5143} 5144 5145@extension("VK_KHR_win32_surface") 5146cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR( 5147 VkPhysicalDevice physicalDevice, 5148 u32 queueFamilyIndex) { 5149 physicalDeviceObject := GetPhysicalDevice(physicalDevice) 5150 return ? 5151} 5152 5153@extension("VK_ANDROID_native_buffer") 5154cmd VkResult vkGetSwapchainGrallocUsageANDROID( 5155 VkDevice device, 5156 VkFormat format, 5157 VkImageUsageFlags imageUsage, 5158 int* grallocUsage) { 5159 return ? 5160} 5161 5162@extension("VK_ANDROID_native_buffer") 5163cmd VkResult vkAcquireImageANDROID( 5164 VkDevice device, 5165 VkImage image, 5166 int nativeFenceFd, 5167 VkSemaphore semaphore, 5168 VkFence fence) { 5169 return ? 5170} 5171 5172@extension("VK_ANDROID_native_buffer") 5173cmd VkResult vkQueueSignalReleaseImageANDROID( 5174 VkQueue queue, 5175 u32 waitSemaphoreCount, 5176 const VkSemaphore* pWaitSemaphores, 5177 VkImage image, 5178 int* pNativeFenceFd) { 5179 return ? 5180} 5181 5182@extension("VK_EXT_debug_report") 5183@external type void* PFN_vkDebugReportCallbackEXT 5184@extension("VK_EXT_debug_report") 5185@pfn cmd VkBool32 vkDebugReportCallbackEXT( 5186 VkDebugReportFlagsEXT flags, 5187 VkDebugReportObjectTypeEXT objectType, 5188 u64 object, 5189 platform.size_t location, 5190 s32 messageCode, 5191 const char* pLayerPrefix, 5192 const char* pMessage, 5193 void* pUserData) { 5194 return ? 5195} 5196 5197@extension("VK_EXT_debug_report") 5198cmd VkResult vkCreateDebugReportCallbackEXT( 5199 VkInstance instance, 5200 const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, 5201 const VkAllocationCallbacks* pAllocator, 5202 VkDebugReportCallbackEXT* pCallback) { 5203 return ? 5204} 5205 5206@extension("VK_EXT_debug_report") 5207cmd void vkDestroyDebugReportCallbackEXT( 5208 VkInstance instance, 5209 VkDebugReportCallbackEXT callback, 5210 const VkAllocationCallbacks* pAllocator) { 5211} 5212 5213@extension("VK_EXT_debug_report") 5214cmd void vkDebugReportMessageEXT( 5215 VkInstance instance, 5216 VkDebugReportFlagsEXT flags, 5217 VkDebugReportObjectTypeEXT objectType, 5218 u64 object, 5219 platform.size_t location, 5220 s32 messageCode, 5221 const char* pLayerPrefix, 5222 const char* pMessage) { 5223} 5224 5225 5226//////////////// 5227// Validation // 5228//////////////// 5229 5230extern void validate(string layerName, bool condition, string message) 5231 5232 5233///////////////////////////// 5234// Internal State Tracking // 5235///////////////////////////// 5236 5237StateObject State 5238 5239@internal class StateObject { 5240 // Dispatchable objects. 5241 map!(VkInstance, ref!InstanceObject) Instances 5242 map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices 5243 map!(VkDevice, ref!DeviceObject) Devices 5244 map!(VkQueue, ref!QueueObject) Queues 5245 map!(VkCommandBuffer, ref!CommandBufferObject) CommandBuffers 5246 5247 // Non-dispatchable objects. 5248 map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories 5249 map!(VkBuffer, ref!BufferObject) Buffers 5250 map!(VkBufferView, ref!BufferViewObject) BufferViews 5251 map!(VkImage, ref!ImageObject) Images 5252 map!(VkImageView, ref!ImageViewObject) ImageViews 5253 map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules 5254 map!(VkPipeline, ref!PipelineObject) Pipelines 5255 map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts 5256 map!(VkSampler, ref!SamplerObject) Samplers 5257 map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets 5258 map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts 5259 map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools 5260 map!(VkFence, ref!FenceObject) Fences 5261 map!(VkSemaphore, ref!SemaphoreObject) Semaphores 5262 map!(VkEvent, ref!EventObject) Events 5263 map!(VkQueryPool, ref!QueryPoolObject) QueryPools 5264 map!(VkFramebuffer, ref!FramebufferObject) Framebuffers 5265 map!(VkRenderPass, ref!RenderPassObject) RenderPasses 5266 map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches 5267 map!(VkCommandPool, ref!CommandPoolObject) CommandPools 5268 map!(VkSurfaceKHR, ref!SurfaceObject) Surfaces 5269 map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains 5270} 5271 5272@internal class InstanceObject { 5273} 5274 5275@internal class PhysicalDeviceObject { 5276 VkInstance instance 5277} 5278 5279@internal class DeviceObject { 5280 VkPhysicalDevice physicalDevice 5281} 5282 5283@internal class QueueObject { 5284 VkDevice device 5285 VkQueueFlags flags 5286} 5287 5288@internal class CommandBufferObject { 5289 VkDevice device 5290 map!(u64, VkDeviceMemory) boundObjects 5291 VkQueueFlags queueFlags 5292} 5293 5294@internal class DeviceMemoryObject { 5295 VkDevice device 5296 VkDeviceSize allocationSize 5297 map!(u64, VkDeviceSize) boundObjects 5298 map!(VkCommandBuffer, VkCommandBuffer) boundCommandBuffers 5299} 5300 5301@internal class BufferObject { 5302 VkDevice device 5303 VkDeviceMemory memory 5304 VkDeviceSize memoryOffset 5305} 5306 5307@internal class BufferViewObject { 5308 VkDevice device 5309 VkBuffer buffer 5310} 5311 5312@internal class ImageObject { 5313 VkDevice device 5314 VkDeviceMemory memory 5315 VkDeviceSize memoryOffset 5316} 5317 5318@internal class ImageViewObject { 5319 VkDevice device 5320 VkImage image 5321} 5322 5323@internal class ShaderObject { 5324 VkDevice device 5325} 5326 5327@internal class ShaderModuleObject { 5328 VkDevice device 5329} 5330 5331@internal class PipelineObject { 5332 VkDevice device 5333} 5334 5335@internal class PipelineLayoutObject { 5336 VkDevice device 5337} 5338 5339@internal class SamplerObject { 5340 VkDevice device 5341} 5342 5343@internal class DescriptorSetObject { 5344 VkDevice device 5345} 5346 5347@internal class DescriptorSetLayoutObject { 5348 VkDevice device 5349} 5350 5351@internal class DescriptorPoolObject { 5352 VkDevice device 5353} 5354 5355@internal class FenceObject { 5356 VkDevice device 5357 bool signaled 5358} 5359 5360@internal class SemaphoreObject { 5361 VkDevice device 5362} 5363 5364@internal class EventObject { 5365 VkDevice device 5366} 5367 5368@internal class QueryPoolObject { 5369 VkDevice device 5370} 5371 5372@internal class FramebufferObject { 5373 VkDevice device 5374} 5375 5376@internal class RenderPassObject { 5377 VkDevice device 5378} 5379 5380@internal class PipelineCacheObject { 5381 VkDevice device 5382} 5383 5384@internal class CommandPoolObject { 5385 VkDevice device 5386} 5387 5388@internal class SurfaceObject { 5389 VkInstance instance 5390} 5391 5392@internal class SwapchainObject { 5393 VkDevice device 5394} 5395 5396macro ref!InstanceObject GetInstance(VkInstance instance) { 5397 assert(instance in State.Instances) 5398 return State.Instances[instance] 5399} 5400 5401macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) { 5402 assert(physicalDevice in State.PhysicalDevices) 5403 return State.PhysicalDevices[physicalDevice] 5404} 5405 5406macro ref!DeviceObject GetDevice(VkDevice device) { 5407 assert(device in State.Devices) 5408 return State.Devices[device] 5409} 5410 5411macro ref!QueueObject GetQueue(VkQueue queue) { 5412 assert(queue in State.Queues) 5413 return State.Queues[queue] 5414} 5415 5416macro ref!CommandBufferObject GetCommandBuffer(VkCommandBuffer commandBuffer) { 5417 assert(commandBuffer in State.CommandBuffers) 5418 return State.CommandBuffers[commandBuffer] 5419} 5420 5421macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory memory) { 5422 assert(memory in State.DeviceMemories) 5423 return State.DeviceMemories[memory] 5424} 5425 5426macro ref!BufferObject GetBuffer(VkBuffer buffer) { 5427 assert(buffer in State.Buffers) 5428 return State.Buffers[buffer] 5429} 5430 5431macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) { 5432 assert(bufferView in State.BufferViews) 5433 return State.BufferViews[bufferView] 5434} 5435 5436macro ref!ImageObject GetImage(VkImage image) { 5437 assert(image in State.Images) 5438 return State.Images[image] 5439} 5440 5441macro ref!ImageViewObject GetImageView(VkImageView imageView) { 5442 assert(imageView in State.ImageViews) 5443 return State.ImageViews[imageView] 5444} 5445 5446macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) { 5447 assert(shaderModule in State.ShaderModules) 5448 return State.ShaderModules[shaderModule] 5449} 5450 5451macro ref!PipelineObject GetPipeline(VkPipeline pipeline) { 5452 assert(pipeline in State.Pipelines) 5453 return State.Pipelines[pipeline] 5454} 5455 5456macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) { 5457 assert(pipelineLayout in State.PipelineLayouts) 5458 return State.PipelineLayouts[pipelineLayout] 5459} 5460 5461macro ref!SamplerObject GetSampler(VkSampler sampler) { 5462 assert(sampler in State.Samplers) 5463 return State.Samplers[sampler] 5464} 5465 5466macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) { 5467 assert(descriptorSet in State.DescriptorSets) 5468 return State.DescriptorSets[descriptorSet] 5469} 5470 5471macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) { 5472 assert(descriptorSetLayout in State.DescriptorSetLayouts) 5473 return State.DescriptorSetLayouts[descriptorSetLayout] 5474} 5475 5476macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) { 5477 assert(descriptorPool in State.DescriptorPools) 5478 return State.DescriptorPools[descriptorPool] 5479} 5480 5481macro ref!FenceObject GetFence(VkFence fence) { 5482 assert(fence in State.Fences) 5483 return State.Fences[fence] 5484} 5485 5486macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) { 5487 assert(semaphore in State.Semaphores) 5488 return State.Semaphores[semaphore] 5489} 5490 5491macro ref!EventObject GetEvent(VkEvent event) { 5492 assert(event in State.Events) 5493 return State.Events[event] 5494} 5495 5496macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) { 5497 assert(queryPool in State.QueryPools) 5498 return State.QueryPools[queryPool] 5499} 5500 5501macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) { 5502 assert(framebuffer in State.Framebuffers) 5503 return State.Framebuffers[framebuffer] 5504} 5505 5506macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) { 5507 assert(renderPass in State.RenderPasses) 5508 return State.RenderPasses[renderPass] 5509} 5510 5511macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) { 5512 assert(pipelineCache in State.PipelineCaches) 5513 return State.PipelineCaches[pipelineCache] 5514} 5515 5516macro ref!CommandPoolObject GetCommandPool(VkCommandPool commandPool) { 5517 assert(commandPool in State.CommandPools) 5518 return State.CommandPools[commandPool] 5519} 5520 5521macro ref!SurfaceObject GetSurface(VkSurfaceKHR surface) { 5522 assert(surface in State.Surfaces) 5523 return State.Surfaces[surface] 5524} 5525 5526macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) { 5527 assert(swapchain in State.Swapchains) 5528 return State.Swapchains[swapchain] 5529} 5530 5531macro VkQueueFlags AddQueueFlag(VkQueueFlags flags, VkQueueFlagBits bit) { 5532 return as!VkQueueFlags(as!u32(flags) | as!u32(bit)) 5533} 5534