blob: 8e654f18fa76264ce0f07dd91c557989909804e8 [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 Hallf8faf0c2015-08-31 11:34:32 -070019#include <array>
Jesse Hall04f4f472015-08-16 19:51:04 -070020#include <algorithm>
Jesse Hallbde8ee32015-09-01 16:24:29 -070021#include <inttypes.h>
22#include <string.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070023
Jesse Hall73ab0ac2015-08-25 15:09:15 +010024// #define LOG_NDEBUG 0
25#include <log/log.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070026#include <utils/Errors.h>
27
28#include "null_driver.h"
29
30using namespace null_driver;
31
32struct VkPhysicalDevice_T {
33 hwvulkan_dispatch_t dispatch;
34};
35
36struct VkInstance_T {
37 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -080038 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -070039 VkPhysicalDevice_T physical_device;
40};
41
42struct VkQueue_T {
43 hwvulkan_dispatch_t dispatch;
44};
45
Jesse Hall3fbc8562015-11-29 22:10:52 -080046struct VkCommandBuffer_T {
Jesse Hall04f4f472015-08-16 19:51:04 -070047 hwvulkan_dispatch_t dispatch;
48};
49
Jesse Hallf8faf0c2015-08-31 11:34:32 -070050namespace {
51// Handles for non-dispatchable objects are either pointers, or arbitrary
52// 64-bit non-zero values. We only use pointers when we need to keep state for
53// the object even in a null driver. For the rest, we form a handle as:
54// [63:63] = 1 to distinguish from pointer handles*
55// [62:56] = non-zero handle type enum value
56// [55: 0] = per-handle-type incrementing counter
57// * This works because virtual addresses with the high bit set are reserved
58// for kernel data in all ABIs we run on.
59//
60// We never reclaim handles on vkDestroy*. It's not even necessary for us to
61// have distinct handles for live objects, and practically speaking we won't
62// ever create 2^56 objects of the same type from a single VkDevice in a null
63// driver.
64//
65// Using a namespace here instead of 'enum class' since we want scoped
66// constants but also want implicit conversions to integral types.
67namespace HandleType {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070068enum Enum {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070069 kBufferView,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070070 kDescriptorPool,
71 kDescriptorSet,
72 kDescriptorSetLayout,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070073 kEvent,
74 kFence,
75 kFramebuffer,
76 kImageView,
77 kPipeline,
78 kPipelineCache,
79 kPipelineLayout,
80 kQueryPool,
81 kRenderPass,
82 kSampler,
83 kSemaphore,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070084 kShaderModule,
Jesse Hallf8faf0c2015-08-31 11:34:32 -070085
Jesse Hallc7a6eb52015-08-31 12:52:03 -070086 kNumTypes
87};
88} // namespace HandleType
Jesse Hallf8faf0c2015-08-31 11:34:32 -070089uint64_t AllocHandle(VkDevice device, HandleType::Enum type);
Jesse Hallbde8ee32015-09-01 16:24:29 -070090
91const VkDeviceSize kMaxDeviceMemory = VkDeviceSize(INTPTR_MAX) + 1;
92
Jesse Hallc7a6eb52015-08-31 12:52:03 -070093} // anonymous namespace
Jesse Hallf8faf0c2015-08-31 11:34:32 -070094
Jesse Hall04f4f472015-08-16 19:51:04 -070095struct VkDevice_T {
96 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -080097 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -070098 VkInstance_T* instance;
99 VkQueue_T queue;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700100 std::array<uint64_t, HandleType::kNumTypes> next_handle;
Jesse Hall04f4f472015-08-16 19:51:04 -0700101};
102
103// -----------------------------------------------------------------------------
104// Declare HAL_MODULE_INFO_SYM early so it can be referenced by nulldrv_device
105// later.
106
107namespace {
108int OpenDevice(const hw_module_t* module, const char* id, hw_device_t** device);
109hw_module_methods_t nulldrv_module_methods = {.open = OpenDevice};
110} // namespace
111
112#pragma clang diagnostic push
113#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
114__attribute__((visibility("default"))) hwvulkan_module_t HAL_MODULE_INFO_SYM = {
115 .common =
116 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500117 .tag = HARDWARE_MODULE_TAG,
118 .module_api_version = HWVULKAN_MODULE_API_VERSION_0_1,
119 .hal_api_version = HARDWARE_HAL_API_VERSION,
120 .id = HWVULKAN_HARDWARE_MODULE_ID,
121 .name = "Null Vulkan Driver",
122 .author = "The Android Open Source Project",
123 .methods = &nulldrv_module_methods,
Jesse Hall04f4f472015-08-16 19:51:04 -0700124 },
125};
126#pragma clang diagnostic pop
127
128// -----------------------------------------------------------------------------
129
130namespace {
131
Jesse Halle1b12782015-11-30 11:27:32 -0800132VKAPI_ATTR
Jesse Hall03b6fe12015-11-24 12:44:21 -0800133VkResult CreateInstance(const VkInstanceCreateInfo* /*create_info*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800134 const VkAllocationCallbacks* allocator,
Jesse Hall04f4f472015-08-16 19:51:04 -0700135 VkInstance* out_instance) {
Jesse Hallb1352bc2015-09-04 16:12:33 -0700136 // Assume the loader provided alloc callbacks even if the app didn't.
137 ALOG_ASSERT(
Jesse Hall03b6fe12015-11-24 12:44:21 -0800138 allocator,
Jesse Hallb1352bc2015-09-04 16:12:33 -0700139 "Missing alloc callbacks, loader or app should have provided them");
140
Jesse Hall3fbc8562015-11-29 22:10:52 -0800141 VkInstance_T* instance =
142 static_cast<VkInstance_T*>(allocator->pfnAllocation(
143 allocator->pUserData, sizeof(VkInstance_T), alignof(VkInstance_T),
144 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE));
Jesse Hall04f4f472015-08-16 19:51:04 -0700145 if (!instance)
146 return VK_ERROR_OUT_OF_HOST_MEMORY;
147
148 instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800149 instance->allocator = *allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700150 instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
151
152 *out_instance = instance;
153 return VK_SUCCESS;
154}
155
156int CloseDevice(struct hw_device_t* /*device*/) {
157 // nothing to do - opening a device doesn't allocate any resources
158 return 0;
159}
160
161hwvulkan_device_t nulldrv_device = {
162 .common =
163 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500164 .tag = HARDWARE_DEVICE_TAG,
165 .version = HWVULKAN_DEVICE_API_VERSION_0_1,
166 .module = &HAL_MODULE_INFO_SYM.common,
167 .close = CloseDevice,
Jesse Hall04f4f472015-08-16 19:51:04 -0700168 },
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700169 .EnumerateInstanceExtensionProperties =
170 EnumerateInstanceExtensionProperties,
Jesse Hall04f4f472015-08-16 19:51:04 -0700171 .CreateInstance = CreateInstance,
172 .GetInstanceProcAddr = GetInstanceProcAddr};
173
174int OpenDevice(const hw_module_t* /*module*/,
175 const char* id,
176 hw_device_t** device) {
177 if (strcmp(id, HWVULKAN_DEVICE_0) == 0) {
178 *device = &nulldrv_device.common;
179 return 0;
180 }
181 return -ENOENT;
182}
183
184VkInstance_T* GetInstanceFromPhysicalDevice(
185 VkPhysicalDevice_T* physical_device) {
186 return reinterpret_cast<VkInstance_T*>(
187 reinterpret_cast<uintptr_t>(physical_device) -
188 offsetof(VkInstance_T, physical_device));
189}
190
Michael Lentine3fec89e2015-12-04 16:25:11 -0800191template <class Handle>
192Handle AllocHandle(VkDevice device, HandleType::Enum type) {
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700193 const uint64_t kHandleMask = (UINT64_C(1) << 56) - 1;
194 ALOGE_IF(device->next_handle[type] == kHandleMask,
Jesse Hallbde8ee32015-09-01 16:24:29 -0700195 "non-dispatchable handles of type=%u are about to overflow", type);
Michael Lentine3fec89e2015-12-04 16:25:11 -0800196 return reinterpret_cast<Handle>(
197 (UINT64_C(1) << 63) | ((uint64_t(type) & 0x7) << 56) |
198 (device->next_handle[type]++ & kHandleMask));
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700199}
200
Jesse Hall04f4f472015-08-16 19:51:04 -0700201} // namespace
202
203namespace null_driver {
204
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800205#define DEFINE_OBJECT_HANDLE_CONVERSION(T) \
206 T* Get##T##FromHandle(Vk##T h); \
207 T* Get##T##FromHandle(Vk##T h) { \
208 return reinterpret_cast<T*>(uintptr_t(h)); \
209 } \
210 Vk##T GetHandleTo##T(const T* obj); \
211 Vk##T GetHandleTo##T(const T* obj) { \
212 return Vk##T(reinterpret_cast<uintptr_t>(obj)); \
213 }
Jesse Hallf6578742015-08-29 17:06:12 +0100214
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100215// -----------------------------------------------------------------------------
216// Global
217
Jesse Halle1b12782015-11-30 11:27:32 -0800218VKAPI_ATTR
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700219VkResult EnumerateInstanceExtensionProperties(const char*,
220 uint32_t* count,
221 VkExtensionProperties*) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100222 *count = 0;
223 return VK_SUCCESS;
224}
225
Jesse Halle1b12782015-11-30 11:27:32 -0800226VKAPI_ATTR
Jesse Hall04f4f472015-08-16 19:51:04 -0700227PFN_vkVoidFunction GetInstanceProcAddr(VkInstance, const char* name) {
228 PFN_vkVoidFunction proc = LookupInstanceProcAddr(name);
229 if (!proc && strcmp(name, "vkGetDeviceProcAddr") == 0)
230 proc = reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr);
231 return proc;
232}
233
Jesse Halle1b12782015-11-30 11:27:32 -0800234VKAPI_ATTR
Jesse Hall04f4f472015-08-16 19:51:04 -0700235PFN_vkVoidFunction GetDeviceProcAddr(VkDevice, const char* name) {
Jesse Hallb1352bc2015-09-04 16:12:33 -0700236 PFN_vkVoidFunction proc = LookupDeviceProcAddr(name);
237 if (proc)
238 return proc;
Jesse Hall70f93352015-11-04 09:41:31 -0800239 if (strcmp(name, "vkGetSwapchainGrallocUsageANDROID") == 0)
240 return reinterpret_cast<PFN_vkVoidFunction>(
241 GetSwapchainGrallocUsageANDROID);
Jesse Hallab9aeef2015-11-04 10:56:20 -0800242 if (strcmp(name, "vkAcquireImageANDROID") == 0)
243 return reinterpret_cast<PFN_vkVoidFunction>(AcquireImageANDROID);
244 if (strcmp(name, "vkQueueSignalReleaseImageANDROID") == 0)
Jesse Hallb1352bc2015-09-04 16:12:33 -0700245 return reinterpret_cast<PFN_vkVoidFunction>(
Jesse Hallab9aeef2015-11-04 10:56:20 -0800246 QueueSignalReleaseImageANDROID);
Jesse Hallb1352bc2015-09-04 16:12:33 -0700247 return nullptr;
Jesse Hall04f4f472015-08-16 19:51:04 -0700248}
249
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100250// -----------------------------------------------------------------------------
251// Instance
252
Jesse Hall03b6fe12015-11-24 12:44:21 -0800253void DestroyInstance(VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800254 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800255 instance->allocator.pfnFree(instance->allocator.pUserData, instance);
Jesse Hall04f4f472015-08-16 19:51:04 -0700256}
257
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100258// -----------------------------------------------------------------------------
259// PhysicalDevice
260
Jesse Hall04f4f472015-08-16 19:51:04 -0700261VkResult EnumeratePhysicalDevices(VkInstance instance,
262 uint32_t* physical_device_count,
263 VkPhysicalDevice* physical_devices) {
264 if (physical_devices && *physical_device_count >= 1)
265 physical_devices[0] = &instance->physical_device;
266 *physical_device_count = 1;
267 return VK_SUCCESS;
268}
269
Jesse Hall606a54e2015-11-19 22:17:28 -0800270void GetPhysicalDeviceProperties(VkPhysicalDevice,
271 VkPhysicalDeviceProperties* properties) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700272 properties->apiVersion = VK_API_VERSION;
273 properties->driverVersion = VK_MAKE_VERSION(0, 0, 1);
Jesse Hall65ab5522015-11-30 00:07:16 -0800274 properties->vendorID = 0;
275 properties->deviceID = 0;
Jesse Hall04f4f472015-08-16 19:51:04 -0700276 properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
277 strcpy(properties->deviceName, "Android Vulkan Null Driver");
278 memset(properties->pipelineCacheUUID, 0,
279 sizeof(properties->pipelineCacheUUID));
Jesse Hall04f4f472015-08-16 19:51:04 -0700280}
281
Jesse Hall606a54e2015-11-19 22:17:28 -0800282void GetPhysicalDeviceQueueFamilyProperties(
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700283 VkPhysicalDevice,
284 uint32_t* count,
285 VkQueueFamilyProperties* properties) {
286 if (properties) {
Jesse Hall65ab5522015-11-30 00:07:16 -0800287 properties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT |
288 VK_QUEUE_TRANSFER_BIT;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700289 properties->queueCount = 1;
Jesse Hallacfa5342015-11-19 21:51:33 -0800290 properties->timestampValidBits = 64;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700291 }
292 *count = 1;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700293}
294
Jesse Hall606a54e2015-11-19 22:17:28 -0800295void GetPhysicalDeviceMemoryProperties(
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100296 VkPhysicalDevice,
297 VkPhysicalDeviceMemoryProperties* properties) {
298 properties->memoryTypeCount = 1;
299 properties->memoryTypes[0].propertyFlags =
Jesse Halld1af8122015-11-29 23:50:38 -0800300 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
301 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
302 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
303 VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100304 properties->memoryTypes[0].heapIndex = 0;
305 properties->memoryHeapCount = 1;
Jesse Hallbde8ee32015-09-01 16:24:29 -0700306 properties->memoryHeaps[0].size = kMaxDeviceMemory;
Jesse Halld1af8122015-11-29 23:50:38 -0800307 properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
Jesse Hall04f4f472015-08-16 19:51:04 -0700308}
309
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100310// -----------------------------------------------------------------------------
311// Device
312
Jesse Hall04f4f472015-08-16 19:51:04 -0700313VkResult CreateDevice(VkPhysicalDevice physical_device,
314 const VkDeviceCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800315 const VkAllocationCallbacks* allocator,
Jesse Hall04f4f472015-08-16 19:51:04 -0700316 VkDevice* out_device) {
317 VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800318 if (!allocator)
319 allocator = &instance->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800320 VkDevice_T* device = static_cast<VkDevice_T*>(allocator->pfnAllocation(
321 allocator->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T),
322 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE));
Jesse Hall04f4f472015-08-16 19:51:04 -0700323 if (!device)
324 return VK_ERROR_OUT_OF_HOST_MEMORY;
325
326 device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800327 device->allocator = *allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700328 device->instance = instance;
329 device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700330 std::fill(device->next_handle.begin(), device->next_handle.end(),
331 UINT64_C(0));
Jesse Hall04f4f472015-08-16 19:51:04 -0700332
333 *out_device = device;
334 return VK_SUCCESS;
335}
336
Jesse Hall3fbc8562015-11-29 22:10:52 -0800337void DestroyDevice(VkDevice device,
338 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700339 if (!device)
Jesse Hallcf25c412015-10-29 17:14:50 -0700340 return;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800341 device->allocator.pfnFree(device->allocator.pUserData, device);
Jesse Hall04f4f472015-08-16 19:51:04 -0700342}
343
Jesse Hall606a54e2015-11-19 22:17:28 -0800344void GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700345 *queue = &device->queue;
Jesse Hall04f4f472015-08-16 19:51:04 -0700346}
347
348// -----------------------------------------------------------------------------
Jesse Hall3fbc8562015-11-29 22:10:52 -0800349// CommandPool
Jesse Hall03b6fe12015-11-24 12:44:21 -0800350
Jesse Hall3fbc8562015-11-29 22:10:52 -0800351struct CommandPool {
352 typedef VkCommandPool HandleType;
353 VkAllocationCallbacks allocator;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800354};
Jesse Hall3fbc8562015-11-29 22:10:52 -0800355DEFINE_OBJECT_HANDLE_CONVERSION(CommandPool)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800356
357VkResult CreateCommandPool(VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800358 const VkCommandPoolCreateInfo* /*create_info*/,
359 const VkAllocationCallbacks* allocator,
360 VkCommandPool* cmd_pool) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800361 if (!allocator)
362 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800363 CommandPool* pool = static_cast<CommandPool*>(allocator->pfnAllocation(
364 allocator->pUserData, sizeof(CommandPool), alignof(CommandPool),
365 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall03b6fe12015-11-24 12:44:21 -0800366 if (!pool)
367 return VK_ERROR_OUT_OF_HOST_MEMORY;
368 pool->allocator = *allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800369 *cmd_pool = GetHandleToCommandPool(pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800370 return VK_SUCCESS;
371}
372
373void DestroyCommandPool(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800374 VkCommandPool cmd_pool,
375 const VkAllocationCallbacks* /*allocator*/) {
376 CommandPool* pool = GetCommandPoolFromHandle(cmd_pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800377 pool->allocator.pfnFree(pool->allocator.pUserData, pool);
378}
379
380// -----------------------------------------------------------------------------
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700381// CmdBuffer
382
Jesse Hall3fbc8562015-11-29 22:10:52 -0800383VkResult AllocateCommandBuffers(VkDevice /*device*/,
384 const VkCommandBufferAllocateInfo* alloc_info,
385 VkCommandBuffer* cmdbufs) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800386 VkResult result = VK_SUCCESS;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800387 CommandPool& pool = *GetCommandPoolFromHandle(alloc_info->commandPool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800388 std::fill(cmdbufs, cmdbufs + alloc_info->bufferCount, nullptr);
389 for (uint32_t i = 0; i < alloc_info->bufferCount; i++) {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800390 cmdbufs[i] =
391 static_cast<VkCommandBuffer_T*>(pool.allocator.pfnAllocation(
392 pool.allocator.pUserData, sizeof(VkCommandBuffer_T),
393 alignof(VkCommandBuffer_T), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallfbf97b02015-11-20 14:17:03 -0800394 if (!cmdbufs[i]) {
395 result = VK_ERROR_OUT_OF_HOST_MEMORY;
396 break;
397 }
398 cmdbufs[i]->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
399 }
400 if (result != VK_SUCCESS) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800401 for (uint32_t i = 0; i < alloc_info->bufferCount; i++) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800402 if (!cmdbufs[i])
403 break;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800404 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800405 }
406 }
Jesse Hallfbf97b02015-11-20 14:17:03 -0800407 return result;
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700408}
409
Jesse Hall03b6fe12015-11-24 12:44:21 -0800410void FreeCommandBuffers(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800411 VkCommandPool cmd_pool,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800412 uint32_t count,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800413 const VkCommandBuffer* cmdbufs) {
414 CommandPool& pool = *GetCommandPoolFromHandle(cmd_pool);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800415 for (uint32_t i = 0; i < count; i++)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800416 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700417}
418
419// -----------------------------------------------------------------------------
Jesse Hall2077ce02015-08-29 18:10:59 +0100420// DeviceMemory
421
422struct DeviceMemory {
423 typedef VkDeviceMemory HandleType;
424 VkDeviceSize size;
425 alignas(16) uint8_t data[0];
426};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800427DEFINE_OBJECT_HANDLE_CONVERSION(DeviceMemory)
Jesse Hall2077ce02015-08-29 18:10:59 +0100428
Jesse Hall3fbc8562015-11-29 22:10:52 -0800429VkResult AllocateMemory(VkDevice device,
430 const VkMemoryAllocateInfo* alloc_info,
431 const VkAllocationCallbacks* allocator,
432 VkDeviceMemory* mem_handle) {
Jesse Hall2077ce02015-08-29 18:10:59 +0100433 if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize)
434 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800435 if (!allocator)
436 allocator = &device->allocator;
Jesse Hall2077ce02015-08-29 18:10:59 +0100437
Jesse Hall2077ce02015-08-29 18:10:59 +0100438 size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize);
Jesse Hall3fbc8562015-11-29 22:10:52 -0800439 DeviceMemory* mem = static_cast<DeviceMemory*>(allocator->pfnAllocation(
440 allocator->pUserData, size, alignof(DeviceMemory),
441 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall2077ce02015-08-29 18:10:59 +0100442 if (!mem)
443 return VK_ERROR_OUT_OF_HOST_MEMORY;
444 mem->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800445 *mem_handle = GetHandleToDeviceMemory(mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100446 return VK_SUCCESS;
447}
448
Jesse Hall03b6fe12015-11-24 12:44:21 -0800449void FreeMemory(VkDevice device,
450 VkDeviceMemory mem_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800451 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800452 if (!allocator)
453 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800454 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800455 allocator->pfnFree(allocator->pUserData, mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100456}
457
458VkResult MapMemory(VkDevice,
459 VkDeviceMemory mem_handle,
460 VkDeviceSize offset,
461 VkDeviceSize,
462 VkMemoryMapFlags,
463 void** out_ptr) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800464 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall2077ce02015-08-29 18:10:59 +0100465 *out_ptr = &mem->data[0] + offset;
466 return VK_SUCCESS;
467}
468
469// -----------------------------------------------------------------------------
Jesse Hallf6578742015-08-29 17:06:12 +0100470// Buffer
471
472struct Buffer {
473 typedef VkBuffer HandleType;
474 VkDeviceSize size;
475};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800476DEFINE_OBJECT_HANDLE_CONVERSION(Buffer)
Jesse Hallf6578742015-08-29 17:06:12 +0100477
478VkResult CreateBuffer(VkDevice device,
479 const VkBufferCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800480 const VkAllocationCallbacks* allocator,
Jesse Hallf6578742015-08-29 17:06:12 +0100481 VkBuffer* buffer_handle) {
Jesse Hallbde8ee32015-09-01 16:24:29 -0700482 ALOGW_IF(create_info->size > kMaxDeviceMemory,
483 "CreateBuffer: requested size 0x%" PRIx64
484 " exceeds max device memory size 0x%" PRIx64,
485 create_info->size, kMaxDeviceMemory);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800486 if (!allocator)
487 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800488 Buffer* buffer = static_cast<Buffer*>(allocator->pfnAllocation(
489 allocator->pUserData, sizeof(Buffer), alignof(Buffer),
490 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallf6578742015-08-29 17:06:12 +0100491 if (!buffer)
492 return VK_ERROR_OUT_OF_HOST_MEMORY;
493 buffer->size = create_info->size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800494 *buffer_handle = GetHandleToBuffer(buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100495 return VK_SUCCESS;
496}
497
Jesse Hall606a54e2015-11-19 22:17:28 -0800498void GetBufferMemoryRequirements(VkDevice,
499 VkBuffer buffer_handle,
500 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800501 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hallf6578742015-08-29 17:06:12 +0100502 requirements->size = buffer->size;
503 requirements->alignment = 16; // allow fast Neon/SSE memcpy
504 requirements->memoryTypeBits = 0x1;
Jesse Hallf6578742015-08-29 17:06:12 +0100505}
506
Jesse Hall03b6fe12015-11-24 12:44:21 -0800507void DestroyBuffer(VkDevice device,
508 VkBuffer buffer_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800509 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800510 if (!allocator)
511 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800512 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800513 allocator->pfnFree(allocator->pUserData, buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100514}
515
516// -----------------------------------------------------------------------------
Jesse Hall85c05b62015-09-01 18:07:41 -0700517// Image
518
519struct Image {
520 typedef VkImage HandleType;
521 VkDeviceSize size;
522};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800523DEFINE_OBJECT_HANDLE_CONVERSION(Image)
Jesse Hall85c05b62015-09-01 18:07:41 -0700524
525VkResult CreateImage(VkDevice device,
526 const VkImageCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800527 const VkAllocationCallbacks* allocator,
Jesse Hall85c05b62015-09-01 18:07:41 -0700528 VkImage* image_handle) {
529 if (create_info->imageType != VK_IMAGE_TYPE_2D ||
530 create_info->format != VK_FORMAT_R8G8B8A8_UNORM ||
531 create_info->mipLevels != 1) {
532 ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u",
533 create_info->imageType, create_info->format,
534 create_info->mipLevels);
Jesse Halla15a4bf2015-11-19 22:48:02 -0800535 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall85c05b62015-09-01 18:07:41 -0700536 }
537
538 VkDeviceSize size =
539 VkDeviceSize(create_info->extent.width * create_info->extent.height) *
Jesse Halla15a4bf2015-11-19 22:48:02 -0800540 create_info->arrayLayers * create_info->samples * 4u;
Jesse Hall85c05b62015-09-01 18:07:41 -0700541 ALOGW_IF(size > kMaxDeviceMemory,
542 "CreateImage: image size 0x%" PRIx64
543 " exceeds max device memory size 0x%" PRIx64,
544 size, kMaxDeviceMemory);
545
Jesse Hall03b6fe12015-11-24 12:44:21 -0800546 if (!allocator)
547 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800548 Image* image = static_cast<Image*>(allocator->pfnAllocation(
549 allocator->pUserData, sizeof(Image), alignof(Image),
550 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall85c05b62015-09-01 18:07:41 -0700551 if (!image)
552 return VK_ERROR_OUT_OF_HOST_MEMORY;
553 image->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800554 *image_handle = GetHandleToImage(image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700555 return VK_SUCCESS;
556}
557
Jesse Hall606a54e2015-11-19 22:17:28 -0800558void GetImageMemoryRequirements(VkDevice,
559 VkImage image_handle,
560 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800561 Image* image = GetImageFromHandle(image_handle);
Jesse Hall85c05b62015-09-01 18:07:41 -0700562 requirements->size = image->size;
563 requirements->alignment = 16; // allow fast Neon/SSE memcpy
564 requirements->memoryTypeBits = 0x1;
Jesse Hall85c05b62015-09-01 18:07:41 -0700565}
566
Jesse Hall03b6fe12015-11-24 12:44:21 -0800567void DestroyImage(VkDevice device,
568 VkImage image_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800569 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800570 if (!allocator)
571 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800572 Image* image = GetImageFromHandle(image_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800573 allocator->pfnFree(allocator->pUserData, image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700574}
575
576// -----------------------------------------------------------------------------
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700577// No-op types
578
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700579VkResult CreateBufferView(VkDevice device,
580 const VkBufferViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800581 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700582 VkBufferView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800583 *view = AllocHandle<VkBufferView>(device, HandleType::kBufferView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700584 return VK_SUCCESS;
585}
586
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700587VkResult CreateDescriptorPool(VkDevice device,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700588 const VkDescriptorPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800589 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700590 VkDescriptorPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800591 *pool = AllocHandle<VkDescriptorPool>(device, HandleType::kDescriptorPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700592 return VK_SUCCESS;
593}
594
Jesse Hall3fbc8562015-11-29 22:10:52 -0800595VkResult AllocateDescriptorSets(VkDevice device,
596 const VkDescriptorSetAllocateInfo* alloc_info,
597 VkDescriptorSet* descriptor_sets) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800598 for (uint32_t i = 0; i < alloc_info->setLayoutCount; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800599 descriptor_sets[i] =
600 AllocHandle<VkDescriptorSet>(device, HandleType::kDescriptorSet);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700601 return VK_SUCCESS;
602}
603
604VkResult CreateDescriptorSetLayout(VkDevice device,
605 const VkDescriptorSetLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800606 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700607 VkDescriptorSetLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800608 *layout = AllocHandle<VkDescriptorSetLayout>(
609 device, HandleType::kDescriptorSetLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700610 return VK_SUCCESS;
611}
612
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700613VkResult CreateEvent(VkDevice device,
614 const VkEventCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800615 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700616 VkEvent* event) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800617 *event = AllocHandle<VkEvent>(device, HandleType::kEvent);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700618 return VK_SUCCESS;
619}
620
621VkResult CreateFence(VkDevice device,
622 const VkFenceCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800623 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700624 VkFence* fence) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800625 *fence = AllocHandle<VkFence>(device, HandleType::kFence);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700626 return VK_SUCCESS;
627}
628
629VkResult CreateFramebuffer(VkDevice device,
630 const VkFramebufferCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800631 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700632 VkFramebuffer* framebuffer) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800633 *framebuffer = AllocHandle<VkFramebuffer>(device, HandleType::kFramebuffer);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700634 return VK_SUCCESS;
635}
636
637VkResult CreateImageView(VkDevice device,
638 const VkImageViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800639 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700640 VkImageView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800641 *view = AllocHandle<VkImageView>(device, HandleType::kImageView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700642 return VK_SUCCESS;
643}
644
645VkResult CreateGraphicsPipelines(VkDevice device,
646 VkPipelineCache,
647 uint32_t count,
648 const VkGraphicsPipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800649 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700650 VkPipeline* pipelines) {
651 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800652 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700653 return VK_SUCCESS;
654}
655
656VkResult CreateComputePipelines(VkDevice device,
657 VkPipelineCache,
658 uint32_t count,
659 const VkComputePipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800660 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700661 VkPipeline* pipelines) {
662 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800663 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700664 return VK_SUCCESS;
665}
666
667VkResult CreatePipelineCache(VkDevice device,
668 const VkPipelineCacheCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800669 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700670 VkPipelineCache* cache) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800671 *cache = AllocHandle<VkPipelineCache>(device, HandleType::kPipelineCache);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700672 return VK_SUCCESS;
673}
674
675VkResult CreatePipelineLayout(VkDevice device,
676 const VkPipelineLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800677 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700678 VkPipelineLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800679 *layout =
680 AllocHandle<VkPipelineLayout>(device, HandleType::kPipelineLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700681 return VK_SUCCESS;
682}
683
684VkResult CreateQueryPool(VkDevice device,
685 const VkQueryPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800686 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700687 VkQueryPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800688 *pool = AllocHandle<VkQueryPool>(device, HandleType::kQueryPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700689 return VK_SUCCESS;
690}
691
692VkResult CreateRenderPass(VkDevice device,
693 const VkRenderPassCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800694 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700695 VkRenderPass* renderpass) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800696 *renderpass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700697 return VK_SUCCESS;
698}
699
700VkResult CreateSampler(VkDevice device,
701 const VkSamplerCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800702 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700703 VkSampler* sampler) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800704 *sampler = AllocHandle<VkSampler>(device, HandleType::kSampler);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700705 return VK_SUCCESS;
706}
707
708VkResult CreateSemaphore(VkDevice device,
709 const VkSemaphoreCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800710 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700711 VkSemaphore* semaphore) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800712 *semaphore = AllocHandle<VkSemaphore>(device, HandleType::kSemaphore);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700713 return VK_SUCCESS;
714}
715
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700716VkResult CreateShaderModule(VkDevice device,
717 const VkShaderModuleCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800718 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700719 VkShaderModule* module) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800720 *module = AllocHandle<VkShaderModule>(device, HandleType::kShaderModule);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700721 return VK_SUCCESS;
722}
723
Jesse Hall70f93352015-11-04 09:41:31 -0800724VkResult GetSwapchainGrallocUsageANDROID(VkDevice,
725 VkFormat,
726 VkImageUsageFlags,
727 int* grallocUsage) {
728 // The null driver never reads or writes the gralloc buffer
729 *grallocUsage = 0;
730 return VK_SUCCESS;
731}
732
Jesse Hallab9aeef2015-11-04 10:56:20 -0800733VkResult AcquireImageANDROID(VkDevice, VkImage, int fence, VkSemaphore) {
Jesse Halld7b994a2015-09-07 14:17:37 -0700734 close(fence);
735 return VK_SUCCESS;
736}
737
Jesse Hallab9aeef2015-11-04 10:56:20 -0800738VkResult QueueSignalReleaseImageANDROID(VkQueue, VkImage, int* fence) {
Jesse Halld7b994a2015-09-07 14:17:37 -0700739 *fence = -1;
740 return VK_SUCCESS;
741}
742
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700743// -----------------------------------------------------------------------------
Jesse Hall04f4f472015-08-16 19:51:04 -0700744// No-op entrypoints
745
746// clang-format off
747#pragma clang diagnostic push
748#pragma clang diagnostic ignored "-Wunused-parameter"
749
Jesse Hall606a54e2015-11-19 22:17:28 -0800750void GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100751 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700752}
753
Jesse Hall606a54e2015-11-19 22:17:28 -0800754void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100755 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700756}
757
Jesse Halla9e57032015-11-30 01:03:10 -0800758VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100759 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Halla9e57032015-11-30 01:03:10 -0800760 return VK_SUCCESS;
Jesse Hall04f4f472015-08-16 19:51:04 -0700761}
762
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700763VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100764 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700765 return VK_SUCCESS;
766}
767
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700768VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100769 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700770 return VK_SUCCESS;
771}
772
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700773VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pCount, VkExtensionProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100774 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700775 return VK_SUCCESS;
776}
777
Jesse Halla366a512015-11-19 22:30:07 -0800778VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700779 return VK_SUCCESS;
780}
781
782VkResult QueueWaitIdle(VkQueue queue) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100783 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700784 return VK_SUCCESS;
785}
786
787VkResult DeviceWaitIdle(VkDevice device) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100788 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700789 return VK_SUCCESS;
790}
791
Jesse Hallcf25c412015-10-29 17:14:50 -0700792void UnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700793}
794
795VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100796 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700797 return VK_SUCCESS;
798}
799
800VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100801 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700802 return VK_SUCCESS;
803}
804
Jesse Hall606a54e2015-11-19 22:17:28 -0800805void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100806 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700807}
808
Jesse Hall04f4f472015-08-16 19:51:04 -0700809VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset) {
810 return VK_SUCCESS;
811}
812
Jesse Hall04f4f472015-08-16 19:51:04 -0700813VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset) {
814 return VK_SUCCESS;
815}
816
Jesse Hall606a54e2015-11-19 22:17:28 -0800817void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100818 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700819}
820
Jesse Hall091ed9e2015-11-30 00:55:29 -0800821void 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 +0100822 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700823}
824
Jesse Halla6429252015-11-29 18:59:42 -0800825VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100826 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700827 return VK_SUCCESS;
828}
829
Jesse Hall3fbc8562015-11-29 22:10:52 -0800830void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700831}
832
833VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
834 return VK_SUCCESS;
835}
836
837VkResult GetFenceStatus(VkDevice device, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100838 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700839 return VK_SUCCESS;
840}
841
842VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
843 return VK_SUCCESS;
844}
845
Jesse Hall3fbc8562015-11-29 22:10:52 -0800846void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700847}
848
Jesse Hall3fbc8562015-11-29 22:10:52 -0800849void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700850}
851
852VkResult GetEventStatus(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100853 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700854 return VK_SUCCESS;
855}
856
857VkResult SetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100858 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700859 return VK_SUCCESS;
860}
861
862VkResult ResetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100863 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700864 return VK_SUCCESS;
865}
866
Jesse Hall3fbc8562015-11-29 22:10:52 -0800867void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700868}
869
Jesse Halla9bb62b2015-11-21 19:31:56 -0800870VkResult 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 +0100871 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700872 return VK_SUCCESS;
873}
874
Jesse Hall3fbc8562015-11-29 22:10:52 -0800875void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700876}
877
Jesse Hall606a54e2015-11-19 22:17:28 -0800878void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100879 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700880}
881
Jesse Hall3fbc8562015-11-29 22:10:52 -0800882void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700883}
884
Jesse Hall3fbc8562015-11-29 22:10:52 -0800885void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700886}
887
Jesse Hall3fbc8562015-11-29 22:10:52 -0800888void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700889}
890
Jesse Halla9bb62b2015-11-21 19:31:56 -0800891VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100892 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700893 return VK_SUCCESS;
894}
895
896VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100897 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700898 return VK_SUCCESS;
899}
900
Jesse Hall3fbc8562015-11-29 22:10:52 -0800901void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700902}
903
Jesse Hall3fbc8562015-11-29 22:10:52 -0800904void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700905}
906
Jesse Hall3fbc8562015-11-29 22:10:52 -0800907void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700908}
909
Jesse Hall3fbc8562015-11-29 22:10:52 -0800910void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700911}
912
Jesse Hall3fbc8562015-11-29 22:10:52 -0800913void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700914}
915
Jesse Hallfbf97b02015-11-20 14:17:03 -0800916VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100917 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700918 return VK_SUCCESS;
919}
920
Jesse Hallcf25c412015-10-29 17:14:50 -0700921void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100922 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700923}
924
925VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100926 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700927 return VK_SUCCESS;
928}
929
Jesse Hall3fbc8562015-11-29 22:10:52 -0800930void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700931}
932
Jesse Hall3fbc8562015-11-29 22:10:52 -0800933void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700934}
935
Jesse Hall606a54e2015-11-19 22:17:28 -0800936void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100937 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700938}
939
Jesse Hall3fbc8562015-11-29 22:10:52 -0800940VkResult ResetCommandPool(VkDevice device, VkCommandPool cmdPool, VkCommandPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100941 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700942 return VK_SUCCESS;
943}
944
Jesse Hall3fbc8562015-11-29 22:10:52 -0800945VkResult BeginCommandBuffer(VkCommandBuffer cmdBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700946 return VK_SUCCESS;
947}
948
Jesse Hall3fbc8562015-11-29 22:10:52 -0800949VkResult EndCommandBuffer(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700950 return VK_SUCCESS;
951}
952
Jesse Hall3fbc8562015-11-29 22:10:52 -0800953VkResult ResetCommandBuffer(VkCommandBuffer cmdBuffer, VkCommandBufferResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100954 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700955 return VK_SUCCESS;
956}
957
Jesse Hall3fbc8562015-11-29 22:10:52 -0800958void CmdBindPipeline(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700959}
960
Jesse Hall3fbc8562015-11-29 22:10:52 -0800961void CmdSetViewport(VkCommandBuffer cmdBuffer, uint32_t viewportCount, const VkViewport* pViewports) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700962}
963
Jesse Hall3fbc8562015-11-29 22:10:52 -0800964void CmdSetScissor(VkCommandBuffer cmdBuffer, uint32_t scissorCount, const VkRect2D* pScissors) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700965}
966
Jesse Hall3fbc8562015-11-29 22:10:52 -0800967void CmdSetLineWidth(VkCommandBuffer cmdBuffer, float lineWidth) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700968}
969
Jesse Hall3fbc8562015-11-29 22:10:52 -0800970void CmdSetDepthBias(VkCommandBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700971}
972
Jesse Hall3fbc8562015-11-29 22:10:52 -0800973void CmdSetBlendConstants(VkCommandBuffer cmdBuffer, const float blendConst[4]) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700974}
975
Jesse Hall3fbc8562015-11-29 22:10:52 -0800976void CmdSetDepthBounds(VkCommandBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700977}
978
Jesse Hall3fbc8562015-11-29 22:10:52 -0800979void CmdSetStencilCompareMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700980}
981
Jesse Hall3fbc8562015-11-29 22:10:52 -0800982void CmdSetStencilWriteMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700983}
984
Jesse Hall3fbc8562015-11-29 22:10:52 -0800985void CmdSetStencilReference(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700986}
987
Jesse Hall3fbc8562015-11-29 22:10:52 -0800988void 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 -0700989}
990
Jesse Hall3fbc8562015-11-29 22:10:52 -0800991void CmdBindIndexBuffer(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700992}
993
Jesse Hall3fbc8562015-11-29 22:10:52 -0800994void CmdBindVertexBuffers(VkCommandBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700995}
996
Jesse Hall3fbc8562015-11-29 22:10:52 -0800997void CmdDraw(VkCommandBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700998}
999
Jesse Hall3fbc8562015-11-29 22:10:52 -08001000void 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 -07001001}
1002
Jesse Hall3fbc8562015-11-29 22:10:52 -08001003void CmdDrawIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001004}
1005
Jesse Hall3fbc8562015-11-29 22:10:52 -08001006void CmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001007}
1008
Jesse Hall3fbc8562015-11-29 22:10:52 -08001009void CmdDispatch(VkCommandBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001010}
1011
Jesse Hall3fbc8562015-11-29 22:10:52 -08001012void CmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001013}
1014
Jesse Hall3fbc8562015-11-29 22:10:52 -08001015void CmdCopyBuffer(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001016}
1017
Jesse Hall3fbc8562015-11-29 22:10:52 -08001018void CmdCopyImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001019}
1020
Jesse Hall3fbc8562015-11-29 22:10:52 -08001021void 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 -07001022}
1023
Jesse Hall3fbc8562015-11-29 22:10:52 -08001024void CmdCopyBufferToImage(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001025}
1026
Jesse Hall3fbc8562015-11-29 22:10:52 -08001027void CmdCopyImageToBuffer(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001028}
1029
Jesse Hall3fbc8562015-11-29 22:10:52 -08001030void CmdUpdateBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001031}
1032
Jesse Hall3fbc8562015-11-29 22:10:52 -08001033void CmdFillBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001034}
1035
Jesse Hall3fbc8562015-11-29 22:10:52 -08001036void CmdClearColorImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001037}
1038
Jesse Hall3fbc8562015-11-29 22:10:52 -08001039void CmdClearDepthStencilImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001040}
1041
Jesse Hall3fbc8562015-11-29 22:10:52 -08001042void CmdClearAttachments(VkCommandBuffer cmdBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001043}
1044
Jesse Hall3fbc8562015-11-29 22:10:52 -08001045void CmdResolveImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001046}
1047
Jesse Hall3fbc8562015-11-29 22:10:52 -08001048void CmdSetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001049}
1050
Jesse Hall3fbc8562015-11-29 22:10:52 -08001051void CmdResetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001052}
1053
Jesse Hall3fbc8562015-11-29 22:10:52 -08001054void CmdWaitEvents(VkCommandBuffer cmdBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags destStageMask, uint32_t memBarrierCount, const void* const* ppMemBarriers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001055}
1056
Jesse Hall3fbc8562015-11-29 22:10:52 -08001057void CmdPipelineBarrier(VkCommandBuffer cmdBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags destStageMask, VkDependencyFlags dependencyFlags, uint32_t memBarrierCount, const void* const* ppMemBarriers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001058}
1059
Jesse Hall3fbc8562015-11-29 22:10:52 -08001060void CmdBeginQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001061}
1062
Jesse Hall3fbc8562015-11-29 22:10:52 -08001063void CmdEndQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001064}
1065
Jesse Hall3fbc8562015-11-29 22:10:52 -08001066void CmdResetQueryPool(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001067}
1068
Jesse Hall3fbc8562015-11-29 22:10:52 -08001069void CmdWriteTimestamp(VkCommandBuffer cmdBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001070}
1071
Jesse Hall3fbc8562015-11-29 22:10:52 -08001072void 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 -07001073}
1074
Jesse Hall3fbc8562015-11-29 22:10:52 -08001075void CmdPushConstants(VkCommandBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001076}
1077
Jesse Hall65ab5522015-11-30 00:07:16 -08001078void CmdBeginRenderPass(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001079}
1080
Jesse Hall65ab5522015-11-30 00:07:16 -08001081void CmdNextSubpass(VkCommandBuffer cmdBuffer, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001082}
1083
Jesse Hall3fbc8562015-11-29 22:10:52 -08001084void CmdEndRenderPass(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001085}
1086
Jesse Hall3fbc8562015-11-29 22:10:52 -08001087void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001088}
1089
Jesse Hall04f4f472015-08-16 19:51:04 -07001090#pragma clang diagnostic pop
1091// clang-format on
1092
1093} // namespace null_driver