blob: 973e71c8925fe6e25795bf9cdab1e52288594ac9 [file] [log] [blame]
Jesse Halld02edcb2015-09-08 07:44:48 -07001/*
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
Trevor David Black0db7a092023-12-11 23:46:36 +000017#include <android/hardware_buffer.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070018#include <hardware/hwvulkan.h>
19
Dan Albert19165132017-12-13 13:40:17 -080020#include <errno.h>
Jesse Hall715b86a2016-01-16 16:34:29 -080021#include <inttypes.h>
Jesse Halld3b14502016-04-20 16:58:11 -070022#include <stdlib.h>
Jesse Hall715b86a2016-01-16 16:34:29 -080023#include <string.h>
Steven Moreland54409a32017-07-17 11:49:21 -070024#include <unistd.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070025
Mark Salyzyna5e161b2016-09-29 08:08:05 -070026#include <algorithm>
27#include <array>
28
Mark Salyzyn7823e122016-09-29 08:08:05 -070029#include <log/log.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070030
Jesse Hall1f91d392015-12-11 16:28:44 -080031#include "null_driver_gen.h"
Jesse Hall04f4f472015-08-16 19:51:04 -070032
33using namespace null_driver;
34
35struct VkPhysicalDevice_T {
36 hwvulkan_dispatch_t dispatch;
37};
38
39struct VkInstance_T {
40 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -080041 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -070042 VkPhysicalDevice_T physical_device;
Jesse Hall715b86a2016-01-16 16:34:29 -080043 uint64_t next_callback_handle;
Jesse Hall04f4f472015-08-16 19:51:04 -070044};
45
46struct VkQueue_T {
47 hwvulkan_dispatch_t dispatch;
48};
49
Jesse Hall3fbc8562015-11-29 22:10:52 -080050struct VkCommandBuffer_T {
Jesse Hall04f4f472015-08-16 19:51:04 -070051 hwvulkan_dispatch_t dispatch;
52};
53
Jesse Hallf8faf0c2015-08-31 11:34:32 -070054namespace {
55// Handles for non-dispatchable objects are either pointers, or arbitrary
56// 64-bit non-zero values. We only use pointers when we need to keep state for
57// the object even in a null driver. For the rest, we form a handle as:
58// [63:63] = 1 to distinguish from pointer handles*
59// [62:56] = non-zero handle type enum value
60// [55: 0] = per-handle-type incrementing counter
61// * This works because virtual addresses with the high bit set are reserved
62// for kernel data in all ABIs we run on.
63//
64// We never reclaim handles on vkDestroy*. It's not even necessary for us to
65// have distinct handles for live objects, and practically speaking we won't
66// ever create 2^56 objects of the same type from a single VkDevice in a null
67// driver.
68//
69// Using a namespace here instead of 'enum class' since we want scoped
70// constants but also want implicit conversions to integral types.
71namespace HandleType {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070072enum Enum {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070073 kBufferView,
Jesse Hall715b86a2016-01-16 16:34:29 -080074 kDebugReportCallbackEXT,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070075 kDescriptorPool,
76 kDescriptorSet,
77 kDescriptorSetLayout,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070078 kEvent,
79 kFence,
80 kFramebuffer,
81 kImageView,
82 kPipeline,
83 kPipelineCache,
84 kPipelineLayout,
85 kQueryPool,
86 kRenderPass,
87 kSampler,
88 kSemaphore,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070089 kShaderModule,
Jesse Hallf8faf0c2015-08-31 11:34:32 -070090
Jesse Hallc7a6eb52015-08-31 12:52:03 -070091 kNumTypes
92};
93} // namespace HandleType
Jesse Hallbde8ee32015-09-01 16:24:29 -070094
Jesse Hall00f10fe2016-02-08 21:20:20 -080095const VkDeviceSize kMaxDeviceMemory = 0x10000000; // 256 MiB, arbitrary
Jesse Hallbde8ee32015-09-01 16:24:29 -070096
Jesse Hallc7a6eb52015-08-31 12:52:03 -070097} // anonymous namespace
Jesse Hallf8faf0c2015-08-31 11:34:32 -070098
Jesse Hall04f4f472015-08-16 19:51:04 -070099struct VkDevice_T {
100 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800101 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700102 VkInstance_T* instance;
103 VkQueue_T queue;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700104 std::array<uint64_t, HandleType::kNumTypes> next_handle;
Jesse Hall04f4f472015-08-16 19:51:04 -0700105};
106
107// -----------------------------------------------------------------------------
108// Declare HAL_MODULE_INFO_SYM early so it can be referenced by nulldrv_device
109// later.
110
111namespace {
112int OpenDevice(const hw_module_t* module, const char* id, hw_device_t** device);
113hw_module_methods_t nulldrv_module_methods = {.open = OpenDevice};
114} // namespace
115
116#pragma clang diagnostic push
117#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
118__attribute__((visibility("default"))) hwvulkan_module_t HAL_MODULE_INFO_SYM = {
119 .common =
120 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500121 .tag = HARDWARE_MODULE_TAG,
122 .module_api_version = HWVULKAN_MODULE_API_VERSION_0_1,
123 .hal_api_version = HARDWARE_HAL_API_VERSION,
124 .id = HWVULKAN_HARDWARE_MODULE_ID,
125 .name = "Null Vulkan Driver",
126 .author = "The Android Open Source Project",
127 .methods = &nulldrv_module_methods,
Jesse Hall04f4f472015-08-16 19:51:04 -0700128 },
129};
130#pragma clang diagnostic pop
131
132// -----------------------------------------------------------------------------
133
134namespace {
135
Jesse Hall04f4f472015-08-16 19:51:04 -0700136int CloseDevice(struct hw_device_t* /*device*/) {
137 // nothing to do - opening a device doesn't allocate any resources
138 return 0;
139}
140
141hwvulkan_device_t nulldrv_device = {
142 .common =
143 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500144 .tag = HARDWARE_DEVICE_TAG,
145 .version = HWVULKAN_DEVICE_API_VERSION_0_1,
146 .module = &HAL_MODULE_INFO_SYM.common,
147 .close = CloseDevice,
Jesse Hall04f4f472015-08-16 19:51:04 -0700148 },
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700149 .EnumerateInstanceExtensionProperties =
150 EnumerateInstanceExtensionProperties,
Jesse Hall04f4f472015-08-16 19:51:04 -0700151 .CreateInstance = CreateInstance,
152 .GetInstanceProcAddr = GetInstanceProcAddr};
153
154int OpenDevice(const hw_module_t* /*module*/,
155 const char* id,
156 hw_device_t** device) {
157 if (strcmp(id, HWVULKAN_DEVICE_0) == 0) {
158 *device = &nulldrv_device.common;
159 return 0;
160 }
161 return -ENOENT;
162}
163
164VkInstance_T* GetInstanceFromPhysicalDevice(
165 VkPhysicalDevice_T* physical_device) {
166 return reinterpret_cast<VkInstance_T*>(
167 reinterpret_cast<uintptr_t>(physical_device) -
168 offsetof(VkInstance_T, physical_device));
169}
170
Jesse Hall715b86a2016-01-16 16:34:29 -0800171uint64_t AllocHandle(uint64_t type, uint64_t* next_handle) {
172 const uint64_t kHandleMask = (UINT64_C(1) << 56) - 1;
173 ALOGE_IF(*next_handle == kHandleMask,
174 "non-dispatchable handles of type=%" PRIu64
175 " are about to overflow",
176 type);
177 return (UINT64_C(1) << 63) | ((type & 0x7) << 56) |
178 ((*next_handle)++ & kHandleMask);
179}
180
181template <class Handle>
182Handle AllocHandle(VkInstance instance, HandleType::Enum type) {
183 return reinterpret_cast<Handle>(
184 AllocHandle(type, &instance->next_callback_handle));
185}
186
Michael Lentine3fec89e2015-12-04 16:25:11 -0800187template <class Handle>
188Handle AllocHandle(VkDevice device, HandleType::Enum type) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800189 return reinterpret_cast<Handle>(
Jesse Hall715b86a2016-01-16 16:34:29 -0800190 AllocHandle(type, &device->next_handle[type]));
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700191}
192
Jesse Halld3b14502016-04-20 16:58:11 -0700193VKAPI_ATTR void* DefaultAllocate(void*,
194 size_t size,
195 size_t alignment,
196 VkSystemAllocationScope) {
197 void* ptr = nullptr;
198 // Vulkan requires 'alignment' to be a power of two, but posix_memalign
199 // additionally requires that it be at least sizeof(void*).
200 int ret = posix_memalign(&ptr, std::max(alignment, sizeof(void*)), size);
201 return ret == 0 ? ptr : nullptr;
202}
203
204VKAPI_ATTR void* DefaultReallocate(void*,
205 void* ptr,
206 size_t size,
207 size_t alignment,
208 VkSystemAllocationScope) {
209 if (size == 0) {
210 free(ptr);
211 return nullptr;
212 }
213
214 // TODO(jessehall): Right now we never shrink allocations; if the new
215 // request is smaller than the existing chunk, we just continue using it.
216 // The null driver never reallocs, so this doesn't matter. If that changes,
217 // or if this code is copied into some other project, this should probably
218 // have a heuristic to allocate-copy-free when doing so will save "enough"
219 // space.
220 size_t old_size = ptr ? malloc_usable_size(ptr) : 0;
221 if (size <= old_size)
222 return ptr;
223
224 void* new_ptr = nullptr;
225 if (posix_memalign(&new_ptr, std::max(alignment, sizeof(void*)), size) != 0)
226 return nullptr;
227 if (ptr) {
228 memcpy(new_ptr, ptr, std::min(old_size, size));
229 free(ptr);
230 }
231 return new_ptr;
232}
233
234VKAPI_ATTR void DefaultFree(void*, void* ptr) {
235 free(ptr);
236}
237
238const VkAllocationCallbacks kDefaultAllocCallbacks = {
239 .pUserData = nullptr,
240 .pfnAllocation = DefaultAllocate,
241 .pfnReallocation = DefaultReallocate,
242 .pfnFree = DefaultFree,
243};
244
Jesse Hall04f4f472015-08-16 19:51:04 -0700245} // namespace
246
247namespace null_driver {
248
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800249#define DEFINE_OBJECT_HANDLE_CONVERSION(T) \
250 T* Get##T##FromHandle(Vk##T h); \
251 T* Get##T##FromHandle(Vk##T h) { \
252 return reinterpret_cast<T*>(uintptr_t(h)); \
253 } \
254 Vk##T GetHandleTo##T(const T* obj); \
255 Vk##T GetHandleTo##T(const T* obj) { \
256 return Vk##T(reinterpret_cast<uintptr_t>(obj)); \
257 }
Jesse Hallf6578742015-08-29 17:06:12 +0100258
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100259// -----------------------------------------------------------------------------
260// Global
261
Jesse Halle1b12782015-11-30 11:27:32 -0800262VKAPI_ATTR
Daniel Koch09f7bf92017-10-05 00:26:58 -0400263VkResult EnumerateInstanceVersion(uint32_t* pApiVersion) {
Trevor David Black628c41a2021-09-27 05:07:22 +0000264 *pApiVersion = VK_API_VERSION_1_3;
Daniel Koch09f7bf92017-10-05 00:26:58 -0400265 return VK_SUCCESS;
266}
267
268VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800269VkResult EnumerateInstanceExtensionProperties(
270 const char* layer_name,
271 uint32_t* count,
272 VkExtensionProperties* properties) {
273 if (layer_name) {
274 ALOGW(
275 "Driver vkEnumerateInstanceExtensionProperties shouldn't be called "
276 "with a layer name ('%s')",
277 layer_name);
Jesse Hall715b86a2016-01-16 16:34:29 -0800278 }
279
280 const VkExtensionProperties kExtensions[] = {
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300281 {VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION}};
Jesse Hall715b86a2016-01-16 16:34:29 -0800282 const uint32_t kExtensionsCount =
283 sizeof(kExtensions) / sizeof(kExtensions[0]);
284
285 if (!properties || *count > kExtensionsCount)
286 *count = kExtensionsCount;
287 if (properties)
288 std::copy(kExtensions, kExtensions + *count, properties);
289 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100290}
291
Jesse Halle1b12782015-11-30 11:27:32 -0800292VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800293VkResult CreateInstance(const VkInstanceCreateInfo* create_info,
Jesse Hall1f91d392015-12-11 16:28:44 -0800294 const VkAllocationCallbacks* allocator,
295 VkInstance* out_instance) {
Jesse Halld3b14502016-04-20 16:58:11 -0700296 if (!allocator)
297 allocator = &kDefaultAllocCallbacks;
Jesse Hall1f91d392015-12-11 16:28:44 -0800298
299 VkInstance_T* instance =
300 static_cast<VkInstance_T*>(allocator->pfnAllocation(
301 allocator->pUserData, sizeof(VkInstance_T), alignof(VkInstance_T),
302 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE));
303 if (!instance)
304 return VK_ERROR_OUT_OF_HOST_MEMORY;
305
306 instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
307 instance->allocator = *allocator;
308 instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall715b86a2016-01-16 16:34:29 -0800309 instance->next_callback_handle = 0;
Jesse Hall715b86a2016-01-16 16:34:29 -0800310
311 for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
312 if (strcmp(create_info->ppEnabledExtensionNames[i],
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300313 VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME) == 0) {
314 ALOGV("instance extension '%s' requested",
315 create_info->ppEnabledExtensionNames[i]);
316 } else if (strcmp(create_info->ppEnabledExtensionNames[i],
Jesse Hall715b86a2016-01-16 16:34:29 -0800317 VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) {
Jesse Hallb1471272016-01-17 21:36:58 -0800318 ALOGV("instance extension '%s' requested",
319 create_info->ppEnabledExtensionNames[i]);
320 } else {
321 ALOGW("unsupported extension '%s' requested",
322 create_info->ppEnabledExtensionNames[i]);
Jesse Hall715b86a2016-01-16 16:34:29 -0800323 }
324 }
Jesse Hall1f91d392015-12-11 16:28:44 -0800325
326 *out_instance = instance;
327 return VK_SUCCESS;
328}
329
330VKAPI_ATTR
331PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name) {
332 return instance ? GetInstanceProcAddr(name) : GetGlobalProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700333}
334
Jesse Halle1b12782015-11-30 11:27:32 -0800335VKAPI_ATTR
Jesse Hall04f4f472015-08-16 19:51:04 -0700336PFN_vkVoidFunction GetDeviceProcAddr(VkDevice, const char* name) {
Jesse Hall1f91d392015-12-11 16:28:44 -0800337 return GetInstanceProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700338}
339
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100340// -----------------------------------------------------------------------------
341// Instance
342
Jesse Hall03b6fe12015-11-24 12:44:21 -0800343void DestroyInstance(VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800344 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800345 instance->allocator.pfnFree(instance->allocator.pUserData, instance);
Jesse Hall04f4f472015-08-16 19:51:04 -0700346}
347
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100348// -----------------------------------------------------------------------------
349// PhysicalDevice
350
Jesse Hall04f4f472015-08-16 19:51:04 -0700351VkResult EnumeratePhysicalDevices(VkInstance instance,
352 uint32_t* physical_device_count,
353 VkPhysicalDevice* physical_devices) {
Ian Elliott3fe21f62017-10-20 10:41:01 -0600354 if (!physical_devices)
355 *physical_device_count = 1;
356 else if (*physical_device_count == 0)
357 return VK_INCOMPLETE;
358 else {
Jesse Hall04f4f472015-08-16 19:51:04 -0700359 physical_devices[0] = &instance->physical_device;
Ian Elliott3fe21f62017-10-20 10:41:01 -0600360 *physical_device_count = 1;
361 }
Jesse Hall04f4f472015-08-16 19:51:04 -0700362 return VK_SUCCESS;
363}
364
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800365VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice /*gpu*/,
366 uint32_t* count,
367 VkLayerProperties* /*properties*/) {
368 ALOGW("Driver vkEnumerateDeviceLayerProperties shouldn't be called");
369 *count = 0;
370 return VK_SUCCESS;
371}
372
373VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice /*gpu*/,
374 const char* layer_name,
375 uint32_t* count,
376 VkExtensionProperties* properties) {
377 if (layer_name) {
378 ALOGW(
379 "Driver vkEnumerateDeviceExtensionProperties shouldn't be called "
380 "with a layer name ('%s')",
381 layer_name);
382 *count = 0;
383 return VK_SUCCESS;
384 }
385
386 const VkExtensionProperties kExtensions[] = {
387 {VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME,
388 VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION}};
389 const uint32_t kExtensionsCount =
390 sizeof(kExtensions) / sizeof(kExtensions[0]);
391
392 if (!properties || *count > kExtensionsCount)
393 *count = kExtensionsCount;
394 if (properties)
395 std::copy(kExtensions, kExtensions + *count, properties);
396 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
397}
398
Jesse Hall606a54e2015-11-19 22:17:28 -0800399void GetPhysicalDeviceProperties(VkPhysicalDevice,
400 VkPhysicalDeviceProperties* properties) {
Trevor David Blackb68a2252021-08-23 16:37:18 +0000401 properties->apiVersion = VK_MAKE_API_VERSION(0, 1, 2, VK_HEADER_VERSION);
402 properties->driverVersion = VK_MAKE_API_VERSION(0, 0, 0, 1);
Jesse Hall65ab5522015-11-30 00:07:16 -0800403 properties->vendorID = 0;
404 properties->deviceID = 0;
Jesse Hall04f4f472015-08-16 19:51:04 -0700405 properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
406 strcpy(properties->deviceName, "Android Vulkan Null Driver");
407 memset(properties->pipelineCacheUUID, 0,
408 sizeof(properties->pipelineCacheUUID));
Jesse Hallc34849e2016-02-09 22:35:04 -0800409 properties->limits = VkPhysicalDeviceLimits{
410 4096, // maxImageDimension1D
411 4096, // maxImageDimension2D
412 256, // maxImageDimension3D
413 4096, // maxImageDimensionCube
414 256, // maxImageArrayLayers
415 65536, // maxTexelBufferElements
416 16384, // maxUniformBufferRange
417 1 << 27, // maxStorageBufferRange
418 128, // maxPushConstantsSize
419 4096, // maxMemoryAllocationCount
420 4000, // maxSamplerAllocationCount
421 1, // bufferImageGranularity
422 0, // sparseAddressSpaceSize
423 4, // maxBoundDescriptorSets
424 16, // maxPerStageDescriptorSamplers
425 12, // maxPerStageDescriptorUniformBuffers
426 4, // maxPerStageDescriptorStorageBuffers
427 16, // maxPerStageDescriptorSampledImages
428 4, // maxPerStageDescriptorStorageImages
429 4, // maxPerStageDescriptorInputAttachments
430 128, // maxPerStageResources
431 96, // maxDescriptorSetSamplers
432 72, // maxDescriptorSetUniformBuffers
433 8, // maxDescriptorSetUniformBuffersDynamic
434 24, // maxDescriptorSetStorageBuffers
435 4, // maxDescriptorSetStorageBuffersDynamic
436 96, // maxDescriptorSetSampledImages
437 24, // maxDescriptorSetStorageImages
438 4, // maxDescriptorSetInputAttachments
439 16, // maxVertexInputAttributes
440 16, // maxVertexInputBindings
441 2047, // maxVertexInputAttributeOffset
442 2048, // maxVertexInputBindingStride
443 64, // maxVertexOutputComponents
444 0, // maxTessellationGenerationLevel
445 0, // maxTessellationPatchSize
446 0, // maxTessellationControlPerVertexInputComponents
447 0, // maxTessellationControlPerVertexOutputComponents
448 0, // maxTessellationControlPerPatchOutputComponents
449 0, // maxTessellationControlTotalOutputComponents
450 0, // maxTessellationEvaluationInputComponents
451 0, // maxTessellationEvaluationOutputComponents
452 0, // maxGeometryShaderInvocations
453 0, // maxGeometryInputComponents
454 0, // maxGeometryOutputComponents
455 0, // maxGeometryOutputVertices
456 0, // maxGeometryTotalOutputComponents
457 64, // maxFragmentInputComponents
458 4, // maxFragmentOutputAttachments
459 0, // maxFragmentDualSrcAttachments
460 4, // maxFragmentCombinedOutputResources
461 16384, // maxComputeSharedMemorySize
462 {65536, 65536, 65536}, // maxComputeWorkGroupCount[3]
463 128, // maxComputeWorkGroupInvocations
464 {128, 128, 64}, // maxComputeWorkGroupSize[3]
465 4, // subPixelPrecisionBits
466 4, // subTexelPrecisionBits
467 4, // mipmapPrecisionBits
468 UINT32_MAX, // maxDrawIndexedIndexValue
469 1, // maxDrawIndirectCount
470 2, // maxSamplerLodBias
471 1, // maxSamplerAnisotropy
472 1, // maxViewports
473 {4096, 4096}, // maxViewportDimensions[2]
474 {-8192.0f, 8191.0f}, // viewportBoundsRange[2]
475 0, // viewportSubPixelBits
476 64, // minMemoryMapAlignment
477 256, // minTexelBufferOffsetAlignment
478 256, // minUniformBufferOffsetAlignment
479 256, // minStorageBufferOffsetAlignment
480 -8, // minTexelOffset
481 7, // maxTexelOffset
482 0, // minTexelGatherOffset
483 0, // maxTexelGatherOffset
484 0.0f, // minInterpolationOffset
485 0.0f, // maxInterpolationOffset
486 0, // subPixelInterpolationOffsetBits
487 4096, // maxFramebufferWidth
488 4096, // maxFramebufferHeight
489 256, // maxFramebufferLayers
490 VK_SAMPLE_COUNT_1_BIT |
491 VK_SAMPLE_COUNT_4_BIT, // framebufferColorSampleCounts
492 VK_SAMPLE_COUNT_1_BIT |
493 VK_SAMPLE_COUNT_4_BIT, // framebufferDepthSampleCounts
494 VK_SAMPLE_COUNT_1_BIT |
495 VK_SAMPLE_COUNT_4_BIT, // framebufferStencilSampleCounts
496 VK_SAMPLE_COUNT_1_BIT |
497 VK_SAMPLE_COUNT_4_BIT, // framebufferNoAttachmentsSampleCounts
498 4, // maxColorAttachments
499 VK_SAMPLE_COUNT_1_BIT |
500 VK_SAMPLE_COUNT_4_BIT, // sampledImageColorSampleCounts
501 VK_SAMPLE_COUNT_1_BIT, // sampledImageIntegerSampleCounts
502 VK_SAMPLE_COUNT_1_BIT |
503 VK_SAMPLE_COUNT_4_BIT, // sampledImageDepthSampleCounts
504 VK_SAMPLE_COUNT_1_BIT |
505 VK_SAMPLE_COUNT_4_BIT, // sampledImageStencilSampleCounts
506 VK_SAMPLE_COUNT_1_BIT, // storageImageSampleCounts
507 1, // maxSampleMaskWords
508 VK_TRUE, // timestampComputeAndGraphics
509 1, // timestampPeriod
510 0, // maxClipDistances
511 0, // maxCullDistances
512 0, // maxCombinedClipAndCullDistances
513 2, // discreteQueuePriorities
514 {1.0f, 1.0f}, // pointSizeRange[2]
515 {1.0f, 1.0f}, // lineWidthRange[2]
516 0.0f, // pointSizeGranularity
517 0.0f, // lineWidthGranularity
518 VK_TRUE, // strictLines
519 VK_TRUE, // standardSampleLocations
520 1, // optimalBufferCopyOffsetAlignment
521 1, // optimalBufferCopyRowPitchAlignment
522 64, // nonCoherentAtomSize
523 };
Jesse Hall04f4f472015-08-16 19:51:04 -0700524}
525
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300526void GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physical_device,
527 VkPhysicalDeviceProperties2KHR* properties) {
528 GetPhysicalDeviceProperties(physical_device, &properties->properties);
Chris Forbesb4eb2782017-03-15 16:09:15 +1300529
530 while (properties->pNext) {
531 properties = reinterpret_cast<VkPhysicalDeviceProperties2KHR *>(properties->pNext);
532
533#pragma clang diagnostic push
534#pragma clang diagnostic ignored "-Wold-style-cast"
535 switch ((VkFlags)properties->sType) {
536 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID: {
537 VkPhysicalDevicePresentationPropertiesANDROID *presentation_properties =
538 reinterpret_cast<VkPhysicalDevicePresentationPropertiesANDROID *>(properties);
539#pragma clang diagnostic pop
540
541 // Claim that we do all the right things for the loader to
542 // expose KHR_shared_presentable_image on our behalf.
543 presentation_properties->sharedImage = VK_TRUE;
544 } break;
545
546 default:
547 // Silently ignore other extension query structs
548 break;
549 }
550 }
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300551}
552
Jesse Hall606a54e2015-11-19 22:17:28 -0800553void GetPhysicalDeviceQueueFamilyProperties(
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700554 VkPhysicalDevice,
555 uint32_t* count,
556 VkQueueFamilyProperties* properties) {
Jesse Hall715b86a2016-01-16 16:34:29 -0800557 if (!properties || *count > 1)
558 *count = 1;
559 if (properties && *count == 1) {
Jesse Hall65ab5522015-11-30 00:07:16 -0800560 properties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT |
561 VK_QUEUE_TRANSFER_BIT;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700562 properties->queueCount = 1;
Jesse Hallacfa5342015-11-19 21:51:33 -0800563 properties->timestampValidBits = 64;
Jesse Hall715b86a2016-01-16 16:34:29 -0800564 properties->minImageTransferGranularity = VkExtent3D{1, 1, 1};
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700565 }
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700566}
567
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300568void GetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physical_device, uint32_t* count, VkQueueFamilyProperties2KHR* properties) {
569 // note: even though multiple structures, this is safe to forward in this
570 // case since we only expose one queue family.
571 GetPhysicalDeviceQueueFamilyProperties(physical_device, count, properties ? &properties->queueFamilyProperties : nullptr);
572}
573
Jesse Hall606a54e2015-11-19 22:17:28 -0800574void GetPhysicalDeviceMemoryProperties(
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100575 VkPhysicalDevice,
576 VkPhysicalDeviceMemoryProperties* properties) {
577 properties->memoryTypeCount = 1;
578 properties->memoryTypes[0].propertyFlags =
Jesse Halld1af8122015-11-29 23:50:38 -0800579 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
580 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
581 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
582 VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100583 properties->memoryTypes[0].heapIndex = 0;
584 properties->memoryHeapCount = 1;
Jesse Hallbde8ee32015-09-01 16:24:29 -0700585 properties->memoryHeaps[0].size = kMaxDeviceMemory;
Jesse Halld1af8122015-11-29 23:50:38 -0800586 properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
Jesse Hall04f4f472015-08-16 19:51:04 -0700587}
588
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300589void GetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceMemoryProperties2KHR* properties) {
590 GetPhysicalDeviceMemoryProperties(physical_device, &properties->memoryProperties);
591}
592
Jesse Hall8e37cf32016-01-18 04:00:57 -0800593void GetPhysicalDeviceFeatures(VkPhysicalDevice /*gpu*/,
594 VkPhysicalDeviceFeatures* features) {
595 *features = VkPhysicalDeviceFeatures{
596 VK_TRUE, // robustBufferAccess
597 VK_FALSE, // fullDrawIndexUint32
598 VK_FALSE, // imageCubeArray
599 VK_FALSE, // independentBlend
600 VK_FALSE, // geometryShader
601 VK_FALSE, // tessellationShader
602 VK_FALSE, // sampleRateShading
603 VK_FALSE, // dualSrcBlend
604 VK_FALSE, // logicOp
605 VK_FALSE, // multiDrawIndirect
606 VK_FALSE, // drawIndirectFirstInstance
607 VK_FALSE, // depthClamp
608 VK_FALSE, // depthBiasClamp
609 VK_FALSE, // fillModeNonSolid
610 VK_FALSE, // depthBounds
611 VK_FALSE, // wideLines
612 VK_FALSE, // largePoints
613 VK_FALSE, // alphaToOne
614 VK_FALSE, // multiViewport
615 VK_FALSE, // samplerAnisotropy
616 VK_FALSE, // textureCompressionETC2
617 VK_FALSE, // textureCompressionASTC_LDR
618 VK_FALSE, // textureCompressionBC
619 VK_FALSE, // occlusionQueryPrecise
620 VK_FALSE, // pipelineStatisticsQuery
621 VK_FALSE, // vertexPipelineStoresAndAtomics
622 VK_FALSE, // fragmentStoresAndAtomics
623 VK_FALSE, // shaderTessellationAndGeometryPointSize
624 VK_FALSE, // shaderImageGatherExtended
625 VK_FALSE, // shaderStorageImageExtendedFormats
626 VK_FALSE, // shaderStorageImageMultisample
627 VK_FALSE, // shaderStorageImageReadWithoutFormat
628 VK_FALSE, // shaderStorageImageWriteWithoutFormat
629 VK_FALSE, // shaderUniformBufferArrayDynamicIndexing
630 VK_FALSE, // shaderSampledImageArrayDynamicIndexing
631 VK_FALSE, // shaderStorageBufferArrayDynamicIndexing
632 VK_FALSE, // shaderStorageImageArrayDynamicIndexing
633 VK_FALSE, // shaderClipDistance
634 VK_FALSE, // shaderCullDistance
635 VK_FALSE, // shaderFloat64
636 VK_FALSE, // shaderInt64
637 VK_FALSE, // shaderInt16
638 VK_FALSE, // shaderResourceResidency
639 VK_FALSE, // shaderResourceMinLod
640 VK_FALSE, // sparseBinding
641 VK_FALSE, // sparseResidencyBuffer
642 VK_FALSE, // sparseResidencyImage2D
643 VK_FALSE, // sparseResidencyImage3D
644 VK_FALSE, // sparseResidency2Samples
645 VK_FALSE, // sparseResidency4Samples
646 VK_FALSE, // sparseResidency8Samples
647 VK_FALSE, // sparseResidency16Samples
648 VK_FALSE, // sparseResidencyAliased
649 VK_FALSE, // variableMultisampleRate
650 VK_FALSE, // inheritedQueries
651 };
652}
653
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300654void GetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceFeatures2KHR* features) {
655 GetPhysicalDeviceFeatures(physical_device, &features->features);
656}
657
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100658// -----------------------------------------------------------------------------
659// Device
660
Jesse Hall04f4f472015-08-16 19:51:04 -0700661VkResult CreateDevice(VkPhysicalDevice physical_device,
Jesse Hallb1471272016-01-17 21:36:58 -0800662 const VkDeviceCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800663 const VkAllocationCallbacks* allocator,
Jesse Hall04f4f472015-08-16 19:51:04 -0700664 VkDevice* out_device) {
665 VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800666 if (!allocator)
667 allocator = &instance->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800668 VkDevice_T* device = static_cast<VkDevice_T*>(allocator->pfnAllocation(
669 allocator->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T),
670 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE));
Jesse Hall04f4f472015-08-16 19:51:04 -0700671 if (!device)
672 return VK_ERROR_OUT_OF_HOST_MEMORY;
673
674 device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800675 device->allocator = *allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700676 device->instance = instance;
677 device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700678 std::fill(device->next_handle.begin(), device->next_handle.end(),
679 UINT64_C(0));
Jesse Hall04f4f472015-08-16 19:51:04 -0700680
Jesse Hallb1471272016-01-17 21:36:58 -0800681 for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
682 if (strcmp(create_info->ppEnabledExtensionNames[i],
683 VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME) == 0) {
684 ALOGV("Enabling " VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME);
685 }
686 }
687
Jesse Hall04f4f472015-08-16 19:51:04 -0700688 *out_device = device;
689 return VK_SUCCESS;
690}
691
Jesse Hall3fbc8562015-11-29 22:10:52 -0800692void DestroyDevice(VkDevice device,
693 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700694 if (!device)
Jesse Hallcf25c412015-10-29 17:14:50 -0700695 return;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800696 device->allocator.pfnFree(device->allocator.pUserData, device);
Jesse Hall04f4f472015-08-16 19:51:04 -0700697}
698
Jesse Hall606a54e2015-11-19 22:17:28 -0800699void GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700700 *queue = &device->queue;
Jesse Hall04f4f472015-08-16 19:51:04 -0700701}
702
703// -----------------------------------------------------------------------------
Jesse Hall3fbc8562015-11-29 22:10:52 -0800704// CommandPool
Jesse Hall03b6fe12015-11-24 12:44:21 -0800705
Jesse Hall3fbc8562015-11-29 22:10:52 -0800706struct CommandPool {
707 typedef VkCommandPool HandleType;
708 VkAllocationCallbacks allocator;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800709};
Jesse Hall3fbc8562015-11-29 22:10:52 -0800710DEFINE_OBJECT_HANDLE_CONVERSION(CommandPool)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800711
712VkResult CreateCommandPool(VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800713 const VkCommandPoolCreateInfo* /*create_info*/,
714 const VkAllocationCallbacks* allocator,
715 VkCommandPool* cmd_pool) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800716 if (!allocator)
717 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800718 CommandPool* pool = static_cast<CommandPool*>(allocator->pfnAllocation(
719 allocator->pUserData, sizeof(CommandPool), alignof(CommandPool),
720 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall03b6fe12015-11-24 12:44:21 -0800721 if (!pool)
722 return VK_ERROR_OUT_OF_HOST_MEMORY;
723 pool->allocator = *allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800724 *cmd_pool = GetHandleToCommandPool(pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800725 return VK_SUCCESS;
726}
727
728void DestroyCommandPool(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800729 VkCommandPool cmd_pool,
730 const VkAllocationCallbacks* /*allocator*/) {
731 CommandPool* pool = GetCommandPoolFromHandle(cmd_pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800732 pool->allocator.pfnFree(pool->allocator.pUserData, pool);
733}
734
735// -----------------------------------------------------------------------------
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700736// CmdBuffer
737
Jesse Hall3fbc8562015-11-29 22:10:52 -0800738VkResult AllocateCommandBuffers(VkDevice /*device*/,
739 const VkCommandBufferAllocateInfo* alloc_info,
740 VkCommandBuffer* cmdbufs) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800741 VkResult result = VK_SUCCESS;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800742 CommandPool& pool = *GetCommandPoolFromHandle(alloc_info->commandPool);
Jesse Hall3dd678a2016-01-08 21:52:01 -0800743 std::fill(cmdbufs, cmdbufs + alloc_info->commandBufferCount, nullptr);
744 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800745 cmdbufs[i] =
746 static_cast<VkCommandBuffer_T*>(pool.allocator.pfnAllocation(
747 pool.allocator.pUserData, sizeof(VkCommandBuffer_T),
748 alignof(VkCommandBuffer_T), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallfbf97b02015-11-20 14:17:03 -0800749 if (!cmdbufs[i]) {
750 result = VK_ERROR_OUT_OF_HOST_MEMORY;
751 break;
752 }
753 cmdbufs[i]->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
754 }
755 if (result != VK_SUCCESS) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800756 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800757 if (!cmdbufs[i])
758 break;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800759 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800760 }
761 }
Jesse Hallfbf97b02015-11-20 14:17:03 -0800762 return result;
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700763}
764
Jesse Hall03b6fe12015-11-24 12:44:21 -0800765void FreeCommandBuffers(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800766 VkCommandPool cmd_pool,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800767 uint32_t count,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800768 const VkCommandBuffer* cmdbufs) {
769 CommandPool& pool = *GetCommandPoolFromHandle(cmd_pool);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800770 for (uint32_t i = 0; i < count; i++)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800771 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700772}
773
774// -----------------------------------------------------------------------------
Jesse Hall2077ce02015-08-29 18:10:59 +0100775// DeviceMemory
776
777struct DeviceMemory {
778 typedef VkDeviceMemory HandleType;
779 VkDeviceSize size;
780 alignas(16) uint8_t data[0];
781};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800782DEFINE_OBJECT_HANDLE_CONVERSION(DeviceMemory)
Jesse Hall2077ce02015-08-29 18:10:59 +0100783
Jesse Hall3fbc8562015-11-29 22:10:52 -0800784VkResult AllocateMemory(VkDevice device,
785 const VkMemoryAllocateInfo* alloc_info,
786 const VkAllocationCallbacks* allocator,
787 VkDeviceMemory* mem_handle) {
Jesse Hall2077ce02015-08-29 18:10:59 +0100788 if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize)
789 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800790 if (!allocator)
791 allocator = &device->allocator;
Jesse Hall2077ce02015-08-29 18:10:59 +0100792
Jesse Hall2077ce02015-08-29 18:10:59 +0100793 size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize);
Jesse Hall3fbc8562015-11-29 22:10:52 -0800794 DeviceMemory* mem = static_cast<DeviceMemory*>(allocator->pfnAllocation(
795 allocator->pUserData, size, alignof(DeviceMemory),
796 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall2077ce02015-08-29 18:10:59 +0100797 if (!mem)
798 return VK_ERROR_OUT_OF_HOST_MEMORY;
799 mem->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800800 *mem_handle = GetHandleToDeviceMemory(mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100801 return VK_SUCCESS;
802}
803
Jesse Hall03b6fe12015-11-24 12:44:21 -0800804void FreeMemory(VkDevice device,
805 VkDeviceMemory mem_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800806 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800807 if (!allocator)
808 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800809 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800810 allocator->pfnFree(allocator->pUserData, mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100811}
812
813VkResult MapMemory(VkDevice,
814 VkDeviceMemory mem_handle,
815 VkDeviceSize offset,
816 VkDeviceSize,
817 VkMemoryMapFlags,
818 void** out_ptr) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800819 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall2077ce02015-08-29 18:10:59 +0100820 *out_ptr = &mem->data[0] + offset;
821 return VK_SUCCESS;
822}
823
824// -----------------------------------------------------------------------------
Jesse Hallf6578742015-08-29 17:06:12 +0100825// Buffer
826
827struct Buffer {
828 typedef VkBuffer HandleType;
829 VkDeviceSize size;
830};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800831DEFINE_OBJECT_HANDLE_CONVERSION(Buffer)
Jesse Hallf6578742015-08-29 17:06:12 +0100832
833VkResult CreateBuffer(VkDevice device,
834 const VkBufferCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800835 const VkAllocationCallbacks* allocator,
Jesse Hallf6578742015-08-29 17:06:12 +0100836 VkBuffer* buffer_handle) {
Jesse Hallbde8ee32015-09-01 16:24:29 -0700837 ALOGW_IF(create_info->size > kMaxDeviceMemory,
838 "CreateBuffer: requested size 0x%" PRIx64
839 " exceeds max device memory size 0x%" PRIx64,
840 create_info->size, kMaxDeviceMemory);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800841 if (!allocator)
842 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800843 Buffer* buffer = static_cast<Buffer*>(allocator->pfnAllocation(
844 allocator->pUserData, sizeof(Buffer), alignof(Buffer),
845 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallf6578742015-08-29 17:06:12 +0100846 if (!buffer)
847 return VK_ERROR_OUT_OF_HOST_MEMORY;
848 buffer->size = create_info->size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800849 *buffer_handle = GetHandleToBuffer(buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100850 return VK_SUCCESS;
851}
852
Jesse Hall606a54e2015-11-19 22:17:28 -0800853void GetBufferMemoryRequirements(VkDevice,
854 VkBuffer buffer_handle,
855 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800856 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hallf6578742015-08-29 17:06:12 +0100857 requirements->size = buffer->size;
858 requirements->alignment = 16; // allow fast Neon/SSE memcpy
859 requirements->memoryTypeBits = 0x1;
Jesse Hallf6578742015-08-29 17:06:12 +0100860}
861
Jesse Hall03b6fe12015-11-24 12:44:21 -0800862void DestroyBuffer(VkDevice device,
863 VkBuffer buffer_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800864 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800865 if (!allocator)
866 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800867 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800868 allocator->pfnFree(allocator->pUserData, buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100869}
870
871// -----------------------------------------------------------------------------
Jesse Hall85c05b62015-09-01 18:07:41 -0700872// Image
873
874struct Image {
875 typedef VkImage HandleType;
876 VkDeviceSize size;
877};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800878DEFINE_OBJECT_HANDLE_CONVERSION(Image)
Jesse Hall85c05b62015-09-01 18:07:41 -0700879
880VkResult CreateImage(VkDevice device,
881 const VkImageCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800882 const VkAllocationCallbacks* allocator,
Jesse Hall85c05b62015-09-01 18:07:41 -0700883 VkImage* image_handle) {
884 if (create_info->imageType != VK_IMAGE_TYPE_2D ||
885 create_info->format != VK_FORMAT_R8G8B8A8_UNORM ||
886 create_info->mipLevels != 1) {
887 ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u",
888 create_info->imageType, create_info->format,
889 create_info->mipLevels);
Jesse Halla15a4bf2015-11-19 22:48:02 -0800890 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall85c05b62015-09-01 18:07:41 -0700891 }
892
893 VkDeviceSize size =
894 VkDeviceSize(create_info->extent.width * create_info->extent.height) *
Jesse Halla15a4bf2015-11-19 22:48:02 -0800895 create_info->arrayLayers * create_info->samples * 4u;
Jesse Hall85c05b62015-09-01 18:07:41 -0700896 ALOGW_IF(size > kMaxDeviceMemory,
897 "CreateImage: image size 0x%" PRIx64
898 " exceeds max device memory size 0x%" PRIx64,
899 size, kMaxDeviceMemory);
900
Jesse Hall03b6fe12015-11-24 12:44:21 -0800901 if (!allocator)
902 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800903 Image* image = static_cast<Image*>(allocator->pfnAllocation(
904 allocator->pUserData, sizeof(Image), alignof(Image),
905 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall85c05b62015-09-01 18:07:41 -0700906 if (!image)
907 return VK_ERROR_OUT_OF_HOST_MEMORY;
908 image->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800909 *image_handle = GetHandleToImage(image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700910 return VK_SUCCESS;
911}
912
Jesse Hall606a54e2015-11-19 22:17:28 -0800913void GetImageMemoryRequirements(VkDevice,
914 VkImage image_handle,
915 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800916 Image* image = GetImageFromHandle(image_handle);
Jesse Hall85c05b62015-09-01 18:07:41 -0700917 requirements->size = image->size;
918 requirements->alignment = 16; // allow fast Neon/SSE memcpy
919 requirements->memoryTypeBits = 0x1;
Jesse Hall85c05b62015-09-01 18:07:41 -0700920}
921
Jesse Hall03b6fe12015-11-24 12:44:21 -0800922void DestroyImage(VkDevice device,
923 VkImage image_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800924 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800925 if (!allocator)
926 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800927 Image* image = GetImageFromHandle(image_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800928 allocator->pfnFree(allocator->pUserData, image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700929}
930
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800931VkResult GetSwapchainGrallocUsageANDROID(VkDevice,
932 VkFormat,
933 VkImageUsageFlags,
934 int* grallocUsage) {
935 // The null driver never reads or writes the gralloc buffer
936 *grallocUsage = 0;
937 return VK_SUCCESS;
938}
939
Chris Forbes8e4438b2016-12-07 16:26:49 +1300940VkResult GetSwapchainGrallocUsage2ANDROID(VkDevice,
941 VkFormat,
942 VkImageUsageFlags,
943 VkSwapchainImageUsageFlagsANDROID,
Jesse Halld1abd742017-02-09 21:45:51 -0800944 uint64_t* grallocConsumerUsage,
945 uint64_t* grallocProducerUsage) {
Chris Forbes8e4438b2016-12-07 16:26:49 +1300946 // The null driver never reads or writes the gralloc buffer
Jesse Halld1abd742017-02-09 21:45:51 -0800947 *grallocConsumerUsage = 0;
948 *grallocProducerUsage = 0;
Chris Forbes8e4438b2016-12-07 16:26:49 +1300949 return VK_SUCCESS;
950}
951
Trevor David Black2cc44682022-03-09 00:31:38 +0000952VkResult GetSwapchainGrallocUsage3ANDROID(
953 VkDevice,
954 const VkGrallocUsageInfoANDROID* grallocUsageInfo,
955 uint64_t* grallocUsage) {
956 // The null driver never reads or writes the gralloc buffer
957 ALOGV("TODO: vk%s - grallocUsageInfo->format:%i", __FUNCTION__,
958 grallocUsageInfo->format);
959 *grallocUsage = 0;
960 return VK_SUCCESS;
961}
962
Trevor David Blackb6ca8422023-07-26 20:00:04 +0000963VkResult GetSwapchainGrallocUsage4ANDROID(
964 VkDevice,
965 const VkGrallocUsageInfo2ANDROID* grallocUsageInfo,
966 uint64_t* grallocUsage) {
967 // The null driver never reads or writes the gralloc buffer
968 ALOGV("TODO: vk%s - grallocUsageInfo->format:%i", __FUNCTION__,
969 grallocUsageInfo->format);
970 *grallocUsage = 0;
971 return VK_SUCCESS;
972}
973
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800974VkResult AcquireImageANDROID(VkDevice,
975 VkImage,
976 int fence,
977 VkSemaphore,
978 VkFence) {
979 close(fence);
980 return VK_SUCCESS;
981}
982
983VkResult QueueSignalReleaseImageANDROID(VkQueue,
984 uint32_t,
985 const VkSemaphore*,
986 VkImage,
987 int* fence) {
988 *fence = -1;
989 return VK_SUCCESS;
990}
991
Jesse Hall85c05b62015-09-01 18:07:41 -0700992// -----------------------------------------------------------------------------
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700993// No-op types
994
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700995VkResult CreateBufferView(VkDevice device,
996 const VkBufferViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800997 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700998 VkBufferView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800999 *view = AllocHandle<VkBufferView>(device, HandleType::kBufferView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001000 return VK_SUCCESS;
1001}
1002
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001003VkResult CreateDescriptorPool(VkDevice device,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001004 const VkDescriptorPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001005 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001006 VkDescriptorPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001007 *pool = AllocHandle<VkDescriptorPool>(device, HandleType::kDescriptorPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001008 return VK_SUCCESS;
1009}
1010
Jesse Hall3fbc8562015-11-29 22:10:52 -08001011VkResult AllocateDescriptorSets(VkDevice device,
1012 const VkDescriptorSetAllocateInfo* alloc_info,
1013 VkDescriptorSet* descriptor_sets) {
Jesse Hall3dd678a2016-01-08 21:52:01 -08001014 for (uint32_t i = 0; i < alloc_info->descriptorSetCount; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -08001015 descriptor_sets[i] =
1016 AllocHandle<VkDescriptorSet>(device, HandleType::kDescriptorSet);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001017 return VK_SUCCESS;
1018}
1019
1020VkResult CreateDescriptorSetLayout(VkDevice device,
1021 const VkDescriptorSetLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001022 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001023 VkDescriptorSetLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001024 *layout = AllocHandle<VkDescriptorSetLayout>(
1025 device, HandleType::kDescriptorSetLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001026 return VK_SUCCESS;
1027}
1028
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001029VkResult CreateEvent(VkDevice device,
1030 const VkEventCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001031 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001032 VkEvent* event) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001033 *event = AllocHandle<VkEvent>(device, HandleType::kEvent);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001034 return VK_SUCCESS;
1035}
1036
1037VkResult CreateFence(VkDevice device,
1038 const VkFenceCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001039 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001040 VkFence* fence) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001041 *fence = AllocHandle<VkFence>(device, HandleType::kFence);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001042 return VK_SUCCESS;
1043}
1044
1045VkResult CreateFramebuffer(VkDevice device,
1046 const VkFramebufferCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001047 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001048 VkFramebuffer* framebuffer) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001049 *framebuffer = AllocHandle<VkFramebuffer>(device, HandleType::kFramebuffer);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001050 return VK_SUCCESS;
1051}
1052
1053VkResult CreateImageView(VkDevice device,
1054 const VkImageViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001055 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001056 VkImageView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001057 *view = AllocHandle<VkImageView>(device, HandleType::kImageView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001058 return VK_SUCCESS;
1059}
1060
1061VkResult CreateGraphicsPipelines(VkDevice device,
1062 VkPipelineCache,
1063 uint32_t count,
1064 const VkGraphicsPipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001065 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001066 VkPipeline* pipelines) {
1067 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -08001068 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001069 return VK_SUCCESS;
1070}
1071
1072VkResult CreateComputePipelines(VkDevice device,
1073 VkPipelineCache,
1074 uint32_t count,
1075 const VkComputePipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001076 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001077 VkPipeline* pipelines) {
1078 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -08001079 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001080 return VK_SUCCESS;
1081}
1082
1083VkResult CreatePipelineCache(VkDevice device,
1084 const VkPipelineCacheCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001085 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001086 VkPipelineCache* cache) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001087 *cache = AllocHandle<VkPipelineCache>(device, HandleType::kPipelineCache);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001088 return VK_SUCCESS;
1089}
1090
1091VkResult CreatePipelineLayout(VkDevice device,
1092 const VkPipelineLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001093 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001094 VkPipelineLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001095 *layout =
1096 AllocHandle<VkPipelineLayout>(device, HandleType::kPipelineLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001097 return VK_SUCCESS;
1098}
1099
1100VkResult CreateQueryPool(VkDevice device,
1101 const VkQueryPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001102 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001103 VkQueryPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001104 *pool = AllocHandle<VkQueryPool>(device, HandleType::kQueryPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001105 return VK_SUCCESS;
1106}
1107
1108VkResult CreateRenderPass(VkDevice device,
1109 const VkRenderPassCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001110 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001111 VkRenderPass* renderpass) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001112 *renderpass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001113 return VK_SUCCESS;
1114}
1115
1116VkResult CreateSampler(VkDevice device,
1117 const VkSamplerCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001118 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001119 VkSampler* sampler) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001120 *sampler = AllocHandle<VkSampler>(device, HandleType::kSampler);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001121 return VK_SUCCESS;
1122}
1123
1124VkResult CreateSemaphore(VkDevice device,
1125 const VkSemaphoreCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001126 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001127 VkSemaphore* semaphore) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001128 *semaphore = AllocHandle<VkSemaphore>(device, HandleType::kSemaphore);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001129 return VK_SUCCESS;
1130}
1131
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001132VkResult CreateShaderModule(VkDevice device,
1133 const VkShaderModuleCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001134 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001135 VkShaderModule* module) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001136 *module = AllocHandle<VkShaderModule>(device, HandleType::kShaderModule);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001137 return VK_SUCCESS;
1138}
1139
Jesse Hall715b86a2016-01-16 16:34:29 -08001140VkResult CreateDebugReportCallbackEXT(VkInstance instance,
1141 const VkDebugReportCallbackCreateInfoEXT*,
1142 const VkAllocationCallbacks*,
1143 VkDebugReportCallbackEXT* callback) {
1144 *callback = AllocHandle<VkDebugReportCallbackEXT>(
1145 instance, HandleType::kDebugReportCallbackEXT);
1146 return VK_SUCCESS;
1147}
1148
Yiwei Zhang6be097b2020-10-19 20:22:05 -07001149VkResult CreateRenderPass2(VkDevice device,
1150 const VkRenderPassCreateInfo2*,
1151 const VkAllocationCallbacks* /*allocator*/,
1152 VkRenderPass* pRenderPass) {
1153 *pRenderPass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass);
1154 return VK_SUCCESS;
1155}
1156
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001157// -----------------------------------------------------------------------------
Jesse Hall04f4f472015-08-16 19:51:04 -07001158// No-op entrypoints
1159
1160// clang-format off
1161#pragma clang diagnostic push
1162#pragma clang diagnostic ignored "-Wunused-parameter"
1163
Jesse Hall606a54e2015-11-19 22:17:28 -08001164void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001165 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001166}
1167
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001168void GetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR* pFormatProperties) {
1169 ALOGV("TODO: vk%s", __FUNCTION__);
1170}
1171
Jesse Halla9e57032015-11-30 01:03:10 -08001172VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001173 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Halla9e57032015-11-30 01:03:10 -08001174 return VK_SUCCESS;
Jesse Hall04f4f472015-08-16 19:51:04 -07001175}
1176
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001177VkResult GetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1178 const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo,
1179 VkImageFormatProperties2KHR* pImageFormatProperties) {
1180 ALOGV("TODO: vk%s", __FUNCTION__);
1181 return VK_SUCCESS;
1182}
1183
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001184VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001185 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001186 return VK_SUCCESS;
1187}
1188
Jesse Halla366a512015-11-19 22:30:07 -08001189VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001190 return VK_SUCCESS;
1191}
1192
1193VkResult QueueWaitIdle(VkQueue queue) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001194 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001195 return VK_SUCCESS;
1196}
1197
1198VkResult DeviceWaitIdle(VkDevice device) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001199 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001200 return VK_SUCCESS;
1201}
1202
Jesse Hallcf25c412015-10-29 17:14:50 -07001203void UnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001204}
1205
1206VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001207 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001208 return VK_SUCCESS;
1209}
1210
1211VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001212 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001213 return VK_SUCCESS;
1214}
1215
Jesse Hall606a54e2015-11-19 22:17:28 -08001216void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001217 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001218}
1219
Jesse Hall04f4f472015-08-16 19:51:04 -07001220VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset) {
1221 return VK_SUCCESS;
1222}
1223
Jesse Hall04f4f472015-08-16 19:51:04 -07001224VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset) {
1225 return VK_SUCCESS;
1226}
1227
Jesse Hall606a54e2015-11-19 22:17:28 -08001228void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001229 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001230}
1231
Jesse Hall091ed9e2015-11-30 00:55:29 -08001232void GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pNumProperties, VkSparseImageFormatProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001233 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001234}
1235
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001236void GetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1237 VkPhysicalDeviceSparseImageFormatInfo2KHR const* pInfo,
1238 unsigned int* pNumProperties,
1239 VkSparseImageFormatProperties2KHR* pProperties) {
1240 ALOGV("TODO: vk%s", __FUNCTION__);
1241}
1242
1243
Jesse Halla6429252015-11-29 18:59:42 -08001244VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001245 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001246 return VK_SUCCESS;
1247}
1248
Jesse Hall3fbc8562015-11-29 22:10:52 -08001249void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001250}
1251
1252VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
1253 return VK_SUCCESS;
1254}
1255
1256VkResult GetFenceStatus(VkDevice device, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001257 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001258 return VK_SUCCESS;
1259}
1260
1261VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
1262 return VK_SUCCESS;
1263}
1264
Jesse Hall3fbc8562015-11-29 22:10:52 -08001265void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001266}
1267
Jesse Hall3fbc8562015-11-29 22:10:52 -08001268void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001269}
1270
1271VkResult GetEventStatus(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001272 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001273 return VK_SUCCESS;
1274}
1275
1276VkResult SetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001277 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001278 return VK_SUCCESS;
1279}
1280
1281VkResult ResetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001282 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001283 return VK_SUCCESS;
1284}
1285
Jesse Hall3fbc8562015-11-29 22:10:52 -08001286void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001287}
1288
Jesse Halla9bb62b2015-11-21 19:31:56 -08001289VkResult GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001290 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001291 return VK_SUCCESS;
1292}
1293
Jesse Hall3fbc8562015-11-29 22:10:52 -08001294void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001295}
1296
Jesse Hall606a54e2015-11-19 22:17:28 -08001297void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001298 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001299}
1300
Jesse Hall3fbc8562015-11-29 22:10:52 -08001301void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001302}
1303
Jesse Hall3fbc8562015-11-29 22:10:52 -08001304void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001305}
1306
Jesse Hall3fbc8562015-11-29 22:10:52 -08001307void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001308}
1309
Jesse Halla9bb62b2015-11-21 19:31:56 -08001310VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001311 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001312 return VK_SUCCESS;
1313}
1314
1315VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001316 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001317 return VK_SUCCESS;
1318}
1319
Jesse Hall3fbc8562015-11-29 22:10:52 -08001320void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001321}
1322
Jesse Hall3fbc8562015-11-29 22:10:52 -08001323void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001324}
1325
Jesse Hall3fbc8562015-11-29 22:10:52 -08001326void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001327}
1328
Jesse Hall3fbc8562015-11-29 22:10:52 -08001329void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001330}
1331
Jesse Hall3fbc8562015-11-29 22:10:52 -08001332void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001333}
1334
Jesse Hallfbf97b02015-11-20 14:17:03 -08001335VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001336 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001337 return VK_SUCCESS;
1338}
1339
Jesse Hallcf25c412015-10-29 17:14:50 -07001340void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001341 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001342}
1343
1344VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001345 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001346 return VK_SUCCESS;
1347}
1348
Jesse Hall3fbc8562015-11-29 22:10:52 -08001349void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001350}
1351
Jesse Hall3fbc8562015-11-29 22:10:52 -08001352void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001353}
1354
Jesse Hall606a54e2015-11-19 22:17:28 -08001355void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001356 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001357}
1358
Jesse Hall3fbc8562015-11-29 22:10:52 -08001359VkResult ResetCommandPool(VkDevice device, VkCommandPool cmdPool, VkCommandPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001360 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001361 return VK_SUCCESS;
1362}
1363
Jesse Hall3fbc8562015-11-29 22:10:52 -08001364VkResult BeginCommandBuffer(VkCommandBuffer cmdBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001365 return VK_SUCCESS;
1366}
1367
Jesse Hall3fbc8562015-11-29 22:10:52 -08001368VkResult EndCommandBuffer(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001369 return VK_SUCCESS;
1370}
1371
Jesse Hall3fbc8562015-11-29 22:10:52 -08001372VkResult ResetCommandBuffer(VkCommandBuffer cmdBuffer, VkCommandBufferResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001373 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001374 return VK_SUCCESS;
1375}
1376
Jesse Hall3fbc8562015-11-29 22:10:52 -08001377void CmdBindPipeline(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001378}
1379
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001380void CmdSetViewport(VkCommandBuffer cmdBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001381}
1382
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001383void CmdSetScissor(VkCommandBuffer cmdBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001384}
1385
Jesse Hall3fbc8562015-11-29 22:10:52 -08001386void CmdSetLineWidth(VkCommandBuffer cmdBuffer, float lineWidth) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001387}
1388
Jesse Hall3fbc8562015-11-29 22:10:52 -08001389void CmdSetDepthBias(VkCommandBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001390}
1391
Jesse Hall3fbc8562015-11-29 22:10:52 -08001392void CmdSetBlendConstants(VkCommandBuffer cmdBuffer, const float blendConst[4]) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001393}
1394
Jesse Hall3fbc8562015-11-29 22:10:52 -08001395void CmdSetDepthBounds(VkCommandBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001396}
1397
Jesse Hall3fbc8562015-11-29 22:10:52 -08001398void CmdSetStencilCompareMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001399}
1400
Jesse Hall3fbc8562015-11-29 22:10:52 -08001401void CmdSetStencilWriteMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001402}
1403
Jesse Hall3fbc8562015-11-29 22:10:52 -08001404void CmdSetStencilReference(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001405}
1406
Jesse Hall3fbc8562015-11-29 22:10:52 -08001407void CmdBindDescriptorSets(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001408}
1409
Jesse Hall3fbc8562015-11-29 22:10:52 -08001410void CmdBindIndexBuffer(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001411}
1412
Jesse Hall3fbc8562015-11-29 22:10:52 -08001413void CmdBindVertexBuffers(VkCommandBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001414}
1415
Jesse Hall3fbc8562015-11-29 22:10:52 -08001416void CmdDraw(VkCommandBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001417}
1418
Jesse Hall3fbc8562015-11-29 22:10:52 -08001419void CmdDrawIndexed(VkCommandBuffer cmdBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001420}
1421
Jesse Hall3fbc8562015-11-29 22:10:52 -08001422void CmdDrawIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001423}
1424
Jesse Hall3fbc8562015-11-29 22:10:52 -08001425void CmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001426}
1427
Jesse Hall3fbc8562015-11-29 22:10:52 -08001428void CmdDispatch(VkCommandBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001429}
1430
Jesse Hall3fbc8562015-11-29 22:10:52 -08001431void CmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001432}
1433
Jesse Hall3fbc8562015-11-29 22:10:52 -08001434void CmdCopyBuffer(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001435}
1436
Jesse Hall3fbc8562015-11-29 22:10:52 -08001437void CmdCopyImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001438}
1439
Jesse Hall3fbc8562015-11-29 22:10:52 -08001440void CmdBlitImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001441}
1442
Jesse Hall3fbc8562015-11-29 22:10:52 -08001443void CmdCopyBufferToImage(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001444}
1445
Jesse Hall3fbc8562015-11-29 22:10:52 -08001446void CmdCopyImageToBuffer(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001447}
1448
Jesse Hall56d386a2016-07-26 15:20:40 -07001449void CmdUpdateBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const void* pData) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001450}
1451
Jesse Hall3fbc8562015-11-29 22:10:52 -08001452void CmdFillBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001453}
1454
Jesse Hall3fbc8562015-11-29 22:10:52 -08001455void CmdClearColorImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001456}
1457
Jesse Hall3fbc8562015-11-29 22:10:52 -08001458void CmdClearDepthStencilImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001459}
1460
Jesse Hall3fbc8562015-11-29 22:10:52 -08001461void CmdClearAttachments(VkCommandBuffer cmdBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001462}
1463
Jesse Hall3fbc8562015-11-29 22:10:52 -08001464void CmdResolveImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001465}
1466
Jesse Hall3fbc8562015-11-29 22:10:52 -08001467void CmdSetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001468}
1469
Jesse Hall3fbc8562015-11-29 22:10:52 -08001470void CmdResetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001471}
1472
Jesse Hall3dd678a2016-01-08 21:52:01 -08001473void 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 Hall04f4f472015-08-16 19:51:04 -07001474}
1475
Jesse Hall3dd678a2016-01-08 21:52:01 -08001476void 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 Hall04f4f472015-08-16 19:51:04 -07001477}
1478
Jesse Hall3fbc8562015-11-29 22:10:52 -08001479void CmdBeginQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001480}
1481
Jesse Hall3fbc8562015-11-29 22:10:52 -08001482void CmdEndQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001483}
1484
Jesse Hall3fbc8562015-11-29 22:10:52 -08001485void CmdResetQueryPool(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001486}
1487
Jesse Hall3fbc8562015-11-29 22:10:52 -08001488void CmdWriteTimestamp(VkCommandBuffer cmdBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001489}
1490
Jesse Hall3fbc8562015-11-29 22:10:52 -08001491void CmdCopyQueryPoolResults(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize destStride, VkQueryResultFlags flags) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001492}
1493
Jesse Hall3fbc8562015-11-29 22:10:52 -08001494void CmdPushConstants(VkCommandBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001495}
1496
Jesse Hall65ab5522015-11-30 00:07:16 -08001497void CmdBeginRenderPass(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001498}
1499
Jesse Hall65ab5522015-11-30 00:07:16 -08001500void CmdNextSubpass(VkCommandBuffer cmdBuffer, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001501}
1502
Jesse Hall3fbc8562015-11-29 22:10:52 -08001503void CmdEndRenderPass(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001504}
1505
Jesse Hall3fbc8562015-11-29 22:10:52 -08001506void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001507}
1508
Jesse Hall715b86a2016-01-16 16:34:29 -08001509void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator) {
1510}
1511
1512void DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage) {
1513}
1514
Daniel Koch09f7bf92017-10-05 00:26:58 -04001515VkResult BindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos) {
1516 return VK_SUCCESS;
1517}
1518
1519VkResult BindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos) {
1520 return VK_SUCCESS;
1521}
1522
1523void GetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures) {
1524}
1525
1526void CmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask) {
1527}
1528
1529void CmdDispatchBase(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) {
1530}
1531
1532VkResult EnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties) {
1533 return VK_SUCCESS;
1534}
1535
1536void GetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) {
1537}
1538
1539void GetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) {
1540}
1541
1542void GetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) {
1543}
1544
1545void GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures) {
1546}
1547
1548void GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties) {
1549}
1550
1551void GetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties) {
1552}
1553
1554VkResult GetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties) {
1555 return VK_SUCCESS;
1556}
1557
1558void GetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties) {
1559}
1560
1561void GetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties) {
1562}
1563
1564void GetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties) {
1565}
1566
1567void TrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) {
1568}
1569
1570void GetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo, VkQueue* pQueue) {
1571}
1572
1573VkResult CreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion) {
1574 return VK_SUCCESS;
1575}
1576
1577void DestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator) {
1578}
1579
1580VkResult CreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate) {
1581 return VK_SUCCESS;
1582}
1583
1584void DestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator) {
1585}
1586
1587void UpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData) {
1588}
1589
1590void GetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) {
1591}
1592
1593void GetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties) {
1594}
1595
1596void GetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties) {
1597}
1598
1599void GetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport) {
1600}
1601
Yiwei Zhang6be097b2020-10-19 20:22:05 -07001602void ResetQueryPool(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) {
1603 ALOGV("TODO: vk%s", __FUNCTION__);
1604}
1605
1606void CmdBeginRenderPass2(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const VkSubpassBeginInfo* pSubpassBeginInfo) {
1607}
1608
1609void CmdNextSubpass2(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo* pSubpassBeginInfo, const VkSubpassEndInfo* pSubpassEndInfo) {
1610}
1611
1612void CmdEndRenderPass2(VkCommandBuffer commandBuffer, const VkSubpassEndInfo* pSubpassEndInfo) {
1613}
1614
1615VkResult GetSemaphoreCounterValue(VkDevice device, VkSemaphore semaphore, uint64_t* pValue) {
1616 ALOGV("TODO: vk%s", __FUNCTION__);
1617 return VK_SUCCESS;
1618}
1619
1620VkResult WaitSemaphores(VkDevice device, const VkSemaphoreWaitInfo* pWaitInfo, uint64_t timeout) {
1621 ALOGV("TODO: vk%s", __FUNCTION__);
1622 return VK_SUCCESS;
1623}
1624
1625VkResult SignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo* pSignalInfo) {
1626 ALOGV("TODO: vk%s", __FUNCTION__);
1627 return VK_SUCCESS;
1628}
1629
1630void CmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) {
1631}
1632
1633void CmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) {
1634}
1635
1636uint64_t GetBufferOpaqueCaptureAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo) {
1637 ALOGV("TODO: vk%s", __FUNCTION__);
1638 return 0;
1639}
1640
1641VkDeviceAddress GetBufferDeviceAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo) {
1642 ALOGV("TODO: vk%s", __FUNCTION__);
1643 return (VkDeviceAddress)0;
1644}
1645
1646uint64_t GetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo) {
1647 ALOGV("TODO: vk%s", __FUNCTION__);
1648 return 0;
1649}
1650
Trevor David Black6e76a612022-01-24 22:28:40 +00001651void CmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo) {
1652}
1653
1654void CmdEndRendering(VkCommandBuffer commandBuffer) {
1655}
1656
1657void CmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes, const VkDeviceSize* pStrides) {
1658}
1659
1660void CmdBlitImage2(VkCommandBuffer commandBuffer, const VkBlitImageInfo2* pBlitImageInfo) {
1661}
1662
1663void CmdCopyBuffer2(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2* pCopyBufferInfo) {
1664}
1665
1666void CmdCopyImage2(VkCommandBuffer commandBuffer, const VkCopyImageInfo2* pCopyImageInfo) {
1667}
1668
1669void CmdCopyBufferToImage2(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2* pCopyBufferToImageInfo) {
1670}
1671
1672void CmdCopyImageToBuffer2(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo) {
1673}
1674
1675void CmdPipelineBarrier2(VkCommandBuffer commandBuffer, const VkDependencyInfo* pDependencyInfo) {
1676}
1677
1678void CmdResetEvent2(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2 stageMask) {
1679}
1680
1681void CmdResolveImage2(VkCommandBuffer commandBuffer, const VkResolveImageInfo2* pResolveImageInfo) {
1682}
1683
1684void CmdSetCullMode(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode) {
1685}
1686
1687void CmdSetDepthBiasEnable(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable) {
1688}
1689
1690void CmdSetDepthBoundsTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable) {
1691}
1692
1693void CmdSetDepthCompareOp(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp) {
1694}
1695
1696void CmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable) {
1697}
1698
1699void CmdSetDepthWriteEnable(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable) {
1700}
1701
1702void CmdSetEvent2(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfo* pDependencyInfo) {
1703}
1704
1705void CmdSetFrontFace(VkCommandBuffer commandBuffer, VkFrontFace frontFace) {
1706}
1707
1708void CmdSetPrimitiveRestartEnable(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable) {
1709}
1710
1711void CmdSetPrimitiveTopology(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology) {
1712}
1713
1714void CmdSetRasterizerDiscardEnable(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable) {
1715}
1716
1717void CmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors) {
1718}
1719
1720void CmdSetStencilOp(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp) {
1721}
1722
1723void CmdSetStencilTestEnable(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable) {
1724}
1725
1726void CmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports) {
1727}
1728
1729void CmdWaitEvents2(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, const VkDependencyInfo* pDependencyInfos) {
1730}
1731
1732void CmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query) {
1733}
1734
1735VkResult CreatePrivateDataSlot(VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot) {
1736 ALOGV("TODO: vk%s", __FUNCTION__);
1737 return VK_SUCCESS;
1738}
1739
1740void DestroyPrivateDataSlot(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator) {
1741}
1742
1743void GetDeviceBufferMemoryRequirements(VkDevice device, const VkDeviceBufferMemoryRequirements* pInfo, VkMemoryRequirements2* pMemoryRequirements) {
1744}
1745
1746void GetDeviceImageMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, VkMemoryRequirements2* pMemoryRequirements) {
1747}
1748
1749void GetDeviceImageSparseMemoryRequirements(VkDevice device, const VkDeviceImageMemoryRequirements* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) {
1750}
1751
1752VkResult GetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolProperties* pToolProperties) {
1753 ALOGV("TODO: vk%s", __FUNCTION__);
1754 return VK_SUCCESS;
1755}
1756
1757void GetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData) {
1758}
1759
1760VkResult QueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2* pSubmits, VkFence fence) {
1761 ALOGV("TODO: vk%s", __FUNCTION__);
1762 return VK_SUCCESS;
1763}
1764
1765VkResult SetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data) {
1766 ALOGV("TODO: vk%s", __FUNCTION__);
1767 return VK_SUCCESS;
1768}
1769
Jesse Hall04f4f472015-08-16 19:51:04 -07001770#pragma clang diagnostic pop
1771// clang-format on
1772
1773} // namespace null_driver