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 | a366a51 | 2015-11-19 22:30:07 -0800 | [diff] [blame^] | 30 | define VERSION_MINOR 180 |
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 | |
Jesse Hall | a366a51 | 2015-11-19 22:30:07 -0800 | [diff] [blame^] | 1061 | class VkSubmitInfo { |
| 1062 | u32 waitSemCount |
| 1063 | const VkSemaphore* pWaitSemaphores |
| 1064 | u32 cmdBufferCount |
| 1065 | const VkCmdBuffer* pCommandBuffers |
| 1066 | u32 signalSemCount |
| 1067 | const VkSemaphore* pSignalSemaphores |
| 1068 | } |
| 1069 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1070 | class VkApplicationInfo { |
| 1071 | VkStructureType sType /// Type of structure. Should be VK_STRUCTURE_TYPE_APPLICATION_INFO |
| 1072 | const void* pNext /// Next structure in chain |
| 1073 | const char* pAppName |
| 1074 | u32 appVersion |
| 1075 | const char* pEngineName |
| 1076 | u32 engineVersion |
| 1077 | u32 apiVersion |
| 1078 | } |
| 1079 | |
| 1080 | class VkAllocCallbacks { |
| 1081 | void* pUserData |
| 1082 | PFN_vkAllocFunction pfnAlloc |
| 1083 | PFN_vkFreeFunction pfnFree |
| 1084 | } |
| 1085 | |
| 1086 | class VkDeviceQueueCreateInfo { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1087 | VkStructureType sStype /// Should be VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO |
| 1088 | const void* pNext /// Pointer to next structure |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1089 | u32 queueFamilyIndex |
| 1090 | u32 queueCount |
| 1091 | } |
| 1092 | |
| 1093 | class VkDeviceCreateInfo { |
| 1094 | VkStructureType sType /// Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO |
| 1095 | const void* pNext /// Pointer to next structure |
Jesse Hall | ae38f73 | 2015-11-19 21:32:50 -0800 | [diff] [blame] | 1096 | u32 requestedQueueRecordCount |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1097 | const VkDeviceQueueCreateInfo* pRequestedQueues |
| 1098 | u32 layerCount |
| 1099 | const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled |
| 1100 | u32 extensionCount |
| 1101 | const char* const* ppEnabledExtensionNames |
| 1102 | const VkPhysicalDeviceFeatures* pEnabledFeatures |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1103 | } |
| 1104 | |
| 1105 | class VkInstanceCreateInfo { |
| 1106 | VkStructureType sType /// Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO |
| 1107 | const void* pNext /// Pointer to next structure |
| 1108 | const VkApplicationInfo* pAppInfo |
| 1109 | const VkAllocCallbacks* pAllocCb |
| 1110 | u32 layerCount |
| 1111 | const char* const* ppEnabledLayerNames /// Ordered list of layer names to be enabled |
| 1112 | u32 extensionCount |
| 1113 | const char* const* ppEnabledExtensionNames /// Extension names to be enabled |
| 1114 | } |
| 1115 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1116 | class VkQueueFamilyProperties { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1117 | VkQueueFlags queueFlags /// Queue flags |
| 1118 | u32 queueCount |
Jesse Hall | acfa534 | 2015-11-19 21:51:33 -0800 | [diff] [blame] | 1119 | u32 timestampValidBits |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1120 | } |
| 1121 | |
| 1122 | class VkPhysicalDeviceMemoryProperties { |
| 1123 | u32 memoryTypeCount |
| 1124 | VkMemoryType[VK_MAX_MEMORY_TYPES] memoryTypes |
| 1125 | u32 memoryHeapCount |
| 1126 | VkMemoryHeap[VK_MAX_MEMORY_HEAPS] memoryHeaps |
| 1127 | } |
| 1128 | |
| 1129 | class VkMemoryAllocInfo { |
| 1130 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO |
| 1131 | const void* pNext /// Pointer to next structure |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1132 | VkDeviceSize allocationSize /// Size of memory allocation |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1133 | u32 memoryTypeIndex /// Index of the of the memory type to allocate from |
| 1134 | } |
| 1135 | |
| 1136 | class VkMemoryRequirements { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1137 | VkDeviceSize size /// Specified in bytes |
| 1138 | VkDeviceSize alignment /// Specified in bytes |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1139 | u32 memoryTypeBits /// Bitfield of the allowed memory type indices into memoryTypes[] for this object |
| 1140 | } |
| 1141 | |
| 1142 | class VkSparseImageFormatProperties { |
| 1143 | VkImageAspect aspect |
| 1144 | VkExtent3D imageGranularity |
| 1145 | VkSparseImageFormatFlags flags |
| 1146 | } |
| 1147 | |
| 1148 | class VkSparseImageMemoryRequirements { |
| 1149 | VkSparseImageFormatProperties formatProps |
| 1150 | u32 imageMipTailStartLOD |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1151 | VkDeviceSize imageMipTailSize /// Specified in bytes, must be a multiple of image block size / alignment |
| 1152 | VkDeviceSize imageMipTailOffset /// Specified in bytes, must be a multiple of image block size / alignment |
| 1153 | 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] | 1154 | } |
| 1155 | |
| 1156 | class VkMemoryType { |
| 1157 | VkMemoryPropertyFlags propertyFlags /// Memory properties of this memory type |
| 1158 | u32 heapIndex /// Index of the memory heap allocations of this memory type are taken from |
| 1159 | } |
| 1160 | |
| 1161 | class VkMemoryHeap { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1162 | VkDeviceSize size /// Available memory in the heap |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1163 | VkMemoryHeapFlags flags /// Flags for the heap |
| 1164 | } |
| 1165 | |
| 1166 | class VkMappedMemoryRange { |
| 1167 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE |
| 1168 | const void* pNext /// Pointer to next structure |
| 1169 | VkDeviceMemory mem /// Mapped memory object |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1170 | VkDeviceSize offset /// Offset within the mapped memory the range starts from |
| 1171 | VkDeviceSize size /// Size of the range within the mapped memory |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1172 | } |
| 1173 | |
| 1174 | class VkFormatProperties { |
| 1175 | VkFormatFeatureFlags linearTilingFeatures /// Format features in case of linear tiling |
| 1176 | VkFormatFeatureFlags optimalTilingFeatures /// Format features in case of optimal tiling |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1177 | VkFormatFeatureFlags bufferFeatures /// Format features supported by buffers |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1178 | } |
| 1179 | |
| 1180 | class VkImageFormatProperties { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1181 | VkExtent3D maxExtent /// max image dimensions for this resource type |
| 1182 | u32 maxMipLevels /// max number of mipmap levels for this resource type |
| 1183 | u32 maxArraySize /// max array size for this resource type |
| 1184 | VkSampleCountFlags sampleCounts /// supported sample counts for this resource type |
| 1185 | VkDeviceSize maxResourceSize /// max size (in bytes) of this resource type |
| 1186 | } |
| 1187 | |
| 1188 | class VkDescriptorBufferInfo { |
| 1189 | VkBuffer buffer /// Buffer used for this descriptor when the descriptor is UNIFORM_BUFFER[_DYNAMIC] |
| 1190 | VkDeviceSize offset /// Base offset from buffer start in bytes to update in the descriptor set. |
| 1191 | 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] | 1192 | } |
| 1193 | |
| 1194 | class VkDescriptorInfo { |
| 1195 | VkBufferView bufferView /// Buffer view to write to the descriptor (in case it's a buffer descriptor, otherwise should be VK_NULL_HANDLE) |
| 1196 | 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] | 1197 | 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) |
| 1198 | VkImageLayout imageLayout /// Layout the image is expected to be in when accessed using this descriptor (only used if imageView is not VK_NULL_HANDLE) |
| 1199 | 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] | 1200 | } |
| 1201 | |
| 1202 | class VkWriteDescriptorSet { |
| 1203 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET |
| 1204 | const void* pNext /// Pointer to next structure |
| 1205 | VkDescriptorSet destSet /// Destination descriptor set |
| 1206 | u32 destBinding /// Binding within the destination descriptor set to write |
| 1207 | u32 destArrayElement /// Array element within the destination binding to write |
| 1208 | u32 count /// Number of descriptors to write (determines the size of the array pointed by <pDescriptors>) |
| 1209 | VkDescriptorType descriptorType /// Descriptor type to write (determines which fields of the array pointed by <pDescriptors> are going to be used) |
| 1210 | const VkDescriptorInfo* pDescriptors /// Array of info structures describing the descriptors to write |
| 1211 | } |
| 1212 | |
| 1213 | class VkCopyDescriptorSet { |
| 1214 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET |
| 1215 | const void* pNext /// Pointer to next structure |
| 1216 | VkDescriptorSet srcSet /// Source descriptor set |
| 1217 | u32 srcBinding /// Binding within the source descriptor set to copy from |
| 1218 | u32 srcArrayElement /// Array element within the source binding to copy from |
| 1219 | VkDescriptorSet destSet /// Destination descriptor set |
| 1220 | u32 destBinding /// Binding within the destination descriptor set to copy to |
| 1221 | u32 destArrayElement /// Array element within the destination binding to copy to |
| 1222 | u32 count /// Number of descriptors to copy |
| 1223 | } |
| 1224 | |
| 1225 | class VkBufferCreateInfo { |
| 1226 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO |
| 1227 | const void* pNext /// Pointer to next structure. |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1228 | VkDeviceSize size /// Specified in bytes |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1229 | VkBufferUsageFlags usage /// Buffer usage flags |
| 1230 | VkBufferCreateFlags flags /// Buffer creation flags |
| 1231 | VkSharingMode sharingMode |
| 1232 | u32 queueFamilyCount |
| 1233 | const u32* pQueueFamilyIndices |
| 1234 | } |
| 1235 | |
| 1236 | class VkBufferViewCreateInfo { |
| 1237 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO |
| 1238 | const void* pNext /// Pointer to next structure. |
| 1239 | VkBuffer buffer |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1240 | VkFormat format /// Optionally specifies format of elements |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1241 | VkDeviceSize offset /// Specified in bytes |
| 1242 | VkDeviceSize range /// View size specified in bytes |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1243 | } |
| 1244 | |
| 1245 | class VkImageSubresource { |
| 1246 | VkImageAspect aspect |
| 1247 | u32 mipLevel |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1248 | u32 arrayLayer |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1249 | } |
| 1250 | |
| 1251 | class VkImageSubresourceRange { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1252 | VkImageAspectFlags aspectMask |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1253 | u32 baseMipLevel |
| 1254 | u32 mipLevels |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1255 | u32 baseArrayLayer |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1256 | u32 arraySize |
| 1257 | } |
| 1258 | |
| 1259 | class VkMemoryBarrier { |
| 1260 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_MEMORY_BARRIER |
| 1261 | const void* pNext /// Pointer to next structure. |
| 1262 | VkMemoryOutputFlags outputMask /// Outputs the barrier should sync |
| 1263 | VkMemoryInputFlags inputMask /// Inputs the barrier should sync to |
| 1264 | } |
| 1265 | |
| 1266 | class VkBufferMemoryBarrier { |
| 1267 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER |
| 1268 | const void* pNext /// Pointer to next structure. |
| 1269 | VkMemoryOutputFlags outputMask /// Outputs the barrier should sync |
| 1270 | VkMemoryInputFlags inputMask /// Inputs the barrier should sync to |
| 1271 | u32 srcQueueFamilyIndex /// Queue family to transition ownership from |
| 1272 | u32 destQueueFamilyIndex /// Queue family to transition ownership to |
| 1273 | VkBuffer buffer /// Buffer to sync |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1274 | VkDeviceSize offset /// Offset within the buffer to sync |
| 1275 | VkDeviceSize size /// Amount of bytes to sync |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1276 | } |
| 1277 | |
| 1278 | class VkImageMemoryBarrier { |
| 1279 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER |
| 1280 | const void* pNext /// Pointer to next structure. |
| 1281 | VkMemoryOutputFlags outputMask /// Outputs the barrier should sync |
| 1282 | VkMemoryInputFlags inputMask /// Inputs the barrier should sync to |
| 1283 | VkImageLayout oldLayout /// Current layout of the image |
| 1284 | VkImageLayout newLayout /// New layout to transition the image to |
| 1285 | u32 srcQueueFamilyIndex /// Queue family to transition ownership from |
| 1286 | u32 destQueueFamilyIndex /// Queue family to transition ownership to |
| 1287 | VkImage image /// Image to sync |
| 1288 | VkImageSubresourceRange subresourceRange /// Subresource range to sync |
| 1289 | } |
| 1290 | |
| 1291 | class VkImageCreateInfo { |
| 1292 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO |
| 1293 | const void* pNext /// Pointer to next structure. |
| 1294 | VkImageType imageType |
| 1295 | VkFormat format |
| 1296 | VkExtent3D extent |
| 1297 | u32 mipLevels |
| 1298 | u32 arraySize |
| 1299 | u32 samples |
| 1300 | VkImageTiling tiling |
| 1301 | VkImageUsageFlags usage /// Image usage flags |
| 1302 | VkImageCreateFlags flags /// Image creation flags |
| 1303 | VkSharingMode sharingMode /// Cross-queue-family sharing mode |
| 1304 | u32 queueFamilyCount /// Number of queue families to share across |
| 1305 | const u32* pQueueFamilyIndices /// Array of queue family indices to share across |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1306 | VkImageLayout initialLayout /// Initial image layout for all subresources |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1307 | } |
| 1308 | |
| 1309 | class VkSubresourceLayout { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1310 | VkDeviceSize offset /// Specified in bytes |
| 1311 | VkDeviceSize size /// Specified in bytes |
| 1312 | VkDeviceSize rowPitch /// Specified in bytes |
| 1313 | VkDeviceSize depthPitch /// Specified in bytes |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1314 | } |
| 1315 | |
| 1316 | class VkImageViewCreateInfo { |
| 1317 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO |
| 1318 | const void* pNext /// Pointer to next structure |
| 1319 | VkImage image |
| 1320 | VkImageViewType viewType |
| 1321 | VkFormat format |
| 1322 | VkChannelMapping channels |
| 1323 | VkImageSubresourceRange subresourceRange |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1324 | VkImageViewCreateFlags flags |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1325 | } |
| 1326 | |
| 1327 | class VkBufferCopy { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1328 | VkDeviceSize srcOffset /// Specified in bytes |
| 1329 | VkDeviceSize destOffset /// Specified in bytes |
| 1330 | VkDeviceSize copySize /// Specified in bytes |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1331 | } |
| 1332 | |
| 1333 | class VkSparseMemoryBindInfo { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1334 | VkDeviceSize rangeOffset /// Specified in bytes |
| 1335 | VkDeviceSize rangeSize /// Specified in bytes |
| 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 | |
| 1341 | class VkSparseImageMemoryBindInfo { |
| 1342 | VkImageSubresource subresource |
| 1343 | VkOffset3D offset |
| 1344 | VkExtent3D extent |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1345 | VkDeviceSize memOffset /// Specified in bytes |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1346 | VkDeviceMemory mem |
| 1347 | VkSparseMemoryBindFlags flags |
| 1348 | } |
| 1349 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1350 | class VkImageSubresourceCopy { |
| 1351 | VkImageAspect aspect |
| 1352 | u32 mipLevel |
| 1353 | u32 arrayLayer |
| 1354 | u32 arraySize |
| 1355 | } |
| 1356 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1357 | class VkImageCopy { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1358 | VkImageSubresourceCopy srcSubresource |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1359 | VkOffset3D srcOffset /// 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 extent /// Specified in pixels for both compressed and uncompressed images |
| 1363 | } |
| 1364 | |
| 1365 | class VkImageBlit { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1366 | VkImageSubresourceCopy srcSubresource |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1367 | VkOffset3D srcOffset /// Specified in pixels for both compressed and uncompressed images |
| 1368 | VkExtent3D srcExtent /// Specified in pixels for both compressed and uncompressed images |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1369 | VkImageSubresourceCopy destSubresource |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1370 | VkOffset3D destOffset /// Specified in pixels for both compressed and uncompressed images |
| 1371 | VkExtent3D destExtent /// Specified in pixels for both compressed and uncompressed images |
| 1372 | } |
| 1373 | |
| 1374 | class VkBufferImageCopy { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1375 | VkDeviceSize bufferOffset /// Specified in bytes |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1376 | u32 bufferRowLength /// Specified in texels |
| 1377 | u32 bufferImageHeight |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1378 | VkImageSubresourceCopy imageSubresource |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1379 | VkOffset3D imageOffset /// Specified in pixels for both compressed and uncompressed images |
| 1380 | VkExtent3D imageExtent /// Specified in pixels for both compressed and uncompressed images |
| 1381 | } |
| 1382 | |
| 1383 | class VkImageResolve { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1384 | VkImageSubresourceCopy srcSubresource |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1385 | VkOffset3D srcOffset |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1386 | VkImageSubresourceCopy destSubresource |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1387 | VkOffset3D destOffset |
| 1388 | VkExtent3D extent |
| 1389 | } |
| 1390 | |
| 1391 | class VkShaderModuleCreateInfo { |
| 1392 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO |
| 1393 | const void* pNext /// Pointer to next structure |
| 1394 | platform.size_t codeSize /// Specified in bytes |
| 1395 | const void* pCode /// Binary code of size codeSize |
| 1396 | VkShaderModuleCreateFlags flags /// Reserved |
| 1397 | } |
| 1398 | |
| 1399 | class VkShaderCreateInfo { |
| 1400 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SHADER_CREATE_INFO |
| 1401 | const void* pNext /// Pointer to next structure |
| 1402 | VkShaderModule module /// Module containing entry point |
| 1403 | const char* pName /// Null-terminated entry point name |
| 1404 | VkShaderCreateFlags flags /// Reserved |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1405 | VkShaderStage stage |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1406 | } |
| 1407 | |
| 1408 | class VkDescriptorSetLayoutBinding { |
| 1409 | VkDescriptorType descriptorType /// Type of the descriptors in this binding |
| 1410 | u32 arraySize /// Number of descriptors in this binding |
| 1411 | VkShaderStageFlags stageFlags /// Shader stages this binding is visible to |
| 1412 | const VkSampler* pImmutableSamplers /// Immutable samplers (used if descriptor type is SAMPLER or COMBINED_IMAGE_SAMPLER, is either NULL or contains <count> number of elements) |
| 1413 | } |
| 1414 | |
| 1415 | class VkDescriptorSetLayoutCreateInfo { |
| 1416 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO |
| 1417 | const void* pNext /// Pointer to next structure |
| 1418 | u32 count /// Number of bindings in the descriptor set layout |
| 1419 | const VkDescriptorSetLayoutBinding* pBinding /// Array of descriptor set layout bindings |
| 1420 | } |
| 1421 | |
| 1422 | class VkDescriptorTypeCount { |
| 1423 | VkDescriptorType type |
| 1424 | u32 count |
| 1425 | } |
| 1426 | |
| 1427 | class VkDescriptorPoolCreateInfo { |
| 1428 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO |
| 1429 | const void* pNext /// Pointer to next structure |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1430 | VkDescriptorPoolUsage poolUsage |
| 1431 | u32 maxSets |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1432 | u32 count |
| 1433 | const VkDescriptorTypeCount* pTypeCount |
| 1434 | } |
| 1435 | |
| 1436 | class VkSpecializationMapEntry { |
| 1437 | u32 constantId /// The SpecConstant ID specified in the BIL |
| 1438 | platform.size_t size /// Size in bytes of the SpecConstant |
| 1439 | u32 offset /// Offset of the value in the data block |
| 1440 | } |
| 1441 | |
| 1442 | class VkSpecializationInfo { |
| 1443 | u32 mapEntryCount /// Number of entries in the map |
| 1444 | const VkSpecializationMapEntry* pMap /// Array of map entries |
| 1445 | platform.size_t dataSize /// Size in bytes of pData |
| 1446 | const void* pData /// Pointer to SpecConstant data |
| 1447 | } |
| 1448 | |
| 1449 | class VkPipelineShaderStageCreateInfo { |
| 1450 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO |
| 1451 | const void* pNext /// Pointer to next structure |
| 1452 | VkShaderStage stage |
| 1453 | VkShader shader |
| 1454 | const VkSpecializationInfo* pSpecializationInfo |
| 1455 | } |
| 1456 | |
| 1457 | class VkComputePipelineCreateInfo { |
| 1458 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO |
| 1459 | const void* pNext /// Pointer to next structure |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1460 | VkPipelineShaderStageCreateInfo stage |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1461 | VkPipelineCreateFlags flags /// Pipeline creation flags |
| 1462 | VkPipelineLayout layout /// Interface layout of the pipeline |
| 1463 | 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 |
| 1464 | 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 |
| 1465 | } |
| 1466 | |
| 1467 | class VkVertexInputBindingDescription { |
| 1468 | u32 binding /// Vertex buffer binding id |
| 1469 | u32 strideInBytes /// Distance between vertices in bytes (0 = no advancement) |
| 1470 | VkVertexInputStepRate stepRate /// Rate at which binding is incremented |
| 1471 | } |
| 1472 | |
| 1473 | class VkVertexInputAttributeDescription { |
| 1474 | u32 location /// location of the shader vertex attrib |
| 1475 | u32 binding /// Vertex buffer binding id |
| 1476 | VkFormat format /// format of source data |
| 1477 | u32 offsetInBytes /// Offset of first element in bytes from base of vertex |
| 1478 | } |
| 1479 | |
| 1480 | class VkPipelineVertexInputStateCreateInfo { |
| 1481 | VkStructureType sType /// Should be VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO |
| 1482 | const void* pNext /// Pointer to next structure |
| 1483 | u32 bindingCount /// number of bindings |
| 1484 | const VkVertexInputBindingDescription* pVertexBindingDescriptions |
| 1485 | u32 attributeCount /// number of attributes |
| 1486 | const VkVertexInputAttributeDescription* pVertexAttributeDescriptions |
| 1487 | } |
| 1488 | |
| 1489 | class VkPipelineInputAssemblyStateCreateInfo { |
| 1490 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO |
| 1491 | const void* pNext /// Pointer to next structure |
| 1492 | VkPrimitiveTopology topology |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1493 | VkBool32 primitiveRestartEnable |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1494 | } |
| 1495 | |
| 1496 | class VkPipelineTessellationStateCreateInfo { |
| 1497 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO |
| 1498 | const void* pNext /// Pointer to next structure |
| 1499 | u32 patchControlPoints |
| 1500 | } |
| 1501 | |
| 1502 | class VkPipelineViewportStateCreateInfo { |
| 1503 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO |
| 1504 | const void* pNext /// Pointer to next structure |
| 1505 | u32 viewportCount |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1506 | const VkViewport* pViewports |
| 1507 | u32 scissorCount |
| 1508 | const VkRect2D* pScissors |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1509 | } |
| 1510 | |
| 1511 | class VkPipelineRasterStateCreateInfo { |
| 1512 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO |
| 1513 | const void* pNext /// Pointer to next structure |
Jesse Hall | ae38f73 | 2015-11-19 21:32:50 -0800 | [diff] [blame] | 1514 | VkBool32 depthClampEnable |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1515 | VkBool32 rasterizerDiscardEnable |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1516 | VkFillMode fillMode /// optional (GL45) |
| 1517 | VkCullMode cullMode |
| 1518 | VkFrontFace frontFace |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1519 | VkBool32 depthBiasEnable |
| 1520 | f32 depthBias |
| 1521 | f32 depthBiasClamp |
| 1522 | f32 slopeScaledDepthBias |
| 1523 | f32 lineWidth |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1524 | } |
| 1525 | |
| 1526 | class VkPipelineMultisampleStateCreateInfo { |
| 1527 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO |
| 1528 | const void* pNext /// Pointer to next structure |
| 1529 | u32 rasterSamples /// Number of samples used for rasterization |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1530 | VkBool32 sampleShadingEnable /// optional (GL45) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1531 | f32 minSampleShading /// optional (GL45) |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1532 | const VkSampleMask* pSampleMask |
Jesse Hall | acfa534 | 2015-11-19 21:51:33 -0800 | [diff] [blame] | 1533 | VkBool32 alphaToCoverageEnable |
| 1534 | VkBool32 alphaToOneEnable |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1535 | } |
| 1536 | |
| 1537 | class VkPipelineColorBlendAttachmentState { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1538 | VkBool32 blendEnable |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1539 | VkBlend srcBlendColor |
| 1540 | VkBlend destBlendColor |
| 1541 | VkBlendOp blendOpColor |
| 1542 | VkBlend srcBlendAlpha |
| 1543 | VkBlend destBlendAlpha |
| 1544 | VkBlendOp blendOpAlpha |
| 1545 | VkChannelFlags channelWriteMask |
| 1546 | } |
| 1547 | |
| 1548 | class VkPipelineColorBlendStateCreateInfo { |
| 1549 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO |
| 1550 | const void* pNext /// Pointer to next structure |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1551 | VkBool32 logicOpEnable |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1552 | VkLogicOp logicOp |
| 1553 | u32 attachmentCount /// # of pAttachments |
| 1554 | const VkPipelineColorBlendAttachmentState* pAttachments |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1555 | f32[4] blendConst |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1556 | } |
| 1557 | |
| 1558 | class VkStencilOpState { |
| 1559 | VkStencilOp stencilFailOp |
| 1560 | VkStencilOp stencilPassOp |
| 1561 | VkStencilOp stencilDepthFailOp |
| 1562 | VkCompareOp stencilCompareOp |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1563 | u32 stencilCompareMask |
| 1564 | u32 stencilWriteMask |
| 1565 | u32 stencilReference |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1566 | } |
| 1567 | |
| 1568 | class VkPipelineDepthStencilStateCreateInfo { |
| 1569 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO |
| 1570 | const void* pNext /// Pointer to next structure |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1571 | VkBool32 depthTestEnable |
| 1572 | VkBool32 depthWriteEnable |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1573 | VkCompareOp depthCompareOp |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1574 | VkBool32 depthBoundsTestEnable /// optional (depth_bounds_test) |
| 1575 | VkBool32 stencilTestEnable |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1576 | VkStencilOpState front |
| 1577 | VkStencilOpState back |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1578 | f32 minDepthBounds |
| 1579 | f32 maxDepthBounds |
| 1580 | } |
| 1581 | |
| 1582 | class VkPipelineDynamicStateCreateInfo { |
| 1583 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO |
| 1584 | const void* pNext /// Pointer to next structure |
| 1585 | u32 dynamicStateCount |
| 1586 | const VkDynamicState* pDynamicStates |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1587 | } |
| 1588 | |
| 1589 | class VkGraphicsPipelineCreateInfo { |
| 1590 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO |
| 1591 | const void* pNext /// Pointer to next structure |
| 1592 | u32 stageCount |
| 1593 | const VkPipelineShaderStageCreateInfo* pStages /// One entry for each active shader stage |
| 1594 | const VkPipelineVertexInputStateCreateInfo* pVertexInputState |
| 1595 | const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState |
| 1596 | const VkPipelineTessellationStateCreateInfo* pTessellationState |
| 1597 | const VkPipelineViewportStateCreateInfo* pViewportState |
| 1598 | const VkPipelineRasterStateCreateInfo* pRasterState |
| 1599 | const VkPipelineMultisampleStateCreateInfo* pMultisampleState |
| 1600 | const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState |
| 1601 | const VkPipelineColorBlendStateCreateInfo* pColorBlendState |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1602 | const VkPipelineDynamicStateCreateInfo* pDynamicState |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1603 | VkPipelineCreateFlags flags /// Pipeline creation flags |
| 1604 | VkPipelineLayout layout /// Interface layout of the pipeline |
| 1605 | VkRenderPass renderPass |
| 1606 | u32 subpass |
| 1607 | 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 |
| 1608 | 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 |
| 1609 | } |
| 1610 | |
| 1611 | class VkPipelineCacheCreateInfo { |
| 1612 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO |
| 1613 | const void* pNext /// Pointer to next structure |
| 1614 | platform.size_t initialSize /// Size of initial data to populate cache, in bytes |
| 1615 | const void* initialData /// Initial data to populate cache |
| 1616 | platform.size_t maxSize /// Maximum size cache can grow to, in bytes. If zero, then the cache may grow without bound. |
| 1617 | } |
| 1618 | |
| 1619 | class VkPushConstantRange { |
| 1620 | VkShaderStageFlags stageFlags /// Which stages use the range |
| 1621 | u32 start /// Start of the range, in bytes |
| 1622 | u32 length /// Length of the range, in bytes |
| 1623 | } |
| 1624 | |
| 1625 | class VkPipelineLayoutCreateInfo { |
| 1626 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO |
| 1627 | const void* pNext /// Pointer to next structure |
| 1628 | u32 descriptorSetCount /// Number of descriptor sets interfaced by the pipeline |
| 1629 | const VkDescriptorSetLayout* pSetLayouts /// Array of <setCount> number of descriptor set layout objects defining the layout of the |
| 1630 | u32 pushConstantRangeCount /// Number of push-constant ranges used by the pipeline |
| 1631 | const VkPushConstantRange* pPushConstantRanges /// Array of pushConstantRangeCount number of ranges used by various shader stages |
| 1632 | } |
| 1633 | |
| 1634 | class VkSamplerCreateInfo { |
| 1635 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO |
| 1636 | const void* pNext /// Pointer to next structure |
| 1637 | VkTexFilter magFilter /// Filter mode for magnification |
| 1638 | VkTexFilter minFilter /// Filter mode for minifiation |
| 1639 | VkTexMipmapMode mipMode /// Mipmap selection mode |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1640 | VkTexAddressMode addressModeU |
| 1641 | VkTexAddressMode addressModeV |
| 1642 | VkTexAddressMode addressModeW |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1643 | f32 mipLodBias |
| 1644 | f32 maxAnisotropy |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1645 | VkBool32 compareEnable |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1646 | VkCompareOp compareOp |
| 1647 | f32 minLod |
| 1648 | f32 maxLod |
| 1649 | VkBorderColor borderColor |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1650 | VkBool32 unnormalizedCoordinates |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1651 | } |
| 1652 | |
| 1653 | class VkCmdPoolCreateInfo { |
| 1654 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO |
| 1655 | const void* pNext /// Pointer to next structure |
| 1656 | u32 queueFamilyIndex |
| 1657 | VkCmdPoolCreateFlags flags /// Command pool creation flags |
| 1658 | } |
| 1659 | |
| 1660 | class VkCmdBufferCreateInfo { |
| 1661 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO |
| 1662 | const void* pNext /// Pointer to next structure |
| 1663 | VkCmdPool cmdPool |
| 1664 | VkCmdBufferLevel level |
| 1665 | VkCmdBufferCreateFlags flags /// Command buffer creation flags |
| 1666 | } |
| 1667 | |
| 1668 | class VkCmdBufferBeginInfo { |
| 1669 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO |
| 1670 | const void* pNext /// Pointer to next structure |
| 1671 | VkCmdBufferOptimizeFlags flags /// Command buffer optimization flags |
| 1672 | VkRenderPass renderPass /// Render pass for secondary command buffers |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1673 | u32 subpass |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1674 | VkFramebuffer framebuffer /// Framebuffer for secondary command buffers |
| 1675 | } |
| 1676 | |
| 1677 | class VkRenderPassBeginInfo { |
| 1678 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO |
| 1679 | const void* pNext /// Pointer to next structure |
| 1680 | VkRenderPass renderPass |
| 1681 | VkFramebuffer framebuffer |
| 1682 | VkRect2D renderArea |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1683 | u32 clearValueCount |
| 1684 | const VkClearValue* pClearValues |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1685 | } |
| 1686 | |
| 1687 | @union |
| 1688 | /// Union allowing specification of floating point, integer, or unsigned integer color data. Actual value selected is based on image/attachment being cleared. |
| 1689 | class VkClearColorValue { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1690 | f32[4] float32 |
| 1691 | s32[4] int32 |
| 1692 | u32[4] uint32 |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1693 | } |
| 1694 | |
| 1695 | class VkClearDepthStencilValue { |
| 1696 | f32 depth |
| 1697 | u32 stencil |
| 1698 | } |
| 1699 | |
| 1700 | @union |
| 1701 | /// Union allowing specification of color, depth, and stencil color values. Actual value selected is based on attachment being cleared. |
| 1702 | class VkClearValue { |
| 1703 | VkClearColorValue color |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1704 | VkClearDepthStencilValue depthStencil |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1705 | } |
| 1706 | |
Jesse Hall | ae38f73 | 2015-11-19 21:32:50 -0800 | [diff] [blame] | 1707 | class VkClearAttachment { |
| 1708 | VkImageAspectFlags aspectMask |
| 1709 | u32 colorAttachment |
| 1710 | VkClearValue clearValue |
| 1711 | } |
| 1712 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1713 | class VkAttachmentDescription { |
| 1714 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION |
| 1715 | const void* pNext /// Pointer to next structure |
| 1716 | VkFormat format |
| 1717 | u32 samples |
| 1718 | VkAttachmentLoadOp loadOp /// Load op for color or depth data |
| 1719 | VkAttachmentStoreOp storeOp /// Store op for color or depth data |
| 1720 | VkAttachmentLoadOp stencilLoadOp /// Load op for stencil data |
| 1721 | VkAttachmentStoreOp stencilStoreOp /// Store op for stencil data |
| 1722 | VkImageLayout initialLayout |
| 1723 | VkImageLayout finalLayout |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1724 | VkAttachmentDescriptionFlags flags |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1725 | } |
| 1726 | |
| 1727 | class VkAttachmentReference { |
| 1728 | u32 attachment |
| 1729 | VkImageLayout layout |
| 1730 | } |
| 1731 | |
| 1732 | class VkSubpassDescription { |
| 1733 | VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DESCRIPTION |
| 1734 | const void* pNext /// Pointer to next structure |
| 1735 | VkPipelineBindPoint pipelineBindPoint /// Must be VK_PIPELINE_BIND_POINT_GRAPHICS for now |
| 1736 | VkSubpassDescriptionFlags flags |
| 1737 | u32 inputCount |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1738 | const VkAttachmentReference* pInputAttachments |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1739 | u32 colorCount |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1740 | const VkAttachmentReference* pColorAttachments |
| 1741 | const VkAttachmentReference* pResolveAttachments |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1742 | VkAttachmentReference depthStencilAttachment |
| 1743 | u32 preserveCount |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1744 | const VkAttachmentReference* pPreserveAttachments |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1745 | } |
| 1746 | |
| 1747 | class VkSubpassDependency { |
| 1748 | VkStructureType sType /// Must be VK_STRUCTURE_SUBPASS_DEPENDENCY |
| 1749 | const void* pNext /// Pointer to next structure |
| 1750 | u32 srcSubpass |
| 1751 | u32 destSubpass |
| 1752 | VkPipelineStageFlags srcStageMask |
| 1753 | VkPipelineStageFlags destStageMask |
| 1754 | VkMemoryOutputFlags outputMask |
| 1755 | VkMemoryInputFlags inputMask |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1756 | VkBool32 byRegion |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1757 | } |
| 1758 | |
| 1759 | class VkRenderPassCreateInfo { |
| 1760 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO |
| 1761 | const void* pNext /// Pointer to next structure |
| 1762 | u32 attachmentCount |
| 1763 | const VkAttachmentDescription* pAttachments |
| 1764 | u32 subpassCount |
| 1765 | const VkSubpassDescription* pSubpasses |
| 1766 | u32 dependencyCount |
| 1767 | const VkSubpassDependency* pDependencies |
| 1768 | } |
| 1769 | |
| 1770 | class VkEventCreateInfo { |
| 1771 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_EVENT_CREATE_INFO |
| 1772 | const void* pNext /// Pointer to next structure |
| 1773 | VkEventCreateFlags flags /// Event creation flags |
| 1774 | } |
| 1775 | |
| 1776 | class VkFenceCreateInfo { |
| 1777 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FENCE_CREATE_INFO |
| 1778 | const void* pNext /// Pointer to next structure |
| 1779 | VkFenceCreateFlags flags /// Fence creation flags |
| 1780 | } |
| 1781 | |
| 1782 | class VkPhysicalDeviceFeatures { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1783 | VkBool32 robustBufferAccess /// out of bounds buffer accesses are well defined |
| 1784 | VkBool32 fullDrawIndexUint32 /// full 32-bit range of indices for indexed draw calls |
| 1785 | VkBool32 imageCubeArray /// image views which are arrays of cube maps |
| 1786 | VkBool32 independentBlend /// blending operations are controlled per-attachment |
| 1787 | VkBool32 geometryShader /// geometry stage |
| 1788 | VkBool32 tessellationShader /// tessellation control and evaluation stage |
| 1789 | VkBool32 sampleRateShading /// per-sample shading and interpolation |
| 1790 | VkBool32 dualSourceBlend /// blend operations which take two sources |
| 1791 | VkBool32 logicOp /// logic operations |
| 1792 | VkBool32 multiDrawIndirect /// multi draw indirect |
Jesse Hall | ae38f73 | 2015-11-19 21:32:50 -0800 | [diff] [blame] | 1793 | VkBool32 depthClamp /// depth clamping |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1794 | VkBool32 depthBiasClamp /// depth bias clamping |
| 1795 | VkBool32 fillModeNonSolid /// point and wireframe fill modes |
| 1796 | VkBool32 depthBounds /// depth bounds test |
| 1797 | VkBool32 wideLines /// lines with width greater than 1 |
| 1798 | VkBool32 largePoints /// points with size greater than 1 |
| 1799 | VkBool32 textureCompressionETC2 /// ETC texture compression formats |
| 1800 | VkBool32 textureCompressionASTC_LDR /// ASTC LDR texture compression formats |
| 1801 | VkBool32 textureCompressionBC /// BC1-7 texture compressed formats |
| 1802 | VkBool32 occlusionQueryNonConservative /// non-conservative (exact) occlusion queries |
| 1803 | VkBool32 pipelineStatisticsQuery /// pipeline statistics query |
| 1804 | VkBool32 vertexSideEffects /// storage buffers and images in vertex stage |
| 1805 | VkBool32 tessellationSideEffects /// storage buffers and images in tessellation stage |
| 1806 | VkBool32 geometrySideEffects /// storage buffers and images in geometry stage |
| 1807 | VkBool32 fragmentSideEffects /// storage buffers and images in fragment stage |
| 1808 | VkBool32 shaderTessellationPointSize /// tessellation stage can export point size |
| 1809 | VkBool32 shaderGeometryPointSize /// geometry stage can export point size |
| 1810 | VkBool32 shaderImageGatherExtended /// texture gather with run-time values and independent offsets |
| 1811 | VkBool32 shaderStorageImageExtendedFormats /// the extended set of formats can be used for storage images |
| 1812 | VkBool32 shaderStorageImageMultisample /// multisample images can be used for storage images |
| 1813 | VkBool32 shaderUniformBufferArrayDynamicIndexing /// arrays of uniform buffers can be accessed with dynamically uniform indices |
| 1814 | VkBool32 shaderSampledImageArrayDynamicIndexing /// arrays of sampled images can be accessed with dynamically uniform indices |
| 1815 | VkBool32 shaderStorageBufferArrayDynamicIndexing /// arrays of storage buffers can be accessed with dynamically uniform indices |
| 1816 | VkBool32 shaderStorageImageArrayDynamicIndexing /// arrays of storage images can be accessed with dynamically uniform indices |
| 1817 | VkBool32 shaderClipDistance /// clip distance in shaders |
| 1818 | VkBool32 shaderCullDistance /// cull distance in shaders |
| 1819 | VkBool32 shaderFloat64 /// 64-bit floats (doubles) in shaders |
| 1820 | VkBool32 shaderInt64 /// 64-bit integers in shaders |
| 1821 | VkBool32 shaderInt16 /// 16-bit integers in shaders |
| 1822 | VkBool32 shaderResourceResidency /// shader can use texture operations that return resource residency information (requires sparseNonResident support) |
| 1823 | VkBool32 shaderResourceMinLOD /// shader can use texture operations that specify minimum resource LOD |
| 1824 | VkBool32 alphaToOne /// The fragment alpha channel can be forced to maximum representable alpha value |
| 1825 | VkBool32 sparseBinding /// Sparse resources support: Resource memory can be managed at opaque page level rather than object level |
| 1826 | VkBool32 sparseResidencyBuffer /// Sparse resources support: GPU can access partially resident buffers |
| 1827 | VkBool32 sparseResidencyImage2D /// Sparse resources support: GPU can access partially resident 2D (non-MSAA non-DepthStencil) images |
| 1828 | VkBool32 sparseResidencyImage3D /// Sparse resources support: GPU can access partially resident 3D images |
| 1829 | VkBool32 sparseResidency2Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 2 samples |
| 1830 | VkBool32 sparseResidency4Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 4 samples |
| 1831 | VkBool32 sparseResidency8Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 8 samples |
| 1832 | VkBool32 sparseResidency16Samples /// Sparse resources support: GPU can access partially resident MSAA 2D images with 16 samples |
| 1833 | 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] | 1834 | } |
| 1835 | |
| 1836 | class VkPhysicalDeviceLimits { |
| 1837 | /// resource maximum sizes |
| 1838 | u32 maxImageDimension1D /// max 1D image dimension |
| 1839 | u32 maxImageDimension2D /// max 2D image dimension |
| 1840 | u32 maxImageDimension3D /// max 3D image dimension |
| 1841 | u32 maxImageDimensionCube /// max cubemap image dimension |
| 1842 | u32 maxImageArrayLayers /// max layers for image arrays |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1843 | VkSampleCountFlags sampleCounts /// sample counts supported for all images supporting rendering and sampling |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1844 | u32 maxTexelBufferSize /// max texel buffer size (bytes) |
| 1845 | u32 maxUniformBufferSize /// max uniform buffer size (bytes) |
| 1846 | u32 maxStorageBufferSize /// max storage buffer size (bytes) |
| 1847 | u32 maxPushConstantsSize /// max size of the push constants pool (bytes) |
| 1848 | /// memory limits |
| 1849 | u32 maxMemoryAllocationCount /// max number of device memory allocations supported |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1850 | VkDeviceSize bufferImageGranularity /// Granularity (in bytes) at which buffers and images can be bound to adjacent memory for simultaneous usage |
| 1851 | VkDeviceSize sparseAddressSpaceSize /// Total address space available for sparse allocations (bytes) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1852 | /// descriptor set limits |
| 1853 | u32 maxBoundDescriptorSets /// max number of descriptors sets that can be bound to a pipeline |
| 1854 | u32 maxDescriptorSets /// max number of allocated descriptor sets |
| 1855 | u32 maxPerStageDescriptorSamplers /// max num of samplers allowed per-stage in a descriptor set |
| 1856 | u32 maxPerStageDescriptorUniformBuffers /// max num of uniform buffers allowed per-stage in a descriptor set |
| 1857 | u32 maxPerStageDescriptorStorageBuffers /// max num of storage buffers allowed per-stage in a descriptor set |
| 1858 | u32 maxPerStageDescriptorSampledImages /// max num of sampled images allowed per-stage in a descriptor set |
| 1859 | u32 maxPerStageDescriptorStorageImages /// max num of storage images allowed per-stage in a descriptor set |
| 1860 | u32 maxDescriptorSetSamplers /// max num of samplers allowed in all stages in a descriptor set |
| 1861 | 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] | 1862 | 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] | 1863 | 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] | 1864 | 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] | 1865 | u32 maxDescriptorSetSampledImages /// max num of sampled images allowed in all stages in a descriptor set |
| 1866 | u32 maxDescriptorSetStorageImages /// max num of storage images allowed in all stages in a descriptor set |
| 1867 | /// vertex stage limits |
| 1868 | u32 maxVertexInputAttributes /// max num of vertex input attribute slots |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1869 | u32 maxVertexInputBindings /// max num of vertex input binding slots |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1870 | u32 maxVertexInputAttributeOffset /// max vertex input attribute offset added to vertex buffer offset |
| 1871 | u32 maxVertexInputBindingStride /// max vertex input binding stride |
| 1872 | u32 maxVertexOutputComponents /// max num of output components written by vertex shader |
| 1873 | /// tessellation control stage limits |
Jesse Hall | ae38f73 | 2015-11-19 21:32:50 -0800 | [diff] [blame] | 1874 | u32 maxTessellationGenLevel /// max level supported by tess primitive generator |
| 1875 | u32 maxTessellationPatchSize /// max patch size (vertices) |
| 1876 | u32 maxTessellationControlPerVertexInputComponents /// max num of input components per-vertex in TCS |
| 1877 | u32 maxTessellationControlPerVertexOutputComponents /// max num of output components per-vertex in TCS |
| 1878 | u32 maxTessellationControlPerPatchOutputComponents /// max num of output components per-patch in TCS |
| 1879 | u32 maxTessellationControlTotalOutputComponents /// max total num of per-vertex and per-patch output components in TCS |
| 1880 | u32 maxTessellationEvaluationInputComponents /// max num of input components per vertex in TES |
| 1881 | u32 maxTessellationEvaluationOutputComponents /// max num of output components per vertex in TES |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1882 | /// geometry stage limits |
| 1883 | u32 maxGeometryShaderInvocations /// max invocation count supported in geometry shader |
| 1884 | u32 maxGeometryInputComponents /// max num of input components read in geometry stage |
| 1885 | u32 maxGeometryOutputComponents /// max num of output components written in geometry stage |
| 1886 | u32 maxGeometryOutputVertices /// max num of vertices that can be emitted in geometry stage |
| 1887 | u32 maxGeometryTotalOutputComponents /// max total num of components (all vertices) written in geometry stage |
| 1888 | /// fragment stage limits |
| 1889 | u32 maxFragmentInputComponents /// max num of input compontents read in fragment stage |
| 1890 | u32 maxFragmentOutputBuffers /// max num of output buffers written in fragment stage |
| 1891 | u32 maxFragmentDualSourceBuffers /// max num of output buffers written when using dual source blending |
| 1892 | u32 maxFragmentCombinedOutputResources /// max total num of storage buffers, storage images and output buffers |
| 1893 | /// compute stage limits |
| 1894 | u32 maxComputeSharedMemorySize /// max total storage size of work group local storage (bytes) |
| 1895 | u32[3] maxComputeWorkGroupCount /// max num of compute work groups that may be dispatched by a single command (x,y,z) |
| 1896 | u32 maxComputeWorkGroupInvocations /// max total compute invocations in a single local work group |
| 1897 | u32[3] maxComputeWorkGroupSize /// max local size of a compute work group (x,y,z) |
| 1898 | |
| 1899 | u32 subPixelPrecisionBits /// num bits of subpixel precision in screen x and y |
| 1900 | u32 subTexelPrecisionBits /// num bits of subtexel precision |
| 1901 | u32 mipmapPrecisionBits /// num bits of mipmap precision |
| 1902 | |
| 1903 | u32 maxDrawIndexedIndexValue /// max index value for indexed draw calls (for 32-bit indices) |
| 1904 | u32 maxDrawIndirectInstanceCount /// max instance count for indirect draw calls |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1905 | VkBool32 primitiveRestartForPatches /// is primitive restart supported for PATCHES |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1906 | |
| 1907 | f32 maxSamplerLodBias /// max absolute sampler level of detail bias |
| 1908 | f32 maxSamplerAnisotropy /// max degree of sampler anisotropy |
| 1909 | |
| 1910 | u32 maxViewports /// max number of active viewports |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1911 | u32[2] maxViewportDimensions /// max viewport dimensions (x,y) |
| 1912 | f32[2] viewportBoundsRange /// viewport bounds range (min,max) |
| 1913 | u32 viewportSubPixelBits /// num bits of subpixel precision for viewport |
| 1914 | |
| 1915 | u32 minMemoryMapAlignment /// min required alignment of pointers returned by MapMemory (bytes) |
Jesse Hall | f09c6b1 | 2015-08-15 19:54:28 -0700 | [diff] [blame] | 1916 | u32 minTexelBufferOffsetAlignment /// min required alignment for texel buffer offsets (bytes) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1917 | u32 minUniformBufferOffsetAlignment /// min required alignment for uniform buffer sizes and offsets (bytes) |
| 1918 | u32 minStorageBufferOffsetAlignment /// min required alignment for storage buffer offsets (bytes) |
| 1919 | |
| 1920 | u32 minTexelOffset /// min texel offset for OpTextureSampleOffset |
| 1921 | u32 maxTexelOffset /// max texel offset for OpTextureSampleOffset |
| 1922 | u32 minTexelGatherOffset /// min texel offset for OpTextureGatherOffset |
| 1923 | u32 maxTexelGatherOffset /// max texel offset for OpTextureGatherOffset |
| 1924 | f32 minInterpolationOffset /// furthest negative offset for interpolateAtOffset |
| 1925 | f32 maxInterpolationOffset /// furthest positive offset for interpolateAtOffset |
| 1926 | u32 subPixelInterpolationOffsetBits /// num of subpixel bits for interpolateAtOffset |
| 1927 | |
| 1928 | u32 maxFramebufferWidth /// max width for a framebuffer |
| 1929 | u32 maxFramebufferHeight /// max height for a framebuffer |
| 1930 | u32 maxFramebufferLayers /// max layer count for a layered framebuffer |
| 1931 | u32 maxFramebufferColorSamples /// max color sample count for a framebuffer |
| 1932 | u32 maxFramebufferDepthSamples /// max depth sample count for a framebuffer |
| 1933 | u32 maxFramebufferStencilSamples /// max stencil sample count for a framebuffer |
| 1934 | u32 maxColorAttachments /// max num of framebuffer color attachments |
| 1935 | |
| 1936 | u32 maxSampledImageColorSamples /// max num of color samples for a non-integer sampled image |
| 1937 | u32 maxSampledImageDepthSamples /// max num of depth/stencil samples for a sampled image |
| 1938 | u32 maxSampledImageIntegerSamples /// max num of samples supported for an integer image |
| 1939 | u32 maxStorageImageSamples /// max num of samples for a storage image |
| 1940 | u32 maxSampleMaskWords /// max num of sample mask words |
| 1941 | |
| 1942 | u64 timestampFrequency /// 1/clock_tick_granularity for timestamp queries |
| 1943 | |
| 1944 | u32 maxClipDistances /// max number of clip distances |
| 1945 | u32 maxCullDistances /// max number of cull distances |
| 1946 | u32 maxCombinedClipAndCullDistances /// max combined number of user clipping |
| 1947 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1948 | f32[2] pointSizeRange /// range (min,max) of supported point sizes |
| 1949 | f32[2] lineWidthRange /// range (min,max) of supported line widths |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1950 | f32 pointSizeGranularity /// granularity of supported point sizes |
| 1951 | f32 lineWidthGranularity /// granularity of supported line widths |
| 1952 | } |
| 1953 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1954 | class VkPhysicalDeviceSparseProperties { |
| 1955 | VkBool32 residencyStandard2DBlockShape /// Sparse resources support: GPU will access all 2D (single sample) sparse resources using the standard block shapes (based on pixel format) |
| 1956 | VkBool32 residencyStandard2DMSBlockShape /// Sparse resources support: GPU will access all 2D (multisample) sparse resources using the standard block shapes (based on pixel format) |
| 1957 | VkBool32 residencyStandard3DBlockShape /// Sparse resources support: GPU will access all 3D sparse resources using the standard block shapes (based on pixel format) |
| 1958 | 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 |
| 1959 | VkBool32 residencyNonResident /// Sparse resources support: GPU can safely access non-resident regions of a resource, read values from read-write resources are undefined |
| 1960 | 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 |
| 1961 | } |
| 1962 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1963 | class VkSemaphoreCreateInfo { |
| 1964 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO |
| 1965 | const void* pNext /// Pointer to next structure |
| 1966 | VkSemaphoreCreateFlags flags /// Semaphore creation flags |
| 1967 | } |
| 1968 | |
| 1969 | class VkQueryPoolCreateInfo { |
| 1970 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO |
| 1971 | const void* pNext /// Pointer to next structure |
| 1972 | VkQueryType queryType |
| 1973 | u32 slots |
| 1974 | VkQueryPipelineStatisticFlags pipelineStatistics /// Optional |
| 1975 | } |
| 1976 | |
| 1977 | class VkFramebufferCreateInfo { |
| 1978 | VkStructureType sType /// Must be VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO |
| 1979 | const void* pNext /// Pointer to next structure |
| 1980 | VkRenderPass renderPass |
| 1981 | u32 attachmentCount |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1982 | const VkImageView* pAttachments |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 1983 | u32 width |
| 1984 | u32 height |
| 1985 | u32 layers |
| 1986 | } |
| 1987 | |
| 1988 | class VkDrawIndirectCmd { |
| 1989 | u32 vertexCount |
| 1990 | u32 instanceCount |
| 1991 | u32 firstVertex |
| 1992 | u32 firstInstance |
| 1993 | } |
| 1994 | |
| 1995 | class VkDrawIndexedIndirectCmd { |
| 1996 | u32 indexCount |
| 1997 | u32 instanceCount |
| 1998 | u32 firstIndex |
| 1999 | s32 vertexOffset |
| 2000 | u32 firstInstance |
| 2001 | } |
| 2002 | |
| 2003 | class VkDispatchIndirectCmd { |
| 2004 | u32 x |
| 2005 | u32 y |
| 2006 | u32 z |
| 2007 | } |
| 2008 | |
Michael Lentine | 88594d7 | 2015-11-12 12:49:45 -0800 | [diff] [blame] | 2009 | ////////////////// |
| 2010 | // Extensions // |
| 2011 | ////////////////// |
| 2012 | |
| 2013 | @extension("VK_EXT_KHR_device_swapchain") |
| 2014 | class VkSurfacePropertiesKHR { |
| 2015 | u32 minImageCount |
| 2016 | u32 maxImageCount |
| 2017 | VkExtent2D currentExtent |
| 2018 | VkExtent2D minImageExtent |
| 2019 | VkExtent2D maxImageExtent |
| 2020 | VkSurfaceTransformFlagsKHR supportedTransforms |
| 2021 | VkSurfaceTransformKHR currentTransform |
| 2022 | u32 maxImageArraySize |
| 2023 | VkImageUsageFlags supportedUsageFlags |
| 2024 | } |
| 2025 | |
| 2026 | @extension("VK_EXT_KHR_device_swapchain") |
| 2027 | class VkSurfaceFormatKHR { |
| 2028 | VkFormat format |
| 2029 | VkColorSpaceKHR colorSpace |
| 2030 | } |
| 2031 | |
| 2032 | @extension("VK_EXT_KHR_device_swapchain") |
| 2033 | class VkSwapchainCreateInfoKHR { |
| 2034 | VkStructureType sType |
| 2035 | const void* pNext |
| 2036 | const VkSurfaceDescriptionKHR* pSurfaceDescription |
| 2037 | u32 minImageCount |
| 2038 | VkFormat imageFormat |
| 2039 | VkColorSpaceKHR imageColorSpace |
| 2040 | VkExtent2D imageExtent |
| 2041 | VkImageUsageFlags imageUsageFlags |
| 2042 | VkSurfaceTransformKHR preTransform |
| 2043 | u32 imageArraySize |
| 2044 | VkSharingMode sharingMode |
| 2045 | u32 queueFamilyCount |
| 2046 | const u32* pQueueFamilyIndices |
| 2047 | VkPresentModeKHR presentMode |
| 2048 | VkSwapchainKHR oldSwapchain |
| 2049 | VkBool32 clipped |
| 2050 | } |
| 2051 | |
| 2052 | @extension("VK_EXT_KHR_device_swapchain") |
| 2053 | class VkPresentInfoKHR { |
| 2054 | VkStructureType sType |
| 2055 | const void* pNext |
| 2056 | u32 swapchainCount |
| 2057 | const VkSwapchainKHR* swapchains |
| 2058 | const u32* imageIndices |
| 2059 | } |
| 2060 | |
| 2061 | @extension("VK_EXT_KHR_swapchain") |
| 2062 | class VkSurfaceDescriptionKHR { |
| 2063 | VkStructureType sType |
| 2064 | const void* pNext |
| 2065 | } |
| 2066 | |
| 2067 | @extension("VK_EXT_KHR_swapchain") |
| 2068 | class VkSurfaceDescriptionWindowKHR { |
| 2069 | VkStructureType sType |
| 2070 | const void* pNext |
| 2071 | VkPlatformKHR platform |
| 2072 | void* pPlatformHandle |
| 2073 | void* pPlatformWindow |
| 2074 | } |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2075 | |
| 2076 | //////////////// |
| 2077 | // Commands // |
| 2078 | //////////////// |
| 2079 | |
| 2080 | // Function pointers. TODO: add support for function pointers. |
| 2081 | |
| 2082 | @external type void* PFN_vkVoidFunction |
| 2083 | @pfn cmd void vkVoidFunction() { |
| 2084 | } |
| 2085 | |
| 2086 | @external type void* PFN_vkAllocFunction |
| 2087 | @pfn cmd void* vkAllocFunction( |
| 2088 | void* pUserData, |
| 2089 | platform.size_t size, |
| 2090 | platform.size_t alignment, |
| 2091 | VkSystemAllocType allocType) { |
| 2092 | return ? |
| 2093 | } |
| 2094 | |
| 2095 | @external type void* PFN_vkFreeFunction |
| 2096 | @pfn cmd void vkFreeFunction( |
| 2097 | void* pUserData, |
| 2098 | void* pMem) { |
| 2099 | } |
| 2100 | |
| 2101 | |
| 2102 | // Global functions |
| 2103 | |
| 2104 | @threadSafety("system") |
| 2105 | cmd VkResult vkCreateInstance( |
| 2106 | const VkInstanceCreateInfo* pCreateInfo, |
| 2107 | VkInstance* pInstance) { |
| 2108 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO) |
| 2109 | |
| 2110 | instance := ? |
| 2111 | pInstance[0] = instance |
| 2112 | State.Instances[instance] = new!InstanceObject() |
| 2113 | |
| 2114 | layers := pCreateInfo.ppEnabledLayerNames[0:pCreateInfo.layerCount] |
| 2115 | extensions := pCreateInfo.ppEnabledExtensionNames[0:pCreateInfo.extensionCount] |
| 2116 | |
| 2117 | return ? |
| 2118 | } |
| 2119 | |
| 2120 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2121 | cmd void vkDestroyInstance( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2122 | VkInstance instance) { |
| 2123 | instanceObject := GetInstance(instance) |
| 2124 | |
| 2125 | State.Instances[instance] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2126 | } |
| 2127 | |
| 2128 | @threadSafety("system") |
| 2129 | cmd VkResult vkEnumeratePhysicalDevices( |
| 2130 | VkInstance instance, |
| 2131 | u32* pPhysicalDeviceCount, |
| 2132 | VkPhysicalDevice* pPhysicalDevices) { |
| 2133 | instanceObject := GetInstance(instance) |
| 2134 | |
| 2135 | physicalDeviceCount := as!u32(?) |
| 2136 | pPhysicalDeviceCount[0] = physicalDeviceCount |
| 2137 | physicalDevices := pPhysicalDevices[0:physicalDeviceCount] |
| 2138 | |
| 2139 | for i in (0 .. physicalDeviceCount) { |
| 2140 | physicalDevice := ? |
| 2141 | physicalDevices[i] = physicalDevice |
| 2142 | if !(physicalDevice in State.PhysicalDevices) { |
| 2143 | State.PhysicalDevices[physicalDevice] = new!PhysicalDeviceObject(instance: instance) |
| 2144 | } |
| 2145 | } |
| 2146 | |
| 2147 | return ? |
| 2148 | } |
| 2149 | |
| 2150 | cmd PFN_vkVoidFunction vkGetDeviceProcAddr( |
| 2151 | VkDevice device, |
| 2152 | const char* pName) { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2153 | if device != NULL_HANDLE { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2154 | device := GetDevice(device) |
| 2155 | } |
| 2156 | |
| 2157 | return ? |
| 2158 | } |
| 2159 | |
| 2160 | cmd PFN_vkVoidFunction vkGetInstanceProcAddr( |
| 2161 | VkInstance instance, |
| 2162 | const char* pName) { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2163 | if instance != NULL_HANDLE { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2164 | instanceObject := GetInstance(instance) |
| 2165 | } |
| 2166 | |
| 2167 | return ? |
| 2168 | } |
| 2169 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 2170 | cmd void vkGetPhysicalDeviceProperties( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2171 | VkPhysicalDevice physicalDevice, |
| 2172 | VkPhysicalDeviceProperties* pProperties) { |
| 2173 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2174 | |
| 2175 | properties := ? |
| 2176 | pProperties[0] = properties |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2177 | } |
| 2178 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 2179 | cmd void vkGetPhysicalDeviceQueueFamilyProperties( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2180 | VkPhysicalDevice physicalDevice, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2181 | u32* pCount, |
| 2182 | VkQueueFamilyProperties* pQueueFamilyProperties) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2183 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2184 | // TODO: Figure out how to express fetch-count-or-properties |
| 2185 | // This version fails 'apic validate' with 'fence not allowed in |
| 2186 | // *semantic.Branch'. Other attempts have failed with the same or other |
| 2187 | // errors. |
| 2188 | // if pQueueFamilyProperties != null { |
| 2189 | // queuesProperties := pQueueFamilyProperties[0:pCount[0]] |
| 2190 | // for i in (0 .. pCount[0]) { |
| 2191 | // queueProperties := as!VkQueueFamilyProperties(?) |
| 2192 | // queuesProperties[i] = queueProperties |
| 2193 | // } |
| 2194 | // } else { |
| 2195 | // count := ? |
| 2196 | // pCount[0] = count |
| 2197 | // } |
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 vkGetPhysicalDeviceMemoryProperties( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2201 | VkPhysicalDevice physicalDevice, |
| 2202 | VkPhysicalDeviceMemoryProperties* pMemoryProperties) { |
| 2203 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2204 | |
| 2205 | memoryProperties := ? |
| 2206 | pMemoryProperties[0] = memoryProperties |
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 vkGetPhysicalDeviceFeatures( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2210 | VkPhysicalDevice physicalDevice, |
| 2211 | VkPhysicalDeviceFeatures* pFeatures) { |
| 2212 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2213 | |
| 2214 | features := ? |
| 2215 | pFeatures[0] = features |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2216 | } |
| 2217 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 2218 | cmd void vkGetPhysicalDeviceFormatProperties( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2219 | VkPhysicalDevice physicalDevice, |
| 2220 | VkFormat format, |
| 2221 | VkFormatProperties* pFormatProperties) { |
| 2222 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2223 | |
| 2224 | formatProperties := ? |
| 2225 | pFormatProperties[0] = formatProperties |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2226 | } |
| 2227 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 2228 | cmd void vkGetPhysicalDeviceImageFormatProperties( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2229 | VkPhysicalDevice physicalDevice, |
| 2230 | VkFormat format, |
| 2231 | VkImageType type, |
| 2232 | VkImageTiling tiling, |
| 2233 | VkImageUsageFlags usage, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2234 | VkImageCreateFlags flags, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2235 | VkImageFormatProperties* pImageFormatProperties) { |
| 2236 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2237 | |
| 2238 | imageFormatProperties := ? |
| 2239 | pImageFormatProperties[0] = imageFormatProperties |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2240 | } |
| 2241 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2242 | |
| 2243 | // Device functions |
| 2244 | |
| 2245 | @threadSafety("system") |
| 2246 | cmd VkResult vkCreateDevice( |
| 2247 | VkPhysicalDevice physicalDevice, |
| 2248 | const VkDeviceCreateInfo* pCreateInfo, |
| 2249 | VkDevice* pDevice) { |
| 2250 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO) |
| 2251 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2252 | |
| 2253 | device := ? |
| 2254 | pDevice[0] = device |
| 2255 | State.Devices[device] = new!DeviceObject(physicalDevice: physicalDevice) |
| 2256 | |
| 2257 | return ? |
| 2258 | } |
| 2259 | |
| 2260 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2261 | cmd void vkDestroyDevice( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2262 | VkDevice device) { |
| 2263 | deviceObject := GetDevice(device) |
| 2264 | |
| 2265 | State.Devices[device] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2266 | } |
| 2267 | |
| 2268 | |
| 2269 | // Extension discovery functions |
| 2270 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2271 | cmd VkResult vkEnumerateInstanceLayerProperties( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2272 | u32* pCount, |
| 2273 | VkLayerProperties* pProperties) { |
| 2274 | count := as!u32(?) |
| 2275 | pCount[0] = count |
| 2276 | |
| 2277 | properties := pProperties[0:count] |
| 2278 | for i in (0 .. count) { |
| 2279 | property := ? |
| 2280 | properties[i] = property |
| 2281 | } |
| 2282 | |
| 2283 | return ? |
| 2284 | } |
| 2285 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2286 | cmd VkResult vkEnumerateInstanceExtensionProperties( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2287 | const char* pLayerName, |
| 2288 | u32* pCount, |
| 2289 | VkExtensionProperties* pProperties) { |
| 2290 | count := as!u32(?) |
| 2291 | pCount[0] = count |
| 2292 | |
| 2293 | properties := pProperties[0:count] |
| 2294 | for i in (0 .. count) { |
| 2295 | property := ? |
| 2296 | properties[i] = property |
| 2297 | } |
| 2298 | |
| 2299 | return ? |
| 2300 | } |
| 2301 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2302 | cmd VkResult vkEnumerateDeviceLayerProperties( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2303 | VkPhysicalDevice physicalDevice, |
| 2304 | u32* pCount, |
| 2305 | VkLayerProperties* pProperties) { |
| 2306 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2307 | count := as!u32(?) |
| 2308 | pCount[0] = count |
| 2309 | |
| 2310 | properties := pProperties[0:count] |
| 2311 | for i in (0 .. count) { |
| 2312 | property := ? |
| 2313 | properties[i] = property |
| 2314 | } |
| 2315 | |
| 2316 | return ? |
| 2317 | } |
| 2318 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2319 | cmd VkResult vkEnumerateDeviceExtensionProperties( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2320 | VkPhysicalDevice physicalDevice, |
| 2321 | const char* pLayerName, |
| 2322 | u32* pCount, |
| 2323 | VkExtensionProperties* pProperties) { |
| 2324 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 2325 | |
| 2326 | count := as!u32(?) |
| 2327 | pCount[0] = count |
| 2328 | |
| 2329 | properties := pProperties[0:count] |
| 2330 | for i in (0 .. count) { |
| 2331 | property := ? |
| 2332 | properties[i] = property |
| 2333 | } |
| 2334 | |
| 2335 | return ? |
| 2336 | } |
| 2337 | |
| 2338 | |
| 2339 | // Queue functions |
| 2340 | |
| 2341 | @threadSafety("system") |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 2342 | cmd void vkGetDeviceQueue( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2343 | VkDevice device, |
| 2344 | u32 queueFamilyIndex, |
| 2345 | u32 queueIndex, |
| 2346 | VkQueue* pQueue) { |
| 2347 | deviceObject := GetDevice(device) |
| 2348 | |
| 2349 | queue := ? |
| 2350 | pQueue[0] = queue |
| 2351 | |
| 2352 | if !(queue in State.Queues) { |
| 2353 | State.Queues[queue] = new!QueueObject(device: device) |
| 2354 | } |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2355 | } |
| 2356 | |
| 2357 | @threadSafety("app") |
| 2358 | cmd VkResult vkQueueSubmit( |
| 2359 | VkQueue queue, |
Jesse Hall | a366a51 | 2015-11-19 22:30:07 -0800 | [diff] [blame^] | 2360 | u32 submitCount, |
| 2361 | const VkSubmitInfo* pSubmitInfo, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2362 | VkFence fence) { |
| 2363 | queueObject := GetQueue(queue) |
| 2364 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2365 | if fence != NULL_HANDLE { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2366 | fenceObject := GetFence(fence) |
| 2367 | assert(fenceObject.device == queueObject.device) |
| 2368 | } |
| 2369 | |
Jesse Hall | a366a51 | 2015-11-19 22:30:07 -0800 | [diff] [blame^] | 2370 | // cmdBuffers := pCmdBuffers[0:cmdBufferCount] |
| 2371 | // for i in (0 .. cmdBufferCount) { |
| 2372 | // cmdBuffer := cmdBuffers[i] |
| 2373 | // cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 2374 | // assert(cmdBufferObject.device == queueObject.device) |
| 2375 | // |
| 2376 | // validate("QueueCheck", cmdBufferObject.queueFlags in queueObject.flags, |
| 2377 | // "vkQueueSubmit: enqueued cmdBuffer requires missing queue capabilities.") |
| 2378 | // } |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2379 | |
| 2380 | return ? |
| 2381 | } |
| 2382 | |
| 2383 | @threadSafety("system") |
| 2384 | cmd VkResult vkQueueWaitIdle( |
| 2385 | VkQueue queue) { |
| 2386 | queueObject := GetQueue(queue) |
| 2387 | |
| 2388 | return ? |
| 2389 | } |
| 2390 | |
| 2391 | @threadSafety("system") |
| 2392 | cmd VkResult vkDeviceWaitIdle( |
| 2393 | VkDevice device) { |
| 2394 | deviceObject := GetDevice(device) |
| 2395 | |
| 2396 | return ? |
| 2397 | } |
| 2398 | |
| 2399 | |
| 2400 | // Memory functions |
| 2401 | |
| 2402 | @threadSafety("system") |
| 2403 | cmd VkResult vkAllocMemory( |
| 2404 | VkDevice device, |
| 2405 | const VkMemoryAllocInfo* pAllocInfo, |
| 2406 | VkDeviceMemory* pMem) { |
| 2407 | assert(pAllocInfo.sType == VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO) |
| 2408 | deviceObject := GetDevice(device) |
| 2409 | |
| 2410 | mem := ? |
| 2411 | pMem[0] = mem |
| 2412 | State.DeviceMemories[mem] = new!DeviceMemoryObject( |
| 2413 | device: device, |
| 2414 | allocationSize: pAllocInfo[0].allocationSize) |
| 2415 | |
| 2416 | return ? |
| 2417 | } |
| 2418 | |
| 2419 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2420 | cmd void vkFreeMemory( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2421 | VkDevice device, |
| 2422 | VkDeviceMemory mem) { |
| 2423 | deviceObject := GetDevice(device) |
| 2424 | memObject := GetDeviceMemory(mem) |
| 2425 | assert(memObject.device == device) |
| 2426 | |
| 2427 | // Check that no objects are still bound before freeing. |
| 2428 | validate("MemoryCheck", len(memObject.boundObjects) == 0, |
| 2429 | "vkFreeMemory: objects still bound") |
| 2430 | validate("MemoryCheck", len(memObject.boundCommandBuffers) == 0, |
| 2431 | "vkFreeMemory: cmdBuffers still bound") |
| 2432 | State.DeviceMemories[mem] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2433 | } |
| 2434 | |
| 2435 | @threadSafety("app") |
| 2436 | cmd VkResult vkMapMemory( |
| 2437 | VkDevice device, |
| 2438 | VkDeviceMemory mem, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2439 | VkDeviceSize offset, |
| 2440 | VkDeviceSize size, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2441 | VkMemoryMapFlags flags, |
| 2442 | void** ppData) { |
| 2443 | deviceObject := GetDevice(device) |
| 2444 | memObject := GetDeviceMemory(mem) |
| 2445 | assert(memObject.device == device) |
| 2446 | |
| 2447 | assert(flags == as!VkMemoryMapFlags(0)) |
| 2448 | assert((offset + size) <= memObject.allocationSize) |
| 2449 | |
| 2450 | return ? |
| 2451 | } |
| 2452 | |
| 2453 | @threadSafety("app") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2454 | cmd void vkUnmapMemory( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2455 | VkDevice device, |
| 2456 | VkDeviceMemory mem) { |
| 2457 | deviceObject := GetDevice(device) |
| 2458 | memObject := GetDeviceMemory(mem) |
| 2459 | assert(memObject.device == device) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2460 | } |
| 2461 | |
| 2462 | cmd VkResult vkFlushMappedMemoryRanges( |
| 2463 | VkDevice device, |
| 2464 | u32 memRangeCount |
| 2465 | const VkMappedMemoryRange* pMemRanges) { |
| 2466 | deviceObject := GetDevice(device) |
| 2467 | |
| 2468 | memRanges := pMemRanges[0:memRangeCount] |
| 2469 | for i in (0 .. memRangeCount) { |
| 2470 | memRange := memRanges[i] |
| 2471 | memObject := GetDeviceMemory(memRange.mem) |
| 2472 | assert(memObject.device == device) |
| 2473 | assert((memRange.offset + memRange.size) <= memObject.allocationSize) |
| 2474 | } |
| 2475 | |
| 2476 | return ? |
| 2477 | } |
| 2478 | |
| 2479 | cmd VkResult vkInvalidateMappedMemoryRanges( |
| 2480 | VkDevice device, |
| 2481 | u32 memRangeCount, |
| 2482 | const VkMappedMemoryRange* pMemRanges) { |
| 2483 | deviceObject := GetDevice(device) |
| 2484 | |
| 2485 | memRanges := pMemRanges[0:memRangeCount] |
| 2486 | for i in (0 .. memRangeCount) { |
| 2487 | memRange := memRanges[i] |
| 2488 | memObject := GetDeviceMemory(memRange.mem) |
| 2489 | assert(memObject.device == device) |
| 2490 | assert((memRange.offset + memRange.size) <= memObject.allocationSize) |
| 2491 | } |
| 2492 | |
| 2493 | return ? |
| 2494 | } |
| 2495 | |
| 2496 | |
| 2497 | // Memory management API functions |
| 2498 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 2499 | cmd void vkGetDeviceMemoryCommitment( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2500 | VkDevice device, |
| 2501 | VkDeviceMemory memory, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2502 | VkDeviceSize* pCommittedMemoryInBytes) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2503 | deviceObject := GetDevice(device) |
| 2504 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2505 | if memory != NULL_HANDLE { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2506 | memoryObject := GetDeviceMemory(memory) |
| 2507 | assert(memoryObject.device == device) |
| 2508 | } |
| 2509 | |
| 2510 | committedMemoryInBytes := ? |
| 2511 | pCommittedMemoryInBytes[0] = committedMemoryInBytes |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2512 | } |
| 2513 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 2514 | cmd void vkGetBufferMemoryRequirements( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2515 | VkDevice device, |
| 2516 | VkBuffer buffer, |
| 2517 | VkMemoryRequirements* pMemoryRequirements) { |
| 2518 | deviceObject := GetDevice(device) |
| 2519 | bufferObject := GetBuffer(buffer) |
| 2520 | assert(bufferObject.device == device) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2521 | } |
| 2522 | |
| 2523 | cmd VkResult vkBindBufferMemory( |
| 2524 | VkDevice device, |
| 2525 | VkBuffer buffer, |
| 2526 | VkDeviceMemory mem, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2527 | VkDeviceSize memOffset) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2528 | deviceObject := GetDevice(device) |
| 2529 | bufferObject := GetBuffer(buffer) |
| 2530 | assert(bufferObject.device == device) |
| 2531 | |
| 2532 | // Unbind buffer from previous memory object, if not VK_NULL_HANDLE. |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2533 | if bufferObject.mem != NULL_HANDLE { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2534 | memObject := GetDeviceMemory(bufferObject.mem) |
| 2535 | memObject.boundObjects[as!u64(buffer)] = null |
| 2536 | } |
| 2537 | |
| 2538 | // Bind buffer to given memory object, if not VK_NULL_HANDLE. |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2539 | if mem != NULL_HANDLE { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2540 | memObject := GetDeviceMemory(mem) |
| 2541 | assert(memObject.device == device) |
| 2542 | memObject.boundObjects[as!u64(buffer)] = memOffset |
| 2543 | } |
| 2544 | bufferObject.mem = mem |
| 2545 | bufferObject.memOffset = memOffset |
| 2546 | |
| 2547 | return ? |
| 2548 | } |
| 2549 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 2550 | cmd void vkGetImageMemoryRequirements( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2551 | VkDevice device, |
| 2552 | VkImage image, |
| 2553 | VkMemoryRequirements* pMemoryRequirements) { |
| 2554 | deviceObject := GetDevice(device) |
| 2555 | imageObject := GetImage(image) |
| 2556 | assert(imageObject.device == device) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2557 | } |
| 2558 | |
| 2559 | cmd VkResult vkBindImageMemory( |
| 2560 | VkDevice device, |
| 2561 | VkImage image, |
| 2562 | VkDeviceMemory mem, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2563 | VkDeviceSize memOffset) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2564 | deviceObject := GetDevice(device) |
| 2565 | imageObject := GetImage(image) |
| 2566 | assert(imageObject.device == device) |
| 2567 | |
| 2568 | // Unbind image from previous memory object, if not VK_NULL_HANDLE. |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2569 | if imageObject.mem != NULL_HANDLE { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2570 | memObject := GetDeviceMemory(imageObject.mem) |
| 2571 | memObject.boundObjects[as!u64(image)] = null |
| 2572 | } |
| 2573 | |
| 2574 | // Bind image to given memory object, if not VK_NULL_HANDLE. |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2575 | if mem != NULL_HANDLE { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2576 | memObject := GetDeviceMemory(mem) |
| 2577 | assert(memObject.device == device) |
| 2578 | memObject.boundObjects[as!u64(image)] = memOffset |
| 2579 | } |
| 2580 | imageObject.mem = mem |
| 2581 | imageObject.memOffset = memOffset |
| 2582 | |
| 2583 | return ? |
| 2584 | } |
| 2585 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 2586 | cmd void vkGetImageSparseMemoryRequirements( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2587 | VkDevice device, |
| 2588 | VkImage image, |
| 2589 | u32* pNumRequirements, |
| 2590 | VkSparseImageMemoryRequirements* pSparseMemoryRequirements) { |
| 2591 | deviceObject := GetDevice(device) |
| 2592 | imageObject := GetImage(image) |
| 2593 | assert(imageObject.device == device) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2594 | } |
| 2595 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 2596 | cmd void vkGetPhysicalDeviceSparseImageFormatProperties( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2597 | VkPhysicalDevice physicalDevice, |
| 2598 | VkFormat format, |
| 2599 | VkImageType type, |
| 2600 | u32 samples, |
| 2601 | VkImageUsageFlags usage, |
| 2602 | VkImageTiling tiling, |
| 2603 | u32* pNumProperties, |
| 2604 | VkSparseImageFormatProperties* pProperties) { |
| 2605 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2606 | } |
| 2607 | |
| 2608 | cmd VkResult vkQueueBindSparseBufferMemory( |
| 2609 | VkQueue queue, |
| 2610 | VkBuffer buffer, |
| 2611 | u32 numBindings, |
| 2612 | const VkSparseMemoryBindInfo* pBindInfo) { |
| 2613 | queueObject := GetQueue(queue) |
| 2614 | bufferObject := GetBuffer(buffer) |
| 2615 | assert(bufferObject.device == queueObject.device) |
| 2616 | |
| 2617 | return ? |
| 2618 | } |
| 2619 | |
| 2620 | cmd VkResult vkQueueBindSparseImageOpaqueMemory( |
| 2621 | VkQueue queue, |
| 2622 | VkImage image, |
| 2623 | u32 numBindings, |
| 2624 | const VkSparseMemoryBindInfo* pBindInfo) { |
| 2625 | queueObject := GetQueue(queue) |
| 2626 | imageObject := GetImage(image) |
| 2627 | assert(imageObject.device == queueObject.device) |
| 2628 | |
| 2629 | return ? |
| 2630 | } |
| 2631 | |
| 2632 | |
| 2633 | cmd VkResult vkQueueBindSparseImageMemory( |
| 2634 | VkQueue queue, |
| 2635 | VkImage image, |
| 2636 | u32 numBindings, |
| 2637 | const VkSparseImageMemoryBindInfo* pBindInfo) { |
| 2638 | queueObject := GetQueue(queue) |
| 2639 | imageObject := GetImage(image) |
| 2640 | |
| 2641 | return ? |
| 2642 | } |
| 2643 | |
| 2644 | |
| 2645 | // Fence functions |
| 2646 | |
| 2647 | @threadSafety("system") |
| 2648 | cmd VkResult vkCreateFence( |
| 2649 | VkDevice device, |
| 2650 | const VkFenceCreateInfo* pCreateInfo, |
| 2651 | VkFence* pFence) { |
| 2652 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO) |
| 2653 | deviceObject := GetDevice(device) |
| 2654 | |
| 2655 | fence := ? |
| 2656 | pFence[0] = fence |
| 2657 | State.Fences[fence] = new!FenceObject( |
| 2658 | device: device, signaled: (pCreateInfo.flags == VK_FENCE_CREATE_SIGNALED_BIT)) |
| 2659 | |
| 2660 | return ? |
| 2661 | } |
| 2662 | |
| 2663 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2664 | cmd void vkDestroyFence( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2665 | VkDevice device, |
| 2666 | VkFence fence) { |
| 2667 | deviceObject := GetDevice(device) |
| 2668 | fenceObject := GetFence(fence) |
| 2669 | assert(fenceObject.device == device) |
| 2670 | |
| 2671 | State.Fences[fence] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2672 | } |
| 2673 | |
| 2674 | @threadSafety("system") |
| 2675 | cmd VkResult vkResetFences( |
| 2676 | VkDevice device, |
| 2677 | u32 fenceCount, |
| 2678 | const VkFence* pFences) { |
| 2679 | deviceObject := GetDevice(device) |
| 2680 | |
| 2681 | fences := pFences[0:fenceCount] |
| 2682 | for i in (0 .. fenceCount) { |
| 2683 | fence := fences[i] |
| 2684 | fenceObject := GetFence(fence) |
| 2685 | assert(fenceObject.device == device) |
| 2686 | fenceObject.signaled = false |
| 2687 | } |
| 2688 | |
| 2689 | return ? |
| 2690 | } |
| 2691 | |
| 2692 | @threadSafety("system") |
| 2693 | cmd VkResult vkGetFenceStatus( |
| 2694 | VkDevice device, |
| 2695 | VkFence fence) { |
| 2696 | deviceObject := GetDevice(device) |
| 2697 | fenceObject := GetFence(fence) |
| 2698 | assert(fenceObject.device == device) |
| 2699 | |
| 2700 | return ? |
| 2701 | } |
| 2702 | |
| 2703 | @threadSafety("system") |
| 2704 | cmd VkResult vkWaitForFences( |
| 2705 | VkDevice device, |
| 2706 | u32 fenceCount, |
| 2707 | const VkFence* pFences, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2708 | VkBool32 waitAll, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2709 | u64 timeout) { /// timeout in nanoseconds |
| 2710 | deviceObject := GetDevice(device) |
| 2711 | |
| 2712 | fences := pFences[0:fenceCount] |
| 2713 | for i in (0 .. fenceCount) { |
| 2714 | fence := fences[i] |
| 2715 | fenceObject := GetFence(fence) |
| 2716 | assert(fenceObject.device == device) |
| 2717 | } |
| 2718 | |
| 2719 | return ? |
| 2720 | } |
| 2721 | |
| 2722 | |
| 2723 | // Queue semaphore functions |
| 2724 | |
| 2725 | @threadSafety("system") |
| 2726 | cmd VkResult vkCreateSemaphore( |
| 2727 | VkDevice device, |
| 2728 | const VkSemaphoreCreateInfo* pCreateInfo, |
| 2729 | VkSemaphore* pSemaphore) { |
| 2730 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO) |
| 2731 | deviceObject := GetDevice(device) |
| 2732 | |
| 2733 | semaphore := ? |
| 2734 | pSemaphore[0] = semaphore |
| 2735 | State.Semaphores[semaphore] = new!SemaphoreObject(device: device) |
| 2736 | |
| 2737 | return ? |
| 2738 | } |
| 2739 | |
| 2740 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2741 | cmd void vkDestroySemaphore( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2742 | VkDevice device, |
| 2743 | VkSemaphore semaphore) { |
| 2744 | deviceObject := GetDevice(device) |
| 2745 | semaphoreObject := GetSemaphore(semaphore) |
| 2746 | assert(semaphoreObject.device == device) |
| 2747 | |
| 2748 | State.Semaphores[semaphore] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2749 | } |
| 2750 | |
| 2751 | @threadSafety("app") |
| 2752 | cmd VkResult vkQueueSignalSemaphore( |
| 2753 | VkQueue queue, |
| 2754 | VkSemaphore semaphore) { |
| 2755 | queueObject := GetQueue(queue) |
| 2756 | semaphoreObject := GetSemaphore(semaphore) |
| 2757 | assert(queueObject.device == semaphoreObject.device) |
| 2758 | |
| 2759 | return ? |
| 2760 | } |
| 2761 | |
| 2762 | @threadSafety("system") |
| 2763 | cmd VkResult vkQueueWaitSemaphore( |
| 2764 | VkQueue queue, |
| 2765 | VkSemaphore semaphore) { |
| 2766 | queueObject := GetQueue(queue) |
| 2767 | semaphoreObject := GetSemaphore(semaphore) |
| 2768 | assert(queueObject.device == semaphoreObject.device) |
| 2769 | |
| 2770 | return ? |
| 2771 | } |
| 2772 | |
| 2773 | |
| 2774 | // Event functions |
| 2775 | |
| 2776 | @threadSafety("system") |
| 2777 | cmd VkResult vkCreateEvent( |
| 2778 | VkDevice device, |
| 2779 | const VkEventCreateInfo* pCreateInfo, |
| 2780 | VkEvent* pEvent) { |
| 2781 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO) |
| 2782 | deviceObject := GetDevice(device) |
| 2783 | |
| 2784 | event := ? |
| 2785 | pEvent[0] = event |
| 2786 | State.Events[event] = new!EventObject(device: device) |
| 2787 | |
| 2788 | return ? |
| 2789 | } |
| 2790 | |
| 2791 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2792 | cmd void vkDestroyEvent( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2793 | VkDevice device, |
| 2794 | VkEvent event) { |
| 2795 | deviceObject := GetDevice(device) |
| 2796 | eventObject := GetEvent(event) |
| 2797 | assert(eventObject.device == device) |
| 2798 | |
| 2799 | State.Events[event] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2800 | } |
| 2801 | |
| 2802 | @threadSafety("system") |
| 2803 | cmd VkResult vkGetEventStatus( |
| 2804 | VkDevice device, |
| 2805 | VkEvent event) { |
| 2806 | deviceObject := GetDevice(device) |
| 2807 | eventObject := GetEvent(event) |
| 2808 | assert(eventObject.device == device) |
| 2809 | |
| 2810 | return ? |
| 2811 | } |
| 2812 | |
| 2813 | @threadSafety("system") |
| 2814 | cmd VkResult vkSetEvent( |
| 2815 | VkDevice device, |
| 2816 | VkEvent event) { |
| 2817 | deviceObject := GetDevice(device) |
| 2818 | eventObject := GetEvent(event) |
| 2819 | assert(eventObject.device == device) |
| 2820 | |
| 2821 | return ? |
| 2822 | } |
| 2823 | |
| 2824 | @threadSafety("system") |
| 2825 | cmd VkResult vkResetEvent( |
| 2826 | VkDevice device, |
| 2827 | VkEvent event) { |
| 2828 | deviceObject := GetDevice(device) |
| 2829 | eventObject := GetEvent(event) |
| 2830 | assert(eventObject.device == device) |
| 2831 | |
| 2832 | return ? |
| 2833 | } |
| 2834 | |
| 2835 | |
| 2836 | // Query functions |
| 2837 | |
| 2838 | @threadSafety("system") |
| 2839 | cmd VkResult vkCreateQueryPool( |
| 2840 | VkDevice device, |
| 2841 | const VkQueryPoolCreateInfo* pCreateInfo, |
| 2842 | VkQueryPool* pQueryPool) { |
| 2843 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO) |
| 2844 | deviceObject := GetDevice(device) |
| 2845 | |
| 2846 | queryPool := ? |
| 2847 | pQueryPool[0] = queryPool |
| 2848 | State.QueryPools[queryPool] = new!QueryPoolObject(device: device) |
| 2849 | |
| 2850 | return ? |
| 2851 | } |
| 2852 | |
| 2853 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2854 | cmd void vkDestroyQueryPool( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2855 | VkDevice device, |
| 2856 | VkQueryPool queryPool) { |
| 2857 | deviceObject := GetDevice(device) |
| 2858 | queryPoolObject := GetQueryPool(queryPool) |
| 2859 | assert(queryPoolObject.device == device) |
| 2860 | |
| 2861 | State.QueryPools[queryPool] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2862 | } |
| 2863 | |
| 2864 | @threadSafety("system") |
| 2865 | cmd VkResult vkGetQueryPoolResults( |
| 2866 | VkDevice device, |
| 2867 | VkQueryPool queryPool, |
| 2868 | u32 startQuery, |
| 2869 | u32 queryCount, |
| 2870 | platform.size_t* pDataSize, |
| 2871 | void* pData, |
| 2872 | VkQueryResultFlags flags) { |
| 2873 | deviceObject := GetDevice(device) |
| 2874 | queryPoolObject := GetQueryPool(queryPool) |
| 2875 | assert(queryPoolObject.device == device) |
| 2876 | |
| 2877 | dataSize := ? |
| 2878 | pDataSize[0] = dataSize |
| 2879 | data := pData[0:dataSize] |
| 2880 | |
| 2881 | return ? |
| 2882 | } |
| 2883 | |
| 2884 | // Buffer functions |
| 2885 | |
| 2886 | @threadSafety("system") |
| 2887 | cmd VkResult vkCreateBuffer( |
| 2888 | VkDevice device, |
| 2889 | const VkBufferCreateInfo* pCreateInfo, |
| 2890 | VkBuffer* pBuffer) { |
| 2891 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO) |
| 2892 | deviceObject := GetDevice(device) |
| 2893 | |
| 2894 | buffer := ? |
| 2895 | pBuffer[0] = buffer |
| 2896 | State.Buffers[buffer] = new!BufferObject(device: device) |
| 2897 | |
| 2898 | return ? |
| 2899 | } |
| 2900 | |
| 2901 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2902 | cmd void vkDestroyBuffer( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2903 | VkDevice device, |
| 2904 | VkBuffer buffer) { |
| 2905 | deviceObject := GetDevice(device) |
| 2906 | bufferObject := GetBuffer(buffer) |
| 2907 | assert(bufferObject.device == device) |
| 2908 | |
| 2909 | assert(bufferObject.mem == 0) |
| 2910 | State.Buffers[buffer] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2911 | } |
| 2912 | |
| 2913 | |
| 2914 | // Buffer view functions |
| 2915 | |
| 2916 | @threadSafety("system") |
| 2917 | cmd VkResult vkCreateBufferView( |
| 2918 | VkDevice device, |
| 2919 | const VkBufferViewCreateInfo* pCreateInfo, |
| 2920 | VkBufferView* pView) { |
| 2921 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO) |
| 2922 | deviceObject := GetDevice(device) |
| 2923 | |
| 2924 | bufferObject := GetBuffer(pCreateInfo.buffer) |
| 2925 | assert(bufferObject.device == device) |
| 2926 | |
| 2927 | view := ? |
| 2928 | pView[0] = view |
| 2929 | State.BufferViews[view] = new!BufferViewObject(device: device, buffer: pCreateInfo.buffer) |
| 2930 | |
| 2931 | return ? |
| 2932 | } |
| 2933 | |
| 2934 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2935 | cmd void vkDestroyBufferView( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2936 | VkDevice device, |
| 2937 | VkBufferView bufferView) { |
| 2938 | deviceObject := GetDevice(device) |
| 2939 | bufferViewObject := GetBufferView(bufferView) |
| 2940 | assert(bufferViewObject.device == device) |
| 2941 | |
| 2942 | State.BufferViews[bufferView] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2943 | } |
| 2944 | |
| 2945 | |
| 2946 | // Image functions |
| 2947 | |
| 2948 | @threadSafety("system") |
| 2949 | cmd VkResult vkCreateImage( |
| 2950 | VkDevice device, |
| 2951 | const VkImageCreateInfo* pCreateInfo, |
| 2952 | VkImage* pImage) { |
| 2953 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO) |
| 2954 | deviceObject := GetDevice(device) |
| 2955 | |
| 2956 | image := ? |
| 2957 | pImage[0] = image |
| 2958 | State.Images[image] = new!ImageObject(device: device) |
| 2959 | |
| 2960 | return ? |
| 2961 | } |
| 2962 | |
| 2963 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 2964 | cmd void vkDestroyImage( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2965 | VkDevice device, |
| 2966 | VkImage image) { |
| 2967 | deviceObject := GetDevice(device) |
| 2968 | imageObject := GetImage(image) |
| 2969 | assert(imageObject.device == device) |
| 2970 | |
| 2971 | assert(imageObject.mem == 0) |
| 2972 | State.Images[image] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2973 | } |
| 2974 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 2975 | cmd void vkGetImageSubresourceLayout( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2976 | VkDevice device, |
| 2977 | VkImage image, |
| 2978 | const VkImageSubresource* pSubresource, |
| 2979 | VkSubresourceLayout* pLayout) { |
| 2980 | deviceObject := GetDevice(device) |
| 2981 | imageObject := GetImage(image) |
| 2982 | assert(imageObject.device == device) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 2983 | } |
| 2984 | |
| 2985 | |
| 2986 | // Image view functions |
| 2987 | |
| 2988 | @threadSafety("system") |
| 2989 | cmd VkResult vkCreateImageView( |
| 2990 | VkDevice device, |
| 2991 | const VkImageViewCreateInfo* pCreateInfo, |
| 2992 | VkImageView* pView) { |
| 2993 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO) |
| 2994 | deviceObject := GetDevice(device) |
| 2995 | |
| 2996 | imageObject := GetImage(pCreateInfo.image) |
| 2997 | assert(imageObject.device == device) |
| 2998 | |
| 2999 | view := ? |
| 3000 | pView[0] = view |
| 3001 | State.ImageViews[view] = new!ImageViewObject(device: device, image: pCreateInfo.image) |
| 3002 | |
| 3003 | return ? |
| 3004 | } |
| 3005 | |
| 3006 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3007 | cmd void vkDestroyImageView( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3008 | VkDevice device, |
| 3009 | VkImageView imageView) { |
| 3010 | deviceObject := GetDevice(device) |
| 3011 | imageViewObject := GetImageView(imageView) |
| 3012 | assert(imageViewObject.device == device) |
| 3013 | |
| 3014 | State.ImageViews[imageView] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3015 | } |
| 3016 | |
| 3017 | |
| 3018 | // Shader functions |
| 3019 | |
| 3020 | cmd VkResult vkCreateShaderModule( |
| 3021 | VkDevice device, |
| 3022 | const VkShaderModuleCreateInfo* pCreateInfo, |
| 3023 | VkShaderModule* pShaderModule) { |
| 3024 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO) |
| 3025 | deviceObject := GetDevice(device) |
| 3026 | |
| 3027 | shaderModule := ? |
| 3028 | pShaderModule[0] = shaderModule |
| 3029 | State.ShaderModules[shaderModule] = new!ShaderModuleObject(device: device) |
| 3030 | |
| 3031 | return ? |
| 3032 | } |
| 3033 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3034 | cmd void vkDestroyShaderModule( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3035 | VkDevice device, |
| 3036 | VkShaderModule shaderModule) { |
| 3037 | deviceObject := GetDevice(device) |
| 3038 | shaderModuleObject := GetShaderModule(shaderModule) |
| 3039 | assert(shaderModuleObject.device == device) |
| 3040 | |
| 3041 | State.ShaderModules[shaderModule] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3042 | } |
| 3043 | |
| 3044 | @threadSafety("system") |
| 3045 | cmd VkResult vkCreateShader( |
| 3046 | VkDevice device, |
| 3047 | const VkShaderCreateInfo* pCreateInfo, |
| 3048 | VkShader* pShader) { |
| 3049 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO) |
| 3050 | deviceObject := GetDevice(device) |
| 3051 | |
| 3052 | shader := ? |
| 3053 | pShader[0] = shader |
| 3054 | State.Shaders[shader] = new!ShaderObject(device: device) |
| 3055 | |
| 3056 | return ? |
| 3057 | } |
| 3058 | |
| 3059 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3060 | cmd void vkDestroyShader( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3061 | VkDevice device, |
| 3062 | VkShader shader) { |
| 3063 | deviceObject := GetDevice(device) |
| 3064 | shaderObject := GetShader(shader) |
| 3065 | assert(shaderObject.device == device) |
| 3066 | |
| 3067 | State.Shaders[shader] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3068 | } |
| 3069 | |
| 3070 | |
| 3071 | // Pipeline functions |
| 3072 | |
| 3073 | cmd VkResult vkCreatePipelineCache( |
| 3074 | VkDevice device, |
| 3075 | const VkPipelineCacheCreateInfo* pCreateInfo, |
| 3076 | VkPipelineCache* pPipelineCache) { |
| 3077 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO) |
| 3078 | deviceObject := GetDevice(device) |
| 3079 | |
| 3080 | pipelineCache := ? |
| 3081 | pPipelineCache[0] = pipelineCache |
| 3082 | State.PipelineCaches[pipelineCache] = new!PipelineCacheObject(device: device) |
| 3083 | |
| 3084 | return ? |
| 3085 | } |
| 3086 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3087 | cmd void vkDestroyPipelineCache( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3088 | VkDevice device, |
| 3089 | VkPipelineCache pipelineCache) { |
| 3090 | deviceObject := GetDevice(device) |
| 3091 | pipelineCacheObject := GetPipelineCache(pipelineCache) |
| 3092 | assert(pipelineCacheObject.device == device) |
| 3093 | |
| 3094 | State.PipelineCaches[pipelineCache] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3095 | } |
| 3096 | |
| 3097 | cmd platform.size_t vkGetPipelineCacheSize( |
| 3098 | VkDevice device, |
| 3099 | VkPipelineCache pipelineCache) { |
| 3100 | deviceObject := GetDevice(device) |
| 3101 | pipelineCacheObject := GetPipelineCache(pipelineCache) |
| 3102 | assert(pipelineCacheObject.device == device) |
| 3103 | |
| 3104 | return ? |
| 3105 | } |
| 3106 | |
| 3107 | cmd VkResult vkGetPipelineCacheData( |
| 3108 | VkDevice device, |
| 3109 | VkPipelineCache pipelineCache, |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 3110 | platform.size_t dataSize, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3111 | void* pData) { |
| 3112 | deviceObject := GetDevice(device) |
| 3113 | pipelineCacheObject := GetPipelineCache(pipelineCache) |
| 3114 | assert(pipelineCacheObject.device == device) |
| 3115 | |
| 3116 | return ? |
| 3117 | } |
| 3118 | |
| 3119 | cmd VkResult vkMergePipelineCaches( |
| 3120 | VkDevice device, |
| 3121 | VkPipelineCache destCache, |
| 3122 | u32 srcCacheCount, |
| 3123 | const VkPipelineCache* pSrcCaches) { |
| 3124 | deviceObject := GetDevice(device) |
| 3125 | destCacheObject := GetPipelineCache(destCache) |
| 3126 | assert(destCacheObject.device == device) |
| 3127 | |
| 3128 | srcCaches := pSrcCaches[0:srcCacheCount] |
| 3129 | for i in (0 .. srcCacheCount) { |
| 3130 | srcCache := srcCaches[i] |
| 3131 | srcCacheObject := GetPipelineCache(srcCache) |
| 3132 | assert(srcCacheObject.device == device) |
| 3133 | } |
| 3134 | |
| 3135 | return ? |
| 3136 | } |
| 3137 | |
| 3138 | cmd VkResult vkCreateGraphicsPipelines( |
| 3139 | VkDevice device, |
| 3140 | VkPipelineCache pipelineCache, |
| 3141 | u32 count, |
| 3142 | const VkGraphicsPipelineCreateInfo* pCreateInfos, |
| 3143 | VkPipeline* pPipelines) { |
| 3144 | deviceObject := GetDevice(device) |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3145 | if pipelineCache != NULL_HANDLE { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3146 | pipelineCacheObject := GetPipelineCache(pipelineCache) |
| 3147 | assert(pipelineCacheObject.device == device) |
| 3148 | } |
| 3149 | |
| 3150 | createInfos := pCreateInfos[0:count] |
| 3151 | pipelines := pPipelines[0:count] |
| 3152 | for i in (0 .. count) { |
| 3153 | pipeline := ? |
| 3154 | pipelines[i] = pipeline |
| 3155 | State.Pipelines[pipeline] = new!PipelineObject(device: device) |
| 3156 | } |
| 3157 | |
| 3158 | return ? |
| 3159 | } |
| 3160 | |
| 3161 | cmd VkResult vkCreateComputePipelines( |
| 3162 | VkDevice device, |
| 3163 | VkPipelineCache pipelineCache, |
| 3164 | u32 count, |
| 3165 | const VkComputePipelineCreateInfo* pCreateInfos, |
| 3166 | VkPipeline* pPipelines) { |
| 3167 | deviceObject := GetDevice(device) |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3168 | if pipelineCache != NULL_HANDLE { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3169 | pipelineCacheObject := GetPipelineCache(pipelineCache) |
| 3170 | assert(pipelineCacheObject.device == device) |
| 3171 | } |
| 3172 | |
| 3173 | createInfos := pCreateInfos[0:count] |
| 3174 | pipelines := pPipelines[0:count] |
| 3175 | for i in (0 .. count) { |
| 3176 | pipeline := ? |
| 3177 | pipelines[i] = pipeline |
| 3178 | State.Pipelines[pipeline] = new!PipelineObject(device: device) |
| 3179 | } |
| 3180 | |
| 3181 | return ? |
| 3182 | } |
| 3183 | |
| 3184 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3185 | cmd void vkDestroyPipeline( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3186 | VkDevice device, |
| 3187 | VkPipeline pipeline) { |
| 3188 | deviceObject := GetDevice(device) |
| 3189 | pipelineObjects := GetPipeline(pipeline) |
| 3190 | assert(pipelineObjects.device == device) |
| 3191 | |
| 3192 | State.Pipelines[pipeline] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3193 | } |
| 3194 | |
| 3195 | |
| 3196 | // Pipeline layout functions |
| 3197 | |
| 3198 | @threadSafety("system") |
| 3199 | cmd VkResult vkCreatePipelineLayout( |
| 3200 | VkDevice device, |
| 3201 | const VkPipelineLayoutCreateInfo* pCreateInfo, |
| 3202 | VkPipelineLayout* pPipelineLayout) { |
| 3203 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO) |
| 3204 | deviceObject := GetDevice(device) |
| 3205 | |
| 3206 | pipelineLayout := ? |
| 3207 | pPipelineLayout[0] = pipelineLayout |
| 3208 | State.PipelineLayouts[pipelineLayout] = new!PipelineLayoutObject(device: device) |
| 3209 | |
| 3210 | return ? |
| 3211 | } |
| 3212 | |
| 3213 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3214 | cmd void vkDestroyPipelineLayout( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3215 | VkDevice device, |
| 3216 | VkPipelineLayout pipelineLayout) { |
| 3217 | deviceObject := GetDevice(device) |
| 3218 | pipelineLayoutObjects := GetPipelineLayout(pipelineLayout) |
| 3219 | assert(pipelineLayoutObjects.device == device) |
| 3220 | |
| 3221 | State.PipelineLayouts[pipelineLayout] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3222 | } |
| 3223 | |
| 3224 | |
| 3225 | // Sampler functions |
| 3226 | |
| 3227 | @threadSafety("system") |
| 3228 | cmd VkResult vkCreateSampler( |
| 3229 | VkDevice device, |
| 3230 | const VkSamplerCreateInfo* pCreateInfo, |
| 3231 | VkSampler* pSampler) { |
| 3232 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO) |
| 3233 | deviceObject := GetDevice(device) |
| 3234 | |
| 3235 | sampler := ? |
| 3236 | pSampler[0] = sampler |
| 3237 | State.Samplers[sampler] = new!SamplerObject(device: device) |
| 3238 | |
| 3239 | return ? |
| 3240 | } |
| 3241 | |
| 3242 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3243 | cmd void vkDestroySampler( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3244 | VkDevice device, |
| 3245 | VkSampler sampler) { |
| 3246 | deviceObject := GetDevice(device) |
| 3247 | samplerObject := GetSampler(sampler) |
| 3248 | assert(samplerObject.device == device) |
| 3249 | |
| 3250 | State.Samplers[sampler] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3251 | } |
| 3252 | |
| 3253 | |
| 3254 | // Descriptor set functions |
| 3255 | |
| 3256 | @threadSafety("system") |
| 3257 | cmd VkResult vkCreateDescriptorSetLayout( |
| 3258 | VkDevice device, |
| 3259 | const VkDescriptorSetLayoutCreateInfo* pCreateInfo, |
| 3260 | VkDescriptorSetLayout* pSetLayout) { |
| 3261 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO) |
| 3262 | deviceObject := GetDevice(device) |
| 3263 | |
| 3264 | setLayout := ? |
| 3265 | pSetLayout[0] = setLayout |
| 3266 | State.DescriptorSetLayouts[setLayout] = new!DescriptorSetLayoutObject(device: device) |
| 3267 | |
| 3268 | return ? |
| 3269 | } |
| 3270 | |
| 3271 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3272 | cmd void vkDestroyDescriptorSetLayout( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3273 | VkDevice device, |
| 3274 | VkDescriptorSetLayout descriptorSetLayout) { |
| 3275 | deviceObject := GetDevice(device) |
| 3276 | descriptorSetLayoutObject := GetDescriptorSetLayout(descriptorSetLayout) |
| 3277 | assert(descriptorSetLayoutObject.device == device) |
| 3278 | |
| 3279 | State.DescriptorSetLayouts[descriptorSetLayout] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3280 | } |
| 3281 | |
| 3282 | @threadSafety("system") |
| 3283 | cmd VkResult vkCreateDescriptorPool( |
| 3284 | VkDevice device, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3285 | const VkDescriptorPoolCreateInfo* pCreateInfo |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3286 | VkDescriptorPool* pDescriptorPool) { |
| 3287 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO) |
| 3288 | deviceObject := GetDevice(device) |
| 3289 | |
| 3290 | descriptorPool := ? |
| 3291 | pDescriptorPool[0] = descriptorPool |
| 3292 | State.DescriptorPools[descriptorPool] = new!DescriptorPoolObject(device: device) |
| 3293 | |
| 3294 | return ? |
| 3295 | } |
| 3296 | |
| 3297 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3298 | cmd void vkDestroyDescriptorPool( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3299 | VkDevice device, |
| 3300 | VkDescriptorPool descriptorPool) { |
| 3301 | deviceObject := GetDevice(device) |
| 3302 | descriptorPoolObject := GetDescriptorPool(descriptorPool) |
| 3303 | assert(descriptorPoolObject.device == device) |
| 3304 | |
| 3305 | State.DescriptorPools[descriptorPool] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3306 | } |
| 3307 | |
| 3308 | @threadSafety("app") |
| 3309 | cmd VkResult vkResetDescriptorPool( |
| 3310 | VkDevice device, |
| 3311 | VkDescriptorPool descriptorPool) { |
| 3312 | deviceObject := GetDevice(device) |
| 3313 | descriptorPoolObject := GetDescriptorPool(descriptorPool) |
| 3314 | assert(descriptorPoolObject.device == device) |
| 3315 | |
| 3316 | return ? |
| 3317 | } |
| 3318 | |
| 3319 | @threadSafety("app") |
| 3320 | cmd VkResult vkAllocDescriptorSets( |
| 3321 | VkDevice device, |
| 3322 | VkDescriptorPool descriptorPool, |
| 3323 | VkDescriptorSetUsage setUsage, |
| 3324 | u32 count, |
| 3325 | const VkDescriptorSetLayout* pSetLayouts, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3326 | VkDescriptorSet* pDescriptorSets) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3327 | deviceObject := GetDevice(device) |
| 3328 | descriptorPoolObject := GetDescriptorPool(descriptorPool) |
| 3329 | |
| 3330 | setLayouts := pSetLayouts[0:count] |
| 3331 | for i in (0 .. count) { |
| 3332 | setLayout := setLayouts[i] |
| 3333 | setLayoutObject := GetDescriptorSetLayout(setLayout) |
| 3334 | assert(setLayoutObject.device == device) |
| 3335 | } |
| 3336 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3337 | descriptorSets := pDescriptorSets[0:count] |
| 3338 | for i in (0 .. count) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3339 | descriptorSet := ? |
| 3340 | descriptorSets[i] = descriptorSet |
| 3341 | State.DescriptorSets[descriptorSet] = new!DescriptorSetObject(device: device) |
| 3342 | } |
| 3343 | |
| 3344 | return ? |
| 3345 | } |
| 3346 | |
Jesse Hall | f09c6b1 | 2015-08-15 19:54:28 -0700 | [diff] [blame] | 3347 | cmd VkResult vkFreeDescriptorSets( |
| 3348 | VkDevice device, |
| 3349 | VkDescriptorPool descriptorPool, |
| 3350 | u32 count, |
| 3351 | const VkDescriptorSet* pDescriptorSets) { |
| 3352 | deviceObject := GetDevice(device) |
| 3353 | descriptorPoolObject := GetDescriptorPool(descriptorPool) |
| 3354 | |
| 3355 | descriptorSets := pDescriptorSets[0:count] |
| 3356 | for i in (0 .. count) { |
| 3357 | descriptorSet := descriptorSets[i] |
| 3358 | descriptorSetObject := GetDescriptorSet(descriptorSet) |
| 3359 | assert(descriptorSetObject.device == device) |
| 3360 | State.DescriptorSets[descriptorSet] = null |
| 3361 | } |
| 3362 | |
| 3363 | return ? |
| 3364 | } |
| 3365 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3366 | cmd void vkUpdateDescriptorSets( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3367 | VkDevice device, |
| 3368 | u32 writeCount, |
| 3369 | const VkWriteDescriptorSet* pDescriptorWrites, |
| 3370 | u32 copyCount, |
| 3371 | const VkCopyDescriptorSet* pDescriptorCopies) { |
| 3372 | deviceObject := GetDevice(device) |
| 3373 | |
| 3374 | descriptorWrites := pDescriptorWrites[0:writeCount] |
| 3375 | for i in (0 .. writeCount) { |
| 3376 | descriptorWrite := descriptorWrites[i] |
| 3377 | descriptorWriteObject := GetDescriptorSet(descriptorWrite.destSet) |
| 3378 | assert(descriptorWriteObject.device == device) |
| 3379 | } |
| 3380 | |
| 3381 | descriptorCopies := pDescriptorCopies[0:copyCount] |
| 3382 | for i in (0 .. copyCount) { |
| 3383 | descriptorCopy := descriptorCopies[i] |
| 3384 | descriptorCopyObject := GetDescriptorSet(descriptorCopy.destSet) |
| 3385 | assert(descriptorCopyObject.device == device) |
| 3386 | } |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3387 | } |
| 3388 | |
| 3389 | |
| 3390 | // Framebuffer functions |
| 3391 | |
| 3392 | @threadSafety("system") |
| 3393 | cmd VkResult vkCreateFramebuffer( |
| 3394 | VkDevice device, |
| 3395 | const VkFramebufferCreateInfo* pCreateInfo, |
| 3396 | VkFramebuffer* pFramebuffer) { |
| 3397 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO) |
| 3398 | deviceObject := GetDevice(device) |
| 3399 | |
| 3400 | framebuffer := ? |
| 3401 | pFramebuffer[0] = framebuffer |
| 3402 | State.Framebuffers[framebuffer] = new!FramebufferObject(device: device) |
| 3403 | |
| 3404 | return ? |
| 3405 | } |
| 3406 | |
| 3407 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3408 | cmd void vkDestroyFramebuffer( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3409 | VkDevice device, |
| 3410 | VkFramebuffer framebuffer) { |
| 3411 | deviceObject := GetDevice(device) |
| 3412 | framebufferObject := GetFramebuffer(framebuffer) |
| 3413 | assert(framebufferObject.device == device) |
| 3414 | |
| 3415 | State.Framebuffers[framebuffer] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3416 | } |
| 3417 | |
| 3418 | |
| 3419 | // Renderpass functions |
| 3420 | |
| 3421 | @threadSafety("system") |
| 3422 | cmd VkResult vkCreateRenderPass( |
| 3423 | VkDevice device, |
| 3424 | const VkRenderPassCreateInfo* pCreateInfo, |
| 3425 | VkRenderPass* pRenderPass) { |
| 3426 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO) |
| 3427 | deviceObject := GetDevice(device) |
| 3428 | |
| 3429 | renderpass := ? |
| 3430 | pRenderPass[0] = renderpass |
| 3431 | State.RenderPasses[renderpass] = new!RenderPassObject(device: device) |
| 3432 | |
| 3433 | return ? |
| 3434 | } |
| 3435 | |
| 3436 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3437 | cmd void vkDestroyRenderPass( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3438 | VkDevice device, |
| 3439 | VkRenderPass renderPass) { |
| 3440 | deviceObject := GetDevice(device) |
| 3441 | renderPassObject := GetRenderPass(renderPass) |
| 3442 | assert(renderPassObject.device == device) |
| 3443 | |
| 3444 | State.RenderPasses[renderPass] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3445 | } |
| 3446 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 3447 | cmd void vkGetRenderAreaGranularity( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3448 | VkDevice device, |
| 3449 | VkRenderPass renderPass, |
| 3450 | VkExtent2D* pGranularity) { |
| 3451 | deviceObject := GetDevice(device) |
| 3452 | renderPassObject := GetRenderPass(renderPass) |
| 3453 | |
| 3454 | granularity := ? |
| 3455 | pGranularity[0] = granularity |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3456 | } |
| 3457 | |
| 3458 | // Command pool functions |
| 3459 | |
| 3460 | cmd VkResult vkCreateCommandPool( |
| 3461 | VkDevice device, |
| 3462 | const VkCmdPoolCreateInfo* pCreateInfo, |
| 3463 | VkCmdPool* pCmdPool) { |
| 3464 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO) |
| 3465 | deviceObject := GetDevice(device) |
| 3466 | |
| 3467 | cmdPool := ? |
| 3468 | pCmdPool[0] = cmdPool |
| 3469 | State.CmdPools[cmdPool] = new!CmdPoolObject(device: device) |
| 3470 | |
| 3471 | return ? |
| 3472 | } |
| 3473 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3474 | cmd void vkDestroyCommandPool( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3475 | VkDevice device, |
| 3476 | VkCmdPool cmdPool) { |
| 3477 | deviceObject := GetDevice(device) |
| 3478 | cmdPoolObject := GetCmdPool(cmdPool) |
| 3479 | assert(cmdPoolObject.device == device) |
| 3480 | |
| 3481 | State.CmdPools[cmdPool] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3482 | } |
| 3483 | |
| 3484 | cmd VkResult vkResetCommandPool( |
| 3485 | VkDevice device, |
| 3486 | VkCmdPool cmdPool, |
| 3487 | VkCmdPoolResetFlags flags) { |
| 3488 | deviceObject := GetDevice(device) |
| 3489 | cmdPoolObject := GetCmdPool(cmdPool) |
| 3490 | assert(cmdPoolObject.device == device) |
| 3491 | |
| 3492 | return ? |
| 3493 | } |
| 3494 | |
| 3495 | // Command buffer functions |
| 3496 | |
| 3497 | macro void bindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) { |
| 3498 | memoryObject := GetDeviceMemory(mem) |
| 3499 | memoryObject.boundCommandBuffers[cmdBuffer] = cmdBuffer |
| 3500 | |
| 3501 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3502 | cmdBufferObject.boundObjects[as!u64(obj)] = mem |
| 3503 | } |
| 3504 | |
| 3505 | macro void unbindCmdBuffer(VkCmdBuffer cmdBuffer, any obj, VkDeviceMemory mem) { |
| 3506 | memoryObject := GetDeviceMemory(mem) |
| 3507 | memoryObject.boundCommandBuffers[cmdBuffer] = null |
| 3508 | |
| 3509 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3510 | cmdBufferObject.boundObjects[as!u64(obj)] = null |
| 3511 | } |
| 3512 | |
| 3513 | @threadSafety("system") |
| 3514 | cmd VkResult vkCreateCommandBuffer( |
| 3515 | VkDevice device, |
| 3516 | const VkCmdBufferCreateInfo* pCreateInfo, |
| 3517 | VkCmdBuffer* pCmdBuffer) { |
| 3518 | assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO) |
| 3519 | |
| 3520 | cmdBuffer := ? |
| 3521 | pCmdBuffer[0] = cmdBuffer |
| 3522 | State.CmdBuffers[cmdBuffer] = new!CmdBufferObject(device: device) |
| 3523 | |
| 3524 | return ? |
| 3525 | } |
| 3526 | |
| 3527 | @threadSafety("system") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3528 | cmd void vkDestroyCommandBuffer( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3529 | VkDevice device, |
| 3530 | VkCmdBuffer commandBuffer) { |
| 3531 | deviceObject := GetDevice(device) |
| 3532 | cmdBufferObject := GetCmdBuffer(commandBuffer) |
| 3533 | assert(cmdBufferObject.device == device) |
| 3534 | |
| 3535 | // TODO: iterate over boundObjects and clear memory bindings |
| 3536 | State.CmdBuffers[commandBuffer] = null |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3537 | } |
| 3538 | |
| 3539 | @threadSafety("app") |
| 3540 | cmd VkResult vkBeginCommandBuffer( |
| 3541 | VkCmdBuffer cmdBuffer, |
| 3542 | const VkCmdBufferBeginInfo* pBeginInfo) { |
| 3543 | assert(pBeginInfo.sType == VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO) |
| 3544 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3545 | |
| 3546 | // TODO: iterate over boundObjects and clear memory bindings |
| 3547 | |
| 3548 | return ? |
| 3549 | } |
| 3550 | |
| 3551 | @threadSafety("app") |
| 3552 | cmd VkResult vkEndCommandBuffer( |
| 3553 | VkCmdBuffer cmdBuffer) { |
| 3554 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3555 | |
| 3556 | return ? |
| 3557 | } |
| 3558 | |
| 3559 | @threadSafety("app") |
| 3560 | cmd VkResult vkResetCommandBuffer( |
| 3561 | VkCmdBuffer cmdBuffer, |
| 3562 | VkCmdBufferResetFlags flags) { |
| 3563 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3564 | |
| 3565 | // TODO: iterate over boundObjects and clear memory bindings |
| 3566 | |
| 3567 | return ? |
| 3568 | } |
| 3569 | |
| 3570 | |
| 3571 | // Command buffer building functions |
| 3572 | |
| 3573 | @threadSafety("app") |
| 3574 | cmd void vkCmdBindPipeline( |
| 3575 | VkCmdBuffer cmdBuffer, |
| 3576 | VkPipelineBindPoint pipelineBindPoint, |
| 3577 | VkPipeline pipeline) { |
| 3578 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3579 | pipelineObject := GetPipeline(pipeline) |
| 3580 | assert(cmdBufferObject.device == pipelineObject.device) |
| 3581 | |
| 3582 | queueFlags := cmdBufferObject.queueFlags | switch (pipelineBindPoint) { |
| 3583 | case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT |
| 3584 | case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT |
| 3585 | } |
| 3586 | cmdBufferObject.queueFlags = queueFlags |
| 3587 | } |
| 3588 | |
| 3589 | @threadSafety("app") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3590 | cmd void vkCmdSetViewport( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3591 | VkCmdBuffer cmdBuffer, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3592 | u32 viewportCount, |
| 3593 | const VkViewport* pViewports) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3594 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3595 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3596 | cmdBufferObject.queueFlags = queueFlags |
| 3597 | } |
| 3598 | |
| 3599 | @threadSafety("app") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3600 | cmd void vkCmdSetScissor( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3601 | VkCmdBuffer cmdBuffer, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3602 | u32 scissorCount, |
| 3603 | const VkRect2D* pScissors) { |
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 vkCmdSetLineWidth( |
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 lineWidth) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3613 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3614 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3615 | cmdBufferObject.queueFlags = queueFlags |
| 3616 | } |
| 3617 | |
| 3618 | @threadSafety("app") |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3619 | cmd void vkCmdSetDepthBias( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3620 | VkCmdBuffer cmdBuffer, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3621 | f32 depthBias, |
| 3622 | f32 depthBiasClamp, |
| 3623 | f32 slopeScaledDepthBias) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3624 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3625 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3626 | cmdBufferObject.queueFlags = queueFlags |
| 3627 | } |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3628 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3629 | @threadSafety("app") |
| 3630 | cmd void vkCmdSetBlendConstants( |
| 3631 | VkCmdBuffer cmdBuffer, |
| 3632 | // TODO(jessehall): apic only supports 'const' on pointer types. Using |
| 3633 | // an annotation as a quick hack to pass this to the template without |
| 3634 | // having to modify the AST and semantic model. |
| 3635 | @readonly f32[4] blendConst) { |
| 3636 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3637 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3638 | cmdBufferObject.queueFlags = queueFlags |
| 3639 | } |
| 3640 | |
| 3641 | @threadSafety("app") |
| 3642 | cmd void vkCmdSetDepthBounds( |
| 3643 | VkCmdBuffer cmdBuffer, |
| 3644 | f32 minDepthBounds, |
| 3645 | f32 maxDepthBounds) { |
| 3646 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3647 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3648 | cmdBufferObject.queueFlags = queueFlags |
| 3649 | } |
| 3650 | |
| 3651 | @threadSafety("app") |
| 3652 | cmd void vkCmdSetStencilCompareMask( |
| 3653 | VkCmdBuffer cmdBuffer, |
| 3654 | VkStencilFaceFlags faceMask, |
| 3655 | u32 stencilCompareMask) { |
| 3656 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3657 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3658 | cmdBufferObject.queueFlags = queueFlags |
| 3659 | } |
| 3660 | |
| 3661 | @threadSafety("app") |
| 3662 | cmd void vkCmdSetStencilWriteMask( |
| 3663 | VkCmdBuffer cmdBuffer, |
| 3664 | VkStencilFaceFlags faceMask, |
| 3665 | u32 stencilWriteMask) { |
| 3666 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3667 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3668 | cmdBufferObject.queueFlags = queueFlags |
| 3669 | } |
| 3670 | |
| 3671 | @threadSafety("app") |
| 3672 | cmd void vkCmdSetStencilReference( |
| 3673 | VkCmdBuffer cmdBuffer, |
| 3674 | VkStencilFaceFlags faceMask, |
| 3675 | u32 stencilReference) { |
| 3676 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3677 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3678 | cmdBufferObject.queueFlags = queueFlags |
| 3679 | } |
| 3680 | |
| 3681 | @threadSafety("app") |
| 3682 | cmd void vkCmdBindDescriptorSets( |
| 3683 | VkCmdBuffer cmdBuffer, |
| 3684 | VkPipelineBindPoint pipelineBindPoint, |
| 3685 | VkPipelineLayout layout, |
| 3686 | u32 firstSet, |
| 3687 | u32 setCount, |
| 3688 | const VkDescriptorSet* pDescriptorSets, |
| 3689 | u32 dynamicOffsetCount, |
| 3690 | const u32* pDynamicOffsets) { |
| 3691 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3692 | |
| 3693 | descriptorSets := pDescriptorSets[0:setCount] |
| 3694 | for i in (0 .. setCount) { |
| 3695 | descriptorSet := descriptorSets[i] |
| 3696 | descriptorSetObject := GetDescriptorSet(descriptorSet) |
| 3697 | assert(cmdBufferObject.device == descriptorSetObject.device) |
| 3698 | } |
| 3699 | |
| 3700 | dynamicOffsets := pDynamicOffsets[0:dynamicOffsetCount] |
| 3701 | for i in (0 .. dynamicOffsetCount) { |
| 3702 | dynamicOffset := dynamicOffsets[i] |
| 3703 | } |
| 3704 | |
| 3705 | queueFlags := cmdBufferObject.queueFlags | switch (pipelineBindPoint) { |
| 3706 | case VK_PIPELINE_BIND_POINT_COMPUTE: VK_QUEUE_COMPUTE_BIT |
| 3707 | case VK_PIPELINE_BIND_POINT_GRAPHICS: VK_QUEUE_GRAPHICS_BIT |
| 3708 | } |
| 3709 | cmdBufferObject.queueFlags = queueFlags |
| 3710 | } |
| 3711 | |
| 3712 | @threadSafety("app") |
| 3713 | cmd void vkCmdBindIndexBuffer( |
| 3714 | VkCmdBuffer cmdBuffer, |
| 3715 | VkBuffer buffer, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3716 | VkDeviceSize offset, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3717 | VkIndexType indexType) { |
| 3718 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3719 | bufferObject := GetBuffer(buffer) |
| 3720 | assert(cmdBufferObject.device == bufferObject.device) |
| 3721 | |
| 3722 | bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem) |
| 3723 | |
| 3724 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3725 | cmdBufferObject.queueFlags = queueFlags |
| 3726 | } |
| 3727 | |
| 3728 | @threadSafety("app") |
| 3729 | cmd void vkCmdBindVertexBuffers( |
| 3730 | VkCmdBuffer cmdBuffer, |
| 3731 | u32 startBinding, |
| 3732 | u32 bindingCount, |
| 3733 | const VkBuffer* pBuffers, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3734 | const VkDeviceSize* pOffsets) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3735 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3736 | |
| 3737 | // TODO: check if not [startBinding:startBinding+bindingCount] |
| 3738 | buffers := pBuffers[0:bindingCount] |
| 3739 | offsets := pOffsets[0:bindingCount] |
| 3740 | for i in (0 .. bindingCount) { |
| 3741 | buffer := buffers[i] |
| 3742 | offset := offsets[i] |
| 3743 | bufferObject := GetBuffer(buffer) |
| 3744 | assert(cmdBufferObject.device == bufferObject.device) |
| 3745 | |
| 3746 | bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem) |
| 3747 | } |
| 3748 | |
| 3749 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3750 | cmdBufferObject.queueFlags = queueFlags |
| 3751 | } |
| 3752 | |
| 3753 | @threadSafety("app") |
| 3754 | cmd void vkCmdDraw( |
| 3755 | VkCmdBuffer cmdBuffer, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3756 | u32 vertexCount, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3757 | u32 instanceCount, |
| 3758 | u32 firstVertex, |
| 3759 | u32 firstInstance) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3760 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3761 | |
| 3762 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3763 | cmdBufferObject.queueFlags = queueFlags |
| 3764 | } |
| 3765 | |
| 3766 | @threadSafety("app") |
| 3767 | cmd void vkCmdDrawIndexed( |
| 3768 | VkCmdBuffer cmdBuffer, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3769 | u32 indexCount, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3770 | u32 instanceCount, |
| 3771 | u32 firstIndex, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3772 | s32 vertexOffset, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3773 | u32 firstInstance) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3774 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3775 | |
| 3776 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3777 | cmdBufferObject.queueFlags = queueFlags |
| 3778 | } |
| 3779 | |
| 3780 | @threadSafety("app") |
| 3781 | cmd void vkCmdDrawIndirect( |
| 3782 | VkCmdBuffer cmdBuffer, |
| 3783 | VkBuffer buffer, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3784 | VkDeviceSize offset, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3785 | u32 count, |
| 3786 | u32 stride) { |
| 3787 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3788 | bufferObject := GetBuffer(buffer) |
| 3789 | assert(cmdBufferObject.device == bufferObject.device) |
| 3790 | |
| 3791 | bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem) |
| 3792 | |
| 3793 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3794 | cmdBufferObject.queueFlags = queueFlags |
| 3795 | } |
| 3796 | |
| 3797 | @threadSafety("app") |
| 3798 | cmd void vkCmdDrawIndexedIndirect( |
| 3799 | VkCmdBuffer cmdBuffer, |
| 3800 | VkBuffer buffer, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3801 | VkDeviceSize offset, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3802 | u32 count, |
| 3803 | u32 stride) { |
| 3804 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3805 | bufferObject := GetBuffer(buffer) |
| 3806 | assert(cmdBufferObject.device == bufferObject.device) |
| 3807 | |
| 3808 | bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem) |
| 3809 | |
| 3810 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3811 | cmdBufferObject.queueFlags = queueFlags |
| 3812 | } |
| 3813 | |
| 3814 | @threadSafety("app") |
| 3815 | cmd void vkCmdDispatch( |
| 3816 | VkCmdBuffer cmdBuffer, |
| 3817 | u32 x, |
| 3818 | u32 y, |
| 3819 | u32 z) { |
| 3820 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3821 | |
| 3822 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_COMPUTE_BIT |
| 3823 | cmdBufferObject.queueFlags = queueFlags |
| 3824 | } |
| 3825 | |
| 3826 | @threadSafety("app") |
| 3827 | cmd void vkCmdDispatchIndirect( |
| 3828 | VkCmdBuffer cmdBuffer, |
| 3829 | VkBuffer buffer, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3830 | VkDeviceSize offset) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3831 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3832 | bufferObject := GetBuffer(buffer) |
| 3833 | assert(cmdBufferObject.device == bufferObject.device) |
| 3834 | |
| 3835 | bindCmdBuffer(cmdBuffer, buffer, bufferObject.mem) |
| 3836 | |
| 3837 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_COMPUTE_BIT |
| 3838 | cmdBufferObject.queueFlags = queueFlags |
| 3839 | } |
| 3840 | |
| 3841 | @threadSafety("app") |
| 3842 | cmd void vkCmdCopyBuffer( |
| 3843 | VkCmdBuffer cmdBuffer, |
| 3844 | VkBuffer srcBuffer, |
| 3845 | VkBuffer destBuffer, |
| 3846 | u32 regionCount, |
| 3847 | const VkBufferCopy* pRegions) { |
| 3848 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3849 | srcBufferObject := GetBuffer(srcBuffer) |
| 3850 | destBufferObject := GetBuffer(destBuffer) |
| 3851 | assert(cmdBufferObject.device == srcBufferObject.device) |
| 3852 | assert(cmdBufferObject.device == destBufferObject.device) |
| 3853 | |
| 3854 | regions := pRegions[0:regionCount] |
| 3855 | for i in (0 .. regionCount) { |
| 3856 | region := regions[i] |
| 3857 | } |
| 3858 | |
| 3859 | bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem) |
| 3860 | bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem) |
| 3861 | |
| 3862 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 3863 | cmdBufferObject.queueFlags = queueFlags |
| 3864 | } |
| 3865 | |
| 3866 | @threadSafety("app") |
| 3867 | cmd void vkCmdCopyImage( |
| 3868 | VkCmdBuffer cmdBuffer, |
| 3869 | VkImage srcImage, |
| 3870 | VkImageLayout srcImageLayout, |
| 3871 | VkImage destImage, |
| 3872 | VkImageLayout destImageLayout, |
| 3873 | u32 regionCount, |
| 3874 | const VkImageCopy* pRegions) { |
| 3875 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3876 | srcImageObject := GetImage(srcImage) |
| 3877 | destImageObject := GetImage(destImage) |
| 3878 | assert(cmdBufferObject.device == srcImageObject.device) |
| 3879 | assert(cmdBufferObject.device == destImageObject.device) |
| 3880 | |
| 3881 | regions := pRegions[0:regionCount] |
| 3882 | for i in (0 .. regionCount) { |
| 3883 | region := regions[i] |
| 3884 | } |
| 3885 | |
| 3886 | bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem) |
| 3887 | bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem) |
| 3888 | |
| 3889 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 3890 | cmdBufferObject.queueFlags = queueFlags |
| 3891 | } |
| 3892 | |
| 3893 | @threadSafety("app") |
| 3894 | cmd void vkCmdBlitImage( |
| 3895 | VkCmdBuffer cmdBuffer, |
| 3896 | VkImage srcImage, |
| 3897 | VkImageLayout srcImageLayout, |
| 3898 | VkImage destImage, |
| 3899 | VkImageLayout destImageLayout, |
| 3900 | u32 regionCount, |
| 3901 | const VkImageBlit* pRegions, |
| 3902 | VkTexFilter filter) { |
| 3903 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3904 | srcImageObject := GetImage(srcImage) |
| 3905 | destImageObject := GetImage(destImage) |
| 3906 | assert(cmdBufferObject.device == srcImageObject.device) |
| 3907 | assert(cmdBufferObject.device == destImageObject.device) |
| 3908 | |
| 3909 | regions := pRegions[0:regionCount] |
| 3910 | for i in (0 .. regionCount) { |
| 3911 | region := regions[i] |
| 3912 | } |
| 3913 | |
| 3914 | bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem) |
| 3915 | bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem) |
| 3916 | |
| 3917 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 3918 | cmdBufferObject.queueFlags = queueFlags |
| 3919 | } |
| 3920 | |
| 3921 | @threadSafety("app") |
| 3922 | cmd void vkCmdCopyBufferToImage( |
| 3923 | VkCmdBuffer cmdBuffer, |
| 3924 | VkBuffer srcBuffer, |
| 3925 | VkImage destImage, |
| 3926 | VkImageLayout destImageLayout, |
| 3927 | u32 regionCount, |
| 3928 | const VkBufferImageCopy* pRegions) { |
| 3929 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3930 | srcBufferObject := GetBuffer(srcBuffer) |
| 3931 | destImageObject := GetImage(destImage) |
| 3932 | assert(cmdBufferObject.device == srcBufferObject.device) |
| 3933 | assert(cmdBufferObject.device == destImageObject.device) |
| 3934 | |
| 3935 | regions := pRegions[0:regionCount] |
| 3936 | for i in (0 .. regionCount) { |
| 3937 | region := regions[i] |
| 3938 | } |
| 3939 | |
| 3940 | bindCmdBuffer(cmdBuffer, srcBuffer, srcBufferObject.mem) |
| 3941 | bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem) |
| 3942 | |
| 3943 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 3944 | cmdBufferObject.queueFlags = queueFlags |
| 3945 | } |
| 3946 | |
| 3947 | @threadSafety("app") |
| 3948 | cmd void vkCmdCopyImageToBuffer( |
| 3949 | VkCmdBuffer cmdBuffer, |
| 3950 | VkImage srcImage, |
| 3951 | VkImageLayout srcImageLayout, |
| 3952 | VkBuffer destBuffer, |
| 3953 | u32 regionCount, |
| 3954 | const VkBufferImageCopy* pRegions) { |
| 3955 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3956 | srcImageObject := GetImage(srcImage) |
| 3957 | destBufferObject := GetBuffer(destBuffer) |
| 3958 | assert(cmdBufferObject.device == srcImageObject.device) |
| 3959 | assert(cmdBufferObject.device == destBufferObject.device) |
| 3960 | |
| 3961 | regions := pRegions[0:regionCount] |
| 3962 | for i in (0 .. regionCount) { |
| 3963 | region := regions[i] |
| 3964 | } |
| 3965 | |
| 3966 | bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem) |
| 3967 | bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem) |
| 3968 | |
| 3969 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 3970 | cmdBufferObject.queueFlags = queueFlags |
| 3971 | } |
| 3972 | |
| 3973 | @threadSafety("app") |
| 3974 | cmd void vkCmdUpdateBuffer( |
| 3975 | VkCmdBuffer cmdBuffer, |
| 3976 | VkBuffer destBuffer, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3977 | VkDeviceSize destOffset, |
| 3978 | VkDeviceSize dataSize, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3979 | const u32* pData) { |
| 3980 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 3981 | destBufferObject := GetBuffer(destBuffer) |
| 3982 | assert(cmdBufferObject.device == destBufferObject.device) |
| 3983 | |
| 3984 | data := pData[0:dataSize] |
| 3985 | |
| 3986 | bindCmdBuffer(cmdBuffer, destBuffer, destBufferObject.mem) |
| 3987 | |
| 3988 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 3989 | cmdBufferObject.queueFlags = queueFlags |
| 3990 | } |
| 3991 | |
| 3992 | @threadSafety("app") |
| 3993 | cmd void vkCmdFillBuffer( |
| 3994 | VkCmdBuffer cmdBuffer, |
| 3995 | VkBuffer destBuffer, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 3996 | VkDeviceSize destOffset, |
| 3997 | VkDeviceSize fillSize, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 3998 | u32 data) { |
| 3999 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4000 | destBufferObject := GetBuffer(destBuffer) |
| 4001 | assert(cmdBufferObject.device == destBufferObject.device) |
| 4002 | |
| 4003 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_DMA_BIT |
| 4004 | cmdBufferObject.queueFlags = queueFlags |
| 4005 | } |
| 4006 | |
| 4007 | @threadSafety("app") |
| 4008 | cmd void vkCmdClearColorImage( |
| 4009 | VkCmdBuffer cmdBuffer, |
| 4010 | VkImage image, |
| 4011 | VkImageLayout imageLayout, |
| 4012 | const VkClearColorValue* pColor, |
| 4013 | u32 rangeCount, |
| 4014 | const VkImageSubresourceRange* pRanges) { |
| 4015 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4016 | imageObject := GetImage(image) |
| 4017 | assert(cmdBufferObject.device == imageObject.device) |
| 4018 | |
| 4019 | ranges := pRanges[0:rangeCount] |
| 4020 | for i in (0 .. rangeCount) { |
| 4021 | range := ranges[i] |
| 4022 | } |
| 4023 | |
| 4024 | bindCmdBuffer(cmdBuffer, image, imageObject.mem) |
| 4025 | |
| 4026 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4027 | cmdBufferObject.queueFlags = queueFlags |
| 4028 | } |
| 4029 | |
| 4030 | @threadSafety("app") |
| 4031 | cmd void vkCmdClearDepthStencilImage( |
| 4032 | VkCmdBuffer cmdBuffer, |
| 4033 | VkImage image, |
| 4034 | VkImageLayout imageLayout, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 4035 | const VkClearDepthStencilValue* pDepthStencil, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4036 | u32 rangeCount, |
| 4037 | const VkImageSubresourceRange* pRanges) { |
| 4038 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4039 | imageObject := GetImage(image) |
| 4040 | assert(cmdBufferObject.device == imageObject.device) |
| 4041 | |
| 4042 | ranges := pRanges[0:rangeCount] |
| 4043 | for i in (0 .. rangeCount) { |
| 4044 | range := ranges[i] |
| 4045 | } |
| 4046 | |
| 4047 | bindCmdBuffer(cmdBuffer, image, imageObject.mem) |
| 4048 | |
| 4049 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4050 | cmdBufferObject.queueFlags = queueFlags |
| 4051 | } |
| 4052 | |
| 4053 | @threadSafety("app") |
Jesse Hall | ae38f73 | 2015-11-19 21:32:50 -0800 | [diff] [blame] | 4054 | cmd void vkCmdClearAttachments( |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4055 | VkCmdBuffer cmdBuffer, |
Jesse Hall | ae38f73 | 2015-11-19 21:32:50 -0800 | [diff] [blame] | 4056 | u32 attachmentCount, |
| 4057 | const VkClearAttachment* pAttachments, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4058 | u32 rectCount, |
| 4059 | const VkRect3D* pRects) { |
| 4060 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4061 | |
| 4062 | rects := pRects[0:rectCount] |
| 4063 | for i in (0 .. rectCount) { |
| 4064 | rect := rects[i] |
| 4065 | } |
| 4066 | |
| 4067 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4068 | cmdBufferObject.queueFlags = queueFlags |
| 4069 | } |
| 4070 | |
| 4071 | @threadSafety("app") |
| 4072 | cmd void vkCmdResolveImage( |
| 4073 | VkCmdBuffer cmdBuffer, |
| 4074 | VkImage srcImage, |
| 4075 | VkImageLayout srcImageLayout, |
| 4076 | VkImage destImage, |
| 4077 | VkImageLayout destImageLayout, |
| 4078 | u32 regionCount, |
| 4079 | const VkImageResolve* pRegions) { |
| 4080 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4081 | srcImageObject := GetImage(srcImage) |
| 4082 | destImageObject := GetImage(destImage) |
| 4083 | assert(cmdBufferObject.device == srcImageObject.device) |
| 4084 | assert(cmdBufferObject.device == destImageObject.device) |
| 4085 | |
| 4086 | regions := pRegions[0:regionCount] |
| 4087 | for i in (0 .. regionCount) { |
| 4088 | region := regions[i] |
| 4089 | } |
| 4090 | |
| 4091 | bindCmdBuffer(cmdBuffer, srcImage, srcImageObject.mem) |
| 4092 | bindCmdBuffer(cmdBuffer, destImage, destImageObject.mem) |
| 4093 | |
| 4094 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4095 | cmdBufferObject.queueFlags = queueFlags |
| 4096 | } |
| 4097 | |
| 4098 | @threadSafety("app") |
| 4099 | cmd void vkCmdSetEvent( |
| 4100 | VkCmdBuffer cmdBuffer, |
| 4101 | VkEvent event, |
| 4102 | VkPipelineStageFlags stageMask) { |
| 4103 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4104 | eventObject := GetEvent(event) |
| 4105 | assert(cmdBufferObject.device == eventObject.device) |
| 4106 | } |
| 4107 | |
| 4108 | @threadSafety("app") |
| 4109 | cmd void vkCmdResetEvent( |
| 4110 | VkCmdBuffer cmdBuffer, |
| 4111 | VkEvent event, |
| 4112 | VkPipelineStageFlags stageMask) { |
| 4113 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4114 | eventObject := GetEvent(event) |
| 4115 | assert(cmdBufferObject.device == eventObject.device) |
| 4116 | } |
| 4117 | |
| 4118 | @threadSafety("app") |
| 4119 | cmd void vkCmdWaitEvents( |
| 4120 | VkCmdBuffer cmdBuffer, |
| 4121 | u32 eventCount, |
| 4122 | const VkEvent* pEvents, |
| 4123 | VkPipelineStageFlags srcStageMask, |
| 4124 | VkPipelineStageFlags destStageMask, |
| 4125 | u32 memBarrierCount, |
| 4126 | const void* const* ppMemBarriers) { |
| 4127 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4128 | |
| 4129 | events := pEvents[0:eventCount] |
| 4130 | for i in (0 .. eventCount) { |
| 4131 | event := events[i] |
| 4132 | eventObject := GetEvent(event) |
| 4133 | assert(cmdBufferObject.device == eventObject.device) |
| 4134 | } |
| 4135 | |
| 4136 | pMemBarriers := ppMemBarriers[0:memBarrierCount] |
| 4137 | for i in (0 .. memBarrierCount) { |
| 4138 | switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType { |
| 4139 | case VK_STRUCTURE_TYPE_MEMORY_BARRIER: { |
| 4140 | memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0] |
| 4141 | } |
| 4142 | case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: { |
| 4143 | imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0] |
| 4144 | imageObject := GetImage(imageMemBarrier.image) |
| 4145 | assert(imageObject.device == cmdBufferObject.device) |
| 4146 | } |
| 4147 | case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: { |
| 4148 | bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0] |
| 4149 | bufferObject := GetBuffer(bufferMemBarrier.buffer) |
| 4150 | assert(bufferObject.device == cmdBufferObject.device) |
| 4151 | } |
| 4152 | } |
| 4153 | } |
| 4154 | } |
| 4155 | |
| 4156 | @threadSafety("app") |
| 4157 | cmd void vkCmdPipelineBarrier( |
| 4158 | VkCmdBuffer cmdBuffer, |
| 4159 | VkPipelineStageFlags srcStageMask, |
| 4160 | VkPipelineStageFlags destStageMask, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 4161 | VkBool32 byRegion, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4162 | u32 memBarrierCount, |
| 4163 | const void* const* ppMemBarriers) { |
| 4164 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4165 | |
| 4166 | pMemBarriers := ppMemBarriers[0:memBarrierCount] |
| 4167 | for i in (0 .. memBarrierCount) { |
| 4168 | switch as!VkMemoryBarrier const*(pMemBarriers[i])[0].sType { |
| 4169 | case VK_STRUCTURE_TYPE_MEMORY_BARRIER: { |
| 4170 | memBarrier := as!VkMemoryBarrier const*(pMemBarriers[i])[0] |
| 4171 | } |
| 4172 | case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: { |
| 4173 | imageMemBarrier := as!VkImageMemoryBarrier const*(pMemBarriers[i])[0] |
| 4174 | imageObject := GetImage(imageMemBarrier.image) |
| 4175 | assert(imageObject.device == cmdBufferObject.device) |
| 4176 | } |
| 4177 | case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: { |
| 4178 | bufferMemBarrier := as!VkBufferMemoryBarrier const*(pMemBarriers[i])[0] |
| 4179 | bufferObject := GetBuffer(bufferMemBarrier.buffer) |
| 4180 | assert(bufferObject.device == cmdBufferObject.device) |
| 4181 | } |
| 4182 | } |
| 4183 | } |
| 4184 | } |
| 4185 | |
| 4186 | @threadSafety("app") |
| 4187 | cmd void vkCmdBeginQuery( |
| 4188 | VkCmdBuffer cmdBuffer, |
| 4189 | VkQueryPool queryPool, |
| 4190 | u32 slot, |
| 4191 | VkQueryControlFlags flags) { |
| 4192 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4193 | queryPoolObject := GetQueryPool(queryPool) |
| 4194 | assert(cmdBufferObject.device == queryPoolObject.device) |
| 4195 | } |
| 4196 | |
| 4197 | @threadSafety("app") |
| 4198 | cmd void vkCmdEndQuery( |
| 4199 | VkCmdBuffer cmdBuffer, |
| 4200 | VkQueryPool queryPool, |
| 4201 | u32 slot) { |
| 4202 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4203 | queryPoolObject := GetQueryPool(queryPool) |
| 4204 | assert(cmdBufferObject.device == queryPoolObject.device) |
| 4205 | } |
| 4206 | |
| 4207 | @threadSafety("app") |
| 4208 | cmd void vkCmdResetQueryPool( |
| 4209 | VkCmdBuffer cmdBuffer, |
| 4210 | VkQueryPool queryPool, |
| 4211 | u32 startQuery, |
| 4212 | u32 queryCount) { |
| 4213 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4214 | queryPoolObject := GetQueryPool(queryPool) |
| 4215 | assert(cmdBufferObject.device == queryPoolObject.device) |
| 4216 | } |
| 4217 | |
| 4218 | @threadSafety("app") |
| 4219 | cmd void vkCmdWriteTimestamp( |
| 4220 | VkCmdBuffer cmdBuffer, |
| 4221 | VkTimestampType timestampType, |
| 4222 | VkBuffer destBuffer, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 4223 | VkDeviceSize destOffset) { |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4224 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4225 | destBufferObject := GetBuffer(destBuffer) |
| 4226 | assert(cmdBufferObject.device == destBufferObject.device) |
| 4227 | } |
| 4228 | |
| 4229 | @threadSafety("app") |
| 4230 | cmd void vkCmdCopyQueryPoolResults( |
| 4231 | VkCmdBuffer cmdBuffer, |
| 4232 | VkQueryPool queryPool, |
| 4233 | u32 startQuery, |
| 4234 | u32 queryCount, |
| 4235 | VkBuffer destBuffer, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 4236 | VkDeviceSize destOffset, |
| 4237 | VkDeviceSize destStride, |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4238 | VkQueryResultFlags flags) { |
| 4239 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4240 | queryPoolObject := GetQueryPool(queryPool) |
| 4241 | destBufferObject := GetBuffer(destBuffer) |
| 4242 | assert(cmdBufferObject.device == queryPoolObject.device) |
| 4243 | assert(cmdBufferObject.device == destBufferObject.device) |
| 4244 | } |
| 4245 | |
| 4246 | cmd void vkCmdPushConstants( |
| 4247 | VkCmdBuffer cmdBuffer, |
| 4248 | VkPipelineLayout layout, |
| 4249 | VkShaderStageFlags stageFlags, |
| 4250 | u32 start, |
| 4251 | u32 length, |
| 4252 | const void* values) { |
| 4253 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4254 | layoutObject := GetPipelineLayout(layout) |
| 4255 | assert(cmdBufferObject.device == layoutObject.device) |
| 4256 | } |
| 4257 | |
| 4258 | @threadSafety("app") |
| 4259 | cmd void vkCmdBeginRenderPass( |
| 4260 | VkCmdBuffer cmdBuffer, |
| 4261 | const VkRenderPassBeginInfo* pRenderPassBegin, |
| 4262 | VkRenderPassContents contents) { |
| 4263 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4264 | renderPassObject := GetRenderPass(pRenderPassBegin.renderPass) |
| 4265 | framebufferObject := GetFramebuffer(pRenderPassBegin.framebuffer) |
| 4266 | assert(cmdBufferObject.device == renderPassObject.device) |
| 4267 | assert(cmdBufferObject.device == framebufferObject.device) |
| 4268 | |
| 4269 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4270 | cmdBufferObject.queueFlags = queueFlags |
| 4271 | } |
| 4272 | |
| 4273 | cmd void vkCmdNextSubpass( |
| 4274 | VkCmdBuffer cmdBuffer, |
| 4275 | VkRenderPassContents contents) { |
| 4276 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4277 | } |
| 4278 | |
| 4279 | @threadSafety("app") |
| 4280 | cmd void vkCmdEndRenderPass( |
| 4281 | VkCmdBuffer cmdBuffer) { |
| 4282 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4283 | |
| 4284 | queueFlags := cmdBufferObject.queueFlags | VK_QUEUE_GRAPHICS_BIT |
| 4285 | cmdBufferObject.queueFlags = queueFlags |
| 4286 | } |
| 4287 | |
| 4288 | cmd void vkCmdExecuteCommands( |
| 4289 | VkCmdBuffer cmdBuffer, |
| 4290 | u32 cmdBuffersCount, |
| 4291 | const VkCmdBuffer* pCmdBuffers) { |
| 4292 | cmdBufferObject := GetCmdBuffer(cmdBuffer) |
| 4293 | |
| 4294 | cmdBuffers := pCmdBuffers[0:cmdBuffersCount] |
| 4295 | for i in (0 .. cmdBuffersCount) { |
| 4296 | secondaryCmdBuffer := cmdBuffers[i] |
| 4297 | secondaryCmdBufferObject := GetCmdBuffer(secondaryCmdBuffer) |
| 4298 | assert(cmdBufferObject.device == secondaryCmdBufferObject.device) |
| 4299 | } |
| 4300 | } |
| 4301 | |
Michael Lentine | 88594d7 | 2015-11-12 12:49:45 -0800 | [diff] [blame] | 4302 | //////////////// |
| 4303 | // Extensions // |
| 4304 | //////////////// |
| 4305 | |
Jesse Hall | 2818f93 | 2015-11-19 21:19:17 -0800 | [diff] [blame] | 4306 | @extension("VK_EXT_KHR_swapchain") |
| 4307 | cmd VkResult vkGetPhysicalDeviceSurfaceSupportKHR( |
| 4308 | VkPhysicalDevice physicalDevice, |
| 4309 | u32 queueFamilyIndex, |
| 4310 | const VkSurfaceDescriptionKHR* pSurfaceDescription, |
| 4311 | VkBool32* pSupported) { |
| 4312 | physicalDeviceObject := GetPhysicalDevice(physicalDevice) |
| 4313 | |
| 4314 | supported := ? |
| 4315 | pSupported[0] = supported |
| 4316 | |
| 4317 | return ? |
| 4318 | } |
| 4319 | |
Michael Lentine | 88594d7 | 2015-11-12 12:49:45 -0800 | [diff] [blame] | 4320 | @extension("VK_EXT_KHR_device_swapchain") |
| 4321 | cmd VkResult vkGetSurfacePropertiesKHR( |
| 4322 | VkDevice device, |
| 4323 | const VkSurfaceDescriptionKHR* pSurfaceDescription, |
| 4324 | VkSurfacePropertiesKHR* pSurfaceProperties) { |
| 4325 | deviceObject := GetDevice(device) |
| 4326 | |
| 4327 | surfaceProperties := ? |
| 4328 | pSurfaceProperties[0] = surfaceProperties |
| 4329 | |
| 4330 | return ? |
| 4331 | } |
| 4332 | |
| 4333 | @extension("VK_EXT_KHR_device_swapchain") |
| 4334 | cmd VkResult vkGetSurfaceFormatsKHR( |
| 4335 | VkDevice device, |
| 4336 | const VkSurfaceDescriptionKHR* pSurfaceDescription, |
| 4337 | u32* pCount, |
| 4338 | VkSurfaceFormatKHR* pSurfaceFormats) { |
| 4339 | deviceObject := GetDevice(device) |
| 4340 | |
| 4341 | count := as!u32(?) |
| 4342 | pCount[0] = count |
| 4343 | surfaceFormats := pSurfaceFormats[0:count] |
| 4344 | |
| 4345 | for i in (0 .. count) { |
| 4346 | surfaceFormat := ? |
| 4347 | surfaceFormats[i] = surfaceFormat |
| 4348 | } |
| 4349 | |
| 4350 | return ? |
| 4351 | } |
| 4352 | |
| 4353 | @extension("VK_EXT_KHR_device_swapchain") |
| 4354 | cmd VkResult vkGetSurfacePresentModesKHR( |
| 4355 | VkDevice device, |
| 4356 | const VkSurfaceDescriptionKHR* pSurfaceDescription, |
| 4357 | u32* pCount, |
| 4358 | VkPresentModeKHR* pPresentModes) { |
| 4359 | deviceObject := GetDevice(device) |
| 4360 | |
| 4361 | count := as!u32(?) |
| 4362 | pCount[0] = count |
| 4363 | presentModes := pPresentModes[0:count] |
| 4364 | |
| 4365 | for i in (0 .. count) { |
| 4366 | presentMode := ? |
| 4367 | presentModes[i] = presentMode |
| 4368 | } |
| 4369 | |
| 4370 | return ? |
| 4371 | } |
| 4372 | |
| 4373 | @extension("VK_EXT_KHR_device_swapchain") |
| 4374 | cmd VkResult vkCreateSwapchainKHR( |
| 4375 | VkDevice device, |
| 4376 | const VkSwapchainCreateInfoKHR* pCreateInfo, |
| 4377 | VkSwapchainKHR* pSwapchain) { |
| 4378 | //assert(pCreateInfo.sType == VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR) |
| 4379 | deviceObject := GetDevice(device) |
| 4380 | |
| 4381 | swapchain := ? |
| 4382 | pSwapchain[0] = swapchain |
| 4383 | State.Swapchains[swapchain] = new!SwapchainObject(device: device) |
| 4384 | |
| 4385 | return ? |
| 4386 | } |
| 4387 | |
| 4388 | @extension("VK_EXT_KHR_device_swapchain") |
| 4389 | cmd VkResult vkDestroySwapchainKHR( |
| 4390 | VkDevice device, |
| 4391 | VkSwapchainKHR swapchain) { |
| 4392 | deviceObject := GetDevice(device) |
| 4393 | swapchainObject := GetSwapchain(swapchain) |
| 4394 | assert(swapchainObject.device == device) |
| 4395 | |
| 4396 | State.Swapchains[swapchain] = null |
| 4397 | |
| 4398 | return ? |
| 4399 | } |
| 4400 | |
| 4401 | @extension("VK_EXT_KHR_device_swapchain") |
| 4402 | cmd VkResult vkGetSwapchainImagesKHR( |
| 4403 | VkDevice device, |
| 4404 | VkSwapchainKHR swapchain, |
| 4405 | u32* pCount, |
| 4406 | VkImage* pSwapchainImages) { |
| 4407 | deviceObject := GetDevice(device) |
| 4408 | |
| 4409 | count := as!u32(?) |
| 4410 | pCount[0] = count |
| 4411 | swapchainImages := pSwapchainImages[0:count] |
| 4412 | |
| 4413 | for i in (0 .. count) { |
| 4414 | swapchainImage := ? |
| 4415 | swapchainImages[i] = swapchainImage |
| 4416 | if !(swapchainImage in State.Images) { |
| 4417 | State.Images[swapchainImage] = new!ImageObject(device: device) |
| 4418 | } |
| 4419 | } |
| 4420 | |
| 4421 | return ? |
| 4422 | } |
| 4423 | |
| 4424 | @extension("VK_EXT_KHR_device_swapchain") |
| 4425 | cmd VkResult vkAcquireNextImageKHR( |
| 4426 | VkDevice device, |
| 4427 | VkSwapchainKHR swapchain, |
| 4428 | u64 timeout, |
| 4429 | VkSemaphore semaphore, |
| 4430 | u32* pImageIndex) { |
| 4431 | deviceObject := GetDevice(device) |
| 4432 | swapchainObject := GetSwapchain(swapchain) |
| 4433 | |
| 4434 | imageIndex := ? |
| 4435 | pImageIndex[0] = imageIndex |
| 4436 | |
| 4437 | return ? |
| 4438 | } |
| 4439 | |
| 4440 | @extension("VK_EXT_KHR_device_swapchain") |
| 4441 | cmd VkResult vkQueuePresentKHR( |
| 4442 | VkQueue queue, |
| 4443 | VkPresentInfoKHR* pPresentInfo) { |
| 4444 | queueObject := GetQueue(queue) |
| 4445 | |
| 4446 | presentInfo := ? |
| 4447 | pPresentInfo[0] = presentInfo |
| 4448 | |
| 4449 | return ? |
| 4450 | } |
| 4451 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4452 | |
| 4453 | //////////////// |
| 4454 | // Validation // |
| 4455 | //////////////// |
| 4456 | |
| 4457 | extern void validate(string layerName, bool condition, string message) |
| 4458 | |
| 4459 | |
| 4460 | ///////////////////////////// |
| 4461 | // Internal State Tracking // |
| 4462 | ///////////////////////////// |
| 4463 | |
| 4464 | StateObject State |
| 4465 | |
| 4466 | @internal class StateObject { |
| 4467 | // Dispatchable objects. |
| 4468 | map!(VkInstance, ref!InstanceObject) Instances |
| 4469 | map!(VkPhysicalDevice, ref!PhysicalDeviceObject) PhysicalDevices |
| 4470 | map!(VkDevice, ref!DeviceObject) Devices |
| 4471 | map!(VkQueue, ref!QueueObject) Queues |
| 4472 | map!(VkCmdBuffer, ref!CmdBufferObject) CmdBuffers |
| 4473 | |
| 4474 | // Non-dispatchable objects. |
| 4475 | map!(VkDeviceMemory, ref!DeviceMemoryObject) DeviceMemories |
| 4476 | map!(VkBuffer, ref!BufferObject) Buffers |
| 4477 | map!(VkBufferView, ref!BufferViewObject) BufferViews |
| 4478 | map!(VkImage, ref!ImageObject) Images |
| 4479 | map!(VkImageView, ref!ImageViewObject) ImageViews |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4480 | map!(VkShaderModule, ref!ShaderModuleObject) ShaderModules |
| 4481 | map!(VkShader, ref!ShaderObject) Shaders |
| 4482 | map!(VkPipeline, ref!PipelineObject) Pipelines |
| 4483 | map!(VkPipelineLayout, ref!PipelineLayoutObject) PipelineLayouts |
| 4484 | map!(VkSampler, ref!SamplerObject) Samplers |
| 4485 | map!(VkDescriptorSet, ref!DescriptorSetObject) DescriptorSets |
| 4486 | map!(VkDescriptorSetLayout, ref!DescriptorSetLayoutObject) DescriptorSetLayouts |
| 4487 | map!(VkDescriptorPool, ref!DescriptorPoolObject) DescriptorPools |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4488 | map!(VkFence, ref!FenceObject) Fences |
| 4489 | map!(VkSemaphore, ref!SemaphoreObject) Semaphores |
| 4490 | map!(VkEvent, ref!EventObject) Events |
| 4491 | map!(VkQueryPool, ref!QueryPoolObject) QueryPools |
| 4492 | map!(VkFramebuffer, ref!FramebufferObject) Framebuffers |
| 4493 | map!(VkRenderPass, ref!RenderPassObject) RenderPasses |
| 4494 | map!(VkPipelineCache, ref!PipelineCacheObject) PipelineCaches |
| 4495 | map!(VkCmdPool, ref!CmdPoolObject) CmdPools |
Michael Lentine | 88594d7 | 2015-11-12 12:49:45 -0800 | [diff] [blame] | 4496 | map!(VkSwapchainKHR, ref!SwapchainObject) Swapchains |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4497 | } |
| 4498 | |
| 4499 | @internal class InstanceObject { |
| 4500 | } |
| 4501 | |
| 4502 | @internal class PhysicalDeviceObject { |
| 4503 | VkInstance instance |
| 4504 | } |
| 4505 | |
| 4506 | @internal class DeviceObject { |
| 4507 | VkPhysicalDevice physicalDevice |
| 4508 | } |
| 4509 | |
| 4510 | @internal class QueueObject { |
| 4511 | VkDevice device |
| 4512 | VkQueueFlags flags |
| 4513 | } |
| 4514 | |
| 4515 | @internal class CmdBufferObject { |
| 4516 | VkDevice device |
| 4517 | map!(u64, VkDeviceMemory) boundObjects |
| 4518 | VkQueueFlags queueFlags |
| 4519 | } |
| 4520 | |
| 4521 | @internal class DeviceMemoryObject { |
| 4522 | VkDevice device |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 4523 | VkDeviceSize allocationSize |
| 4524 | map!(u64, VkDeviceSize ) boundObjects |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4525 | map!(VkCmdBuffer, VkCmdBuffer) boundCommandBuffers |
| 4526 | } |
| 4527 | |
| 4528 | @internal class BufferObject { |
| 4529 | VkDevice device |
| 4530 | VkDeviceMemory mem |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 4531 | VkDeviceSize memOffset |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4532 | } |
| 4533 | |
| 4534 | @internal class BufferViewObject { |
| 4535 | VkDevice device |
| 4536 | VkBuffer buffer |
| 4537 | } |
| 4538 | |
| 4539 | @internal class ImageObject { |
| 4540 | VkDevice device |
| 4541 | VkDeviceMemory mem |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 4542 | VkDeviceSize memOffset |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4543 | } |
| 4544 | |
| 4545 | @internal class ImageViewObject { |
| 4546 | VkDevice device |
| 4547 | VkImage image |
| 4548 | } |
| 4549 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4550 | @internal class ShaderObject { |
| 4551 | VkDevice device |
| 4552 | } |
| 4553 | |
| 4554 | @internal class ShaderModuleObject { |
| 4555 | VkDevice device |
| 4556 | } |
| 4557 | |
| 4558 | @internal class PipelineObject { |
| 4559 | VkDevice device |
| 4560 | } |
| 4561 | |
| 4562 | @internal class PipelineLayoutObject { |
| 4563 | VkDevice device |
| 4564 | } |
| 4565 | |
| 4566 | @internal class SamplerObject { |
| 4567 | VkDevice device |
| 4568 | } |
| 4569 | |
| 4570 | @internal class DescriptorSetObject { |
| 4571 | VkDevice device |
| 4572 | } |
| 4573 | |
| 4574 | @internal class DescriptorSetLayoutObject { |
| 4575 | VkDevice device |
| 4576 | } |
| 4577 | |
| 4578 | @internal class DescriptorPoolObject { |
| 4579 | VkDevice device |
| 4580 | } |
| 4581 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4582 | @internal class FenceObject { |
| 4583 | VkDevice device |
| 4584 | bool signaled |
| 4585 | } |
| 4586 | |
| 4587 | @internal class SemaphoreObject { |
| 4588 | VkDevice device |
| 4589 | } |
| 4590 | |
| 4591 | @internal class EventObject { |
| 4592 | VkDevice device |
| 4593 | } |
| 4594 | |
| 4595 | @internal class QueryPoolObject { |
| 4596 | VkDevice device |
| 4597 | } |
| 4598 | |
| 4599 | @internal class FramebufferObject { |
| 4600 | VkDevice device |
| 4601 | } |
| 4602 | |
| 4603 | @internal class RenderPassObject { |
| 4604 | VkDevice device |
| 4605 | } |
| 4606 | |
| 4607 | @internal class PipelineCacheObject { |
| 4608 | VkDevice device |
| 4609 | } |
| 4610 | |
| 4611 | @internal class CmdPoolObject { |
| 4612 | VkDevice device |
| 4613 | } |
| 4614 | |
Michael Lentine | 88594d7 | 2015-11-12 12:49:45 -0800 | [diff] [blame] | 4615 | @internal class SwapchainObject { |
| 4616 | VkDevice device |
| 4617 | } |
| 4618 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4619 | macro ref!InstanceObject GetInstance(VkInstance instance) { |
| 4620 | assert(instance in State.Instances) |
| 4621 | return State.Instances[instance] |
| 4622 | } |
| 4623 | |
| 4624 | macro ref!PhysicalDeviceObject GetPhysicalDevice(VkPhysicalDevice physicalDevice) { |
| 4625 | assert(physicalDevice in State.PhysicalDevices) |
| 4626 | return State.PhysicalDevices[physicalDevice] |
| 4627 | } |
| 4628 | |
| 4629 | macro ref!DeviceObject GetDevice(VkDevice device) { |
| 4630 | assert(device in State.Devices) |
| 4631 | return State.Devices[device] |
| 4632 | } |
| 4633 | |
| 4634 | macro ref!QueueObject GetQueue(VkQueue queue) { |
| 4635 | assert(queue in State.Queues) |
| 4636 | return State.Queues[queue] |
| 4637 | } |
| 4638 | |
| 4639 | macro ref!CmdBufferObject GetCmdBuffer(VkCmdBuffer cmdBuffer) { |
| 4640 | assert(cmdBuffer in State.CmdBuffers) |
| 4641 | return State.CmdBuffers[cmdBuffer] |
| 4642 | } |
| 4643 | |
| 4644 | macro ref!DeviceMemoryObject GetDeviceMemory(VkDeviceMemory mem) { |
| 4645 | assert(mem in State.DeviceMemories) |
| 4646 | return State.DeviceMemories[mem] |
| 4647 | } |
| 4648 | |
| 4649 | macro ref!BufferObject GetBuffer(VkBuffer buffer) { |
| 4650 | assert(buffer in State.Buffers) |
| 4651 | return State.Buffers[buffer] |
| 4652 | } |
| 4653 | |
| 4654 | macro ref!BufferViewObject GetBufferView(VkBufferView bufferView) { |
| 4655 | assert(bufferView in State.BufferViews) |
| 4656 | return State.BufferViews[bufferView] |
| 4657 | } |
| 4658 | |
| 4659 | macro ref!ImageObject GetImage(VkImage image) { |
| 4660 | assert(image in State.Images) |
| 4661 | return State.Images[image] |
| 4662 | } |
| 4663 | |
| 4664 | macro ref!ImageViewObject GetImageView(VkImageView imageView) { |
| 4665 | assert(imageView in State.ImageViews) |
| 4666 | return State.ImageViews[imageView] |
| 4667 | } |
| 4668 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4669 | macro ref!ShaderObject GetShader(VkShader shader) { |
| 4670 | assert(shader in State.Shaders) |
| 4671 | return State.Shaders[shader] |
| 4672 | } |
| 4673 | |
| 4674 | macro ref!ShaderModuleObject GetShaderModule(VkShaderModule shaderModule) { |
| 4675 | assert(shaderModule in State.ShaderModules) |
| 4676 | return State.ShaderModules[shaderModule] |
| 4677 | } |
| 4678 | |
| 4679 | macro ref!PipelineObject GetPipeline(VkPipeline pipeline) { |
| 4680 | assert(pipeline in State.Pipelines) |
| 4681 | return State.Pipelines[pipeline] |
| 4682 | } |
| 4683 | |
| 4684 | macro ref!PipelineLayoutObject GetPipelineLayout(VkPipelineLayout pipelineLayout) { |
| 4685 | assert(pipelineLayout in State.PipelineLayouts) |
| 4686 | return State.PipelineLayouts[pipelineLayout] |
| 4687 | } |
| 4688 | |
| 4689 | macro ref!SamplerObject GetSampler(VkSampler sampler) { |
| 4690 | assert(sampler in State.Samplers) |
| 4691 | return State.Samplers[sampler] |
| 4692 | } |
| 4693 | |
| 4694 | macro ref!DescriptorSetObject GetDescriptorSet(VkDescriptorSet descriptorSet) { |
| 4695 | assert(descriptorSet in State.DescriptorSets) |
| 4696 | return State.DescriptorSets[descriptorSet] |
| 4697 | } |
| 4698 | |
| 4699 | macro ref!DescriptorSetLayoutObject GetDescriptorSetLayout(VkDescriptorSetLayout descriptorSetLayout) { |
| 4700 | assert(descriptorSetLayout in State.DescriptorSetLayouts) |
| 4701 | return State.DescriptorSetLayouts[descriptorSetLayout] |
| 4702 | } |
| 4703 | |
| 4704 | macro ref!DescriptorPoolObject GetDescriptorPool(VkDescriptorPool descriptorPool) { |
| 4705 | assert(descriptorPool in State.DescriptorPools) |
| 4706 | return State.DescriptorPools[descriptorPool] |
| 4707 | } |
| 4708 | |
Jesse Hall | d27f6aa | 2015-08-15 17:58:48 -0700 | [diff] [blame] | 4709 | macro ref!FenceObject GetFence(VkFence fence) { |
| 4710 | assert(fence in State.Fences) |
| 4711 | return State.Fences[fence] |
| 4712 | } |
| 4713 | |
| 4714 | macro ref!SemaphoreObject GetSemaphore(VkSemaphore semaphore) { |
| 4715 | assert(semaphore in State.Semaphores) |
| 4716 | return State.Semaphores[semaphore] |
| 4717 | } |
| 4718 | |
| 4719 | macro ref!EventObject GetEvent(VkEvent event) { |
| 4720 | assert(event in State.Events) |
| 4721 | return State.Events[event] |
| 4722 | } |
| 4723 | |
| 4724 | macro ref!QueryPoolObject GetQueryPool(VkQueryPool queryPool) { |
| 4725 | assert(queryPool in State.QueryPools) |
| 4726 | return State.QueryPools[queryPool] |
| 4727 | } |
| 4728 | |
| 4729 | macro ref!FramebufferObject GetFramebuffer(VkFramebuffer framebuffer) { |
| 4730 | assert(framebuffer in State.Framebuffers) |
| 4731 | return State.Framebuffers[framebuffer] |
| 4732 | } |
| 4733 | |
| 4734 | macro ref!RenderPassObject GetRenderPass(VkRenderPass renderPass) { |
| 4735 | assert(renderPass in State.RenderPasses) |
| 4736 | return State.RenderPasses[renderPass] |
| 4737 | } |
| 4738 | |
| 4739 | macro ref!PipelineCacheObject GetPipelineCache(VkPipelineCache pipelineCache) { |
| 4740 | assert(pipelineCache in State.PipelineCaches) |
| 4741 | return State.PipelineCaches[pipelineCache] |
| 4742 | } |
| 4743 | |
| 4744 | macro ref!CmdPoolObject GetCmdPool(VkCmdPool cmdPool) { |
| 4745 | assert(cmdPool in State.CmdPools) |
| 4746 | return State.CmdPools[cmdPool] |
Jesse Hall | f09c6b1 | 2015-08-15 19:54:28 -0700 | [diff] [blame] | 4747 | } |
Michael Lentine | 88594d7 | 2015-11-12 12:49:45 -0800 | [diff] [blame] | 4748 | |
| 4749 | macro ref!SwapchainObject GetSwapchain(VkSwapchainKHR swapchain) { |
| 4750 | assert(swapchain in State.Swapchains) |
| 4751 | return State.Swapchains[swapchain] |
| 4752 | } |