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