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