blob: 4647a80e91138219753f26349959c7484eb055d9 [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
Jesse Hall04f4f472015-08-16 19:51:04 -070017#include <hardware/hwvulkan.h>
18
Dan Albert09dc47b2017-10-12 13:27:37 -070019#include <errno.h>
Jesse Hall715b86a2016-01-16 16:34:29 -080020#include <inttypes.h>
Jesse Halld3b14502016-04-20 16:58:11 -070021#include <stdlib.h>
Jesse Hall715b86a2016-01-16 16:34:29 -080022#include <string.h>
Steven Moreland54409a32017-07-17 11:49:21 -070023#include <unistd.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070024
Mark Salyzyna5e161b2016-09-29 08:08:05 -070025#include <algorithm>
26#include <array>
27
Mark Salyzyn7823e122016-09-29 08:08:05 -070028#include <log/log.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070029
Jesse Hall1f91d392015-12-11 16:28:44 -080030#include "null_driver_gen.h"
Jesse Hall04f4f472015-08-16 19:51:04 -070031
32using namespace null_driver;
33
34struct VkPhysicalDevice_T {
35 hwvulkan_dispatch_t dispatch;
36};
37
38struct VkInstance_T {
39 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -080040 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -070041 VkPhysicalDevice_T physical_device;
Jesse Hall715b86a2016-01-16 16:34:29 -080042 uint64_t next_callback_handle;
Jesse Hall04f4f472015-08-16 19:51:04 -070043};
44
45struct VkQueue_T {
46 hwvulkan_dispatch_t dispatch;
47};
48
Jesse Hall3fbc8562015-11-29 22:10:52 -080049struct VkCommandBuffer_T {
Jesse Hall04f4f472015-08-16 19:51:04 -070050 hwvulkan_dispatch_t dispatch;
51};
52
Jesse Hallf8faf0c2015-08-31 11:34:32 -070053namespace {
54// Handles for non-dispatchable objects are either pointers, or arbitrary
55// 64-bit non-zero values. We only use pointers when we need to keep state for
56// the object even in a null driver. For the rest, we form a handle as:
57// [63:63] = 1 to distinguish from pointer handles*
58// [62:56] = non-zero handle type enum value
59// [55: 0] = per-handle-type incrementing counter
60// * This works because virtual addresses with the high bit set are reserved
61// for kernel data in all ABIs we run on.
62//
63// We never reclaim handles on vkDestroy*. It's not even necessary for us to
64// have distinct handles for live objects, and practically speaking we won't
65// ever create 2^56 objects of the same type from a single VkDevice in a null
66// driver.
67//
68// Using a namespace here instead of 'enum class' since we want scoped
69// constants but also want implicit conversions to integral types.
70namespace HandleType {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070071enum Enum {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070072 kBufferView,
Jesse Hall715b86a2016-01-16 16:34:29 -080073 kDebugReportCallbackEXT,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070074 kDescriptorPool,
75 kDescriptorSet,
76 kDescriptorSetLayout,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070077 kEvent,
78 kFence,
79 kFramebuffer,
80 kImageView,
81 kPipeline,
82 kPipelineCache,
83 kPipelineLayout,
84 kQueryPool,
85 kRenderPass,
86 kSampler,
87 kSemaphore,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070088 kShaderModule,
Jesse Hallf8faf0c2015-08-31 11:34:32 -070089
Jesse Hallc7a6eb52015-08-31 12:52:03 -070090 kNumTypes
91};
92} // namespace HandleType
Jesse Hallbde8ee32015-09-01 16:24:29 -070093
Jesse Hall00f10fe2016-02-08 21:20:20 -080094const VkDeviceSize kMaxDeviceMemory = 0x10000000; // 256 MiB, arbitrary
Jesse Hallbde8ee32015-09-01 16:24:29 -070095
Jesse Hallc7a6eb52015-08-31 12:52:03 -070096} // anonymous namespace
Jesse Hallf8faf0c2015-08-31 11:34:32 -070097
Jesse Hall04f4f472015-08-16 19:51:04 -070098struct VkDevice_T {
99 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800100 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700101 VkInstance_T* instance;
102 VkQueue_T queue;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700103 std::array<uint64_t, HandleType::kNumTypes> next_handle;
Jesse Hall04f4f472015-08-16 19:51:04 -0700104};
105
106// -----------------------------------------------------------------------------
107// Declare HAL_MODULE_INFO_SYM early so it can be referenced by nulldrv_device
108// later.
109
110namespace {
111int OpenDevice(const hw_module_t* module, const char* id, hw_device_t** device);
112hw_module_methods_t nulldrv_module_methods = {.open = OpenDevice};
113} // namespace
114
115#pragma clang diagnostic push
116#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
117__attribute__((visibility("default"))) hwvulkan_module_t HAL_MODULE_INFO_SYM = {
118 .common =
119 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500120 .tag = HARDWARE_MODULE_TAG,
121 .module_api_version = HWVULKAN_MODULE_API_VERSION_0_1,
122 .hal_api_version = HARDWARE_HAL_API_VERSION,
123 .id = HWVULKAN_HARDWARE_MODULE_ID,
124 .name = "Null Vulkan Driver",
125 .author = "The Android Open Source Project",
126 .methods = &nulldrv_module_methods,
Jesse Hall04f4f472015-08-16 19:51:04 -0700127 },
128};
129#pragma clang diagnostic pop
130
131// -----------------------------------------------------------------------------
132
133namespace {
134
Jesse Hall04f4f472015-08-16 19:51:04 -0700135int CloseDevice(struct hw_device_t* /*device*/) {
136 // nothing to do - opening a device doesn't allocate any resources
137 return 0;
138}
139
140hwvulkan_device_t nulldrv_device = {
141 .common =
142 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500143 .tag = HARDWARE_DEVICE_TAG,
144 .version = HWVULKAN_DEVICE_API_VERSION_0_1,
145 .module = &HAL_MODULE_INFO_SYM.common,
146 .close = CloseDevice,
Jesse Hall04f4f472015-08-16 19:51:04 -0700147 },
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700148 .EnumerateInstanceExtensionProperties =
149 EnumerateInstanceExtensionProperties,
Jesse Hall04f4f472015-08-16 19:51:04 -0700150 .CreateInstance = CreateInstance,
151 .GetInstanceProcAddr = GetInstanceProcAddr};
152
153int OpenDevice(const hw_module_t* /*module*/,
154 const char* id,
155 hw_device_t** device) {
156 if (strcmp(id, HWVULKAN_DEVICE_0) == 0) {
157 *device = &nulldrv_device.common;
158 return 0;
159 }
160 return -ENOENT;
161}
162
163VkInstance_T* GetInstanceFromPhysicalDevice(
164 VkPhysicalDevice_T* physical_device) {
165 return reinterpret_cast<VkInstance_T*>(
166 reinterpret_cast<uintptr_t>(physical_device) -
167 offsetof(VkInstance_T, physical_device));
168}
169
Jesse Hall715b86a2016-01-16 16:34:29 -0800170uint64_t AllocHandle(uint64_t type, uint64_t* next_handle) {
171 const uint64_t kHandleMask = (UINT64_C(1) << 56) - 1;
172 ALOGE_IF(*next_handle == kHandleMask,
173 "non-dispatchable handles of type=%" PRIu64
174 " are about to overflow",
175 type);
176 return (UINT64_C(1) << 63) | ((type & 0x7) << 56) |
177 ((*next_handle)++ & kHandleMask);
178}
179
180template <class Handle>
181Handle AllocHandle(VkInstance instance, HandleType::Enum type) {
182 return reinterpret_cast<Handle>(
183 AllocHandle(type, &instance->next_callback_handle));
184}
185
Michael Lentine3fec89e2015-12-04 16:25:11 -0800186template <class Handle>
187Handle AllocHandle(VkDevice device, HandleType::Enum type) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800188 return reinterpret_cast<Handle>(
Jesse Hall715b86a2016-01-16 16:34:29 -0800189 AllocHandle(type, &device->next_handle[type]));
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700190}
191
Jesse Halld3b14502016-04-20 16:58:11 -0700192VKAPI_ATTR void* DefaultAllocate(void*,
193 size_t size,
194 size_t alignment,
195 VkSystemAllocationScope) {
196 void* ptr = nullptr;
197 // Vulkan requires 'alignment' to be a power of two, but posix_memalign
198 // additionally requires that it be at least sizeof(void*).
199 int ret = posix_memalign(&ptr, std::max(alignment, sizeof(void*)), size);
200 return ret == 0 ? ptr : nullptr;
201}
202
203VKAPI_ATTR void* DefaultReallocate(void*,
204 void* ptr,
205 size_t size,
206 size_t alignment,
207 VkSystemAllocationScope) {
208 if (size == 0) {
209 free(ptr);
210 return nullptr;
211 }
212
213 // TODO(jessehall): Right now we never shrink allocations; if the new
214 // request is smaller than the existing chunk, we just continue using it.
215 // The null driver never reallocs, so this doesn't matter. If that changes,
216 // or if this code is copied into some other project, this should probably
217 // have a heuristic to allocate-copy-free when doing so will save "enough"
218 // space.
219 size_t old_size = ptr ? malloc_usable_size(ptr) : 0;
220 if (size <= old_size)
221 return ptr;
222
223 void* new_ptr = nullptr;
224 if (posix_memalign(&new_ptr, std::max(alignment, sizeof(void*)), size) != 0)
225 return nullptr;
226 if (ptr) {
227 memcpy(new_ptr, ptr, std::min(old_size, size));
228 free(ptr);
229 }
230 return new_ptr;
231}
232
233VKAPI_ATTR void DefaultFree(void*, void* ptr) {
234 free(ptr);
235}
236
237const VkAllocationCallbacks kDefaultAllocCallbacks = {
238 .pUserData = nullptr,
239 .pfnAllocation = DefaultAllocate,
240 .pfnReallocation = DefaultReallocate,
241 .pfnFree = DefaultFree,
242};
243
Jesse Hall04f4f472015-08-16 19:51:04 -0700244} // namespace
245
246namespace null_driver {
247
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800248#define DEFINE_OBJECT_HANDLE_CONVERSION(T) \
249 T* Get##T##FromHandle(Vk##T h); \
250 T* Get##T##FromHandle(Vk##T h) { \
251 return reinterpret_cast<T*>(uintptr_t(h)); \
252 } \
253 Vk##T GetHandleTo##T(const T* obj); \
254 Vk##T GetHandleTo##T(const T* obj) { \
255 return Vk##T(reinterpret_cast<uintptr_t>(obj)); \
256 }
Jesse Hallf6578742015-08-29 17:06:12 +0100257
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100258// -----------------------------------------------------------------------------
259// Global
260
Jesse Halle1b12782015-11-30 11:27:32 -0800261VKAPI_ATTR
Daniel Kochf25f5bb2017-10-05 00:26:58 -0400262VkResult EnumerateInstanceVersion(uint32_t* pApiVersion) {
263 *pApiVersion = VK_API_VERSION_1_1;
264 return VK_SUCCESS;
265}
266
267VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800268VkResult EnumerateInstanceExtensionProperties(
269 const char* layer_name,
270 uint32_t* count,
271 VkExtensionProperties* properties) {
272 if (layer_name) {
273 ALOGW(
274 "Driver vkEnumerateInstanceExtensionProperties shouldn't be called "
275 "with a layer name ('%s')",
276 layer_name);
Jesse Hall715b86a2016-01-16 16:34:29 -0800277 }
278
279 const VkExtensionProperties kExtensions[] = {
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300280 {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 -0800281 const uint32_t kExtensionsCount =
282 sizeof(kExtensions) / sizeof(kExtensions[0]);
283
284 if (!properties || *count > kExtensionsCount)
285 *count = kExtensionsCount;
286 if (properties)
287 std::copy(kExtensions, kExtensions + *count, properties);
288 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100289}
290
Jesse Halle1b12782015-11-30 11:27:32 -0800291VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800292VkResult CreateInstance(const VkInstanceCreateInfo* create_info,
Jesse Hall1f91d392015-12-11 16:28:44 -0800293 const VkAllocationCallbacks* allocator,
294 VkInstance* out_instance) {
Jesse Halld3b14502016-04-20 16:58:11 -0700295 if (!allocator)
296 allocator = &kDefaultAllocCallbacks;
Jesse Hall1f91d392015-12-11 16:28:44 -0800297
298 VkInstance_T* instance =
299 static_cast<VkInstance_T*>(allocator->pfnAllocation(
300 allocator->pUserData, sizeof(VkInstance_T), alignof(VkInstance_T),
301 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE));
302 if (!instance)
303 return VK_ERROR_OUT_OF_HOST_MEMORY;
304
305 instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
306 instance->allocator = *allocator;
307 instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall715b86a2016-01-16 16:34:29 -0800308 instance->next_callback_handle = 0;
Jesse Hall715b86a2016-01-16 16:34:29 -0800309
310 for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
311 if (strcmp(create_info->ppEnabledExtensionNames[i],
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300312 VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME) == 0) {
313 ALOGV("instance extension '%s' requested",
314 create_info->ppEnabledExtensionNames[i]);
315 } else if (strcmp(create_info->ppEnabledExtensionNames[i],
Jesse Hall715b86a2016-01-16 16:34:29 -0800316 VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) {
Jesse Hallb1471272016-01-17 21:36:58 -0800317 ALOGV("instance extension '%s' requested",
318 create_info->ppEnabledExtensionNames[i]);
319 } else {
320 ALOGW("unsupported extension '%s' requested",
321 create_info->ppEnabledExtensionNames[i]);
Jesse Hall715b86a2016-01-16 16:34:29 -0800322 }
323 }
Jesse Hall1f91d392015-12-11 16:28:44 -0800324
325 *out_instance = instance;
326 return VK_SUCCESS;
327}
328
329VKAPI_ATTR
330PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name) {
331 return instance ? GetInstanceProcAddr(name) : GetGlobalProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700332}
333
Jesse Halle1b12782015-11-30 11:27:32 -0800334VKAPI_ATTR
Jesse Hall04f4f472015-08-16 19:51:04 -0700335PFN_vkVoidFunction GetDeviceProcAddr(VkDevice, const char* name) {
Jesse Hall1f91d392015-12-11 16:28:44 -0800336 return GetInstanceProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700337}
338
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100339// -----------------------------------------------------------------------------
340// Instance
341
Jesse Hall03b6fe12015-11-24 12:44:21 -0800342void DestroyInstance(VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800343 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800344 instance->allocator.pfnFree(instance->allocator.pUserData, instance);
Jesse Hall04f4f472015-08-16 19:51:04 -0700345}
346
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100347// -----------------------------------------------------------------------------
348// PhysicalDevice
349
Jesse Hall04f4f472015-08-16 19:51:04 -0700350VkResult EnumeratePhysicalDevices(VkInstance instance,
351 uint32_t* physical_device_count,
352 VkPhysicalDevice* physical_devices) {
Ian Elliott3fe21f62017-10-20 10:41:01 -0600353 if (!physical_devices)
354 *physical_device_count = 1;
355 else if (*physical_device_count == 0)
356 return VK_INCOMPLETE;
357 else {
Jesse Hall04f4f472015-08-16 19:51:04 -0700358 physical_devices[0] = &instance->physical_device;
Ian Elliott3fe21f62017-10-20 10:41:01 -0600359 *physical_device_count = 1;
360 }
Jesse Hall04f4f472015-08-16 19:51:04 -0700361 return VK_SUCCESS;
362}
363
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800364VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice /*gpu*/,
365 uint32_t* count,
366 VkLayerProperties* /*properties*/) {
367 ALOGW("Driver vkEnumerateDeviceLayerProperties shouldn't be called");
368 *count = 0;
369 return VK_SUCCESS;
370}
371
372VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice /*gpu*/,
373 const char* layer_name,
374 uint32_t* count,
375 VkExtensionProperties* properties) {
376 if (layer_name) {
377 ALOGW(
378 "Driver vkEnumerateDeviceExtensionProperties shouldn't be called "
379 "with a layer name ('%s')",
380 layer_name);
381 *count = 0;
382 return VK_SUCCESS;
383 }
384
385 const VkExtensionProperties kExtensions[] = {
386 {VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME,
387 VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION}};
388 const uint32_t kExtensionsCount =
389 sizeof(kExtensions) / sizeof(kExtensions[0]);
390
391 if (!properties || *count > kExtensionsCount)
392 *count = kExtensionsCount;
393 if (properties)
394 std::copy(kExtensions, kExtensions + *count, properties);
395 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
396}
397
Jesse Hall606a54e2015-11-19 22:17:28 -0800398void GetPhysicalDeviceProperties(VkPhysicalDevice,
399 VkPhysicalDeviceProperties* properties) {
Jesse Hall26763382016-05-20 07:13:52 -0700400 properties->apiVersion = VK_MAKE_VERSION(1, 0, VK_HEADER_VERSION);
Jesse Hall04f4f472015-08-16 19:51:04 -0700401 properties->driverVersion = VK_MAKE_VERSION(0, 0, 1);
Jesse Hall65ab5522015-11-30 00:07:16 -0800402 properties->vendorID = 0;
403 properties->deviceID = 0;
Jesse Hall04f4f472015-08-16 19:51:04 -0700404 properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
405 strcpy(properties->deviceName, "Android Vulkan Null Driver");
406 memset(properties->pipelineCacheUUID, 0,
407 sizeof(properties->pipelineCacheUUID));
Jesse Hallc34849e2016-02-09 22:35:04 -0800408 properties->limits = VkPhysicalDeviceLimits{
409 4096, // maxImageDimension1D
410 4096, // maxImageDimension2D
411 256, // maxImageDimension3D
412 4096, // maxImageDimensionCube
413 256, // maxImageArrayLayers
414 65536, // maxTexelBufferElements
415 16384, // maxUniformBufferRange
416 1 << 27, // maxStorageBufferRange
417 128, // maxPushConstantsSize
418 4096, // maxMemoryAllocationCount
419 4000, // maxSamplerAllocationCount
420 1, // bufferImageGranularity
421 0, // sparseAddressSpaceSize
422 4, // maxBoundDescriptorSets
423 16, // maxPerStageDescriptorSamplers
424 12, // maxPerStageDescriptorUniformBuffers
425 4, // maxPerStageDescriptorStorageBuffers
426 16, // maxPerStageDescriptorSampledImages
427 4, // maxPerStageDescriptorStorageImages
428 4, // maxPerStageDescriptorInputAttachments
429 128, // maxPerStageResources
430 96, // maxDescriptorSetSamplers
431 72, // maxDescriptorSetUniformBuffers
432 8, // maxDescriptorSetUniformBuffersDynamic
433 24, // maxDescriptorSetStorageBuffers
434 4, // maxDescriptorSetStorageBuffersDynamic
435 96, // maxDescriptorSetSampledImages
436 24, // maxDescriptorSetStorageImages
437 4, // maxDescriptorSetInputAttachments
438 16, // maxVertexInputAttributes
439 16, // maxVertexInputBindings
440 2047, // maxVertexInputAttributeOffset
441 2048, // maxVertexInputBindingStride
442 64, // maxVertexOutputComponents
443 0, // maxTessellationGenerationLevel
444 0, // maxTessellationPatchSize
445 0, // maxTessellationControlPerVertexInputComponents
446 0, // maxTessellationControlPerVertexOutputComponents
447 0, // maxTessellationControlPerPatchOutputComponents
448 0, // maxTessellationControlTotalOutputComponents
449 0, // maxTessellationEvaluationInputComponents
450 0, // maxTessellationEvaluationOutputComponents
451 0, // maxGeometryShaderInvocations
452 0, // maxGeometryInputComponents
453 0, // maxGeometryOutputComponents
454 0, // maxGeometryOutputVertices
455 0, // maxGeometryTotalOutputComponents
456 64, // maxFragmentInputComponents
457 4, // maxFragmentOutputAttachments
458 0, // maxFragmentDualSrcAttachments
459 4, // maxFragmentCombinedOutputResources
460 16384, // maxComputeSharedMemorySize
461 {65536, 65536, 65536}, // maxComputeWorkGroupCount[3]
462 128, // maxComputeWorkGroupInvocations
463 {128, 128, 64}, // maxComputeWorkGroupSize[3]
464 4, // subPixelPrecisionBits
465 4, // subTexelPrecisionBits
466 4, // mipmapPrecisionBits
467 UINT32_MAX, // maxDrawIndexedIndexValue
468 1, // maxDrawIndirectCount
469 2, // maxSamplerLodBias
470 1, // maxSamplerAnisotropy
471 1, // maxViewports
472 {4096, 4096}, // maxViewportDimensions[2]
473 {-8192.0f, 8191.0f}, // viewportBoundsRange[2]
474 0, // viewportSubPixelBits
475 64, // minMemoryMapAlignment
476 256, // minTexelBufferOffsetAlignment
477 256, // minUniformBufferOffsetAlignment
478 256, // minStorageBufferOffsetAlignment
479 -8, // minTexelOffset
480 7, // maxTexelOffset
481 0, // minTexelGatherOffset
482 0, // maxTexelGatherOffset
483 0.0f, // minInterpolationOffset
484 0.0f, // maxInterpolationOffset
485 0, // subPixelInterpolationOffsetBits
486 4096, // maxFramebufferWidth
487 4096, // maxFramebufferHeight
488 256, // maxFramebufferLayers
489 VK_SAMPLE_COUNT_1_BIT |
490 VK_SAMPLE_COUNT_4_BIT, // framebufferColorSampleCounts
491 VK_SAMPLE_COUNT_1_BIT |
492 VK_SAMPLE_COUNT_4_BIT, // framebufferDepthSampleCounts
493 VK_SAMPLE_COUNT_1_BIT |
494 VK_SAMPLE_COUNT_4_BIT, // framebufferStencilSampleCounts
495 VK_SAMPLE_COUNT_1_BIT |
496 VK_SAMPLE_COUNT_4_BIT, // framebufferNoAttachmentsSampleCounts
497 4, // maxColorAttachments
498 VK_SAMPLE_COUNT_1_BIT |
499 VK_SAMPLE_COUNT_4_BIT, // sampledImageColorSampleCounts
500 VK_SAMPLE_COUNT_1_BIT, // sampledImageIntegerSampleCounts
501 VK_SAMPLE_COUNT_1_BIT |
502 VK_SAMPLE_COUNT_4_BIT, // sampledImageDepthSampleCounts
503 VK_SAMPLE_COUNT_1_BIT |
504 VK_SAMPLE_COUNT_4_BIT, // sampledImageStencilSampleCounts
505 VK_SAMPLE_COUNT_1_BIT, // storageImageSampleCounts
506 1, // maxSampleMaskWords
507 VK_TRUE, // timestampComputeAndGraphics
508 1, // timestampPeriod
509 0, // maxClipDistances
510 0, // maxCullDistances
511 0, // maxCombinedClipAndCullDistances
512 2, // discreteQueuePriorities
513 {1.0f, 1.0f}, // pointSizeRange[2]
514 {1.0f, 1.0f}, // lineWidthRange[2]
515 0.0f, // pointSizeGranularity
516 0.0f, // lineWidthGranularity
517 VK_TRUE, // strictLines
518 VK_TRUE, // standardSampleLocations
519 1, // optimalBufferCopyOffsetAlignment
520 1, // optimalBufferCopyRowPitchAlignment
521 64, // nonCoherentAtomSize
522 };
Jesse Hall04f4f472015-08-16 19:51:04 -0700523}
524
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300525void GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physical_device,
526 VkPhysicalDeviceProperties2KHR* properties) {
527 GetPhysicalDeviceProperties(physical_device, &properties->properties);
Chris Forbesb4eb2782017-03-15 16:09:15 +1300528
529 while (properties->pNext) {
530 properties = reinterpret_cast<VkPhysicalDeviceProperties2KHR *>(properties->pNext);
531
532#pragma clang diagnostic push
533#pragma clang diagnostic ignored "-Wold-style-cast"
534 switch ((VkFlags)properties->sType) {
535 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID: {
536 VkPhysicalDevicePresentationPropertiesANDROID *presentation_properties =
537 reinterpret_cast<VkPhysicalDevicePresentationPropertiesANDROID *>(properties);
538#pragma clang diagnostic pop
539
540 // Claim that we do all the right things for the loader to
541 // expose KHR_shared_presentable_image on our behalf.
542 presentation_properties->sharedImage = VK_TRUE;
543 } break;
544
545 default:
546 // Silently ignore other extension query structs
547 break;
548 }
549 }
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300550}
551
Jesse Hall606a54e2015-11-19 22:17:28 -0800552void GetPhysicalDeviceQueueFamilyProperties(
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700553 VkPhysicalDevice,
554 uint32_t* count,
555 VkQueueFamilyProperties* properties) {
Jesse Hall715b86a2016-01-16 16:34:29 -0800556 if (!properties || *count > 1)
557 *count = 1;
558 if (properties && *count == 1) {
Jesse Hall65ab5522015-11-30 00:07:16 -0800559 properties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT |
560 VK_QUEUE_TRANSFER_BIT;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700561 properties->queueCount = 1;
Jesse Hallacfa5342015-11-19 21:51:33 -0800562 properties->timestampValidBits = 64;
Jesse Hall715b86a2016-01-16 16:34:29 -0800563 properties->minImageTransferGranularity = VkExtent3D{1, 1, 1};
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700564 }
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700565}
566
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300567void GetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physical_device, uint32_t* count, VkQueueFamilyProperties2KHR* properties) {
568 // note: even though multiple structures, this is safe to forward in this
569 // case since we only expose one queue family.
570 GetPhysicalDeviceQueueFamilyProperties(physical_device, count, properties ? &properties->queueFamilyProperties : nullptr);
571}
572
Jesse Hall606a54e2015-11-19 22:17:28 -0800573void GetPhysicalDeviceMemoryProperties(
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100574 VkPhysicalDevice,
575 VkPhysicalDeviceMemoryProperties* properties) {
576 properties->memoryTypeCount = 1;
577 properties->memoryTypes[0].propertyFlags =
Jesse Halld1af8122015-11-29 23:50:38 -0800578 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
579 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
580 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
581 VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100582 properties->memoryTypes[0].heapIndex = 0;
583 properties->memoryHeapCount = 1;
Jesse Hallbde8ee32015-09-01 16:24:29 -0700584 properties->memoryHeaps[0].size = kMaxDeviceMemory;
Jesse Halld1af8122015-11-29 23:50:38 -0800585 properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
Jesse Hall04f4f472015-08-16 19:51:04 -0700586}
587
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300588void GetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceMemoryProperties2KHR* properties) {
589 GetPhysicalDeviceMemoryProperties(physical_device, &properties->memoryProperties);
590}
591
Jesse Hall8e37cf32016-01-18 04:00:57 -0800592void GetPhysicalDeviceFeatures(VkPhysicalDevice /*gpu*/,
593 VkPhysicalDeviceFeatures* features) {
594 *features = VkPhysicalDeviceFeatures{
595 VK_TRUE, // robustBufferAccess
596 VK_FALSE, // fullDrawIndexUint32
597 VK_FALSE, // imageCubeArray
598 VK_FALSE, // independentBlend
599 VK_FALSE, // geometryShader
600 VK_FALSE, // tessellationShader
601 VK_FALSE, // sampleRateShading
602 VK_FALSE, // dualSrcBlend
603 VK_FALSE, // logicOp
604 VK_FALSE, // multiDrawIndirect
605 VK_FALSE, // drawIndirectFirstInstance
606 VK_FALSE, // depthClamp
607 VK_FALSE, // depthBiasClamp
608 VK_FALSE, // fillModeNonSolid
609 VK_FALSE, // depthBounds
610 VK_FALSE, // wideLines
611 VK_FALSE, // largePoints
612 VK_FALSE, // alphaToOne
613 VK_FALSE, // multiViewport
614 VK_FALSE, // samplerAnisotropy
615 VK_FALSE, // textureCompressionETC2
616 VK_FALSE, // textureCompressionASTC_LDR
617 VK_FALSE, // textureCompressionBC
618 VK_FALSE, // occlusionQueryPrecise
619 VK_FALSE, // pipelineStatisticsQuery
620 VK_FALSE, // vertexPipelineStoresAndAtomics
621 VK_FALSE, // fragmentStoresAndAtomics
622 VK_FALSE, // shaderTessellationAndGeometryPointSize
623 VK_FALSE, // shaderImageGatherExtended
624 VK_FALSE, // shaderStorageImageExtendedFormats
625 VK_FALSE, // shaderStorageImageMultisample
626 VK_FALSE, // shaderStorageImageReadWithoutFormat
627 VK_FALSE, // shaderStorageImageWriteWithoutFormat
628 VK_FALSE, // shaderUniformBufferArrayDynamicIndexing
629 VK_FALSE, // shaderSampledImageArrayDynamicIndexing
630 VK_FALSE, // shaderStorageBufferArrayDynamicIndexing
631 VK_FALSE, // shaderStorageImageArrayDynamicIndexing
632 VK_FALSE, // shaderClipDistance
633 VK_FALSE, // shaderCullDistance
634 VK_FALSE, // shaderFloat64
635 VK_FALSE, // shaderInt64
636 VK_FALSE, // shaderInt16
637 VK_FALSE, // shaderResourceResidency
638 VK_FALSE, // shaderResourceMinLod
639 VK_FALSE, // sparseBinding
640 VK_FALSE, // sparseResidencyBuffer
641 VK_FALSE, // sparseResidencyImage2D
642 VK_FALSE, // sparseResidencyImage3D
643 VK_FALSE, // sparseResidency2Samples
644 VK_FALSE, // sparseResidency4Samples
645 VK_FALSE, // sparseResidency8Samples
646 VK_FALSE, // sparseResidency16Samples
647 VK_FALSE, // sparseResidencyAliased
648 VK_FALSE, // variableMultisampleRate
649 VK_FALSE, // inheritedQueries
650 };
651}
652
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300653void GetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceFeatures2KHR* features) {
654 GetPhysicalDeviceFeatures(physical_device, &features->features);
655}
656
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100657// -----------------------------------------------------------------------------
658// Device
659
Jesse Hall04f4f472015-08-16 19:51:04 -0700660VkResult CreateDevice(VkPhysicalDevice physical_device,
Jesse Hallb1471272016-01-17 21:36:58 -0800661 const VkDeviceCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800662 const VkAllocationCallbacks* allocator,
Jesse Hall04f4f472015-08-16 19:51:04 -0700663 VkDevice* out_device) {
664 VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800665 if (!allocator)
666 allocator = &instance->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800667 VkDevice_T* device = static_cast<VkDevice_T*>(allocator->pfnAllocation(
668 allocator->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T),
669 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE));
Jesse Hall04f4f472015-08-16 19:51:04 -0700670 if (!device)
671 return VK_ERROR_OUT_OF_HOST_MEMORY;
672
673 device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800674 device->allocator = *allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700675 device->instance = instance;
676 device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700677 std::fill(device->next_handle.begin(), device->next_handle.end(),
678 UINT64_C(0));
Jesse Hall04f4f472015-08-16 19:51:04 -0700679
Jesse Hallb1471272016-01-17 21:36:58 -0800680 for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
681 if (strcmp(create_info->ppEnabledExtensionNames[i],
682 VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME) == 0) {
683 ALOGV("Enabling " VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME);
684 }
685 }
686
Jesse Hall04f4f472015-08-16 19:51:04 -0700687 *out_device = device;
688 return VK_SUCCESS;
689}
690
Jesse Hall3fbc8562015-11-29 22:10:52 -0800691void DestroyDevice(VkDevice device,
692 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700693 if (!device)
Jesse Hallcf25c412015-10-29 17:14:50 -0700694 return;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800695 device->allocator.pfnFree(device->allocator.pUserData, device);
Jesse Hall04f4f472015-08-16 19:51:04 -0700696}
697
Jesse Hall606a54e2015-11-19 22:17:28 -0800698void GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700699 *queue = &device->queue;
Jesse Hall04f4f472015-08-16 19:51:04 -0700700}
701
702// -----------------------------------------------------------------------------
Jesse Hall3fbc8562015-11-29 22:10:52 -0800703// CommandPool
Jesse Hall03b6fe12015-11-24 12:44:21 -0800704
Jesse Hall3fbc8562015-11-29 22:10:52 -0800705struct CommandPool {
706 typedef VkCommandPool HandleType;
707 VkAllocationCallbacks allocator;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800708};
Jesse Hall3fbc8562015-11-29 22:10:52 -0800709DEFINE_OBJECT_HANDLE_CONVERSION(CommandPool)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800710
711VkResult CreateCommandPool(VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800712 const VkCommandPoolCreateInfo* /*create_info*/,
713 const VkAllocationCallbacks* allocator,
714 VkCommandPool* cmd_pool) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800715 if (!allocator)
716 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800717 CommandPool* pool = static_cast<CommandPool*>(allocator->pfnAllocation(
718 allocator->pUserData, sizeof(CommandPool), alignof(CommandPool),
719 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall03b6fe12015-11-24 12:44:21 -0800720 if (!pool)
721 return VK_ERROR_OUT_OF_HOST_MEMORY;
722 pool->allocator = *allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800723 *cmd_pool = GetHandleToCommandPool(pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800724 return VK_SUCCESS;
725}
726
727void DestroyCommandPool(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800728 VkCommandPool cmd_pool,
729 const VkAllocationCallbacks* /*allocator*/) {
730 CommandPool* pool = GetCommandPoolFromHandle(cmd_pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800731 pool->allocator.pfnFree(pool->allocator.pUserData, pool);
732}
733
734// -----------------------------------------------------------------------------
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700735// CmdBuffer
736
Jesse Hall3fbc8562015-11-29 22:10:52 -0800737VkResult AllocateCommandBuffers(VkDevice /*device*/,
738 const VkCommandBufferAllocateInfo* alloc_info,
739 VkCommandBuffer* cmdbufs) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800740 VkResult result = VK_SUCCESS;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800741 CommandPool& pool = *GetCommandPoolFromHandle(alloc_info->commandPool);
Jesse Hall3dd678a2016-01-08 21:52:01 -0800742 std::fill(cmdbufs, cmdbufs + alloc_info->commandBufferCount, nullptr);
743 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800744 cmdbufs[i] =
745 static_cast<VkCommandBuffer_T*>(pool.allocator.pfnAllocation(
746 pool.allocator.pUserData, sizeof(VkCommandBuffer_T),
747 alignof(VkCommandBuffer_T), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallfbf97b02015-11-20 14:17:03 -0800748 if (!cmdbufs[i]) {
749 result = VK_ERROR_OUT_OF_HOST_MEMORY;
750 break;
751 }
752 cmdbufs[i]->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
753 }
754 if (result != VK_SUCCESS) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800755 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800756 if (!cmdbufs[i])
757 break;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800758 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800759 }
760 }
Jesse Hallfbf97b02015-11-20 14:17:03 -0800761 return result;
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700762}
763
Jesse Hall03b6fe12015-11-24 12:44:21 -0800764void FreeCommandBuffers(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800765 VkCommandPool cmd_pool,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800766 uint32_t count,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800767 const VkCommandBuffer* cmdbufs) {
768 CommandPool& pool = *GetCommandPoolFromHandle(cmd_pool);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800769 for (uint32_t i = 0; i < count; i++)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800770 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700771}
772
773// -----------------------------------------------------------------------------
Jesse Hall2077ce02015-08-29 18:10:59 +0100774// DeviceMemory
775
776struct DeviceMemory {
777 typedef VkDeviceMemory HandleType;
778 VkDeviceSize size;
779 alignas(16) uint8_t data[0];
780};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800781DEFINE_OBJECT_HANDLE_CONVERSION(DeviceMemory)
Jesse Hall2077ce02015-08-29 18:10:59 +0100782
Jesse Hall3fbc8562015-11-29 22:10:52 -0800783VkResult AllocateMemory(VkDevice device,
784 const VkMemoryAllocateInfo* alloc_info,
785 const VkAllocationCallbacks* allocator,
786 VkDeviceMemory* mem_handle) {
Jesse Hall2077ce02015-08-29 18:10:59 +0100787 if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize)
788 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800789 if (!allocator)
790 allocator = &device->allocator;
Jesse Hall2077ce02015-08-29 18:10:59 +0100791
Jesse Hall2077ce02015-08-29 18:10:59 +0100792 size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize);
Jesse Hall3fbc8562015-11-29 22:10:52 -0800793 DeviceMemory* mem = static_cast<DeviceMemory*>(allocator->pfnAllocation(
794 allocator->pUserData, size, alignof(DeviceMemory),
795 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall2077ce02015-08-29 18:10:59 +0100796 if (!mem)
797 return VK_ERROR_OUT_OF_HOST_MEMORY;
798 mem->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800799 *mem_handle = GetHandleToDeviceMemory(mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100800 return VK_SUCCESS;
801}
802
Jesse Hall03b6fe12015-11-24 12:44:21 -0800803void FreeMemory(VkDevice device,
804 VkDeviceMemory mem_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800805 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800806 if (!allocator)
807 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800808 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800809 allocator->pfnFree(allocator->pUserData, mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100810}
811
812VkResult MapMemory(VkDevice,
813 VkDeviceMemory mem_handle,
814 VkDeviceSize offset,
815 VkDeviceSize,
816 VkMemoryMapFlags,
817 void** out_ptr) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800818 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall2077ce02015-08-29 18:10:59 +0100819 *out_ptr = &mem->data[0] + offset;
820 return VK_SUCCESS;
821}
822
823// -----------------------------------------------------------------------------
Jesse Hallf6578742015-08-29 17:06:12 +0100824// Buffer
825
826struct Buffer {
827 typedef VkBuffer HandleType;
828 VkDeviceSize size;
829};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800830DEFINE_OBJECT_HANDLE_CONVERSION(Buffer)
Jesse Hallf6578742015-08-29 17:06:12 +0100831
832VkResult CreateBuffer(VkDevice device,
833 const VkBufferCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800834 const VkAllocationCallbacks* allocator,
Jesse Hallf6578742015-08-29 17:06:12 +0100835 VkBuffer* buffer_handle) {
Jesse Hallbde8ee32015-09-01 16:24:29 -0700836 ALOGW_IF(create_info->size > kMaxDeviceMemory,
837 "CreateBuffer: requested size 0x%" PRIx64
838 " exceeds max device memory size 0x%" PRIx64,
839 create_info->size, kMaxDeviceMemory);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800840 if (!allocator)
841 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800842 Buffer* buffer = static_cast<Buffer*>(allocator->pfnAllocation(
843 allocator->pUserData, sizeof(Buffer), alignof(Buffer),
844 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallf6578742015-08-29 17:06:12 +0100845 if (!buffer)
846 return VK_ERROR_OUT_OF_HOST_MEMORY;
847 buffer->size = create_info->size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800848 *buffer_handle = GetHandleToBuffer(buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100849 return VK_SUCCESS;
850}
851
Jesse Hall606a54e2015-11-19 22:17:28 -0800852void GetBufferMemoryRequirements(VkDevice,
853 VkBuffer buffer_handle,
854 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800855 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hallf6578742015-08-29 17:06:12 +0100856 requirements->size = buffer->size;
857 requirements->alignment = 16; // allow fast Neon/SSE memcpy
858 requirements->memoryTypeBits = 0x1;
Jesse Hallf6578742015-08-29 17:06:12 +0100859}
860
Jesse Hall03b6fe12015-11-24 12:44:21 -0800861void DestroyBuffer(VkDevice device,
862 VkBuffer buffer_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800863 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800864 if (!allocator)
865 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800866 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800867 allocator->pfnFree(allocator->pUserData, buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100868}
869
870// -----------------------------------------------------------------------------
Jesse Hall85c05b62015-09-01 18:07:41 -0700871// Image
872
873struct Image {
874 typedef VkImage HandleType;
875 VkDeviceSize size;
876};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800877DEFINE_OBJECT_HANDLE_CONVERSION(Image)
Jesse Hall85c05b62015-09-01 18:07:41 -0700878
879VkResult CreateImage(VkDevice device,
880 const VkImageCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800881 const VkAllocationCallbacks* allocator,
Jesse Hall85c05b62015-09-01 18:07:41 -0700882 VkImage* image_handle) {
883 if (create_info->imageType != VK_IMAGE_TYPE_2D ||
884 create_info->format != VK_FORMAT_R8G8B8A8_UNORM ||
885 create_info->mipLevels != 1) {
886 ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u",
887 create_info->imageType, create_info->format,
888 create_info->mipLevels);
Jesse Halla15a4bf2015-11-19 22:48:02 -0800889 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall85c05b62015-09-01 18:07:41 -0700890 }
891
892 VkDeviceSize size =
893 VkDeviceSize(create_info->extent.width * create_info->extent.height) *
Jesse Halla15a4bf2015-11-19 22:48:02 -0800894 create_info->arrayLayers * create_info->samples * 4u;
Jesse Hall85c05b62015-09-01 18:07:41 -0700895 ALOGW_IF(size > kMaxDeviceMemory,
896 "CreateImage: image size 0x%" PRIx64
897 " exceeds max device memory size 0x%" PRIx64,
898 size, kMaxDeviceMemory);
899
Jesse Hall03b6fe12015-11-24 12:44:21 -0800900 if (!allocator)
901 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800902 Image* image = static_cast<Image*>(allocator->pfnAllocation(
903 allocator->pUserData, sizeof(Image), alignof(Image),
904 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall85c05b62015-09-01 18:07:41 -0700905 if (!image)
906 return VK_ERROR_OUT_OF_HOST_MEMORY;
907 image->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800908 *image_handle = GetHandleToImage(image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700909 return VK_SUCCESS;
910}
911
Jesse Hall606a54e2015-11-19 22:17:28 -0800912void GetImageMemoryRequirements(VkDevice,
913 VkImage image_handle,
914 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800915 Image* image = GetImageFromHandle(image_handle);
Jesse Hall85c05b62015-09-01 18:07:41 -0700916 requirements->size = image->size;
917 requirements->alignment = 16; // allow fast Neon/SSE memcpy
918 requirements->memoryTypeBits = 0x1;
Jesse Hall85c05b62015-09-01 18:07:41 -0700919}
920
Jesse Hall03b6fe12015-11-24 12:44:21 -0800921void DestroyImage(VkDevice device,
922 VkImage image_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800923 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800924 if (!allocator)
925 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800926 Image* image = GetImageFromHandle(image_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800927 allocator->pfnFree(allocator->pUserData, image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700928}
929
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800930VkResult GetSwapchainGrallocUsageANDROID(VkDevice,
931 VkFormat,
932 VkImageUsageFlags,
933 int* grallocUsage) {
934 // The null driver never reads or writes the gralloc buffer
935 *grallocUsage = 0;
936 return VK_SUCCESS;
937}
938
Chris Forbes8e4438b2016-12-07 16:26:49 +1300939VkResult GetSwapchainGrallocUsage2ANDROID(VkDevice,
940 VkFormat,
941 VkImageUsageFlags,
942 VkSwapchainImageUsageFlagsANDROID,
Jesse Halld1abd742017-02-09 21:45:51 -0800943 uint64_t* grallocConsumerUsage,
944 uint64_t* grallocProducerUsage) {
Chris Forbes8e4438b2016-12-07 16:26:49 +1300945 // The null driver never reads or writes the gralloc buffer
Jesse Halld1abd742017-02-09 21:45:51 -0800946 *grallocConsumerUsage = 0;
947 *grallocProducerUsage = 0;
Chris Forbes8e4438b2016-12-07 16:26:49 +1300948 return VK_SUCCESS;
949}
950
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800951VkResult AcquireImageANDROID(VkDevice,
952 VkImage,
953 int fence,
954 VkSemaphore,
955 VkFence) {
956 close(fence);
957 return VK_SUCCESS;
958}
959
960VkResult QueueSignalReleaseImageANDROID(VkQueue,
961 uint32_t,
962 const VkSemaphore*,
963 VkImage,
964 int* fence) {
965 *fence = -1;
966 return VK_SUCCESS;
967}
968
Jesse Hall85c05b62015-09-01 18:07:41 -0700969// -----------------------------------------------------------------------------
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700970// No-op types
971
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700972VkResult CreateBufferView(VkDevice device,
973 const VkBufferViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800974 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700975 VkBufferView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800976 *view = AllocHandle<VkBufferView>(device, HandleType::kBufferView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700977 return VK_SUCCESS;
978}
979
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700980VkResult CreateDescriptorPool(VkDevice device,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700981 const VkDescriptorPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800982 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700983 VkDescriptorPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800984 *pool = AllocHandle<VkDescriptorPool>(device, HandleType::kDescriptorPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700985 return VK_SUCCESS;
986}
987
Jesse Hall3fbc8562015-11-29 22:10:52 -0800988VkResult AllocateDescriptorSets(VkDevice device,
989 const VkDescriptorSetAllocateInfo* alloc_info,
990 VkDescriptorSet* descriptor_sets) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800991 for (uint32_t i = 0; i < alloc_info->descriptorSetCount; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800992 descriptor_sets[i] =
993 AllocHandle<VkDescriptorSet>(device, HandleType::kDescriptorSet);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700994 return VK_SUCCESS;
995}
996
997VkResult CreateDescriptorSetLayout(VkDevice device,
998 const VkDescriptorSetLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800999 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001000 VkDescriptorSetLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001001 *layout = AllocHandle<VkDescriptorSetLayout>(
1002 device, HandleType::kDescriptorSetLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001003 return VK_SUCCESS;
1004}
1005
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001006VkResult CreateEvent(VkDevice device,
1007 const VkEventCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001008 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001009 VkEvent* event) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001010 *event = AllocHandle<VkEvent>(device, HandleType::kEvent);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001011 return VK_SUCCESS;
1012}
1013
1014VkResult CreateFence(VkDevice device,
1015 const VkFenceCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001016 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001017 VkFence* fence) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001018 *fence = AllocHandle<VkFence>(device, HandleType::kFence);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001019 return VK_SUCCESS;
1020}
1021
1022VkResult CreateFramebuffer(VkDevice device,
1023 const VkFramebufferCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001024 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001025 VkFramebuffer* framebuffer) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001026 *framebuffer = AllocHandle<VkFramebuffer>(device, HandleType::kFramebuffer);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001027 return VK_SUCCESS;
1028}
1029
1030VkResult CreateImageView(VkDevice device,
1031 const VkImageViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001032 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001033 VkImageView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001034 *view = AllocHandle<VkImageView>(device, HandleType::kImageView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001035 return VK_SUCCESS;
1036}
1037
1038VkResult CreateGraphicsPipelines(VkDevice device,
1039 VkPipelineCache,
1040 uint32_t count,
1041 const VkGraphicsPipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001042 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001043 VkPipeline* pipelines) {
1044 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -08001045 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001046 return VK_SUCCESS;
1047}
1048
1049VkResult CreateComputePipelines(VkDevice device,
1050 VkPipelineCache,
1051 uint32_t count,
1052 const VkComputePipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001053 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001054 VkPipeline* pipelines) {
1055 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -08001056 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001057 return VK_SUCCESS;
1058}
1059
1060VkResult CreatePipelineCache(VkDevice device,
1061 const VkPipelineCacheCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001062 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001063 VkPipelineCache* cache) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001064 *cache = AllocHandle<VkPipelineCache>(device, HandleType::kPipelineCache);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001065 return VK_SUCCESS;
1066}
1067
1068VkResult CreatePipelineLayout(VkDevice device,
1069 const VkPipelineLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001070 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001071 VkPipelineLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001072 *layout =
1073 AllocHandle<VkPipelineLayout>(device, HandleType::kPipelineLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001074 return VK_SUCCESS;
1075}
1076
1077VkResult CreateQueryPool(VkDevice device,
1078 const VkQueryPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001079 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001080 VkQueryPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001081 *pool = AllocHandle<VkQueryPool>(device, HandleType::kQueryPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001082 return VK_SUCCESS;
1083}
1084
1085VkResult CreateRenderPass(VkDevice device,
1086 const VkRenderPassCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001087 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001088 VkRenderPass* renderpass) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001089 *renderpass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001090 return VK_SUCCESS;
1091}
1092
1093VkResult CreateSampler(VkDevice device,
1094 const VkSamplerCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001095 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001096 VkSampler* sampler) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001097 *sampler = AllocHandle<VkSampler>(device, HandleType::kSampler);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001098 return VK_SUCCESS;
1099}
1100
1101VkResult CreateSemaphore(VkDevice device,
1102 const VkSemaphoreCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001103 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001104 VkSemaphore* semaphore) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001105 *semaphore = AllocHandle<VkSemaphore>(device, HandleType::kSemaphore);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001106 return VK_SUCCESS;
1107}
1108
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001109VkResult CreateShaderModule(VkDevice device,
1110 const VkShaderModuleCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001111 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001112 VkShaderModule* module) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001113 *module = AllocHandle<VkShaderModule>(device, HandleType::kShaderModule);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001114 return VK_SUCCESS;
1115}
1116
Jesse Hall715b86a2016-01-16 16:34:29 -08001117VkResult CreateDebugReportCallbackEXT(VkInstance instance,
1118 const VkDebugReportCallbackCreateInfoEXT*,
1119 const VkAllocationCallbacks*,
1120 VkDebugReportCallbackEXT* callback) {
1121 *callback = AllocHandle<VkDebugReportCallbackEXT>(
1122 instance, HandleType::kDebugReportCallbackEXT);
1123 return VK_SUCCESS;
1124}
1125
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001126// -----------------------------------------------------------------------------
Jesse Hall04f4f472015-08-16 19:51:04 -07001127// No-op entrypoints
1128
1129// clang-format off
1130#pragma clang diagnostic push
1131#pragma clang diagnostic ignored "-Wunused-parameter"
1132
Jesse Hall606a54e2015-11-19 22:17:28 -08001133void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001134 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001135}
1136
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001137void GetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR* pFormatProperties) {
1138 ALOGV("TODO: vk%s", __FUNCTION__);
1139}
1140
Jesse Halla9e57032015-11-30 01:03:10 -08001141VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001142 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Halla9e57032015-11-30 01:03:10 -08001143 return VK_SUCCESS;
Jesse Hall04f4f472015-08-16 19:51:04 -07001144}
1145
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001146VkResult GetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1147 const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo,
1148 VkImageFormatProperties2KHR* pImageFormatProperties) {
1149 ALOGV("TODO: vk%s", __FUNCTION__);
1150 return VK_SUCCESS;
1151}
1152
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001153VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001154 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001155 return VK_SUCCESS;
1156}
1157
Jesse Halla366a512015-11-19 22:30:07 -08001158VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001159 return VK_SUCCESS;
1160}
1161
1162VkResult QueueWaitIdle(VkQueue queue) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001163 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001164 return VK_SUCCESS;
1165}
1166
1167VkResult DeviceWaitIdle(VkDevice device) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001168 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001169 return VK_SUCCESS;
1170}
1171
Jesse Hallcf25c412015-10-29 17:14:50 -07001172void UnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001173}
1174
1175VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001176 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001177 return VK_SUCCESS;
1178}
1179
1180VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001181 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001182 return VK_SUCCESS;
1183}
1184
Jesse Hall606a54e2015-11-19 22:17:28 -08001185void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001186 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001187}
1188
Jesse Hall04f4f472015-08-16 19:51:04 -07001189VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset) {
1190 return VK_SUCCESS;
1191}
1192
Jesse Hall04f4f472015-08-16 19:51:04 -07001193VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset) {
1194 return VK_SUCCESS;
1195}
1196
Jesse Hall606a54e2015-11-19 22:17:28 -08001197void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001198 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001199}
1200
Jesse Hall091ed9e2015-11-30 00:55:29 -08001201void 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 +01001202 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001203}
1204
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001205void GetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1206 VkPhysicalDeviceSparseImageFormatInfo2KHR const* pInfo,
1207 unsigned int* pNumProperties,
1208 VkSparseImageFormatProperties2KHR* pProperties) {
1209 ALOGV("TODO: vk%s", __FUNCTION__);
1210}
1211
1212
Jesse Halla6429252015-11-29 18:59:42 -08001213VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001214 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001215 return VK_SUCCESS;
1216}
1217
Jesse Hall3fbc8562015-11-29 22:10:52 -08001218void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001219}
1220
1221VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
1222 return VK_SUCCESS;
1223}
1224
1225VkResult GetFenceStatus(VkDevice device, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001226 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001227 return VK_SUCCESS;
1228}
1229
1230VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
1231 return VK_SUCCESS;
1232}
1233
Jesse Hall3fbc8562015-11-29 22:10:52 -08001234void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001235}
1236
Jesse Hall3fbc8562015-11-29 22:10:52 -08001237void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001238}
1239
1240VkResult GetEventStatus(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001241 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001242 return VK_SUCCESS;
1243}
1244
1245VkResult SetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001246 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001247 return VK_SUCCESS;
1248}
1249
1250VkResult ResetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001251 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001252 return VK_SUCCESS;
1253}
1254
Jesse Hall3fbc8562015-11-29 22:10:52 -08001255void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001256}
1257
Jesse Halla9bb62b2015-11-21 19:31:56 -08001258VkResult 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 +01001259 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001260 return VK_SUCCESS;
1261}
1262
Jesse Hall3fbc8562015-11-29 22:10:52 -08001263void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001264}
1265
Jesse Hall606a54e2015-11-19 22:17:28 -08001266void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001267 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001268}
1269
Jesse Hall3fbc8562015-11-29 22:10:52 -08001270void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001271}
1272
Jesse Hall3fbc8562015-11-29 22:10:52 -08001273void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001274}
1275
Jesse Hall3fbc8562015-11-29 22:10:52 -08001276void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001277}
1278
Jesse Halla9bb62b2015-11-21 19:31:56 -08001279VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001280 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001281 return VK_SUCCESS;
1282}
1283
1284VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001285 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001286 return VK_SUCCESS;
1287}
1288
Jesse Hall3fbc8562015-11-29 22:10:52 -08001289void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001290}
1291
Jesse Hall3fbc8562015-11-29 22:10:52 -08001292void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001293}
1294
Jesse Hall3fbc8562015-11-29 22:10:52 -08001295void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001296}
1297
Jesse Hall3fbc8562015-11-29 22:10:52 -08001298void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001299}
1300
Jesse Hall3fbc8562015-11-29 22:10:52 -08001301void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001302}
1303
Jesse Hallfbf97b02015-11-20 14:17:03 -08001304VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001305 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001306 return VK_SUCCESS;
1307}
1308
Jesse Hallcf25c412015-10-29 17:14:50 -07001309void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001310 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001311}
1312
1313VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001314 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001315 return VK_SUCCESS;
1316}
1317
Jesse Hall3fbc8562015-11-29 22:10:52 -08001318void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001319}
1320
Jesse Hall3fbc8562015-11-29 22:10:52 -08001321void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001322}
1323
Jesse Hall606a54e2015-11-19 22:17:28 -08001324void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001325 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001326}
1327
Jesse Hall3fbc8562015-11-29 22:10:52 -08001328VkResult ResetCommandPool(VkDevice device, VkCommandPool cmdPool, VkCommandPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001329 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001330 return VK_SUCCESS;
1331}
1332
Jesse Hall3fbc8562015-11-29 22:10:52 -08001333VkResult BeginCommandBuffer(VkCommandBuffer cmdBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001334 return VK_SUCCESS;
1335}
1336
Jesse Hall3fbc8562015-11-29 22:10:52 -08001337VkResult EndCommandBuffer(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001338 return VK_SUCCESS;
1339}
1340
Jesse Hall3fbc8562015-11-29 22:10:52 -08001341VkResult ResetCommandBuffer(VkCommandBuffer cmdBuffer, VkCommandBufferResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001342 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001343 return VK_SUCCESS;
1344}
1345
Jesse Hall3fbc8562015-11-29 22:10:52 -08001346void CmdBindPipeline(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001347}
1348
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001349void CmdSetViewport(VkCommandBuffer cmdBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001350}
1351
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001352void CmdSetScissor(VkCommandBuffer cmdBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001353}
1354
Jesse Hall3fbc8562015-11-29 22:10:52 -08001355void CmdSetLineWidth(VkCommandBuffer cmdBuffer, float lineWidth) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001356}
1357
Jesse Hall3fbc8562015-11-29 22:10:52 -08001358void CmdSetDepthBias(VkCommandBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001359}
1360
Jesse Hall3fbc8562015-11-29 22:10:52 -08001361void CmdSetBlendConstants(VkCommandBuffer cmdBuffer, const float blendConst[4]) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001362}
1363
Jesse Hall3fbc8562015-11-29 22:10:52 -08001364void CmdSetDepthBounds(VkCommandBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001365}
1366
Jesse Hall3fbc8562015-11-29 22:10:52 -08001367void CmdSetStencilCompareMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001368}
1369
Jesse Hall3fbc8562015-11-29 22:10:52 -08001370void CmdSetStencilWriteMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001371}
1372
Jesse Hall3fbc8562015-11-29 22:10:52 -08001373void CmdSetStencilReference(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001374}
1375
Jesse Hall3fbc8562015-11-29 22:10:52 -08001376void 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 -07001377}
1378
Jesse Hall3fbc8562015-11-29 22:10:52 -08001379void CmdBindIndexBuffer(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001380}
1381
Jesse Hall3fbc8562015-11-29 22:10:52 -08001382void CmdBindVertexBuffers(VkCommandBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001383}
1384
Jesse Hall3fbc8562015-11-29 22:10:52 -08001385void CmdDraw(VkCommandBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001386}
1387
Jesse Hall3fbc8562015-11-29 22:10:52 -08001388void 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 -07001389}
1390
Jesse Hall3fbc8562015-11-29 22:10:52 -08001391void CmdDrawIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001392}
1393
Jesse Hall3fbc8562015-11-29 22:10:52 -08001394void CmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001395}
1396
Jesse Hall3fbc8562015-11-29 22:10:52 -08001397void CmdDispatch(VkCommandBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001398}
1399
Jesse Hall3fbc8562015-11-29 22:10:52 -08001400void CmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001401}
1402
Jesse Hall3fbc8562015-11-29 22:10:52 -08001403void CmdCopyBuffer(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001404}
1405
Jesse Hall3fbc8562015-11-29 22:10:52 -08001406void CmdCopyImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001407}
1408
Jesse Hall3fbc8562015-11-29 22:10:52 -08001409void 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 -07001410}
1411
Jesse Hall3fbc8562015-11-29 22:10:52 -08001412void CmdCopyBufferToImage(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001413}
1414
Jesse Hall3fbc8562015-11-29 22:10:52 -08001415void CmdCopyImageToBuffer(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001416}
1417
Jesse Hall56d386a2016-07-26 15:20:40 -07001418void CmdUpdateBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const void* pData) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001419}
1420
Jesse Hall3fbc8562015-11-29 22:10:52 -08001421void CmdFillBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001422}
1423
Jesse Hall3fbc8562015-11-29 22:10:52 -08001424void CmdClearColorImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001425}
1426
Jesse Hall3fbc8562015-11-29 22:10:52 -08001427void CmdClearDepthStencilImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001428}
1429
Jesse Hall3fbc8562015-11-29 22:10:52 -08001430void CmdClearAttachments(VkCommandBuffer cmdBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001431}
1432
Jesse Hall3fbc8562015-11-29 22:10:52 -08001433void CmdResolveImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001434}
1435
Jesse Hall3fbc8562015-11-29 22:10:52 -08001436void CmdSetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001437}
1438
Jesse Hall3fbc8562015-11-29 22:10:52 -08001439void CmdResetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001440}
1441
Jesse Hall3dd678a2016-01-08 21:52:01 -08001442void 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 -07001443}
1444
Jesse Hall3dd678a2016-01-08 21:52:01 -08001445void 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 -07001446}
1447
Jesse Hall3fbc8562015-11-29 22:10:52 -08001448void CmdBeginQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001449}
1450
Jesse Hall3fbc8562015-11-29 22:10:52 -08001451void CmdEndQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001452}
1453
Jesse Hall3fbc8562015-11-29 22:10:52 -08001454void CmdResetQueryPool(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001455}
1456
Jesse Hall3fbc8562015-11-29 22:10:52 -08001457void CmdWriteTimestamp(VkCommandBuffer cmdBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001458}
1459
Jesse Hall3fbc8562015-11-29 22:10:52 -08001460void 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 -07001461}
1462
Jesse Hall3fbc8562015-11-29 22:10:52 -08001463void CmdPushConstants(VkCommandBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001464}
1465
Jesse Hall65ab5522015-11-30 00:07:16 -08001466void CmdBeginRenderPass(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001467}
1468
Jesse Hall65ab5522015-11-30 00:07:16 -08001469void CmdNextSubpass(VkCommandBuffer cmdBuffer, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001470}
1471
Jesse Hall3fbc8562015-11-29 22:10:52 -08001472void CmdEndRenderPass(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001473}
1474
Jesse Hall3fbc8562015-11-29 22:10:52 -08001475void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001476}
1477
Jesse Hall715b86a2016-01-16 16:34:29 -08001478void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator) {
1479}
1480
1481void DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage) {
1482}
1483
Daniel Kochf25f5bb2017-10-05 00:26:58 -04001484VkResult BindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos) {
1485 return VK_SUCCESS;
1486}
1487
1488VkResult BindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos) {
1489 return VK_SUCCESS;
1490}
1491
1492void GetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures) {
1493}
1494
1495void CmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask) {
1496}
1497
1498void CmdDispatchBase(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) {
1499}
1500
1501VkResult EnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties) {
1502 return VK_SUCCESS;
1503}
1504
1505void GetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) {
1506}
1507
1508void GetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) {
1509}
1510
1511void GetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) {
1512}
1513
1514void GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures) {
1515}
1516
1517void GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties) {
1518}
1519
1520void GetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties) {
1521}
1522
1523VkResult GetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties) {
1524 return VK_SUCCESS;
1525}
1526
1527void GetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties) {
1528}
1529
1530void GetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties) {
1531}
1532
1533void GetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties) {
1534}
1535
1536void TrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) {
1537}
1538
1539void GetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo, VkQueue* pQueue) {
1540}
1541
1542VkResult CreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion) {
1543 return VK_SUCCESS;
1544}
1545
1546void DestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator) {
1547}
1548
1549VkResult CreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate) {
1550 return VK_SUCCESS;
1551}
1552
1553void DestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator) {
1554}
1555
1556void UpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData) {
1557}
1558
1559void GetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) {
1560}
1561
1562void GetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties) {
1563}
1564
1565void GetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties) {
1566}
1567
1568void GetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport) {
1569}
1570
Jesse Hall04f4f472015-08-16 19:51:04 -07001571#pragma clang diagnostic pop
1572// clang-format on
1573
1574} // namespace null_driver