blob: 67147791f3b7bd1de4c0a1f7c7f5e2672e0c90a1 [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
Jesse Hall715b86a2016-01-16 16:34:29 -080019#include <inttypes.h>
Jesse Halld3b14502016-04-20 16:58:11 -070020#include <stdlib.h>
Jesse Hall715b86a2016-01-16 16:34:29 -080021#include <string.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070022
Mark Salyzyna5e161b2016-09-29 08:08:05 -070023#include <algorithm>
24#include <array>
25
Mark Salyzyn7823e122016-09-29 08:08:05 -070026#include <log/log.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070027#include <utils/Errors.h>
28
Jesse Hall1f91d392015-12-11 16:28:44 -080029#include "null_driver_gen.h"
Jesse Hall04f4f472015-08-16 19:51:04 -070030
31using namespace null_driver;
32
33struct VkPhysicalDevice_T {
34 hwvulkan_dispatch_t dispatch;
35};
36
37struct VkInstance_T {
38 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -080039 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -070040 VkPhysicalDevice_T physical_device;
Jesse Hall715b86a2016-01-16 16:34:29 -080041 uint64_t next_callback_handle;
Jesse Hall04f4f472015-08-16 19:51:04 -070042};
43
44struct VkQueue_T {
45 hwvulkan_dispatch_t dispatch;
46};
47
Jesse Hall3fbc8562015-11-29 22:10:52 -080048struct VkCommandBuffer_T {
Jesse Hall04f4f472015-08-16 19:51:04 -070049 hwvulkan_dispatch_t dispatch;
50};
51
Jesse Hallf8faf0c2015-08-31 11:34:32 -070052namespace {
53// Handles for non-dispatchable objects are either pointers, or arbitrary
54// 64-bit non-zero values. We only use pointers when we need to keep state for
55// the object even in a null driver. For the rest, we form a handle as:
56// [63:63] = 1 to distinguish from pointer handles*
57// [62:56] = non-zero handle type enum value
58// [55: 0] = per-handle-type incrementing counter
59// * This works because virtual addresses with the high bit set are reserved
60// for kernel data in all ABIs we run on.
61//
62// We never reclaim handles on vkDestroy*. It's not even necessary for us to
63// have distinct handles for live objects, and practically speaking we won't
64// ever create 2^56 objects of the same type from a single VkDevice in a null
65// driver.
66//
67// Using a namespace here instead of 'enum class' since we want scoped
68// constants but also want implicit conversions to integral types.
69namespace HandleType {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070070enum Enum {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070071 kBufferView,
Jesse Hall715b86a2016-01-16 16:34:29 -080072 kDebugReportCallbackEXT,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070073 kDescriptorPool,
74 kDescriptorSet,
75 kDescriptorSetLayout,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070076 kEvent,
77 kFence,
78 kFramebuffer,
79 kImageView,
80 kPipeline,
81 kPipelineCache,
82 kPipelineLayout,
83 kQueryPool,
84 kRenderPass,
85 kSampler,
86 kSemaphore,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070087 kShaderModule,
Jesse Hallf8faf0c2015-08-31 11:34:32 -070088
Jesse Hallc7a6eb52015-08-31 12:52:03 -070089 kNumTypes
90};
91} // namespace HandleType
Jesse Hallbde8ee32015-09-01 16:24:29 -070092
Jesse Hall00f10fe2016-02-08 21:20:20 -080093const VkDeviceSize kMaxDeviceMemory = 0x10000000; // 256 MiB, arbitrary
Jesse Hallbde8ee32015-09-01 16:24:29 -070094
Jesse Hallc7a6eb52015-08-31 12:52:03 -070095} // anonymous namespace
Jesse Hallf8faf0c2015-08-31 11:34:32 -070096
Jesse Hall04f4f472015-08-16 19:51:04 -070097struct VkDevice_T {
98 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -080099 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700100 VkInstance_T* instance;
101 VkQueue_T queue;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700102 std::array<uint64_t, HandleType::kNumTypes> next_handle;
Jesse Hall04f4f472015-08-16 19:51:04 -0700103};
104
105// -----------------------------------------------------------------------------
106// Declare HAL_MODULE_INFO_SYM early so it can be referenced by nulldrv_device
107// later.
108
109namespace {
110int OpenDevice(const hw_module_t* module, const char* id, hw_device_t** device);
111hw_module_methods_t nulldrv_module_methods = {.open = OpenDevice};
112} // namespace
113
114#pragma clang diagnostic push
115#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
116__attribute__((visibility("default"))) hwvulkan_module_t HAL_MODULE_INFO_SYM = {
117 .common =
118 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500119 .tag = HARDWARE_MODULE_TAG,
120 .module_api_version = HWVULKAN_MODULE_API_VERSION_0_1,
121 .hal_api_version = HARDWARE_HAL_API_VERSION,
122 .id = HWVULKAN_HARDWARE_MODULE_ID,
123 .name = "Null Vulkan Driver",
124 .author = "The Android Open Source Project",
125 .methods = &nulldrv_module_methods,
Jesse Hall04f4f472015-08-16 19:51:04 -0700126 },
127};
128#pragma clang diagnostic pop
129
130// -----------------------------------------------------------------------------
131
132namespace {
133
Jesse Hall04f4f472015-08-16 19:51:04 -0700134int CloseDevice(struct hw_device_t* /*device*/) {
135 // nothing to do - opening a device doesn't allocate any resources
136 return 0;
137}
138
139hwvulkan_device_t nulldrv_device = {
140 .common =
141 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500142 .tag = HARDWARE_DEVICE_TAG,
143 .version = HWVULKAN_DEVICE_API_VERSION_0_1,
144 .module = &HAL_MODULE_INFO_SYM.common,
145 .close = CloseDevice,
Jesse Hall04f4f472015-08-16 19:51:04 -0700146 },
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700147 .EnumerateInstanceExtensionProperties =
148 EnumerateInstanceExtensionProperties,
Jesse Hall04f4f472015-08-16 19:51:04 -0700149 .CreateInstance = CreateInstance,
150 .GetInstanceProcAddr = GetInstanceProcAddr};
151
152int OpenDevice(const hw_module_t* /*module*/,
153 const char* id,
154 hw_device_t** device) {
155 if (strcmp(id, HWVULKAN_DEVICE_0) == 0) {
156 *device = &nulldrv_device.common;
157 return 0;
158 }
159 return -ENOENT;
160}
161
162VkInstance_T* GetInstanceFromPhysicalDevice(
163 VkPhysicalDevice_T* physical_device) {
164 return reinterpret_cast<VkInstance_T*>(
165 reinterpret_cast<uintptr_t>(physical_device) -
166 offsetof(VkInstance_T, physical_device));
167}
168
Jesse Hall715b86a2016-01-16 16:34:29 -0800169uint64_t AllocHandle(uint64_t type, uint64_t* next_handle) {
170 const uint64_t kHandleMask = (UINT64_C(1) << 56) - 1;
171 ALOGE_IF(*next_handle == kHandleMask,
172 "non-dispatchable handles of type=%" PRIu64
173 " are about to overflow",
174 type);
175 return (UINT64_C(1) << 63) | ((type & 0x7) << 56) |
176 ((*next_handle)++ & kHandleMask);
177}
178
179template <class Handle>
180Handle AllocHandle(VkInstance instance, HandleType::Enum type) {
181 return reinterpret_cast<Handle>(
182 AllocHandle(type, &instance->next_callback_handle));
183}
184
Michael Lentine3fec89e2015-12-04 16:25:11 -0800185template <class Handle>
186Handle AllocHandle(VkDevice device, HandleType::Enum type) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800187 return reinterpret_cast<Handle>(
Jesse Hall715b86a2016-01-16 16:34:29 -0800188 AllocHandle(type, &device->next_handle[type]));
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700189}
190
Jesse Halld3b14502016-04-20 16:58:11 -0700191VKAPI_ATTR void* DefaultAllocate(void*,
192 size_t size,
193 size_t alignment,
194 VkSystemAllocationScope) {
195 void* ptr = nullptr;
196 // Vulkan requires 'alignment' to be a power of two, but posix_memalign
197 // additionally requires that it be at least sizeof(void*).
198 int ret = posix_memalign(&ptr, std::max(alignment, sizeof(void*)), size);
199 return ret == 0 ? ptr : nullptr;
200}
201
202VKAPI_ATTR void* DefaultReallocate(void*,
203 void* ptr,
204 size_t size,
205 size_t alignment,
206 VkSystemAllocationScope) {
207 if (size == 0) {
208 free(ptr);
209 return nullptr;
210 }
211
212 // TODO(jessehall): Right now we never shrink allocations; if the new
213 // request is smaller than the existing chunk, we just continue using it.
214 // The null driver never reallocs, so this doesn't matter. If that changes,
215 // or if this code is copied into some other project, this should probably
216 // have a heuristic to allocate-copy-free when doing so will save "enough"
217 // space.
218 size_t old_size = ptr ? malloc_usable_size(ptr) : 0;
219 if (size <= old_size)
220 return ptr;
221
222 void* new_ptr = nullptr;
223 if (posix_memalign(&new_ptr, std::max(alignment, sizeof(void*)), size) != 0)
224 return nullptr;
225 if (ptr) {
226 memcpy(new_ptr, ptr, std::min(old_size, size));
227 free(ptr);
228 }
229 return new_ptr;
230}
231
232VKAPI_ATTR void DefaultFree(void*, void* ptr) {
233 free(ptr);
234}
235
236const VkAllocationCallbacks kDefaultAllocCallbacks = {
237 .pUserData = nullptr,
238 .pfnAllocation = DefaultAllocate,
239 .pfnReallocation = DefaultReallocate,
240 .pfnFree = DefaultFree,
241};
242
Jesse Hall04f4f472015-08-16 19:51:04 -0700243} // namespace
244
245namespace null_driver {
246
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800247#define DEFINE_OBJECT_HANDLE_CONVERSION(T) \
248 T* Get##T##FromHandle(Vk##T h); \
249 T* Get##T##FromHandle(Vk##T h) { \
250 return reinterpret_cast<T*>(uintptr_t(h)); \
251 } \
252 Vk##T GetHandleTo##T(const T* obj); \
253 Vk##T GetHandleTo##T(const T* obj) { \
254 return Vk##T(reinterpret_cast<uintptr_t>(obj)); \
255 }
Jesse Hallf6578742015-08-29 17:06:12 +0100256
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100257// -----------------------------------------------------------------------------
258// Global
259
Jesse Halle1b12782015-11-30 11:27:32 -0800260VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800261VkResult EnumerateInstanceExtensionProperties(
262 const char* layer_name,
263 uint32_t* count,
264 VkExtensionProperties* properties) {
265 if (layer_name) {
266 ALOGW(
267 "Driver vkEnumerateInstanceExtensionProperties shouldn't be called "
268 "with a layer name ('%s')",
269 layer_name);
Jesse Hall715b86a2016-01-16 16:34:29 -0800270 }
271
272 const VkExtensionProperties kExtensions[] = {
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300273 {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 -0800274 const uint32_t kExtensionsCount =
275 sizeof(kExtensions) / sizeof(kExtensions[0]);
276
277 if (!properties || *count > kExtensionsCount)
278 *count = kExtensionsCount;
279 if (properties)
280 std::copy(kExtensions, kExtensions + *count, properties);
281 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100282}
283
Jesse Halle1b12782015-11-30 11:27:32 -0800284VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800285VkResult CreateInstance(const VkInstanceCreateInfo* create_info,
Jesse Hall1f91d392015-12-11 16:28:44 -0800286 const VkAllocationCallbacks* allocator,
287 VkInstance* out_instance) {
Jesse Halld3b14502016-04-20 16:58:11 -0700288 if (!allocator)
289 allocator = &kDefaultAllocCallbacks;
Jesse Hall1f91d392015-12-11 16:28:44 -0800290
291 VkInstance_T* instance =
292 static_cast<VkInstance_T*>(allocator->pfnAllocation(
293 allocator->pUserData, sizeof(VkInstance_T), alignof(VkInstance_T),
294 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE));
295 if (!instance)
296 return VK_ERROR_OUT_OF_HOST_MEMORY;
297
298 instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
299 instance->allocator = *allocator;
300 instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall715b86a2016-01-16 16:34:29 -0800301 instance->next_callback_handle = 0;
Jesse Hall715b86a2016-01-16 16:34:29 -0800302
303 for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
304 if (strcmp(create_info->ppEnabledExtensionNames[i],
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300305 VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME) == 0) {
306 ALOGV("instance extension '%s' requested",
307 create_info->ppEnabledExtensionNames[i]);
308 } else if (strcmp(create_info->ppEnabledExtensionNames[i],
Jesse Hall715b86a2016-01-16 16:34:29 -0800309 VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) {
Jesse Hallb1471272016-01-17 21:36:58 -0800310 ALOGV("instance extension '%s' requested",
311 create_info->ppEnabledExtensionNames[i]);
312 } else {
313 ALOGW("unsupported extension '%s' requested",
314 create_info->ppEnabledExtensionNames[i]);
Jesse Hall715b86a2016-01-16 16:34:29 -0800315 }
316 }
Jesse Hall1f91d392015-12-11 16:28:44 -0800317
318 *out_instance = instance;
319 return VK_SUCCESS;
320}
321
322VKAPI_ATTR
323PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name) {
324 return instance ? GetInstanceProcAddr(name) : GetGlobalProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700325}
326
Jesse Halle1b12782015-11-30 11:27:32 -0800327VKAPI_ATTR
Jesse Hall04f4f472015-08-16 19:51:04 -0700328PFN_vkVoidFunction GetDeviceProcAddr(VkDevice, const char* name) {
Jesse Hall1f91d392015-12-11 16:28:44 -0800329 return GetInstanceProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700330}
331
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100332// -----------------------------------------------------------------------------
333// Instance
334
Jesse Hall03b6fe12015-11-24 12:44:21 -0800335void DestroyInstance(VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800336 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800337 instance->allocator.pfnFree(instance->allocator.pUserData, instance);
Jesse Hall04f4f472015-08-16 19:51:04 -0700338}
339
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100340// -----------------------------------------------------------------------------
341// PhysicalDevice
342
Jesse Hall04f4f472015-08-16 19:51:04 -0700343VkResult EnumeratePhysicalDevices(VkInstance instance,
344 uint32_t* physical_device_count,
345 VkPhysicalDevice* physical_devices) {
346 if (physical_devices && *physical_device_count >= 1)
347 physical_devices[0] = &instance->physical_device;
348 *physical_device_count = 1;
349 return VK_SUCCESS;
350}
351
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800352VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice /*gpu*/,
353 uint32_t* count,
354 VkLayerProperties* /*properties*/) {
355 ALOGW("Driver vkEnumerateDeviceLayerProperties shouldn't be called");
356 *count = 0;
357 return VK_SUCCESS;
358}
359
360VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice /*gpu*/,
361 const char* layer_name,
362 uint32_t* count,
363 VkExtensionProperties* properties) {
364 if (layer_name) {
365 ALOGW(
366 "Driver vkEnumerateDeviceExtensionProperties shouldn't be called "
367 "with a layer name ('%s')",
368 layer_name);
369 *count = 0;
370 return VK_SUCCESS;
371 }
372
373 const VkExtensionProperties kExtensions[] = {
374 {VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME,
375 VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION}};
376 const uint32_t kExtensionsCount =
377 sizeof(kExtensions) / sizeof(kExtensions[0]);
378
379 if (!properties || *count > kExtensionsCount)
380 *count = kExtensionsCount;
381 if (properties)
382 std::copy(kExtensions, kExtensions + *count, properties);
383 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
384}
385
Jesse Hall606a54e2015-11-19 22:17:28 -0800386void GetPhysicalDeviceProperties(VkPhysicalDevice,
387 VkPhysicalDeviceProperties* properties) {
Jesse Hall26763382016-05-20 07:13:52 -0700388 properties->apiVersion = VK_MAKE_VERSION(1, 0, VK_HEADER_VERSION);
Jesse Hall04f4f472015-08-16 19:51:04 -0700389 properties->driverVersion = VK_MAKE_VERSION(0, 0, 1);
Jesse Hall65ab5522015-11-30 00:07:16 -0800390 properties->vendorID = 0;
391 properties->deviceID = 0;
Jesse Hall04f4f472015-08-16 19:51:04 -0700392 properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
393 strcpy(properties->deviceName, "Android Vulkan Null Driver");
394 memset(properties->pipelineCacheUUID, 0,
395 sizeof(properties->pipelineCacheUUID));
Jesse Hallc34849e2016-02-09 22:35:04 -0800396 properties->limits = VkPhysicalDeviceLimits{
397 4096, // maxImageDimension1D
398 4096, // maxImageDimension2D
399 256, // maxImageDimension3D
400 4096, // maxImageDimensionCube
401 256, // maxImageArrayLayers
402 65536, // maxTexelBufferElements
403 16384, // maxUniformBufferRange
404 1 << 27, // maxStorageBufferRange
405 128, // maxPushConstantsSize
406 4096, // maxMemoryAllocationCount
407 4000, // maxSamplerAllocationCount
408 1, // bufferImageGranularity
409 0, // sparseAddressSpaceSize
410 4, // maxBoundDescriptorSets
411 16, // maxPerStageDescriptorSamplers
412 12, // maxPerStageDescriptorUniformBuffers
413 4, // maxPerStageDescriptorStorageBuffers
414 16, // maxPerStageDescriptorSampledImages
415 4, // maxPerStageDescriptorStorageImages
416 4, // maxPerStageDescriptorInputAttachments
417 128, // maxPerStageResources
418 96, // maxDescriptorSetSamplers
419 72, // maxDescriptorSetUniformBuffers
420 8, // maxDescriptorSetUniformBuffersDynamic
421 24, // maxDescriptorSetStorageBuffers
422 4, // maxDescriptorSetStorageBuffersDynamic
423 96, // maxDescriptorSetSampledImages
424 24, // maxDescriptorSetStorageImages
425 4, // maxDescriptorSetInputAttachments
426 16, // maxVertexInputAttributes
427 16, // maxVertexInputBindings
428 2047, // maxVertexInputAttributeOffset
429 2048, // maxVertexInputBindingStride
430 64, // maxVertexOutputComponents
431 0, // maxTessellationGenerationLevel
432 0, // maxTessellationPatchSize
433 0, // maxTessellationControlPerVertexInputComponents
434 0, // maxTessellationControlPerVertexOutputComponents
435 0, // maxTessellationControlPerPatchOutputComponents
436 0, // maxTessellationControlTotalOutputComponents
437 0, // maxTessellationEvaluationInputComponents
438 0, // maxTessellationEvaluationOutputComponents
439 0, // maxGeometryShaderInvocations
440 0, // maxGeometryInputComponents
441 0, // maxGeometryOutputComponents
442 0, // maxGeometryOutputVertices
443 0, // maxGeometryTotalOutputComponents
444 64, // maxFragmentInputComponents
445 4, // maxFragmentOutputAttachments
446 0, // maxFragmentDualSrcAttachments
447 4, // maxFragmentCombinedOutputResources
448 16384, // maxComputeSharedMemorySize
449 {65536, 65536, 65536}, // maxComputeWorkGroupCount[3]
450 128, // maxComputeWorkGroupInvocations
451 {128, 128, 64}, // maxComputeWorkGroupSize[3]
452 4, // subPixelPrecisionBits
453 4, // subTexelPrecisionBits
454 4, // mipmapPrecisionBits
455 UINT32_MAX, // maxDrawIndexedIndexValue
456 1, // maxDrawIndirectCount
457 2, // maxSamplerLodBias
458 1, // maxSamplerAnisotropy
459 1, // maxViewports
460 {4096, 4096}, // maxViewportDimensions[2]
461 {-8192.0f, 8191.0f}, // viewportBoundsRange[2]
462 0, // viewportSubPixelBits
463 64, // minMemoryMapAlignment
464 256, // minTexelBufferOffsetAlignment
465 256, // minUniformBufferOffsetAlignment
466 256, // minStorageBufferOffsetAlignment
467 -8, // minTexelOffset
468 7, // maxTexelOffset
469 0, // minTexelGatherOffset
470 0, // maxTexelGatherOffset
471 0.0f, // minInterpolationOffset
472 0.0f, // maxInterpolationOffset
473 0, // subPixelInterpolationOffsetBits
474 4096, // maxFramebufferWidth
475 4096, // maxFramebufferHeight
476 256, // maxFramebufferLayers
477 VK_SAMPLE_COUNT_1_BIT |
478 VK_SAMPLE_COUNT_4_BIT, // framebufferColorSampleCounts
479 VK_SAMPLE_COUNT_1_BIT |
480 VK_SAMPLE_COUNT_4_BIT, // framebufferDepthSampleCounts
481 VK_SAMPLE_COUNT_1_BIT |
482 VK_SAMPLE_COUNT_4_BIT, // framebufferStencilSampleCounts
483 VK_SAMPLE_COUNT_1_BIT |
484 VK_SAMPLE_COUNT_4_BIT, // framebufferNoAttachmentsSampleCounts
485 4, // maxColorAttachments
486 VK_SAMPLE_COUNT_1_BIT |
487 VK_SAMPLE_COUNT_4_BIT, // sampledImageColorSampleCounts
488 VK_SAMPLE_COUNT_1_BIT, // sampledImageIntegerSampleCounts
489 VK_SAMPLE_COUNT_1_BIT |
490 VK_SAMPLE_COUNT_4_BIT, // sampledImageDepthSampleCounts
491 VK_SAMPLE_COUNT_1_BIT |
492 VK_SAMPLE_COUNT_4_BIT, // sampledImageStencilSampleCounts
493 VK_SAMPLE_COUNT_1_BIT, // storageImageSampleCounts
494 1, // maxSampleMaskWords
495 VK_TRUE, // timestampComputeAndGraphics
496 1, // timestampPeriod
497 0, // maxClipDistances
498 0, // maxCullDistances
499 0, // maxCombinedClipAndCullDistances
500 2, // discreteQueuePriorities
501 {1.0f, 1.0f}, // pointSizeRange[2]
502 {1.0f, 1.0f}, // lineWidthRange[2]
503 0.0f, // pointSizeGranularity
504 0.0f, // lineWidthGranularity
505 VK_TRUE, // strictLines
506 VK_TRUE, // standardSampleLocations
507 1, // optimalBufferCopyOffsetAlignment
508 1, // optimalBufferCopyRowPitchAlignment
509 64, // nonCoherentAtomSize
510 };
Jesse Hall04f4f472015-08-16 19:51:04 -0700511}
512
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300513void GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physical_device,
514 VkPhysicalDeviceProperties2KHR* properties) {
515 GetPhysicalDeviceProperties(physical_device, &properties->properties);
Chris Forbesb4eb2782017-03-15 16:09:15 +1300516
517 while (properties->pNext) {
518 properties = reinterpret_cast<VkPhysicalDeviceProperties2KHR *>(properties->pNext);
519
520#pragma clang diagnostic push
521#pragma clang diagnostic ignored "-Wold-style-cast"
522 switch ((VkFlags)properties->sType) {
523 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID: {
524 VkPhysicalDevicePresentationPropertiesANDROID *presentation_properties =
525 reinterpret_cast<VkPhysicalDevicePresentationPropertiesANDROID *>(properties);
526#pragma clang diagnostic pop
527
528 // Claim that we do all the right things for the loader to
529 // expose KHR_shared_presentable_image on our behalf.
530 presentation_properties->sharedImage = VK_TRUE;
531 } break;
532
533 default:
534 // Silently ignore other extension query structs
535 break;
536 }
537 }
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300538}
539
Jesse Hall606a54e2015-11-19 22:17:28 -0800540void GetPhysicalDeviceQueueFamilyProperties(
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700541 VkPhysicalDevice,
542 uint32_t* count,
543 VkQueueFamilyProperties* properties) {
Jesse Hall715b86a2016-01-16 16:34:29 -0800544 if (!properties || *count > 1)
545 *count = 1;
546 if (properties && *count == 1) {
Jesse Hall65ab5522015-11-30 00:07:16 -0800547 properties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT |
548 VK_QUEUE_TRANSFER_BIT;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700549 properties->queueCount = 1;
Jesse Hallacfa5342015-11-19 21:51:33 -0800550 properties->timestampValidBits = 64;
Jesse Hall715b86a2016-01-16 16:34:29 -0800551 properties->minImageTransferGranularity = VkExtent3D{1, 1, 1};
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700552 }
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700553}
554
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300555void GetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physical_device, uint32_t* count, VkQueueFamilyProperties2KHR* properties) {
556 // note: even though multiple structures, this is safe to forward in this
557 // case since we only expose one queue family.
558 GetPhysicalDeviceQueueFamilyProperties(physical_device, count, properties ? &properties->queueFamilyProperties : nullptr);
559}
560
Jesse Hall606a54e2015-11-19 22:17:28 -0800561void GetPhysicalDeviceMemoryProperties(
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100562 VkPhysicalDevice,
563 VkPhysicalDeviceMemoryProperties* properties) {
564 properties->memoryTypeCount = 1;
565 properties->memoryTypes[0].propertyFlags =
Jesse Halld1af8122015-11-29 23:50:38 -0800566 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
567 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
568 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
569 VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100570 properties->memoryTypes[0].heapIndex = 0;
571 properties->memoryHeapCount = 1;
Jesse Hallbde8ee32015-09-01 16:24:29 -0700572 properties->memoryHeaps[0].size = kMaxDeviceMemory;
Jesse Halld1af8122015-11-29 23:50:38 -0800573 properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
Jesse Hall04f4f472015-08-16 19:51:04 -0700574}
575
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300576void GetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceMemoryProperties2KHR* properties) {
577 GetPhysicalDeviceMemoryProperties(physical_device, &properties->memoryProperties);
578}
579
Jesse Hall8e37cf32016-01-18 04:00:57 -0800580void GetPhysicalDeviceFeatures(VkPhysicalDevice /*gpu*/,
581 VkPhysicalDeviceFeatures* features) {
582 *features = VkPhysicalDeviceFeatures{
583 VK_TRUE, // robustBufferAccess
584 VK_FALSE, // fullDrawIndexUint32
585 VK_FALSE, // imageCubeArray
586 VK_FALSE, // independentBlend
587 VK_FALSE, // geometryShader
588 VK_FALSE, // tessellationShader
589 VK_FALSE, // sampleRateShading
590 VK_FALSE, // dualSrcBlend
591 VK_FALSE, // logicOp
592 VK_FALSE, // multiDrawIndirect
593 VK_FALSE, // drawIndirectFirstInstance
594 VK_FALSE, // depthClamp
595 VK_FALSE, // depthBiasClamp
596 VK_FALSE, // fillModeNonSolid
597 VK_FALSE, // depthBounds
598 VK_FALSE, // wideLines
599 VK_FALSE, // largePoints
600 VK_FALSE, // alphaToOne
601 VK_FALSE, // multiViewport
602 VK_FALSE, // samplerAnisotropy
603 VK_FALSE, // textureCompressionETC2
604 VK_FALSE, // textureCompressionASTC_LDR
605 VK_FALSE, // textureCompressionBC
606 VK_FALSE, // occlusionQueryPrecise
607 VK_FALSE, // pipelineStatisticsQuery
608 VK_FALSE, // vertexPipelineStoresAndAtomics
609 VK_FALSE, // fragmentStoresAndAtomics
610 VK_FALSE, // shaderTessellationAndGeometryPointSize
611 VK_FALSE, // shaderImageGatherExtended
612 VK_FALSE, // shaderStorageImageExtendedFormats
613 VK_FALSE, // shaderStorageImageMultisample
614 VK_FALSE, // shaderStorageImageReadWithoutFormat
615 VK_FALSE, // shaderStorageImageWriteWithoutFormat
616 VK_FALSE, // shaderUniformBufferArrayDynamicIndexing
617 VK_FALSE, // shaderSampledImageArrayDynamicIndexing
618 VK_FALSE, // shaderStorageBufferArrayDynamicIndexing
619 VK_FALSE, // shaderStorageImageArrayDynamicIndexing
620 VK_FALSE, // shaderClipDistance
621 VK_FALSE, // shaderCullDistance
622 VK_FALSE, // shaderFloat64
623 VK_FALSE, // shaderInt64
624 VK_FALSE, // shaderInt16
625 VK_FALSE, // shaderResourceResidency
626 VK_FALSE, // shaderResourceMinLod
627 VK_FALSE, // sparseBinding
628 VK_FALSE, // sparseResidencyBuffer
629 VK_FALSE, // sparseResidencyImage2D
630 VK_FALSE, // sparseResidencyImage3D
631 VK_FALSE, // sparseResidency2Samples
632 VK_FALSE, // sparseResidency4Samples
633 VK_FALSE, // sparseResidency8Samples
634 VK_FALSE, // sparseResidency16Samples
635 VK_FALSE, // sparseResidencyAliased
636 VK_FALSE, // variableMultisampleRate
637 VK_FALSE, // inheritedQueries
638 };
639}
640
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300641void GetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceFeatures2KHR* features) {
642 GetPhysicalDeviceFeatures(physical_device, &features->features);
643}
644
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100645// -----------------------------------------------------------------------------
646// Device
647
Jesse Hall04f4f472015-08-16 19:51:04 -0700648VkResult CreateDevice(VkPhysicalDevice physical_device,
Jesse Hallb1471272016-01-17 21:36:58 -0800649 const VkDeviceCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800650 const VkAllocationCallbacks* allocator,
Jesse Hall04f4f472015-08-16 19:51:04 -0700651 VkDevice* out_device) {
652 VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800653 if (!allocator)
654 allocator = &instance->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800655 VkDevice_T* device = static_cast<VkDevice_T*>(allocator->pfnAllocation(
656 allocator->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T),
657 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE));
Jesse Hall04f4f472015-08-16 19:51:04 -0700658 if (!device)
659 return VK_ERROR_OUT_OF_HOST_MEMORY;
660
661 device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800662 device->allocator = *allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700663 device->instance = instance;
664 device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700665 std::fill(device->next_handle.begin(), device->next_handle.end(),
666 UINT64_C(0));
Jesse Hall04f4f472015-08-16 19:51:04 -0700667
Jesse Hallb1471272016-01-17 21:36:58 -0800668 for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
669 if (strcmp(create_info->ppEnabledExtensionNames[i],
670 VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME) == 0) {
671 ALOGV("Enabling " VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME);
672 }
673 }
674
Jesse Hall04f4f472015-08-16 19:51:04 -0700675 *out_device = device;
676 return VK_SUCCESS;
677}
678
Jesse Hall3fbc8562015-11-29 22:10:52 -0800679void DestroyDevice(VkDevice device,
680 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700681 if (!device)
Jesse Hallcf25c412015-10-29 17:14:50 -0700682 return;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800683 device->allocator.pfnFree(device->allocator.pUserData, device);
Jesse Hall04f4f472015-08-16 19:51:04 -0700684}
685
Jesse Hall606a54e2015-11-19 22:17:28 -0800686void GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700687 *queue = &device->queue;
Jesse Hall04f4f472015-08-16 19:51:04 -0700688}
689
690// -----------------------------------------------------------------------------
Jesse Hall3fbc8562015-11-29 22:10:52 -0800691// CommandPool
Jesse Hall03b6fe12015-11-24 12:44:21 -0800692
Jesse Hall3fbc8562015-11-29 22:10:52 -0800693struct CommandPool {
694 typedef VkCommandPool HandleType;
695 VkAllocationCallbacks allocator;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800696};
Jesse Hall3fbc8562015-11-29 22:10:52 -0800697DEFINE_OBJECT_HANDLE_CONVERSION(CommandPool)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800698
699VkResult CreateCommandPool(VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800700 const VkCommandPoolCreateInfo* /*create_info*/,
701 const VkAllocationCallbacks* allocator,
702 VkCommandPool* cmd_pool) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800703 if (!allocator)
704 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800705 CommandPool* pool = static_cast<CommandPool*>(allocator->pfnAllocation(
706 allocator->pUserData, sizeof(CommandPool), alignof(CommandPool),
707 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall03b6fe12015-11-24 12:44:21 -0800708 if (!pool)
709 return VK_ERROR_OUT_OF_HOST_MEMORY;
710 pool->allocator = *allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800711 *cmd_pool = GetHandleToCommandPool(pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800712 return VK_SUCCESS;
713}
714
715void DestroyCommandPool(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800716 VkCommandPool cmd_pool,
717 const VkAllocationCallbacks* /*allocator*/) {
718 CommandPool* pool = GetCommandPoolFromHandle(cmd_pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800719 pool->allocator.pfnFree(pool->allocator.pUserData, pool);
720}
721
722// -----------------------------------------------------------------------------
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700723// CmdBuffer
724
Jesse Hall3fbc8562015-11-29 22:10:52 -0800725VkResult AllocateCommandBuffers(VkDevice /*device*/,
726 const VkCommandBufferAllocateInfo* alloc_info,
727 VkCommandBuffer* cmdbufs) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800728 VkResult result = VK_SUCCESS;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800729 CommandPool& pool = *GetCommandPoolFromHandle(alloc_info->commandPool);
Jesse Hall3dd678a2016-01-08 21:52:01 -0800730 std::fill(cmdbufs, cmdbufs + alloc_info->commandBufferCount, nullptr);
731 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800732 cmdbufs[i] =
733 static_cast<VkCommandBuffer_T*>(pool.allocator.pfnAllocation(
734 pool.allocator.pUserData, sizeof(VkCommandBuffer_T),
735 alignof(VkCommandBuffer_T), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallfbf97b02015-11-20 14:17:03 -0800736 if (!cmdbufs[i]) {
737 result = VK_ERROR_OUT_OF_HOST_MEMORY;
738 break;
739 }
740 cmdbufs[i]->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
741 }
742 if (result != VK_SUCCESS) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800743 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800744 if (!cmdbufs[i])
745 break;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800746 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800747 }
748 }
Jesse Hallfbf97b02015-11-20 14:17:03 -0800749 return result;
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700750}
751
Jesse Hall03b6fe12015-11-24 12:44:21 -0800752void FreeCommandBuffers(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800753 VkCommandPool cmd_pool,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800754 uint32_t count,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800755 const VkCommandBuffer* cmdbufs) {
756 CommandPool& pool = *GetCommandPoolFromHandle(cmd_pool);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800757 for (uint32_t i = 0; i < count; i++)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800758 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700759}
760
761// -----------------------------------------------------------------------------
Jesse Hall2077ce02015-08-29 18:10:59 +0100762// DeviceMemory
763
764struct DeviceMemory {
765 typedef VkDeviceMemory HandleType;
766 VkDeviceSize size;
767 alignas(16) uint8_t data[0];
768};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800769DEFINE_OBJECT_HANDLE_CONVERSION(DeviceMemory)
Jesse Hall2077ce02015-08-29 18:10:59 +0100770
Jesse Hall3fbc8562015-11-29 22:10:52 -0800771VkResult AllocateMemory(VkDevice device,
772 const VkMemoryAllocateInfo* alloc_info,
773 const VkAllocationCallbacks* allocator,
774 VkDeviceMemory* mem_handle) {
Jesse Hall2077ce02015-08-29 18:10:59 +0100775 if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize)
776 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800777 if (!allocator)
778 allocator = &device->allocator;
Jesse Hall2077ce02015-08-29 18:10:59 +0100779
Jesse Hall2077ce02015-08-29 18:10:59 +0100780 size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize);
Jesse Hall3fbc8562015-11-29 22:10:52 -0800781 DeviceMemory* mem = static_cast<DeviceMemory*>(allocator->pfnAllocation(
782 allocator->pUserData, size, alignof(DeviceMemory),
783 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall2077ce02015-08-29 18:10:59 +0100784 if (!mem)
785 return VK_ERROR_OUT_OF_HOST_MEMORY;
786 mem->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800787 *mem_handle = GetHandleToDeviceMemory(mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100788 return VK_SUCCESS;
789}
790
Jesse Hall03b6fe12015-11-24 12:44:21 -0800791void FreeMemory(VkDevice device,
792 VkDeviceMemory mem_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800793 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800794 if (!allocator)
795 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800796 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800797 allocator->pfnFree(allocator->pUserData, mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100798}
799
800VkResult MapMemory(VkDevice,
801 VkDeviceMemory mem_handle,
802 VkDeviceSize offset,
803 VkDeviceSize,
804 VkMemoryMapFlags,
805 void** out_ptr) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800806 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall2077ce02015-08-29 18:10:59 +0100807 *out_ptr = &mem->data[0] + offset;
808 return VK_SUCCESS;
809}
810
811// -----------------------------------------------------------------------------
Jesse Hallf6578742015-08-29 17:06:12 +0100812// Buffer
813
814struct Buffer {
815 typedef VkBuffer HandleType;
816 VkDeviceSize size;
817};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800818DEFINE_OBJECT_HANDLE_CONVERSION(Buffer)
Jesse Hallf6578742015-08-29 17:06:12 +0100819
820VkResult CreateBuffer(VkDevice device,
821 const VkBufferCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800822 const VkAllocationCallbacks* allocator,
Jesse Hallf6578742015-08-29 17:06:12 +0100823 VkBuffer* buffer_handle) {
Jesse Hallbde8ee32015-09-01 16:24:29 -0700824 ALOGW_IF(create_info->size > kMaxDeviceMemory,
825 "CreateBuffer: requested size 0x%" PRIx64
826 " exceeds max device memory size 0x%" PRIx64,
827 create_info->size, kMaxDeviceMemory);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800828 if (!allocator)
829 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800830 Buffer* buffer = static_cast<Buffer*>(allocator->pfnAllocation(
831 allocator->pUserData, sizeof(Buffer), alignof(Buffer),
832 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallf6578742015-08-29 17:06:12 +0100833 if (!buffer)
834 return VK_ERROR_OUT_OF_HOST_MEMORY;
835 buffer->size = create_info->size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800836 *buffer_handle = GetHandleToBuffer(buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100837 return VK_SUCCESS;
838}
839
Jesse Hall606a54e2015-11-19 22:17:28 -0800840void GetBufferMemoryRequirements(VkDevice,
841 VkBuffer buffer_handle,
842 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800843 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hallf6578742015-08-29 17:06:12 +0100844 requirements->size = buffer->size;
845 requirements->alignment = 16; // allow fast Neon/SSE memcpy
846 requirements->memoryTypeBits = 0x1;
Jesse Hallf6578742015-08-29 17:06:12 +0100847}
848
Jesse Hall03b6fe12015-11-24 12:44:21 -0800849void DestroyBuffer(VkDevice device,
850 VkBuffer buffer_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800851 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800852 if (!allocator)
853 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800854 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800855 allocator->pfnFree(allocator->pUserData, buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100856}
857
858// -----------------------------------------------------------------------------
Jesse Hall85c05b62015-09-01 18:07:41 -0700859// Image
860
861struct Image {
862 typedef VkImage HandleType;
863 VkDeviceSize size;
864};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800865DEFINE_OBJECT_HANDLE_CONVERSION(Image)
Jesse Hall85c05b62015-09-01 18:07:41 -0700866
867VkResult CreateImage(VkDevice device,
868 const VkImageCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800869 const VkAllocationCallbacks* allocator,
Jesse Hall85c05b62015-09-01 18:07:41 -0700870 VkImage* image_handle) {
871 if (create_info->imageType != VK_IMAGE_TYPE_2D ||
872 create_info->format != VK_FORMAT_R8G8B8A8_UNORM ||
873 create_info->mipLevels != 1) {
874 ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u",
875 create_info->imageType, create_info->format,
876 create_info->mipLevels);
Jesse Halla15a4bf2015-11-19 22:48:02 -0800877 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall85c05b62015-09-01 18:07:41 -0700878 }
879
880 VkDeviceSize size =
881 VkDeviceSize(create_info->extent.width * create_info->extent.height) *
Jesse Halla15a4bf2015-11-19 22:48:02 -0800882 create_info->arrayLayers * create_info->samples * 4u;
Jesse Hall85c05b62015-09-01 18:07:41 -0700883 ALOGW_IF(size > kMaxDeviceMemory,
884 "CreateImage: image size 0x%" PRIx64
885 " exceeds max device memory size 0x%" PRIx64,
886 size, kMaxDeviceMemory);
887
Jesse Hall03b6fe12015-11-24 12:44:21 -0800888 if (!allocator)
889 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800890 Image* image = static_cast<Image*>(allocator->pfnAllocation(
891 allocator->pUserData, sizeof(Image), alignof(Image),
892 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall85c05b62015-09-01 18:07:41 -0700893 if (!image)
894 return VK_ERROR_OUT_OF_HOST_MEMORY;
895 image->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800896 *image_handle = GetHandleToImage(image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700897 return VK_SUCCESS;
898}
899
Jesse Hall606a54e2015-11-19 22:17:28 -0800900void GetImageMemoryRequirements(VkDevice,
901 VkImage image_handle,
902 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800903 Image* image = GetImageFromHandle(image_handle);
Jesse Hall85c05b62015-09-01 18:07:41 -0700904 requirements->size = image->size;
905 requirements->alignment = 16; // allow fast Neon/SSE memcpy
906 requirements->memoryTypeBits = 0x1;
Jesse Hall85c05b62015-09-01 18:07:41 -0700907}
908
Jesse Hall03b6fe12015-11-24 12:44:21 -0800909void DestroyImage(VkDevice device,
910 VkImage image_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800911 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800912 if (!allocator)
913 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800914 Image* image = GetImageFromHandle(image_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800915 allocator->pfnFree(allocator->pUserData, image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700916}
917
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800918VkResult GetSwapchainGrallocUsageANDROID(VkDevice,
919 VkFormat,
920 VkImageUsageFlags,
921 int* grallocUsage) {
922 // The null driver never reads or writes the gralloc buffer
923 *grallocUsage = 0;
924 return VK_SUCCESS;
925}
926
Chris Forbes8e4438b2016-12-07 16:26:49 +1300927VkResult GetSwapchainGrallocUsage2ANDROID(VkDevice,
928 VkFormat,
929 VkImageUsageFlags,
930 VkSwapchainImageUsageFlagsANDROID,
Jesse Halld1abd742017-02-09 21:45:51 -0800931 uint64_t* grallocConsumerUsage,
932 uint64_t* grallocProducerUsage) {
Chris Forbes8e4438b2016-12-07 16:26:49 +1300933 // The null driver never reads or writes the gralloc buffer
Jesse Halld1abd742017-02-09 21:45:51 -0800934 *grallocConsumerUsage = 0;
935 *grallocProducerUsage = 0;
Chris Forbes8e4438b2016-12-07 16:26:49 +1300936 return VK_SUCCESS;
937}
938
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800939VkResult AcquireImageANDROID(VkDevice,
940 VkImage,
941 int fence,
942 VkSemaphore,
943 VkFence) {
944 close(fence);
945 return VK_SUCCESS;
946}
947
948VkResult QueueSignalReleaseImageANDROID(VkQueue,
949 uint32_t,
950 const VkSemaphore*,
951 VkImage,
952 int* fence) {
953 *fence = -1;
954 return VK_SUCCESS;
955}
956
Jesse Hall85c05b62015-09-01 18:07:41 -0700957// -----------------------------------------------------------------------------
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700958// No-op types
959
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700960VkResult CreateBufferView(VkDevice device,
961 const VkBufferViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800962 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700963 VkBufferView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800964 *view = AllocHandle<VkBufferView>(device, HandleType::kBufferView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700965 return VK_SUCCESS;
966}
967
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700968VkResult CreateDescriptorPool(VkDevice device,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700969 const VkDescriptorPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800970 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700971 VkDescriptorPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800972 *pool = AllocHandle<VkDescriptorPool>(device, HandleType::kDescriptorPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700973 return VK_SUCCESS;
974}
975
Jesse Hall3fbc8562015-11-29 22:10:52 -0800976VkResult AllocateDescriptorSets(VkDevice device,
977 const VkDescriptorSetAllocateInfo* alloc_info,
978 VkDescriptorSet* descriptor_sets) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800979 for (uint32_t i = 0; i < alloc_info->descriptorSetCount; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800980 descriptor_sets[i] =
981 AllocHandle<VkDescriptorSet>(device, HandleType::kDescriptorSet);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700982 return VK_SUCCESS;
983}
984
985VkResult CreateDescriptorSetLayout(VkDevice device,
986 const VkDescriptorSetLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800987 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700988 VkDescriptorSetLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800989 *layout = AllocHandle<VkDescriptorSetLayout>(
990 device, HandleType::kDescriptorSetLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700991 return VK_SUCCESS;
992}
993
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700994VkResult CreateEvent(VkDevice device,
995 const VkEventCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800996 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700997 VkEvent* event) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800998 *event = AllocHandle<VkEvent>(device, HandleType::kEvent);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700999 return VK_SUCCESS;
1000}
1001
1002VkResult CreateFence(VkDevice device,
1003 const VkFenceCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001004 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001005 VkFence* fence) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001006 *fence = AllocHandle<VkFence>(device, HandleType::kFence);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001007 return VK_SUCCESS;
1008}
1009
1010VkResult CreateFramebuffer(VkDevice device,
1011 const VkFramebufferCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001012 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001013 VkFramebuffer* framebuffer) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001014 *framebuffer = AllocHandle<VkFramebuffer>(device, HandleType::kFramebuffer);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001015 return VK_SUCCESS;
1016}
1017
1018VkResult CreateImageView(VkDevice device,
1019 const VkImageViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001020 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001021 VkImageView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001022 *view = AllocHandle<VkImageView>(device, HandleType::kImageView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001023 return VK_SUCCESS;
1024}
1025
1026VkResult CreateGraphicsPipelines(VkDevice device,
1027 VkPipelineCache,
1028 uint32_t count,
1029 const VkGraphicsPipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001030 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001031 VkPipeline* pipelines) {
1032 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -08001033 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001034 return VK_SUCCESS;
1035}
1036
1037VkResult CreateComputePipelines(VkDevice device,
1038 VkPipelineCache,
1039 uint32_t count,
1040 const VkComputePipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001041 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001042 VkPipeline* pipelines) {
1043 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -08001044 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001045 return VK_SUCCESS;
1046}
1047
1048VkResult CreatePipelineCache(VkDevice device,
1049 const VkPipelineCacheCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001050 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001051 VkPipelineCache* cache) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001052 *cache = AllocHandle<VkPipelineCache>(device, HandleType::kPipelineCache);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001053 return VK_SUCCESS;
1054}
1055
1056VkResult CreatePipelineLayout(VkDevice device,
1057 const VkPipelineLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001058 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001059 VkPipelineLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001060 *layout =
1061 AllocHandle<VkPipelineLayout>(device, HandleType::kPipelineLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001062 return VK_SUCCESS;
1063}
1064
1065VkResult CreateQueryPool(VkDevice device,
1066 const VkQueryPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001067 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001068 VkQueryPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001069 *pool = AllocHandle<VkQueryPool>(device, HandleType::kQueryPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001070 return VK_SUCCESS;
1071}
1072
1073VkResult CreateRenderPass(VkDevice device,
1074 const VkRenderPassCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001075 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001076 VkRenderPass* renderpass) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001077 *renderpass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001078 return VK_SUCCESS;
1079}
1080
1081VkResult CreateSampler(VkDevice device,
1082 const VkSamplerCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001083 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001084 VkSampler* sampler) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001085 *sampler = AllocHandle<VkSampler>(device, HandleType::kSampler);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001086 return VK_SUCCESS;
1087}
1088
1089VkResult CreateSemaphore(VkDevice device,
1090 const VkSemaphoreCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001091 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001092 VkSemaphore* semaphore) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001093 *semaphore = AllocHandle<VkSemaphore>(device, HandleType::kSemaphore);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001094 return VK_SUCCESS;
1095}
1096
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001097VkResult CreateShaderModule(VkDevice device,
1098 const VkShaderModuleCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001099 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001100 VkShaderModule* module) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001101 *module = AllocHandle<VkShaderModule>(device, HandleType::kShaderModule);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001102 return VK_SUCCESS;
1103}
1104
Jesse Hall715b86a2016-01-16 16:34:29 -08001105VkResult CreateDebugReportCallbackEXT(VkInstance instance,
1106 const VkDebugReportCallbackCreateInfoEXT*,
1107 const VkAllocationCallbacks*,
1108 VkDebugReportCallbackEXT* callback) {
1109 *callback = AllocHandle<VkDebugReportCallbackEXT>(
1110 instance, HandleType::kDebugReportCallbackEXT);
1111 return VK_SUCCESS;
1112}
1113
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001114// -----------------------------------------------------------------------------
Jesse Hall04f4f472015-08-16 19:51:04 -07001115// No-op entrypoints
1116
1117// clang-format off
1118#pragma clang diagnostic push
1119#pragma clang diagnostic ignored "-Wunused-parameter"
1120
Jesse Hall606a54e2015-11-19 22:17:28 -08001121void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001122 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001123}
1124
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001125void GetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR* pFormatProperties) {
1126 ALOGV("TODO: vk%s", __FUNCTION__);
1127}
1128
Jesse Halla9e57032015-11-30 01:03:10 -08001129VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001130 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Halla9e57032015-11-30 01:03:10 -08001131 return VK_SUCCESS;
Jesse Hall04f4f472015-08-16 19:51:04 -07001132}
1133
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001134VkResult GetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1135 const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo,
1136 VkImageFormatProperties2KHR* pImageFormatProperties) {
1137 ALOGV("TODO: vk%s", __FUNCTION__);
1138 return VK_SUCCESS;
1139}
1140
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001141VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001142 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001143 return VK_SUCCESS;
1144}
1145
Jesse Halla366a512015-11-19 22:30:07 -08001146VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001147 return VK_SUCCESS;
1148}
1149
1150VkResult QueueWaitIdle(VkQueue queue) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001151 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001152 return VK_SUCCESS;
1153}
1154
1155VkResult DeviceWaitIdle(VkDevice device) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001156 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001157 return VK_SUCCESS;
1158}
1159
Jesse Hallcf25c412015-10-29 17:14:50 -07001160void UnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001161}
1162
1163VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001164 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001165 return VK_SUCCESS;
1166}
1167
1168VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001169 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001170 return VK_SUCCESS;
1171}
1172
Jesse Hall606a54e2015-11-19 22:17:28 -08001173void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001174 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001175}
1176
Jesse Hall04f4f472015-08-16 19:51:04 -07001177VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset) {
1178 return VK_SUCCESS;
1179}
1180
Jesse Hall04f4f472015-08-16 19:51:04 -07001181VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset) {
1182 return VK_SUCCESS;
1183}
1184
Jesse Hall606a54e2015-11-19 22:17:28 -08001185void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001186 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001187}
1188
Jesse Hall091ed9e2015-11-30 00:55:29 -08001189void 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 +01001190 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001191}
1192
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001193void GetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1194 VkPhysicalDeviceSparseImageFormatInfo2KHR const* pInfo,
1195 unsigned int* pNumProperties,
1196 VkSparseImageFormatProperties2KHR* pProperties) {
1197 ALOGV("TODO: vk%s", __FUNCTION__);
1198}
1199
1200
Jesse Halla6429252015-11-29 18:59:42 -08001201VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001202 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001203 return VK_SUCCESS;
1204}
1205
Jesse Hall3fbc8562015-11-29 22:10:52 -08001206void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001207}
1208
1209VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
1210 return VK_SUCCESS;
1211}
1212
1213VkResult GetFenceStatus(VkDevice device, 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
1218VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
1219 return VK_SUCCESS;
1220}
1221
Jesse Hall3fbc8562015-11-29 22:10:52 -08001222void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001223}
1224
Jesse Hall3fbc8562015-11-29 22:10:52 -08001225void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001226}
1227
1228VkResult GetEventStatus(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001229 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001230 return VK_SUCCESS;
1231}
1232
1233VkResult SetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001234 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001235 return VK_SUCCESS;
1236}
1237
1238VkResult ResetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001239 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001240 return VK_SUCCESS;
1241}
1242
Jesse Hall3fbc8562015-11-29 22:10:52 -08001243void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001244}
1245
Jesse Halla9bb62b2015-11-21 19:31:56 -08001246VkResult 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 +01001247 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001248 return VK_SUCCESS;
1249}
1250
Jesse Hall3fbc8562015-11-29 22:10:52 -08001251void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001252}
1253
Jesse Hall606a54e2015-11-19 22:17:28 -08001254void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001255 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001256}
1257
Jesse Hall3fbc8562015-11-29 22:10:52 -08001258void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001259}
1260
Jesse Hall3fbc8562015-11-29 22:10:52 -08001261void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001262}
1263
Jesse Hall3fbc8562015-11-29 22:10:52 -08001264void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001265}
1266
Jesse Halla9bb62b2015-11-21 19:31:56 -08001267VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001268 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001269 return VK_SUCCESS;
1270}
1271
1272VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001273 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001274 return VK_SUCCESS;
1275}
1276
Jesse Hall3fbc8562015-11-29 22:10:52 -08001277void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001278}
1279
Jesse Hall3fbc8562015-11-29 22:10:52 -08001280void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001281}
1282
Jesse Hall3fbc8562015-11-29 22:10:52 -08001283void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001284}
1285
Jesse Hall3fbc8562015-11-29 22:10:52 -08001286void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001287}
1288
Jesse Hall3fbc8562015-11-29 22:10:52 -08001289void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001290}
1291
Jesse Hallfbf97b02015-11-20 14:17:03 -08001292VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001293 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001294 return VK_SUCCESS;
1295}
1296
Jesse Hallcf25c412015-10-29 17:14:50 -07001297void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001298 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001299}
1300
1301VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001302 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001303 return VK_SUCCESS;
1304}
1305
Jesse Hall3fbc8562015-11-29 22:10:52 -08001306void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001307}
1308
Jesse Hall3fbc8562015-11-29 22:10:52 -08001309void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001310}
1311
Jesse Hall606a54e2015-11-19 22:17:28 -08001312void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001313 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001314}
1315
Jesse Hall3fbc8562015-11-29 22:10:52 -08001316VkResult ResetCommandPool(VkDevice device, VkCommandPool cmdPool, VkCommandPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001317 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001318 return VK_SUCCESS;
1319}
1320
Jesse Hall3fbc8562015-11-29 22:10:52 -08001321VkResult BeginCommandBuffer(VkCommandBuffer cmdBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001322 return VK_SUCCESS;
1323}
1324
Jesse Hall3fbc8562015-11-29 22:10:52 -08001325VkResult EndCommandBuffer(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001326 return VK_SUCCESS;
1327}
1328
Jesse Hall3fbc8562015-11-29 22:10:52 -08001329VkResult ResetCommandBuffer(VkCommandBuffer cmdBuffer, VkCommandBufferResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001330 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001331 return VK_SUCCESS;
1332}
1333
Jesse Hall3fbc8562015-11-29 22:10:52 -08001334void CmdBindPipeline(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001335}
1336
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001337void CmdSetViewport(VkCommandBuffer cmdBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001338}
1339
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001340void CmdSetScissor(VkCommandBuffer cmdBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001341}
1342
Jesse Hall3fbc8562015-11-29 22:10:52 -08001343void CmdSetLineWidth(VkCommandBuffer cmdBuffer, float lineWidth) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001344}
1345
Jesse Hall3fbc8562015-11-29 22:10:52 -08001346void CmdSetDepthBias(VkCommandBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001347}
1348
Jesse Hall3fbc8562015-11-29 22:10:52 -08001349void CmdSetBlendConstants(VkCommandBuffer cmdBuffer, const float blendConst[4]) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001350}
1351
Jesse Hall3fbc8562015-11-29 22:10:52 -08001352void CmdSetDepthBounds(VkCommandBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001353}
1354
Jesse Hall3fbc8562015-11-29 22:10:52 -08001355void CmdSetStencilCompareMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001356}
1357
Jesse Hall3fbc8562015-11-29 22:10:52 -08001358void CmdSetStencilWriteMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001359}
1360
Jesse Hall3fbc8562015-11-29 22:10:52 -08001361void CmdSetStencilReference(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001362}
1363
Jesse Hall3fbc8562015-11-29 22:10:52 -08001364void 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 -07001365}
1366
Jesse Hall3fbc8562015-11-29 22:10:52 -08001367void CmdBindIndexBuffer(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001368}
1369
Jesse Hall3fbc8562015-11-29 22:10:52 -08001370void CmdBindVertexBuffers(VkCommandBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001371}
1372
Jesse Hall3fbc8562015-11-29 22:10:52 -08001373void CmdDraw(VkCommandBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001374}
1375
Jesse Hall3fbc8562015-11-29 22:10:52 -08001376void 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 -07001377}
1378
Jesse Hall3fbc8562015-11-29 22:10:52 -08001379void CmdDrawIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001380}
1381
Jesse Hall3fbc8562015-11-29 22:10:52 -08001382void CmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001383}
1384
Jesse Hall3fbc8562015-11-29 22:10:52 -08001385void CmdDispatch(VkCommandBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001386}
1387
Jesse Hall3fbc8562015-11-29 22:10:52 -08001388void CmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001389}
1390
Jesse Hall3fbc8562015-11-29 22:10:52 -08001391void CmdCopyBuffer(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001392}
1393
Jesse Hall3fbc8562015-11-29 22:10:52 -08001394void CmdCopyImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001395}
1396
Jesse Hall3fbc8562015-11-29 22:10:52 -08001397void 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 -07001398}
1399
Jesse Hall3fbc8562015-11-29 22:10:52 -08001400void CmdCopyBufferToImage(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001401}
1402
Jesse Hall3fbc8562015-11-29 22:10:52 -08001403void CmdCopyImageToBuffer(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001404}
1405
Jesse Hall56d386a2016-07-26 15:20:40 -07001406void CmdUpdateBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const void* pData) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001407}
1408
Jesse Hall3fbc8562015-11-29 22:10:52 -08001409void CmdFillBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001410}
1411
Jesse Hall3fbc8562015-11-29 22:10:52 -08001412void CmdClearColorImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001413}
1414
Jesse Hall3fbc8562015-11-29 22:10:52 -08001415void CmdClearDepthStencilImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001416}
1417
Jesse Hall3fbc8562015-11-29 22:10:52 -08001418void CmdClearAttachments(VkCommandBuffer cmdBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001419}
1420
Jesse Hall3fbc8562015-11-29 22:10:52 -08001421void CmdResolveImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001422}
1423
Jesse Hall3fbc8562015-11-29 22:10:52 -08001424void CmdSetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001425}
1426
Jesse Hall3fbc8562015-11-29 22:10:52 -08001427void CmdResetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001428}
1429
Jesse Hall3dd678a2016-01-08 21:52:01 -08001430void 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 -07001431}
1432
Jesse Hall3dd678a2016-01-08 21:52:01 -08001433void 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 -07001434}
1435
Jesse Hall3fbc8562015-11-29 22:10:52 -08001436void CmdBeginQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001437}
1438
Jesse Hall3fbc8562015-11-29 22:10:52 -08001439void CmdEndQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001440}
1441
Jesse Hall3fbc8562015-11-29 22:10:52 -08001442void CmdResetQueryPool(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001443}
1444
Jesse Hall3fbc8562015-11-29 22:10:52 -08001445void CmdWriteTimestamp(VkCommandBuffer cmdBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001446}
1447
Jesse Hall3fbc8562015-11-29 22:10:52 -08001448void 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 -07001449}
1450
Jesse Hall3fbc8562015-11-29 22:10:52 -08001451void CmdPushConstants(VkCommandBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001452}
1453
Jesse Hall65ab5522015-11-30 00:07:16 -08001454void CmdBeginRenderPass(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001455}
1456
Jesse Hall65ab5522015-11-30 00:07:16 -08001457void CmdNextSubpass(VkCommandBuffer cmdBuffer, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001458}
1459
Jesse Hall3fbc8562015-11-29 22:10:52 -08001460void CmdEndRenderPass(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001461}
1462
Jesse Hall3fbc8562015-11-29 22:10:52 -08001463void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001464}
1465
Jesse Hall715b86a2016-01-16 16:34:29 -08001466void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator) {
1467}
1468
1469void DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage) {
1470}
1471
Jesse Hall04f4f472015-08-16 19:51:04 -07001472#pragma clang diagnostic pop
1473// clang-format on
1474
1475} // namespace null_driver