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