blob: c66ec95a3277195ac87a446f308a3ffbba423edf [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 Hall57f7f8c2016-01-17 17:21:36 -0800298VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice /*gpu*/,
299 uint32_t* count,
300 VkLayerProperties* /*properties*/) {
301 ALOGW("Driver vkEnumerateDeviceLayerProperties shouldn't be called");
302 *count = 0;
303 return VK_SUCCESS;
304}
305
306VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice /*gpu*/,
307 const char* layer_name,
308 uint32_t* count,
309 VkExtensionProperties* properties) {
310 if (layer_name) {
311 ALOGW(
312 "Driver vkEnumerateDeviceExtensionProperties shouldn't be called "
313 "with a layer name ('%s')",
314 layer_name);
315 *count = 0;
316 return VK_SUCCESS;
317 }
318
319 const VkExtensionProperties kExtensions[] = {
320 {VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME,
321 VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION}};
322 const uint32_t kExtensionsCount =
323 sizeof(kExtensions) / sizeof(kExtensions[0]);
324
325 if (!properties || *count > kExtensionsCount)
326 *count = kExtensionsCount;
327 if (properties)
328 std::copy(kExtensions, kExtensions + *count, properties);
329 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
330}
331
Jesse Hall606a54e2015-11-19 22:17:28 -0800332void GetPhysicalDeviceProperties(VkPhysicalDevice,
333 VkPhysicalDeviceProperties* properties) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700334 properties->apiVersion = VK_API_VERSION;
335 properties->driverVersion = VK_MAKE_VERSION(0, 0, 1);
Jesse Hall65ab5522015-11-30 00:07:16 -0800336 properties->vendorID = 0;
337 properties->deviceID = 0;
Jesse Hall04f4f472015-08-16 19:51:04 -0700338 properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
339 strcpy(properties->deviceName, "Android Vulkan Null Driver");
340 memset(properties->pipelineCacheUUID, 0,
341 sizeof(properties->pipelineCacheUUID));
Jesse Hall04f4f472015-08-16 19:51:04 -0700342}
343
Jesse Hall606a54e2015-11-19 22:17:28 -0800344void GetPhysicalDeviceQueueFamilyProperties(
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700345 VkPhysicalDevice,
346 uint32_t* count,
347 VkQueueFamilyProperties* properties) {
Jesse Hall715b86a2016-01-16 16:34:29 -0800348 if (!properties || *count > 1)
349 *count = 1;
350 if (properties && *count == 1) {
Jesse Hall65ab5522015-11-30 00:07:16 -0800351 properties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT |
352 VK_QUEUE_TRANSFER_BIT;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700353 properties->queueCount = 1;
Jesse Hallacfa5342015-11-19 21:51:33 -0800354 properties->timestampValidBits = 64;
Jesse Hall715b86a2016-01-16 16:34:29 -0800355 properties->minImageTransferGranularity = VkExtent3D{1, 1, 1};
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700356 }
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700357}
358
Jesse Hall606a54e2015-11-19 22:17:28 -0800359void GetPhysicalDeviceMemoryProperties(
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100360 VkPhysicalDevice,
361 VkPhysicalDeviceMemoryProperties* properties) {
362 properties->memoryTypeCount = 1;
363 properties->memoryTypes[0].propertyFlags =
Jesse Halld1af8122015-11-29 23:50:38 -0800364 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
365 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
366 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
367 VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100368 properties->memoryTypes[0].heapIndex = 0;
369 properties->memoryHeapCount = 1;
Jesse Hallbde8ee32015-09-01 16:24:29 -0700370 properties->memoryHeaps[0].size = kMaxDeviceMemory;
Jesse Halld1af8122015-11-29 23:50:38 -0800371 properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
Jesse Hall04f4f472015-08-16 19:51:04 -0700372}
373
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100374// -----------------------------------------------------------------------------
375// Device
376
Jesse Hall04f4f472015-08-16 19:51:04 -0700377VkResult CreateDevice(VkPhysicalDevice physical_device,
378 const VkDeviceCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800379 const VkAllocationCallbacks* allocator,
Jesse Hall04f4f472015-08-16 19:51:04 -0700380 VkDevice* out_device) {
381 VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800382 if (!allocator)
383 allocator = &instance->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800384 VkDevice_T* device = static_cast<VkDevice_T*>(allocator->pfnAllocation(
385 allocator->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T),
386 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE));
Jesse Hall04f4f472015-08-16 19:51:04 -0700387 if (!device)
388 return VK_ERROR_OUT_OF_HOST_MEMORY;
389
390 device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800391 device->allocator = *allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700392 device->instance = instance;
393 device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700394 std::fill(device->next_handle.begin(), device->next_handle.end(),
395 UINT64_C(0));
Jesse Hall04f4f472015-08-16 19:51:04 -0700396
397 *out_device = device;
398 return VK_SUCCESS;
399}
400
Jesse Hall3fbc8562015-11-29 22:10:52 -0800401void DestroyDevice(VkDevice device,
402 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700403 if (!device)
Jesse Hallcf25c412015-10-29 17:14:50 -0700404 return;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800405 device->allocator.pfnFree(device->allocator.pUserData, device);
Jesse Hall04f4f472015-08-16 19:51:04 -0700406}
407
Jesse Hall606a54e2015-11-19 22:17:28 -0800408void GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700409 *queue = &device->queue;
Jesse Hall04f4f472015-08-16 19:51:04 -0700410}
411
412// -----------------------------------------------------------------------------
Jesse Hall3fbc8562015-11-29 22:10:52 -0800413// CommandPool
Jesse Hall03b6fe12015-11-24 12:44:21 -0800414
Jesse Hall3fbc8562015-11-29 22:10:52 -0800415struct CommandPool {
416 typedef VkCommandPool HandleType;
417 VkAllocationCallbacks allocator;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800418};
Jesse Hall3fbc8562015-11-29 22:10:52 -0800419DEFINE_OBJECT_HANDLE_CONVERSION(CommandPool)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800420
421VkResult CreateCommandPool(VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800422 const VkCommandPoolCreateInfo* /*create_info*/,
423 const VkAllocationCallbacks* allocator,
424 VkCommandPool* cmd_pool) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800425 if (!allocator)
426 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800427 CommandPool* pool = static_cast<CommandPool*>(allocator->pfnAllocation(
428 allocator->pUserData, sizeof(CommandPool), alignof(CommandPool),
429 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall03b6fe12015-11-24 12:44:21 -0800430 if (!pool)
431 return VK_ERROR_OUT_OF_HOST_MEMORY;
432 pool->allocator = *allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800433 *cmd_pool = GetHandleToCommandPool(pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800434 return VK_SUCCESS;
435}
436
437void DestroyCommandPool(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800438 VkCommandPool cmd_pool,
439 const VkAllocationCallbacks* /*allocator*/) {
440 CommandPool* pool = GetCommandPoolFromHandle(cmd_pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800441 pool->allocator.pfnFree(pool->allocator.pUserData, pool);
442}
443
444// -----------------------------------------------------------------------------
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700445// CmdBuffer
446
Jesse Hall3fbc8562015-11-29 22:10:52 -0800447VkResult AllocateCommandBuffers(VkDevice /*device*/,
448 const VkCommandBufferAllocateInfo* alloc_info,
449 VkCommandBuffer* cmdbufs) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800450 VkResult result = VK_SUCCESS;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800451 CommandPool& pool = *GetCommandPoolFromHandle(alloc_info->commandPool);
Jesse Hall3dd678a2016-01-08 21:52:01 -0800452 std::fill(cmdbufs, cmdbufs + alloc_info->commandBufferCount, nullptr);
453 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800454 cmdbufs[i] =
455 static_cast<VkCommandBuffer_T*>(pool.allocator.pfnAllocation(
456 pool.allocator.pUserData, sizeof(VkCommandBuffer_T),
457 alignof(VkCommandBuffer_T), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallfbf97b02015-11-20 14:17:03 -0800458 if (!cmdbufs[i]) {
459 result = VK_ERROR_OUT_OF_HOST_MEMORY;
460 break;
461 }
462 cmdbufs[i]->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
463 }
464 if (result != VK_SUCCESS) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800465 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800466 if (!cmdbufs[i])
467 break;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800468 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800469 }
470 }
Jesse Hallfbf97b02015-11-20 14:17:03 -0800471 return result;
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700472}
473
Jesse Hall03b6fe12015-11-24 12:44:21 -0800474void FreeCommandBuffers(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800475 VkCommandPool cmd_pool,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800476 uint32_t count,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800477 const VkCommandBuffer* cmdbufs) {
478 CommandPool& pool = *GetCommandPoolFromHandle(cmd_pool);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800479 for (uint32_t i = 0; i < count; i++)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800480 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700481}
482
483// -----------------------------------------------------------------------------
Jesse Hall2077ce02015-08-29 18:10:59 +0100484// DeviceMemory
485
486struct DeviceMemory {
487 typedef VkDeviceMemory HandleType;
488 VkDeviceSize size;
489 alignas(16) uint8_t data[0];
490};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800491DEFINE_OBJECT_HANDLE_CONVERSION(DeviceMemory)
Jesse Hall2077ce02015-08-29 18:10:59 +0100492
Jesse Hall3fbc8562015-11-29 22:10:52 -0800493VkResult AllocateMemory(VkDevice device,
494 const VkMemoryAllocateInfo* alloc_info,
495 const VkAllocationCallbacks* allocator,
496 VkDeviceMemory* mem_handle) {
Jesse Hall2077ce02015-08-29 18:10:59 +0100497 if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize)
498 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800499 if (!allocator)
500 allocator = &device->allocator;
Jesse Hall2077ce02015-08-29 18:10:59 +0100501
Jesse Hall2077ce02015-08-29 18:10:59 +0100502 size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize);
Jesse Hall3fbc8562015-11-29 22:10:52 -0800503 DeviceMemory* mem = static_cast<DeviceMemory*>(allocator->pfnAllocation(
504 allocator->pUserData, size, alignof(DeviceMemory),
505 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall2077ce02015-08-29 18:10:59 +0100506 if (!mem)
507 return VK_ERROR_OUT_OF_HOST_MEMORY;
508 mem->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800509 *mem_handle = GetHandleToDeviceMemory(mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100510 return VK_SUCCESS;
511}
512
Jesse Hall03b6fe12015-11-24 12:44:21 -0800513void FreeMemory(VkDevice device,
514 VkDeviceMemory mem_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800515 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800516 if (!allocator)
517 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800518 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800519 allocator->pfnFree(allocator->pUserData, mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100520}
521
522VkResult MapMemory(VkDevice,
523 VkDeviceMemory mem_handle,
524 VkDeviceSize offset,
525 VkDeviceSize,
526 VkMemoryMapFlags,
527 void** out_ptr) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800528 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall2077ce02015-08-29 18:10:59 +0100529 *out_ptr = &mem->data[0] + offset;
530 return VK_SUCCESS;
531}
532
533// -----------------------------------------------------------------------------
Jesse Hallf6578742015-08-29 17:06:12 +0100534// Buffer
535
536struct Buffer {
537 typedef VkBuffer HandleType;
538 VkDeviceSize size;
539};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800540DEFINE_OBJECT_HANDLE_CONVERSION(Buffer)
Jesse Hallf6578742015-08-29 17:06:12 +0100541
542VkResult CreateBuffer(VkDevice device,
543 const VkBufferCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800544 const VkAllocationCallbacks* allocator,
Jesse Hallf6578742015-08-29 17:06:12 +0100545 VkBuffer* buffer_handle) {
Jesse Hallbde8ee32015-09-01 16:24:29 -0700546 ALOGW_IF(create_info->size > kMaxDeviceMemory,
547 "CreateBuffer: requested size 0x%" PRIx64
548 " exceeds max device memory size 0x%" PRIx64,
549 create_info->size, kMaxDeviceMemory);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800550 if (!allocator)
551 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800552 Buffer* buffer = static_cast<Buffer*>(allocator->pfnAllocation(
553 allocator->pUserData, sizeof(Buffer), alignof(Buffer),
554 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallf6578742015-08-29 17:06:12 +0100555 if (!buffer)
556 return VK_ERROR_OUT_OF_HOST_MEMORY;
557 buffer->size = create_info->size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800558 *buffer_handle = GetHandleToBuffer(buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100559 return VK_SUCCESS;
560}
561
Jesse Hall606a54e2015-11-19 22:17:28 -0800562void GetBufferMemoryRequirements(VkDevice,
563 VkBuffer buffer_handle,
564 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800565 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hallf6578742015-08-29 17:06:12 +0100566 requirements->size = buffer->size;
567 requirements->alignment = 16; // allow fast Neon/SSE memcpy
568 requirements->memoryTypeBits = 0x1;
Jesse Hallf6578742015-08-29 17:06:12 +0100569}
570
Jesse Hall03b6fe12015-11-24 12:44:21 -0800571void DestroyBuffer(VkDevice device,
572 VkBuffer buffer_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800573 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800574 if (!allocator)
575 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800576 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800577 allocator->pfnFree(allocator->pUserData, buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100578}
579
580// -----------------------------------------------------------------------------
Jesse Hall85c05b62015-09-01 18:07:41 -0700581// Image
582
583struct Image {
584 typedef VkImage HandleType;
585 VkDeviceSize size;
586};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800587DEFINE_OBJECT_HANDLE_CONVERSION(Image)
Jesse Hall85c05b62015-09-01 18:07:41 -0700588
589VkResult CreateImage(VkDevice device,
590 const VkImageCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800591 const VkAllocationCallbacks* allocator,
Jesse Hall85c05b62015-09-01 18:07:41 -0700592 VkImage* image_handle) {
593 if (create_info->imageType != VK_IMAGE_TYPE_2D ||
594 create_info->format != VK_FORMAT_R8G8B8A8_UNORM ||
595 create_info->mipLevels != 1) {
596 ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u",
597 create_info->imageType, create_info->format,
598 create_info->mipLevels);
Jesse Halla15a4bf2015-11-19 22:48:02 -0800599 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall85c05b62015-09-01 18:07:41 -0700600 }
601
602 VkDeviceSize size =
603 VkDeviceSize(create_info->extent.width * create_info->extent.height) *
Jesse Halla15a4bf2015-11-19 22:48:02 -0800604 create_info->arrayLayers * create_info->samples * 4u;
Jesse Hall85c05b62015-09-01 18:07:41 -0700605 ALOGW_IF(size > kMaxDeviceMemory,
606 "CreateImage: image size 0x%" PRIx64
607 " exceeds max device memory size 0x%" PRIx64,
608 size, kMaxDeviceMemory);
609
Jesse Hall03b6fe12015-11-24 12:44:21 -0800610 if (!allocator)
611 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800612 Image* image = static_cast<Image*>(allocator->pfnAllocation(
613 allocator->pUserData, sizeof(Image), alignof(Image),
614 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall85c05b62015-09-01 18:07:41 -0700615 if (!image)
616 return VK_ERROR_OUT_OF_HOST_MEMORY;
617 image->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800618 *image_handle = GetHandleToImage(image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700619 return VK_SUCCESS;
620}
621
Jesse Hall606a54e2015-11-19 22:17:28 -0800622void GetImageMemoryRequirements(VkDevice,
623 VkImage image_handle,
624 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800625 Image* image = GetImageFromHandle(image_handle);
Jesse Hall85c05b62015-09-01 18:07:41 -0700626 requirements->size = image->size;
627 requirements->alignment = 16; // allow fast Neon/SSE memcpy
628 requirements->memoryTypeBits = 0x1;
Jesse Hall85c05b62015-09-01 18:07:41 -0700629}
630
Jesse Hall03b6fe12015-11-24 12:44:21 -0800631void DestroyImage(VkDevice device,
632 VkImage image_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800633 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800634 if (!allocator)
635 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800636 Image* image = GetImageFromHandle(image_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800637 allocator->pfnFree(allocator->pUserData, image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700638}
639
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800640VkResult GetSwapchainGrallocUsageANDROID(VkDevice,
641 VkFormat,
642 VkImageUsageFlags,
643 int* grallocUsage) {
644 // The null driver never reads or writes the gralloc buffer
645 *grallocUsage = 0;
646 return VK_SUCCESS;
647}
648
649VkResult AcquireImageANDROID(VkDevice,
650 VkImage,
651 int fence,
652 VkSemaphore,
653 VkFence) {
654 close(fence);
655 return VK_SUCCESS;
656}
657
658VkResult QueueSignalReleaseImageANDROID(VkQueue,
659 uint32_t,
660 const VkSemaphore*,
661 VkImage,
662 int* fence) {
663 *fence = -1;
664 return VK_SUCCESS;
665}
666
Jesse Hall85c05b62015-09-01 18:07:41 -0700667// -----------------------------------------------------------------------------
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700668// No-op types
669
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700670VkResult CreateBufferView(VkDevice device,
671 const VkBufferViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800672 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700673 VkBufferView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800674 *view = AllocHandle<VkBufferView>(device, HandleType::kBufferView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700675 return VK_SUCCESS;
676}
677
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700678VkResult CreateDescriptorPool(VkDevice device,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700679 const VkDescriptorPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800680 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700681 VkDescriptorPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800682 *pool = AllocHandle<VkDescriptorPool>(device, HandleType::kDescriptorPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700683 return VK_SUCCESS;
684}
685
Jesse Hall3fbc8562015-11-29 22:10:52 -0800686VkResult AllocateDescriptorSets(VkDevice device,
687 const VkDescriptorSetAllocateInfo* alloc_info,
688 VkDescriptorSet* descriptor_sets) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800689 for (uint32_t i = 0; i < alloc_info->descriptorSetCount; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800690 descriptor_sets[i] =
691 AllocHandle<VkDescriptorSet>(device, HandleType::kDescriptorSet);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700692 return VK_SUCCESS;
693}
694
695VkResult CreateDescriptorSetLayout(VkDevice device,
696 const VkDescriptorSetLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800697 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700698 VkDescriptorSetLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800699 *layout = AllocHandle<VkDescriptorSetLayout>(
700 device, HandleType::kDescriptorSetLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700701 return VK_SUCCESS;
702}
703
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700704VkResult CreateEvent(VkDevice device,
705 const VkEventCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800706 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700707 VkEvent* event) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800708 *event = AllocHandle<VkEvent>(device, HandleType::kEvent);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700709 return VK_SUCCESS;
710}
711
712VkResult CreateFence(VkDevice device,
713 const VkFenceCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800714 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700715 VkFence* fence) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800716 *fence = AllocHandle<VkFence>(device, HandleType::kFence);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700717 return VK_SUCCESS;
718}
719
720VkResult CreateFramebuffer(VkDevice device,
721 const VkFramebufferCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800722 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700723 VkFramebuffer* framebuffer) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800724 *framebuffer = AllocHandle<VkFramebuffer>(device, HandleType::kFramebuffer);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700725 return VK_SUCCESS;
726}
727
728VkResult CreateImageView(VkDevice device,
729 const VkImageViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800730 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700731 VkImageView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800732 *view = AllocHandle<VkImageView>(device, HandleType::kImageView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700733 return VK_SUCCESS;
734}
735
736VkResult CreateGraphicsPipelines(VkDevice device,
737 VkPipelineCache,
738 uint32_t count,
739 const VkGraphicsPipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800740 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700741 VkPipeline* pipelines) {
742 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800743 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700744 return VK_SUCCESS;
745}
746
747VkResult CreateComputePipelines(VkDevice device,
748 VkPipelineCache,
749 uint32_t count,
750 const VkComputePipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800751 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700752 VkPipeline* pipelines) {
753 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800754 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700755 return VK_SUCCESS;
756}
757
758VkResult CreatePipelineCache(VkDevice device,
759 const VkPipelineCacheCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800760 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700761 VkPipelineCache* cache) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800762 *cache = AllocHandle<VkPipelineCache>(device, HandleType::kPipelineCache);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700763 return VK_SUCCESS;
764}
765
766VkResult CreatePipelineLayout(VkDevice device,
767 const VkPipelineLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800768 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700769 VkPipelineLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800770 *layout =
771 AllocHandle<VkPipelineLayout>(device, HandleType::kPipelineLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700772 return VK_SUCCESS;
773}
774
775VkResult CreateQueryPool(VkDevice device,
776 const VkQueryPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800777 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700778 VkQueryPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800779 *pool = AllocHandle<VkQueryPool>(device, HandleType::kQueryPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700780 return VK_SUCCESS;
781}
782
783VkResult CreateRenderPass(VkDevice device,
784 const VkRenderPassCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800785 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700786 VkRenderPass* renderpass) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800787 *renderpass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700788 return VK_SUCCESS;
789}
790
791VkResult CreateSampler(VkDevice device,
792 const VkSamplerCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800793 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700794 VkSampler* sampler) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800795 *sampler = AllocHandle<VkSampler>(device, HandleType::kSampler);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700796 return VK_SUCCESS;
797}
798
799VkResult CreateSemaphore(VkDevice device,
800 const VkSemaphoreCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800801 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700802 VkSemaphore* semaphore) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800803 *semaphore = AllocHandle<VkSemaphore>(device, HandleType::kSemaphore);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700804 return VK_SUCCESS;
805}
806
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700807VkResult CreateShaderModule(VkDevice device,
808 const VkShaderModuleCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800809 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700810 VkShaderModule* module) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800811 *module = AllocHandle<VkShaderModule>(device, HandleType::kShaderModule);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700812 return VK_SUCCESS;
813}
814
Jesse Hall715b86a2016-01-16 16:34:29 -0800815VkResult CreateDebugReportCallbackEXT(VkInstance instance,
816 const VkDebugReportCallbackCreateInfoEXT*,
817 const VkAllocationCallbacks*,
818 VkDebugReportCallbackEXT* callback) {
819 *callback = AllocHandle<VkDebugReportCallbackEXT>(
820 instance, HandleType::kDebugReportCallbackEXT);
821 return VK_SUCCESS;
822}
823
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700824// -----------------------------------------------------------------------------
Jesse Hall04f4f472015-08-16 19:51:04 -0700825// No-op entrypoints
826
827// clang-format off
828#pragma clang diagnostic push
829#pragma clang diagnostic ignored "-Wunused-parameter"
830
Jesse Hall606a54e2015-11-19 22:17:28 -0800831void GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100832 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700833}
834
Jesse Hall606a54e2015-11-19 22:17:28 -0800835void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100836 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700837}
838
Jesse Halla9e57032015-11-30 01:03:10 -0800839VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100840 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Halla9e57032015-11-30 01:03:10 -0800841 return VK_SUCCESS;
Jesse Hall04f4f472015-08-16 19:51:04 -0700842}
843
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700844VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100845 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700846 return VK_SUCCESS;
847}
848
Jesse Halla366a512015-11-19 22:30:07 -0800849VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700850 return VK_SUCCESS;
851}
852
853VkResult QueueWaitIdle(VkQueue queue) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100854 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700855 return VK_SUCCESS;
856}
857
858VkResult DeviceWaitIdle(VkDevice device) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100859 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700860 return VK_SUCCESS;
861}
862
Jesse Hallcf25c412015-10-29 17:14:50 -0700863void UnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700864}
865
866VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100867 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700868 return VK_SUCCESS;
869}
870
871VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100872 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700873 return VK_SUCCESS;
874}
875
Jesse Hall606a54e2015-11-19 22:17:28 -0800876void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100877 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700878}
879
Jesse Hall04f4f472015-08-16 19:51:04 -0700880VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset) {
881 return VK_SUCCESS;
882}
883
Jesse Hall04f4f472015-08-16 19:51:04 -0700884VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset) {
885 return VK_SUCCESS;
886}
887
Jesse Hall606a54e2015-11-19 22:17:28 -0800888void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100889 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700890}
891
Jesse Hall091ed9e2015-11-30 00:55:29 -0800892void 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 +0100893 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700894}
895
Jesse Halla6429252015-11-29 18:59:42 -0800896VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
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 DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700902}
903
904VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
905 return VK_SUCCESS;
906}
907
908VkResult GetFenceStatus(VkDevice device, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100909 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700910 return VK_SUCCESS;
911}
912
913VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
914 return VK_SUCCESS;
915}
916
Jesse Hall3fbc8562015-11-29 22:10:52 -0800917void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700918}
919
Jesse Hall3fbc8562015-11-29 22:10:52 -0800920void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700921}
922
923VkResult GetEventStatus(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100924 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700925 return VK_SUCCESS;
926}
927
928VkResult SetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100929 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700930 return VK_SUCCESS;
931}
932
933VkResult ResetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100934 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700935 return VK_SUCCESS;
936}
937
Jesse Hall3fbc8562015-11-29 22:10:52 -0800938void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700939}
940
Jesse Halla9bb62b2015-11-21 19:31:56 -0800941VkResult 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 +0100942 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700943 return VK_SUCCESS;
944}
945
Jesse Hall3fbc8562015-11-29 22:10:52 -0800946void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700947}
948
Jesse Hall606a54e2015-11-19 22:17:28 -0800949void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100950 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700951}
952
Jesse Hall3fbc8562015-11-29 22:10:52 -0800953void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700954}
955
Jesse Hall3fbc8562015-11-29 22:10:52 -0800956void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700957}
958
Jesse Hall3fbc8562015-11-29 22:10:52 -0800959void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700960}
961
Jesse Halla9bb62b2015-11-21 19:31:56 -0800962VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100963 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700964 return VK_SUCCESS;
965}
966
967VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100968 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700969 return VK_SUCCESS;
970}
971
Jesse Hall3fbc8562015-11-29 22:10:52 -0800972void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700973}
974
Jesse Hall3fbc8562015-11-29 22:10:52 -0800975void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700976}
977
Jesse Hall3fbc8562015-11-29 22:10:52 -0800978void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700979}
980
Jesse Hall3fbc8562015-11-29 22:10:52 -0800981void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700982}
983
Jesse Hall3fbc8562015-11-29 22:10:52 -0800984void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700985}
986
Jesse Hallfbf97b02015-11-20 14:17:03 -0800987VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags 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 Hallcf25c412015-10-29 17:14:50 -0700992void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100993 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700994}
995
996VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100997 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700998 return VK_SUCCESS;
999}
1000
Jesse Hall3fbc8562015-11-29 22:10:52 -08001001void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001002}
1003
Jesse Hall3fbc8562015-11-29 22:10:52 -08001004void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001005}
1006
Jesse Hall606a54e2015-11-19 22:17:28 -08001007void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001008 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001009}
1010
Jesse Hall3fbc8562015-11-29 22:10:52 -08001011VkResult ResetCommandPool(VkDevice device, VkCommandPool cmdPool, VkCommandPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001012 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001013 return VK_SUCCESS;
1014}
1015
Jesse Hall3fbc8562015-11-29 22:10:52 -08001016VkResult BeginCommandBuffer(VkCommandBuffer cmdBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001017 return VK_SUCCESS;
1018}
1019
Jesse Hall3fbc8562015-11-29 22:10:52 -08001020VkResult EndCommandBuffer(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001021 return VK_SUCCESS;
1022}
1023
Jesse Hall3fbc8562015-11-29 22:10:52 -08001024VkResult ResetCommandBuffer(VkCommandBuffer cmdBuffer, VkCommandBufferResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001025 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001026 return VK_SUCCESS;
1027}
1028
Jesse Hall3fbc8562015-11-29 22:10:52 -08001029void CmdBindPipeline(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001030}
1031
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001032void CmdSetViewport(VkCommandBuffer cmdBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001033}
1034
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001035void CmdSetScissor(VkCommandBuffer cmdBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001036}
1037
Jesse Hall3fbc8562015-11-29 22:10:52 -08001038void CmdSetLineWidth(VkCommandBuffer cmdBuffer, float lineWidth) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001039}
1040
Jesse Hall3fbc8562015-11-29 22:10:52 -08001041void CmdSetDepthBias(VkCommandBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001042}
1043
Jesse Hall3fbc8562015-11-29 22:10:52 -08001044void CmdSetBlendConstants(VkCommandBuffer cmdBuffer, const float blendConst[4]) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001045}
1046
Jesse Hall3fbc8562015-11-29 22:10:52 -08001047void CmdSetDepthBounds(VkCommandBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001048}
1049
Jesse Hall3fbc8562015-11-29 22:10:52 -08001050void CmdSetStencilCompareMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001051}
1052
Jesse Hall3fbc8562015-11-29 22:10:52 -08001053void CmdSetStencilWriteMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001054}
1055
Jesse Hall3fbc8562015-11-29 22:10:52 -08001056void CmdSetStencilReference(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001057}
1058
Jesse Hall3fbc8562015-11-29 22:10:52 -08001059void 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 -07001060}
1061
Jesse Hall3fbc8562015-11-29 22:10:52 -08001062void CmdBindIndexBuffer(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001063}
1064
Jesse Hall3fbc8562015-11-29 22:10:52 -08001065void CmdBindVertexBuffers(VkCommandBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001066}
1067
Jesse Hall3fbc8562015-11-29 22:10:52 -08001068void CmdDraw(VkCommandBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001069}
1070
Jesse Hall3fbc8562015-11-29 22:10:52 -08001071void 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 -07001072}
1073
Jesse Hall3fbc8562015-11-29 22:10:52 -08001074void CmdDrawIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001075}
1076
Jesse Hall3fbc8562015-11-29 22:10:52 -08001077void CmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001078}
1079
Jesse Hall3fbc8562015-11-29 22:10:52 -08001080void CmdDispatch(VkCommandBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001081}
1082
Jesse Hall3fbc8562015-11-29 22:10:52 -08001083void CmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001084}
1085
Jesse Hall3fbc8562015-11-29 22:10:52 -08001086void CmdCopyBuffer(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001087}
1088
Jesse Hall3fbc8562015-11-29 22:10:52 -08001089void CmdCopyImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001090}
1091
Jesse Hall3fbc8562015-11-29 22:10:52 -08001092void 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 -07001093}
1094
Jesse Hall3fbc8562015-11-29 22:10:52 -08001095void CmdCopyBufferToImage(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001096}
1097
Jesse Hall3fbc8562015-11-29 22:10:52 -08001098void CmdCopyImageToBuffer(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001099}
1100
Jesse Hall3fbc8562015-11-29 22:10:52 -08001101void CmdUpdateBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001102}
1103
Jesse Hall3fbc8562015-11-29 22:10:52 -08001104void CmdFillBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001105}
1106
Jesse Hall3fbc8562015-11-29 22:10:52 -08001107void CmdClearColorImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001108}
1109
Jesse Hall3fbc8562015-11-29 22:10:52 -08001110void CmdClearDepthStencilImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001111}
1112
Jesse Hall3fbc8562015-11-29 22:10:52 -08001113void CmdClearAttachments(VkCommandBuffer cmdBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001114}
1115
Jesse Hall3fbc8562015-11-29 22:10:52 -08001116void CmdResolveImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001117}
1118
Jesse Hall3fbc8562015-11-29 22:10:52 -08001119void CmdSetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001120}
1121
Jesse Hall3fbc8562015-11-29 22:10:52 -08001122void CmdResetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001123}
1124
Jesse Hall3dd678a2016-01-08 21:52:01 -08001125void 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 -07001126}
1127
Jesse Hall3dd678a2016-01-08 21:52:01 -08001128void 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 -07001129}
1130
Jesse Hall3fbc8562015-11-29 22:10:52 -08001131void CmdBeginQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001132}
1133
Jesse Hall3fbc8562015-11-29 22:10:52 -08001134void CmdEndQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001135}
1136
Jesse Hall3fbc8562015-11-29 22:10:52 -08001137void CmdResetQueryPool(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001138}
1139
Jesse Hall3fbc8562015-11-29 22:10:52 -08001140void CmdWriteTimestamp(VkCommandBuffer cmdBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001141}
1142
Jesse Hall3fbc8562015-11-29 22:10:52 -08001143void 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 -07001144}
1145
Jesse Hall3fbc8562015-11-29 22:10:52 -08001146void CmdPushConstants(VkCommandBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001147}
1148
Jesse Hall65ab5522015-11-30 00:07:16 -08001149void CmdBeginRenderPass(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001150}
1151
Jesse Hall65ab5522015-11-30 00:07:16 -08001152void CmdNextSubpass(VkCommandBuffer cmdBuffer, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001153}
1154
Jesse Hall3fbc8562015-11-29 22:10:52 -08001155void CmdEndRenderPass(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001156}
1157
Jesse Hall3fbc8562015-11-29 22:10:52 -08001158void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001159}
1160
Jesse Hall715b86a2016-01-16 16:34:29 -08001161void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator) {
1162}
1163
1164void DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage) {
1165}
1166
Jesse Hall04f4f472015-08-16 19:51:04 -07001167#pragma clang diagnostic pop
1168// clang-format on
1169
1170} // namespace null_driver