| 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> | 
|  | 18 |  | 
| Dan Albert | 1916513 | 2017-12-13 13:40:17 -0800 | [diff] [blame] | 19 | #include <errno.h> | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 20 | #include <inttypes.h> | 
| Jesse Hall | d3b1450 | 2016-04-20 16:58:11 -0700 | [diff] [blame] | 21 | #include <stdlib.h> | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 22 | #include <string.h> | 
| Steven Moreland | 54409a3 | 2017-07-17 11:49:21 -0700 | [diff] [blame] | 23 | #include <unistd.h> | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 24 |  | 
| Mark Salyzyn | a5e161b | 2016-09-29 08:08:05 -0700 | [diff] [blame] | 25 | #include <algorithm> | 
|  | 26 | #include <array> | 
|  | 27 |  | 
| Mark Salyzyn | 7823e12 | 2016-09-29 08:08:05 -0700 | [diff] [blame] | 28 | #include <log/log.h> | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 29 |  | 
| Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 30 | #include "null_driver_gen.h" | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 31 |  | 
|  | 32 | using namespace null_driver; | 
|  | 33 |  | 
|  | 34 | struct VkPhysicalDevice_T { | 
|  | 35 | hwvulkan_dispatch_t dispatch; | 
|  | 36 | }; | 
|  | 37 |  | 
|  | 38 | struct VkInstance_T { | 
|  | 39 | hwvulkan_dispatch_t dispatch; | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 40 | VkAllocationCallbacks allocator; | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 41 | VkPhysicalDevice_T physical_device; | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 42 | uint64_t next_callback_handle; | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 43 | }; | 
|  | 44 |  | 
|  | 45 | struct VkQueue_T { | 
|  | 46 | hwvulkan_dispatch_t dispatch; | 
|  | 47 | }; | 
|  | 48 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 49 | struct VkCommandBuffer_T { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 50 | hwvulkan_dispatch_t dispatch; | 
|  | 51 | }; | 
|  | 52 |  | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 53 | namespace { | 
|  | 54 | // Handles for non-dispatchable objects are either pointers, or arbitrary | 
|  | 55 | // 64-bit non-zero values. We only use pointers when we need to keep state for | 
|  | 56 | // the object even in a null driver. For the rest, we form a handle as: | 
|  | 57 | //   [63:63] = 1 to distinguish from pointer handles* | 
|  | 58 | //   [62:56] = non-zero handle type enum value | 
|  | 59 | //   [55: 0] = per-handle-type incrementing counter | 
|  | 60 | // * This works because virtual addresses with the high bit set are reserved | 
|  | 61 | // for kernel data in all ABIs we run on. | 
|  | 62 | // | 
|  | 63 | // We never reclaim handles on vkDestroy*. It's not even necessary for us to | 
|  | 64 | // have distinct handles for live objects, and practically speaking we won't | 
|  | 65 | // ever create 2^56 objects of the same type from a single VkDevice in a null | 
|  | 66 | // driver. | 
|  | 67 | // | 
|  | 68 | // Using a namespace here instead of 'enum class' since we want scoped | 
|  | 69 | // constants but also want implicit conversions to integral types. | 
|  | 70 | namespace HandleType { | 
| Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 71 | enum Enum { | 
| Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 72 | kBufferView, | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 73 | kDebugReportCallbackEXT, | 
| Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 74 | kDescriptorPool, | 
|  | 75 | kDescriptorSet, | 
|  | 76 | kDescriptorSetLayout, | 
| Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 77 | kEvent, | 
|  | 78 | kFence, | 
|  | 79 | kFramebuffer, | 
|  | 80 | kImageView, | 
|  | 81 | kPipeline, | 
|  | 82 | kPipelineCache, | 
|  | 83 | kPipelineLayout, | 
|  | 84 | kQueryPool, | 
|  | 85 | kRenderPass, | 
|  | 86 | kSampler, | 
|  | 87 | kSemaphore, | 
| Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 88 | kShaderModule, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 89 |  | 
| Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 90 | kNumTypes | 
|  | 91 | }; | 
|  | 92 | }  // namespace HandleType | 
| Jesse Hall | bde8ee3 | 2015-09-01 16:24:29 -0700 | [diff] [blame] | 93 |  | 
| Jesse Hall | 00f10fe | 2016-02-08 21:20:20 -0800 | [diff] [blame] | 94 | const VkDeviceSize kMaxDeviceMemory = 0x10000000;  // 256 MiB, arbitrary | 
| Jesse Hall | bde8ee3 | 2015-09-01 16:24:29 -0700 | [diff] [blame] | 95 |  | 
| Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 96 | }  // anonymous namespace | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 97 |  | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 98 | struct VkDevice_T { | 
|  | 99 | hwvulkan_dispatch_t dispatch; | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 100 | VkAllocationCallbacks allocator; | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 101 | VkInstance_T* instance; | 
|  | 102 | VkQueue_T queue; | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 103 | std::array<uint64_t, HandleType::kNumTypes> next_handle; | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 104 | }; | 
|  | 105 |  | 
|  | 106 | // ----------------------------------------------------------------------------- | 
|  | 107 | // Declare HAL_MODULE_INFO_SYM early so it can be referenced by nulldrv_device | 
|  | 108 | // later. | 
|  | 109 |  | 
|  | 110 | namespace { | 
|  | 111 | int OpenDevice(const hw_module_t* module, const char* id, hw_device_t** device); | 
|  | 112 | hw_module_methods_t nulldrv_module_methods = {.open = OpenDevice}; | 
|  | 113 | }  // namespace | 
|  | 114 |  | 
|  | 115 | #pragma clang diagnostic push | 
|  | 116 | #pragma clang diagnostic ignored "-Wmissing-variable-declarations" | 
|  | 117 | __attribute__((visibility("default"))) hwvulkan_module_t HAL_MODULE_INFO_SYM = { | 
|  | 118 | .common = | 
|  | 119 | { | 
| Michael Lentine | 03c64b0 | 2015-08-26 18:27:26 -0500 | [diff] [blame] | 120 | .tag = HARDWARE_MODULE_TAG, | 
|  | 121 | .module_api_version = HWVULKAN_MODULE_API_VERSION_0_1, | 
|  | 122 | .hal_api_version = HARDWARE_HAL_API_VERSION, | 
|  | 123 | .id = HWVULKAN_HARDWARE_MODULE_ID, | 
|  | 124 | .name = "Null Vulkan Driver", | 
|  | 125 | .author = "The Android Open Source Project", | 
|  | 126 | .methods = &nulldrv_module_methods, | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 127 | }, | 
|  | 128 | }; | 
|  | 129 | #pragma clang diagnostic pop | 
|  | 130 |  | 
|  | 131 | // ----------------------------------------------------------------------------- | 
|  | 132 |  | 
|  | 133 | namespace { | 
|  | 134 |  | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 135 | int CloseDevice(struct hw_device_t* /*device*/) { | 
|  | 136 | // nothing to do - opening a device doesn't allocate any resources | 
|  | 137 | return 0; | 
|  | 138 | } | 
|  | 139 |  | 
|  | 140 | hwvulkan_device_t nulldrv_device = { | 
|  | 141 | .common = | 
|  | 142 | { | 
| Michael Lentine | 03c64b0 | 2015-08-26 18:27:26 -0500 | [diff] [blame] | 143 | .tag = HARDWARE_DEVICE_TAG, | 
|  | 144 | .version = HWVULKAN_DEVICE_API_VERSION_0_1, | 
|  | 145 | .module = &HAL_MODULE_INFO_SYM.common, | 
|  | 146 | .close = CloseDevice, | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 147 | }, | 
| Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 148 | .EnumerateInstanceExtensionProperties = | 
|  | 149 | EnumerateInstanceExtensionProperties, | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 150 | .CreateInstance = CreateInstance, | 
|  | 151 | .GetInstanceProcAddr = GetInstanceProcAddr}; | 
|  | 152 |  | 
|  | 153 | int OpenDevice(const hw_module_t* /*module*/, | 
|  | 154 | const char* id, | 
|  | 155 | hw_device_t** device) { | 
|  | 156 | if (strcmp(id, HWVULKAN_DEVICE_0) == 0) { | 
|  | 157 | *device = &nulldrv_device.common; | 
|  | 158 | return 0; | 
|  | 159 | } | 
|  | 160 | return -ENOENT; | 
|  | 161 | } | 
|  | 162 |  | 
|  | 163 | VkInstance_T* GetInstanceFromPhysicalDevice( | 
|  | 164 | VkPhysicalDevice_T* physical_device) { | 
|  | 165 | return reinterpret_cast<VkInstance_T*>( | 
|  | 166 | reinterpret_cast<uintptr_t>(physical_device) - | 
|  | 167 | offsetof(VkInstance_T, physical_device)); | 
|  | 168 | } | 
|  | 169 |  | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 170 | uint64_t AllocHandle(uint64_t type, uint64_t* next_handle) { | 
|  | 171 | const uint64_t kHandleMask = (UINT64_C(1) << 56) - 1; | 
|  | 172 | ALOGE_IF(*next_handle == kHandleMask, | 
|  | 173 | "non-dispatchable handles of type=%" PRIu64 | 
|  | 174 | " are about to overflow", | 
|  | 175 | type); | 
|  | 176 | return (UINT64_C(1) << 63) | ((type & 0x7) << 56) | | 
|  | 177 | ((*next_handle)++ & kHandleMask); | 
|  | 178 | } | 
|  | 179 |  | 
|  | 180 | template <class Handle> | 
|  | 181 | Handle AllocHandle(VkInstance instance, HandleType::Enum type) { | 
|  | 182 | return reinterpret_cast<Handle>( | 
|  | 183 | AllocHandle(type, &instance->next_callback_handle)); | 
|  | 184 | } | 
|  | 185 |  | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 186 | template <class Handle> | 
|  | 187 | Handle AllocHandle(VkDevice device, HandleType::Enum type) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 188 | return reinterpret_cast<Handle>( | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 189 | AllocHandle(type, &device->next_handle[type])); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 190 | } | 
|  | 191 |  | 
| Jesse Hall | d3b1450 | 2016-04-20 16:58:11 -0700 | [diff] [blame] | 192 | VKAPI_ATTR void* DefaultAllocate(void*, | 
|  | 193 | size_t size, | 
|  | 194 | size_t alignment, | 
|  | 195 | VkSystemAllocationScope) { | 
|  | 196 | void* ptr = nullptr; | 
|  | 197 | // Vulkan requires 'alignment' to be a power of two, but posix_memalign | 
|  | 198 | // additionally requires that it be at least sizeof(void*). | 
|  | 199 | int ret = posix_memalign(&ptr, std::max(alignment, sizeof(void*)), size); | 
|  | 200 | return ret == 0 ? ptr : nullptr; | 
|  | 201 | } | 
|  | 202 |  | 
|  | 203 | VKAPI_ATTR void* DefaultReallocate(void*, | 
|  | 204 | void* ptr, | 
|  | 205 | size_t size, | 
|  | 206 | size_t alignment, | 
|  | 207 | VkSystemAllocationScope) { | 
|  | 208 | if (size == 0) { | 
|  | 209 | free(ptr); | 
|  | 210 | return nullptr; | 
|  | 211 | } | 
|  | 212 |  | 
|  | 213 | // TODO(jessehall): Right now we never shrink allocations; if the new | 
|  | 214 | // request is smaller than the existing chunk, we just continue using it. | 
|  | 215 | // The null driver never reallocs, so this doesn't matter. If that changes, | 
|  | 216 | // or if this code is copied into some other project, this should probably | 
|  | 217 | // have a heuristic to allocate-copy-free when doing so will save "enough" | 
|  | 218 | // space. | 
|  | 219 | size_t old_size = ptr ? malloc_usable_size(ptr) : 0; | 
|  | 220 | if (size <= old_size) | 
|  | 221 | return ptr; | 
|  | 222 |  | 
|  | 223 | void* new_ptr = nullptr; | 
|  | 224 | if (posix_memalign(&new_ptr, std::max(alignment, sizeof(void*)), size) != 0) | 
|  | 225 | return nullptr; | 
|  | 226 | if (ptr) { | 
|  | 227 | memcpy(new_ptr, ptr, std::min(old_size, size)); | 
|  | 228 | free(ptr); | 
|  | 229 | } | 
|  | 230 | return new_ptr; | 
|  | 231 | } | 
|  | 232 |  | 
|  | 233 | VKAPI_ATTR void DefaultFree(void*, void* ptr) { | 
|  | 234 | free(ptr); | 
|  | 235 | } | 
|  | 236 |  | 
|  | 237 | const VkAllocationCallbacks kDefaultAllocCallbacks = { | 
|  | 238 | .pUserData = nullptr, | 
|  | 239 | .pfnAllocation = DefaultAllocate, | 
|  | 240 | .pfnReallocation = DefaultReallocate, | 
|  | 241 | .pfnFree = DefaultFree, | 
|  | 242 | }; | 
|  | 243 |  | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 244 | }  // namespace | 
|  | 245 |  | 
|  | 246 | namespace null_driver { | 
|  | 247 |  | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 248 | #define DEFINE_OBJECT_HANDLE_CONVERSION(T)              \ | 
|  | 249 | T* Get##T##FromHandle(Vk##T h);                     \ | 
|  | 250 | T* Get##T##FromHandle(Vk##T h) {                    \ | 
|  | 251 | return reinterpret_cast<T*>(uintptr_t(h));      \ | 
|  | 252 | }                                                   \ | 
|  | 253 | Vk##T GetHandleTo##T(const T* obj);                 \ | 
|  | 254 | Vk##T GetHandleTo##T(const T* obj) {                \ | 
|  | 255 | return Vk##T(reinterpret_cast<uintptr_t>(obj)); \ | 
|  | 256 | } | 
| Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 257 |  | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 258 | // ----------------------------------------------------------------------------- | 
|  | 259 | // Global | 
|  | 260 |  | 
| Jesse Hall | e1b1278 | 2015-11-30 11:27:32 -0800 | [diff] [blame] | 261 | VKAPI_ATTR | 
| Daniel Koch | 09f7bf9 | 2017-10-05 00:26:58 -0400 | [diff] [blame] | 262 | VkResult EnumerateInstanceVersion(uint32_t* pApiVersion) { | 
| Trevor David Black | 628c41a | 2021-09-27 05:07:22 +0000 | [diff] [blame] | 263 | *pApiVersion = VK_API_VERSION_1_3; | 
| Daniel Koch | 09f7bf9 | 2017-10-05 00:26:58 -0400 | [diff] [blame] | 264 | return VK_SUCCESS; | 
|  | 265 | } | 
|  | 266 |  | 
|  | 267 | VKAPI_ATTR | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 268 | VkResult EnumerateInstanceExtensionProperties( | 
|  | 269 | const char* layer_name, | 
|  | 270 | uint32_t* count, | 
|  | 271 | VkExtensionProperties* properties) { | 
|  | 272 | if (layer_name) { | 
|  | 273 | ALOGW( | 
|  | 274 | "Driver vkEnumerateInstanceExtensionProperties shouldn't be called " | 
|  | 275 | "with a layer name ('%s')", | 
|  | 276 | layer_name); | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 277 | } | 
|  | 278 |  | 
|  | 279 | const VkExtensionProperties kExtensions[] = { | 
| Chris Forbes | 86bdfbe | 2017-01-26 12:45:49 +1300 | [diff] [blame] | 280 | {VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION}}; | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 281 | const uint32_t kExtensionsCount = | 
|  | 282 | sizeof(kExtensions) / sizeof(kExtensions[0]); | 
|  | 283 |  | 
|  | 284 | if (!properties || *count > kExtensionsCount) | 
|  | 285 | *count = kExtensionsCount; | 
|  | 286 | if (properties) | 
|  | 287 | std::copy(kExtensions, kExtensions + *count, properties); | 
|  | 288 | return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS; | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 289 | } | 
|  | 290 |  | 
| Jesse Hall | e1b1278 | 2015-11-30 11:27:32 -0800 | [diff] [blame] | 291 | VKAPI_ATTR | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 292 | VkResult CreateInstance(const VkInstanceCreateInfo* create_info, | 
| Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 293 | const VkAllocationCallbacks* allocator, | 
|  | 294 | VkInstance* out_instance) { | 
| Jesse Hall | d3b1450 | 2016-04-20 16:58:11 -0700 | [diff] [blame] | 295 | if (!allocator) | 
|  | 296 | allocator = &kDefaultAllocCallbacks; | 
| Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 297 |  | 
|  | 298 | VkInstance_T* instance = | 
|  | 299 | static_cast<VkInstance_T*>(allocator->pfnAllocation( | 
|  | 300 | allocator->pUserData, sizeof(VkInstance_T), alignof(VkInstance_T), | 
|  | 301 | VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE)); | 
|  | 302 | if (!instance) | 
|  | 303 | return VK_ERROR_OUT_OF_HOST_MEMORY; | 
|  | 304 |  | 
|  | 305 | instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC; | 
|  | 306 | instance->allocator = *allocator; | 
|  | 307 | instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC; | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 308 | instance->next_callback_handle = 0; | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 309 |  | 
|  | 310 | for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) { | 
|  | 311 | if (strcmp(create_info->ppEnabledExtensionNames[i], | 
| Chris Forbes | 86bdfbe | 2017-01-26 12:45:49 +1300 | [diff] [blame] | 312 | VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME) == 0) { | 
|  | 313 | ALOGV("instance extension '%s' requested", | 
|  | 314 | create_info->ppEnabledExtensionNames[i]); | 
|  | 315 | } else if (strcmp(create_info->ppEnabledExtensionNames[i], | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 316 | VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) { | 
| Jesse Hall | b147127 | 2016-01-17 21:36:58 -0800 | [diff] [blame] | 317 | ALOGV("instance extension '%s' requested", | 
|  | 318 | create_info->ppEnabledExtensionNames[i]); | 
|  | 319 | } else { | 
|  | 320 | ALOGW("unsupported extension '%s' requested", | 
|  | 321 | create_info->ppEnabledExtensionNames[i]); | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 322 | } | 
|  | 323 | } | 
| Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 324 |  | 
|  | 325 | *out_instance = instance; | 
|  | 326 | return VK_SUCCESS; | 
|  | 327 | } | 
|  | 328 |  | 
|  | 329 | VKAPI_ATTR | 
|  | 330 | PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name) { | 
|  | 331 | return instance ? GetInstanceProcAddr(name) : GetGlobalProcAddr(name); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 332 | } | 
|  | 333 |  | 
| Jesse Hall | e1b1278 | 2015-11-30 11:27:32 -0800 | [diff] [blame] | 334 | VKAPI_ATTR | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 335 | PFN_vkVoidFunction GetDeviceProcAddr(VkDevice, const char* name) { | 
| Jesse Hall | 1f91d39 | 2015-12-11 16:28:44 -0800 | [diff] [blame] | 336 | return GetInstanceProcAddr(name); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 337 | } | 
|  | 338 |  | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 339 | // ----------------------------------------------------------------------------- | 
|  | 340 | // Instance | 
|  | 341 |  | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 342 | void DestroyInstance(VkInstance instance, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 343 | const VkAllocationCallbacks* /*allocator*/) { | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 344 | instance->allocator.pfnFree(instance->allocator.pUserData, instance); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 345 | } | 
|  | 346 |  | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 347 | // ----------------------------------------------------------------------------- | 
|  | 348 | // PhysicalDevice | 
|  | 349 |  | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 350 | VkResult EnumeratePhysicalDevices(VkInstance instance, | 
|  | 351 | uint32_t* physical_device_count, | 
|  | 352 | VkPhysicalDevice* physical_devices) { | 
| Ian Elliott | 3fe21f6 | 2017-10-20 10:41:01 -0600 | [diff] [blame] | 353 | if (!physical_devices) | 
|  | 354 | *physical_device_count = 1; | 
|  | 355 | else if (*physical_device_count == 0) | 
|  | 356 | return VK_INCOMPLETE; | 
|  | 357 | else { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 358 | physical_devices[0] = &instance->physical_device; | 
| Ian Elliott | 3fe21f6 | 2017-10-20 10:41:01 -0600 | [diff] [blame] | 359 | *physical_device_count = 1; | 
|  | 360 | } | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 361 | return VK_SUCCESS; | 
|  | 362 | } | 
|  | 363 |  | 
| Jesse Hall | 57f7f8c | 2016-01-17 17:21:36 -0800 | [diff] [blame] | 364 | VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice /*gpu*/, | 
|  | 365 | uint32_t* count, | 
|  | 366 | VkLayerProperties* /*properties*/) { | 
|  | 367 | ALOGW("Driver vkEnumerateDeviceLayerProperties shouldn't be called"); | 
|  | 368 | *count = 0; | 
|  | 369 | return VK_SUCCESS; | 
|  | 370 | } | 
|  | 371 |  | 
|  | 372 | VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice /*gpu*/, | 
|  | 373 | const char* layer_name, | 
|  | 374 | uint32_t* count, | 
|  | 375 | VkExtensionProperties* properties) { | 
|  | 376 | if (layer_name) { | 
|  | 377 | ALOGW( | 
|  | 378 | "Driver vkEnumerateDeviceExtensionProperties shouldn't be called " | 
|  | 379 | "with a layer name ('%s')", | 
|  | 380 | layer_name); | 
|  | 381 | *count = 0; | 
|  | 382 | return VK_SUCCESS; | 
|  | 383 | } | 
|  | 384 |  | 
|  | 385 | const VkExtensionProperties kExtensions[] = { | 
|  | 386 | {VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME, | 
|  | 387 | VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION}}; | 
|  | 388 | const uint32_t kExtensionsCount = | 
|  | 389 | sizeof(kExtensions) / sizeof(kExtensions[0]); | 
|  | 390 |  | 
|  | 391 | if (!properties || *count > kExtensionsCount) | 
|  | 392 | *count = kExtensionsCount; | 
|  | 393 | if (properties) | 
|  | 394 | std::copy(kExtensions, kExtensions + *count, properties); | 
|  | 395 | return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS; | 
|  | 396 | } | 
|  | 397 |  | 
| Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 398 | void GetPhysicalDeviceProperties(VkPhysicalDevice, | 
|  | 399 | VkPhysicalDeviceProperties* properties) { | 
| Trevor David Black | b68a225 | 2021-08-23 16:37:18 +0000 | [diff] [blame] | 400 | properties->apiVersion = VK_MAKE_API_VERSION(0, 1, 2, VK_HEADER_VERSION); | 
|  | 401 | properties->driverVersion = VK_MAKE_API_VERSION(0, 0, 0, 1); | 
| Jesse Hall | 65ab552 | 2015-11-30 00:07:16 -0800 | [diff] [blame] | 402 | properties->vendorID = 0; | 
|  | 403 | properties->deviceID = 0; | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 404 | properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER; | 
|  | 405 | strcpy(properties->deviceName, "Android Vulkan Null Driver"); | 
|  | 406 | memset(properties->pipelineCacheUUID, 0, | 
|  | 407 | sizeof(properties->pipelineCacheUUID)); | 
| Jesse Hall | c34849e | 2016-02-09 22:35:04 -0800 | [diff] [blame] | 408 | properties->limits = VkPhysicalDeviceLimits{ | 
|  | 409 | 4096,     // maxImageDimension1D | 
|  | 410 | 4096,     // maxImageDimension2D | 
|  | 411 | 256,      // maxImageDimension3D | 
|  | 412 | 4096,     // maxImageDimensionCube | 
|  | 413 | 256,      // maxImageArrayLayers | 
|  | 414 | 65536,    // maxTexelBufferElements | 
|  | 415 | 16384,    // maxUniformBufferRange | 
|  | 416 | 1 << 27,  // maxStorageBufferRange | 
|  | 417 | 128,      // maxPushConstantsSize | 
|  | 418 | 4096,     // maxMemoryAllocationCount | 
|  | 419 | 4000,     // maxSamplerAllocationCount | 
|  | 420 | 1,        // bufferImageGranularity | 
|  | 421 | 0,        // sparseAddressSpaceSize | 
|  | 422 | 4,        // maxBoundDescriptorSets | 
|  | 423 | 16,       // maxPerStageDescriptorSamplers | 
|  | 424 | 12,       // maxPerStageDescriptorUniformBuffers | 
|  | 425 | 4,        // maxPerStageDescriptorStorageBuffers | 
|  | 426 | 16,       // maxPerStageDescriptorSampledImages | 
|  | 427 | 4,        // maxPerStageDescriptorStorageImages | 
|  | 428 | 4,        // maxPerStageDescriptorInputAttachments | 
|  | 429 | 128,      // maxPerStageResources | 
|  | 430 | 96,       // maxDescriptorSetSamplers | 
|  | 431 | 72,       // maxDescriptorSetUniformBuffers | 
|  | 432 | 8,        // maxDescriptorSetUniformBuffersDynamic | 
|  | 433 | 24,       // maxDescriptorSetStorageBuffers | 
|  | 434 | 4,        // maxDescriptorSetStorageBuffersDynamic | 
|  | 435 | 96,       // maxDescriptorSetSampledImages | 
|  | 436 | 24,       // maxDescriptorSetStorageImages | 
|  | 437 | 4,        // maxDescriptorSetInputAttachments | 
|  | 438 | 16,       // maxVertexInputAttributes | 
|  | 439 | 16,       // maxVertexInputBindings | 
|  | 440 | 2047,     // maxVertexInputAttributeOffset | 
|  | 441 | 2048,     // maxVertexInputBindingStride | 
|  | 442 | 64,       // maxVertexOutputComponents | 
|  | 443 | 0,        // maxTessellationGenerationLevel | 
|  | 444 | 0,        // maxTessellationPatchSize | 
|  | 445 | 0,        // maxTessellationControlPerVertexInputComponents | 
|  | 446 | 0,        // maxTessellationControlPerVertexOutputComponents | 
|  | 447 | 0,        // maxTessellationControlPerPatchOutputComponents | 
|  | 448 | 0,        // maxTessellationControlTotalOutputComponents | 
|  | 449 | 0,        // maxTessellationEvaluationInputComponents | 
|  | 450 | 0,        // maxTessellationEvaluationOutputComponents | 
|  | 451 | 0,        // maxGeometryShaderInvocations | 
|  | 452 | 0,        // maxGeometryInputComponents | 
|  | 453 | 0,        // maxGeometryOutputComponents | 
|  | 454 | 0,        // maxGeometryOutputVertices | 
|  | 455 | 0,        // maxGeometryTotalOutputComponents | 
|  | 456 | 64,       // maxFragmentInputComponents | 
|  | 457 | 4,        // maxFragmentOutputAttachments | 
|  | 458 | 0,        // maxFragmentDualSrcAttachments | 
|  | 459 | 4,        // maxFragmentCombinedOutputResources | 
|  | 460 | 16384,    // maxComputeSharedMemorySize | 
|  | 461 | {65536, 65536, 65536},  // maxComputeWorkGroupCount[3] | 
|  | 462 | 128,                    // maxComputeWorkGroupInvocations | 
|  | 463 | {128, 128, 64},         // maxComputeWorkGroupSize[3] | 
|  | 464 | 4,                      // subPixelPrecisionBits | 
|  | 465 | 4,                      // subTexelPrecisionBits | 
|  | 466 | 4,                      // mipmapPrecisionBits | 
|  | 467 | UINT32_MAX,             // maxDrawIndexedIndexValue | 
|  | 468 | 1,                      // maxDrawIndirectCount | 
|  | 469 | 2,                      // maxSamplerLodBias | 
|  | 470 | 1,                      // maxSamplerAnisotropy | 
|  | 471 | 1,                      // maxViewports | 
|  | 472 | {4096, 4096},           // maxViewportDimensions[2] | 
|  | 473 | {-8192.0f, 8191.0f},    // viewportBoundsRange[2] | 
|  | 474 | 0,                      // viewportSubPixelBits | 
|  | 475 | 64,                     // minMemoryMapAlignment | 
|  | 476 | 256,                    // minTexelBufferOffsetAlignment | 
|  | 477 | 256,                    // minUniformBufferOffsetAlignment | 
|  | 478 | 256,                    // minStorageBufferOffsetAlignment | 
|  | 479 | -8,                     // minTexelOffset | 
|  | 480 | 7,                      // maxTexelOffset | 
|  | 481 | 0,                      // minTexelGatherOffset | 
|  | 482 | 0,                      // maxTexelGatherOffset | 
|  | 483 | 0.0f,                   // minInterpolationOffset | 
|  | 484 | 0.0f,                   // maxInterpolationOffset | 
|  | 485 | 0,                      // subPixelInterpolationOffsetBits | 
|  | 486 | 4096,                   // maxFramebufferWidth | 
|  | 487 | 4096,                   // maxFramebufferHeight | 
|  | 488 | 256,                    // maxFramebufferLayers | 
|  | 489 | VK_SAMPLE_COUNT_1_BIT | | 
|  | 490 | VK_SAMPLE_COUNT_4_BIT,  // framebufferColorSampleCounts | 
|  | 491 | VK_SAMPLE_COUNT_1_BIT | | 
|  | 492 | VK_SAMPLE_COUNT_4_BIT,  // framebufferDepthSampleCounts | 
|  | 493 | VK_SAMPLE_COUNT_1_BIT | | 
|  | 494 | VK_SAMPLE_COUNT_4_BIT,  // framebufferStencilSampleCounts | 
|  | 495 | VK_SAMPLE_COUNT_1_BIT | | 
|  | 496 | VK_SAMPLE_COUNT_4_BIT,  // framebufferNoAttachmentsSampleCounts | 
|  | 497 | 4,                          // maxColorAttachments | 
|  | 498 | VK_SAMPLE_COUNT_1_BIT | | 
|  | 499 | VK_SAMPLE_COUNT_4_BIT,  // sampledImageColorSampleCounts | 
|  | 500 | VK_SAMPLE_COUNT_1_BIT,      // sampledImageIntegerSampleCounts | 
|  | 501 | VK_SAMPLE_COUNT_1_BIT | | 
|  | 502 | VK_SAMPLE_COUNT_4_BIT,  // sampledImageDepthSampleCounts | 
|  | 503 | VK_SAMPLE_COUNT_1_BIT | | 
|  | 504 | VK_SAMPLE_COUNT_4_BIT,  // sampledImageStencilSampleCounts | 
|  | 505 | VK_SAMPLE_COUNT_1_BIT,      // storageImageSampleCounts | 
|  | 506 | 1,                          // maxSampleMaskWords | 
|  | 507 | VK_TRUE,                    // timestampComputeAndGraphics | 
|  | 508 | 1,                          // timestampPeriod | 
|  | 509 | 0,                          // maxClipDistances | 
|  | 510 | 0,                          // maxCullDistances | 
|  | 511 | 0,                          // maxCombinedClipAndCullDistances | 
|  | 512 | 2,                          // discreteQueuePriorities | 
|  | 513 | {1.0f, 1.0f},               // pointSizeRange[2] | 
|  | 514 | {1.0f, 1.0f},               // lineWidthRange[2] | 
|  | 515 | 0.0f,                       // pointSizeGranularity | 
|  | 516 | 0.0f,                       // lineWidthGranularity | 
|  | 517 | VK_TRUE,                    // strictLines | 
|  | 518 | VK_TRUE,                    // standardSampleLocations | 
|  | 519 | 1,                          // optimalBufferCopyOffsetAlignment | 
|  | 520 | 1,                          // optimalBufferCopyRowPitchAlignment | 
|  | 521 | 64,                         // nonCoherentAtomSize | 
|  | 522 | }; | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 523 | } | 
|  | 524 |  | 
| Chris Forbes | 86bdfbe | 2017-01-26 12:45:49 +1300 | [diff] [blame] | 525 | void GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physical_device, | 
|  | 526 | VkPhysicalDeviceProperties2KHR* properties) { | 
|  | 527 | GetPhysicalDeviceProperties(physical_device, &properties->properties); | 
| Chris Forbes | b4eb278 | 2017-03-15 16:09:15 +1300 | [diff] [blame] | 528 |  | 
|  | 529 | while (properties->pNext) { | 
|  | 530 | properties = reinterpret_cast<VkPhysicalDeviceProperties2KHR *>(properties->pNext); | 
|  | 531 |  | 
|  | 532 | #pragma clang diagnostic push | 
|  | 533 | #pragma clang diagnostic ignored "-Wold-style-cast" | 
|  | 534 | switch ((VkFlags)properties->sType) { | 
|  | 535 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID: { | 
|  | 536 | VkPhysicalDevicePresentationPropertiesANDROID *presentation_properties = | 
|  | 537 | reinterpret_cast<VkPhysicalDevicePresentationPropertiesANDROID *>(properties); | 
|  | 538 | #pragma clang diagnostic pop | 
|  | 539 |  | 
|  | 540 | // Claim that we do all the right things for the loader to | 
|  | 541 | // expose KHR_shared_presentable_image on our behalf. | 
|  | 542 | presentation_properties->sharedImage = VK_TRUE; | 
|  | 543 | } break; | 
|  | 544 |  | 
|  | 545 | default: | 
|  | 546 | // Silently ignore other extension query structs | 
|  | 547 | break; | 
|  | 548 | } | 
|  | 549 | } | 
| Chris Forbes | 86bdfbe | 2017-01-26 12:45:49 +1300 | [diff] [blame] | 550 | } | 
|  | 551 |  | 
| Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 552 | void GetPhysicalDeviceQueueFamilyProperties( | 
| Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 553 | VkPhysicalDevice, | 
|  | 554 | uint32_t* count, | 
|  | 555 | VkQueueFamilyProperties* properties) { | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 556 | if (!properties || *count > 1) | 
|  | 557 | *count = 1; | 
|  | 558 | if (properties && *count == 1) { | 
| Jesse Hall | 65ab552 | 2015-11-30 00:07:16 -0800 | [diff] [blame] | 559 | properties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | | 
|  | 560 | VK_QUEUE_TRANSFER_BIT; | 
| Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 561 | properties->queueCount = 1; | 
| Jesse Hall | acfa534 | 2015-11-19 21:51:33 -0800 | [diff] [blame] | 562 | properties->timestampValidBits = 64; | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 563 | properties->minImageTransferGranularity = VkExtent3D{1, 1, 1}; | 
| Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 564 | } | 
| Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 565 | } | 
|  | 566 |  | 
| Chris Forbes | 86bdfbe | 2017-01-26 12:45:49 +1300 | [diff] [blame] | 567 | void GetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physical_device, uint32_t* count, VkQueueFamilyProperties2KHR* properties) { | 
|  | 568 | // note: even though multiple structures, this is safe to forward in this | 
|  | 569 | // case since we only expose one queue family. | 
|  | 570 | GetPhysicalDeviceQueueFamilyProperties(physical_device, count, properties ? &properties->queueFamilyProperties : nullptr); | 
|  | 571 | } | 
|  | 572 |  | 
| Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 573 | void GetPhysicalDeviceMemoryProperties( | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 574 | VkPhysicalDevice, | 
|  | 575 | VkPhysicalDeviceMemoryProperties* properties) { | 
|  | 576 | properties->memoryTypeCount = 1; | 
|  | 577 | properties->memoryTypes[0].propertyFlags = | 
| Jesse Hall | d1af812 | 2015-11-29 23:50:38 -0800 | [diff] [blame] | 578 | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | | 
|  | 579 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | | 
|  | 580 | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | | 
|  | 581 | VK_MEMORY_PROPERTY_HOST_CACHED_BIT; | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 582 | properties->memoryTypes[0].heapIndex = 0; | 
|  | 583 | properties->memoryHeapCount = 1; | 
| Jesse Hall | bde8ee3 | 2015-09-01 16:24:29 -0700 | [diff] [blame] | 584 | properties->memoryHeaps[0].size = kMaxDeviceMemory; | 
| Jesse Hall | d1af812 | 2015-11-29 23:50:38 -0800 | [diff] [blame] | 585 | properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT; | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 586 | } | 
|  | 587 |  | 
| Chris Forbes | 86bdfbe | 2017-01-26 12:45:49 +1300 | [diff] [blame] | 588 | void GetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceMemoryProperties2KHR* properties) { | 
|  | 589 | GetPhysicalDeviceMemoryProperties(physical_device, &properties->memoryProperties); | 
|  | 590 | } | 
|  | 591 |  | 
| Jesse Hall | 8e37cf3 | 2016-01-18 04:00:57 -0800 | [diff] [blame] | 592 | void GetPhysicalDeviceFeatures(VkPhysicalDevice /*gpu*/, | 
|  | 593 | VkPhysicalDeviceFeatures* features) { | 
|  | 594 | *features = VkPhysicalDeviceFeatures{ | 
|  | 595 | VK_TRUE,   // robustBufferAccess | 
|  | 596 | VK_FALSE,  // fullDrawIndexUint32 | 
|  | 597 | VK_FALSE,  // imageCubeArray | 
|  | 598 | VK_FALSE,  // independentBlend | 
|  | 599 | VK_FALSE,  // geometryShader | 
|  | 600 | VK_FALSE,  // tessellationShader | 
|  | 601 | VK_FALSE,  // sampleRateShading | 
|  | 602 | VK_FALSE,  // dualSrcBlend | 
|  | 603 | VK_FALSE,  // logicOp | 
|  | 604 | VK_FALSE,  // multiDrawIndirect | 
|  | 605 | VK_FALSE,  // drawIndirectFirstInstance | 
|  | 606 | VK_FALSE,  // depthClamp | 
|  | 607 | VK_FALSE,  // depthBiasClamp | 
|  | 608 | VK_FALSE,  // fillModeNonSolid | 
|  | 609 | VK_FALSE,  // depthBounds | 
|  | 610 | VK_FALSE,  // wideLines | 
|  | 611 | VK_FALSE,  // largePoints | 
|  | 612 | VK_FALSE,  // alphaToOne | 
|  | 613 | VK_FALSE,  // multiViewport | 
|  | 614 | VK_FALSE,  // samplerAnisotropy | 
|  | 615 | VK_FALSE,  // textureCompressionETC2 | 
|  | 616 | VK_FALSE,  // textureCompressionASTC_LDR | 
|  | 617 | VK_FALSE,  // textureCompressionBC | 
|  | 618 | VK_FALSE,  // occlusionQueryPrecise | 
|  | 619 | VK_FALSE,  // pipelineStatisticsQuery | 
|  | 620 | VK_FALSE,  // vertexPipelineStoresAndAtomics | 
|  | 621 | VK_FALSE,  // fragmentStoresAndAtomics | 
|  | 622 | VK_FALSE,  // shaderTessellationAndGeometryPointSize | 
|  | 623 | VK_FALSE,  // shaderImageGatherExtended | 
|  | 624 | VK_FALSE,  // shaderStorageImageExtendedFormats | 
|  | 625 | VK_FALSE,  // shaderStorageImageMultisample | 
|  | 626 | VK_FALSE,  // shaderStorageImageReadWithoutFormat | 
|  | 627 | VK_FALSE,  // shaderStorageImageWriteWithoutFormat | 
|  | 628 | VK_FALSE,  // shaderUniformBufferArrayDynamicIndexing | 
|  | 629 | VK_FALSE,  // shaderSampledImageArrayDynamicIndexing | 
|  | 630 | VK_FALSE,  // shaderStorageBufferArrayDynamicIndexing | 
|  | 631 | VK_FALSE,  // shaderStorageImageArrayDynamicIndexing | 
|  | 632 | VK_FALSE,  // shaderClipDistance | 
|  | 633 | VK_FALSE,  // shaderCullDistance | 
|  | 634 | VK_FALSE,  // shaderFloat64 | 
|  | 635 | VK_FALSE,  // shaderInt64 | 
|  | 636 | VK_FALSE,  // shaderInt16 | 
|  | 637 | VK_FALSE,  // shaderResourceResidency | 
|  | 638 | VK_FALSE,  // shaderResourceMinLod | 
|  | 639 | VK_FALSE,  // sparseBinding | 
|  | 640 | VK_FALSE,  // sparseResidencyBuffer | 
|  | 641 | VK_FALSE,  // sparseResidencyImage2D | 
|  | 642 | VK_FALSE,  // sparseResidencyImage3D | 
|  | 643 | VK_FALSE,  // sparseResidency2Samples | 
|  | 644 | VK_FALSE,  // sparseResidency4Samples | 
|  | 645 | VK_FALSE,  // sparseResidency8Samples | 
|  | 646 | VK_FALSE,  // sparseResidency16Samples | 
|  | 647 | VK_FALSE,  // sparseResidencyAliased | 
|  | 648 | VK_FALSE,  // variableMultisampleRate | 
|  | 649 | VK_FALSE,  // inheritedQueries | 
|  | 650 | }; | 
|  | 651 | } | 
|  | 652 |  | 
| Chris Forbes | 86bdfbe | 2017-01-26 12:45:49 +1300 | [diff] [blame] | 653 | void GetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceFeatures2KHR* features) { | 
|  | 654 | GetPhysicalDeviceFeatures(physical_device, &features->features); | 
|  | 655 | } | 
|  | 656 |  | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 657 | // ----------------------------------------------------------------------------- | 
|  | 658 | // Device | 
|  | 659 |  | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 660 | VkResult CreateDevice(VkPhysicalDevice physical_device, | 
| Jesse Hall | b147127 | 2016-01-17 21:36:58 -0800 | [diff] [blame] | 661 | const VkDeviceCreateInfo* create_info, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 662 | const VkAllocationCallbacks* allocator, | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 663 | VkDevice* out_device) { | 
|  | 664 | VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device); | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 665 | if (!allocator) | 
|  | 666 | allocator = &instance->allocator; | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 667 | VkDevice_T* device = static_cast<VkDevice_T*>(allocator->pfnAllocation( | 
|  | 668 | allocator->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T), | 
|  | 669 | VK_SYSTEM_ALLOCATION_SCOPE_DEVICE)); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 670 | if (!device) | 
|  | 671 | return VK_ERROR_OUT_OF_HOST_MEMORY; | 
|  | 672 |  | 
|  | 673 | device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC; | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 674 | device->allocator = *allocator; | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 675 | device->instance = instance; | 
|  | 676 | device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC; | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 677 | std::fill(device->next_handle.begin(), device->next_handle.end(), | 
|  | 678 | UINT64_C(0)); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 679 |  | 
| Jesse Hall | b147127 | 2016-01-17 21:36:58 -0800 | [diff] [blame] | 680 | for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) { | 
|  | 681 | if (strcmp(create_info->ppEnabledExtensionNames[i], | 
|  | 682 | VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME) == 0) { | 
|  | 683 | ALOGV("Enabling " VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME); | 
|  | 684 | } | 
|  | 685 | } | 
|  | 686 |  | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 687 | *out_device = device; | 
|  | 688 | return VK_SUCCESS; | 
|  | 689 | } | 
|  | 690 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 691 | void DestroyDevice(VkDevice device, | 
|  | 692 | const VkAllocationCallbacks* /*allocator*/) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 693 | if (!device) | 
| Jesse Hall | cf25c41 | 2015-10-29 17:14:50 -0700 | [diff] [blame] | 694 | return; | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 695 | device->allocator.pfnFree(device->allocator.pUserData, device); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 696 | } | 
|  | 697 |  | 
| Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 698 | void GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 699 | *queue = &device->queue; | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 700 | } | 
|  | 701 |  | 
|  | 702 | // ----------------------------------------------------------------------------- | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 703 | // CommandPool | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 704 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 705 | struct CommandPool { | 
|  | 706 | typedef VkCommandPool HandleType; | 
|  | 707 | VkAllocationCallbacks allocator; | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 708 | }; | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 709 | DEFINE_OBJECT_HANDLE_CONVERSION(CommandPool) | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 710 |  | 
|  | 711 | VkResult CreateCommandPool(VkDevice device, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 712 | const VkCommandPoolCreateInfo* /*create_info*/, | 
|  | 713 | const VkAllocationCallbacks* allocator, | 
|  | 714 | VkCommandPool* cmd_pool) { | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 715 | if (!allocator) | 
|  | 716 | allocator = &device->allocator; | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 717 | CommandPool* pool = static_cast<CommandPool*>(allocator->pfnAllocation( | 
|  | 718 | allocator->pUserData, sizeof(CommandPool), alignof(CommandPool), | 
|  | 719 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 720 | if (!pool) | 
|  | 721 | return VK_ERROR_OUT_OF_HOST_MEMORY; | 
|  | 722 | pool->allocator = *allocator; | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 723 | *cmd_pool = GetHandleToCommandPool(pool); | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 724 | return VK_SUCCESS; | 
|  | 725 | } | 
|  | 726 |  | 
|  | 727 | void DestroyCommandPool(VkDevice /*device*/, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 728 | VkCommandPool cmd_pool, | 
|  | 729 | const VkAllocationCallbacks* /*allocator*/) { | 
|  | 730 | CommandPool* pool = GetCommandPoolFromHandle(cmd_pool); | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 731 | pool->allocator.pfnFree(pool->allocator.pUserData, pool); | 
|  | 732 | } | 
|  | 733 |  | 
|  | 734 | // ----------------------------------------------------------------------------- | 
| Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 735 | // CmdBuffer | 
|  | 736 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 737 | VkResult AllocateCommandBuffers(VkDevice /*device*/, | 
|  | 738 | const VkCommandBufferAllocateInfo* alloc_info, | 
|  | 739 | VkCommandBuffer* cmdbufs) { | 
| Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 740 | VkResult result = VK_SUCCESS; | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 741 | CommandPool& pool = *GetCommandPoolFromHandle(alloc_info->commandPool); | 
| Jesse Hall | 3dd678a | 2016-01-08 21:52:01 -0800 | [diff] [blame] | 742 | std::fill(cmdbufs, cmdbufs + alloc_info->commandBufferCount, nullptr); | 
|  | 743 | for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) { | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 744 | cmdbufs[i] = | 
|  | 745 | static_cast<VkCommandBuffer_T*>(pool.allocator.pfnAllocation( | 
|  | 746 | pool.allocator.pUserData, sizeof(VkCommandBuffer_T), | 
|  | 747 | alignof(VkCommandBuffer_T), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); | 
| Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 748 | if (!cmdbufs[i]) { | 
|  | 749 | result = VK_ERROR_OUT_OF_HOST_MEMORY; | 
|  | 750 | break; | 
|  | 751 | } | 
|  | 752 | cmdbufs[i]->dispatch.magic = HWVULKAN_DISPATCH_MAGIC; | 
|  | 753 | } | 
|  | 754 | if (result != VK_SUCCESS) { | 
| Jesse Hall | 3dd678a | 2016-01-08 21:52:01 -0800 | [diff] [blame] | 755 | for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) { | 
| Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 756 | if (!cmdbufs[i]) | 
|  | 757 | break; | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 758 | pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]); | 
| Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 759 | } | 
|  | 760 | } | 
| Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 761 | return result; | 
| Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 762 | } | 
|  | 763 |  | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 764 | void FreeCommandBuffers(VkDevice /*device*/, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 765 | VkCommandPool cmd_pool, | 
| Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 766 | uint32_t count, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 767 | const VkCommandBuffer* cmdbufs) { | 
|  | 768 | CommandPool& pool = *GetCommandPoolFromHandle(cmd_pool); | 
| Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 769 | for (uint32_t i = 0; i < count; i++) | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 770 | pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]); | 
| Jesse Hall | c7a6eb5 | 2015-08-31 12:52:03 -0700 | [diff] [blame] | 771 | } | 
|  | 772 |  | 
|  | 773 | // ----------------------------------------------------------------------------- | 
| Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 774 | // DeviceMemory | 
|  | 775 |  | 
|  | 776 | struct DeviceMemory { | 
|  | 777 | typedef VkDeviceMemory HandleType; | 
|  | 778 | VkDeviceSize size; | 
|  | 779 | alignas(16) uint8_t data[0]; | 
|  | 780 | }; | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 781 | DEFINE_OBJECT_HANDLE_CONVERSION(DeviceMemory) | 
| Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 782 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 783 | VkResult AllocateMemory(VkDevice device, | 
|  | 784 | const VkMemoryAllocateInfo* alloc_info, | 
|  | 785 | const VkAllocationCallbacks* allocator, | 
|  | 786 | VkDeviceMemory* mem_handle) { | 
| Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 787 | if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize) | 
|  | 788 | return VK_ERROR_OUT_OF_HOST_MEMORY; | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 789 | if (!allocator) | 
|  | 790 | allocator = &device->allocator; | 
| Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 791 |  | 
| Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 792 | size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize); | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 793 | DeviceMemory* mem = static_cast<DeviceMemory*>(allocator->pfnAllocation( | 
|  | 794 | allocator->pUserData, size, alignof(DeviceMemory), | 
|  | 795 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); | 
| Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 796 | if (!mem) | 
|  | 797 | return VK_ERROR_OUT_OF_HOST_MEMORY; | 
|  | 798 | mem->size = size; | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 799 | *mem_handle = GetHandleToDeviceMemory(mem); | 
| Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 800 | return VK_SUCCESS; | 
|  | 801 | } | 
|  | 802 |  | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 803 | void FreeMemory(VkDevice device, | 
|  | 804 | VkDeviceMemory mem_handle, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 805 | const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 806 | if (!allocator) | 
|  | 807 | allocator = &device->allocator; | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 808 | DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle); | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 809 | allocator->pfnFree(allocator->pUserData, mem); | 
| Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 810 | } | 
|  | 811 |  | 
|  | 812 | VkResult MapMemory(VkDevice, | 
|  | 813 | VkDeviceMemory mem_handle, | 
|  | 814 | VkDeviceSize offset, | 
|  | 815 | VkDeviceSize, | 
|  | 816 | VkMemoryMapFlags, | 
|  | 817 | void** out_ptr) { | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 818 | DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle); | 
| Jesse Hall | 2077ce0 | 2015-08-29 18:10:59 +0100 | [diff] [blame] | 819 | *out_ptr = &mem->data[0] + offset; | 
|  | 820 | return VK_SUCCESS; | 
|  | 821 | } | 
|  | 822 |  | 
|  | 823 | // ----------------------------------------------------------------------------- | 
| Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 824 | // Buffer | 
|  | 825 |  | 
|  | 826 | struct Buffer { | 
|  | 827 | typedef VkBuffer HandleType; | 
|  | 828 | VkDeviceSize size; | 
|  | 829 | }; | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 830 | DEFINE_OBJECT_HANDLE_CONVERSION(Buffer) | 
| Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 831 |  | 
|  | 832 | VkResult CreateBuffer(VkDevice device, | 
|  | 833 | const VkBufferCreateInfo* create_info, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 834 | const VkAllocationCallbacks* allocator, | 
| Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 835 | VkBuffer* buffer_handle) { | 
| Jesse Hall | bde8ee3 | 2015-09-01 16:24:29 -0700 | [diff] [blame] | 836 | ALOGW_IF(create_info->size > kMaxDeviceMemory, | 
|  | 837 | "CreateBuffer: requested size 0x%" PRIx64 | 
|  | 838 | " exceeds max device memory size 0x%" PRIx64, | 
|  | 839 | create_info->size, kMaxDeviceMemory); | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 840 | if (!allocator) | 
|  | 841 | allocator = &device->allocator; | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 842 | Buffer* buffer = static_cast<Buffer*>(allocator->pfnAllocation( | 
|  | 843 | allocator->pUserData, sizeof(Buffer), alignof(Buffer), | 
|  | 844 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); | 
| Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 845 | if (!buffer) | 
|  | 846 | return VK_ERROR_OUT_OF_HOST_MEMORY; | 
|  | 847 | buffer->size = create_info->size; | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 848 | *buffer_handle = GetHandleToBuffer(buffer); | 
| Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 849 | return VK_SUCCESS; | 
|  | 850 | } | 
|  | 851 |  | 
| Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 852 | void GetBufferMemoryRequirements(VkDevice, | 
|  | 853 | VkBuffer buffer_handle, | 
|  | 854 | VkMemoryRequirements* requirements) { | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 855 | Buffer* buffer = GetBufferFromHandle(buffer_handle); | 
| Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 856 | requirements->size = buffer->size; | 
|  | 857 | requirements->alignment = 16;  // allow fast Neon/SSE memcpy | 
|  | 858 | requirements->memoryTypeBits = 0x1; | 
| Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 859 | } | 
|  | 860 |  | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 861 | void DestroyBuffer(VkDevice device, | 
|  | 862 | VkBuffer buffer_handle, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 863 | const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 864 | if (!allocator) | 
|  | 865 | allocator = &device->allocator; | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 866 | Buffer* buffer = GetBufferFromHandle(buffer_handle); | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 867 | allocator->pfnFree(allocator->pUserData, buffer); | 
| Jesse Hall | f657874 | 2015-08-29 17:06:12 +0100 | [diff] [blame] | 868 | } | 
|  | 869 |  | 
|  | 870 | // ----------------------------------------------------------------------------- | 
| Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 871 | // Image | 
|  | 872 |  | 
|  | 873 | struct Image { | 
|  | 874 | typedef VkImage HandleType; | 
|  | 875 | VkDeviceSize size; | 
|  | 876 | }; | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 877 | DEFINE_OBJECT_HANDLE_CONVERSION(Image) | 
| Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 878 |  | 
|  | 879 | VkResult CreateImage(VkDevice device, | 
|  | 880 | const VkImageCreateInfo* create_info, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 881 | const VkAllocationCallbacks* allocator, | 
| Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 882 | VkImage* image_handle) { | 
|  | 883 | if (create_info->imageType != VK_IMAGE_TYPE_2D || | 
|  | 884 | create_info->format != VK_FORMAT_R8G8B8A8_UNORM || | 
|  | 885 | create_info->mipLevels != 1) { | 
|  | 886 | ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u", | 
|  | 887 | create_info->imageType, create_info->format, | 
|  | 888 | create_info->mipLevels); | 
| Jesse Hall | a15a4bf | 2015-11-19 22:48:02 -0800 | [diff] [blame] | 889 | return VK_ERROR_OUT_OF_HOST_MEMORY; | 
| Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 890 | } | 
|  | 891 |  | 
|  | 892 | VkDeviceSize size = | 
|  | 893 | VkDeviceSize(create_info->extent.width * create_info->extent.height) * | 
| Jesse Hall | a15a4bf | 2015-11-19 22:48:02 -0800 | [diff] [blame] | 894 | create_info->arrayLayers * create_info->samples * 4u; | 
| Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 895 | ALOGW_IF(size > kMaxDeviceMemory, | 
|  | 896 | "CreateImage: image size 0x%" PRIx64 | 
|  | 897 | " exceeds max device memory size 0x%" PRIx64, | 
|  | 898 | size, kMaxDeviceMemory); | 
|  | 899 |  | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 900 | if (!allocator) | 
|  | 901 | allocator = &device->allocator; | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 902 | Image* image = static_cast<Image*>(allocator->pfnAllocation( | 
|  | 903 | allocator->pUserData, sizeof(Image), alignof(Image), | 
|  | 904 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); | 
| Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 905 | if (!image) | 
|  | 906 | return VK_ERROR_OUT_OF_HOST_MEMORY; | 
|  | 907 | image->size = size; | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 908 | *image_handle = GetHandleToImage(image); | 
| Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 909 | return VK_SUCCESS; | 
|  | 910 | } | 
|  | 911 |  | 
| Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 912 | void GetImageMemoryRequirements(VkDevice, | 
|  | 913 | VkImage image_handle, | 
|  | 914 | VkMemoryRequirements* requirements) { | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 915 | Image* image = GetImageFromHandle(image_handle); | 
| Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 916 | requirements->size = image->size; | 
|  | 917 | requirements->alignment = 16;  // allow fast Neon/SSE memcpy | 
|  | 918 | requirements->memoryTypeBits = 0x1; | 
| Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 919 | } | 
|  | 920 |  | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 921 | void DestroyImage(VkDevice device, | 
|  | 922 | VkImage image_handle, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 923 | const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 924 | if (!allocator) | 
|  | 925 | allocator = &device->allocator; | 
| Jesse Hall | a3a7a1d | 2015-11-24 11:37:23 -0800 | [diff] [blame] | 926 | Image* image = GetImageFromHandle(image_handle); | 
| Jesse Hall | 03b6fe1 | 2015-11-24 12:44:21 -0800 | [diff] [blame] | 927 | allocator->pfnFree(allocator->pUserData, image); | 
| Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 928 | } | 
|  | 929 |  | 
| Jesse Hall | 57f7f8c | 2016-01-17 17:21:36 -0800 | [diff] [blame] | 930 | VkResult GetSwapchainGrallocUsageANDROID(VkDevice, | 
|  | 931 | VkFormat, | 
|  | 932 | VkImageUsageFlags, | 
|  | 933 | int* grallocUsage) { | 
|  | 934 | // The null driver never reads or writes the gralloc buffer | 
|  | 935 | *grallocUsage = 0; | 
|  | 936 | return VK_SUCCESS; | 
|  | 937 | } | 
|  | 938 |  | 
| Chris Forbes | 8e4438b | 2016-12-07 16:26:49 +1300 | [diff] [blame] | 939 | VkResult GetSwapchainGrallocUsage2ANDROID(VkDevice, | 
|  | 940 | VkFormat, | 
|  | 941 | VkImageUsageFlags, | 
|  | 942 | VkSwapchainImageUsageFlagsANDROID, | 
| Jesse Hall | d1abd74 | 2017-02-09 21:45:51 -0800 | [diff] [blame] | 943 | uint64_t* grallocConsumerUsage, | 
|  | 944 | uint64_t* grallocProducerUsage) { | 
| Chris Forbes | 8e4438b | 2016-12-07 16:26:49 +1300 | [diff] [blame] | 945 | // The null driver never reads or writes the gralloc buffer | 
| Jesse Hall | d1abd74 | 2017-02-09 21:45:51 -0800 | [diff] [blame] | 946 | *grallocConsumerUsage = 0; | 
|  | 947 | *grallocProducerUsage = 0; | 
| Chris Forbes | 8e4438b | 2016-12-07 16:26:49 +1300 | [diff] [blame] | 948 | return VK_SUCCESS; | 
|  | 949 | } | 
|  | 950 |  | 
| Jesse Hall | 57f7f8c | 2016-01-17 17:21:36 -0800 | [diff] [blame] | 951 | VkResult AcquireImageANDROID(VkDevice, | 
|  | 952 | VkImage, | 
|  | 953 | int fence, | 
|  | 954 | VkSemaphore, | 
|  | 955 | VkFence) { | 
|  | 956 | close(fence); | 
|  | 957 | return VK_SUCCESS; | 
|  | 958 | } | 
|  | 959 |  | 
|  | 960 | VkResult QueueSignalReleaseImageANDROID(VkQueue, | 
|  | 961 | uint32_t, | 
|  | 962 | const VkSemaphore*, | 
|  | 963 | VkImage, | 
|  | 964 | int* fence) { | 
|  | 965 | *fence = -1; | 
|  | 966 | return VK_SUCCESS; | 
|  | 967 | } | 
|  | 968 |  | 
| Jesse Hall | 85c05b6 | 2015-09-01 18:07:41 -0700 | [diff] [blame] | 969 | // ----------------------------------------------------------------------------- | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 970 | // No-op types | 
|  | 971 |  | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 972 | VkResult CreateBufferView(VkDevice device, | 
|  | 973 | const VkBufferViewCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 974 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 975 | VkBufferView* view) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 976 | *view = AllocHandle<VkBufferView>(device, HandleType::kBufferView); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 977 | return VK_SUCCESS; | 
|  | 978 | } | 
|  | 979 |  | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 980 | VkResult CreateDescriptorPool(VkDevice device, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 981 | const VkDescriptorPoolCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 982 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 983 | VkDescriptorPool* pool) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 984 | *pool = AllocHandle<VkDescriptorPool>(device, HandleType::kDescriptorPool); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 985 | return VK_SUCCESS; | 
|  | 986 | } | 
|  | 987 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 988 | VkResult AllocateDescriptorSets(VkDevice device, | 
|  | 989 | const VkDescriptorSetAllocateInfo* alloc_info, | 
|  | 990 | VkDescriptorSet* descriptor_sets) { | 
| Jesse Hall | 3dd678a | 2016-01-08 21:52:01 -0800 | [diff] [blame] | 991 | for (uint32_t i = 0; i < alloc_info->descriptorSetCount; i++) | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 992 | descriptor_sets[i] = | 
|  | 993 | AllocHandle<VkDescriptorSet>(device, HandleType::kDescriptorSet); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 994 | return VK_SUCCESS; | 
|  | 995 | } | 
|  | 996 |  | 
|  | 997 | VkResult CreateDescriptorSetLayout(VkDevice device, | 
|  | 998 | const VkDescriptorSetLayoutCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 999 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1000 | VkDescriptorSetLayout* layout) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1001 | *layout = AllocHandle<VkDescriptorSetLayout>( | 
|  | 1002 | device, HandleType::kDescriptorSetLayout); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1003 | return VK_SUCCESS; | 
|  | 1004 | } | 
|  | 1005 |  | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1006 | VkResult CreateEvent(VkDevice device, | 
|  | 1007 | const VkEventCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1008 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1009 | VkEvent* event) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1010 | *event = AllocHandle<VkEvent>(device, HandleType::kEvent); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1011 | return VK_SUCCESS; | 
|  | 1012 | } | 
|  | 1013 |  | 
|  | 1014 | VkResult CreateFence(VkDevice device, | 
|  | 1015 | const VkFenceCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1016 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1017 | VkFence* fence) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1018 | *fence = AllocHandle<VkFence>(device, HandleType::kFence); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1019 | return VK_SUCCESS; | 
|  | 1020 | } | 
|  | 1021 |  | 
|  | 1022 | VkResult CreateFramebuffer(VkDevice device, | 
|  | 1023 | const VkFramebufferCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1024 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1025 | VkFramebuffer* framebuffer) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1026 | *framebuffer = AllocHandle<VkFramebuffer>(device, HandleType::kFramebuffer); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1027 | return VK_SUCCESS; | 
|  | 1028 | } | 
|  | 1029 |  | 
|  | 1030 | VkResult CreateImageView(VkDevice device, | 
|  | 1031 | const VkImageViewCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1032 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1033 | VkImageView* view) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1034 | *view = AllocHandle<VkImageView>(device, HandleType::kImageView); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1035 | return VK_SUCCESS; | 
|  | 1036 | } | 
|  | 1037 |  | 
|  | 1038 | VkResult CreateGraphicsPipelines(VkDevice device, | 
|  | 1039 | VkPipelineCache, | 
|  | 1040 | uint32_t count, | 
|  | 1041 | const VkGraphicsPipelineCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1042 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1043 | VkPipeline* pipelines) { | 
|  | 1044 | for (uint32_t i = 0; i < count; i++) | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1045 | pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1046 | return VK_SUCCESS; | 
|  | 1047 | } | 
|  | 1048 |  | 
|  | 1049 | VkResult CreateComputePipelines(VkDevice device, | 
|  | 1050 | VkPipelineCache, | 
|  | 1051 | uint32_t count, | 
|  | 1052 | const VkComputePipelineCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1053 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1054 | VkPipeline* pipelines) { | 
|  | 1055 | for (uint32_t i = 0; i < count; i++) | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1056 | pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1057 | return VK_SUCCESS; | 
|  | 1058 | } | 
|  | 1059 |  | 
|  | 1060 | VkResult CreatePipelineCache(VkDevice device, | 
|  | 1061 | const VkPipelineCacheCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1062 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1063 | VkPipelineCache* cache) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1064 | *cache = AllocHandle<VkPipelineCache>(device, HandleType::kPipelineCache); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1065 | return VK_SUCCESS; | 
|  | 1066 | } | 
|  | 1067 |  | 
|  | 1068 | VkResult CreatePipelineLayout(VkDevice device, | 
|  | 1069 | const VkPipelineLayoutCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1070 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1071 | VkPipelineLayout* layout) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1072 | *layout = | 
|  | 1073 | AllocHandle<VkPipelineLayout>(device, HandleType::kPipelineLayout); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1074 | return VK_SUCCESS; | 
|  | 1075 | } | 
|  | 1076 |  | 
|  | 1077 | VkResult CreateQueryPool(VkDevice device, | 
|  | 1078 | const VkQueryPoolCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1079 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1080 | VkQueryPool* pool) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1081 | *pool = AllocHandle<VkQueryPool>(device, HandleType::kQueryPool); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1082 | return VK_SUCCESS; | 
|  | 1083 | } | 
|  | 1084 |  | 
|  | 1085 | VkResult CreateRenderPass(VkDevice device, | 
|  | 1086 | const VkRenderPassCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1087 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1088 | VkRenderPass* renderpass) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1089 | *renderpass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1090 | return VK_SUCCESS; | 
|  | 1091 | } | 
|  | 1092 |  | 
|  | 1093 | VkResult CreateSampler(VkDevice device, | 
|  | 1094 | const VkSamplerCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1095 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1096 | VkSampler* sampler) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1097 | *sampler = AllocHandle<VkSampler>(device, HandleType::kSampler); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1098 | return VK_SUCCESS; | 
|  | 1099 | } | 
|  | 1100 |  | 
|  | 1101 | VkResult CreateSemaphore(VkDevice device, | 
|  | 1102 | const VkSemaphoreCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1103 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1104 | VkSemaphore* semaphore) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1105 | *semaphore = AllocHandle<VkSemaphore>(device, HandleType::kSemaphore); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1106 | return VK_SUCCESS; | 
|  | 1107 | } | 
|  | 1108 |  | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1109 | VkResult CreateShaderModule(VkDevice device, | 
|  | 1110 | const VkShaderModuleCreateInfo*, | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1111 | const VkAllocationCallbacks* /*allocator*/, | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1112 | VkShaderModule* module) { | 
| Michael Lentine | 3fec89e | 2015-12-04 16:25:11 -0800 | [diff] [blame] | 1113 | *module = AllocHandle<VkShaderModule>(device, HandleType::kShaderModule); | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1114 | return VK_SUCCESS; | 
|  | 1115 | } | 
|  | 1116 |  | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 1117 | VkResult CreateDebugReportCallbackEXT(VkInstance instance, | 
|  | 1118 | const VkDebugReportCallbackCreateInfoEXT*, | 
|  | 1119 | const VkAllocationCallbacks*, | 
|  | 1120 | VkDebugReportCallbackEXT* callback) { | 
|  | 1121 | *callback = AllocHandle<VkDebugReportCallbackEXT>( | 
|  | 1122 | instance, HandleType::kDebugReportCallbackEXT); | 
|  | 1123 | return VK_SUCCESS; | 
|  | 1124 | } | 
|  | 1125 |  | 
| Yiwei Zhang | 6be097b | 2020-10-19 20:22:05 -0700 | [diff] [blame] | 1126 | VkResult CreateRenderPass2(VkDevice device, | 
|  | 1127 | const VkRenderPassCreateInfo2*, | 
|  | 1128 | const VkAllocationCallbacks* /*allocator*/, | 
|  | 1129 | VkRenderPass* pRenderPass) { | 
|  | 1130 | *pRenderPass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass); | 
|  | 1131 | return VK_SUCCESS; | 
|  | 1132 | } | 
|  | 1133 |  | 
| Jesse Hall | f8faf0c | 2015-08-31 11:34:32 -0700 | [diff] [blame] | 1134 | // ----------------------------------------------------------------------------- | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1135 | // No-op entrypoints | 
|  | 1136 |  | 
|  | 1137 | // clang-format off | 
|  | 1138 | #pragma clang diagnostic push | 
|  | 1139 | #pragma clang diagnostic ignored "-Wunused-parameter" | 
|  | 1140 |  | 
| Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 1141 | void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1142 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1143 | } | 
|  | 1144 |  | 
| Chris Forbes | 86bdfbe | 2017-01-26 12:45:49 +1300 | [diff] [blame] | 1145 | void GetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR* pFormatProperties) { | 
|  | 1146 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1147 | } | 
|  | 1148 |  | 
| Jesse Hall | a9e5703 | 2015-11-30 01:03:10 -0800 | [diff] [blame] | 1149 | 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] | 1150 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | a9e5703 | 2015-11-30 01:03:10 -0800 | [diff] [blame] | 1151 | return VK_SUCCESS; | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1152 | } | 
|  | 1153 |  | 
| Chris Forbes | 86bdfbe | 2017-01-26 12:45:49 +1300 | [diff] [blame] | 1154 | VkResult GetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, | 
|  | 1155 | const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo, | 
|  | 1156 | VkImageFormatProperties2KHR* pImageFormatProperties) { | 
|  | 1157 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1158 | return VK_SUCCESS; | 
|  | 1159 | } | 
|  | 1160 |  | 
| Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1161 | VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1162 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1163 | return VK_SUCCESS; | 
|  | 1164 | } | 
|  | 1165 |  | 
| Jesse Hall | a366a51 | 2015-11-19 22:30:07 -0800 | [diff] [blame] | 1166 | VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1167 | return VK_SUCCESS; | 
|  | 1168 | } | 
|  | 1169 |  | 
|  | 1170 | VkResult QueueWaitIdle(VkQueue queue) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1171 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1172 | return VK_SUCCESS; | 
|  | 1173 | } | 
|  | 1174 |  | 
|  | 1175 | VkResult DeviceWaitIdle(VkDevice device) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1176 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1177 | return VK_SUCCESS; | 
|  | 1178 | } | 
|  | 1179 |  | 
| Jesse Hall | cf25c41 | 2015-10-29 17:14:50 -0700 | [diff] [blame] | 1180 | void UnmapMemory(VkDevice device, VkDeviceMemory mem) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1181 | } | 
|  | 1182 |  | 
|  | 1183 | VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1184 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1185 | return VK_SUCCESS; | 
|  | 1186 | } | 
|  | 1187 |  | 
|  | 1188 | VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1189 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1190 | return VK_SUCCESS; | 
|  | 1191 | } | 
|  | 1192 |  | 
| Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 1193 | void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1194 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1195 | } | 
|  | 1196 |  | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1197 | VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset) { | 
|  | 1198 | return VK_SUCCESS; | 
|  | 1199 | } | 
|  | 1200 |  | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1201 | VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset) { | 
|  | 1202 | return VK_SUCCESS; | 
|  | 1203 | } | 
|  | 1204 |  | 
| Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 1205 | void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1206 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1207 | } | 
|  | 1208 |  | 
| Jesse Hall | 091ed9e | 2015-11-30 00:55:29 -0800 | [diff] [blame] | 1209 | 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] | 1210 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1211 | } | 
|  | 1212 |  | 
| Chris Forbes | 86bdfbe | 2017-01-26 12:45:49 +1300 | [diff] [blame] | 1213 | void GetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, | 
|  | 1214 | VkPhysicalDeviceSparseImageFormatInfo2KHR const* pInfo, | 
|  | 1215 | unsigned int* pNumProperties, | 
|  | 1216 | VkSparseImageFormatProperties2KHR* pProperties) { | 
|  | 1217 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1218 | } | 
|  | 1219 |  | 
|  | 1220 |  | 
| Jesse Hall | a642925 | 2015-11-29 18:59:42 -0800 | [diff] [blame] | 1221 | VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1222 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1223 | return VK_SUCCESS; | 
|  | 1224 | } | 
|  | 1225 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1226 | void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1227 | } | 
|  | 1228 |  | 
|  | 1229 | VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) { | 
|  | 1230 | return VK_SUCCESS; | 
|  | 1231 | } | 
|  | 1232 |  | 
|  | 1233 | VkResult GetFenceStatus(VkDevice device, VkFence fence) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1234 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1235 | return VK_SUCCESS; | 
|  | 1236 | } | 
|  | 1237 |  | 
|  | 1238 | VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) { | 
|  | 1239 | return VK_SUCCESS; | 
|  | 1240 | } | 
|  | 1241 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1242 | void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1243 | } | 
|  | 1244 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1245 | void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1246 | } | 
|  | 1247 |  | 
|  | 1248 | VkResult GetEventStatus(VkDevice device, VkEvent event) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1249 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1250 | return VK_SUCCESS; | 
|  | 1251 | } | 
|  | 1252 |  | 
|  | 1253 | VkResult SetEvent(VkDevice device, VkEvent event) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1254 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1255 | return VK_SUCCESS; | 
|  | 1256 | } | 
|  | 1257 |  | 
|  | 1258 | VkResult ResetEvent(VkDevice device, VkEvent event) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1259 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1260 | return VK_SUCCESS; | 
|  | 1261 | } | 
|  | 1262 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1263 | void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1264 | } | 
|  | 1265 |  | 
| Jesse Hall | a9bb62b | 2015-11-21 19:31:56 -0800 | [diff] [blame] | 1266 | 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] | 1267 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1268 | return VK_SUCCESS; | 
|  | 1269 | } | 
|  | 1270 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1271 | void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1272 | } | 
|  | 1273 |  | 
| Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 1274 | void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1275 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1276 | } | 
|  | 1277 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1278 | void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1279 | } | 
|  | 1280 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1281 | void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1282 | } | 
|  | 1283 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1284 | void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1285 | } | 
|  | 1286 |  | 
| Jesse Hall | a9bb62b | 2015-11-21 19:31:56 -0800 | [diff] [blame] | 1287 | VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1288 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1289 | return VK_SUCCESS; | 
|  | 1290 | } | 
|  | 1291 |  | 
|  | 1292 | VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1293 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1294 | return VK_SUCCESS; | 
|  | 1295 | } | 
|  | 1296 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1297 | void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1298 | } | 
|  | 1299 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1300 | void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1301 | } | 
|  | 1302 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1303 | void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1304 | } | 
|  | 1305 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1306 | void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1307 | } | 
|  | 1308 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1309 | void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1310 | } | 
|  | 1311 |  | 
| Jesse Hall | fbf97b0 | 2015-11-20 14:17:03 -0800 | [diff] [blame] | 1312 | VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1313 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1314 | return VK_SUCCESS; | 
|  | 1315 | } | 
|  | 1316 |  | 
| Jesse Hall | cf25c41 | 2015-10-29 17:14:50 -0700 | [diff] [blame] | 1317 | 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] | 1318 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1319 | } | 
|  | 1320 |  | 
|  | 1321 | VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1322 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1323 | return VK_SUCCESS; | 
|  | 1324 | } | 
|  | 1325 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1326 | void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1327 | } | 
|  | 1328 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1329 | void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* allocator) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1330 | } | 
|  | 1331 |  | 
| Jesse Hall | 606a54e | 2015-11-19 22:17:28 -0800 | [diff] [blame] | 1332 | void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1333 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1334 | } | 
|  | 1335 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1336 | VkResult ResetCommandPool(VkDevice device, VkCommandPool cmdPool, VkCommandPoolResetFlags flags) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1337 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1338 | return VK_SUCCESS; | 
|  | 1339 | } | 
|  | 1340 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1341 | VkResult BeginCommandBuffer(VkCommandBuffer cmdBuffer, const VkCommandBufferBeginInfo* pBeginInfo) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1342 | return VK_SUCCESS; | 
|  | 1343 | } | 
|  | 1344 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1345 | VkResult EndCommandBuffer(VkCommandBuffer cmdBuffer) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1346 | return VK_SUCCESS; | 
|  | 1347 | } | 
|  | 1348 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1349 | VkResult ResetCommandBuffer(VkCommandBuffer cmdBuffer, VkCommandBufferResetFlags flags) { | 
| Jesse Hall | 73ab0ac | 2015-08-25 15:09:15 +0100 | [diff] [blame] | 1350 | ALOGV("TODO: vk%s", __FUNCTION__); | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1351 | return VK_SUCCESS; | 
|  | 1352 | } | 
|  | 1353 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1354 | void CmdBindPipeline(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1355 | } | 
|  | 1356 |  | 
| Jesse Hall | f9fa9a5 | 2016-01-08 16:08:51 -0800 | [diff] [blame] | 1357 | 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] | 1358 | } | 
|  | 1359 |  | 
| Jesse Hall | f9fa9a5 | 2016-01-08 16:08:51 -0800 | [diff] [blame] | 1360 | 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] | 1361 | } | 
|  | 1362 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1363 | void CmdSetLineWidth(VkCommandBuffer cmdBuffer, float lineWidth) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1364 | } | 
|  | 1365 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1366 | void CmdSetDepthBias(VkCommandBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) { | 
| Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1367 | } | 
|  | 1368 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1369 | void CmdSetBlendConstants(VkCommandBuffer cmdBuffer, const float blendConst[4]) { | 
| Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1370 | } | 
|  | 1371 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1372 | void CmdSetDepthBounds(VkCommandBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) { | 
| Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1373 | } | 
|  | 1374 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1375 | void CmdSetStencilCompareMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) { | 
| Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1376 | } | 
|  | 1377 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1378 | void CmdSetStencilWriteMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) { | 
| Jesse Hall | 5ae3abb | 2015-10-08 14:00:22 -0700 | [diff] [blame] | 1379 | } | 
|  | 1380 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1381 | void CmdSetStencilReference(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1382 | } | 
|  | 1383 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1384 | 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] | 1385 | } | 
|  | 1386 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1387 | void CmdBindIndexBuffer(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1388 | } | 
|  | 1389 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1390 | 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] | 1391 | } | 
|  | 1392 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1393 | 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] | 1394 | } | 
|  | 1395 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1396 | 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] | 1397 | } | 
|  | 1398 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1399 | 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] | 1400 | } | 
|  | 1401 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1402 | 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] | 1403 | } | 
|  | 1404 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1405 | 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] | 1406 | } | 
|  | 1407 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1408 | void CmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1409 | } | 
|  | 1410 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1411 | 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] | 1412 | } | 
|  | 1413 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1414 | 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] | 1415 | } | 
|  | 1416 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1417 | 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] | 1418 | } | 
|  | 1419 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1420 | 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] | 1421 | } | 
|  | 1422 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1423 | 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] | 1424 | } | 
|  | 1425 |  | 
| Jesse Hall | 56d386a | 2016-07-26 15:20:40 -0700 | [diff] [blame] | 1426 | void CmdUpdateBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const void* pData) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1427 | } | 
|  | 1428 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1429 | 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] | 1430 | } | 
|  | 1431 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1432 | 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] | 1433 | } | 
|  | 1434 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1435 | 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] | 1436 | } | 
|  | 1437 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1438 | 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] | 1439 | } | 
|  | 1440 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1441 | 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] | 1442 | } | 
|  | 1443 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1444 | void CmdSetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1445 | } | 
|  | 1446 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1447 | void CmdResetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1448 | } | 
|  | 1449 |  | 
| Jesse Hall | 3dd678a | 2016-01-08 21:52:01 -0800 | [diff] [blame] | 1450 | 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] | 1451 | } | 
|  | 1452 |  | 
| Jesse Hall | 3dd678a | 2016-01-08 21:52:01 -0800 | [diff] [blame] | 1453 | 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] | 1454 | } | 
|  | 1455 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1456 | void CmdBeginQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1457 | } | 
|  | 1458 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1459 | void CmdEndQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1460 | } | 
|  | 1461 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1462 | void CmdResetQueryPool(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1463 | } | 
|  | 1464 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1465 | void CmdWriteTimestamp(VkCommandBuffer cmdBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1466 | } | 
|  | 1467 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1468 | 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] | 1469 | } | 
|  | 1470 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1471 | 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] | 1472 | } | 
|  | 1473 |  | 
| Jesse Hall | 65ab552 | 2015-11-30 00:07:16 -0800 | [diff] [blame] | 1474 | void CmdBeginRenderPass(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1475 | } | 
|  | 1476 |  | 
| Jesse Hall | 65ab552 | 2015-11-30 00:07:16 -0800 | [diff] [blame] | 1477 | void CmdNextSubpass(VkCommandBuffer cmdBuffer, VkSubpassContents contents) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1478 | } | 
|  | 1479 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1480 | void CmdEndRenderPass(VkCommandBuffer cmdBuffer) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1481 | } | 
|  | 1482 |  | 
| Jesse Hall | 3fbc856 | 2015-11-29 22:10:52 -0800 | [diff] [blame] | 1483 | void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers) { | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1484 | } | 
|  | 1485 |  | 
| Jesse Hall | 715b86a | 2016-01-16 16:34:29 -0800 | [diff] [blame] | 1486 | void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator) { | 
|  | 1487 | } | 
|  | 1488 |  | 
|  | 1489 | void DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage) { | 
|  | 1490 | } | 
|  | 1491 |  | 
| Daniel Koch | 09f7bf9 | 2017-10-05 00:26:58 -0400 | [diff] [blame] | 1492 | VkResult BindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos) { | 
|  | 1493 | return VK_SUCCESS; | 
|  | 1494 | } | 
|  | 1495 |  | 
|  | 1496 | VkResult BindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos) { | 
|  | 1497 | return VK_SUCCESS; | 
|  | 1498 | } | 
|  | 1499 |  | 
|  | 1500 | void GetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures) { | 
|  | 1501 | } | 
|  | 1502 |  | 
|  | 1503 | void CmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask) { | 
|  | 1504 | } | 
|  | 1505 |  | 
|  | 1506 | void CmdDispatchBase(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) { | 
|  | 1507 | } | 
|  | 1508 |  | 
|  | 1509 | VkResult EnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties) { | 
|  | 1510 | return VK_SUCCESS; | 
|  | 1511 | } | 
|  | 1512 |  | 
|  | 1513 | void GetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) { | 
|  | 1514 | } | 
|  | 1515 |  | 
|  | 1516 | void GetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) { | 
|  | 1517 | } | 
|  | 1518 |  | 
|  | 1519 | void GetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) { | 
|  | 1520 | } | 
|  | 1521 |  | 
|  | 1522 | void GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures) { | 
|  | 1523 | } | 
|  | 1524 |  | 
|  | 1525 | void GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties) { | 
|  | 1526 | } | 
|  | 1527 |  | 
|  | 1528 | void GetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties) { | 
|  | 1529 | } | 
|  | 1530 |  | 
|  | 1531 | VkResult GetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties) { | 
|  | 1532 | return VK_SUCCESS; | 
|  | 1533 | } | 
|  | 1534 |  | 
|  | 1535 | void GetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties) { | 
|  | 1536 | } | 
|  | 1537 |  | 
|  | 1538 | void GetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties) { | 
|  | 1539 | } | 
|  | 1540 |  | 
|  | 1541 | void GetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties) { | 
|  | 1542 | } | 
|  | 1543 |  | 
|  | 1544 | void TrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) { | 
|  | 1545 | } | 
|  | 1546 |  | 
|  | 1547 | void GetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo, VkQueue* pQueue) { | 
|  | 1548 | } | 
|  | 1549 |  | 
|  | 1550 | VkResult CreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion) { | 
|  | 1551 | return VK_SUCCESS; | 
|  | 1552 | } | 
|  | 1553 |  | 
|  | 1554 | void DestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator) { | 
|  | 1555 | } | 
|  | 1556 |  | 
|  | 1557 | VkResult CreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate) { | 
|  | 1558 | return VK_SUCCESS; | 
|  | 1559 | } | 
|  | 1560 |  | 
|  | 1561 | void DestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator) { | 
|  | 1562 | } | 
|  | 1563 |  | 
|  | 1564 | void UpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData) { | 
|  | 1565 | } | 
|  | 1566 |  | 
|  | 1567 | void GetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) { | 
|  | 1568 | } | 
|  | 1569 |  | 
|  | 1570 | void GetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties) { | 
|  | 1571 | } | 
|  | 1572 |  | 
|  | 1573 | void GetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties) { | 
|  | 1574 | } | 
|  | 1575 |  | 
|  | 1576 | void GetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport) { | 
|  | 1577 | } | 
|  | 1578 |  | 
| Yiwei Zhang | 6be097b | 2020-10-19 20:22:05 -0700 | [diff] [blame] | 1579 | void ResetQueryPool(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) { | 
|  | 1580 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1581 | } | 
|  | 1582 |  | 
|  | 1583 | void CmdBeginRenderPass2(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const VkSubpassBeginInfo* pSubpassBeginInfo) { | 
|  | 1584 | } | 
|  | 1585 |  | 
|  | 1586 | void CmdNextSubpass2(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo* pSubpassBeginInfo, const VkSubpassEndInfo* pSubpassEndInfo) { | 
|  | 1587 | } | 
|  | 1588 |  | 
|  | 1589 | void CmdEndRenderPass2(VkCommandBuffer commandBuffer, const VkSubpassEndInfo* pSubpassEndInfo) { | 
|  | 1590 | } | 
|  | 1591 |  | 
|  | 1592 | VkResult GetSemaphoreCounterValue(VkDevice device, VkSemaphore semaphore, uint64_t* pValue) { | 
|  | 1593 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1594 | return VK_SUCCESS; | 
|  | 1595 | } | 
|  | 1596 |  | 
|  | 1597 | VkResult WaitSemaphores(VkDevice device, const VkSemaphoreWaitInfo* pWaitInfo, uint64_t timeout) { | 
|  | 1598 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1599 | return VK_SUCCESS; | 
|  | 1600 | } | 
|  | 1601 |  | 
|  | 1602 | VkResult SignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo* pSignalInfo) { | 
|  | 1603 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1604 | return VK_SUCCESS; | 
|  | 1605 | } | 
|  | 1606 |  | 
|  | 1607 | void CmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) { | 
|  | 1608 | } | 
|  | 1609 |  | 
|  | 1610 | void CmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) { | 
|  | 1611 | } | 
|  | 1612 |  | 
|  | 1613 | uint64_t GetBufferOpaqueCaptureAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo) { | 
|  | 1614 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1615 | return 0; | 
|  | 1616 | } | 
|  | 1617 |  | 
|  | 1618 | VkDeviceAddress GetBufferDeviceAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo) { | 
|  | 1619 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1620 | return (VkDeviceAddress)0; | 
|  | 1621 | } | 
|  | 1622 |  | 
|  | 1623 | uint64_t GetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo) { | 
|  | 1624 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1625 | return 0; | 
|  | 1626 | } | 
|  | 1627 |  | 
| Trevor David Black | 6e76a61 | 2022-01-24 22:28:40 +0000 | [diff] [blame] | 1628 | void CmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo) { | 
|  | 1629 | } | 
|  | 1630 |  | 
|  | 1631 | void CmdEndRendering(VkCommandBuffer commandBuffer) { | 
|  | 1632 | } | 
|  | 1633 |  | 
|  | 1634 | void CmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes, const VkDeviceSize* pStrides) { | 
|  | 1635 | } | 
|  | 1636 |  | 
|  | 1637 | void CmdBlitImage2(VkCommandBuffer commandBuffer, const VkBlitImageInfo2* pBlitImageInfo) { | 
|  | 1638 | } | 
|  | 1639 |  | 
|  | 1640 | void CmdCopyBuffer2(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2* pCopyBufferInfo) { | 
|  | 1641 | } | 
|  | 1642 |  | 
|  | 1643 | void CmdCopyImage2(VkCommandBuffer commandBuffer, const VkCopyImageInfo2* pCopyImageInfo) { | 
|  | 1644 | } | 
|  | 1645 |  | 
|  | 1646 | void CmdCopyBufferToImage2(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2* pCopyBufferToImageInfo) { | 
|  | 1647 | } | 
|  | 1648 |  | 
|  | 1649 | void CmdCopyImageToBuffer2(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo) { | 
|  | 1650 | } | 
|  | 1651 |  | 
|  | 1652 | void CmdPipelineBarrier2(VkCommandBuffer commandBuffer, const VkDependencyInfo* pDependencyInfo) { | 
|  | 1653 | } | 
|  | 1654 |  | 
|  | 1655 | void CmdResetEvent2(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2 stageMask) { | 
|  | 1656 | } | 
|  | 1657 |  | 
|  | 1658 | void CmdResolveImage2(VkCommandBuffer commandBuffer, const VkResolveImageInfo2* pResolveImageInfo) { | 
|  | 1659 | } | 
|  | 1660 |  | 
|  | 1661 | void CmdSetCullMode(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode) { | 
|  | 1662 | } | 
|  | 1663 |  | 
|  | 1664 | void CmdSetDepthBiasEnable(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable) { | 
|  | 1665 | } | 
|  | 1666 |  | 
|  | 1667 | void CmdSetDepthBoundsTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable) { | 
|  | 1668 | } | 
|  | 1669 |  | 
|  | 1670 | void CmdSetDepthCompareOp(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp) { | 
|  | 1671 | } | 
|  | 1672 |  | 
|  | 1673 | void CmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable) { | 
|  | 1674 | } | 
|  | 1675 |  | 
|  | 1676 | void CmdSetDepthWriteEnable(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable) { | 
|  | 1677 | } | 
|  | 1678 |  | 
|  | 1679 | void CmdSetEvent2(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfo* pDependencyInfo) { | 
|  | 1680 | } | 
|  | 1681 |  | 
|  | 1682 | void CmdSetFrontFace(VkCommandBuffer commandBuffer, VkFrontFace frontFace) { | 
|  | 1683 | } | 
|  | 1684 |  | 
|  | 1685 | void CmdSetPrimitiveRestartEnable(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable) { | 
|  | 1686 | } | 
|  | 1687 |  | 
|  | 1688 | void CmdSetPrimitiveTopology(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology) { | 
|  | 1689 | } | 
|  | 1690 |  | 
|  | 1691 | void CmdSetRasterizerDiscardEnable(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable) { | 
|  | 1692 | } | 
|  | 1693 |  | 
|  | 1694 | void CmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors) { | 
|  | 1695 | } | 
|  | 1696 |  | 
|  | 1697 | void CmdSetStencilOp(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp) { | 
|  | 1698 | } | 
|  | 1699 |  | 
|  | 1700 | void CmdSetStencilTestEnable(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable) { | 
|  | 1701 | } | 
|  | 1702 |  | 
|  | 1703 | void CmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports) { | 
|  | 1704 | } | 
|  | 1705 |  | 
|  | 1706 | void CmdWaitEvents2(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, const VkDependencyInfo* pDependencyInfos) { | 
|  | 1707 | } | 
|  | 1708 |  | 
|  | 1709 | void CmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query) { | 
|  | 1710 | } | 
|  | 1711 |  | 
|  | 1712 | VkResult CreatePrivateDataSlot(VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot) { | 
|  | 1713 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1714 | return VK_SUCCESS; | 
|  | 1715 | } | 
|  | 1716 |  | 
|  | 1717 | void DestroyPrivateDataSlot(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator) { | 
|  | 1718 | } | 
|  | 1719 |  | 
|  | 1720 | void GetDeviceBufferMemoryRequirements(VkDevice device, const VkDeviceBufferMemoryRequirements* pInfo, VkMemoryRequirements2* pMemoryRequirements) { | 
|  | 1721 | } | 
|  | 1722 |  | 
|  | 1723 | void GetDeviceImageMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, VkMemoryRequirements2* pMemoryRequirements) { | 
|  | 1724 | } | 
|  | 1725 |  | 
|  | 1726 | void GetDeviceImageSparseMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) { | 
|  | 1727 | } | 
|  | 1728 |  | 
|  | 1729 | VkResult GetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolProperties* pToolProperties) { | 
|  | 1730 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1731 | return VK_SUCCESS; | 
|  | 1732 | } | 
|  | 1733 |  | 
|  | 1734 | void GetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData) { | 
|  | 1735 | } | 
|  | 1736 |  | 
|  | 1737 | VkResult QueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2* pSubmits, VkFence fence) { | 
|  | 1738 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1739 | return VK_SUCCESS; | 
|  | 1740 | } | 
|  | 1741 |  | 
|  | 1742 | VkResult SetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data) { | 
|  | 1743 | ALOGV("TODO: vk%s", __FUNCTION__); | 
|  | 1744 | return VK_SUCCESS; | 
|  | 1745 | } | 
|  | 1746 |  | 
| Jesse Hall | 04f4f47 | 2015-08-16 19:51:04 -0700 | [diff] [blame] | 1747 | #pragma clang diagnostic pop | 
|  | 1748 | // clang-format on | 
|  | 1749 |  | 
|  | 1750 | }  // namespace null_driver |