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