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