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