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