blob: 9462a3e6fba966899912a1874e13f024f03257ee [file] [log] [blame]
Jesse Halld02edcb2015-09-08 07:44:48 -07001/*
2 * Copyright 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Jesse Hall04f4f472015-08-16 19:51:04 -070017#include <hardware/hwvulkan.h>
Jesse Hall715b86a2016-01-16 16:34:29 -080018#include <vulkan/vk_ext_debug_report.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070019
Jesse Hall1f91d392015-12-11 16:28:44 -080020#include <algorithm>
21#include <array>
Jesse Hall715b86a2016-01-16 16:34:29 -080022#include <inttypes.h>
23#include <string.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070024
Jesse Hall73ab0ac2015-08-25 15:09:15 +010025#include <log/log.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070026#include <utils/Errors.h>
27
Jesse Hall1f91d392015-12-11 16:28:44 -080028#include "null_driver_gen.h"
Jesse Hall04f4f472015-08-16 19:51:04 -070029
30using namespace null_driver;
31
32struct VkPhysicalDevice_T {
33 hwvulkan_dispatch_t dispatch;
34};
35
36struct VkInstance_T {
37 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -080038 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -070039 VkPhysicalDevice_T physical_device;
Jesse Hall715b86a2016-01-16 16:34:29 -080040 uint64_t next_callback_handle;
Jesse Hall04f4f472015-08-16 19:51:04 -070041};
42
43struct VkQueue_T {
44 hwvulkan_dispatch_t dispatch;
45};
46
Jesse Hall3fbc8562015-11-29 22:10:52 -080047struct VkCommandBuffer_T {
Jesse Hall04f4f472015-08-16 19:51:04 -070048 hwvulkan_dispatch_t dispatch;
49};
50
Jesse Hallf8faf0c2015-08-31 11:34:32 -070051namespace {
52// Handles for non-dispatchable objects are either pointers, or arbitrary
53// 64-bit non-zero values. We only use pointers when we need to keep state for
54// the object even in a null driver. For the rest, we form a handle as:
55// [63:63] = 1 to distinguish from pointer handles*
56// [62:56] = non-zero handle type enum value
57// [55: 0] = per-handle-type incrementing counter
58// * This works because virtual addresses with the high bit set are reserved
59// for kernel data in all ABIs we run on.
60//
61// We never reclaim handles on vkDestroy*. It's not even necessary for us to
62// have distinct handles for live objects, and practically speaking we won't
63// ever create 2^56 objects of the same type from a single VkDevice in a null
64// driver.
65//
66// Using a namespace here instead of 'enum class' since we want scoped
67// constants but also want implicit conversions to integral types.
68namespace HandleType {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070069enum Enum {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070070 kBufferView,
Jesse Hall715b86a2016-01-16 16:34:29 -080071 kDebugReportCallbackEXT,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070072 kDescriptorPool,
73 kDescriptorSet,
74 kDescriptorSetLayout,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070075 kEvent,
76 kFence,
77 kFramebuffer,
78 kImageView,
79 kPipeline,
80 kPipelineCache,
81 kPipelineLayout,
82 kQueryPool,
83 kRenderPass,
84 kSampler,
85 kSemaphore,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070086 kShaderModule,
Jesse Hallf8faf0c2015-08-31 11:34:32 -070087
Jesse Hallc7a6eb52015-08-31 12:52:03 -070088 kNumTypes
89};
90} // namespace HandleType
Jesse Hallbde8ee32015-09-01 16:24:29 -070091
Jesse Hall00f10fe2016-02-08 21:20:20 -080092const VkDeviceSize kMaxDeviceMemory = 0x10000000; // 256 MiB, arbitrary
Jesse Hallbde8ee32015-09-01 16:24:29 -070093
Jesse Hallc7a6eb52015-08-31 12:52:03 -070094} // anonymous namespace
Jesse Hallf8faf0c2015-08-31 11:34:32 -070095
Jesse Hall04f4f472015-08-16 19:51:04 -070096struct VkDevice_T {
97 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -080098 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -070099 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
Jesse Hall04f4f472015-08-16 19:51:04 -0700133int CloseDevice(struct hw_device_t* /*device*/) {
134 // nothing to do - opening a device doesn't allocate any resources
135 return 0;
136}
137
138hwvulkan_device_t nulldrv_device = {
139 .common =
140 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500141 .tag = HARDWARE_DEVICE_TAG,
142 .version = HWVULKAN_DEVICE_API_VERSION_0_1,
143 .module = &HAL_MODULE_INFO_SYM.common,
144 .close = CloseDevice,
Jesse Hall04f4f472015-08-16 19:51:04 -0700145 },
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700146 .EnumerateInstanceExtensionProperties =
147 EnumerateInstanceExtensionProperties,
Jesse Hall04f4f472015-08-16 19:51:04 -0700148 .CreateInstance = CreateInstance,
149 .GetInstanceProcAddr = GetInstanceProcAddr};
150
151int OpenDevice(const hw_module_t* /*module*/,
152 const char* id,
153 hw_device_t** device) {
154 if (strcmp(id, HWVULKAN_DEVICE_0) == 0) {
155 *device = &nulldrv_device.common;
156 return 0;
157 }
158 return -ENOENT;
159}
160
161VkInstance_T* GetInstanceFromPhysicalDevice(
162 VkPhysicalDevice_T* physical_device) {
163 return reinterpret_cast<VkInstance_T*>(
164 reinterpret_cast<uintptr_t>(physical_device) -
165 offsetof(VkInstance_T, physical_device));
166}
167
Jesse Hall715b86a2016-01-16 16:34:29 -0800168uint64_t AllocHandle(uint64_t type, uint64_t* next_handle) {
169 const uint64_t kHandleMask = (UINT64_C(1) << 56) - 1;
170 ALOGE_IF(*next_handle == kHandleMask,
171 "non-dispatchable handles of type=%" PRIu64
172 " are about to overflow",
173 type);
174 return (UINT64_C(1) << 63) | ((type & 0x7) << 56) |
175 ((*next_handle)++ & kHandleMask);
176}
177
178template <class Handle>
179Handle AllocHandle(VkInstance instance, HandleType::Enum type) {
180 return reinterpret_cast<Handle>(
181 AllocHandle(type, &instance->next_callback_handle));
182}
183
Michael Lentine3fec89e2015-12-04 16:25:11 -0800184template <class Handle>
185Handle AllocHandle(VkDevice device, HandleType::Enum type) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800186 return reinterpret_cast<Handle>(
Jesse Hall715b86a2016-01-16 16:34:29 -0800187 AllocHandle(type, &device->next_handle[type]));
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700188}
189
Jesse Hall04f4f472015-08-16 19:51:04 -0700190} // namespace
191
192namespace null_driver {
193
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800194#define DEFINE_OBJECT_HANDLE_CONVERSION(T) \
195 T* Get##T##FromHandle(Vk##T h); \
196 T* Get##T##FromHandle(Vk##T h) { \
197 return reinterpret_cast<T*>(uintptr_t(h)); \
198 } \
199 Vk##T GetHandleTo##T(const T* obj); \
200 Vk##T GetHandleTo##T(const T* obj) { \
201 return Vk##T(reinterpret_cast<uintptr_t>(obj)); \
202 }
Jesse Hallf6578742015-08-29 17:06:12 +0100203
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100204// -----------------------------------------------------------------------------
205// Global
206
Jesse Halle1b12782015-11-30 11:27:32 -0800207VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800208VkResult EnumerateInstanceExtensionProperties(
209 const char* layer_name,
210 uint32_t* count,
211 VkExtensionProperties* properties) {
212 if (layer_name) {
213 ALOGW(
214 "Driver vkEnumerateInstanceExtensionProperties shouldn't be called "
215 "with a layer name ('%s')",
216 layer_name);
Jesse Hall715b86a2016-01-16 16:34:29 -0800217 }
218
Jesse Hall4b62e4f2016-01-21 09:49:49 -0800219// NOTE: Change this to zero to report and extension, which can be useful
220// for testing changes to the loader.
221#if 1
222 (void)properties; // unused
223 *count = 0;
224 return VK_SUCCESS;
225#else
Jesse Hall715b86a2016-01-16 16:34:29 -0800226 const VkExtensionProperties kExtensions[] = {
227 {VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}};
228 const uint32_t kExtensionsCount =
229 sizeof(kExtensions) / sizeof(kExtensions[0]);
230
231 if (!properties || *count > kExtensionsCount)
232 *count = kExtensionsCount;
233 if (properties)
234 std::copy(kExtensions, kExtensions + *count, properties);
235 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
Jesse Hall4b62e4f2016-01-21 09:49:49 -0800236#endif
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100237}
238
Jesse Halle1b12782015-11-30 11:27:32 -0800239VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800240VkResult CreateInstance(const VkInstanceCreateInfo* create_info,
Jesse Hall1f91d392015-12-11 16:28:44 -0800241 const VkAllocationCallbacks* allocator,
242 VkInstance* out_instance) {
243 // Assume the loader provided alloc callbacks even if the app didn't.
244 ALOG_ASSERT(
245 allocator,
246 "Missing alloc callbacks, loader or app should have provided them");
247
248 VkInstance_T* instance =
249 static_cast<VkInstance_T*>(allocator->pfnAllocation(
250 allocator->pUserData, sizeof(VkInstance_T), alignof(VkInstance_T),
251 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE));
252 if (!instance)
253 return VK_ERROR_OUT_OF_HOST_MEMORY;
254
255 instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
256 instance->allocator = *allocator;
257 instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall715b86a2016-01-16 16:34:29 -0800258 instance->next_callback_handle = 0;
Jesse Hall715b86a2016-01-16 16:34:29 -0800259
260 for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
261 if (strcmp(create_info->ppEnabledExtensionNames[i],
262 VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) {
Jesse Hallb1471272016-01-17 21:36:58 -0800263 ALOGV("instance extension '%s' requested",
264 create_info->ppEnabledExtensionNames[i]);
265 } else {
266 ALOGW("unsupported extension '%s' requested",
267 create_info->ppEnabledExtensionNames[i]);
Jesse Hall715b86a2016-01-16 16:34:29 -0800268 }
269 }
Jesse Hall1f91d392015-12-11 16:28:44 -0800270
271 *out_instance = instance;
272 return VK_SUCCESS;
273}
274
275VKAPI_ATTR
276PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name) {
277 return instance ? GetInstanceProcAddr(name) : GetGlobalProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700278}
279
Jesse Halle1b12782015-11-30 11:27:32 -0800280VKAPI_ATTR
Jesse Hall04f4f472015-08-16 19:51:04 -0700281PFN_vkVoidFunction GetDeviceProcAddr(VkDevice, const char* name) {
Jesse Hall1f91d392015-12-11 16:28:44 -0800282 return GetInstanceProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700283}
284
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100285// -----------------------------------------------------------------------------
286// Instance
287
Jesse Hall03b6fe12015-11-24 12:44:21 -0800288void DestroyInstance(VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800289 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800290 instance->allocator.pfnFree(instance->allocator.pUserData, instance);
Jesse Hall04f4f472015-08-16 19:51:04 -0700291}
292
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100293// -----------------------------------------------------------------------------
294// PhysicalDevice
295
Jesse Hall04f4f472015-08-16 19:51:04 -0700296VkResult EnumeratePhysicalDevices(VkInstance instance,
297 uint32_t* physical_device_count,
298 VkPhysicalDevice* physical_devices) {
299 if (physical_devices && *physical_device_count >= 1)
300 physical_devices[0] = &instance->physical_device;
301 *physical_device_count = 1;
302 return VK_SUCCESS;
303}
304
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800305VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice /*gpu*/,
306 uint32_t* count,
307 VkLayerProperties* /*properties*/) {
308 ALOGW("Driver vkEnumerateDeviceLayerProperties shouldn't be called");
309 *count = 0;
310 return VK_SUCCESS;
311}
312
313VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice /*gpu*/,
314 const char* layer_name,
315 uint32_t* count,
316 VkExtensionProperties* properties) {
317 if (layer_name) {
318 ALOGW(
319 "Driver vkEnumerateDeviceExtensionProperties shouldn't be called "
320 "with a layer name ('%s')",
321 layer_name);
322 *count = 0;
323 return VK_SUCCESS;
324 }
325
326 const VkExtensionProperties kExtensions[] = {
327 {VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME,
328 VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION}};
329 const uint32_t kExtensionsCount =
330 sizeof(kExtensions) / sizeof(kExtensions[0]);
331
332 if (!properties || *count > kExtensionsCount)
333 *count = kExtensionsCount;
334 if (properties)
335 std::copy(kExtensions, kExtensions + *count, properties);
336 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
337}
338
Jesse Hall606a54e2015-11-19 22:17:28 -0800339void GetPhysicalDeviceProperties(VkPhysicalDevice,
340 VkPhysicalDeviceProperties* properties) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700341 properties->apiVersion = VK_API_VERSION;
342 properties->driverVersion = VK_MAKE_VERSION(0, 0, 1);
Jesse Hall65ab5522015-11-30 00:07:16 -0800343 properties->vendorID = 0;
344 properties->deviceID = 0;
Jesse Hall04f4f472015-08-16 19:51:04 -0700345 properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
346 strcpy(properties->deviceName, "Android Vulkan Null Driver");
347 memset(properties->pipelineCacheUUID, 0,
348 sizeof(properties->pipelineCacheUUID));
Jesse Hall04f4f472015-08-16 19:51:04 -0700349}
350
Jesse Hall606a54e2015-11-19 22:17:28 -0800351void GetPhysicalDeviceQueueFamilyProperties(
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700352 VkPhysicalDevice,
353 uint32_t* count,
354 VkQueueFamilyProperties* properties) {
Jesse Hall715b86a2016-01-16 16:34:29 -0800355 if (!properties || *count > 1)
356 *count = 1;
357 if (properties && *count == 1) {
Jesse Hall65ab5522015-11-30 00:07:16 -0800358 properties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT |
359 VK_QUEUE_TRANSFER_BIT;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700360 properties->queueCount = 1;
Jesse Hallacfa5342015-11-19 21:51:33 -0800361 properties->timestampValidBits = 64;
Jesse Hall715b86a2016-01-16 16:34:29 -0800362 properties->minImageTransferGranularity = VkExtent3D{1, 1, 1};
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700363 }
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700364}
365
Jesse Hall606a54e2015-11-19 22:17:28 -0800366void GetPhysicalDeviceMemoryProperties(
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100367 VkPhysicalDevice,
368 VkPhysicalDeviceMemoryProperties* properties) {
369 properties->memoryTypeCount = 1;
370 properties->memoryTypes[0].propertyFlags =
Jesse Halld1af8122015-11-29 23:50:38 -0800371 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
372 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
373 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
374 VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100375 properties->memoryTypes[0].heapIndex = 0;
376 properties->memoryHeapCount = 1;
Jesse Hallbde8ee32015-09-01 16:24:29 -0700377 properties->memoryHeaps[0].size = kMaxDeviceMemory;
Jesse Halld1af8122015-11-29 23:50:38 -0800378 properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
Jesse Hall04f4f472015-08-16 19:51:04 -0700379}
380
Jesse Hall8e37cf32016-01-18 04:00:57 -0800381void GetPhysicalDeviceFeatures(VkPhysicalDevice /*gpu*/,
382 VkPhysicalDeviceFeatures* features) {
383 *features = VkPhysicalDeviceFeatures{
384 VK_TRUE, // robustBufferAccess
385 VK_FALSE, // fullDrawIndexUint32
386 VK_FALSE, // imageCubeArray
387 VK_FALSE, // independentBlend
388 VK_FALSE, // geometryShader
389 VK_FALSE, // tessellationShader
390 VK_FALSE, // sampleRateShading
391 VK_FALSE, // dualSrcBlend
392 VK_FALSE, // logicOp
393 VK_FALSE, // multiDrawIndirect
394 VK_FALSE, // drawIndirectFirstInstance
395 VK_FALSE, // depthClamp
396 VK_FALSE, // depthBiasClamp
397 VK_FALSE, // fillModeNonSolid
398 VK_FALSE, // depthBounds
399 VK_FALSE, // wideLines
400 VK_FALSE, // largePoints
401 VK_FALSE, // alphaToOne
402 VK_FALSE, // multiViewport
403 VK_FALSE, // samplerAnisotropy
404 VK_FALSE, // textureCompressionETC2
405 VK_FALSE, // textureCompressionASTC_LDR
406 VK_FALSE, // textureCompressionBC
407 VK_FALSE, // occlusionQueryPrecise
408 VK_FALSE, // pipelineStatisticsQuery
409 VK_FALSE, // vertexPipelineStoresAndAtomics
410 VK_FALSE, // fragmentStoresAndAtomics
411 VK_FALSE, // shaderTessellationAndGeometryPointSize
412 VK_FALSE, // shaderImageGatherExtended
413 VK_FALSE, // shaderStorageImageExtendedFormats
414 VK_FALSE, // shaderStorageImageMultisample
415 VK_FALSE, // shaderStorageImageReadWithoutFormat
416 VK_FALSE, // shaderStorageImageWriteWithoutFormat
417 VK_FALSE, // shaderUniformBufferArrayDynamicIndexing
418 VK_FALSE, // shaderSampledImageArrayDynamicIndexing
419 VK_FALSE, // shaderStorageBufferArrayDynamicIndexing
420 VK_FALSE, // shaderStorageImageArrayDynamicIndexing
421 VK_FALSE, // shaderClipDistance
422 VK_FALSE, // shaderCullDistance
423 VK_FALSE, // shaderFloat64
424 VK_FALSE, // shaderInt64
425 VK_FALSE, // shaderInt16
426 VK_FALSE, // shaderResourceResidency
427 VK_FALSE, // shaderResourceMinLod
428 VK_FALSE, // sparseBinding
429 VK_FALSE, // sparseResidencyBuffer
430 VK_FALSE, // sparseResidencyImage2D
431 VK_FALSE, // sparseResidencyImage3D
432 VK_FALSE, // sparseResidency2Samples
433 VK_FALSE, // sparseResidency4Samples
434 VK_FALSE, // sparseResidency8Samples
435 VK_FALSE, // sparseResidency16Samples
436 VK_FALSE, // sparseResidencyAliased
437 VK_FALSE, // variableMultisampleRate
438 VK_FALSE, // inheritedQueries
439 };
440}
441
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100442// -----------------------------------------------------------------------------
443// Device
444
Jesse Hall04f4f472015-08-16 19:51:04 -0700445VkResult CreateDevice(VkPhysicalDevice physical_device,
Jesse Hallb1471272016-01-17 21:36:58 -0800446 const VkDeviceCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800447 const VkAllocationCallbacks* allocator,
Jesse Hall04f4f472015-08-16 19:51:04 -0700448 VkDevice* out_device) {
449 VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800450 if (!allocator)
451 allocator = &instance->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800452 VkDevice_T* device = static_cast<VkDevice_T*>(allocator->pfnAllocation(
453 allocator->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T),
454 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE));
Jesse Hall04f4f472015-08-16 19:51:04 -0700455 if (!device)
456 return VK_ERROR_OUT_OF_HOST_MEMORY;
457
458 device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800459 device->allocator = *allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700460 device->instance = instance;
461 device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700462 std::fill(device->next_handle.begin(), device->next_handle.end(),
463 UINT64_C(0));
Jesse Hall04f4f472015-08-16 19:51:04 -0700464
Jesse Hallb1471272016-01-17 21:36:58 -0800465 for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
466 if (strcmp(create_info->ppEnabledExtensionNames[i],
467 VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME) == 0) {
468 ALOGV("Enabling " VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME);
469 }
470 }
471
Jesse Hall04f4f472015-08-16 19:51:04 -0700472 *out_device = device;
473 return VK_SUCCESS;
474}
475
Jesse Hall3fbc8562015-11-29 22:10:52 -0800476void DestroyDevice(VkDevice device,
477 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700478 if (!device)
Jesse Hallcf25c412015-10-29 17:14:50 -0700479 return;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800480 device->allocator.pfnFree(device->allocator.pUserData, device);
Jesse Hall04f4f472015-08-16 19:51:04 -0700481}
482
Jesse Hall606a54e2015-11-19 22:17:28 -0800483void GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700484 *queue = &device->queue;
Jesse Hall04f4f472015-08-16 19:51:04 -0700485}
486
487// -----------------------------------------------------------------------------
Jesse Hall3fbc8562015-11-29 22:10:52 -0800488// CommandPool
Jesse Hall03b6fe12015-11-24 12:44:21 -0800489
Jesse Hall3fbc8562015-11-29 22:10:52 -0800490struct CommandPool {
491 typedef VkCommandPool HandleType;
492 VkAllocationCallbacks allocator;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800493};
Jesse Hall3fbc8562015-11-29 22:10:52 -0800494DEFINE_OBJECT_HANDLE_CONVERSION(CommandPool)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800495
496VkResult CreateCommandPool(VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800497 const VkCommandPoolCreateInfo* /*create_info*/,
498 const VkAllocationCallbacks* allocator,
499 VkCommandPool* cmd_pool) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800500 if (!allocator)
501 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800502 CommandPool* pool = static_cast<CommandPool*>(allocator->pfnAllocation(
503 allocator->pUserData, sizeof(CommandPool), alignof(CommandPool),
504 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall03b6fe12015-11-24 12:44:21 -0800505 if (!pool)
506 return VK_ERROR_OUT_OF_HOST_MEMORY;
507 pool->allocator = *allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800508 *cmd_pool = GetHandleToCommandPool(pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800509 return VK_SUCCESS;
510}
511
512void DestroyCommandPool(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800513 VkCommandPool cmd_pool,
514 const VkAllocationCallbacks* /*allocator*/) {
515 CommandPool* pool = GetCommandPoolFromHandle(cmd_pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800516 pool->allocator.pfnFree(pool->allocator.pUserData, pool);
517}
518
519// -----------------------------------------------------------------------------
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700520// CmdBuffer
521
Jesse Hall3fbc8562015-11-29 22:10:52 -0800522VkResult AllocateCommandBuffers(VkDevice /*device*/,
523 const VkCommandBufferAllocateInfo* alloc_info,
524 VkCommandBuffer* cmdbufs) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800525 VkResult result = VK_SUCCESS;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800526 CommandPool& pool = *GetCommandPoolFromHandle(alloc_info->commandPool);
Jesse Hall3dd678a2016-01-08 21:52:01 -0800527 std::fill(cmdbufs, cmdbufs + alloc_info->commandBufferCount, nullptr);
528 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800529 cmdbufs[i] =
530 static_cast<VkCommandBuffer_T*>(pool.allocator.pfnAllocation(
531 pool.allocator.pUserData, sizeof(VkCommandBuffer_T),
532 alignof(VkCommandBuffer_T), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallfbf97b02015-11-20 14:17:03 -0800533 if (!cmdbufs[i]) {
534 result = VK_ERROR_OUT_OF_HOST_MEMORY;
535 break;
536 }
537 cmdbufs[i]->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
538 }
539 if (result != VK_SUCCESS) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800540 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800541 if (!cmdbufs[i])
542 break;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800543 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800544 }
545 }
Jesse Hallfbf97b02015-11-20 14:17:03 -0800546 return result;
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700547}
548
Jesse Hall03b6fe12015-11-24 12:44:21 -0800549void FreeCommandBuffers(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800550 VkCommandPool cmd_pool,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800551 uint32_t count,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800552 const VkCommandBuffer* cmdbufs) {
553 CommandPool& pool = *GetCommandPoolFromHandle(cmd_pool);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800554 for (uint32_t i = 0; i < count; i++)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800555 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700556}
557
558// -----------------------------------------------------------------------------
Jesse Hall2077ce02015-08-29 18:10:59 +0100559// DeviceMemory
560
561struct DeviceMemory {
562 typedef VkDeviceMemory HandleType;
563 VkDeviceSize size;
564 alignas(16) uint8_t data[0];
565};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800566DEFINE_OBJECT_HANDLE_CONVERSION(DeviceMemory)
Jesse Hall2077ce02015-08-29 18:10:59 +0100567
Jesse Hall3fbc8562015-11-29 22:10:52 -0800568VkResult AllocateMemory(VkDevice device,
569 const VkMemoryAllocateInfo* alloc_info,
570 const VkAllocationCallbacks* allocator,
571 VkDeviceMemory* mem_handle) {
Jesse Hall2077ce02015-08-29 18:10:59 +0100572 if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize)
573 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800574 if (!allocator)
575 allocator = &device->allocator;
Jesse Hall2077ce02015-08-29 18:10:59 +0100576
Jesse Hall2077ce02015-08-29 18:10:59 +0100577 size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize);
Jesse Hall3fbc8562015-11-29 22:10:52 -0800578 DeviceMemory* mem = static_cast<DeviceMemory*>(allocator->pfnAllocation(
579 allocator->pUserData, size, alignof(DeviceMemory),
580 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall2077ce02015-08-29 18:10:59 +0100581 if (!mem)
582 return VK_ERROR_OUT_OF_HOST_MEMORY;
583 mem->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800584 *mem_handle = GetHandleToDeviceMemory(mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100585 return VK_SUCCESS;
586}
587
Jesse Hall03b6fe12015-11-24 12:44:21 -0800588void FreeMemory(VkDevice device,
589 VkDeviceMemory mem_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800590 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800591 if (!allocator)
592 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800593 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800594 allocator->pfnFree(allocator->pUserData, mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100595}
596
597VkResult MapMemory(VkDevice,
598 VkDeviceMemory mem_handle,
599 VkDeviceSize offset,
600 VkDeviceSize,
601 VkMemoryMapFlags,
602 void** out_ptr) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800603 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall2077ce02015-08-29 18:10:59 +0100604 *out_ptr = &mem->data[0] + offset;
605 return VK_SUCCESS;
606}
607
608// -----------------------------------------------------------------------------
Jesse Hallf6578742015-08-29 17:06:12 +0100609// Buffer
610
611struct Buffer {
612 typedef VkBuffer HandleType;
613 VkDeviceSize size;
614};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800615DEFINE_OBJECT_HANDLE_CONVERSION(Buffer)
Jesse Hallf6578742015-08-29 17:06:12 +0100616
617VkResult CreateBuffer(VkDevice device,
618 const VkBufferCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800619 const VkAllocationCallbacks* allocator,
Jesse Hallf6578742015-08-29 17:06:12 +0100620 VkBuffer* buffer_handle) {
Jesse Hallbde8ee32015-09-01 16:24:29 -0700621 ALOGW_IF(create_info->size > kMaxDeviceMemory,
622 "CreateBuffer: requested size 0x%" PRIx64
623 " exceeds max device memory size 0x%" PRIx64,
624 create_info->size, kMaxDeviceMemory);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800625 if (!allocator)
626 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800627 Buffer* buffer = static_cast<Buffer*>(allocator->pfnAllocation(
628 allocator->pUserData, sizeof(Buffer), alignof(Buffer),
629 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallf6578742015-08-29 17:06:12 +0100630 if (!buffer)
631 return VK_ERROR_OUT_OF_HOST_MEMORY;
632 buffer->size = create_info->size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800633 *buffer_handle = GetHandleToBuffer(buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100634 return VK_SUCCESS;
635}
636
Jesse Hall606a54e2015-11-19 22:17:28 -0800637void GetBufferMemoryRequirements(VkDevice,
638 VkBuffer buffer_handle,
639 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800640 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hallf6578742015-08-29 17:06:12 +0100641 requirements->size = buffer->size;
642 requirements->alignment = 16; // allow fast Neon/SSE memcpy
643 requirements->memoryTypeBits = 0x1;
Jesse Hallf6578742015-08-29 17:06:12 +0100644}
645
Jesse Hall03b6fe12015-11-24 12:44:21 -0800646void DestroyBuffer(VkDevice device,
647 VkBuffer buffer_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800648 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800649 if (!allocator)
650 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800651 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800652 allocator->pfnFree(allocator->pUserData, buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100653}
654
655// -----------------------------------------------------------------------------
Jesse Hall85c05b62015-09-01 18:07:41 -0700656// Image
657
658struct Image {
659 typedef VkImage HandleType;
660 VkDeviceSize size;
661};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800662DEFINE_OBJECT_HANDLE_CONVERSION(Image)
Jesse Hall85c05b62015-09-01 18:07:41 -0700663
664VkResult CreateImage(VkDevice device,
665 const VkImageCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800666 const VkAllocationCallbacks* allocator,
Jesse Hall85c05b62015-09-01 18:07:41 -0700667 VkImage* image_handle) {
668 if (create_info->imageType != VK_IMAGE_TYPE_2D ||
669 create_info->format != VK_FORMAT_R8G8B8A8_UNORM ||
670 create_info->mipLevels != 1) {
671 ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u",
672 create_info->imageType, create_info->format,
673 create_info->mipLevels);
Jesse Halla15a4bf2015-11-19 22:48:02 -0800674 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall85c05b62015-09-01 18:07:41 -0700675 }
676
677 VkDeviceSize size =
678 VkDeviceSize(create_info->extent.width * create_info->extent.height) *
Jesse Halla15a4bf2015-11-19 22:48:02 -0800679 create_info->arrayLayers * create_info->samples * 4u;
Jesse Hall85c05b62015-09-01 18:07:41 -0700680 ALOGW_IF(size > kMaxDeviceMemory,
681 "CreateImage: image size 0x%" PRIx64
682 " exceeds max device memory size 0x%" PRIx64,
683 size, kMaxDeviceMemory);
684
Jesse Hall03b6fe12015-11-24 12:44:21 -0800685 if (!allocator)
686 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800687 Image* image = static_cast<Image*>(allocator->pfnAllocation(
688 allocator->pUserData, sizeof(Image), alignof(Image),
689 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall85c05b62015-09-01 18:07:41 -0700690 if (!image)
691 return VK_ERROR_OUT_OF_HOST_MEMORY;
692 image->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800693 *image_handle = GetHandleToImage(image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700694 return VK_SUCCESS;
695}
696
Jesse Hall606a54e2015-11-19 22:17:28 -0800697void GetImageMemoryRequirements(VkDevice,
698 VkImage image_handle,
699 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800700 Image* image = GetImageFromHandle(image_handle);
Jesse Hall85c05b62015-09-01 18:07:41 -0700701 requirements->size = image->size;
702 requirements->alignment = 16; // allow fast Neon/SSE memcpy
703 requirements->memoryTypeBits = 0x1;
Jesse Hall85c05b62015-09-01 18:07:41 -0700704}
705
Jesse Hall03b6fe12015-11-24 12:44:21 -0800706void DestroyImage(VkDevice device,
707 VkImage image_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800708 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800709 if (!allocator)
710 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800711 Image* image = GetImageFromHandle(image_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800712 allocator->pfnFree(allocator->pUserData, image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700713}
714
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800715VkResult GetSwapchainGrallocUsageANDROID(VkDevice,
716 VkFormat,
717 VkImageUsageFlags,
718 int* grallocUsage) {
719 // The null driver never reads or writes the gralloc buffer
720 *grallocUsage = 0;
721 return VK_SUCCESS;
722}
723
724VkResult AcquireImageANDROID(VkDevice,
725 VkImage,
726 int fence,
727 VkSemaphore,
728 VkFence) {
729 close(fence);
730 return VK_SUCCESS;
731}
732
733VkResult QueueSignalReleaseImageANDROID(VkQueue,
734 uint32_t,
735 const VkSemaphore*,
736 VkImage,
737 int* fence) {
738 *fence = -1;
739 return VK_SUCCESS;
740}
741
Jesse Hall85c05b62015-09-01 18:07:41 -0700742// -----------------------------------------------------------------------------
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700743// No-op types
744
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700745VkResult CreateBufferView(VkDevice device,
746 const VkBufferViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800747 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700748 VkBufferView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800749 *view = AllocHandle<VkBufferView>(device, HandleType::kBufferView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700750 return VK_SUCCESS;
751}
752
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700753VkResult CreateDescriptorPool(VkDevice device,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700754 const VkDescriptorPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800755 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700756 VkDescriptorPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800757 *pool = AllocHandle<VkDescriptorPool>(device, HandleType::kDescriptorPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700758 return VK_SUCCESS;
759}
760
Jesse Hall3fbc8562015-11-29 22:10:52 -0800761VkResult AllocateDescriptorSets(VkDevice device,
762 const VkDescriptorSetAllocateInfo* alloc_info,
763 VkDescriptorSet* descriptor_sets) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800764 for (uint32_t i = 0; i < alloc_info->descriptorSetCount; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800765 descriptor_sets[i] =
766 AllocHandle<VkDescriptorSet>(device, HandleType::kDescriptorSet);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700767 return VK_SUCCESS;
768}
769
770VkResult CreateDescriptorSetLayout(VkDevice device,
771 const VkDescriptorSetLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800772 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700773 VkDescriptorSetLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800774 *layout = AllocHandle<VkDescriptorSetLayout>(
775 device, HandleType::kDescriptorSetLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700776 return VK_SUCCESS;
777}
778
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700779VkResult CreateEvent(VkDevice device,
780 const VkEventCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800781 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700782 VkEvent* event) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800783 *event = AllocHandle<VkEvent>(device, HandleType::kEvent);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700784 return VK_SUCCESS;
785}
786
787VkResult CreateFence(VkDevice device,
788 const VkFenceCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800789 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700790 VkFence* fence) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800791 *fence = AllocHandle<VkFence>(device, HandleType::kFence);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700792 return VK_SUCCESS;
793}
794
795VkResult CreateFramebuffer(VkDevice device,
796 const VkFramebufferCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800797 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700798 VkFramebuffer* framebuffer) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800799 *framebuffer = AllocHandle<VkFramebuffer>(device, HandleType::kFramebuffer);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700800 return VK_SUCCESS;
801}
802
803VkResult CreateImageView(VkDevice device,
804 const VkImageViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800805 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700806 VkImageView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800807 *view = AllocHandle<VkImageView>(device, HandleType::kImageView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700808 return VK_SUCCESS;
809}
810
811VkResult CreateGraphicsPipelines(VkDevice device,
812 VkPipelineCache,
813 uint32_t count,
814 const VkGraphicsPipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800815 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700816 VkPipeline* pipelines) {
817 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800818 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700819 return VK_SUCCESS;
820}
821
822VkResult CreateComputePipelines(VkDevice device,
823 VkPipelineCache,
824 uint32_t count,
825 const VkComputePipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800826 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700827 VkPipeline* pipelines) {
828 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800829 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700830 return VK_SUCCESS;
831}
832
833VkResult CreatePipelineCache(VkDevice device,
834 const VkPipelineCacheCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800835 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700836 VkPipelineCache* cache) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800837 *cache = AllocHandle<VkPipelineCache>(device, HandleType::kPipelineCache);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700838 return VK_SUCCESS;
839}
840
841VkResult CreatePipelineLayout(VkDevice device,
842 const VkPipelineLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800843 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700844 VkPipelineLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800845 *layout =
846 AllocHandle<VkPipelineLayout>(device, HandleType::kPipelineLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700847 return VK_SUCCESS;
848}
849
850VkResult CreateQueryPool(VkDevice device,
851 const VkQueryPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800852 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700853 VkQueryPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800854 *pool = AllocHandle<VkQueryPool>(device, HandleType::kQueryPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700855 return VK_SUCCESS;
856}
857
858VkResult CreateRenderPass(VkDevice device,
859 const VkRenderPassCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800860 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700861 VkRenderPass* renderpass) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800862 *renderpass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700863 return VK_SUCCESS;
864}
865
866VkResult CreateSampler(VkDevice device,
867 const VkSamplerCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800868 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700869 VkSampler* sampler) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800870 *sampler = AllocHandle<VkSampler>(device, HandleType::kSampler);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700871 return VK_SUCCESS;
872}
873
874VkResult CreateSemaphore(VkDevice device,
875 const VkSemaphoreCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800876 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700877 VkSemaphore* semaphore) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800878 *semaphore = AllocHandle<VkSemaphore>(device, HandleType::kSemaphore);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700879 return VK_SUCCESS;
880}
881
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700882VkResult CreateShaderModule(VkDevice device,
883 const VkShaderModuleCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800884 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700885 VkShaderModule* module) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800886 *module = AllocHandle<VkShaderModule>(device, HandleType::kShaderModule);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700887 return VK_SUCCESS;
888}
889
Jesse Hall715b86a2016-01-16 16:34:29 -0800890VkResult CreateDebugReportCallbackEXT(VkInstance instance,
891 const VkDebugReportCallbackCreateInfoEXT*,
892 const VkAllocationCallbacks*,
893 VkDebugReportCallbackEXT* callback) {
894 *callback = AllocHandle<VkDebugReportCallbackEXT>(
895 instance, HandleType::kDebugReportCallbackEXT);
896 return VK_SUCCESS;
897}
898
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700899// -----------------------------------------------------------------------------
Jesse Hall04f4f472015-08-16 19:51:04 -0700900// No-op entrypoints
901
902// clang-format off
903#pragma clang diagnostic push
904#pragma clang diagnostic ignored "-Wunused-parameter"
905
Jesse Hall606a54e2015-11-19 22:17:28 -0800906void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100907 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700908}
909
Jesse Halla9e57032015-11-30 01:03:10 -0800910VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100911 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Halla9e57032015-11-30 01:03:10 -0800912 return VK_SUCCESS;
Jesse Hall04f4f472015-08-16 19:51:04 -0700913}
914
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700915VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100916 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700917 return VK_SUCCESS;
918}
919
Jesse Halla366a512015-11-19 22:30:07 -0800920VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700921 return VK_SUCCESS;
922}
923
924VkResult QueueWaitIdle(VkQueue queue) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100925 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700926 return VK_SUCCESS;
927}
928
929VkResult DeviceWaitIdle(VkDevice device) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100930 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700931 return VK_SUCCESS;
932}
933
Jesse Hallcf25c412015-10-29 17:14:50 -0700934void UnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700935}
936
937VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100938 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700939 return VK_SUCCESS;
940}
941
942VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100943 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700944 return VK_SUCCESS;
945}
946
Jesse Hall606a54e2015-11-19 22:17:28 -0800947void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100948 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700949}
950
Jesse Hall04f4f472015-08-16 19:51:04 -0700951VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset) {
952 return VK_SUCCESS;
953}
954
Jesse Hall04f4f472015-08-16 19:51:04 -0700955VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset) {
956 return VK_SUCCESS;
957}
958
Jesse Hall606a54e2015-11-19 22:17:28 -0800959void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100960 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700961}
962
Jesse Hall091ed9e2015-11-30 00:55:29 -0800963void GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pNumProperties, VkSparseImageFormatProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100964 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700965}
966
Jesse Halla6429252015-11-29 18:59:42 -0800967VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100968 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700969 return VK_SUCCESS;
970}
971
Jesse Hall3fbc8562015-11-29 22:10:52 -0800972void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700973}
974
975VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
976 return VK_SUCCESS;
977}
978
979VkResult GetFenceStatus(VkDevice device, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100980 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700981 return VK_SUCCESS;
982}
983
984VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
985 return VK_SUCCESS;
986}
987
Jesse Hall3fbc8562015-11-29 22:10:52 -0800988void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700989}
990
Jesse Hall3fbc8562015-11-29 22:10:52 -0800991void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700992}
993
994VkResult GetEventStatus(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100995 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -0700996 return VK_SUCCESS;
997}
998
999VkResult SetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001000 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001001 return VK_SUCCESS;
1002}
1003
1004VkResult ResetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001005 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001006 return VK_SUCCESS;
1007}
1008
Jesse Hall3fbc8562015-11-29 22:10:52 -08001009void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001010}
1011
Jesse Halla9bb62b2015-11-21 19:31:56 -08001012VkResult GetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001013 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001014 return VK_SUCCESS;
1015}
1016
Jesse Hall3fbc8562015-11-29 22:10:52 -08001017void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001018}
1019
Jesse Hall606a54e2015-11-19 22:17:28 -08001020void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001021 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001022}
1023
Jesse Hall3fbc8562015-11-29 22:10:52 -08001024void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001025}
1026
Jesse Hall3fbc8562015-11-29 22:10:52 -08001027void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001028}
1029
Jesse Hall3fbc8562015-11-29 22:10:52 -08001030void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001031}
1032
Jesse Halla9bb62b2015-11-21 19:31:56 -08001033VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001034 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001035 return VK_SUCCESS;
1036}
1037
1038VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001039 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001040 return VK_SUCCESS;
1041}
1042
Jesse Hall3fbc8562015-11-29 22:10:52 -08001043void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001044}
1045
Jesse Hall3fbc8562015-11-29 22:10:52 -08001046void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001047}
1048
Jesse Hall3fbc8562015-11-29 22:10:52 -08001049void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001050}
1051
Jesse Hall3fbc8562015-11-29 22:10:52 -08001052void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001053}
1054
Jesse Hall3fbc8562015-11-29 22:10:52 -08001055void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001056}
1057
Jesse Hallfbf97b02015-11-20 14:17:03 -08001058VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001059 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001060 return VK_SUCCESS;
1061}
1062
Jesse Hallcf25c412015-10-29 17:14:50 -07001063void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001064 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001065}
1066
1067VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001068 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001069 return VK_SUCCESS;
1070}
1071
Jesse Hall3fbc8562015-11-29 22:10:52 -08001072void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001073}
1074
Jesse Hall3fbc8562015-11-29 22:10:52 -08001075void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001076}
1077
Jesse Hall606a54e2015-11-19 22:17:28 -08001078void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001079 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001080}
1081
Jesse Hall3fbc8562015-11-29 22:10:52 -08001082VkResult ResetCommandPool(VkDevice device, VkCommandPool cmdPool, VkCommandPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001083 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001084 return VK_SUCCESS;
1085}
1086
Jesse Hall3fbc8562015-11-29 22:10:52 -08001087VkResult BeginCommandBuffer(VkCommandBuffer cmdBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001088 return VK_SUCCESS;
1089}
1090
Jesse Hall3fbc8562015-11-29 22:10:52 -08001091VkResult EndCommandBuffer(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001092 return VK_SUCCESS;
1093}
1094
Jesse Hall3fbc8562015-11-29 22:10:52 -08001095VkResult ResetCommandBuffer(VkCommandBuffer cmdBuffer, VkCommandBufferResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001096 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001097 return VK_SUCCESS;
1098}
1099
Jesse Hall3fbc8562015-11-29 22:10:52 -08001100void CmdBindPipeline(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001101}
1102
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001103void CmdSetViewport(VkCommandBuffer cmdBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001104}
1105
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001106void CmdSetScissor(VkCommandBuffer cmdBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001107}
1108
Jesse Hall3fbc8562015-11-29 22:10:52 -08001109void CmdSetLineWidth(VkCommandBuffer cmdBuffer, float lineWidth) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001110}
1111
Jesse Hall3fbc8562015-11-29 22:10:52 -08001112void CmdSetDepthBias(VkCommandBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001113}
1114
Jesse Hall3fbc8562015-11-29 22:10:52 -08001115void CmdSetBlendConstants(VkCommandBuffer cmdBuffer, const float blendConst[4]) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001116}
1117
Jesse Hall3fbc8562015-11-29 22:10:52 -08001118void CmdSetDepthBounds(VkCommandBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001119}
1120
Jesse Hall3fbc8562015-11-29 22:10:52 -08001121void CmdSetStencilCompareMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001122}
1123
Jesse Hall3fbc8562015-11-29 22:10:52 -08001124void CmdSetStencilWriteMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001125}
1126
Jesse Hall3fbc8562015-11-29 22:10:52 -08001127void CmdSetStencilReference(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001128}
1129
Jesse Hall3fbc8562015-11-29 22:10:52 -08001130void CmdBindDescriptorSets(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001131}
1132
Jesse Hall3fbc8562015-11-29 22:10:52 -08001133void CmdBindIndexBuffer(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001134}
1135
Jesse Hall3fbc8562015-11-29 22:10:52 -08001136void CmdBindVertexBuffers(VkCommandBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001137}
1138
Jesse Hall3fbc8562015-11-29 22:10:52 -08001139void CmdDraw(VkCommandBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001140}
1141
Jesse Hall3fbc8562015-11-29 22:10:52 -08001142void CmdDrawIndexed(VkCommandBuffer cmdBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001143}
1144
Jesse Hall3fbc8562015-11-29 22:10:52 -08001145void CmdDrawIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001146}
1147
Jesse Hall3fbc8562015-11-29 22:10:52 -08001148void CmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001149}
1150
Jesse Hall3fbc8562015-11-29 22:10:52 -08001151void CmdDispatch(VkCommandBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001152}
1153
Jesse Hall3fbc8562015-11-29 22:10:52 -08001154void CmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001155}
1156
Jesse Hall3fbc8562015-11-29 22:10:52 -08001157void CmdCopyBuffer(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001158}
1159
Jesse Hall3fbc8562015-11-29 22:10:52 -08001160void CmdCopyImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001161}
1162
Jesse Hall3fbc8562015-11-29 22:10:52 -08001163void CmdBlitImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001164}
1165
Jesse Hall3fbc8562015-11-29 22:10:52 -08001166void CmdCopyBufferToImage(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001167}
1168
Jesse Hall3fbc8562015-11-29 22:10:52 -08001169void CmdCopyImageToBuffer(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001170}
1171
Jesse Hall3fbc8562015-11-29 22:10:52 -08001172void CmdUpdateBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001173}
1174
Jesse Hall3fbc8562015-11-29 22:10:52 -08001175void CmdFillBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001176}
1177
Jesse Hall3fbc8562015-11-29 22:10:52 -08001178void CmdClearColorImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001179}
1180
Jesse Hall3fbc8562015-11-29 22:10:52 -08001181void CmdClearDepthStencilImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001182}
1183
Jesse Hall3fbc8562015-11-29 22:10:52 -08001184void CmdClearAttachments(VkCommandBuffer cmdBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001185}
1186
Jesse Hall3fbc8562015-11-29 22:10:52 -08001187void CmdResolveImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001188}
1189
Jesse Hall3fbc8562015-11-29 22:10:52 -08001190void CmdSetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001191}
1192
Jesse Hall3fbc8562015-11-29 22:10:52 -08001193void CmdResetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001194}
1195
Jesse Hall3dd678a2016-01-08 21:52:01 -08001196void CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001197}
1198
Jesse Hall3dd678a2016-01-08 21:52:01 -08001199void CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001200}
1201
Jesse Hall3fbc8562015-11-29 22:10:52 -08001202void CmdBeginQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001203}
1204
Jesse Hall3fbc8562015-11-29 22:10:52 -08001205void CmdEndQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001206}
1207
Jesse Hall3fbc8562015-11-29 22:10:52 -08001208void CmdResetQueryPool(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001209}
1210
Jesse Hall3fbc8562015-11-29 22:10:52 -08001211void CmdWriteTimestamp(VkCommandBuffer cmdBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001212}
1213
Jesse Hall3fbc8562015-11-29 22:10:52 -08001214void CmdCopyQueryPoolResults(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize destStride, VkQueryResultFlags flags) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001215}
1216
Jesse Hall3fbc8562015-11-29 22:10:52 -08001217void CmdPushConstants(VkCommandBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001218}
1219
Jesse Hall65ab5522015-11-30 00:07:16 -08001220void CmdBeginRenderPass(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001221}
1222
Jesse Hall65ab5522015-11-30 00:07:16 -08001223void CmdNextSubpass(VkCommandBuffer cmdBuffer, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001224}
1225
Jesse Hall3fbc8562015-11-29 22:10:52 -08001226void CmdEndRenderPass(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001227}
1228
Jesse Hall3fbc8562015-11-29 22:10:52 -08001229void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001230}
1231
Jesse Hall715b86a2016-01-16 16:34:29 -08001232void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator) {
1233}
1234
1235void DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage) {
1236}
1237
Jesse Hall04f4f472015-08-16 19:51:04 -07001238#pragma clang diagnostic pop
1239// clang-format on
1240
1241} // namespace null_driver