Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 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 | |
| 22 | import platform "platform.api" |
| 23 | |
| 24 | /////////////// |
| 25 | // Constants // |
| 26 | /////////////// |
| 27 | |
| 28 | // API version (major.minor.patch) |
| 29 | define VERSION_MAJOR 0 |
| 30 | define VERSION_MINOR 138 |
Jesse Hall | f09c6b1 | 2015-08-15 19:54:28 -0700 | [diff] [blame^] | 31 | define VERSION_PATCH 2 |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 32 | |
| 33 | // API limits |
| 34 | define VK_MAX_PHYSICAL_DEVICE_NAME 256 |
| 35 | define VK_UUID_LENGTH 16 |
| 36 | define VK_MAX_EXTENSION_NAME 256 |
| 37 | define VK_MAX_DESCRIPTION 256 |
| 38 | define VK_MAX_MEMORY_TYPES 32 |
| 39 | define 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 |
| 42 | define VK_TRUE 1 |
| 43 | define VK_FALSE 0 |
| 44 | define VK_NULL_HANDLE 0 |
| 45 | |
| 46 | |
| 47 | ///////////// |
| 48 | // Types // |
| 49 | ///////////// |
| 50 | |
| 51 | /// Dispatchable handle types. |
| 52 | @dispatchHandle type u64 VkInstance |
| 53 | @dispatchHandle type u64 VkPhysicalDevice |
| 54 | @dispatchHandle type u64 VkDevice |
| 55 | @dispatchHandle type u64 VkQueue |
| 56 | @dispatchHandle type u64 VkCmdBuffer |
| 57 | |
| 58 | /// Non dispatchable handle types. |
| 59 | @nonDispatchHandle type u64 VkDeviceMemory |
| 60 | @nonDispatchHandle type u64 VkCmdPool |
| 61 | @nonDispatchHandle type u64 VkBuffer |
| 62 | @nonDispatchHandle type u64 VkBufferView |
| 63 | @nonDispatchHandle type u64 VkImage |
| 64 | @nonDispatchHandle type u64 VkImageView |
| 65 | @nonDispatchHandle type u64 VkAttachmentView |
| 66 | @nonDispatchHandle type u64 VkShaderModule |
| 67 | @nonDispatchHandle type u64 VkShader |
| 68 | @nonDispatchHandle type u64 VkPipeline |
| 69 | @nonDispatchHandle type u64 VkPipelineLayout |
| 70 | @nonDispatchHandle type u64 VkSampler |
| 71 | @nonDispatchHandle type u64 VkDescriptorSet |
| 72 | @nonDispatchHandle type u64 VkDescriptorSetLayout |
| 73 | @nonDispatchHandle type u64 VkDescriptorPool |
| 74 | @nonDispatchHandle type u64 VkDynamicViewportState |
| 75 | @nonDispatchHandle type u64 VkDynamicRasterState |
| 76 | @nonDispatchHandle type u64 VkDynamicColorBlendState |
| 77 | @nonDispatchHandle type u64 VkDynamicDepthStencilState |
| 78 | @nonDispatchHandle type u64 VkFence |
| 79 | @nonDispatchHandle type u64 VkSemaphore |
| 80 | @nonDispatchHandle type u64 VkEvent |
| 81 | @nonDispatchHandle type u64 VkQueryPool |
| 82 | @nonDispatchHandle type u64 VkFramebuffer |
| 83 | @nonDispatchHandle type u64 VkRenderPass |
| 84 | @nonDispatchHandle type u64 VkPipelineCache |
| 85 | |
| 86 | |
| 87 | ///////////// |
| 88 | // Enums // |
| 89 | ///////////// |
| 90 | |
| 91 | enum VkImageLayout { |
| 92 | VK_IMAGE_LAYOUT_UNDEFINED = 0x00000000, /// Implicit layout an image is when its contents are undefined due to various reasons (e.g. right after creation) |
| 93 | VK_IMAGE_LAYOUT_GENERAL = 0x00000001, /// General layout when image can be used for any kind of access |
| 94 | VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 0x00000002, /// Optimal layout when image is only used for color attachment read/write |
| 95 | VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 0x00000003, /// Optimal layout when image is only used for depth/stencil attachment read/write |
| 96 | VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 0x00000004, /// Optimal layout when image is used for read only depth/stencil attachment and shader access |
| 97 | VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 0x00000005, /// Optimal layout when image is used for read only shader access |
| 98 | VK_IMAGE_LAYOUT_TRANSFER_SOURCE_OPTIMAL = 0x00000006, /// Optimal layout when image is used only as source of transfer operations |
| 99 | VK_IMAGE_LAYOUT_TRANSFER_DESTINATION_OPTIMAL = 0x00000007, /// Optimal layout when image is used only as destination of transfer operations |
| 100 | } |
| 101 | |
| 102 | enum VkAttachmentLoadOp { |
| 103 | VK_ATTACHMENT_LOAD_OP_LOAD = 0x00000000, |
| 104 | VK_ATTACHMENT_LOAD_OP_CLEAR = 0x00000001, |
| 105 | VK_ATTACHMENT_LOAD_OP_DONT_CARE = 0x00000002, |
| 106 | } |
| 107 | |
| 108 | enum VkAttachmentStoreOp { |
| 109 | VK_ATTACHMENT_STORE_OP_STORE = 0x00000000, |
| 110 | VK_ATTACHMENT_STORE_OP_DONT_CARE = 0x00000001, |
| 111 | } |
| 112 | |
| 113 | enum VkImageType { |
| 114 | VK_IMAGE_TYPE_1D = 0x00000000, |
| 115 | VK_IMAGE_TYPE_2D = 0x00000001, |
| 116 | VK_IMAGE_TYPE_3D = 0x00000002, |
| 117 | } |
| 118 | |
| 119 | enum VkImageTiling { |
| 120 | VK_IMAGE_TILING_LINEAR = 0x00000000, |
| 121 | VK_IMAGE_TILING_OPTIMAL = 0x00000001, |
| 122 | } |
| 123 | |
| 124 | enum VkImageViewType { |
| 125 | VK_IMAGE_VIEW_TYPE_1D = 0x00000000, |
| 126 | VK_IMAGE_VIEW_TYPE_2D = 0x00000001, |
| 127 | VK_IMAGE_VIEW_TYPE_3D = 0x00000002, |
| 128 | VK_IMAGE_VIEW_TYPE_CUBE = 0x00000003, |
| 129 | VK_IMAGE_VIEW_TYPE_1D_ARRAY = 0x00000004, |
| 130 | VK_IMAGE_VIEW_TYPE_2D_ARRAY = 0x00000005, |
| 131 | VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 0x00000006, |
| 132 | } |
| 133 | |
| 134 | enum VkImageAspect { |
| 135 | VK_IMAGE_ASPECT_COLOR = 0x00000000, |
| 136 | VK_IMAGE_ASPECT_DEPTH = 0x00000001, |
| 137 | VK_IMAGE_ASPECT_STENCIL = 0x00000002, |
| 138 | VK_IMAGE_ASPECT_METADATA = 0x00000003, |
| 139 | } |
| 140 | |
| 141 | enum VkBufferViewType { |
| 142 | VK_BUFFER_VIEW_TYPE_RAW = 0x00000000, /// Raw buffer without special structure (UBO, SSBO) |
| 143 | VK_BUFFER_VIEW_TYPE_FORMATTED = 0x00000001, /// Buffer with format (TBO, IBO) |
| 144 | } |
| 145 | |
| 146 | enum VkCmdBufferLevel { |
| 147 | VK_CMD_BUFFER_LEVEL_PRIMARY = 0x00000000, |
| 148 | VK_CMD_BUFFER_LEVEL_SECONDARY = 0x00000001, |
| 149 | } |
| 150 | |
| 151 | enum VkChannelSwizzle { |
| 152 | VK_CHANNEL_SWIZZLE_ZERO = 0x00000000, |
| 153 | VK_CHANNEL_SWIZZLE_ONE = 0x00000001, |
| 154 | VK_CHANNEL_SWIZZLE_R = 0x00000002, |
| 155 | VK_CHANNEL_SWIZZLE_G = 0x00000003, |
| 156 | VK_CHANNEL_SWIZZLE_B = 0x00000004, |
| 157 | VK_CHANNEL_SWIZZLE_A = 0x00000005, |
| 158 | } |
| 159 | |
| 160 | enum VkDescriptorType { |
| 161 | VK_DESCRIPTOR_TYPE_SAMPLER = 0x00000000, |
| 162 | VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 0x00000001, |
| 163 | VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 0x00000002, |
| 164 | VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 0x00000003, |
| 165 | VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 0x00000004, |
| 166 | VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 0x00000005, |
| 167 | VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 0x00000006, |
| 168 | VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 0x00000007, |
| 169 | VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 0x00000008, |
| 170 | VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 0x00000009, |
| 171 | VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 0x0000000a, |
| 172 | } |
| 173 | |
| 174 | enum VkDescriptorPoolUsage { |
| 175 | VK_DESCRIPTOR_POOL_USAGE_ONE_SHOT = 0x00000000, |
| 176 | VK_DESCRIPTOR_POOL_USAGE_DYNAMIC = 0x00000001, |
| 177 | } |
| 178 | |
| 179 | enum VkDescriptorSetUsage { |
| 180 | VK_DESCRIPTOR_SET_USAGE_ONE_SHOT = 0x00000000, |
| 181 | VK_DESCRIPTOR_SET_USAGE_STATIC = 0x00000001, |
| 182 | } |
| 183 | |
| 184 | enum VkQueryType { |
| 185 | VK_QUERY_TYPE_OCCLUSION = 0x00000000, |
| 186 | VK_QUERY_TYPE_PIPELINE_STATISTICS = 0x00000001, /// Optional |
| 187 | } |
| 188 | |
| 189 | enum VkTimestampType { |
| 190 | VK_TIMESTAMP_TYPE_TOP = 0x00000000, |
| 191 | VK_TIMESTAMP_TYPE_BOTTOM = 0x00000001, |
| 192 | } |
| 193 | |
| 194 | enum VkBorderColor { |
| 195 | VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0x00000000, |
| 196 | VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 0x00000001, |
| 197 | VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 0x00000002, |
| 198 | VK_BORDER_COLOR_INT_OPAQUE_BLACK = 0x00000003, |
| 199 | VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 0x00000004, |
| 200 | VK_BORDER_COLOR_INT_OPAQUE_WHITE = 0x00000005, |
| 201 | } |
| 202 | |
| 203 | enum VkPipelineBindPoint { |
| 204 | VK_PIPELINE_BIND_POINT_COMPUTE = 0x00000000, |
| 205 | VK_PIPELINE_BIND_POINT_GRAPHICS = 0x00000001, |
| 206 | } |
| 207 | |
| 208 | enum VkPrimitiveTopology { |
| 209 | VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0x00000000, |
| 210 | VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 0x00000001, |
| 211 | VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 0x00000002, |
| 212 | VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 0x00000003, |
| 213 | VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 0x00000004, |
| 214 | VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 0x00000005, |
| 215 | VK_PRIMITIVE_TOPOLOGY_LINE_LIST_ADJ = 0x00000006, |
| 216 | VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_ADJ = 0x00000007, |
| 217 | VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ = 0x00000008, |
| 218 | VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJ = 0x00000009, |
| 219 | VK_PRIMITIVE_TOPOLOGY_PATCH = 0x0000000a, |
| 220 | } |
| 221 | |
| 222 | enum VkSharingMode { |
| 223 | VK_SHARING_MODE_EXCLUSIVE = 0x00000000, |
| 224 | VK_SHARING_MODE_CONCURRENT = 0x00000001, |
| 225 | } |
| 226 | |
| 227 | enum VkIndexType { |
| 228 | VK_INDEX_TYPE_UINT16 = 0x00000000, |
| 229 | VK_INDEX_TYPE_UINT32 = 0x00000001, |
| 230 | } |
| 231 | |
| 232 | enum VkTexFilter { |
| 233 | VK_TEX_FILTER_NEAREST = 0x00000000, |
| 234 | VK_TEX_FILTER_LINEAR = 0x00000001, |
| 235 | } |
| 236 | |
| 237 | enum VkTexMipmapMode { |
| 238 | VK_TEX_MIPMAP_MODE_BASE = 0x00000000, /// Always choose base level |
| 239 | VK_TEX_MIPMAP_MODE_NEAREST = 0x00000001, /// Choose nearest mip level |
| 240 | VK_TEX_MIPMAP_MODE_LINEAR = 0x00000002, /// Linear filter between mip levels |
| 241 | } |
| 242 | |
| 243 | enum VkTexAddress { |
| 244 | VK_TEX_ADDRESS_WRAP = 0x00000000, |
| 245 | VK_TEX_ADDRESS_MIRROR = 0x00000001, |
| 246 | VK_TEX_ADDRESS_CLAMP = 0x00000002, |
| 247 | VK_TEX_ADDRESS_MIRROR_ONCE = 0x00000003, |
| 248 | VK_TEX_ADDRESS_CLAMP_BORDER = 0x00000004, |
| 249 | } |
| 250 | |
| 251 | enum VkCompareOp { |
| 252 | VK_COMPARE_OP_NEVER = 0x00000000, |
| 253 | VK_COMPARE_OP_LESS = 0x00000001, |
| 254 | VK_COMPARE_OP_EQUAL = 0x00000002, |
| 255 | VK_COMPARE_OP_LESS_EQUAL = 0x00000003, |
| 256 | VK_COMPARE_OP_GREATER = 0x00000004, |
| 257 | VK_COMPARE_OP_NOT_EQUAL = 0x00000005, |
| 258 | VK_COMPARE_OP_GREATER_EQUAL = 0x00000006, |
| 259 | VK_COMPARE_OP_ALWAYS = 0x00000007, |
| 260 | } |
| 261 | |
| 262 | enum VkFillMode { |
| 263 | VK_FILL_MODE_POINTS = 0x00000000, |
| 264 | VK_FILL_MODE_WIREFRAME = 0x00000001, |
| 265 | VK_FILL_MODE_SOLID = 0x00000002, |
| 266 | } |
| 267 | |
| 268 | enum VkCullMode { |
| 269 | VK_CULL_MODE_NONE = 0x00000000, |
| 270 | VK_CULL_MODE_FRONT = 0x00000001, |
| 271 | VK_CULL_MODE_BACK = 0x00000002, |
| 272 | VK_CULL_MODE_FRONT_AND_BACK = 0x00000003, |
| 273 | } |
| 274 | |
| 275 | enum VkFrontFace { |
| 276 | VK_FRONT_FACE_CCW = 0x00000000, |
| 277 | VK_FRONT_FACE_CW = 0x00000001, |
| 278 | } |
| 279 | |
| 280 | enum VkBlend { |
| 281 | VK_BLEND_ZERO = 0x00000000, |
| 282 | VK_BLEND_ONE = 0x00000001, |
| 283 | VK_BLEND_SRC_COLOR = 0x00000002, |
| 284 | VK_BLEND_ONE_MINUS_SRC_COLOR = 0x00000003, |
| 285 | VK_BLEND_DEST_COLOR = 0x00000004, |
| 286 | VK_BLEND_ONE_MINUS_DEST_COLOR = 0x00000005, |
| 287 | VK_BLEND_SRC_ALPHA = 0x00000006, |
| 288 | VK_BLEND_ONE_MINUS_SRC_ALPHA = 0x00000007, |
| 289 | VK_BLEND_DEST_ALPHA = 0x00000008, |
| 290 | VK_BLEND_ONE_MINUS_DEST_ALPHA = 0x00000009, |
| 291 | VK_BLEND_CONSTANT_COLOR = 0x0000000a, |
| 292 | VK_BLEND_ONE_MINUS_CONSTANT_COLOR = 0x0000000b, |
| 293 | VK_BLEND_CONSTANT_ALPHA = 0x0000000c, |
| 294 | VK_BLEND_ONE_MINUS_CONSTANT_ALPHA = 0x0000000d, |
| 295 | VK_BLEND_SRC_ALPHA_SATURATE = 0x0000000e, |
| 296 | VK_BLEND_SRC1_COLOR = 0x0000000f, |
| 297 | VK_BLEND_ONE_MINUS_SRC1_COLOR = 0x00000010, |
| 298 | VK_BLEND_SRC1_ALPHA = 0x00000011, |
| 299 | VK_BLEND_ONE_MINUS_SRC1_ALPHA = 0x00000012, |
| 300 | } |
| 301 | |
| 302 | enum VkBlendOp { |
| 303 | VK_BLEND_OP_ADD = 0x00000000, |
| 304 | VK_BLEND_OP_SUBTRACT = 0x00000001, |
| 305 | VK_BLEND_OP_REVERSE_SUBTRACT = 0x00000002, |
| 306 | VK_BLEND_OP_MIN = 0x00000003, |
| 307 | VK_BLEND_OP_MAX = 0x00000004, |
| 308 | } |
| 309 | |
| 310 | enum VkStencilOp { |
| 311 | VK_STENCIL_OP_KEEP = 0x00000000, |
| 312 | VK_STENCIL_OP_ZERO = 0x00000001, |
| 313 | VK_STENCIL_OP_REPLACE = 0x00000002, |
| 314 | VK_STENCIL_OP_INC_CLAMP = 0x00000003, |
| 315 | VK_STENCIL_OP_DEC_CLAMP = 0x00000004, |
| 316 | VK_STENCIL_OP_INVERT = 0x00000005, |
| 317 | VK_STENCIL_OP_INC_WRAP = 0x00000006, |
| 318 | VK_STENCIL_OP_DEC_WRAP = 0x00000007, |
| 319 | } |
| 320 | |
| 321 | enum VkLogicOp { |
| 322 | VK_LOGIC_OP_CLEAR = 0x00000000, |
| 323 | VK_LOGIC_OP_AND = 0x00000001, |
| 324 | VK_LOGIC_OP_AND_REVERSE = 0x00000002, |
| 325 | VK_LOGIC_OP_COPY = 0x00000003, |
| 326 | VK_LOGIC_OP_AND_INVERTED = 0x00000004, |
| 327 | VK_LOGIC_OP_NOOP = 0x00000005, |
| 328 | VK_LOGIC_OP_XOR = 0x00000006, |
| 329 | VK_LOGIC_OP_OR = 0x00000007, |
| 330 | VK_LOGIC_OP_NOR = 0x00000008, |
| 331 | VK_LOGIC_OP_EQUIV = 0x00000009, |
| 332 | VK_LOGIC_OP_INVERT = 0x0000000a, |
| 333 | VK_LOGIC_OP_OR_REVERSE = 0x0000000b, |
| 334 | VK_LOGIC_OP_COPY_INVERTED = 0x0000000c, |
| 335 | VK_LOGIC_OP_OR_INVERTED = 0x0000000d, |
| 336 | VK_LOGIC_OP_NAND = 0x0000000e, |
| 337 | VK_LOGIC_OP_SET = 0x0000000f, |
| 338 | } |
| 339 | |
| 340 | enum VkSystemAllocType { |
| 341 | VK_SYSTEM_ALLOC_TYPE_API_OBJECT = 0x00000000, |
| 342 | VK_SYSTEM_ALLOC_TYPE_INTERNAL = 0x00000001, |
| 343 | VK_SYSTEM_ALLOC_TYPE_INTERNAL_TEMP = 0x00000002, |
| 344 | VK_SYSTEM_ALLOC_TYPE_INTERNAL_SHADER = 0x00000003, |
| 345 | VK_SYSTEM_ALLOC_TYPE_DEBUG = 0x00000004, |
| 346 | } |
| 347 | |
| 348 | enum VkPhysicalDeviceType { |
| 349 | VK_PHYSICAL_DEVICE_TYPE_OTHER = 0x00000000, |
| 350 | VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 0x00000001, |
| 351 | VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 0x00000002, |
| 352 | VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 0x00000003, |
| 353 | VK_PHYSICAL_DEVICE_TYPE_CPU = 0x00000004, |
| 354 | } |
| 355 | |
| 356 | enum VkVertexInputStepRate { |
| 357 | VK_VERTEX_INPUT_STEP_RATE_VERTEX = 0x00000000, |
| 358 | VK_VERTEX_INPUT_STEP_RATE_INSTANCE = 0x00000001, |
| 359 | } |
| 360 | |
| 361 | /// Vulkan format definitions |
| 362 | enum VkFormat { |
| 363 | VK_FORMAT_UNDEFINED = 0x00000000, |
| 364 | VK_FORMAT_R4G4_UNORM = 0x00000001, |
| 365 | VK_FORMAT_R4G4_USCALED = 0x00000002, |
| 366 | VK_FORMAT_R4G4B4A4_UNORM = 0x00000003, |
| 367 | VK_FORMAT_R4G4B4A4_USCALED = 0x00000004, |
| 368 | VK_FORMAT_R5G6B5_UNORM = 0x00000005, |
| 369 | VK_FORMAT_R5G6B5_USCALED = 0x00000006, |
| 370 | VK_FORMAT_R5G5B5A1_UNORM = 0x00000007, |
| 371 | VK_FORMAT_R5G5B5A1_USCALED = 0x00000008, |
| 372 | VK_FORMAT_R8_UNORM = 0x00000009, |
| 373 | VK_FORMAT_R8_SNORM = 0x0000000A, |
| 374 | VK_FORMAT_R8_USCALED = 0x0000000B, |
| 375 | VK_FORMAT_R8_SSCALED = 0x0000000C, |
| 376 | VK_FORMAT_R8_UINT = 0x0000000D, |
| 377 | VK_FORMAT_R8_SINT = 0x0000000E, |
| 378 | VK_FORMAT_R8_SRGB = 0x0000000F, |
| 379 | VK_FORMAT_R8G8_UNORM = 0x00000010, |
| 380 | VK_FORMAT_R8G8_SNORM = 0x00000011, |
| 381 | VK_FORMAT_R8G8_USCALED = 0x00000012, |
| 382 | VK_FORMAT_R8G8_SSCALED = 0x00000013, |
| 383 | VK_FORMAT_R8G8_UINT = 0x00000014, |
| 384 | VK_FORMAT_R8G8_SINT = 0x00000015, |
| 385 | VK_FORMAT_R8G8_SRGB = 0x00000016, |
| 386 | VK_FORMAT_R8G8B8_UNORM = 0x00000017, |
| 387 | VK_FORMAT_R8G8B8_SNORM = 0x00000018, |
| 388 | VK_FORMAT_R8G8B8_USCALED = 0x00000019, |
| 389 | VK_FORMAT_R8G8B8_SSCALED = 0x0000001A, |
| 390 | VK_FORMAT_R8G8B8_UINT = 0x0000001B, |
| 391 | VK_FORMAT_R8G8B8_SINT = 0x0000001C, |
| 392 | VK_FORMAT_R8G8B8_SRGB = 0x0000001D, |
| 393 | VK_FORMAT_R8G8B8A8_UNORM = 0x0000001E, |
| 394 | VK_FORMAT_R8G8B8A8_SNORM = 0x0000001F, |
| 395 | VK_FORMAT_R8G8B8A8_USCALED = 0x00000020, |
| 396 | VK_FORMAT_R8G8B8A8_SSCALED = 0x00000021, |
| 397 | VK_FORMAT_R8G8B8A8_UINT = 0x00000022, |
| 398 | VK_FORMAT_R8G8B8A8_SINT = 0x00000023, |
| 399 | VK_FORMAT_R8G8B8A8_SRGB = 0x00000024, |
| 400 | VK_FORMAT_R10G10B10A2_UNORM = 0x00000025, |
| 401 | VK_FORMAT_R10G10B10A2_SNORM = 0x00000026, |
| 402 | VK_FORMAT_R10G10B10A2_USCALED = 0x00000027, |
| 403 | VK_FORMAT_R10G10B10A2_SSCALED = 0x00000028, |
| 404 | VK_FORMAT_R10G10B10A2_UINT = 0x00000029, |
| 405 | VK_FORMAT_R10G10B10A2_SINT = 0x0000002A, |
| 406 | VK_FORMAT_R16_UNORM = 0x0000002B, |
| 407 | VK_FORMAT_R16_SNORM = 0x0000002C, |
| 408 | VK_FORMAT_R16_USCALED = 0x0000002D, |
| 409 | VK_FORMAT_R16_SSCALED = 0x0000002E, |
| 410 | VK_FORMAT_R16_UINT = 0x0000002F, |
| 411 | VK_FORMAT_R16_SINT = 0x00000030, |
| 412 | VK_FORMAT_R16_SFLOAT = 0x00000031, |
| 413 | VK_FORMAT_R16G16_UNORM = 0x00000032, |
| 414 | VK_FORMAT_R16G16_SNORM = 0x00000033, |
| 415 | VK_FORMAT_R16G16_USCALED = 0x00000034, |
| 416 | VK_FORMAT_R16G16_SSCALED = 0x00000035, |
| 417 | VK_FORMAT_R16G16_UINT = 0x00000036, |
| 418 | VK_FORMAT_R16G16_SINT = 0x00000037, |
| 419 | VK_FORMAT_R16G16_SFLOAT = 0x00000038, |
| 420 | VK_FORMAT_R16G16B16_UNORM = 0x00000039, |
| 421 | VK_FORMAT_R16G16B16_SNORM = 0x0000003A, |
| 422 | VK_FORMAT_R16G16B16_USCALED = 0x0000003B, |
| 423 | VK_FORMAT_R16G16B16_SSCALED = 0x0000003C, |
| 424 | VK_FORMAT_R16G16B16_UINT = 0x0000003D, |
| 425 | VK_FORMAT_R16G16B16_SINT = 0x0000003E, |
| 426 | VK_FORMAT_R16G16B16_SFLOAT = 0x0000003F, |
| 427 | VK_FORMAT_R16G16B16A16_UNORM = 0x00000040, |
| 428 | VK_FORMAT_R16G16B16A16_SNORM = 0x00000041, |
| 429 | VK_FORMAT_R16G16B16A16_USCALED = 0x00000042, |
| 430 | VK_FORMAT_R16G16B16A16_SSCALED = 0x00000043, |
| 431 | VK_FORMAT_R16G16B16A16_UINT = 0x00000044, |
| 432 | VK_FORMAT_R16G16B16A16_SINT = 0x00000045, |
| 433 | VK_FORMAT_R16G16B16A16_SFLOAT = 0x00000046, |
| 434 | VK_FORMAT_R32_UINT = 0x00000047, |
| 435 | VK_FORMAT_R32_SINT = 0x00000048, |
| 436 | VK_FORMAT_R32_SFLOAT = 0x00000049, |
| 437 | VK_FORMAT_R32G32_UINT = 0x0000004A, |
| 438 | VK_FORMAT_R32G32_SINT = 0x0000004B, |
| 439 | VK_FORMAT_R32G32_SFLOAT = 0x0000004C, |
| 440 | VK_FORMAT_R32G32B32_UINT = 0x0000004D, |
| 441 | VK_FORMAT_R32G32B32_SINT = 0x0000004E, |
| 442 | VK_FORMAT_R32G32B32_SFLOAT = 0x0000004F, |
| 443 | VK_FORMAT_R32G32B32A32_UINT = 0x00000050, |
| 444 | VK_FORMAT_R32G32B32A32_SINT = 0x00000051, |
| 445 | VK_FORMAT_R32G32B32A32_SFLOAT = 0x00000052, |
| 446 | VK_FORMAT_R64_SFLOAT = 0x00000053, |
| 447 | VK_FORMAT_R64G64_SFLOAT = 0x00000054, |
| 448 | VK_FORMAT_R64G64B64_SFLOAT = 0x00000055, |
| 449 | VK_FORMAT_R64G64B64A64_SFLOAT = 0x00000056, |
| 450 | VK_FORMAT_R11G11B10_UFLOAT = 0x00000057, |
| 451 | VK_FORMAT_R9G9B9E5_UFLOAT = 0x00000058, |
| 452 | VK_FORMAT_D16_UNORM = 0x00000059, |
| 453 | VK_FORMAT_D24_UNORM = 0x0000005A, |
| 454 | VK_FORMAT_D32_SFLOAT = 0x0000005B, |
| 455 | VK_FORMAT_S8_UINT = 0x0000005C, |
| 456 | VK_FORMAT_D16_UNORM_S8_UINT = 0x0000005D, |
| 457 | VK_FORMAT_D24_UNORM_S8_UINT = 0x0000005E, |
| 458 | VK_FORMAT_D32_SFLOAT_S8_UINT = 0x0000005F, |
| 459 | VK_FORMAT_BC1_RGB_UNORM = 0x00000060, |
| 460 | VK_FORMAT_BC1_RGB_SRGB = 0x00000061, |
| 461 | VK_FORMAT_BC1_RGBA_UNORM = 0x00000062, |
| 462 | VK_FORMAT_BC1_RGBA_SRGB = 0x00000063, |
| 463 | VK_FORMAT_BC2_UNORM = 0x00000064, |
| 464 | VK_FORMAT_BC2_SRGB = 0x00000065, |
| 465 | VK_FORMAT_BC3_UNORM = 0x00000066, |
| 466 | VK_FORMAT_BC3_SRGB = 0x00000067, |
| 467 | VK_FORMAT_BC4_UNORM = 0x00000068, |
| 468 | VK_FORMAT_BC4_SNORM = 0x00000069, |
| 469 | VK_FORMAT_BC5_UNORM = 0x0000006A, |
| 470 | VK_FORMAT_BC5_SNORM = 0x0000006B, |
| 471 | VK_FORMAT_BC6H_UFLOAT = 0x0000006C, |
| 472 | VK_FORMAT_BC6H_SFLOAT = 0x0000006D, |
| 473 | VK_FORMAT_BC7_UNORM = 0x0000006E, |
| 474 | VK_FORMAT_BC7_SRGB = 0x0000006F, |
| 475 | VK_FORMAT_ETC2_R8G8B8_UNORM = 0x00000070, |
| 476 | VK_FORMAT_ETC2_R8G8B8_SRGB = 0x00000071, |
| 477 | VK_FORMAT_ETC2_R8G8B8A1_UNORM = 0x00000072, |
| 478 | VK_FORMAT_ETC2_R8G8B8A1_SRGB = 0x00000073, |
| 479 | VK_FORMAT_ETC2_R8G8B8A8_UNORM = 0x00000074, |
| 480 | VK_FORMAT_ETC2_R8G8B8A8_SRGB = 0x00000075, |
| 481 | VK_FORMAT_EAC_R11_UNORM = 0x00000076, |
| 482 | VK_FORMAT_EAC_R11_SNORM = 0x00000077, |
| 483 | VK_FORMAT_EAC_R11G11_UNORM = 0x00000078, |
| 484 | VK_FORMAT_EAC_R11G11_SNORM = 0x00000079, |
| 485 | VK_FORMAT_ASTC_4x4_UNORM = 0x0000007A, |
| 486 | VK_FORMAT_ASTC_4x4_SRGB = 0x0000007B, |
| 487 | VK_FORMAT_ASTC_5x4_UNORM = 0x0000007C, |
| 488 | VK_FORMAT_ASTC_5x4_SRGB = 0x0000007D, |
| 489 | VK_FORMAT_ASTC_5x5_UNORM = 0x0000007E, |
| 490 | VK_FORMAT_ASTC_5x5_SRGB = 0x0000007F, |
| 491 | VK_FORMAT_ASTC_6x5_UNORM = 0x00000080, |
| 492 | VK_FORMAT_ASTC_6x5_SRGB = 0x00000081, |
| 493 | VK_FORMAT_ASTC_6x6_UNORM = 0x00000082, |
| 494 | VK_FORMAT_ASTC_6x6_SRGB = 0x00000083, |
| 495 | VK_FORMAT_ASTC_8x5_UNORM = 0x00000084, |
| 496 | VK_FORMAT_ASTC_8x5_SRGB = 0x00000085, |
| 497 | VK_FORMAT_ASTC_8x6_UNORM = 0x00000086, |
| 498 | VK_FORMAT_ASTC_8x6_SRGB = 0x00000087, |
| 499 | VK_FORMAT_ASTC_8x8_UNORM = 0x00000088, |
| 500 | VK_FORMAT_ASTC_8x8_SRGB = 0x00000089, |
| 501 | VK_FORMAT_ASTC_10x5_UNORM = 0x0000008A, |
| 502 | VK_FORMAT_ASTC_10x5_SRGB = 0x0000008B, |
| 503 | VK_FORMAT_ASTC_10x6_UNORM = 0x0000008C, |
| 504 | VK_FORMAT_ASTC_10x6_SRGB = 0x0000008D, |
| 505 | VK_FORMAT_ASTC_10x8_UNORM = 0x0000008E, |
| 506 | VK_FORMAT_ASTC_10x8_SRGB = 0x0000008F, |
| 507 | VK_FORMAT_ASTC_10x10_UNORM = 0x00000090, |
| 508 | VK_FORMAT_ASTC_10x10_SRGB = 0x00000091, |
| 509 | VK_FORMAT_ASTC_12x10_UNORM = 0x00000092, |
| 510 | VK_FORMAT_ASTC_12x10_SRGB = 0x00000093, |
| 511 | VK_FORMAT_ASTC_12x12_UNORM = 0x00000094, |
| 512 | VK_FORMAT_ASTC_12x12_SRGB = 0x00000095, |
| 513 | VK_FORMAT_B4G4R4A4_UNORM = 0x00000096, |
| 514 | VK_FORMAT_B5G5R5A1_UNORM = 0x00000097, |
| 515 | VK_FORMAT_B5G6R5_UNORM = 0x00000098, |
| 516 | VK_FORMAT_B5G6R5_USCALED = 0x00000099, |
| 517 | VK_FORMAT_B8G8R8_UNORM = 0x0000009A, |
| 518 | VK_FORMAT_B8G8R8_SNORM = 0x0000009B, |
| 519 | VK_FORMAT_B8G8R8_USCALED = 0x0000009C, |
| 520 | VK_FORMAT_B8G8R8_SSCALED = 0x0000009D, |
| 521 | VK_FORMAT_B8G8R8_UINT = 0x0000009E, |
| 522 | VK_FORMAT_B8G8R8_SINT = 0x0000009F, |
| 523 | VK_FORMAT_B8G8R8_SRGB = 0x000000A0, |
| 524 | VK_FORMAT_B8G8R8A8_UNORM = 0x000000A1, |
| 525 | VK_FORMAT_B8G8R8A8_SNORM = 0x000000A2, |
| 526 | VK_FORMAT_B8G8R8A8_USCALED = 0x000000A3, |
| 527 | VK_FORMAT_B8G8R8A8_SSCALED = 0x000000A4, |
| 528 | VK_FORMAT_B8G8R8A8_UINT = 0x000000A5, |
| 529 | VK_FORMAT_B8G8R8A8_SINT = 0x000000A6, |
| 530 | VK_FORMAT_B8G8R8A8_SRGB = 0x000000A7, |
| 531 | VK_FORMAT_B10G10R10A2_UNORM = 0x000000A8, |
| 532 | VK_FORMAT_B10G10R10A2_SNORM = 0x000000A9, |
| 533 | VK_FORMAT_B10G10R10A2_USCALED = 0x000000AA, |
| 534 | VK_FORMAT_B10G10R10A2_SSCALED = 0x000000AB, |
| 535 | VK_FORMAT_B10G10R10A2_UINT = 0x000000AC, |
| 536 | VK_FORMAT_B10G10R10A2_SINT = 0x000000AD, |
| 537 | } |
| 538 | |
| 539 | /// Shader stage enumerant |
| 540 | enum VkShaderStage { |
| 541 | VK_SHADER_STAGE_VERTEX = 0x00000000, |
| 542 | VK_SHADER_STAGE_TESS_CONTROL = 0x00000001, |
| 543 | VK_SHADER_STAGE_TESS_EVALUATION = 0x00000002, |
| 544 | VK_SHADER_STAGE_GEOMETRY = 0x00000003, |
| 545 | VK_SHADER_STAGE_FRAGMENT = 0x00000004, |
| 546 | VK_SHADER_STAGE_COMPUTE = 0x00000005, |
| 547 | } |
| 548 | |
| 549 | /// Structure type enumerant |
| 550 | enum VkStructureType { |
| 551 | VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, |
| 552 | VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 1, |
| 553 | VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO = 2, |
| 554 | VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 3, |
| 555 | VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO = 4, |
| 556 | VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 5, |
| 557 | VK_STRUCTURE_TYPE_SHADER_CREATE_INFO = 6, |
| 558 | VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 7, |
| 559 | VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 8, |
| 560 | VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 9, |
| 561 | VK_STRUCTURE_TYPE_DYNAMIC_VIEWPORT_STATE_CREATE_INFO = 10, |
| 562 | VK_STRUCTURE_TYPE_DYNAMIC_RASTER_STATE_CREATE_INFO = 11, |
| 563 | VK_STRUCTURE_TYPE_DYNAMIC_COLOR_BLEND_STATE_CREATE_INFO = 12, |
| 564 | VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STENCIL_STATE_CREATE_INFO = 13, |
| 565 | VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO = 14, |
| 566 | VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 15, |
| 567 | VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 16, |
| 568 | VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 17, |
| 569 | VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 18, |
| 570 | VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 19, |
| 571 | VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 20, |
| 572 | VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 21, |
| 573 | VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 22, |
| 574 | VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 23, |
| 575 | VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 24, |
| 576 | VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO = 25, |
| 577 | VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 26, |
| 578 | VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 27, |
| 579 | VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 28, |
| 580 | VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 29, |
| 581 | VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 30, |
| 582 | VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 31, |
| 583 | VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 32, |
| 584 | VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO = 33, |
| 585 | VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 34, |
Jesse Hall | f09c6b1 | 2015-08-15 19:54:28 -0700 | [diff] [blame^] | 586 | VK_STRUCTURE_TYPE_MEMORY_BARRIER = 35, |
| 587 | VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 36, |
| 588 | VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 37, |
| 589 | VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 38, |
| 590 | VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 39, |
| 591 | VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 40, |
| 592 | VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 41, |
| 593 | VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 42, |
| 594 | VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 43, |
| 595 | VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 44, |
| 596 | VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION = 45, |
| 597 | VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION = 46, |
| 598 | VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY = 47, |
| 599 | VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 48, |
| 600 | VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO = 49, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 601 | } |
| 602 | |
| 603 | enum VkRenderPassContents { |
| 604 | VK_RENDER_PASS_CONTENTS_INLINE = 0x00000000, |
| 605 | VK_RENDER_PASS_CONTENTS_SECONDARY_CMD_BUFFERS = 0x00000001, |
| 606 | } |
| 607 | |
| 608 | @lastUnused(-33) |
| 609 | /// Error and return codes |
| 610 | enum VkResult { |
| 611 | // Return codes for successful operation execution (positive values) |
| 612 | VK_SUCCESS = 0x00000000, |
| 613 | VK_UNSUPPORTED = 0x00000001, |
| 614 | VK_NOT_READY = 0x00000002, |
| 615 | VK_TIMEOUT = 0x00000003, |
| 616 | VK_EVENT_SET = 0x00000004, |
| 617 | VK_EVENT_RESET = 0x00000005, |
| 618 | VK_INCOMPLETE = 0x00000006, |
| 619 | |
| 620 | // Error codes (negative values) |
| 621 | VK_ERROR_UNKNOWN = 0xFFFFFFFF, |
| 622 | VK_ERROR_UNAVAILABLE = 0xFFFFFFFE, |
| 623 | VK_ERROR_INITIALIZATION_FAILED = 0xFFFFFFFD, |
| 624 | VK_ERROR_OUT_OF_HOST_MEMORY = 0xFFFFFFFC, |
| 625 | VK_ERROR_OUT_OF_DEVICE_MEMORY = 0xFFFFFFFB, |
| 626 | VK_ERROR_DEVICE_ALREADY_CREATED = 0xFFFFFFFA, |
| 627 | VK_ERROR_DEVICE_LOST = 0xFFFFFFF9, |
| 628 | VK_ERROR_INVALID_POINTER = 0xFFFFFFF8, |
| 629 | VK_ERROR_INVALID_VALUE = 0xFFFFFFF7, |
| 630 | VK_ERROR_INVALID_HANDLE = 0xFFFFFFF6, |
| 631 | VK_ERROR_INVALID_ORDINAL = 0xFFFFFFF5, |
| 632 | VK_ERROR_INVALID_MEMORY_SIZE = 0xFFFFFFF4, |
| 633 | VK_ERROR_INVALID_EXTENSION = 0xFFFFFFF3, |
| 634 | VK_ERROR_INVALID_FLAGS = 0xFFFFFFF2, |
| 635 | VK_ERROR_INVALID_ALIGNMENT = 0xFFFFFFF1, |
| 636 | VK_ERROR_INVALID_FORMAT = 0xFFFFFFF0, |
| 637 | VK_ERROR_INVALID_IMAGE = 0xFFFFFFEF, |
| 638 | VK_ERROR_INVALID_DESCRIPTOR_SET_DATA = 0xFFFFFFEE, |
| 639 | VK_ERROR_INVALID_QUEUE_TYPE = 0xFFFFFFED, |
| 640 | VK_ERROR_UNSUPPORTED_SHADER_IL_VERSION = 0xFFFFFFEC, |
| 641 | VK_ERROR_BAD_SHADER_CODE = 0xFFFFFFEB, |
| 642 | VK_ERROR_BAD_PIPELINE_DATA = 0xFFFFFFEA, |
| 643 | VK_ERROR_NOT_MAPPABLE = 0xFFFFFFE9, |
| 644 | VK_ERROR_MEMORY_MAP_FAILED = 0xFFFFFFE8, |
| 645 | VK_ERROR_MEMORY_UNMAP_FAILED = 0xFFFFFFE7, |
| 646 | VK_ERROR_INCOMPATIBLE_DEVICE = 0xFFFFFFE6, |
| 647 | VK_ERROR_INCOMPATIBLE_DRIVER = 0xFFFFFFE5, |
| 648 | VK_ERROR_INCOMPLETE_COMMAND_BUFFER = 0xFFFFFFE4, |
| 649 | VK_ERROR_BUILDING_COMMAND_BUFFER = 0xFFFFFFE3, |
| 650 | VK_ERROR_MEMORY_NOT_BOUND = 0xFFFFFFE2, |
| 651 | VK_ERROR_INCOMPATIBLE_QUEUE = 0xFFFFFFE1, |
| 652 | VK_ERROR_INVALID_LAYER = 0xFFFFFFE0, |
| 653 | } |
| 654 | |
| 655 | |
| 656 | ///////////////// |
| 657 | // Bitfields // |
| 658 | ///////////////// |
| 659 | |
| 660 | /// Device creation flags |
| 661 | bitfield VkDeviceCreateFlags { |
| 662 | VK_DEVICE_CREATE_VALIDATION_BIT = 0x00000001, |
| 663 | } |
| 664 | |
| 665 | /// Queue capabilities |
| 666 | bitfield VkQueueFlags { |
| 667 | VK_QUEUE_GRAPHICS_BIT = 0x00000001, /// Queue supports graphics operations |
| 668 | VK_QUEUE_COMPUTE_BIT = 0x00000002, /// Queue supports compute operations |
| 669 | VK_QUEUE_DMA_BIT = 0x00000004, /// Queue supports DMA operations |
| 670 | VK_QUEUE_SPARSE_MEMMGR_BIT = 0x00000008, /// Queue supports sparse resource memory management operations |
| 671 | VK_QUEUE_EXTENDED_BIT = 0x40000000, /// Extended queue |
| 672 | } |
| 673 | |
| 674 | /// Memory properties passed into vkAllocMemory(). |
| 675 | bitfield VkMemoryPropertyFlags { |
| 676 | VK_MEMORY_PROPERTY_DEVICE_ONLY = 0x00000000, /// If otherwise stated, then allocate memory on device |
| 677 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000001, /// Memory should be mappable by host |
| 678 | VK_MEMORY_PROPERTY_HOST_NON_COHERENT_BIT = 0x00000002, /// Memory may not have i/o coherency so vkFlushMappedMemoryRanges and vkInvalidateMappedMemoryRanges must be used flush/invalidate host cache |
| 679 | /// vkInvalidateMappedMemoryRanges must be used flush/invalidate host cache |
| 680 | VK_MEMORY_PROPERTY_HOST_UNCACHED_BIT = 0x00000004, /// Memory should not be cached by the host |
| 681 | VK_MEMORY_PROPERTY_HOST_WRITE_COMBINED_BIT = 0x00000008, /// Memory should support host write combining |
| 682 | VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, /// Memory may be allocated by the driver when it is required |
| 683 | } |
| 684 | |
| 685 | /// Memory heap flags |
| 686 | bitfield VkMemoryHeapFlags { |
| 687 | VK_MEMORY_HEAP_HOST_LOCAL = 0x00000001, /// If set, heap represents host memory |
| 688 | } |
| 689 | |
| 690 | /// Memory output flags passed to resource transition commands |
| 691 | bitfield VkMemoryOutputFlags { |
| 692 | VK_MEMORY_OUTPUT_HOST_WRITE_BIT = 0x00000001, /// Controls output coherency of host writes |
| 693 | VK_MEMORY_OUTPUT_SHADER_WRITE_BIT = 0x00000002, /// Controls output coherency of generic shader writes |
| 694 | VK_MEMORY_OUTPUT_COLOR_ATTACHMENT_BIT = 0x00000004, /// Controls output coherency of color attachment writes |
| 695 | VK_MEMORY_OUTPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000008, /// Controls output coherency of depth/stencil attachment writes |
| 696 | VK_MEMORY_OUTPUT_TRANSFER_BIT = 0x00000010, /// Controls output coherency of transfer operations |
| 697 | } |
| 698 | |
| 699 | /// Memory input flags passed to resource transition commands |
| 700 | bitfield VkMemoryInputFlags { |
| 701 | VK_MEMORY_INPUT_HOST_READ_BIT = 0x00000001, /// Controls input coherency of host reads |
| 702 | VK_MEMORY_INPUT_INDIRECT_COMMAND_BIT = 0x00000002, /// Controls input coherency of indirect command reads |
| 703 | VK_MEMORY_INPUT_INDEX_FETCH_BIT = 0x00000004, /// Controls input coherency of index fetches |
| 704 | VK_MEMORY_INPUT_VERTEX_ATTRIBUTE_FETCH_BIT = 0x00000008, /// Controls input coherency of vertex attribute fetches |
| 705 | VK_MEMORY_INPUT_UNIFORM_READ_BIT = 0x00000010, /// Controls input coherency of uniform buffer reads |
| 706 | VK_MEMORY_INPUT_SHADER_READ_BIT = 0x00000020, /// Controls input coherency of generic shader reads |
| 707 | VK_MEMORY_INPUT_COLOR_ATTACHMENT_BIT = 0x00000040, /// Controls input coherency of color attachment reads |
| 708 | VK_MEMORY_INPUT_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000080, /// Controls input coherency of depth/stencil attachment reads |
| 709 | VK_MEMORY_INPUT_INPUT_ATTACHMENT_BIT = 0x00000100, /// Controls input coherency of input attachment reads |
| 710 | VK_MEMORY_INPUT_TRANSFER_BIT = 0x00000200, /// Controls input coherency of transfer operations |
| 711 | } |
| 712 | |
| 713 | /// Buffer usage flags |
| 714 | bitfield VkBufferUsageFlags { |
| 715 | VK_BUFFER_USAGE_GENERAL = 0x00000000, /// No special usage |
| 716 | VK_BUFFER_USAGE_TRANSFER_SOURCE_BIT = 0x00000001, /// Can be used as a source of transfer operations |
| 717 | VK_BUFFER_USAGE_TRANSFER_DESTINATION_BIT = 0x00000002, /// Can be used as a destination of transfer operations |
| 718 | VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, /// Can be used as TBO |
| 719 | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, /// Can be used as IBO |
| 720 | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, /// Can be used as UBO |
| 721 | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, /// Can be used as SSBO |
| 722 | VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, /// Can be used as source of fixed function index fetch (index buffer) |
| 723 | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, /// Can be used as source of fixed function vertex fetch (VBO) |
| 724 | VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, /// Can be the source of indirect parameters (e.g. indirect buffer, parameter buffer) |
| 725 | } |
| 726 | |
| 727 | /// Buffer creation flags |
| 728 | bitfield VkBufferCreateFlags { |
| 729 | VK_BUFFER_CREATE_SPARSE_BIT = 0x00000001, /// Buffer should support sparse backing |
| 730 | VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Buffer should support sparse backing with partial residency |
| 731 | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Buffer should support constent data access to physical memory blocks mapped into multiple locations of sparse buffers |
| 732 | } |
| 733 | |
| 734 | /// Shader stage flags |
| 735 | bitfield VkShaderStageFlags { |
| 736 | VK_SHADER_STAGE_VERTEX_BIT = 0x00000001, |
| 737 | VK_SHADER_STAGE_TESS_CONTROL_BIT = 0x00000002, |
| 738 | VK_SHADER_STAGE_TESS_EVALUATION_BIT = 0x00000004, |
| 739 | VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008, |
| 740 | VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, |
| 741 | VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020, |
| 742 | |
| 743 | VK_SHADER_STAGE_ALL = 0x7FFFFFFF, |
| 744 | } |
| 745 | |
| 746 | /// Image usage flags |
| 747 | bitfield VkImageUsageFlags { |
| 748 | VK_IMAGE_USAGE_GENERAL = 0x00000000, /// No special usage |
| 749 | VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT = 0x00000001, /// Can be used as a source of transfer operations |
| 750 | VK_IMAGE_USAGE_TRANSFER_DESTINATION_BIT = 0x00000002, /// Can be used as a destination of transfer operations |
| 751 | VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, /// Can be sampled from (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types) |
| 752 | VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, /// Can be used as storage image (STORAGE_IMAGE descriptor type) |
| 753 | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, /// Can be used as framebuffer color attachment |
| 754 | VK_IMAGE_USAGE_DEPTH_STENCIL_BIT = 0x00000020, /// Can be used as framebuffer depth/stencil attachment |
| 755 | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, /// Image data not needed outside of rendering |
| 756 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, /// Can be used as framebuffer input attachment |
| 757 | } |
| 758 | |
| 759 | /// Image creation flags |
| 760 | bitfield VkImageCreateFlags { |
| 761 | VK_IMAGE_CREATE_SPARSE_BIT = 0x00000001, /// Image should support sparse backing |
| 762 | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, /// Image should support sparse backing with partial residency |
| 763 | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Image should support constent data access to physical memory blocks mapped into multiple locations of sparse images |
| 764 | VK_IMAGE_CREATE_INVARIANT_DATA_BIT = 0x00000008, |
| 765 | VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000010, /// Allows image views to have different format than the base image |
| 766 | VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000020, /// Allows creating image views with cube type from the created image |
| 767 | } |
| 768 | |
| 769 | /// Framebuffer attachment view creation flags |
| 770 | bitfield VkAttachmentViewCreateFlags { |
| 771 | VK_ATTACHMENT_VIEW_CREATE_READ_ONLY_DEPTH_BIT = 0x00000001, |
| 772 | VK_ATTACHMENT_VIEW_CREATE_READ_ONLY_STENCIL_BIT = 0x00000002, |
| 773 | } |
| 774 | |
| 775 | /// Pipeline creation flags |
| 776 | bitfield VkPipelineCreateFlags { |
| 777 | VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001, |
| 778 | VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002, |
| 779 | VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004, |
| 780 | } |
| 781 | |
| 782 | /// Channel flags |
| 783 | bitfield VkChannelFlags { |
| 784 | VK_CHANNEL_R_BIT = 0x00000001, |
| 785 | VK_CHANNEL_G_BIT = 0x00000002, |
| 786 | VK_CHANNEL_B_BIT = 0x00000004, |
| 787 | VK_CHANNEL_A_BIT = 0x00000008, |
| 788 | } |
| 789 | |
| 790 | /// Fence creation flags |
| 791 | bitfield VkFenceCreateFlags { |
| 792 | VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001, |
| 793 | } |
| 794 | |
| 795 | /// Semaphore creation flags |
| 796 | bitfield VkSemaphoreCreateFlags { |
| 797 | } |
| 798 | |
| 799 | /// Format capability flags |
| 800 | bitfield VkFormatFeatureFlags { |
| 801 | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, /// Format can be used for sampled images (SAMPLED_IMAGE and COMBINED_IMAGE_SAMPLER descriptor types) |
| 802 | VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, /// Format can be used for storage images (STORAGE_IMAGE descriptor type) |
| 803 | VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, /// Format supports atomic operations in case it's used for storage images |
| 804 | VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, /// Format can be used for uniform texel buffers (TBOs) |
| 805 | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, /// Format can be used for storage texel buffers (IBOs) |
| 806 | VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, /// Format supports atomic operations in case it's used for storage texel buffers |
| 807 | VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, /// Format can be used for vertex buffers (VBOs) |
| 808 | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, /// Format can be used for color attachment images |
| 809 | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, /// Format supports blending in case it's used for color attachment images |
| 810 | VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, /// Format can be used for depth/stencil attachment images |
| 811 | VK_FORMAT_FEATURE_CONVERSION_BIT = 0x00000400, /// Format can be used as the source or destination of format converting blits |
| 812 | } |
| 813 | |
| 814 | /// Query control flags |
| 815 | bitfield VkQueryControlFlags { |
| 816 | VK_QUERY_CONTROL_CONSERVATIVE_BIT = 0x00000001, /// Allow conservative results to be collected by the query |
| 817 | } |
| 818 | |
| 819 | /// Query result flags |
| 820 | bitfield VkQueryResultFlags { |
| 821 | VK_QUERY_RESULT_DEFAULT = 0x00000000, /// Results of the queries are immediately written to the destination buffer as 32-bit values |
| 822 | VK_QUERY_RESULT_64_BIT = 0x00000001, /// Results of the queries are written to the destination buffer as 64-bit values |
| 823 | VK_QUERY_RESULT_WAIT_BIT = 0x00000002, /// Results of the queries are waited on before proceeding with the result copy |
| 824 | VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, /// Besides the results of the query, the availability of the results is also written |
| 825 | VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, /// Copy the partial results of the query even if the final results aren't available |
| 826 | } |
| 827 | |
| 828 | /// Shader module creation flags |
| 829 | bitfield VkShaderModuleCreateFlags { |
| 830 | } |
| 831 | |
| 832 | /// Shader creation flags |
| 833 | bitfield VkShaderCreateFlags { |
| 834 | } |
| 835 | |
| 836 | /// Event creation flags |
| 837 | bitfield VkEventCreateFlags { |
| 838 | } |
| 839 | |
| 840 | /// Command buffer creation flags |
| 841 | bitfield VkCmdBufferCreateFlags { |
| 842 | } |
| 843 | |
| 844 | /// Command buffer optimization flags |
| 845 | bitfield VkCmdBufferOptimizeFlags { |
| 846 | VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT = 0x00000001, |
| 847 | VK_CMD_BUFFER_OPTIMIZE_PIPELINE_SWITCH_BIT = 0x00000002, |
| 848 | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT = 0x00000004, |
| 849 | VK_CMD_BUFFER_OPTIMIZE_DESCRIPTOR_SET_SWITCH_BIT = 0x00000008, |
| 850 | VK_CMD_BUFFER_OPTIMIZE_NO_SIMULTANEOUS_USE_BIT = 0x00000010, /// Only one call to the secondary command buffer will exist at any given time |
| 851 | } |
| 852 | |
| 853 | /// Pipeline statistics flags |
| 854 | bitfield VkQueryPipelineStatisticFlags { |
| 855 | VK_QUERY_PIPELINE_STATISTIC_IA_VERTICES_BIT = 0x00000001, /// Optional |
| 856 | VK_QUERY_PIPELINE_STATISTIC_IA_PRIMITIVES_BIT = 0x00000002, /// Optional |
| 857 | VK_QUERY_PIPELINE_STATISTIC_VS_INVOCATIONS_BIT = 0x00000004, /// Optional |
| 858 | VK_QUERY_PIPELINE_STATISTIC_GS_INVOCATIONS_BIT = 0x00000008, /// Optional |
| 859 | VK_QUERY_PIPELINE_STATISTIC_GS_PRIMITIVES_BIT = 0x00000010, /// Optional |
| 860 | VK_QUERY_PIPELINE_STATISTIC_C_INVOCATIONS_BIT = 0x00000020, /// Optional |
| 861 | VK_QUERY_PIPELINE_STATISTIC_C_PRIMITIVES_BIT = 0x00000040, /// Optional |
| 862 | VK_QUERY_PIPELINE_STATISTIC_FS_INVOCATIONS_BIT = 0x00000080, /// Optional |
| 863 | VK_QUERY_PIPELINE_STATISTIC_TCS_PATCHES_BIT = 0x00000100, /// Optional |
| 864 | VK_QUERY_PIPELINE_STATISTIC_TES_INVOCATIONS_BIT = 0x00000200, /// Optional |
| 865 | VK_QUERY_PIPELINE_STATISTIC_CS_INVOCATIONS_BIT = 0x00000400, /// Optional |
| 866 | } |
| 867 | |
| 868 | /// Memory mapping flags |
| 869 | bitfield VkMemoryMapFlags { |
| 870 | } |
| 871 | |
| 872 | /// Bitfield of image aspects |
| 873 | bitfield VkImageAspectFlags { |
| 874 | VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001, |
| 875 | VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002, |
| 876 | VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004, |
| 877 | VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008, |
| 878 | } |
| 879 | |
| 880 | /// Sparse memory bind flags |
| 881 | bitfield VkSparseMemoryBindFlags { |
| 882 | VK_SPARSE_MEMORY_BIND_REPLICATE_64KIB_BLOCK_BIT = 0x00000001, /// Replicate the first 64 KiB memory block to the entire bind rage |
| 883 | } |
| 884 | |
| 885 | /// Sparse image memory requirements flags |
| 886 | bitfield VkSparseImageFormatFlags { |
| 887 | VK_SPARSE_IMAGE_FMT_SINGLE_MIPTAIL_BIT = 0x00000001, /// Image uses a single miptail region for all array slices |
| 888 | VK_SPARSE_IMAGE_FMT_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. |
| 889 | VK_SPARSE_IMAGE_FMT_NONSTD_BLOCK_SIZE_BIT = 0x00000004, /// Image uses a non-standard sparse block size |
| 890 | } |
| 891 | |
| 892 | /// Pipeline stages |
| 893 | bitfield VkPipelineStageFlags { |
| 894 | VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, /// Before subsequent commands are processed |
| 895 | VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, /// Draw/DispatchIndirect command fetch |
| 896 | VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, /// Vertex/index fetch |
| 897 | VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, /// Vertex shading |
| 898 | VK_PIPELINE_STAGE_TESS_CONTROL_SHADER_BIT = 0x00000010, /// Tessellation control shading |
| 899 | VK_PIPELINE_STAGE_TESS_EVALUATION_SHADER_BIT = 0x00000020, /// Tessellation evaluation shading |
| 900 | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, /// Geometry shading |
| 901 | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, /// Fragment shading |
| 902 | VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, /// Early fragment (depth/stencil) tests |
| 903 | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, /// Late fragment (depth/stencil) tests |
| 904 | VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, /// Color attachment writes |
| 905 | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, /// Compute shading |
| 906 | VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, /// Transfer/copy operations |
| 907 | VK_PIPELINE_STAGE_TRANSITION_BIT = 0x00002000, /// Resource transition commands |
| 908 | VK_PIPELINE_STAGE_HOST_BIT = 0x00004000, /// Indicates host (CPU) is a source/sink of the dependency |
| 909 | |
| 910 | VK_PIPELINE_STAGE_ALL_GRAPHICS = 0x000007FF, /// All stages of the graphics pipeline |
| 911 | VK_PIPELINE_STAGE_ALL_GPU_COMMANDS = 0x00003FFF, /// All graphics, compute, copy, and transition commands |
| 912 | } |
| 913 | |
| 914 | /// Subpass description flags |
| 915 | bitfield VkSubpassDescriptionFlags { |
| 916 | VK_SUBPASS_DESCRIPTION_NO_OVERDRAW_BIT = 0x00000001, |
| 917 | } |
| 918 | |
| 919 | /// Command pool creation flags |
| 920 | bitfield VkCmdPoolCreateFlags { |
| 921 | VK_CMD_POOL_CREATE_TRANSIENT_BIT = 0x00000001, /// Command buffers have a short lifetime |
| 922 | VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, /// Command buffers may release their memory individually |
| 923 | } |
| 924 | |
| 925 | /// Command pool reset flags |
| 926 | bitfield VkCmdPoolResetFlags { |
| 927 | VK_CMD_POOL_RESET_RELEASE_RESOURCES = 0x00000001, /// Release resources owned by the pool |
| 928 | } |
| 929 | |
| 930 | bitfield VkCmdBufferResetFlags { |
| 931 | VK_CMD_BUFFER_RESET_RELEASE_RESOURCES = 0x00000001, /// Release resources owned by the buffer |
| 932 | } |
| 933 | |
| 934 | |
| 935 | ////////////////// |
| 936 | // Structures // |
| 937 | ////////////////// |
| 938 | |
| 939 | class VkOffset2D { |
| 940 | s32 x |
| 941 | s32 y |
| 942 | } |
| 943 | |
| 944 | class VkOffset3D { |
| 945 | s32 x |
| 946 | s32 y |
| 947 | s32 z |
| 948 | } |
| 949 | |
| 950 | class VkExtent2D { |
| 951 | s32 width |
| 952 | s32 height |
| 953 | } |
| 954 | |
| 955 | class VkExtent3D { |
| 956 | s32 width |
| 957 | s32 height |
| 958 | s32 depth |
| 959 | } |
| 960 | |
| 961 | class VkViewport { |
| 962 | f32 originX |
| 963 | f32 originY |
| 964 | f32 width |
| 965 | f32 height |
| 966 | f32 minDepth |
| 967 | f32 maxDepth |
| 968 | } |
| 969 | |
| 970 | class VkRect2D { |
| 971 | VkOffset2D offset |
| 972 | VkExtent2D extent |
| 973 | } |
| 974 | |
| 975 | class VkRect3D { |
| 976 | VkOffset3D offset |
| 977 | VkExtent3D extent |
| 978 | } |
| 979 | |
| 980 | class VkChannelMapping { |
| 981 | VkChannelSwizzle r |
| 982 | VkChannelSwizzle g |
| 983 | VkChannelSwizzle b |
| 984 | VkChannelSwizzle a |
| 985 | } |
| 986 | |
| 987 | class VkPhysicalDeviceProperties { |
| 988 | u32 apiVersion |
| 989 | u32 driverVersion |
| 990 | u32 vendorId |
| 991 | u32 deviceId |
| 992 | VkPhysicalDeviceType deviceType |
| 993 | char[VK_MAX_PHYSICAL_DEVICE_NAME] deviceName |
| 994 | u8[VK_UUID_LENGTH] pipelineCacheUUID |
| 995 | } |
| 996 | |
| 997 | class VkExtensionProperties { |
| 998 | char[VK_MAX_EXTENSION_NAME] extName /// extension name |
| 999 | u32 specVersion /// version of the extension specification implemented |
| 1000 | } |
| 1001 | |
| 1002 | class VkLayerProperties { |
| 1003 | char[VK_MAX_EXTENSION_NAME] layerName /// layer name |
| 1004 | u32 specVersion /// version of the layer specification implemented |
| 1005 | u32 implVersion /// build or release version of the layer's library |
Jesse Hall | f09c6b1 | 2015-08-15 19:54:28 -0700 | [diff] [blame^] | 1006 | char[VK_MAX_DESCRIPTION] description /// Free-form description of the layer |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1007 | } |
| 1008 | |
| 1009 | class VkApplicationInfo { |
| 1010 | VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO |
| 1011 | const void* pNext /// Next structure in chain |
| 1012 | const char* pAppName |
| 1013 | u32 appVersion |
| 1014 | const char* pEngineName |
| 1015 | u32 engineVersion |
| 1016 | u32 apiVersion |
| 1017 | } |
| 1018 | |
| 1019 | class VkAllocCallbacks { |
| 1020 | void* pUserData |
| 1021 | PFN_vkAllocFunction pfnAlloc |
| 1022 | PFN_vkFreeFunction pfnFree |
| 1023 | } |
| 1024 | |
| 1025 | class VkDeviceQueueCreateInfo { |
| 1026 | u32 queueFamilyIndex |
| 1027 | u32 queueCount |
| 1028 | } |
| 1029 | |
| 1030 | class VkDeviceCreateInfo { |
| 1031 | VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO |
| 1032 | const void* pNext /// Pointer to next structure |
| 1033 | u32 queueRecordCount |
| 1034 | const VkDeviceQueueCreateInfo* pRequestedQueues |
| 1035 | u32 layerCount |
| 1036 | const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled |
| 1037 | u32 extensionCount |
| 1038 | const char* const* ppEnabledExtensionNames |
| 1039 | const VkPhysicalDeviceFeatures* pEnabledFeatures |
| 1040 | VkDeviceCreateFlags flags /// Device creation flags |
| 1041 | } |
| 1042 | |
| 1043 | class VkInstanceCreateInfo { |
| 1044 | VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO |
| 1045 | const void* pNext /// Pointer to next structure |
| 1046 | const VkApplicationInfo* pAppInfo |
| 1047 | const VkAllocCallbacks* pAllocCb |
| 1048 | u32 layerCount |
| 1049 | const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled |
| 1050 | u32 extensionCount |
| 1051 | const char* const* ppEnabledExtensionNames /// Extension names to be enabled |
| 1052 | } |
| 1053 | |
| 1054 | class VkPhysicalDeviceQueueProperties { |
| 1055 | VkQueueFlags queueFlags /// Queue flags |
| 1056 | u32 queueCount |
| 1057 | platform.VkBool32 supportsTimestamps |
| 1058 | } |
| 1059 | |
| 1060 | class VkPhysicalDeviceMemoryProperties { |
| 1061 | u32 memoryTypeCount |
| 1062 | VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes |
| 1063 | u32 memoryHeapCount |
| 1064 | VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps |
| 1065 | } |
| 1066 | |
| 1067 | class VkMemoryAllocInfo { |
| 1068 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO |
| 1069 | const void* pNext /// Pointer to next structure |
| 1070 | platform.VkDeviceSize allocationSize /// Size of memory allocation |
| 1071 | u32 memoryTypeIndex /// Index of the of the memory type to allocate from |
| 1072 | } |
| 1073 | |
| 1074 | class VkMemoryRequirements { |
| 1075 | platform.VkDeviceSize size /// Specified in bytes |
| 1076 | platform.VkDeviceSize alignment /// Specified in bytes |
| 1077 | u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object |
| 1078 | } |
| 1079 | |
| 1080 | class VkSparseImageFormatProperties { |
| 1081 | VkImageAspect aspect |
| 1082 | VkExtent3D imageGranularity |
| 1083 | VkSparseImageFormatFlags flags |
| 1084 | } |
| 1085 | |
| 1086 | class VkSparseImageMemoryRequirements { |
| 1087 | VkSparseImageFormatProperties formatProps |
| 1088 | u32 imageMipTailStartLOD |
| 1089 | platform.VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment |
| 1090 | platform.VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment |
| 1091 | platform.VkDeviceSize imageMipTailStride /// Specified in bytes, must be a multiple of image block size / alignment |
| 1092 | } |
| 1093 | |
| 1094 | class VkMemoryType { |
| 1095 | VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type |
| 1096 | u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from |
| 1097 | } |
| 1098 | |
| 1099 | class VkMemoryHeap { |
| 1100 | platform.VkDeviceSize size /// Available memory in the heap |
| 1101 | VkMemoryHeapFlags flags /// Flags for the heap |
| 1102 | } |
| 1103 | |
| 1104 | class VkMappedMemoryRange { |
| 1105 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE |
| 1106 | const void* pNext /// Pointer to next structure |
| 1107 | VkDeviceMemory mem /// Mapped memory object |
| 1108 | platform.VkDeviceSize offset /// Offset within the mapped memory the range starts from |
| 1109 | platform.VkDeviceSize size /// Size of the range within the mapped memory |
| 1110 | } |
| 1111 | |
| 1112 | class VkFormatProperties { |
| 1113 | VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling |
| 1114 | VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling |
| 1115 | } |
| 1116 | |
| 1117 | class VkImageFormatProperties { |
| 1118 | u64 maxResourceSize /// max size (in bytes) of this resource type |
| 1119 | u32 maxSamples /// max sample count for this resource type |
| 1120 | } |
| 1121 | |
| 1122 | class VkDescriptorInfo { |
| 1123 | VkBufferView bufferView /// Buffer view to write to the descriptor (in case it's a buffer descriptor, otherwise should be VK_NULL_HANDLE) |
| 1124 | VkSampler sampler /// Sampler to write to the descriptor (in case it's a SAMPLER or COMBINED_IMAGE_SAMPLER descriptor, otherwise should be VK_NULL_HANDLE) |
| 1125 | VkImageView imageView /// Image view to write to the descriptor (in case it's a SAMPLED_IMAGE, STORAGE_IMAGE, or COMBINED_IMAGE_SAMPLER descriptor, otherwise should be VK_NULL_HANDLE) |
| 1126 | VkAttachmentView attachmentView /// Input attachment view to write to the descriptor (in case it's a INPUT_ATTACHMENT descriptor, otherwise should be VK_NULL_HANDLE) |
| 1127 | VkImageLayout imageLayout /// Layout the image is expected to be in when accessed using this descriptor (only used if imageView or attachmentView is not VK_NULL_HANDLE) |
| 1128 | } |
| 1129 | |
| 1130 | class VkWriteDescriptorSet { |
| 1131 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET |
| 1132 | const void* pNext /// Pointer to next structure |
| 1133 | VkDescriptorSet destSet /// Destination descriptor set |
| 1134 | u32 destBinding /// Binding within the destination descriptor set to write |
| 1135 | u32 destArrayElement /// Array element within the destination binding to write |
| 1136 | u32 count /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>) |
| 1137 | VkDescriptorType descriptorType /// Descriptor type to write (determines which fields of the array pointed by <pDescriptors> are going to be used) |
| 1138 | const VkDescriptorInfo* pDescriptors /// Array of info structures describing the descriptors to write |
| 1139 | } |
| 1140 | |
| 1141 | class VkCopyDescriptorSet { |
| 1142 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET |
| 1143 | const void* pNext /// Pointer to next structure |
| 1144 | VkDescriptorSet srcSet /// Source descriptor set |
| 1145 | u32 srcBinding /// Binding within the source descriptor set to copy from |
| 1146 | u32 srcArrayElement /// Array element within the source binding to copy from |
| 1147 | VkDescriptorSet destSet /// Destination descriptor set |
| 1148 | u32 destBinding /// Binding within the destination descriptor set to copy to |
| 1149 | u32 destArrayElement /// Array element within the destination binding to copy to |
| 1150 | u32 count /// Number of descriptors to copy |
| 1151 | } |
| 1152 | |
| 1153 | class VkBufferCreateInfo { |
| 1154 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO |
| 1155 | const void* pNext /// Pointer to next structure. |
| 1156 | platform.VkDeviceSize size /// Specified in bytes |
| 1157 | VkBufferUsageFlags usage /// Buffer usage flags |
| 1158 | VkBufferCreateFlags flags /// Buffer creation flags |
| 1159 | VkSharingMode sharingMode |
| 1160 | u32 queueFamilyCount |
| 1161 | const u32* pQueueFamilyIndices |
| 1162 | } |
| 1163 | |
| 1164 | class VkBufferViewCreateInfo { |
| 1165 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO |
| 1166 | const void* pNext /// Pointer to next structure. |
| 1167 | VkBuffer buffer |
| 1168 | VkBufferViewType viewType |
| 1169 | VkFormat format /// Optionally specifies format of elements |
| 1170 | platform.VkDeviceSize offset /// Specified in bytes |
| 1171 | platform.VkDeviceSize range /// View size specified in bytes |
| 1172 | } |
| 1173 | |
| 1174 | class VkImageSubresource { |
| 1175 | VkImageAspect aspect |
| 1176 | u32 mipLevel |
| 1177 | u32 arraySlice |
| 1178 | } |
| 1179 | |
| 1180 | class VkImageSubresourceRange { |
| 1181 | VkImageAspect aspect |
| 1182 | u32 baseMipLevel |
| 1183 | u32 mipLevels |
| 1184 | u32 baseArraySlice |
| 1185 | u32 arraySize |
| 1186 | } |
| 1187 | |
| 1188 | class VkMemoryBarrier { |
| 1189 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER |
| 1190 | const void* pNext /// Pointer to next structure. |
| 1191 | VkMemoryOutputFlags outputMask /// Outputs the barrier should sync |
| 1192 | VkMemoryInputFlags inputMask /// Inputs the barrier should sync to |
| 1193 | } |
| 1194 | |
| 1195 | class VkBufferMemoryBarrier { |
| 1196 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER |
| 1197 | const void* pNext /// Pointer to next structure. |
| 1198 | VkMemoryOutputFlags outputMask /// Outputs the barrier should sync |
| 1199 | VkMemoryInputFlags inputMask /// Inputs the barrier should sync to |
| 1200 | u32 srcQueueFamilyIndex /// Queue family to transition ownership from |
| 1201 | u32 destQueueFamilyIndex /// Queue family to transition ownership to |
| 1202 | VkBuffer buffer /// Buffer to sync |
| 1203 | platform.VkDeviceSize offset /// Offset within the buffer to sync |
| 1204 | platform.VkDeviceSize size /// Amount of bytes to sync |
| 1205 | } |
| 1206 | |
| 1207 | class VkImageMemoryBarrier { |
| 1208 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER |
| 1209 | const void* pNext /// Pointer to next structure. |
| 1210 | VkMemoryOutputFlags outputMask /// Outputs the barrier should sync |
| 1211 | VkMemoryInputFlags inputMask /// Inputs the barrier should sync to |
| 1212 | VkImageLayout oldLayout /// Current layout of the image |
| 1213 | VkImageLayout newLayout /// New layout to transition the image to |
| 1214 | u32 srcQueueFamilyIndex /// Queue family to transition ownership from |
| 1215 | u32 destQueueFamilyIndex /// Queue family to transition ownership to |
| 1216 | VkImage image /// Image to sync |
| 1217 | VkImageSubresourceRange subresourceRange /// Subresource range to sync |
| 1218 | } |
| 1219 | |
| 1220 | class VkImageCreateInfo { |
| 1221 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO |
| 1222 | const void* pNext /// Pointer to next structure. |
| 1223 | VkImageType imageType |
| 1224 | VkFormat format |
| 1225 | VkExtent3D extent |
| 1226 | u32 mipLevels |
| 1227 | u32 arraySize |
| 1228 | u32 samples |
| 1229 | VkImageTiling tiling |
| 1230 | VkImageUsageFlags usage /// Image usage flags |
| 1231 | VkImageCreateFlags flags /// Image creation flags |
| 1232 | VkSharingMode sharingMode /// Cross-queue-family sharing mode |
| 1233 | u32 queueFamilyCount /// Number of queue families to share across |
| 1234 | const u32* pQueueFamilyIndices /// Array of queue family indices to share across |
| 1235 | } |
| 1236 | |
| 1237 | class VkSubresourceLayout { |
| 1238 | platform.VkDeviceSize offset /// Specified in bytes |
| 1239 | platform.VkDeviceSize size /// Specified in bytes |
| 1240 | platform.VkDeviceSize rowPitch /// Specified in bytes |
| 1241 | platform.VkDeviceSize depthPitch /// Specified in bytes |
| 1242 | } |
| 1243 | |
| 1244 | class VkImageViewCreateInfo { |
| 1245 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO |
| 1246 | const void* pNext /// Pointer to next structure |
| 1247 | VkImage image |
| 1248 | VkImageViewType viewType |
| 1249 | VkFormat format |
| 1250 | VkChannelMapping channels |
| 1251 | VkImageSubresourceRange subresourceRange |
| 1252 | } |
| 1253 | |
| 1254 | class VkAttachmentViewCreateInfo { |
| 1255 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO |
| 1256 | const void* pNext /// Pointer to next structure |
| 1257 | VkImage image |
| 1258 | VkFormat format |
| 1259 | u32 mipLevel |
| 1260 | u32 baseArraySlice |
| 1261 | u32 arraySize |
| 1262 | VkAttachmentViewCreateFlags flags /// Framebuffer attachment view flags |
| 1263 | } |
| 1264 | |
| 1265 | class VkAttachmentBindInfo { |
| 1266 | VkAttachmentView view |
| 1267 | VkImageLayout layout |
| 1268 | } |
| 1269 | |
| 1270 | class VkBufferCopy { |
| 1271 | platform.VkDeviceSize srcOffset /// Specified in bytes |
| 1272 | platform.VkDeviceSize destOffset /// Specified in bytes |
| 1273 | platform.VkDeviceSize copySize /// Specified in bytes |
| 1274 | } |
| 1275 | |
| 1276 | class VkSparseMemoryBindInfo { |
Jesse Hall | f09c6b1 | 2015-08-15 19:54:28 -0700 | [diff] [blame^] | 1277 | platform.VkDeviceSize rangeOffset /// Specified in bytes |
| 1278 | platform.VkDeviceSize rangeSize /// Specified in bytes |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1279 | platform.VkDeviceSize memOffset /// Specified in bytes |
| 1280 | VkDeviceMemory mem |
| 1281 | VkSparseMemoryBindFlags flags |
| 1282 | } |
| 1283 | |
| 1284 | class VkSparseImageMemoryBindInfo { |
| 1285 | VkImageSubresource subresource |
| 1286 | VkOffset3D offset |
| 1287 | VkExtent3D extent |
| 1288 | platform.VkDeviceSize memOffset /// Specified in bytes |
| 1289 | VkDeviceMemory mem |
| 1290 | VkSparseMemoryBindFlags flags |
| 1291 | } |
| 1292 | |
| 1293 | class VkImageCopy { |
| 1294 | VkImageSubresource srcSubresource |
| 1295 | VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images |
| 1296 | VkImageSubresource destSubresource |
| 1297 | VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images |
| 1298 | VkExtent3D extent /// Specified in pixels for both compressed and uncompressed images |
| 1299 | } |
| 1300 | |
| 1301 | class VkImageBlit { |
| 1302 | VkImageSubresource srcSubresource |
| 1303 | VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images |
| 1304 | VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images |
| 1305 | VkImageSubresource destSubresource |
| 1306 | VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images |
| 1307 | VkExtent3D destExtent /// Specified in pixels for both compressed and uncompressed images |
| 1308 | } |
| 1309 | |
| 1310 | class VkBufferImageCopy { |
| 1311 | platform.VkDeviceSize bufferOffset /// Specified in bytes |
| 1312 | u32 bufferRowLength /// Specified in texels |
| 1313 | u32 bufferImageHeight |
| 1314 | VkImageSubresource imageSubresource |
| 1315 | VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images |
| 1316 | VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images |
| 1317 | } |
| 1318 | |
| 1319 | class VkImageResolve { |
| 1320 | VkImageSubresource srcSubresource |
| 1321 | VkOffset3D srcOffset |
| 1322 | VkImageSubresource destSubresource |
| 1323 | VkOffset3D destOffset |
| 1324 | VkExtent3D extent |
| 1325 | } |
| 1326 | |
| 1327 | class VkShaderModuleCreateInfo { |
| 1328 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO |
| 1329 | const void* pNext /// Pointer to next structure |
| 1330 | platform.size_t codeSize /// Specified in bytes |
| 1331 | const void* pCode /// Binary code of size codeSize |
| 1332 | VkShaderModuleCreateFlags flags /// Reserved |
| 1333 | } |
| 1334 | |
| 1335 | class VkShaderCreateInfo { |
| 1336 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO |
| 1337 | const void* pNext /// Pointer to next structure |
| 1338 | VkShaderModule module /// Module containing entry point |
| 1339 | const char* pName /// Null-terminated entry point name |
| 1340 | VkShaderCreateFlags flags /// Reserved |
| 1341 | } |
| 1342 | |
| 1343 | class VkDescriptorSetLayoutBinding { |
| 1344 | VkDescriptorType descriptorType /// Type of the descriptors in this binding |
| 1345 | u32 arraySize /// Number of descriptors in this binding |
| 1346 | VkShaderStageFlags stageFlags /// Shader stages this binding is visible to |
| 1347 | const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements) |
| 1348 | } |
| 1349 | |
| 1350 | class VkDescriptorSetLayoutCreateInfo { |
| 1351 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO |
| 1352 | const void* pNext /// Pointer to next structure |
| 1353 | u32 count /// Number of bindings in the descriptor set layout |
| 1354 | const VkDescriptorSetLayoutBinding* pBinding /// Array of descriptor set layout bindings |
| 1355 | } |
| 1356 | |
| 1357 | class VkDescriptorTypeCount { |
| 1358 | VkDescriptorType type |
| 1359 | u32 count |
| 1360 | } |
| 1361 | |
| 1362 | class VkDescriptorPoolCreateInfo { |
| 1363 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO |
| 1364 | const void* pNext /// Pointer to next structure |
| 1365 | u32 count |
| 1366 | const VkDescriptorTypeCount* pTypeCount |
| 1367 | } |
| 1368 | |
| 1369 | class VkSpecializationMapEntry { |
| 1370 | u32 constantId /// The SpecConstant ID specified in the BIL |
| 1371 | platform.size_t size /// Size in bytes of the SpecConstant |
| 1372 | u32 offset /// Offset of the value in the data block |
| 1373 | } |
| 1374 | |
| 1375 | class VkSpecializationInfo { |
| 1376 | u32 mapEntryCount /// Number of entries in the map |
| 1377 | const VkSpecializationMapEntry* pMap /// Array of map entries |
| 1378 | platform.size_t dataSize /// Size in bytes of pData |
| 1379 | const void* pData /// Pointer to SpecConstant data |
| 1380 | } |
| 1381 | |
| 1382 | class VkPipelineShaderStageCreateInfo { |
| 1383 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO |
| 1384 | const void* pNext /// Pointer to next structure |
| 1385 | VkShaderStage stage |
| 1386 | VkShader shader |
| 1387 | const VkSpecializationInfo* pSpecializationInfo |
| 1388 | } |
| 1389 | |
| 1390 | class VkComputePipelineCreateInfo { |
| 1391 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO |
| 1392 | const void* pNext /// Pointer to next structure |
| 1393 | VkPipelineShaderStageCreateInfo cs |
| 1394 | VkPipelineCreateFlags flags /// Pipeline creation flags |
| 1395 | VkPipelineLayout layout /// Interface layout of the pipeline |
| 1396 | 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 |
| 1397 | 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 |
| 1398 | } |
| 1399 | |
| 1400 | class VkVertexInputBindingDescription { |
| 1401 | u32 binding /// Vertex buffer binding id |
| 1402 | u32 strideInBytes /// Distance between vertices in bytes (0 = no advancement) |
| 1403 | VkVertexInputStepRate stepRate /// Rate at which binding is incremented |
| 1404 | } |
| 1405 | |
| 1406 | class VkVertexInputAttributeDescription { |
| 1407 | u32 location /// location of the shader vertex attrib |
| 1408 | u32 binding /// Vertex buffer binding id |
| 1409 | VkFormat format /// format of source data |
| 1410 | u32 offsetInBytes /// Offset of first element in bytes from base of vertex |
| 1411 | } |
| 1412 | |
| 1413 | class VkPipelineVertexInputStateCreateInfo { |
| 1414 | VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO |
| 1415 | const void* pNext /// Pointer to next structure |
| 1416 | u32 bindingCount /// number of bindings |
| 1417 | const VkVertexInputBindingDescription* pVertexBindingDescriptions |
| 1418 | u32 attributeCount /// number of attributes |
| 1419 | const VkVertexInputAttributeDescription* pVertexAttributeDescriptions |
| 1420 | } |
| 1421 | |
| 1422 | class VkPipelineInputAssemblyStateCreateInfo { |
| 1423 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO |
| 1424 | const void* pNext /// Pointer to next structure |
| 1425 | VkPrimitiveTopology topology |
| 1426 | platform.VkBool32 primitiveRestartEnable |
| 1427 | } |
| 1428 | |
| 1429 | class VkPipelineTessellationStateCreateInfo { |
| 1430 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO |
| 1431 | const void* pNext /// Pointer to next structure |
| 1432 | u32 patchControlPoints |
| 1433 | } |
| 1434 | |
| 1435 | class VkPipelineViewportStateCreateInfo { |
| 1436 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO |
| 1437 | const void* pNext /// Pointer to next structure |
| 1438 | u32 viewportCount |
| 1439 | } |
| 1440 | |
| 1441 | class VkPipelineRasterStateCreateInfo { |
| 1442 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO |
| 1443 | const void* pNext /// Pointer to next structure |
| 1444 | platform.VkBool32 depthClipEnable |
| 1445 | platform.VkBool32 rasterizerDiscardEnable |
| 1446 | VkFillMode fillMode /// optional (GL45) |
| 1447 | VkCullMode cullMode |
| 1448 | VkFrontFace frontFace |
| 1449 | } |
| 1450 | |
| 1451 | class VkPipelineMultisampleStateCreateInfo { |
| 1452 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO |
| 1453 | const void* pNext /// Pointer to next structure |
| 1454 | u32 rasterSamples /// Number of samples used for rasterization |
| 1455 | platform.VkBool32 sampleShadingEnable /// optional (GL45) |
| 1456 | f32 minSampleShading /// optional (GL45) |
| 1457 | platform.VkSampleMask sampleMask |
| 1458 | } |
| 1459 | |
| 1460 | class VkPipelineColorBlendAttachmentState { |
| 1461 | platform.VkBool32 blendEnable |
| 1462 | VkBlend srcBlendColor |
| 1463 | VkBlend destBlendColor |
| 1464 | VkBlendOp blendOpColor |
| 1465 | VkBlend srcBlendAlpha |
| 1466 | VkBlend destBlendAlpha |
| 1467 | VkBlendOp blendOpAlpha |
| 1468 | VkChannelFlags channelWriteMask |
| 1469 | } |
| 1470 | |
| 1471 | class VkPipelineColorBlendStateCreateInfo { |
| 1472 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO |
| 1473 | const void* pNext /// Pointer to next structure |
| 1474 | platform.VkBool32 alphaToCoverageEnable |
| 1475 | platform.VkBool32 logicOpEnable |
| 1476 | VkLogicOp logicOp |
| 1477 | u32 attachmentCount /// # of pAttachments |
| 1478 | const VkPipelineColorBlendAttachmentState* pAttachments |
| 1479 | } |
| 1480 | |
| 1481 | class VkStencilOpState { |
| 1482 | VkStencilOp stencilFailOp |
| 1483 | VkStencilOp stencilPassOp |
| 1484 | VkStencilOp stencilDepthFailOp |
| 1485 | VkCompareOp stencilCompareOp |
| 1486 | } |
| 1487 | |
| 1488 | class VkPipelineDepthStencilStateCreateInfo { |
| 1489 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO |
| 1490 | const void* pNext /// Pointer to next structure |
| 1491 | platform.VkBool32 depthTestEnable |
| 1492 | platform.VkBool32 depthWriteEnable |
| 1493 | VkCompareOp depthCompareOp |
| 1494 | platform.VkBool32 depthBoundsEnable /// optional (depth_bounds_test) |
| 1495 | platform.VkBool32 stencilTestEnable |
| 1496 | VkStencilOpState front |
| 1497 | VkStencilOpState back |
| 1498 | } |
| 1499 | |
| 1500 | class VkGraphicsPipelineCreateInfo { |
| 1501 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO |
| 1502 | const void* pNext /// Pointer to next structure |
| 1503 | u32 stageCount |
| 1504 | const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage |
| 1505 | const VkPipelineVertexInputStateCreateInfo* pVertexInputState |
| 1506 | const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState |
| 1507 | const VkPipelineTessellationStateCreateInfo* pTessellationState |
| 1508 | const VkPipelineViewportStateCreateInfo* pViewportState |
| 1509 | const VkPipelineRasterStateCreateInfo* pRasterState |
| 1510 | const VkPipelineMultisampleStateCreateInfo* pMultisampleState |
| 1511 | const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState |
| 1512 | const VkPipelineColorBlendStateCreateInfo* pColorBlendState |
| 1513 | VkPipelineCreateFlags flags /// Pipeline creation flags |
| 1514 | VkPipelineLayout layout /// Interface layout of the pipeline |
| 1515 | VkRenderPass renderPass |
| 1516 | u32 subpass |
| 1517 | 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 |
| 1518 | 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 |
| 1519 | } |
| 1520 | |
| 1521 | class VkPipelineCacheCreateInfo { |
| 1522 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO |
| 1523 | const void* pNext /// Pointer to next structure |
| 1524 | platform.size_t initialSize /// Size of initial data to populate cache, in bytes |
| 1525 | const void* initialData /// Initial data to populate cache |
| 1526 | platform.size_t maxSize /// Maximum size cache can grow to, in bytes. If zero, then the cache may grow without bound. |
| 1527 | } |
| 1528 | |
| 1529 | class VkPushConstantRange { |
| 1530 | VkShaderStageFlags stageFlags /// Which stages use the range |
| 1531 | u32 start /// Start of the range, in bytes |
| 1532 | u32 length /// Length of the range, in bytes |
| 1533 | } |
| 1534 | |
| 1535 | class VkPipelineLayoutCreateInfo { |
| 1536 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO |
| 1537 | const void* pNext /// Pointer to next structure |
| 1538 | u32 descriptorSetCount /// Number of descriptor sets interfaced by the pipeline |
| 1539 | const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the |
| 1540 | u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline |
| 1541 | const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages |
| 1542 | } |
| 1543 | |
| 1544 | class VkSamplerCreateInfo { |
| 1545 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO |
| 1546 | const void* pNext /// Pointer to next structure |
| 1547 | VkTexFilter magFilter /// Filter mode for magnification |
| 1548 | VkTexFilter minFilter /// Filter mode for minifiation |
| 1549 | VkTexMipmapMode mipMode /// Mipmap selection mode |
| 1550 | VkTexAddress addressU |
| 1551 | VkTexAddress addressV |
| 1552 | VkTexAddress addressW |
| 1553 | f32 mipLodBias |
| 1554 | f32 maxAnisotropy |
| 1555 | platform.VkBool32 compareEnable |
| 1556 | VkCompareOp compareOp |
| 1557 | f32 minLod |
| 1558 | f32 maxLod |
| 1559 | VkBorderColor borderColor |
| 1560 | } |
| 1561 | |
| 1562 | class VkDynamicViewportStateCreateInfo { |
| 1563 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DYNAMIC_VIEWPORT_STATE_CREATE_INFO |
| 1564 | const void* pNext /// Pointer to next structure |
| 1565 | u32 viewportAndScissorCount /// number of entries in pViewports and pScissors |
| 1566 | const VkViewport* pViewports |
| 1567 | const VkRect2D* pScissors |
| 1568 | } |
| 1569 | |
| 1570 | class VkDynamicRasterStateCreateInfo { |
| 1571 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DYNAMIC_RASTER_STATE_CREATE_INFO |
| 1572 | const void* pNext /// Pointer to next structure |
| 1573 | f32 depthBias |
| 1574 | f32 depthBiasClamp |
| 1575 | f32 slopeScaledDepthBias |
| 1576 | f32 lineWidth /// optional (GL45) - Width of lines |
| 1577 | } |
| 1578 | |
| 1579 | class VkDynamicColorBlendStateCreateInfo { |
| 1580 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DYNAMIC_COLOR_BLEND_STATE_CREATE_INFO |
| 1581 | const void* pNext /// Pointer to next structure |
| 1582 | f32[4] blendConst |
| 1583 | } |
| 1584 | |
| 1585 | class VkDynamicDepthStencilStateCreateInfo { |
| 1586 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STENCIL_STATE_CREATE_INFO |
| 1587 | const void* pNext /// Pointer to next structure |
| 1588 | f32 minDepthBounds /// optional (depth_bounds_test) |
| 1589 | f32 maxDepthBounds /// optional (depth_bounds_test) |
| 1590 | u32 stencilReadMask |
| 1591 | u32 stencilWriteMask |
| 1592 | u32 stencilFrontRef |
| 1593 | u32 stencilBackRef |
| 1594 | } |
| 1595 | |
| 1596 | class VkCmdPoolCreateInfo { |
| 1597 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO |
| 1598 | const void* pNext /// Pointer to next structure |
| 1599 | u32 queueFamilyIndex |
| 1600 | VkCmdPoolCreateFlags flags /// Command pool creation flags |
| 1601 | } |
| 1602 | |
| 1603 | class VkCmdBufferCreateInfo { |
| 1604 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO |
| 1605 | const void* pNext /// Pointer to next structure |
| 1606 | VkCmdPool cmdPool |
| 1607 | VkCmdBufferLevel level |
| 1608 | VkCmdBufferCreateFlags flags /// Command buffer creation flags |
| 1609 | } |
| 1610 | |
| 1611 | class VkCmdBufferBeginInfo { |
| 1612 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO |
| 1613 | const void* pNext /// Pointer to next structure |
| 1614 | VkCmdBufferOptimizeFlags flags /// Command buffer optimization flags |
| 1615 | VkRenderPass renderPass /// Render pass for secondary command buffers |
| 1616 | VkFramebuffer framebuffer /// Framebuffer for secondary command buffers |
| 1617 | } |
| 1618 | |
| 1619 | class VkRenderPassBeginInfo { |
| 1620 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO |
| 1621 | const void* pNext /// Pointer to next structure |
| 1622 | VkRenderPass renderPass |
| 1623 | VkFramebuffer framebuffer |
| 1624 | VkRect2D renderArea |
| 1625 | u32 attachmentCount |
| 1626 | const VkClearValue* pAttachmentClearValues |
| 1627 | } |
| 1628 | |
| 1629 | @union |
| 1630 | /// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared. |
| 1631 | class VkClearColorValue { |
| 1632 | f32[4] f32 |
| 1633 | s32[4] s32 |
| 1634 | u32[4] u32 |
| 1635 | } |
| 1636 | |
| 1637 | class VkClearDepthStencilValue { |
| 1638 | f32 depth |
| 1639 | u32 stencil |
| 1640 | } |
| 1641 | |
| 1642 | @union |
| 1643 | /// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared. |
| 1644 | class VkClearValue { |
| 1645 | VkClearColorValue color |
| 1646 | VkClearDepthStencilValue ds |
| 1647 | } |
| 1648 | |
| 1649 | class VkAttachmentDescription { |
| 1650 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION |
| 1651 | const void* pNext /// Pointer to next structure |
| 1652 | VkFormat format |
| 1653 | u32 samples |
| 1654 | VkAttachmentLoadOp loadOp /// Load op for color or depth data |
| 1655 | VkAttachmentStoreOp storeOp /// Store op for color or depth data |
| 1656 | VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data |
| 1657 | VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data |
| 1658 | VkImageLayout initialLayout |
| 1659 | VkImageLayout finalLayout |
| 1660 | } |
| 1661 | |
| 1662 | class VkAttachmentReference { |
| 1663 | u32 attachment |
| 1664 | VkImageLayout layout |
| 1665 | } |
| 1666 | |
| 1667 | class VkSubpassDescription { |
| 1668 | VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DESCRIPTION |
| 1669 | const void* pNext /// Pointer to next structure |
| 1670 | VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now |
| 1671 | VkSubpassDescriptionFlags flags |
| 1672 | u32 inputCount |
| 1673 | const VkAttachmentReference* inputAttachments |
| 1674 | u32 colorCount |
| 1675 | const VkAttachmentReference* colorAttachments |
| 1676 | const VkAttachmentReference* resolveAttachments |
| 1677 | VkAttachmentReference depthStencilAttachment |
| 1678 | u32 preserveCount |
| 1679 | const VkAttachmentReference* preserveAttachments |
| 1680 | } |
| 1681 | |
| 1682 | class VkSubpassDependency { |
| 1683 | VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DEPENDENCY |
| 1684 | const void* pNext /// Pointer to next structure |
| 1685 | u32 srcSubpass |
| 1686 | u32 destSubpass |
| 1687 | VkPipelineStageFlags srcStageMask |
| 1688 | VkPipelineStageFlags destStageMask |
| 1689 | VkMemoryOutputFlags outputMask |
| 1690 | VkMemoryInputFlags inputMask |
| 1691 | platform.VkBool32 byRegion |
| 1692 | } |
| 1693 | |
| 1694 | class VkRenderPassCreateInfo { |
| 1695 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO |
| 1696 | const void* pNext /// Pointer to next structure |
| 1697 | u32 attachmentCount |
| 1698 | const VkAttachmentDescription* pAttachments |
| 1699 | u32 subpassCount |
| 1700 | const VkSubpassDescription* pSubpasses |
| 1701 | u32 dependencyCount |
| 1702 | const VkSubpassDependency* pDependencies |
| 1703 | } |
| 1704 | |
| 1705 | class VkEventCreateInfo { |
| 1706 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO |
| 1707 | const void* pNext /// Pointer to next structure |
| 1708 | VkEventCreateFlags flags /// Event creation flags |
| 1709 | } |
| 1710 | |
| 1711 | class VkFenceCreateInfo { |
| 1712 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO |
| 1713 | const void* pNext /// Pointer to next structure |
| 1714 | VkFenceCreateFlags flags /// Fence creation flags |
| 1715 | } |
| 1716 | |
| 1717 | class VkPhysicalDeviceFeatures { |
| 1718 | platform.VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined |
| 1719 | platform.VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls |
| 1720 | platform.VkBool32 imageCubeArray /// image views which are arrays of cube maps |
| 1721 | platform.VkBool32 independentBlend /// blending operations are controlled per-attachment |
| 1722 | platform.VkBool32 geometryShader /// geometry stage |
| 1723 | platform.VkBool32 tessellationShader /// tessellation control and evaluation stage |
| 1724 | platform.VkBool32 sampleRateShading /// per-sample shading and interpolation |
| 1725 | platform.VkBool32 dualSourceBlend /// blend operations which take two sources |
| 1726 | platform.VkBool32 logicOp /// logic operations |
| 1727 | platform.VkBool32 instancedDrawIndirect /// multi draw indirect |
| 1728 | platform.VkBool32 depthClip /// depth clipping |
| 1729 | platform.VkBool32 depthBiasClamp /// depth bias clamping |
| 1730 | platform.VkBool32 fillModeNonSolid /// point and wireframe fill modes |
| 1731 | platform.VkBool32 depthBounds /// depth bounds test |
| 1732 | platform.VkBool32 wideLines /// lines with width greater than 1 |
| 1733 | platform.VkBool32 largePoints /// points with size greater than 1 |
| 1734 | platform.VkBool32 textureCompressionETC2 /// ETC texture compression formats |
| 1735 | platform.VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats |
| 1736 | platform.VkBool32 textureCompressionBC /// BC1-7 texture compressed formats |
| 1737 | platform.VkBool32 pipelineStatisticsQuery /// pipeline statistics query |
| 1738 | platform.VkBool32 vertexSideEffects /// storage buffers and images in vertex stage |
| 1739 | platform.VkBool32 tessellationSideEffects /// storage buffers and images in tessellation stage |
| 1740 | platform.VkBool32 geometrySideEffects /// storage buffers and images in geometry stage |
| 1741 | platform.VkBool32 fragmentSideEffects /// storage buffers and images in fragment stage |
| 1742 | platform.VkBool32 shaderTessellationPointSize /// tessellation stage can export point size |
| 1743 | platform.VkBool32 shaderGeometryPointSize /// geometry stage can export point size |
| 1744 | platform.VkBool32 shaderTextureGatherExtended /// texture gather with run-time values and independent offsets |
| 1745 | platform.VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images |
| 1746 | platform.VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images |
| 1747 | platform.VkBool32 shaderStorageBufferArrayConstantIndexing /// arrays of storage buffers can be accessed with constant indices |
| 1748 | platform.VkBool32 shaderStorageImageArrayConstantIndexing /// arrays of storage images can be accessed with constant indices |
| 1749 | platform.VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices |
| 1750 | platform.VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices |
| 1751 | platform.VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices |
| 1752 | platform.VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices |
| 1753 | platform.VkBool32 shaderClipDistance /// clip distance in shaders |
| 1754 | platform.VkBool32 shaderCullDistance /// cull distance in shaders |
| 1755 | platform.VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders |
| 1756 | platform.VkBool32 shaderInt64 /// 64-bit integers in shaders |
| 1757 | platform.VkBool32 shaderFloat16 /// 16-bit floats in shaders |
| 1758 | platform.VkBool32 shaderInt16 /// 16-bit integers in shaders |
| 1759 | platform.VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support) |
| 1760 | platform.VkBool32 shaderResourceMinLOD /// shader can use texture operations that specify minimum resource LOD |
| 1761 | platform.VkBool32 sparse /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level |
| 1762 | platform.VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers |
| 1763 | platform.VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images |
| 1764 | platform.VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images |
| 1765 | platform.VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples |
| 1766 | platform.VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples |
| 1767 | platform.VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples |
| 1768 | platform.VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples |
| 1769 | platform.VkBool32 sparseResidencyStandard2DBlockShape /// Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard block shapes (based on pixel format) |
| 1770 | platform.VkBool32 sparseResidencyStandard2DMSBlockShape /// Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard block shapes (based on pixel format) |
| 1771 | platform.VkBool32 sparseResidencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format) |
| 1772 | platform.VkBool32 sparseResidencyAlignedMipSize /// Sparse resources support: Images with mip-level dimensions that are NOT a multiple of the block size will be placed in the mip tail |
| 1773 | platform.VkBool32 sparseResidencyNonResident /// Sparse resources support: GPU can safely access non-resident regions of a resource, read values from read-write resources are undefined |
| 1774 | platform.VkBool32 sparseResidencyNonResidentStrict /// Sparse resources support: GPU can safely access non-resident regions of a resource, all reads return as if data is 0, writes are discarded |
| 1775 | platform.VkBool32 sparseResidencyAliased /// Sparse resources support: GPU can correctly access data aliased into multiple locations (opt-in) |
| 1776 | } |
| 1777 | |
| 1778 | class VkPhysicalDeviceLimits { |
| 1779 | /// resource maximum sizes |
| 1780 | u32 maxImageDimension1D /// max 1D image dimension |
| 1781 | u32 maxImageDimension2D /// max 2D image dimension |
| 1782 | u32 maxImageDimension3D /// max 3D image dimension |
| 1783 | u32 maxImageDimensionCube /// max cubemap image dimension |
| 1784 | u32 maxImageArrayLayers /// max layers for image arrays |
| 1785 | u32 maxTexelBufferSize /// max texel buffer size (bytes) |
| 1786 | u32 maxUniformBufferSize /// max uniform buffer size (bytes) |
| 1787 | u32 maxStorageBufferSize /// max storage buffer size (bytes) |
| 1788 | u32 maxPushConstantsSize /// max size of the push constants pool (bytes) |
| 1789 | /// memory limits |
| 1790 | u32 maxMemoryAllocationCount /// max number of device memory allocations supported |
| 1791 | platform.VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage |
| 1792 | /// descriptor set limits |
| 1793 | u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline |
| 1794 | u32 maxDescriptorSets /// max number of allocated descriptor sets |
| 1795 | u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set |
| 1796 | u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set |
| 1797 | u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set |
| 1798 | u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set |
| 1799 | u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set |
| 1800 | u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set |
| 1801 | u32 maxDescriptorSetUniformBuffers /// max num of uniform buffers allowed in all stages in a descriptor set |
| 1802 | u32 maxDescriptorSetStorageBuffers /// max num of storage buffers allowed in all stages in a descriptor set |
| 1803 | u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set |
| 1804 | u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set |
| 1805 | /// vertex stage limits |
| 1806 | u32 maxVertexInputAttributes /// max num of vertex input attribute slots |
| 1807 | u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset |
| 1808 | u32 maxVertexInputBindingStride /// max vertex input binding stride |
| 1809 | u32 maxVertexOutputComponents /// max num of output components written by vertex shader |
| 1810 | /// tessellation control stage limits |
| 1811 | u32 maxTessGenLevel /// max level supported by tess primitive generator |
| 1812 | u32 maxTessPatchSize /// max patch size (vertices) |
| 1813 | u32 maxTessControlPerVertexInputComponents /// max num of input components per-vertex in TCS |
| 1814 | u32 maxTessControlPerVertexOutputComponents /// max num of output components per-vertex in TCS |
| 1815 | u32 maxTessControlPerPatchOutputComponents /// max num of output components per-patch in TCS |
| 1816 | u32 maxTessControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS |
| 1817 | u32 maxTessEvaluationInputComponents /// max num of input components per vertex in TES |
| 1818 | u32 maxTessEvaluationOutputComponents /// max num of output components per vertex in TES |
| 1819 | /// geometry stage limits |
| 1820 | u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader |
| 1821 | u32 maxGeometryInputComponents /// max num of input components read in geometry stage |
| 1822 | u32 maxGeometryOutputComponents /// max num of output components written in geometry stage |
| 1823 | u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage |
| 1824 | u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage |
| 1825 | /// fragment stage limits |
| 1826 | u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage |
| 1827 | u32 maxFragmentOutputBuffers /// max num of output buffers written in fragment stage |
| 1828 | u32 maxFragmentDualSourceBuffers /// max num of output buffers written when using dual source blending |
| 1829 | u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers |
| 1830 | /// compute stage limits |
| 1831 | u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes) |
| 1832 | u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z) |
| 1833 | u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group |
| 1834 | u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z) |
| 1835 | |
| 1836 | u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y |
| 1837 | u32 subTexelPrecisionBits /// num bits of subtexel precision |
| 1838 | u32 mipmapPrecisionBits /// num bits of mipmap precision |
| 1839 | |
| 1840 | u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices) |
| 1841 | u32 maxDrawIndirectInstanceCount /// max instance count for indirect draw calls |
| 1842 | platform.VkBool32 primitiveRestartForPatches /// is primitive restart supported for PATCHES |
| 1843 | |
| 1844 | f32 maxSamplerLodBias /// max absolute sampler level of detail bias |
| 1845 | f32 maxSamplerAnisotropy /// max degree of sampler anisotropy |
| 1846 | |
| 1847 | u32 maxViewports /// max number of active viewports |
| 1848 | u32 maxDynamicViewportStates /// max number of dynamic viewport state objects |
| 1849 | u32[2] maxViewportDimensions /// max viewport dimensions (x,y) |
| 1850 | f32[2] viewportBoundsRange /// viewport bounds range (min,max) |
| 1851 | u32 viewportSubPixelBits /// num bits of subpixel precision for viewport |
| 1852 | |
| 1853 | u32 minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes) |
Jesse Hall | f09c6b1 | 2015-08-15 19:54:28 -0700 | [diff] [blame^] | 1854 | u32 minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1855 | u32 minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes) |
| 1856 | u32 minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes) |
| 1857 | |
| 1858 | u32 minTexelOffset /// min texel offset for OpTextureSampleOffset |
| 1859 | u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset |
| 1860 | u32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset |
| 1861 | u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset |
| 1862 | f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset |
| 1863 | f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset |
| 1864 | u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset |
| 1865 | |
| 1866 | u32 maxFramebufferWidth /// max width for a framebuffer |
| 1867 | u32 maxFramebufferHeight /// max height for a framebuffer |
| 1868 | u32 maxFramebufferLayers /// max layer count for a layered framebuffer |
| 1869 | u32 maxFramebufferColorSamples /// max color sample count for a framebuffer |
| 1870 | u32 maxFramebufferDepthSamples /// max depth sample count for a framebuffer |
| 1871 | u32 maxFramebufferStencilSamples /// max stencil sample count for a framebuffer |
| 1872 | u32 maxColorAttachments /// max num of framebuffer color attachments |
| 1873 | |
| 1874 | u32 maxSampledImageColorSamples /// max num of color samples for a non-integer sampled image |
| 1875 | u32 maxSampledImageDepthSamples /// max num of depth/stencil samples for a sampled image |
| 1876 | u32 maxSampledImageIntegerSamples /// max num of samples supported for an integer image |
| 1877 | u32 maxStorageImageSamples /// max num of samples for a storage image |
| 1878 | u32 maxSampleMaskWords /// max num of sample mask words |
| 1879 | |
| 1880 | u64 timestampFrequency /// 1/clock_tick_granularity for timestamp queries |
| 1881 | |
| 1882 | u32 maxClipDistances /// max number of clip distances |
| 1883 | u32 maxCullDistances /// max number of cull distances |
| 1884 | u32 maxCombinedClipAndCullDistances /// max combined number of user clipping |
| 1885 | |
| 1886 | f32[2] pointSizeRange /// range (min,max) of supported point sizes |
| 1887 | f32[2] lineWidthRange /// range (min,max) of supported line widths |
| 1888 | f32 pointSizeGranularity /// granularity of supported point sizes |
| 1889 | f32 lineWidthGranularity /// granularity of supported line widths |
| 1890 | } |
| 1891 | |
| 1892 | class VkSemaphoreCreateInfo { |
| 1893 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO |
| 1894 | const void* pNext /// Pointer to next structure |
| 1895 | VkSemaphoreCreateFlags flags /// Semaphore creation flags |
| 1896 | } |
| 1897 | |
| 1898 | class VkQueryPoolCreateInfo { |
| 1899 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO |
| 1900 | const void* pNext /// Pointer to next structure |
| 1901 | VkQueryType queryType |
| 1902 | u32 slots |
| 1903 | VkQueryPipelineStatisticFlags pipelineStatistics /// Optional |
| 1904 | } |
| 1905 | |
| 1906 | class VkFramebufferCreateInfo { |
| 1907 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO |
| 1908 | const void* pNext /// Pointer to next structure |
| 1909 | VkRenderPass renderPass |
| 1910 | u32 attachmentCount |
| 1911 | const VkAttachmentBindInfo* pAttachments |
| 1912 | u32 width |
| 1913 | u32 height |
| 1914 | u32 layers |
| 1915 | } |
| 1916 | |
| 1917 | class VkDrawIndirectCmd { |
| 1918 | u32 vertexCount |
| 1919 | u32 instanceCount |
| 1920 | u32 firstVertex |
| 1921 | u32 firstInstance |
| 1922 | } |
| 1923 | |
| 1924 | class VkDrawIndexedIndirectCmd { |
| 1925 | u32 indexCount |
| 1926 | u32 instanceCount |
| 1927 | u32 firstIndex |
| 1928 | s32 vertexOffset |
| 1929 | u32 firstInstance |
| 1930 | } |
| 1931 | |
| 1932 | class VkDispatchIndirectCmd { |
| 1933 | u32 x |
| 1934 | u32 y |
| 1935 | u32 z |
| 1936 | } |
| 1937 | |
| 1938 | |
| 1939 | //////////////// |
| 1940 | // Commands // |
| 1941 | //////////////// |
| 1942 | |
| 1943 | // Function pointers. TODO: add support for function pointers. |
| 1944 | |
| 1945 | @external type void* PFN_vkVoidFunction |
| 1946 | @pfn cmd void vkVoidFunction() { |
| 1947 | } |
| 1948 | |
| 1949 | @external type void* PFN_vkAllocFunction |
| 1950 | @pfn cmd void* vkAllocFunction( |
| 1951 | void* pUserData, |
| 1952 | platform.size_t size, |
| 1953 | platform.size_t alignment, |
| 1954 | VkSystemAllocType allocType) { |
| 1955 | return ? |
| 1956 | } |
| 1957 | |
| 1958 | @external type void* PFN_vkFreeFunction |
| 1959 | @pfn cmd void vkFreeFunction( |
| 1960 | void* pUserData, |
| 1961 | void* pMem) { |
| 1962 | } |
| 1963 | |
| 1964 | |
| 1965 | // Global functions |
| 1966 | |
| 1967 | @threadSafety("system") |
| 1968 | cmd VkResult vkCreateInstance( |
| 1969 | const VkInstanceCreateInfo* pCreateInfo, |
| 1970 | VkInstance* pInstance) { |
| 1971 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO) |
| 1972 | |
| 1973 | instance := ? |
| 1974 | pInstance[0] = instance |
| 1975 | State.Instances[instance] = new!InstanceObject() |
| 1976 | |
| 1977 | layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.layerCount] |
| 1978 | extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.extensionCount] |
| 1979 | |
| 1980 | return ? |
| 1981 | } |
| 1982 | |
| 1983 | @threadSafety("system") |
| 1984 | cmd VkResult vkDestroyInstance( |
| 1985 | VkInstance instance) { |
| 1986 | instanceObject := GetInstance(instance) |
| 1987 | |
| 1988 | State.Instances[instance] = null |
| 1989 | |
| 1990 | return ? |
| 1991 | } |
| 1992 | |
| 1993 | @threadSafety("system") |
| 1994 | cmd VkResult vkEnumeratePhysicalDevices( |
| 1995 | VkInstance instance, |
| 1996 | u32* pPhysicalDeviceCount, |
| 1997 | VkPhysicalDevice* pPhysicalDevices) { |
| 1998 | instanceObject := GetInstance(instance) |
| 1999 | |
| 2000 | physicalDeviceCount := as!u32(?) |
| 2001 | pPhysicalDeviceCount[0] = physicalDeviceCount |
| 2002 | physicalDevices := pPhysicalDevices[0:physicalDeviceCount] |
| 2003 | |
| 2004 | for i in (0 .. physicalDeviceCount) { |
| 2005 | physicalDevice := ? |
| 2006 | physicalDevices[i] = physicalDevice |
| 2007 | if !(physicalDevice in State.PhysicalDevices) { |
| 2008 | State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance) |
| 2009 | } |
| 2010 | } |
| 2011 | |
| 2012 | return ? |
| 2013 | } |
| 2014 | |
| 2015 | cmd PFN_vkVoidFunction vkGetDeviceProcAddr( |
| 2016 | VkDevice device, |
| 2017 | const char* pName) { |
| 2018 | if device != VK_NULL_HANDLE { |
| 2019 | device := GetDevice(device) |
| 2020 | } |
| 2021 | |
| 2022 | return ? |
| 2023 | } |
| 2024 | |
| 2025 | cmd PFN_vkVoidFunction vkGetInstanceProcAddr( |
| 2026 | VkInstance instance, |
| 2027 | const char* pName) { |
| 2028 | if instance != VK_NULL_HANDLE { |
| 2029 | instanceObject := GetInstance(instance) |
| 2030 | } |
| 2031 | |
| 2032 | return ? |
| 2033 | } |
| 2034 | |
| 2035 | cmd VkResult vkGetPhysicalDeviceProperties( |
| 2036 | VkPhysicalDevice physicalDevice, |
| 2037 | VkPhysicalDeviceProperties* pProperties) { |
| 2038 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2039 | |
| 2040 | properties := ? |
| 2041 | pProperties[0] = properties |
| 2042 | |
| 2043 | return ? |
| 2044 | } |
| 2045 | |
| 2046 | cmd VkResult vkGetPhysicalDeviceQueueCount( |
| 2047 | VkPhysicalDevice physicalDevice, |
| 2048 | u32* pCount) { |
| 2049 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2050 | |
| 2051 | count := ? |
| 2052 | pCount[0] = count |
| 2053 | |
| 2054 | return ? |
| 2055 | } |
| 2056 | |
| 2057 | cmd VkResult vkGetPhysicalDeviceQueueProperties( |
| 2058 | VkPhysicalDevice physicalDevice, |
| 2059 | u32 count, |
| 2060 | VkPhysicalDeviceQueueProperties* pQueueProperties) { |
| 2061 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2062 | queuesProperties := pQueueProperties[0:count] |
| 2063 | for i in (0 .. count) { |
| 2064 | queueProperties := as!VkPhysicalDeviceQueueProperties(?) |
| 2065 | queuesProperties[i] = queueProperties |
| 2066 | } |
| 2067 | return ? |
| 2068 | } |
| 2069 | |
| 2070 | cmd VkResult vkGetPhysicalDeviceMemoryProperties( |
| 2071 | VkPhysicalDevice physicalDevice, |
| 2072 | VkPhysicalDeviceMemoryProperties* pMemoryProperties) { |
| 2073 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2074 | |
| 2075 | memoryProperties := ? |
| 2076 | pMemoryProperties[0] = memoryProperties |
| 2077 | |
| 2078 | return ? |
| 2079 | } |
| 2080 | |
| 2081 | cmd VkResult vkGetPhysicalDeviceFeatures( |
| 2082 | VkPhysicalDevice physicalDevice, |
| 2083 | VkPhysicalDeviceFeatures* pFeatures) { |
| 2084 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2085 | |
| 2086 | features := ? |
| 2087 | pFeatures[0] = features |
| 2088 | |
| 2089 | return ? |
| 2090 | } |
| 2091 | |
| 2092 | cmd VkResult vkGetPhysicalDeviceFormatProperties( |
| 2093 | VkPhysicalDevice physicalDevice, |
| 2094 | VkFormat format, |
| 2095 | VkFormatProperties* pFormatProperties) { |
| 2096 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2097 | |
| 2098 | formatProperties := ? |
| 2099 | pFormatProperties[0] = formatProperties |
| 2100 | |
| 2101 | return ? |
| 2102 | } |
| 2103 | |
| 2104 | cmd VkResult vkGetPhysicalDeviceImageFormatProperties( |
| 2105 | VkPhysicalDevice physicalDevice, |
| 2106 | VkFormat format, |
| 2107 | VkImageType type, |
| 2108 | VkImageTiling tiling, |
| 2109 | VkImageUsageFlags usage, |
| 2110 | VkImageFormatProperties* pImageFormatProperties) { |
| 2111 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2112 | |
| 2113 | imageFormatProperties := ? |
| 2114 | pImageFormatProperties[0] = imageFormatProperties |
| 2115 | |
| 2116 | return ? |
| 2117 | } |
| 2118 | |
| 2119 | cmd VkResult vkGetPhysicalDeviceLimits( |
| 2120 | VkPhysicalDevice physicalDevice, |
| 2121 | VkPhysicalDeviceLimits* pLimits) { |
| 2122 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2123 | |
| 2124 | limits := ? |
| 2125 | pLimits[0] = limits |
| 2126 | |
| 2127 | return ? |
| 2128 | } |
| 2129 | |
| 2130 | |
| 2131 | // Device functions |
| 2132 | |
| 2133 | @threadSafety("system") |
| 2134 | cmd VkResult vkCreateDevice( |
| 2135 | VkPhysicalDevice physicalDevice, |
| 2136 | const VkDeviceCreateInfo* pCreateInfo, |
| 2137 | VkDevice* pDevice) { |
| 2138 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO) |
| 2139 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2140 | |
| 2141 | device := ? |
| 2142 | pDevice[0] = device |
| 2143 | State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice) |
| 2144 | |
| 2145 | return ? |
| 2146 | } |
| 2147 | |
| 2148 | @threadSafety("system") |
| 2149 | cmd VkResult vkDestroyDevice( |
| 2150 | VkDevice device) { |
| 2151 | deviceObject := GetDevice(device) |
| 2152 | |
| 2153 | State.Devices[device] = null |
| 2154 | |
| 2155 | return ? |
| 2156 | } |
| 2157 | |
| 2158 | |
| 2159 | // Extension discovery functions |
| 2160 | |
| 2161 | cmd VkResult vkGetGlobalLayerProperties( |
| 2162 | u32* pCount, |
| 2163 | VkLayerProperties* pProperties) { |
| 2164 | count := as!u32(?) |
| 2165 | pCount[0] = count |
| 2166 | |
| 2167 | properties := pProperties[0:count] |
| 2168 | for i in (0 .. count) { |
| 2169 | property := ? |
| 2170 | properties[i] = property |
| 2171 | } |
| 2172 | |
| 2173 | return ? |
| 2174 | } |
| 2175 | |
| 2176 | cmd VkResult vkGetGlobalExtensionProperties( |
| 2177 | const char* pLayerName, |
| 2178 | u32* pCount, |
| 2179 | VkExtensionProperties* pProperties) { |
| 2180 | count := as!u32(?) |
| 2181 | pCount[0] = count |
| 2182 | |
| 2183 | properties := pProperties[0:count] |
| 2184 | for i in (0 .. count) { |
| 2185 | property := ? |
| 2186 | properties[i] = property |
| 2187 | } |
| 2188 | |
| 2189 | return ? |
| 2190 | } |
| 2191 | |
| 2192 | cmd VkResult vkGetPhysicalDeviceLayerProperties( |
| 2193 | VkPhysicalDevice physicalDevice, |
| 2194 | u32* pCount, |
| 2195 | VkLayerProperties* pProperties) { |
| 2196 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2197 | count := as!u32(?) |
| 2198 | pCount[0] = count |
| 2199 | |
| 2200 | properties := pProperties[0:count] |
| 2201 | for i in (0 .. count) { |
| 2202 | property := ? |
| 2203 | properties[i] = property |
| 2204 | } |
| 2205 | |
| 2206 | return ? |
| 2207 | } |
| 2208 | |
| 2209 | cmd VkResult vkGetPhysicalDeviceExtensionProperties( |
| 2210 | VkPhysicalDevice physicalDevice, |
| 2211 | const char* pLayerName, |
| 2212 | u32* pCount, |
| 2213 | VkExtensionProperties* pProperties) { |
| 2214 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2215 | |
| 2216 | count := as!u32(?) |
| 2217 | pCount[0] = count |
| 2218 | |
| 2219 | properties := pProperties[0:count] |
| 2220 | for i in (0 .. count) { |
| 2221 | property := ? |
| 2222 | properties[i] = property |
| 2223 | } |
| 2224 | |
| 2225 | return ? |
| 2226 | } |
| 2227 | |
| 2228 | |
| 2229 | // Queue functions |
| 2230 | |
| 2231 | @threadSafety("system") |
| 2232 | cmd VkResult vkGetDeviceQueue( |
| 2233 | VkDevice device, |
| 2234 | u32 queueFamilyIndex, |
| 2235 | u32 queueIndex, |
| 2236 | VkQueue* pQueue) { |
| 2237 | deviceObject := GetDevice(device) |
| 2238 | |
| 2239 | queue := ? |
| 2240 | pQueue[0] = queue |
| 2241 | |
| 2242 | if !(queue in State.Queues) { |
| 2243 | State.Queues[queue] = new!QueueObject(device: device) |
| 2244 | } |
| 2245 | |
| 2246 | return ? |
| 2247 | } |
| 2248 | |
| 2249 | @threadSafety("app") |
| 2250 | cmd VkResult vkQueueSubmit( |
| 2251 | VkQueue queue, |
| 2252 | u32 cmdBufferCount, |
| 2253 | const VkCmdBuffer* pCmdBuffers, |
| 2254 | VkFence fence) { |
| 2255 | queueObject := GetQueue(queue) |
| 2256 | |
| 2257 | if fence != VK_NULL_HANDLE { |
| 2258 | fenceObject := GetFence(fence) |
| 2259 | assert(fenceObject.device == queueObject.device) |
| 2260 | } |
| 2261 | |
| 2262 | cmdBuffers := pCmdBuffers[0:cmdBufferCount] |
| 2263 | for i in (0 .. cmdBufferCount) { |
| 2264 | cmdBuffer := cmdBuffers[i] |
| 2265 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 2266 | assert(cmdBufferObject.device == queueObject.device) |
| 2267 | |
| 2268 | validate("QueueCheck", cmdBufferObject.queueFlags in queueObject.flags, |
| 2269 | "vkQueueSubmit: enqueued cmdBuffer requires missing queue capabilities.") |
| 2270 | } |
| 2271 | |
| 2272 | return ? |
| 2273 | } |
| 2274 | |
| 2275 | @threadSafety("system") |
| 2276 | cmd VkResult vkQueueWaitIdle( |
| 2277 | VkQueue queue) { |
| 2278 | queueObject := GetQueue(queue) |
| 2279 | |
| 2280 | return ? |
| 2281 | } |
| 2282 | |
| 2283 | @threadSafety("system") |
| 2284 | cmd VkResult vkDeviceWaitIdle( |
| 2285 | VkDevice device) { |
| 2286 | deviceObject := GetDevice(device) |
| 2287 | |
| 2288 | return ? |
| 2289 | } |
| 2290 | |
| 2291 | |
| 2292 | // Memory functions |
| 2293 | |
| 2294 | @threadSafety("system") |
| 2295 | cmd VkResult vkAllocMemory( |
| 2296 | VkDevice device, |
| 2297 | const VkMemoryAllocInfo* pAllocInfo, |
| 2298 | VkDeviceMemory* pMem) { |
| 2299 | assert(pAllocInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO) |
| 2300 | deviceObject := GetDevice(device) |
| 2301 | |
| 2302 | mem := ? |
| 2303 | pMem[0] = mem |
| 2304 | State.DeviceMemories[mem] = new!DeviceMemoryObject( |
| 2305 | device: device, |
| 2306 | allocationSize: pAllocInfo[0].allocationSize) |
| 2307 | |
| 2308 | return ? |
| 2309 | } |
| 2310 | |
| 2311 | @threadSafety("system") |
| 2312 | cmd VkResult vkFreeMemory( |
| 2313 | VkDevice device, |
| 2314 | VkDeviceMemory mem) { |
| 2315 | deviceObject := GetDevice(device) |
| 2316 | memObject := GetDeviceMemory(mem) |
| 2317 | assert(memObject.device == device) |
| 2318 | |
| 2319 | // Check that no objects are still bound before freeing. |
| 2320 | validate("MemoryCheck", len(memObject.boundObjects) == 0, |
| 2321 | "vkFreeMemory: objects still bound") |
| 2322 | validate("MemoryCheck", len(memObject.boundCommandBuffers) == 0, |
| 2323 | "vkFreeMemory: cmdBuffers still bound") |
| 2324 | State.DeviceMemories[mem] = null |
| 2325 | |
| 2326 | return ? |
| 2327 | } |
| 2328 | |
| 2329 | @threadSafety("app") |
| 2330 | cmd VkResult vkMapMemory( |
| 2331 | VkDevice device, |
| 2332 | VkDeviceMemory mem, |
| 2333 | platform.VkDeviceSize offset, |
| 2334 | platform.VkDeviceSize size, |
| 2335 | VkMemoryMapFlags flags, |
| 2336 | void** ppData) { |
| 2337 | deviceObject := GetDevice(device) |
| 2338 | memObject := GetDeviceMemory(mem) |
| 2339 | assert(memObject.device == device) |
| 2340 | |
| 2341 | assert(flags == as!VkMemoryMapFlags(0)) |
| 2342 | assert((offset + size) <= memObject.allocationSize) |
| 2343 | |
| 2344 | return ? |
| 2345 | } |
| 2346 | |
| 2347 | @threadSafety("app") |
| 2348 | cmd VkResult vkUnmapMemory( |
| 2349 | VkDevice device, |
| 2350 | VkDeviceMemory mem) { |
| 2351 | deviceObject := GetDevice(device) |
| 2352 | memObject := GetDeviceMemory(mem) |
| 2353 | assert(memObject.device == device) |
| 2354 | |
| 2355 | return ? |
| 2356 | } |
| 2357 | |
| 2358 | cmd VkResult vkFlushMappedMemoryRanges( |
| 2359 | VkDevice device, |
| 2360 | u32 memRangeCount |
| 2361 | const VkMappedMemoryRange* pMemRanges) { |
| 2362 | deviceObject := GetDevice(device) |
| 2363 | |
| 2364 | memRanges := pMemRanges[0:memRangeCount] |
| 2365 | for i in (0 .. memRangeCount) { |
| 2366 | memRange := memRanges[i] |
| 2367 | memObject := GetDeviceMemory(memRange.mem) |
| 2368 | assert(memObject.device == device) |
| 2369 | assert((memRange.offset + memRange.size) <= memObject.allocationSize) |
| 2370 | } |
| 2371 | |
| 2372 | return ? |
| 2373 | } |
| 2374 | |
| 2375 | cmd VkResult vkInvalidateMappedMemoryRanges( |
| 2376 | VkDevice device, |
| 2377 | u32 memRangeCount, |
| 2378 | const VkMappedMemoryRange* pMemRanges) { |
| 2379 | deviceObject := GetDevice(device) |
| 2380 | |
| 2381 | memRanges := pMemRanges[0:memRangeCount] |
| 2382 | for i in (0 .. memRangeCount) { |
| 2383 | memRange := memRanges[i] |
| 2384 | memObject := GetDeviceMemory(memRange.mem) |
| 2385 | assert(memObject.device == device) |
| 2386 | assert((memRange.offset + memRange.size) <= memObject.allocationSize) |
| 2387 | } |
| 2388 | |
| 2389 | return ? |
| 2390 | } |
| 2391 | |
| 2392 | |
| 2393 | // Memory management API functions |
| 2394 | |
| 2395 | cmd VkResult vkGetDeviceMemoryCommitment( |
| 2396 | VkDevice device, |
| 2397 | VkDeviceMemory memory, |
| 2398 | platform.VkDeviceSize* pCommittedMemoryInBytes) { |
| 2399 | deviceObject := GetDevice(device) |
| 2400 | |
| 2401 | if memory != VK_NULL_HANDLE { |
| 2402 | memoryObject := GetDeviceMemory(memory) |
| 2403 | assert(memoryObject.device == device) |
| 2404 | } |
| 2405 | |
| 2406 | committedMemoryInBytes := ? |
| 2407 | pCommittedMemoryInBytes[0] = committedMemoryInBytes |
| 2408 | |
| 2409 | return ? |
| 2410 | } |
| 2411 | |
| 2412 | cmd VkResult vkGetBufferMemoryRequirements( |
| 2413 | VkDevice device, |
| 2414 | VkBuffer buffer, |
| 2415 | VkMemoryRequirements* pMemoryRequirements) { |
| 2416 | deviceObject := GetDevice(device) |
| 2417 | bufferObject := GetBuffer(buffer) |
| 2418 | assert(bufferObject.device == device) |
| 2419 | |
| 2420 | return ? |
| 2421 | } |
| 2422 | |
| 2423 | cmd VkResult vkBindBufferMemory( |
| 2424 | VkDevice device, |
| 2425 | VkBuffer buffer, |
| 2426 | VkDeviceMemory mem, |
| 2427 | platform.VkDeviceSize memOffset) { |
| 2428 | deviceObject := GetDevice(device) |
| 2429 | bufferObject := GetBuffer(buffer) |
| 2430 | assert(bufferObject.device == device) |
| 2431 | |
| 2432 | // Unbind buffer from previous memory object, if not VK_NULL_HANDLE. |
| 2433 | if bufferObject.mem != VK_NULL_HANDLE { |
| 2434 | memObject := GetDeviceMemory(bufferObject.mem) |
| 2435 | memObject.boundObjects[as!u64(buffer)] = null |
| 2436 | } |
| 2437 | |
| 2438 | // Bind buffer to given memory object, if not VK_NULL_HANDLE. |
| 2439 | if mem != VK_NULL_HANDLE { |
| 2440 | memObject := GetDeviceMemory(mem) |
| 2441 | assert(memObject.device == device) |
| 2442 | memObject.boundObjects[as!u64(buffer)] = memOffset |
| 2443 | } |
| 2444 | bufferObject.mem = mem |
| 2445 | bufferObject.memOffset = memOffset |
| 2446 | |
| 2447 | return ? |
| 2448 | } |
| 2449 | |
| 2450 | cmd VkResult vkGetImageMemoryRequirements( |
| 2451 | VkDevice device, |
| 2452 | VkImage image, |
| 2453 | VkMemoryRequirements* pMemoryRequirements) { |
| 2454 | deviceObject := GetDevice(device) |
| 2455 | imageObject := GetImage(image) |
| 2456 | assert(imageObject.device == device) |
| 2457 | |
| 2458 | return ? |
| 2459 | } |
| 2460 | |
| 2461 | cmd VkResult vkBindImageMemory( |
| 2462 | VkDevice device, |
| 2463 | VkImage image, |
| 2464 | VkDeviceMemory mem, |
| 2465 | platform.VkDeviceSize memOffset) { |
| 2466 | deviceObject := GetDevice(device) |
| 2467 | imageObject := GetImage(image) |
| 2468 | assert(imageObject.device == device) |
| 2469 | |
| 2470 | // Unbind image from previous memory object, if not VK_NULL_HANDLE. |
| 2471 | if imageObject.mem != VK_NULL_HANDLE { |
| 2472 | memObject := GetDeviceMemory(imageObject.mem) |
| 2473 | memObject.boundObjects[as!u64(image)] = null |
| 2474 | } |
| 2475 | |
| 2476 | // Bind image to given memory object, if not VK_NULL_HANDLE. |
| 2477 | if mem != VK_NULL_HANDLE { |
| 2478 | memObject := GetDeviceMemory(mem) |
| 2479 | assert(memObject.device == device) |
| 2480 | memObject.boundObjects[as!u64(image)] = memOffset |
| 2481 | } |
| 2482 | imageObject.mem = mem |
| 2483 | imageObject.memOffset = memOffset |
| 2484 | |
| 2485 | return ? |
| 2486 | } |
| 2487 | |
| 2488 | cmd VkResult vkGetImageSparseMemoryRequirements( |
| 2489 | VkDevice device, |
| 2490 | VkImage image, |
| 2491 | u32* pNumRequirements, |
| 2492 | VkSparseImageMemoryRequirements* pSparseMemoryRequirements) { |
| 2493 | deviceObject := GetDevice(device) |
| 2494 | imageObject := GetImage(image) |
| 2495 | assert(imageObject.device == device) |
| 2496 | |
| 2497 | return ? |
| 2498 | } |
| 2499 | |
| 2500 | cmd VkResult vkGetPhysicalDeviceSparseImageFormatProperties( |
| 2501 | VkPhysicalDevice physicalDevice, |
| 2502 | VkFormat format, |
| 2503 | VkImageType type, |
| 2504 | u32 samples, |
| 2505 | VkImageUsageFlags usage, |
| 2506 | VkImageTiling tiling, |
| 2507 | u32* pNumProperties, |
| 2508 | VkSparseImageFormatProperties* pProperties) { |
| 2509 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2510 | |
| 2511 | return ? |
| 2512 | } |
| 2513 | |
| 2514 | cmd VkResult vkQueueBindSparseBufferMemory( |
| 2515 | VkQueue queue, |
| 2516 | VkBuffer buffer, |
| 2517 | u32 numBindings, |
| 2518 | const VkSparseMemoryBindInfo* pBindInfo) { |
| 2519 | queueObject := GetQueue(queue) |
| 2520 | bufferObject := GetBuffer(buffer) |
| 2521 | assert(bufferObject.device == queueObject.device) |
| 2522 | |
| 2523 | return ? |
| 2524 | } |
| 2525 | |
| 2526 | cmd VkResult vkQueueBindSparseImageOpaqueMemory( |
| 2527 | VkQueue queue, |
| 2528 | VkImage image, |
| 2529 | u32 numBindings, |
| 2530 | const VkSparseMemoryBindInfo* pBindInfo) { |
| 2531 | queueObject := GetQueue(queue) |
| 2532 | imageObject := GetImage(image) |
| 2533 | assert(imageObject.device == queueObject.device) |
| 2534 | |
| 2535 | return ? |
| 2536 | } |
| 2537 | |
| 2538 | |
| 2539 | cmd VkResult vkQueueBindSparseImageMemory( |
| 2540 | VkQueue queue, |
| 2541 | VkImage image, |
| 2542 | u32 numBindings, |
| 2543 | const VkSparseImageMemoryBindInfo* pBindInfo) { |
| 2544 | queueObject := GetQueue(queue) |
| 2545 | imageObject := GetImage(image) |
| 2546 | |
| 2547 | return ? |
| 2548 | } |
| 2549 | |
| 2550 | |
| 2551 | // Fence functions |
| 2552 | |
| 2553 | @threadSafety("system") |
| 2554 | cmd VkResult vkCreateFence( |
| 2555 | VkDevice device, |
| 2556 | const VkFenceCreateInfo* pCreateInfo, |
| 2557 | VkFence* pFence) { |
| 2558 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO) |
| 2559 | deviceObject := GetDevice(device) |
| 2560 | |
| 2561 | fence := ? |
| 2562 | pFence[0] = fence |
| 2563 | State.Fences[fence] = new!FenceObject( |
| 2564 | device: device, signaled: (pCreateInfo.flags == VK_FENCE_CREATE_SIGNALED_BIT)) |
| 2565 | |
| 2566 | return ? |
| 2567 | } |
| 2568 | |
| 2569 | @threadSafety("system") |
| 2570 | cmd VkResult vkDestroyFence( |
| 2571 | VkDevice device, |
| 2572 | VkFence fence) { |
| 2573 | deviceObject := GetDevice(device) |
| 2574 | fenceObject := GetFence(fence) |
| 2575 | assert(fenceObject.device == device) |
| 2576 | |
| 2577 | State.Fences[fence] = null |
| 2578 | |
| 2579 | return ? |
| 2580 | } |
| 2581 | |
| 2582 | @threadSafety("system") |
| 2583 | cmd VkResult vkResetFences( |
| 2584 | VkDevice device, |
| 2585 | u32 fenceCount, |
| 2586 | const VkFence* pFences) { |
| 2587 | deviceObject := GetDevice(device) |
| 2588 | |
| 2589 | fences := pFences[0:fenceCount] |
| 2590 | for i in (0 .. fenceCount) { |
| 2591 | fence := fences[i] |
| 2592 | fenceObject := GetFence(fence) |
| 2593 | assert(fenceObject.device == device) |
| 2594 | fenceObject.signaled = false |
| 2595 | } |
| 2596 | |
| 2597 | return ? |
| 2598 | } |
| 2599 | |
| 2600 | @threadSafety("system") |
| 2601 | cmd VkResult vkGetFenceStatus( |
| 2602 | VkDevice device, |
| 2603 | VkFence fence) { |
| 2604 | deviceObject := GetDevice(device) |
| 2605 | fenceObject := GetFence(fence) |
| 2606 | assert(fenceObject.device == device) |
| 2607 | |
| 2608 | return ? |
| 2609 | } |
| 2610 | |
| 2611 | @threadSafety("system") |
| 2612 | cmd VkResult vkWaitForFences( |
| 2613 | VkDevice device, |
| 2614 | u32 fenceCount, |
| 2615 | const VkFence* pFences, |
| 2616 | platform.VkBool32 waitAll, |
| 2617 | u64 timeout) { /// timeout in nanoseconds |
| 2618 | deviceObject := GetDevice(device) |
| 2619 | |
| 2620 | fences := pFences[0:fenceCount] |
| 2621 | for i in (0 .. fenceCount) { |
| 2622 | fence := fences[i] |
| 2623 | fenceObject := GetFence(fence) |
| 2624 | assert(fenceObject.device == device) |
| 2625 | } |
| 2626 | |
| 2627 | return ? |
| 2628 | } |
| 2629 | |
| 2630 | |
| 2631 | // Queue semaphore functions |
| 2632 | |
| 2633 | @threadSafety("system") |
| 2634 | cmd VkResult vkCreateSemaphore( |
| 2635 | VkDevice device, |
| 2636 | const VkSemaphoreCreateInfo* pCreateInfo, |
| 2637 | VkSemaphore* pSemaphore) { |
| 2638 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO) |
| 2639 | deviceObject := GetDevice(device) |
| 2640 | |
| 2641 | semaphore := ? |
| 2642 | pSemaphore[0] = semaphore |
| 2643 | State.Semaphores[semaphore] = new!SemaphoreObject(device: device) |
| 2644 | |
| 2645 | return ? |
| 2646 | } |
| 2647 | |
| 2648 | @threadSafety("system") |
| 2649 | cmd VkResult vkDestroySemaphore( |
| 2650 | VkDevice device, |
| 2651 | VkSemaphore semaphore) { |
| 2652 | deviceObject := GetDevice(device) |
| 2653 | semaphoreObject := GetSemaphore(semaphore) |
| 2654 | assert(semaphoreObject.device == device) |
| 2655 | |
| 2656 | State.Semaphores[semaphore] = null |
| 2657 | |
| 2658 | return ? |
| 2659 | } |
| 2660 | |
| 2661 | @threadSafety("app") |
| 2662 | cmd VkResult vkQueueSignalSemaphore( |
| 2663 | VkQueue queue, |
| 2664 | VkSemaphore semaphore) { |
| 2665 | queueObject := GetQueue(queue) |
| 2666 | semaphoreObject := GetSemaphore(semaphore) |
| 2667 | assert(queueObject.device == semaphoreObject.device) |
| 2668 | |
| 2669 | return ? |
| 2670 | } |
| 2671 | |
| 2672 | @threadSafety("system") |
| 2673 | cmd VkResult vkQueueWaitSemaphore( |
| 2674 | VkQueue queue, |
| 2675 | VkSemaphore semaphore) { |
| 2676 | queueObject := GetQueue(queue) |
| 2677 | semaphoreObject := GetSemaphore(semaphore) |
| 2678 | assert(queueObject.device == semaphoreObject.device) |
| 2679 | |
| 2680 | return ? |
| 2681 | } |
| 2682 | |
| 2683 | |
| 2684 | // Event functions |
| 2685 | |
| 2686 | @threadSafety("system") |
| 2687 | cmd VkResult vkCreateEvent( |
| 2688 | VkDevice device, |
| 2689 | const VkEventCreateInfo* pCreateInfo, |
| 2690 | VkEvent* pEvent) { |
| 2691 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO) |
| 2692 | deviceObject := GetDevice(device) |
| 2693 | |
| 2694 | event := ? |
| 2695 | pEvent[0] = event |
| 2696 | State.Events[event] = new!EventObject(device: device) |
| 2697 | |
| 2698 | return ? |
| 2699 | } |
| 2700 | |
| 2701 | @threadSafety("system") |
| 2702 | cmd VkResult vkDestroyEvent( |
| 2703 | VkDevice device, |
| 2704 | VkEvent event) { |
| 2705 | deviceObject := GetDevice(device) |
| 2706 | eventObject := GetEvent(event) |
| 2707 | assert(eventObject.device == device) |
| 2708 | |
| 2709 | State.Events[event] = null |
| 2710 | |
| 2711 | return ? |
| 2712 | } |
| 2713 | |
| 2714 | @threadSafety("system") |
| 2715 | cmd VkResult vkGetEventStatus( |
| 2716 | VkDevice device, |
| 2717 | VkEvent event) { |
| 2718 | deviceObject := GetDevice(device) |
| 2719 | eventObject := GetEvent(event) |
| 2720 | assert(eventObject.device == device) |
| 2721 | |
| 2722 | return ? |
| 2723 | } |
| 2724 | |
| 2725 | @threadSafety("system") |
| 2726 | cmd VkResult vkSetEvent( |
| 2727 | VkDevice device, |
| 2728 | VkEvent event) { |
| 2729 | deviceObject := GetDevice(device) |
| 2730 | eventObject := GetEvent(event) |
| 2731 | assert(eventObject.device == device) |
| 2732 | |
| 2733 | return ? |
| 2734 | } |
| 2735 | |
| 2736 | @threadSafety("system") |
| 2737 | cmd VkResult vkResetEvent( |
| 2738 | VkDevice device, |
| 2739 | VkEvent event) { |
| 2740 | deviceObject := GetDevice(device) |
| 2741 | eventObject := GetEvent(event) |
| 2742 | assert(eventObject.device == device) |
| 2743 | |
| 2744 | return ? |
| 2745 | } |
| 2746 | |
| 2747 | |
| 2748 | // Query functions |
| 2749 | |
| 2750 | @threadSafety("system") |
| 2751 | cmd VkResult vkCreateQueryPool( |
| 2752 | VkDevice device, |
| 2753 | const VkQueryPoolCreateInfo* pCreateInfo, |
| 2754 | VkQueryPool* pQueryPool) { |
| 2755 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO) |
| 2756 | deviceObject := GetDevice(device) |
| 2757 | |
| 2758 | queryPool := ? |
| 2759 | pQueryPool[0] = queryPool |
| 2760 | State.QueryPools[queryPool] = new!QueryPoolObject(device: device) |
| 2761 | |
| 2762 | return ? |
| 2763 | } |
| 2764 | |
| 2765 | @threadSafety("system") |
| 2766 | cmd VkResult vkDestroyQueryPool( |
| 2767 | VkDevice device, |
| 2768 | VkQueryPool queryPool) { |
| 2769 | deviceObject := GetDevice(device) |
| 2770 | queryPoolObject := GetQueryPool(queryPool) |
| 2771 | assert(queryPoolObject.device == device) |
| 2772 | |
| 2773 | State.QueryPools[queryPool] = null |
| 2774 | |
| 2775 | return ? |
| 2776 | } |
| 2777 | |
| 2778 | @threadSafety("system") |
| 2779 | cmd VkResult vkGetQueryPoolResults( |
| 2780 | VkDevice device, |
| 2781 | VkQueryPool queryPool, |
| 2782 | u32 startQuery, |
| 2783 | u32 queryCount, |
| 2784 | platform.size_t* pDataSize, |
| 2785 | void* pData, |
| 2786 | VkQueryResultFlags flags) { |
| 2787 | deviceObject := GetDevice(device) |
| 2788 | queryPoolObject := GetQueryPool(queryPool) |
| 2789 | assert(queryPoolObject.device == device) |
| 2790 | |
| 2791 | dataSize := ? |
| 2792 | pDataSize[0] = dataSize |
| 2793 | data := pData[0:dataSize] |
| 2794 | |
| 2795 | return ? |
| 2796 | } |
| 2797 | |
| 2798 | // Buffer functions |
| 2799 | |
| 2800 | @threadSafety("system") |
| 2801 | cmd VkResult vkCreateBuffer( |
| 2802 | VkDevice device, |
| 2803 | const VkBufferCreateInfo* pCreateInfo, |
| 2804 | VkBuffer* pBuffer) { |
| 2805 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO) |
| 2806 | deviceObject := GetDevice(device) |
| 2807 | |
| 2808 | buffer := ? |
| 2809 | pBuffer[0] = buffer |
| 2810 | State.Buffers[buffer] = new!BufferObject(device: device) |
| 2811 | |
| 2812 | return ? |
| 2813 | } |
| 2814 | |
| 2815 | @threadSafety("system") |
| 2816 | cmd VkResult vkDestroyBuffer( |
| 2817 | VkDevice device, |
| 2818 | VkBuffer buffer) { |
| 2819 | deviceObject := GetDevice(device) |
| 2820 | bufferObject := GetBuffer(buffer) |
| 2821 | assert(bufferObject.device == device) |
| 2822 | |
| 2823 | assert(bufferObject.mem == 0) |
| 2824 | State.Buffers[buffer] = null |
| 2825 | |
| 2826 | return ? |
| 2827 | } |
| 2828 | |
| 2829 | |
| 2830 | // Buffer view functions |
| 2831 | |
| 2832 | @threadSafety("system") |
| 2833 | cmd VkResult vkCreateBufferView( |
| 2834 | VkDevice device, |
| 2835 | const VkBufferViewCreateInfo* pCreateInfo, |
| 2836 | VkBufferView* pView) { |
| 2837 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO) |
| 2838 | deviceObject := GetDevice(device) |
| 2839 | |
| 2840 | bufferObject := GetBuffer(pCreateInfo.buffer) |
| 2841 | assert(bufferObject.device == device) |
| 2842 | |
| 2843 | view := ? |
| 2844 | pView[0] = view |
| 2845 | State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer) |
| 2846 | |
| 2847 | return ? |
| 2848 | } |
| 2849 | |
| 2850 | @threadSafety("system") |
| 2851 | cmd VkResult vkDestroyBufferView( |
| 2852 | VkDevice device, |
| 2853 | VkBufferView bufferView) { |
| 2854 | deviceObject := GetDevice(device) |
| 2855 | bufferViewObject := GetBufferView(bufferView) |
| 2856 | assert(bufferViewObject.device == device) |
| 2857 | |
| 2858 | State.BufferViews[bufferView] = null |
| 2859 | |
| 2860 | return ? |
| 2861 | } |
| 2862 | |
| 2863 | |
| 2864 | // Image functions |
| 2865 | |
| 2866 | @threadSafety("system") |
| 2867 | cmd VkResult vkCreateImage( |
| 2868 | VkDevice device, |
| 2869 | const VkImageCreateInfo* pCreateInfo, |
| 2870 | VkImage* pImage) { |
| 2871 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO) |
| 2872 | deviceObject := GetDevice(device) |
| 2873 | |
| 2874 | image := ? |
| 2875 | pImage[0] = image |
| 2876 | State.Images[image] = new!ImageObject(device: device) |
| 2877 | |
| 2878 | return ? |
| 2879 | } |
| 2880 | |
| 2881 | @threadSafety("system") |
| 2882 | cmd VkResult vkDestroyImage( |
| 2883 | VkDevice device, |
| 2884 | VkImage image) { |
| 2885 | deviceObject := GetDevice(device) |
| 2886 | imageObject := GetImage(image) |
| 2887 | assert(imageObject.device == device) |
| 2888 | |
| 2889 | assert(imageObject.mem == 0) |
| 2890 | State.Images[image] = null |
| 2891 | |
| 2892 | return ? |
| 2893 | } |
| 2894 | |
| 2895 | cmd VkResult vkGetImageSubresourceLayout( |
| 2896 | VkDevice device, |
| 2897 | VkImage image, |
| 2898 | const VkImageSubresource* pSubresource, |
| 2899 | VkSubresourceLayout* pLayout) { |
| 2900 | deviceObject := GetDevice(device) |
| 2901 | imageObject := GetImage(image) |
| 2902 | assert(imageObject.device == device) |
| 2903 | |
| 2904 | return ? |
| 2905 | } |
| 2906 | |
| 2907 | |
| 2908 | // Image view functions |
| 2909 | |
| 2910 | @threadSafety("system") |
| 2911 | cmd VkResult vkCreateImageView( |
| 2912 | VkDevice device, |
| 2913 | const VkImageViewCreateInfo* pCreateInfo, |
| 2914 | VkImageView* pView) { |
| 2915 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO) |
| 2916 | deviceObject := GetDevice(device) |
| 2917 | |
| 2918 | imageObject := GetImage(pCreateInfo.image) |
| 2919 | assert(imageObject.device == device) |
| 2920 | |
| 2921 | view := ? |
| 2922 | pView[0] = view |
| 2923 | State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image) |
| 2924 | |
| 2925 | return ? |
| 2926 | } |
| 2927 | |
| 2928 | @threadSafety("system") |
| 2929 | cmd VkResult vkDestroyImageView( |
| 2930 | VkDevice device, |
| 2931 | VkImageView imageView) { |
| 2932 | deviceObject := GetDevice(device) |
| 2933 | imageViewObject := GetImageView(imageView) |
| 2934 | assert(imageViewObject.device == device) |
| 2935 | |
| 2936 | State.ImageViews[imageView] = null |
| 2937 | |
| 2938 | return ? |
| 2939 | } |
| 2940 | |
| 2941 | @threadSafety("system") |
| 2942 | cmd VkResult vkCreateAttachmentView( |
| 2943 | VkDevice device, |
| 2944 | const VkAttachmentViewCreateInfo* pCreateInfo, |
| 2945 | VkAttachmentView* pView) { |
| 2946 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO) |
| 2947 | deviceObject := GetDevice(device) |
| 2948 | |
| 2949 | imageObject := GetImage(pCreateInfo.image) |
| 2950 | assert(imageObject.device == device) |
| 2951 | |
| 2952 | view := ? |
| 2953 | pView[0] = view |
| 2954 | State.AttachmentViews[view] = new!AttachmentViewObject(device: device, image: pCreateInfo.image) |
| 2955 | |
| 2956 | return ? |
| 2957 | } |
| 2958 | |
| 2959 | @threadSafety("system") |
| 2960 | cmd VkResult vkDestroyAttachmentView( |
| 2961 | VkDevice device, |
| 2962 | VkAttachmentView attachmentView) { |
| 2963 | deviceObject := GetDevice(device) |
| 2964 | attachmentViewObject := GetAttachmentView(attachmentView) |
| 2965 | assert(attachmentViewObject.device == device) |
| 2966 | |
| 2967 | State.AttachmentViews[attachmentView] = null |
| 2968 | |
| 2969 | return ? |
| 2970 | } |
| 2971 | |
| 2972 | |
| 2973 | // Shader functions |
| 2974 | |
| 2975 | cmd VkResult vkCreateShaderModule( |
| 2976 | VkDevice device, |
| 2977 | const VkShaderModuleCreateInfo* pCreateInfo, |
| 2978 | VkShaderModule* pShaderModule) { |
| 2979 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO) |
| 2980 | deviceObject := GetDevice(device) |
| 2981 | |
| 2982 | shaderModule := ? |
| 2983 | pShaderModule[0] = shaderModule |
| 2984 | State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device) |
| 2985 | |
| 2986 | return ? |
| 2987 | } |
| 2988 | |
| 2989 | cmd VkResult vkDestroyShaderModule( |
| 2990 | VkDevice device, |
| 2991 | VkShaderModule shaderModule) { |
| 2992 | deviceObject := GetDevice(device) |
| 2993 | shaderModuleObject := GetShaderModule(shaderModule) |
| 2994 | assert(shaderModuleObject.device == device) |
| 2995 | |
| 2996 | State.ShaderModules[shaderModule] = null |
| 2997 | |
| 2998 | return ? |
| 2999 | } |
| 3000 | |
| 3001 | @threadSafety("system") |
| 3002 | cmd VkResult vkCreateShader( |
| 3003 | VkDevice device, |
| 3004 | const VkShaderCreateInfo* pCreateInfo, |
| 3005 | VkShader* pShader) { |
| 3006 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO) |
| 3007 | deviceObject := GetDevice(device) |
| 3008 | |
| 3009 | shader := ? |
| 3010 | pShader[0] = shader |
| 3011 | State.Shaders[shader] = new!ShaderObject(device: device) |
| 3012 | |
| 3013 | return ? |
| 3014 | } |
| 3015 | |
| 3016 | @threadSafety("system") |
| 3017 | cmd VkResult vkDestroyShader( |
| 3018 | VkDevice device, |
| 3019 | VkShader shader) { |
| 3020 | deviceObject := GetDevice(device) |
| 3021 | shaderObject := GetShader(shader) |
| 3022 | assert(shaderObject.device == device) |
| 3023 | |
| 3024 | State.Shaders[shader] = null |
| 3025 | |
| 3026 | return ? |
| 3027 | } |
| 3028 | |
| 3029 | |
| 3030 | // Pipeline functions |
| 3031 | |
| 3032 | cmd VkResult vkCreatePipelineCache( |
| 3033 | VkDevice device, |
| 3034 | const VkPipelineCacheCreateInfo* pCreateInfo, |
| 3035 | VkPipelineCache* pPipelineCache) { |
| 3036 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO) |
| 3037 | deviceObject := GetDevice(device) |
| 3038 | |
| 3039 | pipelineCache := ? |
| 3040 | pPipelineCache[0] = pipelineCache |
| 3041 | State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device) |
| 3042 | |
| 3043 | return ? |
| 3044 | } |
| 3045 | |
| 3046 | cmd VkResult vkDestroyPipelineCache( |
| 3047 | VkDevice device, |
| 3048 | VkPipelineCache pipelineCache) { |
| 3049 | deviceObject := GetDevice(device) |
| 3050 | pipelineCacheObject := GetPipelineCache(pipelineCache) |
| 3051 | assert(pipelineCacheObject.device == device) |
| 3052 | |
| 3053 | State.PipelineCaches[pipelineCache] = null |
| 3054 | |
| 3055 | return ? |
| 3056 | } |
| 3057 | |
| 3058 | cmd platform.size_t vkGetPipelineCacheSize( |
| 3059 | VkDevice device, |
| 3060 | VkPipelineCache pipelineCache) { |
| 3061 | deviceObject := GetDevice(device) |
| 3062 | pipelineCacheObject := GetPipelineCache(pipelineCache) |
| 3063 | assert(pipelineCacheObject.device == device) |
| 3064 | |
| 3065 | return ? |
| 3066 | } |
| 3067 | |
| 3068 | cmd VkResult vkGetPipelineCacheData( |
| 3069 | VkDevice device, |
| 3070 | VkPipelineCache pipelineCache, |
| 3071 | void* pData) { |
| 3072 | deviceObject := GetDevice(device) |
| 3073 | pipelineCacheObject := GetPipelineCache(pipelineCache) |
| 3074 | assert(pipelineCacheObject.device == device) |
| 3075 | |
| 3076 | return ? |
| 3077 | } |
| 3078 | |
| 3079 | cmd VkResult vkMergePipelineCaches( |
| 3080 | VkDevice device, |
| 3081 | VkPipelineCache destCache, |
| 3082 | u32 srcCacheCount, |
| 3083 | const VkPipelineCache* pSrcCaches) { |
| 3084 | deviceObject := GetDevice(device) |
| 3085 | destCacheObject := GetPipelineCache(destCache) |
| 3086 | assert(destCacheObject.device == device) |
| 3087 | |
| 3088 | srcCaches := pSrcCaches[0:srcCacheCount] |
| 3089 | for i in (0 .. srcCacheCount) { |
| 3090 | srcCache := srcCaches[i] |
| 3091 | srcCacheObject := GetPipelineCache(srcCache) |
| 3092 | assert(srcCacheObject.device == device) |
| 3093 | } |
| 3094 | |
| 3095 | return ? |
| 3096 | } |
| 3097 | |
| 3098 | cmd VkResult vkCreateGraphicsPipelines( |
| 3099 | VkDevice device, |
| 3100 | VkPipelineCache pipelineCache, |
| 3101 | u32 count, |
| 3102 | const VkGraphicsPipelineCreateInfo* pCreateInfos, |
| 3103 | VkPipeline* pPipelines) { |
| 3104 | deviceObject := GetDevice(device) |
| 3105 | if pipelineCache != VK_NULL_HANDLE { |
| 3106 | pipelineCacheObject := GetPipelineCache(pipelineCache) |
| 3107 | assert(pipelineCacheObject.device == device) |
| 3108 | } |
| 3109 | |
| 3110 | createInfos := pCreateInfos[0:count] |
| 3111 | pipelines := pPipelines[0:count] |
| 3112 | for i in (0 .. count) { |
| 3113 | pipeline := ? |
| 3114 | pipelines[i] = pipeline |
| 3115 | State.Pipelines[pipeline] = new!PipelineObject(device: device) |
| 3116 | } |
| 3117 | |
| 3118 | return ? |
| 3119 | } |
| 3120 | |
| 3121 | cmd VkResult vkCreateComputePipelines( |
| 3122 | VkDevice device, |
| 3123 | VkPipelineCache pipelineCache, |
| 3124 | u32 count, |
| 3125 | const VkComputePipelineCreateInfo* pCreateInfos, |
| 3126 | VkPipeline* pPipelines) { |
| 3127 | deviceObject := GetDevice(device) |
| 3128 | if pipelineCache != VK_NULL_HANDLE { |
| 3129 | pipelineCacheObject := GetPipelineCache(pipelineCache) |
| 3130 | assert(pipelineCacheObject.device == device) |
| 3131 | } |
| 3132 | |
| 3133 | createInfos := pCreateInfos[0:count] |
| 3134 | pipelines := pPipelines[0:count] |
| 3135 | for i in (0 .. count) { |
| 3136 | pipeline := ? |
| 3137 | pipelines[i] = pipeline |
| 3138 | State.Pipelines[pipeline] = new!PipelineObject(device: device) |
| 3139 | } |
| 3140 | |
| 3141 | return ? |
| 3142 | } |
| 3143 | |
| 3144 | @threadSafety("system") |
| 3145 | cmd VkResult vkDestroyPipeline( |
| 3146 | VkDevice device, |
| 3147 | VkPipeline pipeline) { |
| 3148 | deviceObject := GetDevice(device) |
| 3149 | pipelineObjects := GetPipeline(pipeline) |
| 3150 | assert(pipelineObjects.device == device) |
| 3151 | |
| 3152 | State.Pipelines[pipeline] = null |
| 3153 | |
| 3154 | return ? |
| 3155 | } |
| 3156 | |
| 3157 | |
| 3158 | // Pipeline layout functions |
| 3159 | |
| 3160 | @threadSafety("system") |
| 3161 | cmd VkResult vkCreatePipelineLayout( |
| 3162 | VkDevice device, |
| 3163 | const VkPipelineLayoutCreateInfo* pCreateInfo, |
| 3164 | VkPipelineLayout* pPipelineLayout) { |
| 3165 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO) |
| 3166 | deviceObject := GetDevice(device) |
| 3167 | |
| 3168 | pipelineLayout := ? |
| 3169 | pPipelineLayout[0] = pipelineLayout |
| 3170 | State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device) |
| 3171 | |
| 3172 | return ? |
| 3173 | } |
| 3174 | |
| 3175 | @threadSafety("system") |
| 3176 | cmd VkResult vkDestroyPipelineLayout( |
| 3177 | VkDevice device, |
| 3178 | VkPipelineLayout pipelineLayout) { |
| 3179 | deviceObject := GetDevice(device) |
| 3180 | pipelineLayoutObjects := GetPipelineLayout(pipelineLayout) |
| 3181 | assert(pipelineLayoutObjects.device == device) |
| 3182 | |
| 3183 | State.PipelineLayouts[pipelineLayout] = null |
| 3184 | |
| 3185 | return ? |
| 3186 | } |
| 3187 | |
| 3188 | |
| 3189 | // Sampler functions |
| 3190 | |
| 3191 | @threadSafety("system") |
| 3192 | cmd VkResult vkCreateSampler( |
| 3193 | VkDevice device, |
| 3194 | const VkSamplerCreateInfo* pCreateInfo, |
| 3195 | VkSampler* pSampler) { |
| 3196 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO) |
| 3197 | deviceObject := GetDevice(device) |
| 3198 | |
| 3199 | sampler := ? |
| 3200 | pSampler[0] = sampler |
| 3201 | State.Samplers[sampler] = new!SamplerObject(device: device) |
| 3202 | |
| 3203 | return ? |
| 3204 | } |
| 3205 | |
| 3206 | @threadSafety("system") |
| 3207 | cmd VkResult vkDestroySampler( |
| 3208 | VkDevice device, |
| 3209 | VkSampler sampler) { |
| 3210 | deviceObject := GetDevice(device) |
| 3211 | samplerObject := GetSampler(sampler) |
| 3212 | assert(samplerObject.device == device) |
| 3213 | |
| 3214 | State.Samplers[sampler] = null |
| 3215 | |
| 3216 | return ? |
| 3217 | } |
| 3218 | |
| 3219 | |
| 3220 | // Descriptor set functions |
| 3221 | |
| 3222 | @threadSafety("system") |
| 3223 | cmd VkResult vkCreateDescriptorSetLayout( |
| 3224 | VkDevice device, |
| 3225 | const VkDescriptorSetLayoutCreateInfo* pCreateInfo, |
| 3226 | VkDescriptorSetLayout* pSetLayout) { |
| 3227 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO) |
| 3228 | deviceObject := GetDevice(device) |
| 3229 | |
| 3230 | setLayout := ? |
| 3231 | pSetLayout[0] = setLayout |
| 3232 | State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device) |
| 3233 | |
| 3234 | return ? |
| 3235 | } |
| 3236 | |
| 3237 | @threadSafety("system") |
| 3238 | cmd VkResult vkDestroyDescriptorSetLayout( |
| 3239 | VkDevice device, |
| 3240 | VkDescriptorSetLayout descriptorSetLayout) { |
| 3241 | deviceObject := GetDevice(device) |
| 3242 | descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout) |
| 3243 | assert(descriptorSetLayoutObject.device == device) |
| 3244 | |
| 3245 | State.DescriptorSetLayouts[descriptorSetLayout] = null |
| 3246 | |
| 3247 | return ? |
| 3248 | } |
| 3249 | |
| 3250 | @threadSafety("system") |
| 3251 | cmd VkResult vkCreateDescriptorPool( |
| 3252 | VkDevice device, |
| 3253 | VkDescriptorPoolUsage poolUsage, |
| 3254 | u32 maxSets, |
| 3255 | const VkDescriptorPoolCreateInfo* pCreateInfo, |
| 3256 | VkDescriptorPool* pDescriptorPool) { |
| 3257 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO) |
| 3258 | deviceObject := GetDevice(device) |
| 3259 | |
| 3260 | descriptorPool := ? |
| 3261 | pDescriptorPool[0] = descriptorPool |
| 3262 | State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device) |
| 3263 | |
| 3264 | return ? |
| 3265 | } |
| 3266 | |
| 3267 | @threadSafety("system") |
| 3268 | cmd VkResult vkDestroyDescriptorPool( |
| 3269 | VkDevice device, |
| 3270 | VkDescriptorPool descriptorPool) { |
| 3271 | deviceObject := GetDevice(device) |
| 3272 | descriptorPoolObject := GetDescriptorPool(descriptorPool) |
| 3273 | assert(descriptorPoolObject.device == device) |
| 3274 | |
| 3275 | State.DescriptorPools[descriptorPool] = null |
| 3276 | |
| 3277 | return ? |
| 3278 | } |
| 3279 | |
| 3280 | @threadSafety("app") |
| 3281 | cmd VkResult vkResetDescriptorPool( |
| 3282 | VkDevice device, |
| 3283 | VkDescriptorPool descriptorPool) { |
| 3284 | deviceObject := GetDevice(device) |
| 3285 | descriptorPoolObject := GetDescriptorPool(descriptorPool) |
| 3286 | assert(descriptorPoolObject.device == device) |
| 3287 | |
| 3288 | return ? |
| 3289 | } |
| 3290 | |
| 3291 | @threadSafety("app") |
| 3292 | cmd VkResult vkAllocDescriptorSets( |
| 3293 | VkDevice device, |
| 3294 | VkDescriptorPool descriptorPool, |
| 3295 | VkDescriptorSetUsage setUsage, |
| 3296 | u32 count, |
| 3297 | const VkDescriptorSetLayout* pSetLayouts, |
| 3298 | VkDescriptorSet* pDescriptorSets, |
| 3299 | u32* pCount) { |
| 3300 | deviceObject := GetDevice(device) |
| 3301 | descriptorPoolObject := GetDescriptorPool(descriptorPool) |
| 3302 | |
| 3303 | setLayouts := pSetLayouts[0:count] |
| 3304 | for i in (0 .. count) { |
| 3305 | setLayout := setLayouts[i] |
| 3306 | setLayoutObject := GetDescriptorSetLayout(setLayout) |
| 3307 | assert(setLayoutObject.device == device) |
| 3308 | } |
| 3309 | |
| 3310 | setsCount := as!u32(?) |
| 3311 | pCount[0] = setsCount |
| 3312 | descriptorSets := pDescriptorSets[0:setsCount] |
| 3313 | for i in (0 .. setsCount) { |
| 3314 | descriptorSet := ? |
| 3315 | descriptorSets[i] = descriptorSet |
| 3316 | State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device) |
| 3317 | } |
| 3318 | |
| 3319 | return ? |
| 3320 | } |
| 3321 | |
Jesse Hall | f09c6b1 | 2015-08-15 19:54:28 -0700 | [diff] [blame^] | 3322 | cmd VkResult vkFreeDescriptorSets( |
| 3323 | VkDevice device, |
| 3324 | VkDescriptorPool descriptorPool, |
| 3325 | u32 count, |
| 3326 | const VkDescriptorSet* pDescriptorSets) { |
| 3327 | deviceObject := GetDevice(device) |
| 3328 | descriptorPoolObject := GetDescriptorPool(descriptorPool) |
| 3329 | |
| 3330 | descriptorSets := pDescriptorSets[0:count] |
| 3331 | for i in (0 .. count) { |
| 3332 | descriptorSet := descriptorSets[i] |
| 3333 | descriptorSetObject := GetDescriptorSet(descriptorSet) |
| 3334 | assert(descriptorSetObject.device == device) |
| 3335 | State.DescriptorSets[descriptorSet] = null |
| 3336 | } |
| 3337 | |
| 3338 | return ? |
| 3339 | } |
| 3340 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3341 | cmd VkResult vkUpdateDescriptorSets( |
| 3342 | VkDevice device, |
| 3343 | u32 writeCount, |
| 3344 | const VkWriteDescriptorSet* pDescriptorWrites, |
| 3345 | u32 copyCount, |
| 3346 | const VkCopyDescriptorSet* pDescriptorCopies) { |
| 3347 | deviceObject := GetDevice(device) |
| 3348 | |
| 3349 | descriptorWrites := pDescriptorWrites[0:writeCount] |
| 3350 | for i in (0 .. writeCount) { |
| 3351 | descriptorWrite := descriptorWrites[i] |
| 3352 | descriptorWriteObject := GetDescriptorSet(descriptorWrite.destSet) |
| 3353 | assert(descriptorWriteObject.device == device) |
| 3354 | } |
| 3355 | |
| 3356 | descriptorCopies := pDescriptorCopies[0:copyCount] |
| 3357 | for i in (0 .. copyCount) { |
| 3358 | descriptorCopy := descriptorCopies[i] |
| 3359 | descriptorCopyObject := GetDescriptorSet(descriptorCopy.destSet) |
| 3360 | assert(descriptorCopyObject.device == device) |
| 3361 | } |
| 3362 | |
| 3363 | return ? |
| 3364 | } |
| 3365 | |
| 3366 | |
| 3367 | // State object functions |
| 3368 | |
| 3369 | @threadSafety("system") |
| 3370 | cmd VkResult vkCreateDynamicViewportState( |
| 3371 | VkDevice device, |
| 3372 | const VkDynamicViewportStateCreateInfo* pCreateInfo, |
| 3373 | VkDynamicViewportState* pState) { |
| 3374 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DYNAMIC_VIEWPORT_STATE_CREATE_INFO) |
| 3375 | deviceObject := GetDevice(device) |
| 3376 | |
| 3377 | state := ? |
| 3378 | pState[0] = state |
| 3379 | State.DynamicViewportStates[state] = new!DynamicViewportStateObject(device: device) |
| 3380 | |
| 3381 | return ? |
| 3382 | } |
| 3383 | |
| 3384 | @threadSafety("system") |
| 3385 | cmd VkResult vkDestroyDynamicViewportState( |
| 3386 | VkDevice device, |
| 3387 | VkDynamicViewportState dynamicViewportState) { |
| 3388 | deviceObject := GetDevice(device) |
| 3389 | dynamicViewportStateObject := GetDynamicViewportState(dynamicViewportState) |
| 3390 | assert(dynamicViewportStateObject.device == device) |
| 3391 | |
| 3392 | State.DynamicViewportStates[dynamicViewportState] = null |
| 3393 | |
| 3394 | return ? |
| 3395 | } |
| 3396 | |
| 3397 | @threadSafety("system") |
| 3398 | cmd VkResult vkCreateDynamicRasterState( |
| 3399 | VkDevice device, |
| 3400 | const VkDynamicRasterStateCreateInfo* pCreateInfo, |
| 3401 | VkDynamicRasterState* pState) { |
| 3402 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DYNAMIC_RASTER_STATE_CREATE_INFO) |
| 3403 | deviceObject := GetDevice(device) |
| 3404 | |
| 3405 | state := ? |
| 3406 | pState[0] = state |
| 3407 | State.DynamicRasterStates[state] = new!DynamicRasterStateObject(device: device) |
| 3408 | |
| 3409 | return ? |
| 3410 | } |
| 3411 | |
| 3412 | @threadSafety("system") |
| 3413 | cmd VkResult vkDestroyDynamicRasterState( |
| 3414 | VkDevice device, |
| 3415 | VkDynamicRasterState dynamicRasterState) { |
| 3416 | deviceObject := GetDevice(device) |
| 3417 | dynamicRasterStateObject := GetDynamicRasterState(dynamicRasterState) |
| 3418 | assert(dynamicRasterStateObject.device == device) |
| 3419 | |
| 3420 | State.DynamicRasterStates[dynamicRasterState] = null |
| 3421 | |
| 3422 | return ? |
| 3423 | } |
| 3424 | |
| 3425 | @threadSafety("system") |
| 3426 | cmd VkResult vkCreateDynamicColorBlendState( |
| 3427 | VkDevice device, |
| 3428 | const VkDynamicColorBlendStateCreateInfo* pCreateInfo, |
| 3429 | VkDynamicColorBlendState* pState) { |
| 3430 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DYNAMIC_COLOR_BLEND_STATE_CREATE_INFO) |
| 3431 | deviceObject := GetDevice(device) |
| 3432 | |
| 3433 | state := ? |
| 3434 | pState[0] = state |
| 3435 | State.DynamicColorBlendStates[state] = new!DynamicColorBlendStateObject(device: device) |
| 3436 | |
| 3437 | return ? |
| 3438 | } |
| 3439 | |
| 3440 | @threadSafety("system") |
| 3441 | cmd VkResult vkDestroyDynamicColorBlendState( |
| 3442 | VkDevice device, |
| 3443 | VkDynamicColorBlendState dynamicColorBlendState) { |
| 3444 | deviceObject := GetDevice(device) |
| 3445 | dynamicColorBlendStateObject := GetDynamicColorBlendState(dynamicColorBlendState) |
| 3446 | assert(dynamicColorBlendStateObject.device == device) |
| 3447 | |
| 3448 | State.DynamicColorBlendStates[dynamicColorBlendState] = null |
| 3449 | |
| 3450 | return ? |
| 3451 | } |
| 3452 | |
| 3453 | @threadSafety("system") |
| 3454 | cmd VkResult vkCreateDynamicDepthStencilState( |
| 3455 | VkDevice device, |
| 3456 | const VkDynamicDepthStencilStateCreateInfo* pCreateInfo, |
| 3457 | VkDynamicDepthStencilState* pState) { |
| 3458 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STENCIL_STATE_CREATE_INFO) |
| 3459 | deviceObject := GetDevice(device) |
| 3460 | |
| 3461 | state := ? |
| 3462 | pState[0] = state |
| 3463 | State.DynamicDepthStencilStates[state] = new!DynamicDepthStencilStateObject(device: device) |
| 3464 | |
| 3465 | return ? |
| 3466 | } |
| 3467 | |
| 3468 | @threadSafety("system") |
| 3469 | cmd VkResult vkDestroyDynamicDepthStencilState( |
| 3470 | VkDevice device, |
| 3471 | VkDynamicDepthStencilState dynamicDepthStencilState) { |
| 3472 | deviceObject := GetDevice(device) |
| 3473 | dynamicDepthStencilStateObject := GetDynamicDepthStencilState(dynamicDepthStencilState) |
| 3474 | assert(dynamicDepthStencilStateObject.device == device) |
| 3475 | |
| 3476 | State.DynamicDepthStencilStates[dynamicDepthStencilState] = null |
| 3477 | |
| 3478 | return ? |
| 3479 | } |
| 3480 | |
| 3481 | |
| 3482 | // Framebuffer functions |
| 3483 | |
| 3484 | @threadSafety("system") |
| 3485 | cmd VkResult vkCreateFramebuffer( |
| 3486 | VkDevice device, |
| 3487 | const VkFramebufferCreateInfo* pCreateInfo, |
| 3488 | VkFramebuffer* pFramebuffer) { |
| 3489 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO) |
| 3490 | deviceObject := GetDevice(device) |
| 3491 | |
| 3492 | framebuffer := ? |
| 3493 | pFramebuffer[0] = framebuffer |
| 3494 | State.Framebuffers[framebuffer] = new!FramebufferObject(device: device) |
| 3495 | |
| 3496 | return ? |
| 3497 | } |
| 3498 | |
| 3499 | @threadSafety("system") |
| 3500 | cmd VkResult vkDestroyFramebuffer( |
| 3501 | VkDevice device, |
| 3502 | VkFramebuffer framebuffer) { |
| 3503 | deviceObject := GetDevice(device) |
| 3504 | framebufferObject := GetFramebuffer(framebuffer) |
| 3505 | assert(framebufferObject.device == device) |
| 3506 | |
| 3507 | State.Framebuffers[framebuffer] = null |
| 3508 | |
| 3509 | return ? |
| 3510 | } |
| 3511 | |
| 3512 | |
| 3513 | // Renderpass functions |
| 3514 | |
| 3515 | @threadSafety("system") |
| 3516 | cmd VkResult vkCreateRenderPass( |
| 3517 | VkDevice device, |
| 3518 | const VkRenderPassCreateInfo* pCreateInfo, |
| 3519 | VkRenderPass* pRenderPass) { |
| 3520 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO) |
| 3521 | deviceObject := GetDevice(device) |
| 3522 | |
| 3523 | renderpass := ? |
| 3524 | pRenderPass[0] = renderpass |
| 3525 | State.RenderPasses[renderpass] = new!RenderPassObject(device: device) |
| 3526 | |
| 3527 | return ? |
| 3528 | } |
| 3529 | |
| 3530 | @threadSafety("system") |
| 3531 | cmd VkResult vkDestroyRenderPass( |
| 3532 | VkDevice device, |
| 3533 | VkRenderPass renderPass) { |
| 3534 | deviceObject := GetDevice(device) |
| 3535 | renderPassObject := GetRenderPass(renderPass) |
| 3536 | assert(renderPassObject.device == device) |
| 3537 | |
| 3538 | State.RenderPasses[renderPass] = null |
| 3539 | |
| 3540 | return ? |
| 3541 | } |
| 3542 | |
| 3543 | cmd VkResult vkGetRenderAreaGranularity( |
| 3544 | VkDevice device, |
| 3545 | VkRenderPass renderPass, |
| 3546 | VkExtent2D* pGranularity) { |
| 3547 | deviceObject := GetDevice(device) |
| 3548 | renderPassObject := GetRenderPass(renderPass) |
| 3549 | |
| 3550 | granularity := ? |
| 3551 | pGranularity[0] = granularity |
| 3552 | |
| 3553 | return ? |
| 3554 | } |
| 3555 | |
| 3556 | // Command pool functions |
| 3557 | |
| 3558 | cmd VkResult vkCreateCommandPool( |
| 3559 | VkDevice device, |
| 3560 | const VkCmdPoolCreateInfo* pCreateInfo, |
| 3561 | VkCmdPool* pCmdPool) { |
| 3562 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO) |
| 3563 | deviceObject := GetDevice(device) |
| 3564 | |
| 3565 | cmdPool := ? |
| 3566 | pCmdPool[0] = cmdPool |
| 3567 | State.CmdPools[cmdPool] = new!CmdPoolObject(device: device) |
| 3568 | |
| 3569 | return ? |
| 3570 | } |
| 3571 | |
| 3572 | cmd VkResult vkDestroyCommandPool( |
| 3573 | VkDevice device, |
| 3574 | VkCmdPool cmdPool) { |
| 3575 | deviceObject := GetDevice(device) |
| 3576 | cmdPoolObject := GetCmdPool(cmdPool) |
| 3577 | assert(cmdPoolObject.device == device) |
| 3578 | |
| 3579 | State.CmdPools[cmdPool] = null |
| 3580 | |
| 3581 | return ? |
| 3582 | } |
| 3583 | |
| 3584 | cmd VkResult vkResetCommandPool( |
| 3585 | VkDevice device, |
| 3586 | VkCmdPool cmdPool, |
| 3587 | VkCmdPoolResetFlags flags) { |
| 3588 | deviceObject := GetDevice(device) |
| 3589 | cmdPoolObject := GetCmdPool(cmdPool) |
| 3590 | assert(cmdPoolObject.device == device) |
| 3591 | |
| 3592 | return ? |
| 3593 | } |
| 3594 | |
| 3595 | // Command buffer functions |
| 3596 | |
| 3597 | macro void bindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) { |
| 3598 | memoryObject := GetDeviceMemory(mem) |
| 3599 | memoryObject.boundCommandBuffers[cmdBuffer] = cmdBuffer |
| 3600 | |
| 3601 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3602 | cmdBufferObject.boundObjects[as!u64(obj)] = mem |
| 3603 | } |
| 3604 | |
| 3605 | macro void unbindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) { |
| 3606 | memoryObject := GetDeviceMemory(mem) |
| 3607 | memoryObject.boundCommandBuffers[cmdBuffer] = null |
| 3608 | |
| 3609 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3610 | cmdBufferObject.boundObjects[as!u64(obj)] = null |
| 3611 | } |
| 3612 | |
| 3613 | @threadSafety("system") |
| 3614 | cmd VkResult vkCreateCommandBuffer( |
| 3615 | VkDevice device, |
| 3616 | const VkCmdBufferCreateInfo* pCreateInfo, |
| 3617 | VkCmdBuffer* pCmdBuffer) { |
| 3618 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO) |
| 3619 | |
| 3620 | cmdBuffer := ? |
| 3621 | pCmdBuffer[0] = cmdBuffer |
| 3622 | State.CmdBuffers[cmdBuffer] = new!CmdBufferObject(device: device) |
| 3623 | |
| 3624 | return ? |
| 3625 | } |
| 3626 | |
| 3627 | @threadSafety("system") |
| 3628 | cmd VkResult vkDestroyCommandBuffer( |
| 3629 | VkDevice device, |
| 3630 | VkCmdBuffer commandBuffer) { |
| 3631 | deviceObject := GetDevice(device) |
| 3632 | cmdBufferObject := GetCmdBuffer(commandBuffer) |
| 3633 | assert(cmdBufferObject.device == device) |
| 3634 | |
| 3635 | // TODO: iterate over boundObjects and clear memory bindings |
| 3636 | State.CmdBuffers[commandBuffer] = null |
| 3637 | |
| 3638 | return ? |
| 3639 | } |
| 3640 | |
| 3641 | @threadSafety("app") |
| 3642 | cmd VkResult vkBeginCommandBuffer( |
| 3643 | VkCmdBuffer cmdBuffer, |
| 3644 | const VkCmdBufferBeginInfo* pBeginInfo) { |
| 3645 | assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO) |
| 3646 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3647 | |
| 3648 | // TODO: iterate over boundObjects and clear memory bindings |
| 3649 | |
| 3650 | return ? |
| 3651 | } |
| 3652 | |
| 3653 | @threadSafety("app") |
| 3654 | cmd VkResult vkEndCommandBuffer( |
| 3655 | VkCmdBuffer cmdBuffer) { |
| 3656 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3657 | |
| 3658 | return ? |
| 3659 | } |
| 3660 | |
| 3661 | @threadSafety("app") |
| 3662 | cmd VkResult vkResetCommandBuffer( |
| 3663 | VkCmdBuffer cmdBuffer, |
| 3664 | VkCmdBufferResetFlags flags) { |
| 3665 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3666 | |
| 3667 | // TODO: iterate over boundObjects and clear memory bindings |
| 3668 | |
| 3669 | return ? |
| 3670 | } |
| 3671 | |
| 3672 | |
| 3673 | // Command buffer building functions |
| 3674 | |
| 3675 | @threadSafety("app") |
| 3676 | cmd void vkCmdBindPipeline( |
| 3677 | VkCmdBuffer cmdBuffer, |
| 3678 | VkPipelineBindPoint pipelineBindPoint, |
| 3679 | VkPipeline pipeline) { |
| 3680 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3681 | pipelineObject := GetPipeline(pipeline) |
| 3682 | assert(cmdBufferObject.device == pipelineObject.device) |
| 3683 | |
| 3684 | queueFlags := cmdBufferObject.queueFlags | switch (pipelineBindPoint) { |
| 3685 | case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT |
| 3686 | case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT |
| 3687 | } |
| 3688 | cmdBufferObject.queueFlags = queueFlags |
| 3689 | } |
| 3690 | |
| 3691 | @threadSafety("app") |
| 3692 | cmd void vkCmdBindDynamicViewportState( |
| 3693 | VkCmdBuffer cmdBuffer, |
| 3694 | VkDynamicViewportState dynamicViewportState) { |
| 3695 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3696 | dynamicViewportStateObject := GetDynamicViewportState(dynamicViewportState) |
| 3697 | assert(cmdBufferObject.device == dynamicViewportStateObject.device) |
| 3698 | |
| 3699 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3700 | cmdBufferObject.queueFlags = queueFlags |
| 3701 | } |
| 3702 | |
| 3703 | @threadSafety("app") |
| 3704 | cmd void vkCmdBindDynamicRasterState( |
| 3705 | VkCmdBuffer cmdBuffer, |
| 3706 | VkDynamicRasterState dynamicRasterState) { |
| 3707 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3708 | dynamicRasterStateObject := GetDynamicRasterState(dynamicRasterState) |
| 3709 | assert(cmdBufferObject.device == dynamicRasterStateObject.device) |
| 3710 | |
| 3711 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3712 | cmdBufferObject.queueFlags = queueFlags |
| 3713 | } |
| 3714 | |
| 3715 | @threadSafety("app") |
| 3716 | cmd void vkCmdBindDynamicColorBlendState( |
| 3717 | VkCmdBuffer cmdBuffer, |
| 3718 | VkDynamicColorBlendState dynamicColorBlendState) { |
| 3719 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3720 | dynamicColorBlendStateObject := GetDynamicColorBlendState(dynamicColorBlendState) |
| 3721 | assert(cmdBufferObject.device == dynamicColorBlendStateObject.device) |
| 3722 | |
| 3723 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3724 | cmdBufferObject.queueFlags = queueFlags |
| 3725 | } |
| 3726 | |
| 3727 | @threadSafety("app") |
| 3728 | cmd void vkCmdBindDynamicDepthStencilState( |
| 3729 | VkCmdBuffer cmdBuffer, |
| 3730 | VkDynamicDepthStencilState dynamicDepthStencilState) { |
| 3731 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3732 | dynamicDepthStencilStateObject := GetDynamicDepthStencilState(dynamicDepthStencilState) |
| 3733 | assert(cmdBufferObject.device == dynamicDepthStencilStateObject.device) |
| 3734 | |
| 3735 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3736 | cmdBufferObject.queueFlags = queueFlags |
| 3737 | } |
| 3738 | |
| 3739 | @threadSafety("app") |
| 3740 | cmd void vkCmdBindDescriptorSets( |
| 3741 | VkCmdBuffer cmdBuffer, |
| 3742 | VkPipelineBindPoint pipelineBindPoint, |
| 3743 | VkPipelineLayout layout, |
| 3744 | u32 firstSet, |
| 3745 | u32 setCount, |
| 3746 | const VkDescriptorSet* pDescriptorSets, |
| 3747 | u32 dynamicOffsetCount, |
| 3748 | const u32* pDynamicOffsets) { |
| 3749 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3750 | |
| 3751 | descriptorSets := pDescriptorSets[0:setCount] |
| 3752 | for i in (0 .. setCount) { |
| 3753 | descriptorSet := descriptorSets[i] |
| 3754 | descriptorSetObject := GetDescriptorSet(descriptorSet) |
| 3755 | assert(cmdBufferObject.device == descriptorSetObject.device) |
| 3756 | } |
| 3757 | |
| 3758 | dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount] |
| 3759 | for i in (0 .. dynamicOffsetCount) { |
| 3760 | dynamicOffset := dynamicOffsets[i] |
| 3761 | } |
| 3762 | |
| 3763 | queueFlags := cmdBufferObject.queueFlags | switch (pipelineBindPoint) { |
| 3764 | case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT |
| 3765 | case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT |
| 3766 | } |
| 3767 | cmdBufferObject.queueFlags = queueFlags |
| 3768 | } |
| 3769 | |
| 3770 | @threadSafety("app") |
| 3771 | cmd void vkCmdBindIndexBuffer( |
| 3772 | VkCmdBuffer cmdBuffer, |
| 3773 | VkBuffer buffer, |
| 3774 | platform.VkDeviceSize offset, |
| 3775 | VkIndexType indexType) { |
| 3776 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3777 | bufferObject := GetBuffer(buffer) |
| 3778 | assert(cmdBufferObject.device == bufferObject.device) |
| 3779 | |
| 3780 | bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem) |
| 3781 | |
| 3782 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3783 | cmdBufferObject.queueFlags = queueFlags |
| 3784 | } |
| 3785 | |
| 3786 | @threadSafety("app") |
| 3787 | cmd void vkCmdBindVertexBuffers( |
| 3788 | VkCmdBuffer cmdBuffer, |
| 3789 | u32 startBinding, |
| 3790 | u32 bindingCount, |
| 3791 | const VkBuffer* pBuffers, |
| 3792 | const platform.VkDeviceSize* pOffsets) { |
| 3793 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3794 | |
| 3795 | // TODO: check if not [startBinding:startBinding+bindingCount] |
| 3796 | buffers := pBuffers[0:bindingCount] |
| 3797 | offsets := pOffsets[0:bindingCount] |
| 3798 | for i in (0 .. bindingCount) { |
| 3799 | buffer := buffers[i] |
| 3800 | offset := offsets[i] |
| 3801 | bufferObject := GetBuffer(buffer) |
| 3802 | assert(cmdBufferObject.device == bufferObject.device) |
| 3803 | |
| 3804 | bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem) |
| 3805 | } |
| 3806 | |
| 3807 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3808 | cmdBufferObject.queueFlags = queueFlags |
| 3809 | } |
| 3810 | |
| 3811 | @threadSafety("app") |
| 3812 | cmd void vkCmdDraw( |
| 3813 | VkCmdBuffer cmdBuffer, |
| 3814 | u32 firstVertex, |
| 3815 | u32 vertexCount, |
| 3816 | u32 firstInstance, |
| 3817 | u32 instanceCount) { |
| 3818 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3819 | |
| 3820 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3821 | cmdBufferObject.queueFlags = queueFlags |
| 3822 | } |
| 3823 | |
| 3824 | @threadSafety("app") |
| 3825 | cmd void vkCmdDrawIndexed( |
| 3826 | VkCmdBuffer cmdBuffer, |
| 3827 | u32 firstIndex, |
| 3828 | u32 indexCount, |
| 3829 | s32 vertexOffset, |
| 3830 | u32 firstInstance, |
| 3831 | u32 instanceCount) { |
| 3832 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3833 | |
| 3834 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3835 | cmdBufferObject.queueFlags = queueFlags |
| 3836 | } |
| 3837 | |
| 3838 | @threadSafety("app") |
| 3839 | cmd void vkCmdDrawIndirect( |
| 3840 | VkCmdBuffer cmdBuffer, |
| 3841 | VkBuffer buffer, |
| 3842 | platform.VkDeviceSize offset, |
| 3843 | u32 count, |
| 3844 | u32 stride) { |
| 3845 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3846 | bufferObject := GetBuffer(buffer) |
| 3847 | assert(cmdBufferObject.device == bufferObject.device) |
| 3848 | |
| 3849 | bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem) |
| 3850 | |
| 3851 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3852 | cmdBufferObject.queueFlags = queueFlags |
| 3853 | } |
| 3854 | |
| 3855 | @threadSafety("app") |
| 3856 | cmd void vkCmdDrawIndexedIndirect( |
| 3857 | VkCmdBuffer cmdBuffer, |
| 3858 | VkBuffer buffer, |
| 3859 | platform.VkDeviceSize offset, |
| 3860 | u32 count, |
| 3861 | u32 stride) { |
| 3862 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3863 | bufferObject := GetBuffer(buffer) |
| 3864 | assert(cmdBufferObject.device == bufferObject.device) |
| 3865 | |
| 3866 | bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem) |
| 3867 | |
| 3868 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3869 | cmdBufferObject.queueFlags = queueFlags |
| 3870 | } |
| 3871 | |
| 3872 | @threadSafety("app") |
| 3873 | cmd void vkCmdDispatch( |
| 3874 | VkCmdBuffer cmdBuffer, |
| 3875 | u32 x, |
| 3876 | u32 y, |
| 3877 | u32 z) { |
| 3878 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3879 | |
| 3880 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_COMPUTE_BIT |
| 3881 | cmdBufferObject.queueFlags = queueFlags |
| 3882 | } |
| 3883 | |
| 3884 | @threadSafety("app") |
| 3885 | cmd void vkCmdDispatchIndirect( |
| 3886 | VkCmdBuffer cmdBuffer, |
| 3887 | VkBuffer buffer, |
| 3888 | platform.VkDeviceSize offset) { |
| 3889 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3890 | bufferObject := GetBuffer(buffer) |
| 3891 | assert(cmdBufferObject.device == bufferObject.device) |
| 3892 | |
| 3893 | bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem) |
| 3894 | |
| 3895 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_COMPUTE_BIT |
| 3896 | cmdBufferObject.queueFlags = queueFlags |
| 3897 | } |
| 3898 | |
| 3899 | @threadSafety("app") |
| 3900 | cmd void vkCmdCopyBuffer( |
| 3901 | VkCmdBuffer cmdBuffer, |
| 3902 | VkBuffer srcBuffer, |
| 3903 | VkBuffer destBuffer, |
| 3904 | u32 regionCount, |
| 3905 | const VkBufferCopy* pRegions) { |
| 3906 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3907 | srcBufferObject := GetBuffer(srcBuffer) |
| 3908 | destBufferObject := GetBuffer(destBuffer) |
| 3909 | assert(cmdBufferObject.device == srcBufferObject.device) |
| 3910 | assert(cmdBufferObject.device == destBufferObject.device) |
| 3911 | |
| 3912 | regions := pRegions[0:regionCount] |
| 3913 | for i in (0 .. regionCount) { |
| 3914 | region := regions[i] |
| 3915 | } |
| 3916 | |
| 3917 | bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem) |
| 3918 | bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem) |
| 3919 | |
| 3920 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 3921 | cmdBufferObject.queueFlags = queueFlags |
| 3922 | } |
| 3923 | |
| 3924 | @threadSafety("app") |
| 3925 | cmd void vkCmdCopyImage( |
| 3926 | VkCmdBuffer cmdBuffer, |
| 3927 | VkImage srcImage, |
| 3928 | VkImageLayout srcImageLayout, |
| 3929 | VkImage destImage, |
| 3930 | VkImageLayout destImageLayout, |
| 3931 | u32 regionCount, |
| 3932 | const VkImageCopy* pRegions) { |
| 3933 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3934 | srcImageObject := GetImage(srcImage) |
| 3935 | destImageObject := GetImage(destImage) |
| 3936 | assert(cmdBufferObject.device == srcImageObject.device) |
| 3937 | assert(cmdBufferObject.device == destImageObject.device) |
| 3938 | |
| 3939 | regions := pRegions[0:regionCount] |
| 3940 | for i in (0 .. regionCount) { |
| 3941 | region := regions[i] |
| 3942 | } |
| 3943 | |
| 3944 | bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem) |
| 3945 | bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem) |
| 3946 | |
| 3947 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 3948 | cmdBufferObject.queueFlags = queueFlags |
| 3949 | } |
| 3950 | |
| 3951 | @threadSafety("app") |
| 3952 | cmd void vkCmdBlitImage( |
| 3953 | VkCmdBuffer cmdBuffer, |
| 3954 | VkImage srcImage, |
| 3955 | VkImageLayout srcImageLayout, |
| 3956 | VkImage destImage, |
| 3957 | VkImageLayout destImageLayout, |
| 3958 | u32 regionCount, |
| 3959 | const VkImageBlit* pRegions, |
| 3960 | VkTexFilter filter) { |
| 3961 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3962 | srcImageObject := GetImage(srcImage) |
| 3963 | destImageObject := GetImage(destImage) |
| 3964 | assert(cmdBufferObject.device == srcImageObject.device) |
| 3965 | assert(cmdBufferObject.device == destImageObject.device) |
| 3966 | |
| 3967 | regions := pRegions[0:regionCount] |
| 3968 | for i in (0 .. regionCount) { |
| 3969 | region := regions[i] |
| 3970 | } |
| 3971 | |
| 3972 | bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem) |
| 3973 | bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem) |
| 3974 | |
| 3975 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3976 | cmdBufferObject.queueFlags = queueFlags |
| 3977 | } |
| 3978 | |
| 3979 | @threadSafety("app") |
| 3980 | cmd void vkCmdCopyBufferToImage( |
| 3981 | VkCmdBuffer cmdBuffer, |
| 3982 | VkBuffer srcBuffer, |
| 3983 | VkImage destImage, |
| 3984 | VkImageLayout destImageLayout, |
| 3985 | u32 regionCount, |
| 3986 | const VkBufferImageCopy* pRegions) { |
| 3987 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3988 | srcBufferObject := GetBuffer(srcBuffer) |
| 3989 | destImageObject := GetImage(destImage) |
| 3990 | assert(cmdBufferObject.device == srcBufferObject.device) |
| 3991 | assert(cmdBufferObject.device == destImageObject.device) |
| 3992 | |
| 3993 | regions := pRegions[0:regionCount] |
| 3994 | for i in (0 .. regionCount) { |
| 3995 | region := regions[i] |
| 3996 | } |
| 3997 | |
| 3998 | bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem) |
| 3999 | bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem) |
| 4000 | |
| 4001 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 4002 | cmdBufferObject.queueFlags = queueFlags |
| 4003 | } |
| 4004 | |
| 4005 | @threadSafety("app") |
| 4006 | cmd void vkCmdCopyImageToBuffer( |
| 4007 | VkCmdBuffer cmdBuffer, |
| 4008 | VkImage srcImage, |
| 4009 | VkImageLayout srcImageLayout, |
| 4010 | VkBuffer destBuffer, |
| 4011 | u32 regionCount, |
| 4012 | const VkBufferImageCopy* pRegions) { |
| 4013 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4014 | srcImageObject := GetImage(srcImage) |
| 4015 | destBufferObject := GetBuffer(destBuffer) |
| 4016 | assert(cmdBufferObject.device == srcImageObject.device) |
| 4017 | assert(cmdBufferObject.device == destBufferObject.device) |
| 4018 | |
| 4019 | regions := pRegions[0:regionCount] |
| 4020 | for i in (0 .. regionCount) { |
| 4021 | region := regions[i] |
| 4022 | } |
| 4023 | |
| 4024 | bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem) |
| 4025 | bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem) |
| 4026 | |
| 4027 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 4028 | cmdBufferObject.queueFlags = queueFlags |
| 4029 | } |
| 4030 | |
| 4031 | @threadSafety("app") |
| 4032 | cmd void vkCmdUpdateBuffer( |
| 4033 | VkCmdBuffer cmdBuffer, |
| 4034 | VkBuffer destBuffer, |
| 4035 | platform.VkDeviceSize destOffset, |
| 4036 | platform.VkDeviceSize dataSize, |
| 4037 | const u32* pData) { |
| 4038 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4039 | destBufferObject := GetBuffer(destBuffer) |
| 4040 | assert(cmdBufferObject.device == destBufferObject.device) |
| 4041 | |
| 4042 | data := pData[0:dataSize] |
| 4043 | |
| 4044 | bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem) |
| 4045 | |
| 4046 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 4047 | cmdBufferObject.queueFlags = queueFlags |
| 4048 | } |
| 4049 | |
| 4050 | @threadSafety("app") |
| 4051 | cmd void vkCmdFillBuffer( |
| 4052 | VkCmdBuffer cmdBuffer, |
| 4053 | VkBuffer destBuffer, |
| 4054 | platform.VkDeviceSize destOffset, |
| 4055 | platform.VkDeviceSize fillSize, |
| 4056 | u32 data) { |
| 4057 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4058 | destBufferObject := GetBuffer(destBuffer) |
| 4059 | assert(cmdBufferObject.device == destBufferObject.device) |
| 4060 | |
| 4061 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 4062 | cmdBufferObject.queueFlags = queueFlags |
| 4063 | } |
| 4064 | |
| 4065 | @threadSafety("app") |
| 4066 | cmd void vkCmdClearColorImage( |
| 4067 | VkCmdBuffer cmdBuffer, |
| 4068 | VkImage image, |
| 4069 | VkImageLayout imageLayout, |
| 4070 | const VkClearColorValue* pColor, |
| 4071 | u32 rangeCount, |
| 4072 | const VkImageSubresourceRange* pRanges) { |
| 4073 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4074 | imageObject := GetImage(image) |
| 4075 | assert(cmdBufferObject.device == imageObject.device) |
| 4076 | |
| 4077 | ranges := pRanges[0:rangeCount] |
| 4078 | for i in (0 .. rangeCount) { |
| 4079 | range := ranges[i] |
| 4080 | } |
| 4081 | |
| 4082 | bindCmdBuffer(cmdBuffer, image, imageObject.mem) |
| 4083 | |
| 4084 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4085 | cmdBufferObject.queueFlags = queueFlags |
| 4086 | } |
| 4087 | |
| 4088 | @threadSafety("app") |
| 4089 | cmd void vkCmdClearDepthStencilImage( |
| 4090 | VkCmdBuffer cmdBuffer, |
| 4091 | VkImage image, |
| 4092 | VkImageLayout imageLayout, |
| 4093 | f32 depth, |
| 4094 | u32 stencil, |
| 4095 | u32 rangeCount, |
| 4096 | const VkImageSubresourceRange* pRanges) { |
| 4097 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4098 | imageObject := GetImage(image) |
| 4099 | assert(cmdBufferObject.device == imageObject.device) |
| 4100 | |
| 4101 | ranges := pRanges[0:rangeCount] |
| 4102 | for i in (0 .. rangeCount) { |
| 4103 | range := ranges[i] |
| 4104 | } |
| 4105 | |
| 4106 | bindCmdBuffer(cmdBuffer, image, imageObject.mem) |
| 4107 | |
| 4108 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4109 | cmdBufferObject.queueFlags = queueFlags |
| 4110 | } |
| 4111 | |
| 4112 | @threadSafety("app") |
| 4113 | cmd void vkCmdClearColorAttachment( |
| 4114 | VkCmdBuffer cmdBuffer, |
| 4115 | u32 colorAttachment, |
| 4116 | VkImageLayout imageLayout, |
| 4117 | const VkClearColorValue* pColor, |
| 4118 | u32 rectCount, |
| 4119 | const VkRect3D* pRects) { |
| 4120 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4121 | |
| 4122 | rects := pRects[0:rectCount] |
| 4123 | for i in (0 .. rectCount) { |
| 4124 | rect := rects[i] |
| 4125 | } |
| 4126 | |
| 4127 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4128 | cmdBufferObject.queueFlags = queueFlags |
| 4129 | } |
| 4130 | |
| 4131 | @threadSafety("app") |
| 4132 | cmd void vkCmdClearDepthStencilAttachment( |
| 4133 | VkCmdBuffer cmdBuffer, |
| 4134 | VkImageAspectFlags imageAspectMask, |
| 4135 | VkImageLayout imageLayout, |
| 4136 | f32 depth, |
| 4137 | u32 stencil, |
| 4138 | u32 rectCount, |
| 4139 | const VkRect3D* pRects) { |
| 4140 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4141 | |
| 4142 | rects := pRects[0:rectCount] |
| 4143 | for i in (0 .. rectCount) { |
| 4144 | rect := rects[i] |
| 4145 | } |
| 4146 | |
| 4147 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4148 | cmdBufferObject.queueFlags = queueFlags |
| 4149 | } |
| 4150 | |
| 4151 | @threadSafety("app") |
| 4152 | cmd void vkCmdResolveImage( |
| 4153 | VkCmdBuffer cmdBuffer, |
| 4154 | VkImage srcImage, |
| 4155 | VkImageLayout srcImageLayout, |
| 4156 | VkImage destImage, |
| 4157 | VkImageLayout destImageLayout, |
| 4158 | u32 regionCount, |
| 4159 | const VkImageResolve* pRegions) { |
| 4160 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4161 | srcImageObject := GetImage(srcImage) |
| 4162 | destImageObject := GetImage(destImage) |
| 4163 | assert(cmdBufferObject.device == srcImageObject.device) |
| 4164 | assert(cmdBufferObject.device == destImageObject.device) |
| 4165 | |
| 4166 | regions := pRegions[0:regionCount] |
| 4167 | for i in (0 .. regionCount) { |
| 4168 | region := regions[i] |
| 4169 | } |
| 4170 | |
| 4171 | bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem) |
| 4172 | bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem) |
| 4173 | |
| 4174 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4175 | cmdBufferObject.queueFlags = queueFlags |
| 4176 | } |
| 4177 | |
| 4178 | @threadSafety("app") |
| 4179 | cmd void vkCmdSetEvent( |
| 4180 | VkCmdBuffer cmdBuffer, |
| 4181 | VkEvent event, |
| 4182 | VkPipelineStageFlags stageMask) { |
| 4183 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4184 | eventObject := GetEvent(event) |
| 4185 | assert(cmdBufferObject.device == eventObject.device) |
| 4186 | } |
| 4187 | |
| 4188 | @threadSafety("app") |
| 4189 | cmd void vkCmdResetEvent( |
| 4190 | VkCmdBuffer cmdBuffer, |
| 4191 | VkEvent event, |
| 4192 | VkPipelineStageFlags stageMask) { |
| 4193 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4194 | eventObject := GetEvent(event) |
| 4195 | assert(cmdBufferObject.device == eventObject.device) |
| 4196 | } |
| 4197 | |
| 4198 | @threadSafety("app") |
| 4199 | cmd void vkCmdWaitEvents( |
| 4200 | VkCmdBuffer cmdBuffer, |
| 4201 | u32 eventCount, |
| 4202 | const VkEvent* pEvents, |
| 4203 | VkPipelineStageFlags srcStageMask, |
| 4204 | VkPipelineStageFlags destStageMask, |
| 4205 | u32 memBarrierCount, |
| 4206 | const void* const* ppMemBarriers) { |
| 4207 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4208 | |
| 4209 | events := pEvents[0:eventCount] |
| 4210 | for i in (0 .. eventCount) { |
| 4211 | event := events[i] |
| 4212 | eventObject := GetEvent(event) |
| 4213 | assert(cmdBufferObject.device == eventObject.device) |
| 4214 | } |
| 4215 | |
| 4216 | pMemBarriers := ppMemBarriers[0:memBarrierCount] |
| 4217 | for i in (0 .. memBarrierCount) { |
| 4218 | switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType { |
| 4219 | case VK_STRUCTURE_TYPE_MEMORY_BARRIER: { |
| 4220 | memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0] |
| 4221 | } |
| 4222 | case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: { |
| 4223 | imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0] |
| 4224 | imageObject := GetImage(imageMemBarrier.image) |
| 4225 | assert(imageObject.device == cmdBufferObject.device) |
| 4226 | } |
| 4227 | case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: { |
| 4228 | bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0] |
| 4229 | bufferObject := GetBuffer(bufferMemBarrier.buffer) |
| 4230 | assert(bufferObject.device == cmdBufferObject.device) |
| 4231 | } |
| 4232 | } |
| 4233 | } |
| 4234 | } |
| 4235 | |
| 4236 | @threadSafety("app") |
| 4237 | cmd void vkCmdPipelineBarrier( |
| 4238 | VkCmdBuffer cmdBuffer, |
| 4239 | VkPipelineStageFlags srcStageMask, |
| 4240 | VkPipelineStageFlags destStageMask, |
| 4241 | platform.VkBool32 byRegion, |
| 4242 | u32 memBarrierCount, |
| 4243 | const void* const* ppMemBarriers) { |
| 4244 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4245 | |
| 4246 | pMemBarriers := ppMemBarriers[0:memBarrierCount] |
| 4247 | for i in (0 .. memBarrierCount) { |
| 4248 | switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType { |
| 4249 | case VK_STRUCTURE_TYPE_MEMORY_BARRIER: { |
| 4250 | memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0] |
| 4251 | } |
| 4252 | case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: { |
| 4253 | imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0] |
| 4254 | imageObject := GetImage(imageMemBarrier.image) |
| 4255 | assert(imageObject.device == cmdBufferObject.device) |
| 4256 | } |
| 4257 | case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: { |
| 4258 | bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0] |
| 4259 | bufferObject := GetBuffer(bufferMemBarrier.buffer) |
| 4260 | assert(bufferObject.device == cmdBufferObject.device) |
| 4261 | } |
| 4262 | } |
| 4263 | } |
| 4264 | } |
| 4265 | |
| 4266 | @threadSafety("app") |
| 4267 | cmd void vkCmdBeginQuery( |
| 4268 | VkCmdBuffer cmdBuffer, |
| 4269 | VkQueryPool queryPool, |
| 4270 | u32 slot, |
| 4271 | VkQueryControlFlags flags) { |
| 4272 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4273 | queryPoolObject := GetQueryPool(queryPool) |
| 4274 | assert(cmdBufferObject.device == queryPoolObject.device) |
| 4275 | } |
| 4276 | |
| 4277 | @threadSafety("app") |
| 4278 | cmd void vkCmdEndQuery( |
| 4279 | VkCmdBuffer cmdBuffer, |
| 4280 | VkQueryPool queryPool, |
| 4281 | u32 slot) { |
| 4282 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4283 | queryPoolObject := GetQueryPool(queryPool) |
| 4284 | assert(cmdBufferObject.device == queryPoolObject.device) |
| 4285 | } |
| 4286 | |
| 4287 | @threadSafety("app") |
| 4288 | cmd void vkCmdResetQueryPool( |
| 4289 | VkCmdBuffer cmdBuffer, |
| 4290 | VkQueryPool queryPool, |
| 4291 | u32 startQuery, |
| 4292 | u32 queryCount) { |
| 4293 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4294 | queryPoolObject := GetQueryPool(queryPool) |
| 4295 | assert(cmdBufferObject.device == queryPoolObject.device) |
| 4296 | } |
| 4297 | |
| 4298 | @threadSafety("app") |
| 4299 | cmd void vkCmdWriteTimestamp( |
| 4300 | VkCmdBuffer cmdBuffer, |
| 4301 | VkTimestampType timestampType, |
| 4302 | VkBuffer destBuffer, |
| 4303 | platform.VkDeviceSize destOffset) { |
| 4304 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4305 | destBufferObject := GetBuffer(destBuffer) |
| 4306 | assert(cmdBufferObject.device == destBufferObject.device) |
| 4307 | } |
| 4308 | |
| 4309 | @threadSafety("app") |
| 4310 | cmd void vkCmdCopyQueryPoolResults( |
| 4311 | VkCmdBuffer cmdBuffer, |
| 4312 | VkQueryPool queryPool, |
| 4313 | u32 startQuery, |
| 4314 | u32 queryCount, |
| 4315 | VkBuffer destBuffer, |
| 4316 | platform.VkDeviceSize destOffset, |
| 4317 | platform.VkDeviceSize destStride, |
| 4318 | VkQueryResultFlags flags) { |
| 4319 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4320 | queryPoolObject := GetQueryPool(queryPool) |
| 4321 | destBufferObject := GetBuffer(destBuffer) |
| 4322 | assert(cmdBufferObject.device == queryPoolObject.device) |
| 4323 | assert(cmdBufferObject.device == destBufferObject.device) |
| 4324 | } |
| 4325 | |
| 4326 | cmd void vkCmdPushConstants( |
| 4327 | VkCmdBuffer cmdBuffer, |
| 4328 | VkPipelineLayout layout, |
| 4329 | VkShaderStageFlags stageFlags, |
| 4330 | u32 start, |
| 4331 | u32 length, |
| 4332 | const void* values) { |
| 4333 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4334 | layoutObject := GetPipelineLayout(layout) |
| 4335 | assert(cmdBufferObject.device == layoutObject.device) |
| 4336 | } |
| 4337 | |
| 4338 | @threadSafety("app") |
| 4339 | cmd void vkCmdBeginRenderPass( |
| 4340 | VkCmdBuffer cmdBuffer, |
| 4341 | const VkRenderPassBeginInfo* pRenderPassBegin, |
| 4342 | VkRenderPassContents contents) { |
| 4343 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4344 | renderPassObject := GetRenderPass(pRenderPassBegin.renderPass) |
| 4345 | framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer) |
| 4346 | assert(cmdBufferObject.device == renderPassObject.device) |
| 4347 | assert(cmdBufferObject.device == framebufferObject.device) |
| 4348 | |
| 4349 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4350 | cmdBufferObject.queueFlags = queueFlags |
| 4351 | } |
| 4352 | |
| 4353 | cmd void vkCmdNextSubpass( |
| 4354 | VkCmdBuffer cmdBuffer, |
| 4355 | VkRenderPassContents contents) { |
| 4356 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4357 | } |
| 4358 | |
| 4359 | @threadSafety("app") |
| 4360 | cmd void vkCmdEndRenderPass( |
| 4361 | VkCmdBuffer cmdBuffer) { |
| 4362 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4363 | |
| 4364 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4365 | cmdBufferObject.queueFlags = queueFlags |
| 4366 | } |
| 4367 | |
| 4368 | cmd void vkCmdExecuteCommands( |
| 4369 | VkCmdBuffer cmdBuffer, |
| 4370 | u32 cmdBuffersCount, |
| 4371 | const VkCmdBuffer* pCmdBuffers) { |
| 4372 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4373 | |
| 4374 | cmdBuffers := pCmdBuffers[0:cmdBuffersCount] |
| 4375 | for i in (0 .. cmdBuffersCount) { |
| 4376 | secondaryCmdBuffer := cmdBuffers[i] |
| 4377 | secondaryCmdBufferObject := GetCmdBuffer(secondaryCmdBuffer) |
| 4378 | assert(cmdBufferObject.device == secondaryCmdBufferObject.device) |
| 4379 | } |
| 4380 | } |
| 4381 | |
| 4382 | |
| 4383 | //////////////// |
| 4384 | // Validation // |
| 4385 | //////////////// |
| 4386 | |
| 4387 | extern void validate(string layerName, bool condition, string message) |
| 4388 | |
| 4389 | |
| 4390 | ///////////////////////////// |
| 4391 | // Internal State Tracking // |
| 4392 | ///////////////////////////// |
| 4393 | |
| 4394 | StateObject State |
| 4395 | |
| 4396 | @internal class StateObject { |
| 4397 | // Dispatchable objects. |
| 4398 | map!(VkInstance, ref!InstanceObject) Instances |
| 4399 | map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices |
| 4400 | map!(VkDevice, ref!DeviceObject) Devices |
| 4401 | map!(VkQueue, ref!QueueObject) Queues |
| 4402 | map!(VkCmdBuffer, ref!CmdBufferObject) CmdBuffers |
| 4403 | |
| 4404 | // Non-dispatchable objects. |
| 4405 | map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories |
| 4406 | map!(VkBuffer, ref!BufferObject) Buffers |
| 4407 | map!(VkBufferView, ref!BufferViewObject) BufferViews |
| 4408 | map!(VkImage, ref!ImageObject) Images |
| 4409 | map!(VkImageView, ref!ImageViewObject) ImageViews |
| 4410 | map!(VkAttachmentView, ref!AttachmentViewObject) AttachmentViews |
| 4411 | map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules |
| 4412 | map!(VkShader, ref!ShaderObject) Shaders |
| 4413 | map!(VkPipeline, ref!PipelineObject) Pipelines |
| 4414 | map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts |
| 4415 | map!(VkSampler, ref!SamplerObject) Samplers |
| 4416 | map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets |
| 4417 | map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts |
| 4418 | map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools |
| 4419 | map!(VkDynamicViewportState, ref!DynamicViewportStateObject) DynamicViewportStates |
| 4420 | map!(VkDynamicRasterState, ref!DynamicRasterStateObject) DynamicRasterStates |
| 4421 | map!(VkDynamicColorBlendState, ref!DynamicColorBlendStateObject) DynamicColorBlendStates |
| 4422 | map!(VkDynamicDepthStencilState, ref!DynamicDepthStencilStateObject) DynamicDepthStencilStates |
| 4423 | map!(VkFence, ref!FenceObject) Fences |
| 4424 | map!(VkSemaphore, ref!SemaphoreObject) Semaphores |
| 4425 | map!(VkEvent, ref!EventObject) Events |
| 4426 | map!(VkQueryPool, ref!QueryPoolObject) QueryPools |
| 4427 | map!(VkFramebuffer, ref!FramebufferObject) Framebuffers |
| 4428 | map!(VkRenderPass, ref!RenderPassObject) RenderPasses |
| 4429 | map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches |
| 4430 | map!(VkCmdPool, ref!CmdPoolObject) CmdPools |
| 4431 | } |
| 4432 | |
| 4433 | @internal class InstanceObject { |
| 4434 | } |
| 4435 | |
| 4436 | @internal class PhysicalDeviceObject { |
| 4437 | VkInstance instance |
| 4438 | } |
| 4439 | |
| 4440 | @internal class DeviceObject { |
| 4441 | VkPhysicalDevice physicalDevice |
| 4442 | } |
| 4443 | |
| 4444 | @internal class QueueObject { |
| 4445 | VkDevice device |
| 4446 | VkQueueFlags flags |
| 4447 | } |
| 4448 | |
| 4449 | @internal class CmdBufferObject { |
| 4450 | VkDevice device |
| 4451 | map!(u64, VkDeviceMemory) boundObjects |
| 4452 | VkQueueFlags queueFlags |
| 4453 | } |
| 4454 | |
| 4455 | @internal class DeviceMemoryObject { |
| 4456 | VkDevice device |
| 4457 | platform.VkDeviceSize allocationSize |
| 4458 | map!(u64, platform.VkDeviceSize) boundObjects |
| 4459 | map!(VkCmdBuffer, VkCmdBuffer) boundCommandBuffers |
| 4460 | } |
| 4461 | |
| 4462 | @internal class BufferObject { |
| 4463 | VkDevice device |
| 4464 | VkDeviceMemory mem |
| 4465 | platform.VkDeviceSize memOffset |
| 4466 | } |
| 4467 | |
| 4468 | @internal class BufferViewObject { |
| 4469 | VkDevice device |
| 4470 | VkBuffer buffer |
| 4471 | } |
| 4472 | |
| 4473 | @internal class ImageObject { |
| 4474 | VkDevice device |
| 4475 | VkDeviceMemory mem |
| 4476 | platform.VkDeviceSize memOffset |
| 4477 | } |
| 4478 | |
| 4479 | @internal class ImageViewObject { |
| 4480 | VkDevice device |
| 4481 | VkImage image |
| 4482 | } |
| 4483 | |
| 4484 | @internal class AttachmentViewObject { |
| 4485 | VkDevice device |
| 4486 | VkImage image |
| 4487 | } |
| 4488 | |
| 4489 | @internal class ShaderObject { |
| 4490 | VkDevice device |
| 4491 | } |
| 4492 | |
| 4493 | @internal class ShaderModuleObject { |
| 4494 | VkDevice device |
| 4495 | } |
| 4496 | |
| 4497 | @internal class PipelineObject { |
| 4498 | VkDevice device |
| 4499 | } |
| 4500 | |
| 4501 | @internal class PipelineLayoutObject { |
| 4502 | VkDevice device |
| 4503 | } |
| 4504 | |
| 4505 | @internal class SamplerObject { |
| 4506 | VkDevice device |
| 4507 | } |
| 4508 | |
| 4509 | @internal class DescriptorSetObject { |
| 4510 | VkDevice device |
| 4511 | } |
| 4512 | |
| 4513 | @internal class DescriptorSetLayoutObject { |
| 4514 | VkDevice device |
| 4515 | } |
| 4516 | |
| 4517 | @internal class DescriptorPoolObject { |
| 4518 | VkDevice device |
| 4519 | } |
| 4520 | |
| 4521 | @internal class DynamicViewportStateObject { |
| 4522 | VkDevice device |
| 4523 | } |
| 4524 | |
| 4525 | @internal class DynamicRasterStateObject { |
| 4526 | VkDevice device |
| 4527 | } |
| 4528 | |
| 4529 | @internal class DynamicColorBlendStateObject { |
| 4530 | VkDevice device |
| 4531 | } |
| 4532 | |
| 4533 | @internal class DynamicDepthStencilStateObject { |
| 4534 | VkDevice device |
| 4535 | } |
| 4536 | |
| 4537 | @internal class FenceObject { |
| 4538 | VkDevice device |
| 4539 | bool signaled |
| 4540 | } |
| 4541 | |
| 4542 | @internal class SemaphoreObject { |
| 4543 | VkDevice device |
| 4544 | } |
| 4545 | |
| 4546 | @internal class EventObject { |
| 4547 | VkDevice device |
| 4548 | } |
| 4549 | |
| 4550 | @internal class QueryPoolObject { |
| 4551 | VkDevice device |
| 4552 | } |
| 4553 | |
| 4554 | @internal class FramebufferObject { |
| 4555 | VkDevice device |
| 4556 | } |
| 4557 | |
| 4558 | @internal class RenderPassObject { |
| 4559 | VkDevice device |
| 4560 | } |
| 4561 | |
| 4562 | @internal class PipelineCacheObject { |
| 4563 | VkDevice device |
| 4564 | } |
| 4565 | |
| 4566 | @internal class CmdPoolObject { |
| 4567 | VkDevice device |
| 4568 | } |
| 4569 | |
| 4570 | macro ref!InstanceObject GetInstance(VkInstance instance) { |
| 4571 | assert(instance in State.Instances) |
| 4572 | return State.Instances[instance] |
| 4573 | } |
| 4574 | |
| 4575 | macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) { |
| 4576 | assert(physicalDevice in State.PhysicalDevices) |
| 4577 | return State.PhysicalDevices[physicalDevice] |
| 4578 | } |
| 4579 | |
| 4580 | macro ref!DeviceObject GetDevice(VkDevice device) { |
| 4581 | assert(device in State.Devices) |
| 4582 | return State.Devices[device] |
| 4583 | } |
| 4584 | |
| 4585 | macro ref!QueueObject GetQueue(VkQueue queue) { |
| 4586 | assert(queue in State.Queues) |
| 4587 | return State.Queues[queue] |
| 4588 | } |
| 4589 | |
| 4590 | macro ref!CmdBufferObject GetCmdBuffer(VkCmdBuffer cmdBuffer) { |
| 4591 | assert(cmdBuffer in State.CmdBuffers) |
| 4592 | return State.CmdBuffers[cmdBuffer] |
| 4593 | } |
| 4594 | |
| 4595 | macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory mem) { |
| 4596 | assert(mem in State.DeviceMemories) |
| 4597 | return State.DeviceMemories[mem] |
| 4598 | } |
| 4599 | |
| 4600 | macro ref!BufferObject GetBuffer(VkBuffer buffer) { |
| 4601 | assert(buffer in State.Buffers) |
| 4602 | return State.Buffers[buffer] |
| 4603 | } |
| 4604 | |
| 4605 | macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) { |
| 4606 | assert(bufferView in State.BufferViews) |
| 4607 | return State.BufferViews[bufferView] |
| 4608 | } |
| 4609 | |
| 4610 | macro ref!ImageObject GetImage(VkImage image) { |
| 4611 | assert(image in State.Images) |
| 4612 | return State.Images[image] |
| 4613 | } |
| 4614 | |
| 4615 | macro ref!ImageViewObject GetImageView(VkImageView imageView) { |
| 4616 | assert(imageView in State.ImageViews) |
| 4617 | return State.ImageViews[imageView] |
| 4618 | } |
| 4619 | |
| 4620 | macro ref!AttachmentViewObject GetAttachmentView(VkAttachmentView attachmentView) { |
| 4621 | assert(attachmentView in State.AttachmentViews) |
| 4622 | return State.AttachmentViews[attachmentView] |
| 4623 | } |
| 4624 | |
| 4625 | macro ref!ShaderObject GetShader(VkShader shader) { |
| 4626 | assert(shader in State.Shaders) |
| 4627 | return State.Shaders[shader] |
| 4628 | } |
| 4629 | |
| 4630 | macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) { |
| 4631 | assert(shaderModule in State.ShaderModules) |
| 4632 | return State.ShaderModules[shaderModule] |
| 4633 | } |
| 4634 | |
| 4635 | macro ref!PipelineObject GetPipeline(VkPipeline pipeline) { |
| 4636 | assert(pipeline in State.Pipelines) |
| 4637 | return State.Pipelines[pipeline] |
| 4638 | } |
| 4639 | |
| 4640 | macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) { |
| 4641 | assert(pipelineLayout in State.PipelineLayouts) |
| 4642 | return State.PipelineLayouts[pipelineLayout] |
| 4643 | } |
| 4644 | |
| 4645 | macro ref!SamplerObject GetSampler(VkSampler sampler) { |
| 4646 | assert(sampler in State.Samplers) |
| 4647 | return State.Samplers[sampler] |
| 4648 | } |
| 4649 | |
| 4650 | macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) { |
| 4651 | assert(descriptorSet in State.DescriptorSets) |
| 4652 | return State.DescriptorSets[descriptorSet] |
| 4653 | } |
| 4654 | |
| 4655 | macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) { |
| 4656 | assert(descriptorSetLayout in State.DescriptorSetLayouts) |
| 4657 | return State.DescriptorSetLayouts[descriptorSetLayout] |
| 4658 | } |
| 4659 | |
| 4660 | macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) { |
| 4661 | assert(descriptorPool in State.DescriptorPools) |
| 4662 | return State.DescriptorPools[descriptorPool] |
| 4663 | } |
| 4664 | |
| 4665 | macro ref!DynamicViewportStateObject GetDynamicViewportState(VkDynamicViewportState dynamicViewportState) { |
| 4666 | assert(dynamicViewportState in State.DynamicViewportStates) |
| 4667 | return State.DynamicViewportStates[dynamicViewportState] |
| 4668 | } |
| 4669 | |
| 4670 | macro ref!DynamicRasterStateObject GetDynamicRasterState(VkDynamicRasterState dynamicRasterState) { |
| 4671 | assert(dynamicRasterState in State.DynamicRasterStates) |
| 4672 | return State.DynamicRasterStates[dynamicRasterState] |
| 4673 | } |
| 4674 | |
| 4675 | macro ref!DynamicColorBlendStateObject GetDynamicColorBlendState(VkDynamicColorBlendState dynamicColorBlendState) { |
| 4676 | assert(dynamicColorBlendState in State.DynamicColorBlendStates) |
| 4677 | return State.DynamicColorBlendStates[dynamicColorBlendState] |
| 4678 | } |
| 4679 | |
| 4680 | macro ref!DynamicDepthStencilStateObject GetDynamicDepthStencilState(VkDynamicDepthStencilState dynamicDepthStencilState) { |
| 4681 | assert(dynamicDepthStencilState in State.DynamicDepthStencilStates) |
| 4682 | return State.DynamicDepthStencilStates[dynamicDepthStencilState] |
| 4683 | } |
| 4684 | |
| 4685 | macro ref!FenceObject GetFence(VkFence fence) { |
| 4686 | assert(fence in State.Fences) |
| 4687 | return State.Fences[fence] |
| 4688 | } |
| 4689 | |
| 4690 | macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) { |
| 4691 | assert(semaphore in State.Semaphores) |
| 4692 | return State.Semaphores[semaphore] |
| 4693 | } |
| 4694 | |
| 4695 | macro ref!EventObject GetEvent(VkEvent event) { |
| 4696 | assert(event in State.Events) |
| 4697 | return State.Events[event] |
| 4698 | } |
| 4699 | |
| 4700 | macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) { |
| 4701 | assert(queryPool in State.QueryPools) |
| 4702 | return State.QueryPools[queryPool] |
| 4703 | } |
| 4704 | |
| 4705 | macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) { |
| 4706 | assert(framebuffer in State.Framebuffers) |
| 4707 | return State.Framebuffers[framebuffer] |
| 4708 | } |
| 4709 | |
| 4710 | macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) { |
| 4711 | assert(renderPass in State.RenderPasses) |
| 4712 | return State.RenderPasses[renderPass] |
| 4713 | } |
| 4714 | |
| 4715 | macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) { |
| 4716 | assert(pipelineCache in State.PipelineCaches) |
| 4717 | return State.PipelineCaches[pipelineCache] |
| 4718 | } |
| 4719 | |
| 4720 | macro ref!CmdPoolObject GetCmdPool(VkCmdPool cmdPool) { |
| 4721 | assert(cmdPool in State.CmdPools) |
| 4722 | return State.CmdPools[cmdPool] |
Jesse Hall | f09c6b1 | 2015-08-15 19:54:28 -0700 | [diff] [blame^] | 4723 | } |