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