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