Jesse Hall | d02edcb | 2015-09-08 07:44:48 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 17 | #include <hardware/hwvulkan.h> |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 18 | #include <vulkan/vk_ext_debug_report.h> |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 19 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 20 | #include <algorithm> |
| 21 | #include <array> |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 22 | #include <inttypes.h> |
| 23 | #include <string.h> |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 24 | |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 25 | #include <log/log.h> |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 26 | #include <utils/Errors.h> |
| 27 | |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 28 | #include "null_driver_gen.h" |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 29 | |
| 30 | using namespace null_driver; |
| 31 | |
| 32 | struct VkPhysicalDevice_T { |
| 33 | hwvulkan_dispatch_t dispatch; |
| 34 | }; |
| 35 | |
| 36 | struct VkInstance_T { |
| 37 | hwvulkan_dispatch_t dispatch; |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 38 | VkAllocationCallbacks allocator; |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 39 | VkPhysicalDevice_T physical_device; |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 40 | uint64_t next_callback_handle; |
| 41 | bool debug_report_enabled; |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | struct VkQueue_T { |
| 45 | hwvulkan_dispatch_t dispatch; |
| 46 | }; |
| 47 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 48 | struct VkCommandBuffer_T { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 49 | hwvulkan_dispatch_t dispatch; |
| 50 | }; |
| 51 | |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 52 | namespace { |
| 53 | // Handles for non-dispatchable objects are either pointers, or arbitrary |
| 54 | // 64-bit non-zero values. We only use pointers when we need to keep state for |
| 55 | // the object even in a null driver. For the rest, we form a handle as: |
| 56 | // [63:63] = 1 to distinguish from pointer handles* |
| 57 | // [62:56] = non-zero handle type enum value |
| 58 | // [55: 0] = per-handle-type incrementing counter |
| 59 | // * This works because virtual addresses with the high bit set are reserved |
| 60 | // for kernel data in all ABIs we run on. |
| 61 | // |
| 62 | // We never reclaim handles on vkDestroy*. It's not even necessary for us to |
| 63 | // have distinct handles for live objects, and practically speaking we won't |
| 64 | // ever create 2^56 objects of the same type from a single VkDevice in a null |
| 65 | // driver. |
| 66 | // |
| 67 | // Using a namespace here instead of 'enum class' since we want scoped |
| 68 | // constants but also want implicit conversions to integral types. |
| 69 | namespace HandleType { |
Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 70 | enum Enum { |
Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 71 | kBufferView, |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 72 | kDebugReportCallbackEXT, |
Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 73 | kDescriptorPool, |
| 74 | kDescriptorSet, |
| 75 | kDescriptorSetLayout, |
Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 76 | kEvent, |
| 77 | kFence, |
| 78 | kFramebuffer, |
| 79 | kImageView, |
| 80 | kPipeline, |
| 81 | kPipelineCache, |
| 82 | kPipelineLayout, |
| 83 | kQueryPool, |
| 84 | kRenderPass, |
| 85 | kSampler, |
| 86 | kSemaphore, |
Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 87 | kShaderModule, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 88 | |
Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 89 | kNumTypes |
| 90 | }; |
| 91 | } // namespace HandleType |
Jesse Hall | bde8ee3 | 2015-09-01 16:24:29 -0700 | [diff] [blame] | 92 | |
| 93 | const VkDeviceSize kMaxDeviceMemory = VkDeviceSize(INTPTR_MAX) + 1; |
| 94 | |
Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 95 | } // anonymous namespace |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 96 | |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 97 | struct VkDevice_T { |
| 98 | hwvulkan_dispatch_t dispatch; |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 99 | VkAllocationCallbacks allocator; |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 100 | VkInstance_T* instance; |
| 101 | VkQueue_T queue; |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 102 | std::array<uint64_t, HandleType::kNumTypes> next_handle; |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | // ----------------------------------------------------------------------------- |
| 106 | // Declare HAL_MODULE_INFO_SYM early so it can be referenced by nulldrv_device |
| 107 | // later. |
| 108 | |
| 109 | namespace { |
| 110 | int OpenDevice(const hw_module_t* module, const char* id, hw_device_t** device); |
| 111 | hw_module_methods_t nulldrv_module_methods = {.open = OpenDevice}; |
| 112 | } // namespace |
| 113 | |
| 114 | #pragma clang diagnostic push |
| 115 | #pragma clang diagnostic ignored "-Wmissing-variable-declarations" |
| 116 | __attribute__((visibility("default"))) hwvulkan_module_t HAL_MODULE_INFO_SYM = { |
| 117 | .common = |
| 118 | { |
Michael Lentine | 03c64b0 | 2015-08-26 18:27:26 -0500 | [diff] [blame] | 119 | .tag = HARDWARE_MODULE_TAG, |
| 120 | .module_api_version = HWVULKAN_MODULE_API_VERSION_0_1, |
| 121 | .hal_api_version = HARDWARE_HAL_API_VERSION, |
| 122 | .id = HWVULKAN_HARDWARE_MODULE_ID, |
| 123 | .name = "Null Vulkan Driver", |
| 124 | .author = "The Android Open Source Project", |
| 125 | .methods = &nulldrv_module_methods, |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 126 | }, |
| 127 | }; |
| 128 | #pragma clang diagnostic pop |
| 129 | |
| 130 | // ----------------------------------------------------------------------------- |
| 131 | |
| 132 | namespace { |
| 133 | |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 134 | int CloseDevice(struct hw_device_t* /*device*/) { |
| 135 | // nothing to do - opening a device doesn't allocate any resources |
| 136 | return 0; |
| 137 | } |
| 138 | |
| 139 | hwvulkan_device_t nulldrv_device = { |
| 140 | .common = |
| 141 | { |
Michael Lentine | 03c64b0 | 2015-08-26 18:27:26 -0500 | [diff] [blame] | 142 | .tag = HARDWARE_DEVICE_TAG, |
| 143 | .version = HWVULKAN_DEVICE_API_VERSION_0_1, |
| 144 | .module = &HAL_MODULE_INFO_SYM.common, |
| 145 | .close = CloseDevice, |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 146 | }, |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 147 | .EnumerateInstanceExtensionProperties = |
| 148 | EnumerateInstanceExtensionProperties, |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 149 | .CreateInstance = CreateInstance, |
| 150 | .GetInstanceProcAddr = GetInstanceProcAddr}; |
| 151 | |
| 152 | int OpenDevice(const hw_module_t* /*module*/, |
| 153 | const char* id, |
| 154 | hw_device_t** device) { |
| 155 | if (strcmp(id, HWVULKAN_DEVICE_0) == 0) { |
| 156 | *device = &nulldrv_device.common; |
| 157 | return 0; |
| 158 | } |
| 159 | return -ENOENT; |
| 160 | } |
| 161 | |
| 162 | VkInstance_T* GetInstanceFromPhysicalDevice( |
| 163 | VkPhysicalDevice_T* physical_device) { |
| 164 | return reinterpret_cast<VkInstance_T*>( |
| 165 | reinterpret_cast<uintptr_t>(physical_device) - |
| 166 | offsetof(VkInstance_T, physical_device)); |
| 167 | } |
| 168 | |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 169 | uint64_t AllocHandle(uint64_t type, uint64_t* next_handle) { |
| 170 | const uint64_t kHandleMask = (UINT64_C(1) << 56) - 1; |
| 171 | ALOGE_IF(*next_handle == kHandleMask, |
| 172 | "non-dispatchable handles of type=%" PRIu64 |
| 173 | " are about to overflow", |
| 174 | type); |
| 175 | return (UINT64_C(1) << 63) | ((type & 0x7) << 56) | |
| 176 | ((*next_handle)++ & kHandleMask); |
| 177 | } |
| 178 | |
| 179 | template <class Handle> |
| 180 | Handle AllocHandle(VkInstance instance, HandleType::Enum type) { |
| 181 | return reinterpret_cast<Handle>( |
| 182 | AllocHandle(type, &instance->next_callback_handle)); |
| 183 | } |
| 184 | |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 185 | template <class Handle> |
| 186 | Handle AllocHandle(VkDevice device, HandleType::Enum type) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 187 | return reinterpret_cast<Handle>( |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 188 | AllocHandle(type, &device->next_handle[type])); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 189 | } |
| 190 | |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 191 | } // namespace |
| 192 | |
| 193 | namespace null_driver { |
| 194 | |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 195 | #define DEFINE_OBJECT_HANDLE_CONVERSION(T) \ |
| 196 | T* Get##T##FromHandle(Vk##T h); \ |
| 197 | T* Get##T##FromHandle(Vk##T h) { \ |
| 198 | return reinterpret_cast<T*>(uintptr_t(h)); \ |
| 199 | } \ |
| 200 | Vk##T GetHandleTo##T(const T* obj); \ |
| 201 | Vk##T GetHandleTo##T(const T* obj) { \ |
| 202 | return Vk##T(reinterpret_cast<uintptr_t>(obj)); \ |
| 203 | } |
Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 204 | |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 205 | // ----------------------------------------------------------------------------- |
| 206 | // Global |
| 207 | |
Jesse Hall | e1b1278 | 2015-11-30 11:27:32 -0800 | [diff] [blame] | 208 | VKAPI_ATTR |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 209 | VkResult EnumerateInstanceExtensionProperties( |
| 210 | const char* layer_name, |
| 211 | uint32_t* count, |
| 212 | VkExtensionProperties* properties) { |
| 213 | if (layer_name) { |
| 214 | ALOGW( |
| 215 | "Driver vkEnumerateInstanceExtensionProperties shouldn't be called " |
| 216 | "with a layer name ('%s')", |
| 217 | layer_name); |
| 218 | *count = 0; |
| 219 | return VK_SUCCESS; |
| 220 | } |
| 221 | |
| 222 | const VkExtensionProperties kExtensions[] = { |
| 223 | {VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}}; |
| 224 | const uint32_t kExtensionsCount = |
| 225 | sizeof(kExtensions) / sizeof(kExtensions[0]); |
| 226 | |
| 227 | if (!properties || *count > kExtensionsCount) |
| 228 | *count = kExtensionsCount; |
| 229 | if (properties) |
| 230 | std::copy(kExtensions, kExtensions + *count, properties); |
| 231 | return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS; |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 232 | } |
| 233 | |
Jesse Hall | e1b1278 | 2015-11-30 11:27:32 -0800 | [diff] [blame] | 234 | VKAPI_ATTR |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 235 | VkResult CreateInstance(const VkInstanceCreateInfo* create_info, |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 236 | const VkAllocationCallbacks* allocator, |
| 237 | VkInstance* out_instance) { |
| 238 | // Assume the loader provided alloc callbacks even if the app didn't. |
| 239 | ALOG_ASSERT( |
| 240 | allocator, |
| 241 | "Missing alloc callbacks, loader or app should have provided them"); |
| 242 | |
| 243 | VkInstance_T* instance = |
| 244 | static_cast<VkInstance_T*>(allocator->pfnAllocation( |
| 245 | allocator->pUserData, sizeof(VkInstance_T), alignof(VkInstance_T), |
| 246 | VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE)); |
| 247 | if (!instance) |
| 248 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 249 | |
| 250 | instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC; |
| 251 | instance->allocator = *allocator; |
| 252 | instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC; |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 253 | instance->next_callback_handle = 0; |
| 254 | instance->debug_report_enabled = false; |
| 255 | |
| 256 | for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) { |
| 257 | if (strcmp(create_info->ppEnabledExtensionNames[i], |
| 258 | VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) { |
| 259 | ALOGV("Enabling " VK_EXT_DEBUG_REPORT_EXTENSION_NAME); |
| 260 | instance->debug_report_enabled = true; |
| 261 | } |
| 262 | } |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 263 | |
| 264 | *out_instance = instance; |
| 265 | return VK_SUCCESS; |
| 266 | } |
| 267 | |
| 268 | VKAPI_ATTR |
| 269 | PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name) { |
| 270 | return instance ? GetInstanceProcAddr(name) : GetGlobalProcAddr(name); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 271 | } |
| 272 | |
Jesse Hall | e1b1278 | 2015-11-30 11:27:32 -0800 | [diff] [blame] | 273 | VKAPI_ATTR |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 274 | PFN_vkVoidFunction GetDeviceProcAddr(VkDevice, const char* name) { |
Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 275 | return GetInstanceProcAddr(name); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 276 | } |
| 277 | |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 278 | // ----------------------------------------------------------------------------- |
| 279 | // Instance |
| 280 | |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 281 | void DestroyInstance(VkInstance instance, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 282 | const VkAllocationCallbacks* /*allocator*/) { |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 283 | instance->allocator.pfnFree(instance->allocator.pUserData, instance); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 284 | } |
| 285 | |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 286 | // ----------------------------------------------------------------------------- |
| 287 | // PhysicalDevice |
| 288 | |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 289 | VkResult EnumeratePhysicalDevices(VkInstance instance, |
| 290 | uint32_t* physical_device_count, |
| 291 | VkPhysicalDevice* physical_devices) { |
| 292 | if (physical_devices && *physical_device_count >= 1) |
| 293 | physical_devices[0] = &instance->physical_device; |
| 294 | *physical_device_count = 1; |
| 295 | return VK_SUCCESS; |
| 296 | } |
| 297 | |
Jesse Hall | 57f7f8c | 2016-01-17 17:21:36 -0800 | [diff] [blame^] | 298 | VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice /*gpu*/, |
| 299 | uint32_t* count, |
| 300 | VkLayerProperties* /*properties*/) { |
| 301 | ALOGW("Driver vkEnumerateDeviceLayerProperties shouldn't be called"); |
| 302 | *count = 0; |
| 303 | return VK_SUCCESS; |
| 304 | } |
| 305 | |
| 306 | VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice /*gpu*/, |
| 307 | const char* layer_name, |
| 308 | uint32_t* count, |
| 309 | VkExtensionProperties* properties) { |
| 310 | if (layer_name) { |
| 311 | ALOGW( |
| 312 | "Driver vkEnumerateDeviceExtensionProperties shouldn't be called " |
| 313 | "with a layer name ('%s')", |
| 314 | layer_name); |
| 315 | *count = 0; |
| 316 | return VK_SUCCESS; |
| 317 | } |
| 318 | |
| 319 | const VkExtensionProperties kExtensions[] = { |
| 320 | {VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME, |
| 321 | VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION}}; |
| 322 | const uint32_t kExtensionsCount = |
| 323 | sizeof(kExtensions) / sizeof(kExtensions[0]); |
| 324 | |
| 325 | if (!properties || *count > kExtensionsCount) |
| 326 | *count = kExtensionsCount; |
| 327 | if (properties) |
| 328 | std::copy(kExtensions, kExtensions + *count, properties); |
| 329 | return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS; |
| 330 | } |
| 331 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 332 | void GetPhysicalDeviceProperties(VkPhysicalDevice, |
| 333 | VkPhysicalDeviceProperties* properties) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 334 | properties->apiVersion = VK_API_VERSION; |
| 335 | properties->driverVersion = VK_MAKE_VERSION(0, 0, 1); |
Jesse Hall | 65ab552 | 2015-11-30 00:07:16 -0800 | [diff] [blame] | 336 | properties->vendorID = 0; |
| 337 | properties->deviceID = 0; |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 338 | properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER; |
| 339 | strcpy(properties->deviceName, "Android Vulkan Null Driver"); |
| 340 | memset(properties->pipelineCacheUUID, 0, |
| 341 | sizeof(properties->pipelineCacheUUID)); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 342 | } |
| 343 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 344 | void GetPhysicalDeviceQueueFamilyProperties( |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 345 | VkPhysicalDevice, |
| 346 | uint32_t* count, |
| 347 | VkQueueFamilyProperties* properties) { |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 348 | if (!properties || *count > 1) |
| 349 | *count = 1; |
| 350 | if (properties && *count == 1) { |
Jesse Hall | 65ab552 | 2015-11-30 00:07:16 -0800 | [diff] [blame] | 351 | properties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | |
| 352 | VK_QUEUE_TRANSFER_BIT; |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 353 | properties->queueCount = 1; |
Jesse Hall | acfa534 | 2015-11-19 21:51:33 -0800 | [diff] [blame] | 354 | properties->timestampValidBits = 64; |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 355 | properties->minImageTransferGranularity = VkExtent3D{1, 1, 1}; |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 356 | } |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 357 | } |
| 358 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 359 | void GetPhysicalDeviceMemoryProperties( |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 360 | VkPhysicalDevice, |
| 361 | VkPhysicalDeviceMemoryProperties* properties) { |
| 362 | properties->memoryTypeCount = 1; |
| 363 | properties->memoryTypes[0].propertyFlags = |
Jesse Hall | d1af812 | 2015-11-29 23:50:38 -0800 | [diff] [blame] | 364 | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | |
| 365 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | |
| 366 | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | |
| 367 | VK_MEMORY_PROPERTY_HOST_CACHED_BIT; |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 368 | properties->memoryTypes[0].heapIndex = 0; |
| 369 | properties->memoryHeapCount = 1; |
Jesse Hall | bde8ee3 | 2015-09-01 16:24:29 -0700 | [diff] [blame] | 370 | properties->memoryHeaps[0].size = kMaxDeviceMemory; |
Jesse Hall | d1af812 | 2015-11-29 23:50:38 -0800 | [diff] [blame] | 371 | properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT; |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 372 | } |
| 373 | |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 374 | // ----------------------------------------------------------------------------- |
| 375 | // Device |
| 376 | |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 377 | VkResult CreateDevice(VkPhysicalDevice physical_device, |
| 378 | const VkDeviceCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 379 | const VkAllocationCallbacks* allocator, |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 380 | VkDevice* out_device) { |
| 381 | VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device); |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 382 | if (!allocator) |
| 383 | allocator = &instance->allocator; |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 384 | VkDevice_T* device = static_cast<VkDevice_T*>(allocator->pfnAllocation( |
| 385 | allocator->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T), |
| 386 | VK_SYSTEM_ALLOCATION_SCOPE_DEVICE)); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 387 | if (!device) |
| 388 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 389 | |
| 390 | device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC; |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 391 | device->allocator = *allocator; |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 392 | device->instance = instance; |
| 393 | device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC; |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 394 | std::fill(device->next_handle.begin(), device->next_handle.end(), |
| 395 | UINT64_C(0)); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 396 | |
| 397 | *out_device = device; |
| 398 | return VK_SUCCESS; |
| 399 | } |
| 400 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 401 | void DestroyDevice(VkDevice device, |
| 402 | const VkAllocationCallbacks* /*allocator*/) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 403 | if (!device) |
Jesse Hall | cf25c41 | 2015-10-29 17:14:50 -0700 | [diff] [blame] | 404 | return; |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 405 | device->allocator.pfnFree(device->allocator.pUserData, device); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 406 | } |
| 407 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 408 | void GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 409 | *queue = &device->queue; |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | // ----------------------------------------------------------------------------- |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 413 | // CommandPool |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 414 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 415 | struct CommandPool { |
| 416 | typedef VkCommandPool HandleType; |
| 417 | VkAllocationCallbacks allocator; |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 418 | }; |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 419 | DEFINE_OBJECT_HANDLE_CONVERSION(CommandPool) |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 420 | |
| 421 | VkResult CreateCommandPool(VkDevice device, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 422 | const VkCommandPoolCreateInfo* /*create_info*/, |
| 423 | const VkAllocationCallbacks* allocator, |
| 424 | VkCommandPool* cmd_pool) { |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 425 | if (!allocator) |
| 426 | allocator = &device->allocator; |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 427 | CommandPool* pool = static_cast<CommandPool*>(allocator->pfnAllocation( |
| 428 | allocator->pUserData, sizeof(CommandPool), alignof(CommandPool), |
| 429 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 430 | if (!pool) |
| 431 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 432 | pool->allocator = *allocator; |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 433 | *cmd_pool = GetHandleToCommandPool(pool); |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 434 | return VK_SUCCESS; |
| 435 | } |
| 436 | |
| 437 | void DestroyCommandPool(VkDevice /*device*/, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 438 | VkCommandPool cmd_pool, |
| 439 | const VkAllocationCallbacks* /*allocator*/) { |
| 440 | CommandPool* pool = GetCommandPoolFromHandle(cmd_pool); |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 441 | pool->allocator.pfnFree(pool->allocator.pUserData, pool); |
| 442 | } |
| 443 | |
| 444 | // ----------------------------------------------------------------------------- |
Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 445 | // CmdBuffer |
| 446 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 447 | VkResult AllocateCommandBuffers(VkDevice /*device*/, |
| 448 | const VkCommandBufferAllocateInfo* alloc_info, |
| 449 | VkCommandBuffer* cmdbufs) { |
Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 450 | VkResult result = VK_SUCCESS; |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 451 | CommandPool& pool = *GetCommandPoolFromHandle(alloc_info->commandPool); |
Jesse Hall | 3dd678a | 2016-01-08 21:52:01 -0800 | [diff] [blame] | 452 | std::fill(cmdbufs, cmdbufs + alloc_info->commandBufferCount, nullptr); |
| 453 | for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) { |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 454 | cmdbufs[i] = |
| 455 | static_cast<VkCommandBuffer_T*>(pool.allocator.pfnAllocation( |
| 456 | pool.allocator.pUserData, sizeof(VkCommandBuffer_T), |
| 457 | alignof(VkCommandBuffer_T), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); |
Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 458 | if (!cmdbufs[i]) { |
| 459 | result = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 460 | break; |
| 461 | } |
| 462 | cmdbufs[i]->dispatch.magic = HWVULKAN_DISPATCH_MAGIC; |
| 463 | } |
| 464 | if (result != VK_SUCCESS) { |
Jesse Hall | 3dd678a | 2016-01-08 21:52:01 -0800 | [diff] [blame] | 465 | for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) { |
Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 466 | if (!cmdbufs[i]) |
| 467 | break; |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 468 | pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]); |
Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 469 | } |
| 470 | } |
Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 471 | return result; |
Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 472 | } |
| 473 | |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 474 | void FreeCommandBuffers(VkDevice /*device*/, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 475 | VkCommandPool cmd_pool, |
Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 476 | uint32_t count, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 477 | const VkCommandBuffer* cmdbufs) { |
| 478 | CommandPool& pool = *GetCommandPoolFromHandle(cmd_pool); |
Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 479 | for (uint32_t i = 0; i < count; i++) |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 480 | pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]); |
Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 481 | } |
| 482 | |
| 483 | // ----------------------------------------------------------------------------- |
Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 484 | // DeviceMemory |
| 485 | |
| 486 | struct DeviceMemory { |
| 487 | typedef VkDeviceMemory HandleType; |
| 488 | VkDeviceSize size; |
| 489 | alignas(16) uint8_t data[0]; |
| 490 | }; |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 491 | DEFINE_OBJECT_HANDLE_CONVERSION(DeviceMemory) |
Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 492 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 493 | VkResult AllocateMemory(VkDevice device, |
| 494 | const VkMemoryAllocateInfo* alloc_info, |
| 495 | const VkAllocationCallbacks* allocator, |
| 496 | VkDeviceMemory* mem_handle) { |
Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 497 | if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize) |
| 498 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 499 | if (!allocator) |
| 500 | allocator = &device->allocator; |
Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 501 | |
Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 502 | size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize); |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 503 | DeviceMemory* mem = static_cast<DeviceMemory*>(allocator->pfnAllocation( |
| 504 | allocator->pUserData, size, alignof(DeviceMemory), |
| 505 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); |
Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 506 | if (!mem) |
| 507 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 508 | mem->size = size; |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 509 | *mem_handle = GetHandleToDeviceMemory(mem); |
Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 510 | return VK_SUCCESS; |
| 511 | } |
| 512 | |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 513 | void FreeMemory(VkDevice device, |
| 514 | VkDeviceMemory mem_handle, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 515 | const VkAllocationCallbacks* allocator) { |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 516 | if (!allocator) |
| 517 | allocator = &device->allocator; |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 518 | DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle); |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 519 | allocator->pfnFree(allocator->pUserData, mem); |
Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 520 | } |
| 521 | |
| 522 | VkResult MapMemory(VkDevice, |
| 523 | VkDeviceMemory mem_handle, |
| 524 | VkDeviceSize offset, |
| 525 | VkDeviceSize, |
| 526 | VkMemoryMapFlags, |
| 527 | void** out_ptr) { |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 528 | DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle); |
Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 529 | *out_ptr = &mem->data[0] + offset; |
| 530 | return VK_SUCCESS; |
| 531 | } |
| 532 | |
| 533 | // ----------------------------------------------------------------------------- |
Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 534 | // Buffer |
| 535 | |
| 536 | struct Buffer { |
| 537 | typedef VkBuffer HandleType; |
| 538 | VkDeviceSize size; |
| 539 | }; |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 540 | DEFINE_OBJECT_HANDLE_CONVERSION(Buffer) |
Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 541 | |
| 542 | VkResult CreateBuffer(VkDevice device, |
| 543 | const VkBufferCreateInfo* create_info, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 544 | const VkAllocationCallbacks* allocator, |
Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 545 | VkBuffer* buffer_handle) { |
Jesse Hall | bde8ee3 | 2015-09-01 16:24:29 -0700 | [diff] [blame] | 546 | ALOGW_IF(create_info->size > kMaxDeviceMemory, |
| 547 | "CreateBuffer: requested size 0x%" PRIx64 |
| 548 | " exceeds max device memory size 0x%" PRIx64, |
| 549 | create_info->size, kMaxDeviceMemory); |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 550 | if (!allocator) |
| 551 | allocator = &device->allocator; |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 552 | Buffer* buffer = static_cast<Buffer*>(allocator->pfnAllocation( |
| 553 | allocator->pUserData, sizeof(Buffer), alignof(Buffer), |
| 554 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); |
Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 555 | if (!buffer) |
| 556 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 557 | buffer->size = create_info->size; |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 558 | *buffer_handle = GetHandleToBuffer(buffer); |
Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 559 | return VK_SUCCESS; |
| 560 | } |
| 561 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 562 | void GetBufferMemoryRequirements(VkDevice, |
| 563 | VkBuffer buffer_handle, |
| 564 | VkMemoryRequirements* requirements) { |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 565 | Buffer* buffer = GetBufferFromHandle(buffer_handle); |
Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 566 | requirements->size = buffer->size; |
| 567 | requirements->alignment = 16; // allow fast Neon/SSE memcpy |
| 568 | requirements->memoryTypeBits = 0x1; |
Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 569 | } |
| 570 | |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 571 | void DestroyBuffer(VkDevice device, |
| 572 | VkBuffer buffer_handle, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 573 | const VkAllocationCallbacks* allocator) { |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 574 | if (!allocator) |
| 575 | allocator = &device->allocator; |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 576 | Buffer* buffer = GetBufferFromHandle(buffer_handle); |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 577 | allocator->pfnFree(allocator->pUserData, buffer); |
Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 578 | } |
| 579 | |
| 580 | // ----------------------------------------------------------------------------- |
Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 581 | // Image |
| 582 | |
| 583 | struct Image { |
| 584 | typedef VkImage HandleType; |
| 585 | VkDeviceSize size; |
| 586 | }; |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 587 | DEFINE_OBJECT_HANDLE_CONVERSION(Image) |
Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 588 | |
| 589 | VkResult CreateImage(VkDevice device, |
| 590 | const VkImageCreateInfo* create_info, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 591 | const VkAllocationCallbacks* allocator, |
Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 592 | VkImage* image_handle) { |
| 593 | if (create_info->imageType != VK_IMAGE_TYPE_2D || |
| 594 | create_info->format != VK_FORMAT_R8G8B8A8_UNORM || |
| 595 | create_info->mipLevels != 1) { |
| 596 | ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u", |
| 597 | create_info->imageType, create_info->format, |
| 598 | create_info->mipLevels); |
Jesse Hall | a15a4bf | 2015-11-19 22:48:02 -0800 | [diff] [blame] | 599 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 600 | } |
| 601 | |
| 602 | VkDeviceSize size = |
| 603 | VkDeviceSize(create_info->extent.width * create_info->extent.height) * |
Jesse Hall | a15a4bf | 2015-11-19 22:48:02 -0800 | [diff] [blame] | 604 | create_info->arrayLayers * create_info->samples * 4u; |
Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 605 | ALOGW_IF(size > kMaxDeviceMemory, |
| 606 | "CreateImage: image size 0x%" PRIx64 |
| 607 | " exceeds max device memory size 0x%" PRIx64, |
| 608 | size, kMaxDeviceMemory); |
| 609 | |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 610 | if (!allocator) |
| 611 | allocator = &device->allocator; |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 612 | Image* image = static_cast<Image*>(allocator->pfnAllocation( |
| 613 | allocator->pUserData, sizeof(Image), alignof(Image), |
| 614 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); |
Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 615 | if (!image) |
| 616 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 617 | image->size = size; |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 618 | *image_handle = GetHandleToImage(image); |
Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 619 | return VK_SUCCESS; |
| 620 | } |
| 621 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 622 | void GetImageMemoryRequirements(VkDevice, |
| 623 | VkImage image_handle, |
| 624 | VkMemoryRequirements* requirements) { |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 625 | Image* image = GetImageFromHandle(image_handle); |
Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 626 | requirements->size = image->size; |
| 627 | requirements->alignment = 16; // allow fast Neon/SSE memcpy |
| 628 | requirements->memoryTypeBits = 0x1; |
Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 629 | } |
| 630 | |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 631 | void DestroyImage(VkDevice device, |
| 632 | VkImage image_handle, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 633 | const VkAllocationCallbacks* allocator) { |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 634 | if (!allocator) |
| 635 | allocator = &device->allocator; |
Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 636 | Image* image = GetImageFromHandle(image_handle); |
Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 637 | allocator->pfnFree(allocator->pUserData, image); |
Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 638 | } |
| 639 | |
Jesse Hall | 57f7f8c | 2016-01-17 17:21:36 -0800 | [diff] [blame^] | 640 | VkResult GetSwapchainGrallocUsageANDROID(VkDevice, |
| 641 | VkFormat, |
| 642 | VkImageUsageFlags, |
| 643 | int* grallocUsage) { |
| 644 | // The null driver never reads or writes the gralloc buffer |
| 645 | *grallocUsage = 0; |
| 646 | return VK_SUCCESS; |
| 647 | } |
| 648 | |
| 649 | VkResult AcquireImageANDROID(VkDevice, |
| 650 | VkImage, |
| 651 | int fence, |
| 652 | VkSemaphore, |
| 653 | VkFence) { |
| 654 | close(fence); |
| 655 | return VK_SUCCESS; |
| 656 | } |
| 657 | |
| 658 | VkResult QueueSignalReleaseImageANDROID(VkQueue, |
| 659 | uint32_t, |
| 660 | const VkSemaphore*, |
| 661 | VkImage, |
| 662 | int* fence) { |
| 663 | *fence = -1; |
| 664 | return VK_SUCCESS; |
| 665 | } |
| 666 | |
Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 667 | // ----------------------------------------------------------------------------- |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 668 | // No-op types |
| 669 | |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 670 | VkResult CreateBufferView(VkDevice device, |
| 671 | const VkBufferViewCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 672 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 673 | VkBufferView* view) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 674 | *view = AllocHandle<VkBufferView>(device, HandleType::kBufferView); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 675 | return VK_SUCCESS; |
| 676 | } |
| 677 | |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 678 | VkResult CreateDescriptorPool(VkDevice device, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 679 | const VkDescriptorPoolCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 680 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 681 | VkDescriptorPool* pool) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 682 | *pool = AllocHandle<VkDescriptorPool>(device, HandleType::kDescriptorPool); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 683 | return VK_SUCCESS; |
| 684 | } |
| 685 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 686 | VkResult AllocateDescriptorSets(VkDevice device, |
| 687 | const VkDescriptorSetAllocateInfo* alloc_info, |
| 688 | VkDescriptorSet* descriptor_sets) { |
Jesse Hall | 3dd678a | 2016-01-08 21:52:01 -0800 | [diff] [blame] | 689 | for (uint32_t i = 0; i < alloc_info->descriptorSetCount; i++) |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 690 | descriptor_sets[i] = |
| 691 | AllocHandle<VkDescriptorSet>(device, HandleType::kDescriptorSet); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 692 | return VK_SUCCESS; |
| 693 | } |
| 694 | |
| 695 | VkResult CreateDescriptorSetLayout(VkDevice device, |
| 696 | const VkDescriptorSetLayoutCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 697 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 698 | VkDescriptorSetLayout* layout) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 699 | *layout = AllocHandle<VkDescriptorSetLayout>( |
| 700 | device, HandleType::kDescriptorSetLayout); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 701 | return VK_SUCCESS; |
| 702 | } |
| 703 | |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 704 | VkResult CreateEvent(VkDevice device, |
| 705 | const VkEventCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 706 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 707 | VkEvent* event) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 708 | *event = AllocHandle<VkEvent>(device, HandleType::kEvent); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 709 | return VK_SUCCESS; |
| 710 | } |
| 711 | |
| 712 | VkResult CreateFence(VkDevice device, |
| 713 | const VkFenceCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 714 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 715 | VkFence* fence) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 716 | *fence = AllocHandle<VkFence>(device, HandleType::kFence); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 717 | return VK_SUCCESS; |
| 718 | } |
| 719 | |
| 720 | VkResult CreateFramebuffer(VkDevice device, |
| 721 | const VkFramebufferCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 722 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 723 | VkFramebuffer* framebuffer) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 724 | *framebuffer = AllocHandle<VkFramebuffer>(device, HandleType::kFramebuffer); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 725 | return VK_SUCCESS; |
| 726 | } |
| 727 | |
| 728 | VkResult CreateImageView(VkDevice device, |
| 729 | const VkImageViewCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 730 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 731 | VkImageView* view) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 732 | *view = AllocHandle<VkImageView>(device, HandleType::kImageView); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 733 | return VK_SUCCESS; |
| 734 | } |
| 735 | |
| 736 | VkResult CreateGraphicsPipelines(VkDevice device, |
| 737 | VkPipelineCache, |
| 738 | uint32_t count, |
| 739 | const VkGraphicsPipelineCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 740 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 741 | VkPipeline* pipelines) { |
| 742 | for (uint32_t i = 0; i < count; i++) |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 743 | pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 744 | return VK_SUCCESS; |
| 745 | } |
| 746 | |
| 747 | VkResult CreateComputePipelines(VkDevice device, |
| 748 | VkPipelineCache, |
| 749 | uint32_t count, |
| 750 | const VkComputePipelineCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 751 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 752 | VkPipeline* pipelines) { |
| 753 | for (uint32_t i = 0; i < count; i++) |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 754 | pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 755 | return VK_SUCCESS; |
| 756 | } |
| 757 | |
| 758 | VkResult CreatePipelineCache(VkDevice device, |
| 759 | const VkPipelineCacheCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 760 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 761 | VkPipelineCache* cache) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 762 | *cache = AllocHandle<VkPipelineCache>(device, HandleType::kPipelineCache); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 763 | return VK_SUCCESS; |
| 764 | } |
| 765 | |
| 766 | VkResult CreatePipelineLayout(VkDevice device, |
| 767 | const VkPipelineLayoutCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 768 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 769 | VkPipelineLayout* layout) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 770 | *layout = |
| 771 | AllocHandle<VkPipelineLayout>(device, HandleType::kPipelineLayout); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 772 | return VK_SUCCESS; |
| 773 | } |
| 774 | |
| 775 | VkResult CreateQueryPool(VkDevice device, |
| 776 | const VkQueryPoolCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 777 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 778 | VkQueryPool* pool) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 779 | *pool = AllocHandle<VkQueryPool>(device, HandleType::kQueryPool); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 780 | return VK_SUCCESS; |
| 781 | } |
| 782 | |
| 783 | VkResult CreateRenderPass(VkDevice device, |
| 784 | const VkRenderPassCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 785 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 786 | VkRenderPass* renderpass) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 787 | *renderpass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 788 | return VK_SUCCESS; |
| 789 | } |
| 790 | |
| 791 | VkResult CreateSampler(VkDevice device, |
| 792 | const VkSamplerCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 793 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 794 | VkSampler* sampler) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 795 | *sampler = AllocHandle<VkSampler>(device, HandleType::kSampler); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 796 | return VK_SUCCESS; |
| 797 | } |
| 798 | |
| 799 | VkResult CreateSemaphore(VkDevice device, |
| 800 | const VkSemaphoreCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 801 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 802 | VkSemaphore* semaphore) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 803 | *semaphore = AllocHandle<VkSemaphore>(device, HandleType::kSemaphore); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 804 | return VK_SUCCESS; |
| 805 | } |
| 806 | |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 807 | VkResult CreateShaderModule(VkDevice device, |
| 808 | const VkShaderModuleCreateInfo*, |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 809 | const VkAllocationCallbacks* /*allocator*/, |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 810 | VkShaderModule* module) { |
Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 811 | *module = AllocHandle<VkShaderModule>(device, HandleType::kShaderModule); |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 812 | return VK_SUCCESS; |
| 813 | } |
| 814 | |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 815 | VkResult CreateDebugReportCallbackEXT(VkInstance instance, |
| 816 | const VkDebugReportCallbackCreateInfoEXT*, |
| 817 | const VkAllocationCallbacks*, |
| 818 | VkDebugReportCallbackEXT* callback) { |
| 819 | *callback = AllocHandle<VkDebugReportCallbackEXT>( |
| 820 | instance, HandleType::kDebugReportCallbackEXT); |
| 821 | return VK_SUCCESS; |
| 822 | } |
| 823 | |
Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 824 | // ----------------------------------------------------------------------------- |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 825 | // No-op entrypoints |
| 826 | |
| 827 | // clang-format off |
| 828 | #pragma clang diagnostic push |
| 829 | #pragma clang diagnostic ignored "-Wunused-parameter" |
| 830 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 831 | void GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 832 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 833 | } |
| 834 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 835 | void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 836 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 837 | } |
| 838 | |
Jesse Hall | a9e5703 | 2015-11-30 01:03:10 -0800 | [diff] [blame] | 839 | VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 840 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | a9e5703 | 2015-11-30 01:03:10 -0800 | [diff] [blame] | 841 | return VK_SUCCESS; |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 842 | } |
| 843 | |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 844 | VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 845 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 846 | return VK_SUCCESS; |
| 847 | } |
| 848 | |
Jesse Hall | a366a51 | 2015-11-19 22:30:07 -0800 | [diff] [blame] | 849 | VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 850 | return VK_SUCCESS; |
| 851 | } |
| 852 | |
| 853 | VkResult QueueWaitIdle(VkQueue queue) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 854 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 855 | return VK_SUCCESS; |
| 856 | } |
| 857 | |
| 858 | VkResult DeviceWaitIdle(VkDevice device) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 859 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 860 | return VK_SUCCESS; |
| 861 | } |
| 862 | |
Jesse Hall | cf25c41 | 2015-10-29 17:14:50 -0700 | [diff] [blame] | 863 | void UnmapMemory(VkDevice device, VkDeviceMemory mem) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 864 | } |
| 865 | |
| 866 | VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 867 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 868 | return VK_SUCCESS; |
| 869 | } |
| 870 | |
| 871 | VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 872 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 873 | return VK_SUCCESS; |
| 874 | } |
| 875 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 876 | void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 877 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 878 | } |
| 879 | |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 880 | VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset) { |
| 881 | return VK_SUCCESS; |
| 882 | } |
| 883 | |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 884 | VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset) { |
| 885 | return VK_SUCCESS; |
| 886 | } |
| 887 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 888 | void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 889 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 890 | } |
| 891 | |
Jesse Hall | 091ed9e | 2015-11-30 00:55:29 -0800 | [diff] [blame] | 892 | void GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pNumProperties, VkSparseImageFormatProperties* pProperties) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 893 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 894 | } |
| 895 | |
Jesse Hall | a642925 | 2015-11-29 18:59:42 -0800 | [diff] [blame] | 896 | VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 897 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 898 | return VK_SUCCESS; |
| 899 | } |
| 900 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 901 | void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 902 | } |
| 903 | |
| 904 | VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) { |
| 905 | return VK_SUCCESS; |
| 906 | } |
| 907 | |
| 908 | VkResult GetFenceStatus(VkDevice device, VkFence fence) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 909 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 910 | return VK_SUCCESS; |
| 911 | } |
| 912 | |
| 913 | VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) { |
| 914 | return VK_SUCCESS; |
| 915 | } |
| 916 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 917 | void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 918 | } |
| 919 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 920 | void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 921 | } |
| 922 | |
| 923 | VkResult GetEventStatus(VkDevice device, VkEvent event) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 924 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 925 | return VK_SUCCESS; |
| 926 | } |
| 927 | |
| 928 | VkResult SetEvent(VkDevice device, VkEvent event) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 929 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 930 | return VK_SUCCESS; |
| 931 | } |
| 932 | |
| 933 | VkResult ResetEvent(VkDevice device, VkEvent event) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 934 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 935 | return VK_SUCCESS; |
| 936 | } |
| 937 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 938 | void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 939 | } |
| 940 | |
Jesse Hall | a9bb62b | 2015-11-21 19:31:56 -0800 | [diff] [blame] | 941 | VkResult GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 942 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 943 | return VK_SUCCESS; |
| 944 | } |
| 945 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 946 | void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 947 | } |
| 948 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 949 | void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 950 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 951 | } |
| 952 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 953 | void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 954 | } |
| 955 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 956 | void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 957 | } |
| 958 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 959 | void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 960 | } |
| 961 | |
Jesse Hall | a9bb62b | 2015-11-21 19:31:56 -0800 | [diff] [blame] | 962 | VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 963 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 964 | return VK_SUCCESS; |
| 965 | } |
| 966 | |
| 967 | VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 968 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 969 | return VK_SUCCESS; |
| 970 | } |
| 971 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 972 | void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 973 | } |
| 974 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 975 | void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 976 | } |
| 977 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 978 | void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 979 | } |
| 980 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 981 | void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 982 | } |
| 983 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 984 | void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 985 | } |
| 986 | |
Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 987 | VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 988 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 989 | return VK_SUCCESS; |
| 990 | } |
| 991 | |
Jesse Hall | cf25c41 | 2015-10-29 17:14:50 -0700 | [diff] [blame] | 992 | void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 993 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 994 | } |
| 995 | |
| 996 | VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 997 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 998 | return VK_SUCCESS; |
| 999 | } |
| 1000 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1001 | void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1002 | } |
| 1003 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1004 | void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* allocator) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1005 | } |
| 1006 | |
Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 1007 | void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1008 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1009 | } |
| 1010 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1011 | VkResult ResetCommandPool(VkDevice device, VkCommandPool cmdPool, VkCommandPoolResetFlags flags) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1012 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1013 | return VK_SUCCESS; |
| 1014 | } |
| 1015 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1016 | VkResult BeginCommandBuffer(VkCommandBuffer cmdBuffer, const VkCommandBufferBeginInfo* pBeginInfo) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1017 | return VK_SUCCESS; |
| 1018 | } |
| 1019 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1020 | VkResult EndCommandBuffer(VkCommandBuffer cmdBuffer) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1021 | return VK_SUCCESS; |
| 1022 | } |
| 1023 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1024 | VkResult ResetCommandBuffer(VkCommandBuffer cmdBuffer, VkCommandBufferResetFlags flags) { |
Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1025 | ALOGV("TODO: vk%s", __FUNCTION__); |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1026 | return VK_SUCCESS; |
| 1027 | } |
| 1028 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1029 | void CmdBindPipeline(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1030 | } |
| 1031 | |
Jesse Hall | f9fa9a5 | 2016-01-08 16:08:51 -0800 | [diff] [blame] | 1032 | void CmdSetViewport(VkCommandBuffer cmdBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1033 | } |
| 1034 | |
Jesse Hall | f9fa9a5 | 2016-01-08 16:08:51 -0800 | [diff] [blame] | 1035 | void CmdSetScissor(VkCommandBuffer cmdBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1036 | } |
| 1037 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1038 | void CmdSetLineWidth(VkCommandBuffer cmdBuffer, float lineWidth) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1039 | } |
| 1040 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1041 | void CmdSetDepthBias(VkCommandBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1042 | } |
| 1043 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1044 | void CmdSetBlendConstants(VkCommandBuffer cmdBuffer, const float blendConst[4]) { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1045 | } |
| 1046 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1047 | void CmdSetDepthBounds(VkCommandBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1048 | } |
| 1049 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1050 | void CmdSetStencilCompareMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1051 | } |
| 1052 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1053 | void CmdSetStencilWriteMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) { |
Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1054 | } |
| 1055 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1056 | void CmdSetStencilReference(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1057 | } |
| 1058 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1059 | void CmdBindDescriptorSets(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1060 | } |
| 1061 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1062 | void CmdBindIndexBuffer(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1063 | } |
| 1064 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1065 | void CmdBindVertexBuffers(VkCommandBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1066 | } |
| 1067 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1068 | void CmdDraw(VkCommandBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1069 | } |
| 1070 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1071 | void CmdDrawIndexed(VkCommandBuffer cmdBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1072 | } |
| 1073 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1074 | void CmdDrawIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1075 | } |
| 1076 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1077 | void CmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1078 | } |
| 1079 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1080 | void CmdDispatch(VkCommandBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1081 | } |
| 1082 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1083 | void CmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1084 | } |
| 1085 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1086 | void CmdCopyBuffer(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1087 | } |
| 1088 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1089 | void CmdCopyImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1090 | } |
| 1091 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1092 | void CmdBlitImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1093 | } |
| 1094 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1095 | void CmdCopyBufferToImage(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1096 | } |
| 1097 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1098 | void CmdCopyImageToBuffer(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1099 | } |
| 1100 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1101 | void CmdUpdateBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1102 | } |
| 1103 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1104 | void CmdFillBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1105 | } |
| 1106 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1107 | void CmdClearColorImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1108 | } |
| 1109 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1110 | void CmdClearDepthStencilImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1111 | } |
| 1112 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1113 | void CmdClearAttachments(VkCommandBuffer cmdBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1114 | } |
| 1115 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1116 | void CmdResolveImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1117 | } |
| 1118 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1119 | void CmdSetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1120 | } |
| 1121 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1122 | void CmdResetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1123 | } |
| 1124 | |
Jesse Hall | 3dd678a | 2016-01-08 21:52:01 -0800 | [diff] [blame] | 1125 | void CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1126 | } |
| 1127 | |
Jesse Hall | 3dd678a | 2016-01-08 21:52:01 -0800 | [diff] [blame] | 1128 | void CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1129 | } |
| 1130 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1131 | void CmdBeginQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1132 | } |
| 1133 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1134 | void CmdEndQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1135 | } |
| 1136 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1137 | void CmdResetQueryPool(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1138 | } |
| 1139 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1140 | void CmdWriteTimestamp(VkCommandBuffer cmdBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1141 | } |
| 1142 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1143 | void CmdCopyQueryPoolResults(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize destStride, VkQueryResultFlags flags) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1144 | } |
| 1145 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1146 | void CmdPushConstants(VkCommandBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1147 | } |
| 1148 | |
Jesse Hall | 65ab552 | 2015-11-30 00:07:16 -0800 | [diff] [blame] | 1149 | void CmdBeginRenderPass(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1150 | } |
| 1151 | |
Jesse Hall | 65ab552 | 2015-11-30 00:07:16 -0800 | [diff] [blame] | 1152 | void CmdNextSubpass(VkCommandBuffer cmdBuffer, VkSubpassContents contents) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1153 | } |
| 1154 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1155 | void CmdEndRenderPass(VkCommandBuffer cmdBuffer) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1156 | } |
| 1157 | |
Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1158 | void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers) { |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1159 | } |
| 1160 | |
Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 1161 | void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator) { |
| 1162 | } |
| 1163 | |
| 1164 | void DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage) { |
| 1165 | } |
| 1166 | |
Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1167 | #pragma clang diagnostic pop |
| 1168 | // clang-format on |
| 1169 | |
| 1170 | } // namespace null_driver |