blob: 2bef297ced6996e547b4449473e0952ab9413e3d [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;
Jesse Hall70f93352015-11-04 09:41:31 -0800238 if (strcmp(name, "vkGetSwapchainGrallocUsageANDROID") == 0)
239 return reinterpret_cast<PFN_vkVoidFunction>(
240 GetSwapchainGrallocUsageANDROID);
Jesse Hallab9aeef2015-11-04 10:56:20 -0800241 if (strcmp(name, "vkAcquireImageANDROID") == 0)
242 return reinterpret_cast<PFN_vkVoidFunction>(AcquireImageANDROID);
243 if (strcmp(name, "vkQueueSignalReleaseImageANDROID") == 0)
Jesse Hallb1352bc2015-09-04 16:12:33 -0700244 return reinterpret_cast<PFN_vkVoidFunction>(
Jesse Hallab9aeef2015-11-04 10:56:20 -0800245 QueueSignalReleaseImageANDROID);
Jesse Hallb1352bc2015-09-04 16:12:33 -0700246 return nullptr;
Jesse Hall04f4f472015-08-16 19:51:04 -0700247}
248
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100249// -----------------------------------------------------------------------------
250// Instance
251
Jesse Hallcf25c412015-10-29 17:14:50 -0700252void DestroyInstance(VkInstance instance) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700253 instance->alloc->pfnFree(instance->alloc->pUserData, instance);
Jesse Hall04f4f472015-08-16 19:51:04 -0700254}
255
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100256// -----------------------------------------------------------------------------
257// PhysicalDevice
258
Jesse Hall04f4f472015-08-16 19:51:04 -0700259VkResult EnumeratePhysicalDevices(VkInstance instance,
260 uint32_t* physical_device_count,
261 VkPhysicalDevice* physical_devices) {
262 if (physical_devices && *physical_device_count >= 1)
263 physical_devices[0] = &instance->physical_device;
264 *physical_device_count = 1;
265 return VK_SUCCESS;
266}
267
Jesse Hall606a54e2015-11-19 22:17:28 -0800268void GetPhysicalDeviceProperties(VkPhysicalDevice,
269 VkPhysicalDeviceProperties* properties) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700270 properties->apiVersion = VK_API_VERSION;
271 properties->driverVersion = VK_MAKE_VERSION(0, 0, 1);
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700272 properties->vendorId = 0;
273 properties->deviceId = 0;
Jesse Hall04f4f472015-08-16 19:51:04 -0700274 properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
275 strcpy(properties->deviceName, "Android Vulkan Null Driver");
276 memset(properties->pipelineCacheUUID, 0,
277 sizeof(properties->pipelineCacheUUID));
Jesse Hall04f4f472015-08-16 19:51:04 -0700278}
279
Jesse Hall606a54e2015-11-19 22:17:28 -0800280void GetPhysicalDeviceQueueFamilyProperties(
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700281 VkPhysicalDevice,
282 uint32_t* count,
283 VkQueueFamilyProperties* properties) {
284 if (properties) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700285 properties->queueFlags =
286 VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_DMA_BIT;
287 properties->queueCount = 1;
Jesse Hallacfa5342015-11-19 21:51:33 -0800288 properties->timestampValidBits = 64;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700289 }
290 *count = 1;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700291}
292
Jesse Hall606a54e2015-11-19 22:17:28 -0800293void GetPhysicalDeviceMemoryProperties(
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100294 VkPhysicalDevice,
295 VkPhysicalDeviceMemoryProperties* properties) {
296 properties->memoryTypeCount = 1;
297 properties->memoryTypes[0].propertyFlags =
298 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
299 properties->memoryTypes[0].heapIndex = 0;
300 properties->memoryHeapCount = 1;
Jesse Hallbde8ee32015-09-01 16:24:29 -0700301 properties->memoryHeaps[0].size = kMaxDeviceMemory;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700302 properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_HOST_LOCAL_BIT;
Jesse Hall04f4f472015-08-16 19:51:04 -0700303}
304
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100305// -----------------------------------------------------------------------------
306// Device
307
Jesse Hall04f4f472015-08-16 19:51:04 -0700308VkResult CreateDevice(VkPhysicalDevice physical_device,
309 const VkDeviceCreateInfo*,
310 VkDevice* out_device) {
311 VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device);
312 VkDevice_T* device = static_cast<VkDevice_T*>(instance->alloc->pfnAlloc(
313 instance->alloc->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T),
314 VK_SYSTEM_ALLOC_TYPE_API_OBJECT));
315 if (!device)
316 return VK_ERROR_OUT_OF_HOST_MEMORY;
317
318 device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
319 device->instance = instance;
320 device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700321 std::fill(device->next_handle.begin(), device->next_handle.end(),
322 UINT64_C(0));
Jesse Hall04f4f472015-08-16 19:51:04 -0700323
324 *out_device = device;
325 return VK_SUCCESS;
326}
327
Jesse Hallcf25c412015-10-29 17:14:50 -0700328void DestroyDevice(VkDevice device) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700329 if (!device)
Jesse Hallcf25c412015-10-29 17:14:50 -0700330 return;
Jesse Hall04f4f472015-08-16 19:51:04 -0700331 const VkAllocCallbacks* alloc = device->instance->alloc;
332 alloc->pfnFree(alloc->pUserData, device);
Jesse Hall04f4f472015-08-16 19:51:04 -0700333}
334
Jesse Hall606a54e2015-11-19 22:17:28 -0800335void GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700336 *queue = &device->queue;
Jesse Hall04f4f472015-08-16 19:51:04 -0700337}
338
339// -----------------------------------------------------------------------------
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700340// CmdBuffer
341
342VkResult CreateCommandBuffer(VkDevice device,
343 const VkCmdBufferCreateInfo*,
344 VkCmdBuffer* out_cmdbuf) {
345 const VkAllocCallbacks* alloc = device->instance->alloc;
346 VkCmdBuffer_T* cmdbuf = static_cast<VkCmdBuffer_T*>(alloc->pfnAlloc(
347 alloc->pUserData, sizeof(VkCmdBuffer_T), alignof(VkCmdBuffer_T),
348 VK_SYSTEM_ALLOC_TYPE_API_OBJECT));
349 if (!cmdbuf)
350 return VK_ERROR_OUT_OF_HOST_MEMORY;
351 cmdbuf->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
352 *out_cmdbuf = cmdbuf;
353 return VK_SUCCESS;
354}
355
Jesse Hallcf25c412015-10-29 17:14:50 -0700356void DestroyCommandBuffer(VkDevice device, VkCmdBuffer cmdbuf) {
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700357 const VkAllocCallbacks* alloc = device->instance->alloc;
358 alloc->pfnFree(alloc->pUserData, cmdbuf);
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700359}
360
361// -----------------------------------------------------------------------------
Jesse Hall2077ce02015-08-29 18:10:59 +0100362// DeviceMemory
363
364struct DeviceMemory {
365 typedef VkDeviceMemory HandleType;
366 VkDeviceSize size;
367 alignas(16) uint8_t data[0];
368};
369template <>
370struct HandleTraits<VkDeviceMemory> {
371 typedef DeviceMemory* PointerType;
372};
373
374VkResult AllocMemory(VkDevice device,
375 const VkMemoryAllocInfo* alloc_info,
376 VkDeviceMemory* mem_handle) {
377 if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize)
378 return VK_ERROR_OUT_OF_HOST_MEMORY;
379
380 const VkAllocCallbacks* alloc = device->instance->alloc;
381 size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize);
382 DeviceMemory* mem = static_cast<DeviceMemory*>(
383 alloc->pfnAlloc(alloc->pUserData, size, alignof(DeviceMemory),
384 VK_SYSTEM_ALLOC_TYPE_API_OBJECT));
385 if (!mem)
386 return VK_ERROR_OUT_OF_HOST_MEMORY;
387 mem->size = size;
388 *mem_handle = GetHandleToObject(mem);
389 return VK_SUCCESS;
390}
391
Jesse Hallcf25c412015-10-29 17:14:50 -0700392void FreeMemory(VkDevice device, VkDeviceMemory mem_handle) {
Jesse Hall2077ce02015-08-29 18:10:59 +0100393 const VkAllocCallbacks* alloc = device->instance->alloc;
394 DeviceMemory* mem = GetObjectFromHandle(mem_handle);
395 alloc->pfnFree(alloc->pUserData, mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100396}
397
398VkResult MapMemory(VkDevice,
399 VkDeviceMemory mem_handle,
400 VkDeviceSize offset,
401 VkDeviceSize,
402 VkMemoryMapFlags,
403 void** out_ptr) {
404 DeviceMemory* mem = GetObjectFromHandle(mem_handle);
405 *out_ptr = &mem->data[0] + offset;
406 return VK_SUCCESS;
407}
408
409// -----------------------------------------------------------------------------
Jesse Hallf6578742015-08-29 17:06:12 +0100410// Buffer
411
412struct Buffer {
413 typedef VkBuffer HandleType;
414 VkDeviceSize size;
415};
416template <>
417struct HandleTraits<VkBuffer> {
418 typedef Buffer* PointerType;
419};
420
421VkResult CreateBuffer(VkDevice device,
422 const VkBufferCreateInfo* create_info,
423 VkBuffer* buffer_handle) {
Jesse Hallbde8ee32015-09-01 16:24:29 -0700424 ALOGW_IF(create_info->size > kMaxDeviceMemory,
425 "CreateBuffer: requested size 0x%" PRIx64
426 " exceeds max device memory size 0x%" PRIx64,
427 create_info->size, kMaxDeviceMemory);
428
Jesse Hallf6578742015-08-29 17:06:12 +0100429 const VkAllocCallbacks* alloc = device->instance->alloc;
430 Buffer* buffer = static_cast<Buffer*>(
431 alloc->pfnAlloc(alloc->pUserData, sizeof(Buffer), alignof(Buffer),
432 VK_SYSTEM_ALLOC_TYPE_API_OBJECT));
433 if (!buffer)
434 return VK_ERROR_OUT_OF_HOST_MEMORY;
435 buffer->size = create_info->size;
436 *buffer_handle = GetHandleToObject(buffer);
437 return VK_SUCCESS;
438}
439
Jesse Hall606a54e2015-11-19 22:17:28 -0800440void GetBufferMemoryRequirements(VkDevice,
441 VkBuffer buffer_handle,
442 VkMemoryRequirements* requirements) {
Jesse Hallf6578742015-08-29 17:06:12 +0100443 Buffer* buffer = GetObjectFromHandle(buffer_handle);
444 requirements->size = buffer->size;
445 requirements->alignment = 16; // allow fast Neon/SSE memcpy
446 requirements->memoryTypeBits = 0x1;
Jesse Hallf6578742015-08-29 17:06:12 +0100447}
448
Jesse Hallcf25c412015-10-29 17:14:50 -0700449void DestroyBuffer(VkDevice device, VkBuffer buffer_handle) {
Jesse Hallf6578742015-08-29 17:06:12 +0100450 const VkAllocCallbacks* alloc = device->instance->alloc;
451 Buffer* buffer = GetObjectFromHandle(buffer_handle);
452 alloc->pfnFree(alloc->pUserData, buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100453}
454
455// -----------------------------------------------------------------------------
Jesse Hall85c05b62015-09-01 18:07:41 -0700456// Image
457
458struct Image {
459 typedef VkImage HandleType;
460 VkDeviceSize size;
461};
462template <>
463struct HandleTraits<VkImage> {
464 typedef Image* PointerType;
465};
466
467VkResult CreateImage(VkDevice device,
468 const VkImageCreateInfo* create_info,
469 VkImage* image_handle) {
470 if (create_info->imageType != VK_IMAGE_TYPE_2D ||
471 create_info->format != VK_FORMAT_R8G8B8A8_UNORM ||
472 create_info->mipLevels != 1) {
473 ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u",
474 create_info->imageType, create_info->format,
475 create_info->mipLevels);
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700476 return VK_UNSUPPORTED;
Jesse Hall85c05b62015-09-01 18:07:41 -0700477 }
478
479 VkDeviceSize size =
480 VkDeviceSize(create_info->extent.width * create_info->extent.height) *
481 create_info->arraySize * create_info->samples * 4u;
482 ALOGW_IF(size > kMaxDeviceMemory,
483 "CreateImage: image size 0x%" PRIx64
484 " exceeds max device memory size 0x%" PRIx64,
485 size, kMaxDeviceMemory);
486
487 const VkAllocCallbacks* alloc = device->instance->alloc;
488 Image* image = static_cast<Image*>(
489 alloc->pfnAlloc(alloc->pUserData, sizeof(Image), alignof(Image),
490 VK_SYSTEM_ALLOC_TYPE_API_OBJECT));
491 if (!image)
492 return VK_ERROR_OUT_OF_HOST_MEMORY;
493 image->size = size;
494 *image_handle = GetHandleToObject(image);
495 return VK_SUCCESS;
496}
497
Jesse Hall606a54e2015-11-19 22:17:28 -0800498void GetImageMemoryRequirements(VkDevice,
499 VkImage image_handle,
500 VkMemoryRequirements* requirements) {
Jesse Hall85c05b62015-09-01 18:07:41 -0700501 Image* image = GetObjectFromHandle(image_handle);
502 requirements->size = image->size;
503 requirements->alignment = 16; // allow fast Neon/SSE memcpy
504 requirements->memoryTypeBits = 0x1;
Jesse Hall85c05b62015-09-01 18:07:41 -0700505}
506
Jesse Hallcf25c412015-10-29 17:14:50 -0700507void DestroyImage(VkDevice device, VkImage image_handle) {
Jesse Hall85c05b62015-09-01 18:07:41 -0700508 const VkAllocCallbacks* alloc = device->instance->alloc;
509 Image* image = GetObjectFromHandle(image_handle);
510 alloc->pfnFree(alloc->pUserData, image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700511}
512
513// -----------------------------------------------------------------------------
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700514// No-op types
515
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700516VkResult CreateBufferView(VkDevice device,
517 const VkBufferViewCreateInfo*,
518 VkBufferView* view) {
519 *view = AllocHandle(device, HandleType::kBufferView);
520 return VK_SUCCESS;
521}
522
523VkResult CreateCommandPool(VkDevice device,
524 const VkCmdPoolCreateInfo*,
525 VkCmdPool* pool) {
526 *pool = AllocHandle(device, HandleType::kCmdPool);
527 return VK_SUCCESS;
528}
529
530VkResult CreateDescriptorPool(VkDevice device,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700531 const VkDescriptorPoolCreateInfo*,
532 VkDescriptorPool* pool) {
533 *pool = AllocHandle(device, HandleType::kDescriptorPool);
534 return VK_SUCCESS;
535}
536
537VkResult AllocDescriptorSets(VkDevice device,
538 VkDescriptorPool,
539 VkDescriptorSetUsage,
540 uint32_t count,
541 const VkDescriptorSetLayout*,
Jesse Hallcf25c412015-10-29 17:14:50 -0700542 VkDescriptorSet* sets) {
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700543 for (uint32_t i = 0; i < count; i++)
544 sets[i] = AllocHandle(device, HandleType::kDescriptorSet);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700545 return VK_SUCCESS;
546}
547
548VkResult CreateDescriptorSetLayout(VkDevice device,
549 const VkDescriptorSetLayoutCreateInfo*,
550 VkDescriptorSetLayout* layout) {
551 *layout = AllocHandle(device, HandleType::kDescriptorSetLayout);
552 return VK_SUCCESS;
553}
554
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700555VkResult CreateEvent(VkDevice device,
556 const VkEventCreateInfo*,
557 VkEvent* event) {
558 *event = AllocHandle(device, HandleType::kEvent);
559 return VK_SUCCESS;
560}
561
562VkResult CreateFence(VkDevice device,
563 const VkFenceCreateInfo*,
564 VkFence* fence) {
565 *fence = AllocHandle(device, HandleType::kFence);
566 return VK_SUCCESS;
567}
568
569VkResult CreateFramebuffer(VkDevice device,
570 const VkFramebufferCreateInfo*,
571 VkFramebuffer* framebuffer) {
572 *framebuffer = AllocHandle(device, HandleType::kFramebuffer);
573 return VK_SUCCESS;
574}
575
576VkResult CreateImageView(VkDevice device,
577 const VkImageViewCreateInfo*,
578 VkImageView* view) {
579 *view = AllocHandle(device, HandleType::kImageView);
580 return VK_SUCCESS;
581}
582
583VkResult CreateGraphicsPipelines(VkDevice device,
584 VkPipelineCache,
585 uint32_t count,
586 const VkGraphicsPipelineCreateInfo*,
587 VkPipeline* pipelines) {
588 for (uint32_t i = 0; i < count; i++)
589 pipelines[i] = AllocHandle(device, HandleType::kPipeline);
590 return VK_SUCCESS;
591}
592
593VkResult CreateComputePipelines(VkDevice device,
594 VkPipelineCache,
595 uint32_t count,
596 const VkComputePipelineCreateInfo*,
597 VkPipeline* pipelines) {
598 for (uint32_t i = 0; i < count; i++)
599 pipelines[i] = AllocHandle(device, HandleType::kPipeline);
600 return VK_SUCCESS;
601}
602
603VkResult CreatePipelineCache(VkDevice device,
604 const VkPipelineCacheCreateInfo*,
605 VkPipelineCache* cache) {
606 *cache = AllocHandle(device, HandleType::kPipelineCache);
607 return VK_SUCCESS;
608}
609
610VkResult CreatePipelineLayout(VkDevice device,
611 const VkPipelineLayoutCreateInfo*,
612 VkPipelineLayout* layout) {
613 *layout = AllocHandle(device, HandleType::kPipelineLayout);
614 return VK_SUCCESS;
615}
616
617VkResult CreateQueryPool(VkDevice device,
618 const VkQueryPoolCreateInfo*,
619 VkQueryPool* pool) {
620 *pool = AllocHandle(device, HandleType::kQueryPool);
621 return VK_SUCCESS;
622}
623
624VkResult CreateRenderPass(VkDevice device,
625 const VkRenderPassCreateInfo*,
626 VkRenderPass* renderpass) {
627 *renderpass = AllocHandle(device, HandleType::kRenderPass);
628 return VK_SUCCESS;
629}
630
631VkResult CreateSampler(VkDevice device,
632 const VkSamplerCreateInfo*,
633 VkSampler* sampler) {
634 *sampler = AllocHandle(device, HandleType::kSampler);
635 return VK_SUCCESS;
636}
637
638VkResult CreateSemaphore(VkDevice device,
639 const VkSemaphoreCreateInfo*,
640 VkSemaphore* semaphore) {
641 *semaphore = AllocHandle(device, HandleType::kSemaphore);
642 return VK_SUCCESS;
643}
644
645VkResult CreateShader(VkDevice device,
646 const VkShaderCreateInfo*,
647 VkShader* shader) {
648 *shader = AllocHandle(device, HandleType::kShader);
649 return VK_SUCCESS;
650}
651
652VkResult CreateShaderModule(VkDevice device,
653 const VkShaderModuleCreateInfo*,
654 VkShaderModule* module) {
655 *module = AllocHandle(device, HandleType::kShaderModule);
656 return VK_SUCCESS;
657}
658
Jesse Hall70f93352015-11-04 09:41:31 -0800659VkResult GetSwapchainGrallocUsageANDROID(VkDevice,
660 VkFormat,
661 VkImageUsageFlags,
662 int* grallocUsage) {
663 // The null driver never reads or writes the gralloc buffer
664 *grallocUsage = 0;
665 return VK_SUCCESS;
666}
667
Jesse Hallab9aeef2015-11-04 10:56:20 -0800668VkResult AcquireImageANDROID(VkDevice, VkImage, int fence, VkSemaphore) {
Jesse Halld7b994a2015-09-07 14:17:37 -0700669 close(fence);
670 return VK_SUCCESS;
671}
672
Jesse Hallab9aeef2015-11-04 10:56:20 -0800673VkResult QueueSignalReleaseImageANDROID(VkQueue, VkImage, int* fence) {
Jesse Halld7b994a2015-09-07 14:17:37 -0700674 *fence = -1;
675 return VK_SUCCESS;
676}
677
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700678// -----------------------------------------------------------------------------
Jesse Hall04f4f472015-08-16 19:51:04 -0700679// No-op entrypoints
680
681// clang-format off
682#pragma clang diagnostic push
683#pragma clang diagnostic ignored "-Wunused-parameter"
684
Jesse Hall606a54e2015-11-19 22:17:28 -0800685void GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100686 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700687}
688
Jesse Hall606a54e2015-11-19 22:17:28 -0800689void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100690 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700691}
692
Jesse Hall606a54e2015-11-19 22:17:28 -0800693void GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100694 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700695}
696
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700697VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100698 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700699 return VK_SUCCESS;
700}
701
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700702VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100703 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700704 return VK_SUCCESS;
705}
706
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700707VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pCount, VkExtensionProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100708 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700709 return VK_SUCCESS;
710}
711
Jesse Halla366a512015-11-19 22:30:07 -0800712VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700713 return VK_SUCCESS;
714}
715
716VkResult QueueWaitIdle(VkQueue queue) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100717 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700718 return VK_SUCCESS;
719}
720
721VkResult DeviceWaitIdle(VkDevice device) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100722 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700723 return VK_SUCCESS;
724}
725
Jesse Hallcf25c412015-10-29 17:14:50 -0700726void UnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700727}
728
729VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100730 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700731 return VK_SUCCESS;
732}
733
734VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100735 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700736 return VK_SUCCESS;
737}
738
Jesse Hall606a54e2015-11-19 22:17:28 -0800739void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100740 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700741}
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
Jesse Hall606a54e2015-11-19 22:17:28 -0800751void 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}
754
Jesse Hall606a54e2015-11-19 22:17:28 -0800755void 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 +0100756 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700757}
758
759VkResult QueueBindSparseBufferMemory(VkQueue queue, VkBuffer buffer, uint32_t numBindings, const VkSparseMemoryBindInfo* pBindInfo) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100760 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700761 return VK_SUCCESS;
762}
763
764VkResult QueueBindSparseImageOpaqueMemory(VkQueue queue, VkImage image, uint32_t numBindings, const VkSparseMemoryBindInfo* pBindInfo) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100765 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700766 return VK_SUCCESS;
767}
768
769VkResult QueueBindSparseImageMemory(VkQueue queue, VkImage image, uint32_t numBindings, const VkSparseImageMemoryBindInfo* pBindInfo) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100770 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700771 return VK_SUCCESS;
772}
773
Jesse Hallcf25c412015-10-29 17:14:50 -0700774void DestroyFence(VkDevice device, VkFence fence) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700775}
776
777VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
778 return VK_SUCCESS;
779}
780
781VkResult GetFenceStatus(VkDevice device, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100782 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700783 return VK_SUCCESS;
784}
785
786VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
787 return VK_SUCCESS;
788}
789
Jesse Hallcf25c412015-10-29 17:14:50 -0700790void DestroySemaphore(VkDevice device, VkSemaphore semaphore) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700791}
792
793VkResult QueueSignalSemaphore(VkQueue queue, VkSemaphore semaphore) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100794 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700795 return VK_SUCCESS;
796}
797
798VkResult QueueWaitSemaphore(VkQueue queue, VkSemaphore semaphore) {
799 return VK_SUCCESS;
800}
801
Jesse Hallcf25c412015-10-29 17:14:50 -0700802void DestroyEvent(VkDevice device, VkEvent event) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700803}
804
805VkResult GetEventStatus(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100806 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700807 return VK_SUCCESS;
808}
809
810VkResult SetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100811 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700812 return VK_SUCCESS;
813}
814
815VkResult ResetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100816 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700817 return VK_SUCCESS;
818}
819
Jesse Hallcf25c412015-10-29 17:14:50 -0700820void DestroyQueryPool(VkDevice device, VkQueryPool queryPool) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700821}
822
823VkResult 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 +0100824 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700825 return VK_SUCCESS;
826}
827
Jesse Hallcf25c412015-10-29 17:14:50 -0700828void DestroyBufferView(VkDevice device, VkBufferView bufferView) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700829}
830
Jesse Hall606a54e2015-11-19 22:17:28 -0800831void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100832 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700833}
834
Jesse Hallcf25c412015-10-29 17:14:50 -0700835void DestroyImageView(VkDevice device, VkImageView imageView) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700836}
837
Jesse Hallcf25c412015-10-29 17:14:50 -0700838void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700839}
840
Jesse Hallcf25c412015-10-29 17:14:50 -0700841void DestroyShader(VkDevice device, VkShader shader) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700842}
843
Jesse Hallcf25c412015-10-29 17:14:50 -0700844void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700845}
846
847size_t GetPipelineCacheSize(VkDevice device, VkPipelineCache pipelineCache) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100848 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700849 return VK_SUCCESS;
850}
851
Jesse Hall606a54e2015-11-19 22:17:28 -0800852VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t dataSize, void* pData) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100853 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700854 return VK_SUCCESS;
855}
856
857VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100858 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700859 return VK_SUCCESS;
860}
861
Jesse Hallcf25c412015-10-29 17:14:50 -0700862void DestroyPipeline(VkDevice device, VkPipeline pipeline) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700863}
864
Jesse Hallcf25c412015-10-29 17:14:50 -0700865void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700866}
867
Jesse Hallcf25c412015-10-29 17:14:50 -0700868void DestroySampler(VkDevice device, VkSampler sampler) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700869}
870
Jesse Hallcf25c412015-10-29 17:14:50 -0700871void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700872}
873
Jesse Hallcf25c412015-10-29 17:14:50 -0700874void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700875}
876
877VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100878 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700879 return VK_SUCCESS;
880}
881
Jesse Hallcf25c412015-10-29 17:14:50 -0700882void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100883 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700884}
885
886VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100887 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700888 return VK_SUCCESS;
889}
890
Jesse Hallcf25c412015-10-29 17:14:50 -0700891void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700892}
893
Jesse Hallcf25c412015-10-29 17:14:50 -0700894void DestroyRenderPass(VkDevice device, VkRenderPass renderPass) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700895}
896
Jesse Hall606a54e2015-11-19 22:17:28 -0800897void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100898 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700899}
900
Jesse Hallcf25c412015-10-29 17:14:50 -0700901void DestroyCommandPool(VkDevice device, VkCmdPool cmdPool) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700902}
903
904VkResult ResetCommandPool(VkDevice device, VkCmdPool cmdPool, VkCmdPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100905 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700906 return VK_SUCCESS;
907}
908
Jesse Hall04f4f472015-08-16 19:51:04 -0700909VkResult BeginCommandBuffer(VkCmdBuffer cmdBuffer, const VkCmdBufferBeginInfo* pBeginInfo) {
910 return VK_SUCCESS;
911}
912
913VkResult EndCommandBuffer(VkCmdBuffer cmdBuffer) {
914 return VK_SUCCESS;
915}
916
917VkResult ResetCommandBuffer(VkCmdBuffer cmdBuffer, VkCmdBufferResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100918 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700919 return VK_SUCCESS;
920}
921
922void CmdBindPipeline(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
923}
924
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700925void CmdSetViewport(VkCmdBuffer cmdBuffer, uint32_t viewportCount, const VkViewport* pViewports) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700926}
927
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700928void CmdSetScissor(VkCmdBuffer cmdBuffer, uint32_t scissorCount, const VkRect2D* pScissors) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700929}
930
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700931void CmdSetLineWidth(VkCmdBuffer cmdBuffer, float lineWidth) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700932}
933
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700934void CmdSetDepthBias(VkCmdBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) {
935}
936
937void CmdSetBlendConstants(VkCmdBuffer cmdBuffer, const float blendConst[4]) {
938}
939
940void CmdSetDepthBounds(VkCmdBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) {
941}
942
943void CmdSetStencilCompareMask(VkCmdBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) {
944}
945
946void CmdSetStencilWriteMask(VkCmdBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) {
947}
948
949void CmdSetStencilReference(VkCmdBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700950}
951
952void CmdBindDescriptorSets(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets) {
953}
954
955void CmdBindIndexBuffer(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
956}
957
958void CmdBindVertexBuffers(VkCmdBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
959}
960
Jesse Hallcf25c412015-10-29 17:14:50 -0700961void CmdDraw(VkCmdBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700962}
963
Jesse Hallcf25c412015-10-29 17:14:50 -0700964void 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 -0700965}
966
967void CmdDrawIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
968}
969
970void CmdDrawIndexedIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
971}
972
973void CmdDispatch(VkCmdBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) {
974}
975
976void CmdDispatchIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) {
977}
978
979void CmdCopyBuffer(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
980}
981
982void CmdCopyImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
983}
984
985void CmdBlitImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkTexFilter filter) {
986}
987
988void CmdCopyBufferToImage(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
989}
990
991void CmdCopyImageToBuffer(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
992}
993
994void CmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData) {
995}
996
997void CmdFillBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) {
998}
999
1000void CmdClearColorImage(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
1001}
1002
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001003void CmdClearDepthStencilImage(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001004}
1005
Jesse Hallae38f732015-11-19 21:32:50 -08001006void CmdClearAttachments(VkCmdBuffer cmdBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkRect3D* pRects) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001007}
1008
1009void CmdResolveImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
1010}
1011
1012void CmdSetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
1013}
1014
1015void CmdResetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
1016}
1017
1018void CmdWaitEvents(VkCmdBuffer cmdBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags destStageMask, uint32_t memBarrierCount, const void* const* ppMemBarriers) {
1019}
1020
1021void CmdPipelineBarrier(VkCmdBuffer cmdBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags destStageMask, VkBool32 byRegion, uint32_t memBarrierCount, const void* const* ppMemBarriers) {
1022}
1023
1024void CmdBeginQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) {
1025}
1026
1027void CmdEndQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) {
1028}
1029
1030void CmdResetQueryPool(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
1031}
1032
1033void CmdWriteTimestamp(VkCmdBuffer cmdBuffer, VkTimestampType timestampType, VkBuffer destBuffer, VkDeviceSize destOffset) {
1034}
1035
1036void CmdCopyQueryPoolResults(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize destStride, VkQueryResultFlags flags) {
1037}
1038
1039void CmdPushConstants(VkCmdBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values) {
1040}
1041
1042void CmdBeginRenderPass(VkCmdBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkRenderPassContents contents) {
1043}
1044
1045void CmdNextSubpass(VkCmdBuffer cmdBuffer, VkRenderPassContents contents) {
1046}
1047
1048void CmdEndRenderPass(VkCmdBuffer cmdBuffer) {
1049}
1050
1051void CmdExecuteCommands(VkCmdBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCmdBuffer* pCmdBuffers) {
1052}
1053
Jesse Hall04f4f472015-08-16 19:51:04 -07001054#pragma clang diagnostic pop
1055// clang-format on
1056
1057} // namespace null_driver