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