blob: 1b19d9a588b336875ac19ecf14d8d29225c10fc3 [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>
Jesse Hall715b86a2016-01-16 16:34:29 -080018#include <vulkan/vk_ext_debug_report.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070019
Jesse Hall1f91d392015-12-11 16:28:44 -080020#include <algorithm>
21#include <array>
Jesse Hall715b86a2016-01-16 16:34:29 -080022#include <inttypes.h>
23#include <string.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070024
Jesse Hall73ab0ac2015-08-25 15:09:15 +010025#include <log/log.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070026#include <utils/Errors.h>
27
Jesse Hall1f91d392015-12-11 16:28:44 -080028#include "null_driver_gen.h"
Jesse Hall04f4f472015-08-16 19:51:04 -070029
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;
Jesse Hall715b86a2016-01-16 16:34:29 -080040 uint64_t next_callback_handle;
41 bool debug_report_enabled;
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
93const VkDeviceSize kMaxDeviceMemory = VkDeviceSize(INTPTR_MAX) + 1;
94
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 Hall04f4f472015-08-16 19:51:04 -0700191} // namespace
192
193namespace null_driver {
194
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800195#define DEFINE_OBJECT_HANDLE_CONVERSION(T) \
196 T* Get##T##FromHandle(Vk##T h); \
197 T* Get##T##FromHandle(Vk##T h) { \
198 return reinterpret_cast<T*>(uintptr_t(h)); \
199 } \
200 Vk##T GetHandleTo##T(const T* obj); \
201 Vk##T GetHandleTo##T(const T* obj) { \
202 return Vk##T(reinterpret_cast<uintptr_t>(obj)); \
203 }
Jesse Hallf6578742015-08-29 17:06:12 +0100204
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100205// -----------------------------------------------------------------------------
206// Global
207
Jesse Halle1b12782015-11-30 11:27:32 -0800208VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800209VkResult EnumerateInstanceExtensionProperties(
210 const char* layer_name,
211 uint32_t* count,
212 VkExtensionProperties* properties) {
213 if (layer_name) {
214 ALOGW(
215 "Driver vkEnumerateInstanceExtensionProperties shouldn't be called "
216 "with a layer name ('%s')",
217 layer_name);
218 *count = 0;
219 return VK_SUCCESS;
220 }
221
222 const VkExtensionProperties kExtensions[] = {
223 {VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}};
224 const uint32_t kExtensionsCount =
225 sizeof(kExtensions) / sizeof(kExtensions[0]);
226
227 if (!properties || *count > kExtensionsCount)
228 *count = kExtensionsCount;
229 if (properties)
230 std::copy(kExtensions, kExtensions + *count, properties);
231 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100232}
233
Jesse Halle1b12782015-11-30 11:27:32 -0800234VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800235VkResult CreateInstance(const VkInstanceCreateInfo* create_info,
Jesse Hall1f91d392015-12-11 16:28:44 -0800236 const VkAllocationCallbacks* allocator,
237 VkInstance* out_instance) {
238 // Assume the loader provided alloc callbacks even if the app didn't.
239 ALOG_ASSERT(
240 allocator,
241 "Missing alloc callbacks, loader or app should have provided them");
242
243 VkInstance_T* instance =
244 static_cast<VkInstance_T*>(allocator->pfnAllocation(
245 allocator->pUserData, sizeof(VkInstance_T), alignof(VkInstance_T),
246 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE));
247 if (!instance)
248 return VK_ERROR_OUT_OF_HOST_MEMORY;
249
250 instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
251 instance->allocator = *allocator;
252 instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall715b86a2016-01-16 16:34:29 -0800253 instance->next_callback_handle = 0;
254 instance->debug_report_enabled = false;
255
256 for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
257 if (strcmp(create_info->ppEnabledExtensionNames[i],
258 VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) {
259 ALOGV("Enabling " VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
260 instance->debug_report_enabled = true;
261 }
262 }
Jesse Hall1f91d392015-12-11 16:28:44 -0800263
264 *out_instance = instance;
265 return VK_SUCCESS;
266}
267
268VKAPI_ATTR
269PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name) {
270 return instance ? GetInstanceProcAddr(name) : GetGlobalProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700271}
272
Jesse Halle1b12782015-11-30 11:27:32 -0800273VKAPI_ATTR
Jesse Hall04f4f472015-08-16 19:51:04 -0700274PFN_vkVoidFunction GetDeviceProcAddr(VkDevice, const char* name) {
Jesse Hall1f91d392015-12-11 16:28:44 -0800275 return GetInstanceProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700276}
277
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100278// -----------------------------------------------------------------------------
279// Instance
280
Jesse Hall03b6fe12015-11-24 12:44:21 -0800281void DestroyInstance(VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800282 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800283 instance->allocator.pfnFree(instance->allocator.pUserData, instance);
Jesse Hall04f4f472015-08-16 19:51:04 -0700284}
285
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100286// -----------------------------------------------------------------------------
287// PhysicalDevice
288
Jesse Hall04f4f472015-08-16 19:51:04 -0700289VkResult EnumeratePhysicalDevices(VkInstance instance,
290 uint32_t* physical_device_count,
291 VkPhysicalDevice* physical_devices) {
292 if (physical_devices && *physical_device_count >= 1)
293 physical_devices[0] = &instance->physical_device;
294 *physical_device_count = 1;
295 return VK_SUCCESS;
296}
297
Jesse Hall606a54e2015-11-19 22:17:28 -0800298void GetPhysicalDeviceProperties(VkPhysicalDevice,
299 VkPhysicalDeviceProperties* properties) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700300 properties->apiVersion = VK_API_VERSION;
301 properties->driverVersion = VK_MAKE_VERSION(0, 0, 1);
Jesse Hall65ab5522015-11-30 00:07:16 -0800302 properties->vendorID = 0;
303 properties->deviceID = 0;
Jesse Hall04f4f472015-08-16 19:51:04 -0700304 properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
305 strcpy(properties->deviceName, "Android Vulkan Null Driver");
306 memset(properties->pipelineCacheUUID, 0,
307 sizeof(properties->pipelineCacheUUID));
Jesse Hall04f4f472015-08-16 19:51:04 -0700308}
309
Jesse Hall606a54e2015-11-19 22:17:28 -0800310void GetPhysicalDeviceQueueFamilyProperties(
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700311 VkPhysicalDevice,
312 uint32_t* count,
313 VkQueueFamilyProperties* properties) {
Jesse Hall715b86a2016-01-16 16:34:29 -0800314 if (!properties || *count > 1)
315 *count = 1;
316 if (properties && *count == 1) {
Jesse Hall65ab5522015-11-30 00:07:16 -0800317 properties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT |
318 VK_QUEUE_TRANSFER_BIT;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700319 properties->queueCount = 1;
Jesse Hallacfa5342015-11-19 21:51:33 -0800320 properties->timestampValidBits = 64;
Jesse Hall715b86a2016-01-16 16:34:29 -0800321 properties->minImageTransferGranularity = VkExtent3D{1, 1, 1};
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700322 }
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700323}
324
Jesse Hall606a54e2015-11-19 22:17:28 -0800325void GetPhysicalDeviceMemoryProperties(
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100326 VkPhysicalDevice,
327 VkPhysicalDeviceMemoryProperties* properties) {
328 properties->memoryTypeCount = 1;
329 properties->memoryTypes[0].propertyFlags =
Jesse Halld1af8122015-11-29 23:50:38 -0800330 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
331 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
332 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
333 VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100334 properties->memoryTypes[0].heapIndex = 0;
335 properties->memoryHeapCount = 1;
Jesse Hallbde8ee32015-09-01 16:24:29 -0700336 properties->memoryHeaps[0].size = kMaxDeviceMemory;
Jesse Halld1af8122015-11-29 23:50:38 -0800337 properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
Jesse Hall04f4f472015-08-16 19:51:04 -0700338}
339
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100340// -----------------------------------------------------------------------------
341// Device
342
Jesse Hall04f4f472015-08-16 19:51:04 -0700343VkResult CreateDevice(VkPhysicalDevice physical_device,
344 const VkDeviceCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800345 const VkAllocationCallbacks* allocator,
Jesse Hall04f4f472015-08-16 19:51:04 -0700346 VkDevice* out_device) {
347 VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800348 if (!allocator)
349 allocator = &instance->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800350 VkDevice_T* device = static_cast<VkDevice_T*>(allocator->pfnAllocation(
351 allocator->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T),
352 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE));
Jesse Hall04f4f472015-08-16 19:51:04 -0700353 if (!device)
354 return VK_ERROR_OUT_OF_HOST_MEMORY;
355
356 device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800357 device->allocator = *allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700358 device->instance = instance;
359 device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700360 std::fill(device->next_handle.begin(), device->next_handle.end(),
361 UINT64_C(0));
Jesse Hall04f4f472015-08-16 19:51:04 -0700362
363 *out_device = device;
364 return VK_SUCCESS;
365}
366
Jesse Hall3fbc8562015-11-29 22:10:52 -0800367void DestroyDevice(VkDevice device,
368 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700369 if (!device)
Jesse Hallcf25c412015-10-29 17:14:50 -0700370 return;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800371 device->allocator.pfnFree(device->allocator.pUserData, device);
Jesse Hall04f4f472015-08-16 19:51:04 -0700372}
373
Jesse Hall606a54e2015-11-19 22:17:28 -0800374void GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700375 *queue = &device->queue;
Jesse Hall04f4f472015-08-16 19:51:04 -0700376}
377
378// -----------------------------------------------------------------------------
Jesse Hall3fbc8562015-11-29 22:10:52 -0800379// CommandPool
Jesse Hall03b6fe12015-11-24 12:44:21 -0800380
Jesse Hall3fbc8562015-11-29 22:10:52 -0800381struct CommandPool {
382 typedef VkCommandPool HandleType;
383 VkAllocationCallbacks allocator;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800384};
Jesse Hall3fbc8562015-11-29 22:10:52 -0800385DEFINE_OBJECT_HANDLE_CONVERSION(CommandPool)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800386
387VkResult CreateCommandPool(VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800388 const VkCommandPoolCreateInfo* /*create_info*/,
389 const VkAllocationCallbacks* allocator,
390 VkCommandPool* cmd_pool) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800391 if (!allocator)
392 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800393 CommandPool* pool = static_cast<CommandPool*>(allocator->pfnAllocation(
394 allocator->pUserData, sizeof(CommandPool), alignof(CommandPool),
395 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall03b6fe12015-11-24 12:44:21 -0800396 if (!pool)
397 return VK_ERROR_OUT_OF_HOST_MEMORY;
398 pool->allocator = *allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800399 *cmd_pool = GetHandleToCommandPool(pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800400 return VK_SUCCESS;
401}
402
403void DestroyCommandPool(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800404 VkCommandPool cmd_pool,
405 const VkAllocationCallbacks* /*allocator*/) {
406 CommandPool* pool = GetCommandPoolFromHandle(cmd_pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800407 pool->allocator.pfnFree(pool->allocator.pUserData, pool);
408}
409
410// -----------------------------------------------------------------------------
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700411// CmdBuffer
412
Jesse Hall3fbc8562015-11-29 22:10:52 -0800413VkResult AllocateCommandBuffers(VkDevice /*device*/,
414 const VkCommandBufferAllocateInfo* alloc_info,
415 VkCommandBuffer* cmdbufs) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800416 VkResult result = VK_SUCCESS;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800417 CommandPool& pool = *GetCommandPoolFromHandle(alloc_info->commandPool);
Jesse Hall3dd678a2016-01-08 21:52:01 -0800418 std::fill(cmdbufs, cmdbufs + alloc_info->commandBufferCount, nullptr);
419 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800420 cmdbufs[i] =
421 static_cast<VkCommandBuffer_T*>(pool.allocator.pfnAllocation(
422 pool.allocator.pUserData, sizeof(VkCommandBuffer_T),
423 alignof(VkCommandBuffer_T), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallfbf97b02015-11-20 14:17:03 -0800424 if (!cmdbufs[i]) {
425 result = VK_ERROR_OUT_OF_HOST_MEMORY;
426 break;
427 }
428 cmdbufs[i]->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
429 }
430 if (result != VK_SUCCESS) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800431 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800432 if (!cmdbufs[i])
433 break;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800434 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800435 }
436 }
Jesse Hallfbf97b02015-11-20 14:17:03 -0800437 return result;
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700438}
439
Jesse Hall03b6fe12015-11-24 12:44:21 -0800440void FreeCommandBuffers(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800441 VkCommandPool cmd_pool,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800442 uint32_t count,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800443 const VkCommandBuffer* cmdbufs) {
444 CommandPool& pool = *GetCommandPoolFromHandle(cmd_pool);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800445 for (uint32_t i = 0; i < count; i++)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800446 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700447}
448
449// -----------------------------------------------------------------------------
Jesse Hall2077ce02015-08-29 18:10:59 +0100450// DeviceMemory
451
452struct DeviceMemory {
453 typedef VkDeviceMemory HandleType;
454 VkDeviceSize size;
455 alignas(16) uint8_t data[0];
456};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800457DEFINE_OBJECT_HANDLE_CONVERSION(DeviceMemory)
Jesse Hall2077ce02015-08-29 18:10:59 +0100458
Jesse Hall3fbc8562015-11-29 22:10:52 -0800459VkResult AllocateMemory(VkDevice device,
460 const VkMemoryAllocateInfo* alloc_info,
461 const VkAllocationCallbacks* allocator,
462 VkDeviceMemory* mem_handle) {
Jesse Hall2077ce02015-08-29 18:10:59 +0100463 if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize)
464 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800465 if (!allocator)
466 allocator = &device->allocator;
Jesse Hall2077ce02015-08-29 18:10:59 +0100467
Jesse Hall2077ce02015-08-29 18:10:59 +0100468 size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize);
Jesse Hall3fbc8562015-11-29 22:10:52 -0800469 DeviceMemory* mem = static_cast<DeviceMemory*>(allocator->pfnAllocation(
470 allocator->pUserData, size, alignof(DeviceMemory),
471 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall2077ce02015-08-29 18:10:59 +0100472 if (!mem)
473 return VK_ERROR_OUT_OF_HOST_MEMORY;
474 mem->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800475 *mem_handle = GetHandleToDeviceMemory(mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100476 return VK_SUCCESS;
477}
478
Jesse Hall03b6fe12015-11-24 12:44:21 -0800479void FreeMemory(VkDevice device,
480 VkDeviceMemory mem_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800481 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800482 if (!allocator)
483 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800484 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800485 allocator->pfnFree(allocator->pUserData, mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100486}
487
488VkResult MapMemory(VkDevice,
489 VkDeviceMemory mem_handle,
490 VkDeviceSize offset,
491 VkDeviceSize,
492 VkMemoryMapFlags,
493 void** out_ptr) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800494 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall2077ce02015-08-29 18:10:59 +0100495 *out_ptr = &mem->data[0] + offset;
496 return VK_SUCCESS;
497}
498
499// -----------------------------------------------------------------------------
Jesse Hallf6578742015-08-29 17:06:12 +0100500// Buffer
501
502struct Buffer {
503 typedef VkBuffer HandleType;
504 VkDeviceSize size;
505};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800506DEFINE_OBJECT_HANDLE_CONVERSION(Buffer)
Jesse Hallf6578742015-08-29 17:06:12 +0100507
508VkResult CreateBuffer(VkDevice device,
509 const VkBufferCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800510 const VkAllocationCallbacks* allocator,
Jesse Hallf6578742015-08-29 17:06:12 +0100511 VkBuffer* buffer_handle) {
Jesse Hallbde8ee32015-09-01 16:24:29 -0700512 ALOGW_IF(create_info->size > kMaxDeviceMemory,
513 "CreateBuffer: requested size 0x%" PRIx64
514 " exceeds max device memory size 0x%" PRIx64,
515 create_info->size, kMaxDeviceMemory);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800516 if (!allocator)
517 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800518 Buffer* buffer = static_cast<Buffer*>(allocator->pfnAllocation(
519 allocator->pUserData, sizeof(Buffer), alignof(Buffer),
520 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallf6578742015-08-29 17:06:12 +0100521 if (!buffer)
522 return VK_ERROR_OUT_OF_HOST_MEMORY;
523 buffer->size = create_info->size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800524 *buffer_handle = GetHandleToBuffer(buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100525 return VK_SUCCESS;
526}
527
Jesse Hall606a54e2015-11-19 22:17:28 -0800528void GetBufferMemoryRequirements(VkDevice,
529 VkBuffer buffer_handle,
530 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800531 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hallf6578742015-08-29 17:06:12 +0100532 requirements->size = buffer->size;
533 requirements->alignment = 16; // allow fast Neon/SSE memcpy
534 requirements->memoryTypeBits = 0x1;
Jesse Hallf6578742015-08-29 17:06:12 +0100535}
536
Jesse Hall03b6fe12015-11-24 12:44:21 -0800537void DestroyBuffer(VkDevice device,
538 VkBuffer buffer_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800539 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800540 if (!allocator)
541 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800542 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800543 allocator->pfnFree(allocator->pUserData, buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100544}
545
546// -----------------------------------------------------------------------------
Jesse Hall85c05b62015-09-01 18:07:41 -0700547// Image
548
549struct Image {
550 typedef VkImage HandleType;
551 VkDeviceSize size;
552};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800553DEFINE_OBJECT_HANDLE_CONVERSION(Image)
Jesse Hall85c05b62015-09-01 18:07:41 -0700554
555VkResult CreateImage(VkDevice device,
556 const VkImageCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800557 const VkAllocationCallbacks* allocator,
Jesse Hall85c05b62015-09-01 18:07:41 -0700558 VkImage* image_handle) {
559 if (create_info->imageType != VK_IMAGE_TYPE_2D ||
560 create_info->format != VK_FORMAT_R8G8B8A8_UNORM ||
561 create_info->mipLevels != 1) {
562 ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u",
563 create_info->imageType, create_info->format,
564 create_info->mipLevels);
Jesse Halla15a4bf2015-11-19 22:48:02 -0800565 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall85c05b62015-09-01 18:07:41 -0700566 }
567
568 VkDeviceSize size =
569 VkDeviceSize(create_info->extent.width * create_info->extent.height) *
Jesse Halla15a4bf2015-11-19 22:48:02 -0800570 create_info->arrayLayers * create_info->samples * 4u;
Jesse Hall85c05b62015-09-01 18:07:41 -0700571 ALOGW_IF(size > kMaxDeviceMemory,
572 "CreateImage: image size 0x%" PRIx64
573 " exceeds max device memory size 0x%" PRIx64,
574 size, kMaxDeviceMemory);
575
Jesse Hall03b6fe12015-11-24 12:44:21 -0800576 if (!allocator)
577 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800578 Image* image = static_cast<Image*>(allocator->pfnAllocation(
579 allocator->pUserData, sizeof(Image), alignof(Image),
580 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall85c05b62015-09-01 18:07:41 -0700581 if (!image)
582 return VK_ERROR_OUT_OF_HOST_MEMORY;
583 image->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800584 *image_handle = GetHandleToImage(image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700585 return VK_SUCCESS;
586}
587
Jesse Hall606a54e2015-11-19 22:17:28 -0800588void GetImageMemoryRequirements(VkDevice,
589 VkImage image_handle,
590 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800591 Image* image = GetImageFromHandle(image_handle);
Jesse Hall85c05b62015-09-01 18:07:41 -0700592 requirements->size = image->size;
593 requirements->alignment = 16; // allow fast Neon/SSE memcpy
594 requirements->memoryTypeBits = 0x1;
Jesse Hall85c05b62015-09-01 18:07:41 -0700595}
596
Jesse Hall03b6fe12015-11-24 12:44:21 -0800597void DestroyImage(VkDevice device,
598 VkImage image_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800599 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800600 if (!allocator)
601 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800602 Image* image = GetImageFromHandle(image_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800603 allocator->pfnFree(allocator->pUserData, image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700604}
605
606// -----------------------------------------------------------------------------
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700607// No-op types
608
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700609VkResult CreateBufferView(VkDevice device,
610 const VkBufferViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800611 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700612 VkBufferView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800613 *view = AllocHandle<VkBufferView>(device, HandleType::kBufferView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700614 return VK_SUCCESS;
615}
616
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700617VkResult CreateDescriptorPool(VkDevice device,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700618 const VkDescriptorPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800619 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700620 VkDescriptorPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800621 *pool = AllocHandle<VkDescriptorPool>(device, HandleType::kDescriptorPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700622 return VK_SUCCESS;
623}
624
Jesse Hall3fbc8562015-11-29 22:10:52 -0800625VkResult AllocateDescriptorSets(VkDevice device,
626 const VkDescriptorSetAllocateInfo* alloc_info,
627 VkDescriptorSet* descriptor_sets) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800628 for (uint32_t i = 0; i < alloc_info->descriptorSetCount; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800629 descriptor_sets[i] =
630 AllocHandle<VkDescriptorSet>(device, HandleType::kDescriptorSet);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700631 return VK_SUCCESS;
632}
633
634VkResult CreateDescriptorSetLayout(VkDevice device,
635 const VkDescriptorSetLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800636 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700637 VkDescriptorSetLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800638 *layout = AllocHandle<VkDescriptorSetLayout>(
639 device, HandleType::kDescriptorSetLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700640 return VK_SUCCESS;
641}
642
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700643VkResult CreateEvent(VkDevice device,
644 const VkEventCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800645 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700646 VkEvent* event) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800647 *event = AllocHandle<VkEvent>(device, HandleType::kEvent);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700648 return VK_SUCCESS;
649}
650
651VkResult CreateFence(VkDevice device,
652 const VkFenceCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800653 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700654 VkFence* fence) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800655 *fence = AllocHandle<VkFence>(device, HandleType::kFence);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700656 return VK_SUCCESS;
657}
658
659VkResult CreateFramebuffer(VkDevice device,
660 const VkFramebufferCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800661 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700662 VkFramebuffer* framebuffer) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800663 *framebuffer = AllocHandle<VkFramebuffer>(device, HandleType::kFramebuffer);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700664 return VK_SUCCESS;
665}
666
667VkResult CreateImageView(VkDevice device,
668 const VkImageViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800669 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700670 VkImageView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800671 *view = AllocHandle<VkImageView>(device, HandleType::kImageView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700672 return VK_SUCCESS;
673}
674
675VkResult CreateGraphicsPipelines(VkDevice device,
676 VkPipelineCache,
677 uint32_t count,
678 const VkGraphicsPipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800679 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700680 VkPipeline* pipelines) {
681 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800682 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700683 return VK_SUCCESS;
684}
685
686VkResult CreateComputePipelines(VkDevice device,
687 VkPipelineCache,
688 uint32_t count,
689 const VkComputePipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800690 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700691 VkPipeline* pipelines) {
692 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800693 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700694 return VK_SUCCESS;
695}
696
697VkResult CreatePipelineCache(VkDevice device,
698 const VkPipelineCacheCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800699 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700700 VkPipelineCache* cache) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800701 *cache = AllocHandle<VkPipelineCache>(device, HandleType::kPipelineCache);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700702 return VK_SUCCESS;
703}
704
705VkResult CreatePipelineLayout(VkDevice device,
706 const VkPipelineLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800707 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700708 VkPipelineLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800709 *layout =
710 AllocHandle<VkPipelineLayout>(device, HandleType::kPipelineLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700711 return VK_SUCCESS;
712}
713
714VkResult CreateQueryPool(VkDevice device,
715 const VkQueryPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800716 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700717 VkQueryPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800718 *pool = AllocHandle<VkQueryPool>(device, HandleType::kQueryPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700719 return VK_SUCCESS;
720}
721
722VkResult CreateRenderPass(VkDevice device,
723 const VkRenderPassCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800724 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700725 VkRenderPass* renderpass) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800726 *renderpass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700727 return VK_SUCCESS;
728}
729
730VkResult CreateSampler(VkDevice device,
731 const VkSamplerCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800732 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700733 VkSampler* sampler) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800734 *sampler = AllocHandle<VkSampler>(device, HandleType::kSampler);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700735 return VK_SUCCESS;
736}
737
738VkResult CreateSemaphore(VkDevice device,
739 const VkSemaphoreCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800740 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700741 VkSemaphore* semaphore) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800742 *semaphore = AllocHandle<VkSemaphore>(device, HandleType::kSemaphore);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700743 return VK_SUCCESS;
744}
745
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700746VkResult CreateShaderModule(VkDevice device,
747 const VkShaderModuleCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800748 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700749 VkShaderModule* module) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800750 *module = AllocHandle<VkShaderModule>(device, HandleType::kShaderModule);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700751 return VK_SUCCESS;
752}
753
Jesse Hall715b86a2016-01-16 16:34:29 -0800754VkResult CreateDebugReportCallbackEXT(VkInstance instance,
755 const VkDebugReportCallbackCreateInfoEXT*,
756 const VkAllocationCallbacks*,
757 VkDebugReportCallbackEXT* callback) {
758 *callback = AllocHandle<VkDebugReportCallbackEXT>(
759 instance, HandleType::kDebugReportCallbackEXT);
760 return VK_SUCCESS;
761}
762
Jesse Hall70f93352015-11-04 09:41:31 -0800763VkResult GetSwapchainGrallocUsageANDROID(VkDevice,
764 VkFormat,
765 VkImageUsageFlags,
766 int* grallocUsage) {
767 // The null driver never reads or writes the gralloc buffer
768 *grallocUsage = 0;
769 return VK_SUCCESS;
770}
771
Jesse Hall1f91d392015-12-11 16:28:44 -0800772VkResult AcquireImageANDROID(VkDevice,
773 VkImage,
774 int fence,
775 VkSemaphore,
776 VkFence) {
Jesse Halld7b994a2015-09-07 14:17:37 -0700777 close(fence);
778 return VK_SUCCESS;
779}
780
Jesse Hall275d76c2016-01-08 22:39:16 -0800781VkResult QueueSignalReleaseImageANDROID(VkQueue,
782 uint32_t,
783 const VkSemaphore*,
784 VkImage,
785 int* fence) {
Jesse Halld7b994a2015-09-07 14:17:37 -0700786 *fence = -1;
787 return VK_SUCCESS;
788}
789
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700790// -----------------------------------------------------------------------------
Jesse Hall04f4f472015-08-16 19:51:04 -0700791// No-op entrypoints
792
793// clang-format off
794#pragma clang diagnostic push
795#pragma clang diagnostic ignored "-Wunused-parameter"
796
Jesse Hall606a54e2015-11-19 22:17:28 -0800797void GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100798 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700799}
800
Jesse Hall606a54e2015-11-19 22:17:28 -0800801void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100802 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700803}
804
Jesse Halla9e57032015-11-30 01:03:10 -0800805VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100806 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Halla9e57032015-11-30 01:03:10 -0800807 return VK_SUCCESS;
Jesse Hall04f4f472015-08-16 19:51:04 -0700808}
809
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700810VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100811 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700812 return VK_SUCCESS;
813}
814
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700815VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100816 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700817 return VK_SUCCESS;
818}
819
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700820VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pCount, VkExtensionProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100821 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700822 return VK_SUCCESS;
823}
824
Jesse Halla366a512015-11-19 22:30:07 -0800825VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700826 return VK_SUCCESS;
827}
828
829VkResult QueueWaitIdle(VkQueue queue) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100830 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700831 return VK_SUCCESS;
832}
833
834VkResult DeviceWaitIdle(VkDevice device) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100835 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700836 return VK_SUCCESS;
837}
838
Jesse Hallcf25c412015-10-29 17:14:50 -0700839void UnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700840}
841
842VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100843 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700844 return VK_SUCCESS;
845}
846
847VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100848 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700849 return VK_SUCCESS;
850}
851
Jesse Hall606a54e2015-11-19 22:17:28 -0800852void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100853 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700854}
855
Jesse Hall04f4f472015-08-16 19:51:04 -0700856VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset) {
857 return VK_SUCCESS;
858}
859
Jesse Hall04f4f472015-08-16 19:51:04 -0700860VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset) {
861 return VK_SUCCESS;
862}
863
Jesse Hall606a54e2015-11-19 22:17:28 -0800864void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100865 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700866}
867
Jesse Hall091ed9e2015-11-30 00:55:29 -0800868void 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 +0100869 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700870}
871
Jesse Halla6429252015-11-29 18:59:42 -0800872VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100873 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700874 return VK_SUCCESS;
875}
876
Jesse Hall3fbc8562015-11-29 22:10:52 -0800877void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700878}
879
880VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
881 return VK_SUCCESS;
882}
883
884VkResult GetFenceStatus(VkDevice device, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100885 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700886 return VK_SUCCESS;
887}
888
889VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
890 return VK_SUCCESS;
891}
892
Jesse Hall3fbc8562015-11-29 22:10:52 -0800893void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700894}
895
Jesse Hall3fbc8562015-11-29 22:10:52 -0800896void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700897}
898
899VkResult GetEventStatus(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100900 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700901 return VK_SUCCESS;
902}
903
904VkResult SetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100905 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700906 return VK_SUCCESS;
907}
908
909VkResult ResetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100910 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700911 return VK_SUCCESS;
912}
913
Jesse Hall3fbc8562015-11-29 22:10:52 -0800914void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700915}
916
Jesse Halla9bb62b2015-11-21 19:31:56 -0800917VkResult 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 +0100918 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700919 return VK_SUCCESS;
920}
921
Jesse Hall3fbc8562015-11-29 22:10:52 -0800922void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700923}
924
Jesse Hall606a54e2015-11-19 22:17:28 -0800925void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100926 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700927}
928
Jesse Hall3fbc8562015-11-29 22:10:52 -0800929void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700930}
931
Jesse Hall3fbc8562015-11-29 22:10:52 -0800932void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700933}
934
Jesse Hall3fbc8562015-11-29 22:10:52 -0800935void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700936}
937
Jesse Halla9bb62b2015-11-21 19:31:56 -0800938VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100939 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700940 return VK_SUCCESS;
941}
942
943VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100944 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700945 return VK_SUCCESS;
946}
947
Jesse Hall3fbc8562015-11-29 22:10:52 -0800948void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700949}
950
Jesse Hall3fbc8562015-11-29 22:10:52 -0800951void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700952}
953
Jesse Hall3fbc8562015-11-29 22:10:52 -0800954void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700955}
956
Jesse Hall3fbc8562015-11-29 22:10:52 -0800957void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700958}
959
Jesse Hall3fbc8562015-11-29 22:10:52 -0800960void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700961}
962
Jesse Hallfbf97b02015-11-20 14:17:03 -0800963VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100964 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700965 return VK_SUCCESS;
966}
967
Jesse Hallcf25c412015-10-29 17:14:50 -0700968void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100969 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700970}
971
972VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100973 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700974 return VK_SUCCESS;
975}
976
Jesse Hall3fbc8562015-11-29 22:10:52 -0800977void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700978}
979
Jesse Hall3fbc8562015-11-29 22:10:52 -0800980void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700981}
982
Jesse Hall606a54e2015-11-19 22:17:28 -0800983void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100984 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700985}
986
Jesse Hall3fbc8562015-11-29 22:10:52 -0800987VkResult ResetCommandPool(VkDevice device, VkCommandPool cmdPool, VkCommandPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100988 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700989 return VK_SUCCESS;
990}
991
Jesse Hall3fbc8562015-11-29 22:10:52 -0800992VkResult BeginCommandBuffer(VkCommandBuffer cmdBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700993 return VK_SUCCESS;
994}
995
Jesse Hall3fbc8562015-11-29 22:10:52 -0800996VkResult EndCommandBuffer(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700997 return VK_SUCCESS;
998}
999
Jesse Hall3fbc8562015-11-29 22:10:52 -08001000VkResult ResetCommandBuffer(VkCommandBuffer cmdBuffer, VkCommandBufferResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001001 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001002 return VK_SUCCESS;
1003}
1004
Jesse Hall3fbc8562015-11-29 22:10:52 -08001005void CmdBindPipeline(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001006}
1007
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001008void CmdSetViewport(VkCommandBuffer cmdBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001009}
1010
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001011void CmdSetScissor(VkCommandBuffer cmdBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001012}
1013
Jesse Hall3fbc8562015-11-29 22:10:52 -08001014void CmdSetLineWidth(VkCommandBuffer cmdBuffer, float lineWidth) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001015}
1016
Jesse Hall3fbc8562015-11-29 22:10:52 -08001017void CmdSetDepthBias(VkCommandBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001018}
1019
Jesse Hall3fbc8562015-11-29 22:10:52 -08001020void CmdSetBlendConstants(VkCommandBuffer cmdBuffer, const float blendConst[4]) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001021}
1022
Jesse Hall3fbc8562015-11-29 22:10:52 -08001023void CmdSetDepthBounds(VkCommandBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001024}
1025
Jesse Hall3fbc8562015-11-29 22:10:52 -08001026void CmdSetStencilCompareMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001027}
1028
Jesse Hall3fbc8562015-11-29 22:10:52 -08001029void CmdSetStencilWriteMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001030}
1031
Jesse Hall3fbc8562015-11-29 22:10:52 -08001032void CmdSetStencilReference(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001033}
1034
Jesse Hall3fbc8562015-11-29 22:10:52 -08001035void 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 -07001036}
1037
Jesse Hall3fbc8562015-11-29 22:10:52 -08001038void CmdBindIndexBuffer(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001039}
1040
Jesse Hall3fbc8562015-11-29 22:10:52 -08001041void CmdBindVertexBuffers(VkCommandBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001042}
1043
Jesse Hall3fbc8562015-11-29 22:10:52 -08001044void CmdDraw(VkCommandBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001045}
1046
Jesse Hall3fbc8562015-11-29 22:10:52 -08001047void 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 -07001048}
1049
Jesse Hall3fbc8562015-11-29 22:10:52 -08001050void CmdDrawIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001051}
1052
Jesse Hall3fbc8562015-11-29 22:10:52 -08001053void CmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001054}
1055
Jesse Hall3fbc8562015-11-29 22:10:52 -08001056void CmdDispatch(VkCommandBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001057}
1058
Jesse Hall3fbc8562015-11-29 22:10:52 -08001059void CmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001060}
1061
Jesse Hall3fbc8562015-11-29 22:10:52 -08001062void CmdCopyBuffer(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001063}
1064
Jesse Hall3fbc8562015-11-29 22:10:52 -08001065void CmdCopyImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001066}
1067
Jesse Hall3fbc8562015-11-29 22:10:52 -08001068void 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 -07001069}
1070
Jesse Hall3fbc8562015-11-29 22:10:52 -08001071void CmdCopyBufferToImage(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001072}
1073
Jesse Hall3fbc8562015-11-29 22:10:52 -08001074void CmdCopyImageToBuffer(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001075}
1076
Jesse Hall3fbc8562015-11-29 22:10:52 -08001077void CmdUpdateBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001078}
1079
Jesse Hall3fbc8562015-11-29 22:10:52 -08001080void CmdFillBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001081}
1082
Jesse Hall3fbc8562015-11-29 22:10:52 -08001083void CmdClearColorImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001084}
1085
Jesse Hall3fbc8562015-11-29 22:10:52 -08001086void CmdClearDepthStencilImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001087}
1088
Jesse Hall3fbc8562015-11-29 22:10:52 -08001089void CmdClearAttachments(VkCommandBuffer cmdBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001090}
1091
Jesse Hall3fbc8562015-11-29 22:10:52 -08001092void CmdResolveImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001093}
1094
Jesse Hall3fbc8562015-11-29 22:10:52 -08001095void CmdSetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001096}
1097
Jesse Hall3fbc8562015-11-29 22:10:52 -08001098void CmdResetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001099}
1100
Jesse Hall3dd678a2016-01-08 21:52:01 -08001101void 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 -07001102}
1103
Jesse Hall3dd678a2016-01-08 21:52:01 -08001104void 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 -07001105}
1106
Jesse Hall3fbc8562015-11-29 22:10:52 -08001107void CmdBeginQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001108}
1109
Jesse Hall3fbc8562015-11-29 22:10:52 -08001110void CmdEndQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001111}
1112
Jesse Hall3fbc8562015-11-29 22:10:52 -08001113void CmdResetQueryPool(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001114}
1115
Jesse Hall3fbc8562015-11-29 22:10:52 -08001116void CmdWriteTimestamp(VkCommandBuffer cmdBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001117}
1118
Jesse Hall3fbc8562015-11-29 22:10:52 -08001119void 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 -07001120}
1121
Jesse Hall3fbc8562015-11-29 22:10:52 -08001122void CmdPushConstants(VkCommandBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001123}
1124
Jesse Hall65ab5522015-11-30 00:07:16 -08001125void CmdBeginRenderPass(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001126}
1127
Jesse Hall65ab5522015-11-30 00:07:16 -08001128void CmdNextSubpass(VkCommandBuffer cmdBuffer, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001129}
1130
Jesse Hall3fbc8562015-11-29 22:10:52 -08001131void CmdEndRenderPass(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001132}
1133
Jesse Hall3fbc8562015-11-29 22:10:52 -08001134void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001135}
1136
Jesse Hall715b86a2016-01-16 16:34:29 -08001137void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator) {
1138}
1139
1140void DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage) {
1141}
1142
Jesse Hall04f4f472015-08-16 19:51:04 -07001143#pragma clang diagnostic pop
1144// clang-format on
1145
1146} // namespace null_driver