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