blob: 4b4d22d8ee5fd91d139e7d4be39d75b635e9d87c [file] [log] [blame]
Jesse Halld02edcb2015-09-08 07:44:48 -07001/*
2 * Copyright 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Jesse Hall04f4f472015-08-16 19:51:04 -070017#include <hardware/hwvulkan.h>
18
Jesse Hallf8faf0c2015-08-31 11:34:32 -070019#include <array>
Jesse Hall04f4f472015-08-16 19:51:04 -070020#include <algorithm>
Jesse Hallbde8ee32015-09-01 16:24:29 -070021#include <inttypes.h>
22#include <string.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070023
Jesse Hall73ab0ac2015-08-25 15:09:15 +010024// #define LOG_NDEBUG 0
25#include <log/log.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070026#include <utils/Errors.h>
27
28#include "null_driver.h"
29
30using namespace null_driver;
31
32struct VkPhysicalDevice_T {
33 hwvulkan_dispatch_t dispatch;
34};
35
36struct VkInstance_T {
37 hwvulkan_dispatch_t dispatch;
38 const VkAllocCallbacks* alloc;
39 VkPhysicalDevice_T physical_device;
40};
41
42struct VkQueue_T {
43 hwvulkan_dispatch_t dispatch;
44};
45
46struct VkCmdBuffer_T {
47 hwvulkan_dispatch_t dispatch;
48};
49
Jesse Hallf8faf0c2015-08-31 11:34:32 -070050namespace {
51// Handles for non-dispatchable objects are either pointers, or arbitrary
52// 64-bit non-zero values. We only use pointers when we need to keep state for
53// the object even in a null driver. For the rest, we form a handle as:
54// [63:63] = 1 to distinguish from pointer handles*
55// [62:56] = non-zero handle type enum value
56// [55: 0] = per-handle-type incrementing counter
57// * This works because virtual addresses with the high bit set are reserved
58// for kernel data in all ABIs we run on.
59//
60// We never reclaim handles on vkDestroy*. It's not even necessary for us to
61// have distinct handles for live objects, and practically speaking we won't
62// ever create 2^56 objects of the same type from a single VkDevice in a null
63// driver.
64//
65// Using a namespace here instead of 'enum class' since we want scoped
66// constants but also want implicit conversions to integral types.
67namespace HandleType {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070068enum Enum {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070069 kBufferView,
70 kCmdPool,
71 kDescriptorPool,
72 kDescriptorSet,
73 kDescriptorSetLayout,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070074 kEvent,
75 kFence,
76 kFramebuffer,
77 kImageView,
78 kPipeline,
79 kPipelineCache,
80 kPipelineLayout,
81 kQueryPool,
82 kRenderPass,
83 kSampler,
84 kSemaphore,
85 kShader,
86 kShaderModule,
Jesse Hallf8faf0c2015-08-31 11:34:32 -070087
Jesse Hallc7a6eb52015-08-31 12:52:03 -070088 kNumTypes
89};
90} // namespace HandleType
Jesse Hallf8faf0c2015-08-31 11:34:32 -070091uint64_t AllocHandle(VkDevice device, HandleType::Enum type);
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;
99 VkInstance_T* instance;
100 VkQueue_T queue;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700101 std::array<uint64_t, HandleType::kNumTypes> next_handle;
Jesse Hall04f4f472015-08-16 19:51:04 -0700102};
103
104// -----------------------------------------------------------------------------
105// Declare HAL_MODULE_INFO_SYM early so it can be referenced by nulldrv_device
106// later.
107
108namespace {
109int OpenDevice(const hw_module_t* module, const char* id, hw_device_t** device);
110hw_module_methods_t nulldrv_module_methods = {.open = OpenDevice};
111} // namespace
112
113#pragma clang diagnostic push
114#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
115__attribute__((visibility("default"))) hwvulkan_module_t HAL_MODULE_INFO_SYM = {
116 .common =
117 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500118 .tag = HARDWARE_MODULE_TAG,
119 .module_api_version = HWVULKAN_MODULE_API_VERSION_0_1,
120 .hal_api_version = HARDWARE_HAL_API_VERSION,
121 .id = HWVULKAN_HARDWARE_MODULE_ID,
122 .name = "Null Vulkan Driver",
123 .author = "The Android Open Source Project",
124 .methods = &nulldrv_module_methods,
Jesse Hall04f4f472015-08-16 19:51:04 -0700125 },
126};
127#pragma clang diagnostic pop
128
129// -----------------------------------------------------------------------------
130
131namespace {
132
133VkResult CreateInstance(const VkInstanceCreateInfo* create_info,
134 VkInstance* out_instance) {
Jesse Hallb1352bc2015-09-04 16:12:33 -0700135 // Assume the loader provided alloc callbacks even if the app didn't.
136 ALOG_ASSERT(
Jesse Halld7b994a2015-09-07 14:17:37 -0700137 create_info->pAllocCb,
Jesse Hallb1352bc2015-09-04 16:12:33 -0700138 "Missing alloc callbacks, loader or app should have provided them");
139
Jesse Hall04f4f472015-08-16 19:51:04 -0700140 VkInstance_T* instance =
141 static_cast<VkInstance_T*>(create_info->pAllocCb->pfnAlloc(
142 create_info->pAllocCb->pUserData, sizeof(VkInstance_T),
143 alignof(VkInstance_T), VK_SYSTEM_ALLOC_TYPE_API_OBJECT));
144 if (!instance)
145 return VK_ERROR_OUT_OF_HOST_MEMORY;
146
147 instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
148 instance->alloc = create_info->pAllocCb;
149 instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
150
151 *out_instance = instance;
152 return VK_SUCCESS;
153}
154
155int CloseDevice(struct hw_device_t* /*device*/) {
156 // nothing to do - opening a device doesn't allocate any resources
157 return 0;
158}
159
160hwvulkan_device_t nulldrv_device = {
161 .common =
162 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500163 .tag = HARDWARE_DEVICE_TAG,
164 .version = HWVULKAN_DEVICE_API_VERSION_0_1,
165 .module = &HAL_MODULE_INFO_SYM.common,
166 .close = CloseDevice,
Jesse Hall04f4f472015-08-16 19:51:04 -0700167 },
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700168 .EnumerateInstanceExtensionProperties =
169 EnumerateInstanceExtensionProperties,
Jesse Hall04f4f472015-08-16 19:51:04 -0700170 .CreateInstance = CreateInstance,
171 .GetInstanceProcAddr = GetInstanceProcAddr};
172
173int OpenDevice(const hw_module_t* /*module*/,
174 const char* id,
175 hw_device_t** device) {
176 if (strcmp(id, HWVULKAN_DEVICE_0) == 0) {
177 *device = &nulldrv_device.common;
178 return 0;
179 }
180 return -ENOENT;
181}
182
183VkInstance_T* GetInstanceFromPhysicalDevice(
184 VkPhysicalDevice_T* physical_device) {
185 return reinterpret_cast<VkInstance_T*>(
186 reinterpret_cast<uintptr_t>(physical_device) -
187 offsetof(VkInstance_T, physical_device));
188}
189
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700190uint64_t AllocHandle(VkDevice device, HandleType::Enum type) {
191 const uint64_t kHandleMask = (UINT64_C(1) << 56) - 1;
192 ALOGE_IF(device->next_handle[type] == kHandleMask,
Jesse Hallbde8ee32015-09-01 16:24:29 -0700193 "non-dispatchable handles of type=%u are about to overflow", type);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700194 return (UINT64_C(1) << 63) | ((uint64_t(type) & 0x7) << 56) |
195 (device->next_handle[type]++ & kHandleMask);
196}
197
Jesse Hall04f4f472015-08-16 19:51:04 -0700198} // namespace
199
200namespace null_driver {
201
Jesse Hallf6578742015-08-29 17:06:12 +0100202template <typename HandleT>
203struct HandleTraits {};
204
205template <typename HandleT>
206typename HandleTraits<HandleT>::PointerType GetObjectFromHandle(
207 const HandleT& h) {
208 return reinterpret_cast<typename HandleTraits<HandleT>::PointerType>(
209 uintptr_t(h.handle));
210}
211
212template <typename T>
213typename T::HandleType GetHandleToObject(const T* obj) {
214 return typename T::HandleType(reinterpret_cast<uintptr_t>(obj));
215}
216
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100217// -----------------------------------------------------------------------------
218// Global
219
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700220VkResult EnumerateInstanceExtensionProperties(const char*,
221 uint32_t* count,
222 VkExtensionProperties*) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100223 *count = 0;
224 return VK_SUCCESS;
225}
226
Jesse Hall04f4f472015-08-16 19:51:04 -0700227PFN_vkVoidFunction GetInstanceProcAddr(VkInstance, const char* name) {
228 PFN_vkVoidFunction proc = LookupInstanceProcAddr(name);
229 if (!proc && strcmp(name, "vkGetDeviceProcAddr") == 0)
230 proc = reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr);
231 return proc;
232}
233
234PFN_vkVoidFunction GetDeviceProcAddr(VkDevice, const char* name) {
Jesse Hallb1352bc2015-09-04 16:12:33 -0700235 PFN_vkVoidFunction proc = LookupDeviceProcAddr(name);
236 if (proc)
237 return proc;
238 if (strcmp(name, "vkImportNativeFenceANDROID") == 0)
239 return reinterpret_cast<PFN_vkVoidFunction>(ImportNativeFenceANDROID);
240 if (strcmp(name, "vkQueueSignalNativeFenceANDROID") == 0)
241 return reinterpret_cast<PFN_vkVoidFunction>(
242 QueueSignalNativeFenceANDROID);
243 return nullptr;
Jesse Hall04f4f472015-08-16 19:51:04 -0700244}
245
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100246// -----------------------------------------------------------------------------
247// Instance
248
Jesse Hallcf25c412015-10-29 17:14:50 -0700249void DestroyInstance(VkInstance instance) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700250 instance->alloc->pfnFree(instance->alloc->pUserData, instance);
Jesse Hall04f4f472015-08-16 19:51:04 -0700251}
252
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100253// -----------------------------------------------------------------------------
254// PhysicalDevice
255
Jesse Hall04f4f472015-08-16 19:51:04 -0700256VkResult EnumeratePhysicalDevices(VkInstance instance,
257 uint32_t* physical_device_count,
258 VkPhysicalDevice* physical_devices) {
259 if (physical_devices && *physical_device_count >= 1)
260 physical_devices[0] = &instance->physical_device;
261 *physical_device_count = 1;
262 return VK_SUCCESS;
263}
264
265VkResult GetPhysicalDeviceProperties(VkPhysicalDevice,
266 VkPhysicalDeviceProperties* properties) {
267 properties->apiVersion = VK_API_VERSION;
268 properties->driverVersion = VK_MAKE_VERSION(0, 0, 1);
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700269 properties->vendorId = 0;
270 properties->deviceId = 0;
Jesse Hall04f4f472015-08-16 19:51:04 -0700271 properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
272 strcpy(properties->deviceName, "Android Vulkan Null Driver");
273 memset(properties->pipelineCacheUUID, 0,
274 sizeof(properties->pipelineCacheUUID));
275 return VK_SUCCESS;
276}
277
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700278VkResult GetPhysicalDeviceQueueFamilyProperties(
279 VkPhysicalDevice,
280 uint32_t* count,
281 VkQueueFamilyProperties* properties) {
282 if (properties) {
283 if (*count < 1)
284 return VK_INCOMPLETE;
285 properties->queueFlags =
286 VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_DMA_BIT;
287 properties->queueCount = 1;
288 properties->supportsTimestamps = VK_FALSE;
289 }
290 *count = 1;
291 return VK_SUCCESS;
292}
293
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100294VkResult GetPhysicalDeviceMemoryProperties(
295 VkPhysicalDevice,
296 VkPhysicalDeviceMemoryProperties* properties) {
297 properties->memoryTypeCount = 1;
298 properties->memoryTypes[0].propertyFlags =
299 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
300 properties->memoryTypes[0].heapIndex = 0;
301 properties->memoryHeapCount = 1;
Jesse Hallbde8ee32015-09-01 16:24:29 -0700302 properties->memoryHeaps[0].size = kMaxDeviceMemory;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700303 properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_HOST_LOCAL_BIT;
Jesse Hall04f4f472015-08-16 19:51:04 -0700304 return VK_SUCCESS;
305}
306
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100307// -----------------------------------------------------------------------------
308// Device
309
Jesse Hall04f4f472015-08-16 19:51:04 -0700310VkResult CreateDevice(VkPhysicalDevice physical_device,
311 const VkDeviceCreateInfo*,
312 VkDevice* out_device) {
313 VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device);
314 VkDevice_T* device = static_cast<VkDevice_T*>(instance->alloc->pfnAlloc(
315 instance->alloc->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T),
316 VK_SYSTEM_ALLOC_TYPE_API_OBJECT));
317 if (!device)
318 return VK_ERROR_OUT_OF_HOST_MEMORY;
319
320 device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
321 device->instance = instance;
322 device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700323 std::fill(device->next_handle.begin(), device->next_handle.end(),
324 UINT64_C(0));
Jesse Hall04f4f472015-08-16 19:51:04 -0700325
326 *out_device = device;
327 return VK_SUCCESS;
328}
329
Jesse Hallcf25c412015-10-29 17:14:50 -0700330void DestroyDevice(VkDevice device) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700331 if (!device)
Jesse Hallcf25c412015-10-29 17:14:50 -0700332 return;
Jesse Hall04f4f472015-08-16 19:51:04 -0700333 const VkAllocCallbacks* alloc = device->instance->alloc;
334 alloc->pfnFree(alloc->pUserData, device);
Jesse Hall04f4f472015-08-16 19:51:04 -0700335}
336
337VkResult GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) {
338 *queue = &device->queue;
339 return VK_SUCCESS;
340}
341
342// -----------------------------------------------------------------------------
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700343// CmdBuffer
344
345VkResult CreateCommandBuffer(VkDevice device,
346 const VkCmdBufferCreateInfo*,
347 VkCmdBuffer* out_cmdbuf) {
348 const VkAllocCallbacks* alloc = device->instance->alloc;
349 VkCmdBuffer_T* cmdbuf = static_cast<VkCmdBuffer_T*>(alloc->pfnAlloc(
350 alloc->pUserData, sizeof(VkCmdBuffer_T), alignof(VkCmdBuffer_T),
351 VK_SYSTEM_ALLOC_TYPE_API_OBJECT));
352 if (!cmdbuf)
353 return VK_ERROR_OUT_OF_HOST_MEMORY;
354 cmdbuf->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
355 *out_cmdbuf = cmdbuf;
356 return VK_SUCCESS;
357}
358
Jesse Hallcf25c412015-10-29 17:14:50 -0700359void DestroyCommandBuffer(VkDevice device, VkCmdBuffer cmdbuf) {
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700360 const VkAllocCallbacks* alloc = device->instance->alloc;
361 alloc->pfnFree(alloc->pUserData, cmdbuf);
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700362}
363
364// -----------------------------------------------------------------------------
Jesse Hall2077ce02015-08-29 18:10:59 +0100365// DeviceMemory
366
367struct DeviceMemory {
368 typedef VkDeviceMemory HandleType;
369 VkDeviceSize size;
370 alignas(16) uint8_t data[0];
371};
372template <>
373struct HandleTraits<VkDeviceMemory> {
374 typedef DeviceMemory* PointerType;
375};
376
377VkResult AllocMemory(VkDevice device,
378 const VkMemoryAllocInfo* alloc_info,
379 VkDeviceMemory* mem_handle) {
380 if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize)
381 return VK_ERROR_OUT_OF_HOST_MEMORY;
382
383 const VkAllocCallbacks* alloc = device->instance->alloc;
384 size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize);
385 DeviceMemory* mem = static_cast<DeviceMemory*>(
386 alloc->pfnAlloc(alloc->pUserData, size, alignof(DeviceMemory),
387 VK_SYSTEM_ALLOC_TYPE_API_OBJECT));
388 if (!mem)
389 return VK_ERROR_OUT_OF_HOST_MEMORY;
390 mem->size = size;
391 *mem_handle = GetHandleToObject(mem);
392 return VK_SUCCESS;
393}
394
Jesse Hallcf25c412015-10-29 17:14:50 -0700395void FreeMemory(VkDevice device, VkDeviceMemory mem_handle) {
Jesse Hall2077ce02015-08-29 18:10:59 +0100396 const VkAllocCallbacks* alloc = device->instance->alloc;
397 DeviceMemory* mem = GetObjectFromHandle(mem_handle);
398 alloc->pfnFree(alloc->pUserData, mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100399}
400
401VkResult MapMemory(VkDevice,
402 VkDeviceMemory mem_handle,
403 VkDeviceSize offset,
404 VkDeviceSize,
405 VkMemoryMapFlags,
406 void** out_ptr) {
407 DeviceMemory* mem = GetObjectFromHandle(mem_handle);
408 *out_ptr = &mem->data[0] + offset;
409 return VK_SUCCESS;
410}
411
412// -----------------------------------------------------------------------------
Jesse Hallf6578742015-08-29 17:06:12 +0100413// Buffer
414
415struct Buffer {
416 typedef VkBuffer HandleType;
417 VkDeviceSize size;
418};
419template <>
420struct HandleTraits<VkBuffer> {
421 typedef Buffer* PointerType;
422};
423
424VkResult CreateBuffer(VkDevice device,
425 const VkBufferCreateInfo* create_info,
426 VkBuffer* buffer_handle) {
Jesse Hallbde8ee32015-09-01 16:24:29 -0700427 ALOGW_IF(create_info->size > kMaxDeviceMemory,
428 "CreateBuffer: requested size 0x%" PRIx64
429 " exceeds max device memory size 0x%" PRIx64,
430 create_info->size, kMaxDeviceMemory);
431
Jesse Hallf6578742015-08-29 17:06:12 +0100432 const VkAllocCallbacks* alloc = device->instance->alloc;
433 Buffer* buffer = static_cast<Buffer*>(
434 alloc->pfnAlloc(alloc->pUserData, sizeof(Buffer), alignof(Buffer),
435 VK_SYSTEM_ALLOC_TYPE_API_OBJECT));
436 if (!buffer)
437 return VK_ERROR_OUT_OF_HOST_MEMORY;
438 buffer->size = create_info->size;
439 *buffer_handle = GetHandleToObject(buffer);
440 return VK_SUCCESS;
441}
442
443VkResult GetBufferMemoryRequirements(VkDevice,
444 VkBuffer buffer_handle,
445 VkMemoryRequirements* requirements) {
446 Buffer* buffer = GetObjectFromHandle(buffer_handle);
447 requirements->size = buffer->size;
448 requirements->alignment = 16; // allow fast Neon/SSE memcpy
449 requirements->memoryTypeBits = 0x1;
450 return VK_SUCCESS;
451}
452
Jesse Hallcf25c412015-10-29 17:14:50 -0700453void DestroyBuffer(VkDevice device, VkBuffer buffer_handle) {
Jesse Hallf6578742015-08-29 17:06:12 +0100454 const VkAllocCallbacks* alloc = device->instance->alloc;
455 Buffer* buffer = GetObjectFromHandle(buffer_handle);
456 alloc->pfnFree(alloc->pUserData, buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100457}
458
459// -----------------------------------------------------------------------------
Jesse Hall85c05b62015-09-01 18:07:41 -0700460// Image
461
462struct Image {
463 typedef VkImage HandleType;
464 VkDeviceSize size;
465};
466template <>
467struct HandleTraits<VkImage> {
468 typedef Image* PointerType;
469};
470
471VkResult CreateImage(VkDevice device,
472 const VkImageCreateInfo* create_info,
473 VkImage* image_handle) {
474 if (create_info->imageType != VK_IMAGE_TYPE_2D ||
475 create_info->format != VK_FORMAT_R8G8B8A8_UNORM ||
476 create_info->mipLevels != 1) {
477 ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u",
478 create_info->imageType, create_info->format,
479 create_info->mipLevels);
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700480 return VK_UNSUPPORTED;
Jesse Hall85c05b62015-09-01 18:07:41 -0700481 }
482
483 VkDeviceSize size =
484 VkDeviceSize(create_info->extent.width * create_info->extent.height) *
485 create_info->arraySize * create_info->samples * 4u;
486 ALOGW_IF(size > kMaxDeviceMemory,
487 "CreateImage: image size 0x%" PRIx64
488 " exceeds max device memory size 0x%" PRIx64,
489 size, kMaxDeviceMemory);
490
491 const VkAllocCallbacks* alloc = device->instance->alloc;
492 Image* image = static_cast<Image*>(
493 alloc->pfnAlloc(alloc->pUserData, sizeof(Image), alignof(Image),
494 VK_SYSTEM_ALLOC_TYPE_API_OBJECT));
495 if (!image)
496 return VK_ERROR_OUT_OF_HOST_MEMORY;
497 image->size = size;
498 *image_handle = GetHandleToObject(image);
499 return VK_SUCCESS;
500}
501
502VkResult GetImageMemoryRequirements(VkDevice,
503 VkImage image_handle,
504 VkMemoryRequirements* requirements) {
505 Image* image = GetObjectFromHandle(image_handle);
506 requirements->size = image->size;
507 requirements->alignment = 16; // allow fast Neon/SSE memcpy
508 requirements->memoryTypeBits = 0x1;
509 return VK_SUCCESS;
510}
511
Jesse Hallcf25c412015-10-29 17:14:50 -0700512void DestroyImage(VkDevice device, VkImage image_handle) {
Jesse Hall85c05b62015-09-01 18:07:41 -0700513 const VkAllocCallbacks* alloc = device->instance->alloc;
514 Image* image = GetObjectFromHandle(image_handle);
515 alloc->pfnFree(alloc->pUserData, image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700516}
517
518// -----------------------------------------------------------------------------
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700519// No-op types
520
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700521VkResult CreateBufferView(VkDevice device,
522 const VkBufferViewCreateInfo*,
523 VkBufferView* view) {
524 *view = AllocHandle(device, HandleType::kBufferView);
525 return VK_SUCCESS;
526}
527
528VkResult CreateCommandPool(VkDevice device,
529 const VkCmdPoolCreateInfo*,
530 VkCmdPool* pool) {
531 *pool = AllocHandle(device, HandleType::kCmdPool);
532 return VK_SUCCESS;
533}
534
535VkResult CreateDescriptorPool(VkDevice device,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700536 const VkDescriptorPoolCreateInfo*,
537 VkDescriptorPool* pool) {
538 *pool = AllocHandle(device, HandleType::kDescriptorPool);
539 return VK_SUCCESS;
540}
541
542VkResult AllocDescriptorSets(VkDevice device,
543 VkDescriptorPool,
544 VkDescriptorSetUsage,
545 uint32_t count,
546 const VkDescriptorSetLayout*,
Jesse Hallcf25c412015-10-29 17:14:50 -0700547 VkDescriptorSet* sets) {
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700548 for (uint32_t i = 0; i < count; i++)
549 sets[i] = AllocHandle(device, HandleType::kDescriptorSet);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700550 return VK_SUCCESS;
551}
552
553VkResult CreateDescriptorSetLayout(VkDevice device,
554 const VkDescriptorSetLayoutCreateInfo*,
555 VkDescriptorSetLayout* layout) {
556 *layout = AllocHandle(device, HandleType::kDescriptorSetLayout);
557 return VK_SUCCESS;
558}
559
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700560VkResult CreateEvent(VkDevice device,
561 const VkEventCreateInfo*,
562 VkEvent* event) {
563 *event = AllocHandle(device, HandleType::kEvent);
564 return VK_SUCCESS;
565}
566
567VkResult CreateFence(VkDevice device,
568 const VkFenceCreateInfo*,
569 VkFence* fence) {
570 *fence = AllocHandle(device, HandleType::kFence);
571 return VK_SUCCESS;
572}
573
574VkResult CreateFramebuffer(VkDevice device,
575 const VkFramebufferCreateInfo*,
576 VkFramebuffer* framebuffer) {
577 *framebuffer = AllocHandle(device, HandleType::kFramebuffer);
578 return VK_SUCCESS;
579}
580
581VkResult CreateImageView(VkDevice device,
582 const VkImageViewCreateInfo*,
583 VkImageView* view) {
584 *view = AllocHandle(device, HandleType::kImageView);
585 return VK_SUCCESS;
586}
587
588VkResult CreateGraphicsPipelines(VkDevice device,
589 VkPipelineCache,
590 uint32_t count,
591 const VkGraphicsPipelineCreateInfo*,
592 VkPipeline* pipelines) {
593 for (uint32_t i = 0; i < count; i++)
594 pipelines[i] = AllocHandle(device, HandleType::kPipeline);
595 return VK_SUCCESS;
596}
597
598VkResult CreateComputePipelines(VkDevice device,
599 VkPipelineCache,
600 uint32_t count,
601 const VkComputePipelineCreateInfo*,
602 VkPipeline* pipelines) {
603 for (uint32_t i = 0; i < count; i++)
604 pipelines[i] = AllocHandle(device, HandleType::kPipeline);
605 return VK_SUCCESS;
606}
607
608VkResult CreatePipelineCache(VkDevice device,
609 const VkPipelineCacheCreateInfo*,
610 VkPipelineCache* cache) {
611 *cache = AllocHandle(device, HandleType::kPipelineCache);
612 return VK_SUCCESS;
613}
614
615VkResult CreatePipelineLayout(VkDevice device,
616 const VkPipelineLayoutCreateInfo*,
617 VkPipelineLayout* layout) {
618 *layout = AllocHandle(device, HandleType::kPipelineLayout);
619 return VK_SUCCESS;
620}
621
622VkResult CreateQueryPool(VkDevice device,
623 const VkQueryPoolCreateInfo*,
624 VkQueryPool* pool) {
625 *pool = AllocHandle(device, HandleType::kQueryPool);
626 return VK_SUCCESS;
627}
628
629VkResult CreateRenderPass(VkDevice device,
630 const VkRenderPassCreateInfo*,
631 VkRenderPass* renderpass) {
632 *renderpass = AllocHandle(device, HandleType::kRenderPass);
633 return VK_SUCCESS;
634}
635
636VkResult CreateSampler(VkDevice device,
637 const VkSamplerCreateInfo*,
638 VkSampler* sampler) {
639 *sampler = AllocHandle(device, HandleType::kSampler);
640 return VK_SUCCESS;
641}
642
643VkResult CreateSemaphore(VkDevice device,
644 const VkSemaphoreCreateInfo*,
645 VkSemaphore* semaphore) {
646 *semaphore = AllocHandle(device, HandleType::kSemaphore);
647 return VK_SUCCESS;
648}
649
650VkResult CreateShader(VkDevice device,
651 const VkShaderCreateInfo*,
652 VkShader* shader) {
653 *shader = AllocHandle(device, HandleType::kShader);
654 return VK_SUCCESS;
655}
656
657VkResult CreateShaderModule(VkDevice device,
658 const VkShaderModuleCreateInfo*,
659 VkShaderModule* module) {
660 *module = AllocHandle(device, HandleType::kShaderModule);
661 return VK_SUCCESS;
662}
663
Jesse Halld7b994a2015-09-07 14:17:37 -0700664VkResult ImportNativeFenceANDROID(VkDevice, VkSemaphore, int fence) {
665 close(fence);
666 return VK_SUCCESS;
667}
668
669VkResult QueueSignalNativeFenceANDROID(VkQueue, int* fence) {
670 *fence = -1;
671 return VK_SUCCESS;
672}
673
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700674// -----------------------------------------------------------------------------
Jesse Hall04f4f472015-08-16 19:51:04 -0700675// No-op entrypoints
676
677// clang-format off
678#pragma clang diagnostic push
679#pragma clang diagnostic ignored "-Wunused-parameter"
680
Jesse Hall04f4f472015-08-16 19:51:04 -0700681VkResult GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100682 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700683 return VK_SUCCESS;
684}
685
686VkResult GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100687 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700688 return VK_SUCCESS;
689}
690
Jesse Hallcf25c412015-10-29 17:14:50 -0700691VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100692 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700693 return VK_SUCCESS;
694}
695
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700696VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100697 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700698 return VK_SUCCESS;
699}
700
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700701VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100702 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700703 return VK_SUCCESS;
704}
705
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700706VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pCount, VkExtensionProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100707 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700708 return VK_SUCCESS;
709}
710
711VkResult QueueSubmit(VkQueue queue, uint32_t cmdBufferCount, const VkCmdBuffer* pCmdBuffers, VkFence fence) {
712 return VK_SUCCESS;
713}
714
715VkResult QueueWaitIdle(VkQueue queue) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100716 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700717 return VK_SUCCESS;
718}
719
720VkResult DeviceWaitIdle(VkDevice device) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100721 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700722 return VK_SUCCESS;
723}
724
Jesse Hallcf25c412015-10-29 17:14:50 -0700725void UnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700726}
727
728VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100729 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700730 return VK_SUCCESS;
731}
732
733VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100734 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700735 return VK_SUCCESS;
736}
737
738VkResult GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100739 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700740 return VK_SUCCESS;
741}
742
Jesse Hall04f4f472015-08-16 19:51:04 -0700743VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset) {
744 return VK_SUCCESS;
745}
746
Jesse Hall04f4f472015-08-16 19:51:04 -0700747VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset) {
748 return VK_SUCCESS;
749}
750
751VkResult GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100752 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700753 return VK_SUCCESS;
754}
755
756VkResult GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, uint32_t samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pNumProperties, VkSparseImageFormatProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100757 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700758 return VK_SUCCESS;
759}
760
761VkResult QueueBindSparseBufferMemory(VkQueue queue, VkBuffer buffer, uint32_t numBindings, const VkSparseMemoryBindInfo* pBindInfo) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100762 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700763 return VK_SUCCESS;
764}
765
766VkResult QueueBindSparseImageOpaqueMemory(VkQueue queue, VkImage image, uint32_t numBindings, const VkSparseMemoryBindInfo* pBindInfo) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100767 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700768 return VK_SUCCESS;
769}
770
771VkResult QueueBindSparseImageMemory(VkQueue queue, VkImage image, uint32_t numBindings, const VkSparseImageMemoryBindInfo* pBindInfo) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100772 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700773 return VK_SUCCESS;
774}
775
Jesse Hallcf25c412015-10-29 17:14:50 -0700776void DestroyFence(VkDevice device, VkFence fence) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700777}
778
779VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
780 return VK_SUCCESS;
781}
782
783VkResult GetFenceStatus(VkDevice device, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100784 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700785 return VK_SUCCESS;
786}
787
788VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
789 return VK_SUCCESS;
790}
791
Jesse Hallcf25c412015-10-29 17:14:50 -0700792void DestroySemaphore(VkDevice device, VkSemaphore semaphore) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700793}
794
795VkResult QueueSignalSemaphore(VkQueue queue, VkSemaphore semaphore) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100796 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700797 return VK_SUCCESS;
798}
799
800VkResult QueueWaitSemaphore(VkQueue queue, VkSemaphore semaphore) {
801 return VK_SUCCESS;
802}
803
Jesse Hallcf25c412015-10-29 17:14:50 -0700804void DestroyEvent(VkDevice device, VkEvent event) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700805}
806
807VkResult GetEventStatus(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100808 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700809 return VK_SUCCESS;
810}
811
812VkResult SetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100813 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700814 return VK_SUCCESS;
815}
816
817VkResult ResetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100818 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700819 return VK_SUCCESS;
820}
821
Jesse Hallcf25c412015-10-29 17:14:50 -0700822void DestroyQueryPool(VkDevice device, VkQueryPool queryPool) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700823}
824
825VkResult GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData, VkQueryResultFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100826 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700827 return VK_SUCCESS;
828}
829
Jesse Hallcf25c412015-10-29 17:14:50 -0700830void DestroyBufferView(VkDevice device, VkBufferView bufferView) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700831}
832
Jesse Hall04f4f472015-08-16 19:51:04 -0700833VkResult GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100834 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700835 return VK_SUCCESS;
836}
837
Jesse Hallcf25c412015-10-29 17:14:50 -0700838void DestroyImageView(VkDevice device, VkImageView imageView) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700839}
840
Jesse Hallcf25c412015-10-29 17:14:50 -0700841void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700842}
843
Jesse Hallcf25c412015-10-29 17:14:50 -0700844void DestroyShader(VkDevice device, VkShader shader) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700845}
846
Jesse Hallcf25c412015-10-29 17:14:50 -0700847void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700848}
849
850size_t GetPipelineCacheSize(VkDevice device, VkPipelineCache pipelineCache) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100851 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700852 return VK_SUCCESS;
853}
854
855VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, void* pData) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100856 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700857 return VK_SUCCESS;
858}
859
860VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100861 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700862 return VK_SUCCESS;
863}
864
Jesse Hallcf25c412015-10-29 17:14:50 -0700865void DestroyPipeline(VkDevice device, VkPipeline pipeline) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700866}
867
Jesse Hallcf25c412015-10-29 17:14:50 -0700868void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700869}
870
Jesse Hallcf25c412015-10-29 17:14:50 -0700871void DestroySampler(VkDevice device, VkSampler sampler) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700872}
873
Jesse Hallcf25c412015-10-29 17:14:50 -0700874void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700875}
876
Jesse Hallcf25c412015-10-29 17:14:50 -0700877void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700878}
879
880VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100881 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700882 return VK_SUCCESS;
883}
884
Jesse Hallcf25c412015-10-29 17:14:50 -0700885void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100886 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700887}
888
889VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100890 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700891 return VK_SUCCESS;
892}
893
Jesse Hallcf25c412015-10-29 17:14:50 -0700894void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700895}
896
Jesse Hallcf25c412015-10-29 17:14:50 -0700897void DestroyRenderPass(VkDevice device, VkRenderPass renderPass) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700898}
899
900VkResult GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100901 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700902 return VK_SUCCESS;
903}
904
Jesse Hallcf25c412015-10-29 17:14:50 -0700905void DestroyCommandPool(VkDevice device, VkCmdPool cmdPool) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700906}
907
908VkResult ResetCommandPool(VkDevice device, VkCmdPool cmdPool, VkCmdPoolResetFlags flags) {
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
Jesse Hall04f4f472015-08-16 19:51:04 -0700913VkResult BeginCommandBuffer(VkCmdBuffer cmdBuffer, const VkCmdBufferBeginInfo* pBeginInfo) {
914 return VK_SUCCESS;
915}
916
917VkResult EndCommandBuffer(VkCmdBuffer cmdBuffer) {
918 return VK_SUCCESS;
919}
920
921VkResult ResetCommandBuffer(VkCmdBuffer cmdBuffer, VkCmdBufferResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100922 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700923 return VK_SUCCESS;
924}
925
926void CmdBindPipeline(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
927}
928
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700929void CmdSetViewport(VkCmdBuffer cmdBuffer, uint32_t viewportCount, const VkViewport* pViewports) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700930}
931
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700932void CmdSetScissor(VkCmdBuffer cmdBuffer, uint32_t scissorCount, const VkRect2D* pScissors) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700933}
934
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700935void CmdSetLineWidth(VkCmdBuffer cmdBuffer, float lineWidth) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700936}
937
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700938void CmdSetDepthBias(VkCmdBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) {
939}
940
941void CmdSetBlendConstants(VkCmdBuffer cmdBuffer, const float blendConst[4]) {
942}
943
944void CmdSetDepthBounds(VkCmdBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) {
945}
946
947void CmdSetStencilCompareMask(VkCmdBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) {
948}
949
950void CmdSetStencilWriteMask(VkCmdBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) {
951}
952
953void CmdSetStencilReference(VkCmdBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700954}
955
956void CmdBindDescriptorSets(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets) {
957}
958
959void CmdBindIndexBuffer(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
960}
961
962void CmdBindVertexBuffers(VkCmdBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
963}
964
Jesse Hallcf25c412015-10-29 17:14:50 -0700965void CmdDraw(VkCmdBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700966}
967
Jesse Hallcf25c412015-10-29 17:14:50 -0700968void CmdDrawIndexed(VkCmdBuffer cmdBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700969}
970
971void CmdDrawIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
972}
973
974void CmdDrawIndexedIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
975}
976
977void CmdDispatch(VkCmdBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) {
978}
979
980void CmdDispatchIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) {
981}
982
983void CmdCopyBuffer(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
984}
985
986void CmdCopyImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
987}
988
989void CmdBlitImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkTexFilter filter) {
990}
991
992void CmdCopyBufferToImage(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
993}
994
995void CmdCopyImageToBuffer(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
996}
997
998void CmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData) {
999}
1000
1001void CmdFillBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) {
1002}
1003
1004void CmdClearColorImage(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
1005}
1006
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001007void CmdClearDepthStencilImage(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001008}
1009
1010void CmdClearColorAttachment(VkCmdBuffer cmdBuffer, uint32_t colorAttachment, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rectCount, const VkRect3D* pRects) {
1011}
1012
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001013void CmdClearDepthStencilAttachment(VkCmdBuffer cmdBuffer, VkImageAspectFlags aspectMask, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rectCount, const VkRect3D* pRects) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001014}
1015
1016void CmdResolveImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
1017}
1018
1019void CmdSetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
1020}
1021
1022void CmdResetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
1023}
1024
1025void CmdWaitEvents(VkCmdBuffer cmdBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags destStageMask, uint32_t memBarrierCount, const void* const* ppMemBarriers) {
1026}
1027
1028void CmdPipelineBarrier(VkCmdBuffer cmdBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags destStageMask, VkBool32 byRegion, uint32_t memBarrierCount, const void* const* ppMemBarriers) {
1029}
1030
1031void CmdBeginQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) {
1032}
1033
1034void CmdEndQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) {
1035}
1036
1037void CmdResetQueryPool(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
1038}
1039
1040void CmdWriteTimestamp(VkCmdBuffer cmdBuffer, VkTimestampType timestampType, VkBuffer destBuffer, VkDeviceSize destOffset) {
1041}
1042
1043void CmdCopyQueryPoolResults(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize destStride, VkQueryResultFlags flags) {
1044}
1045
1046void CmdPushConstants(VkCmdBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values) {
1047}
1048
1049void CmdBeginRenderPass(VkCmdBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkRenderPassContents contents) {
1050}
1051
1052void CmdNextSubpass(VkCmdBuffer cmdBuffer, VkRenderPassContents contents) {
1053}
1054
1055void CmdEndRenderPass(VkCmdBuffer cmdBuffer) {
1056}
1057
1058void CmdExecuteCommands(VkCmdBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCmdBuffer* pCmdBuffers) {
1059}
1060
Jesse Hall04f4f472015-08-16 19:51:04 -07001061#pragma clang diagnostic pop
1062// clang-format on
1063
1064} // namespace null_driver