blob: e2d5c83d7845a0b16d54681b050bf21445f8d831 [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
Dan Albert09dc47b2017-10-12 13:27:37 -070019#include <errno.h>
Jesse Hall715b86a2016-01-16 16:34:29 -080020#include <inttypes.h>
Jesse Halld3b14502016-04-20 16:58:11 -070021#include <stdlib.h>
Jesse Hall715b86a2016-01-16 16:34:29 -080022#include <string.h>
Steven Moreland54409a32017-07-17 11:49:21 -070023#include <unistd.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070024
Mark Salyzyna5e161b2016-09-29 08:08:05 -070025#include <algorithm>
26#include <array>
27
Mark Salyzyn7823e122016-09-29 08:08:05 -070028#include <log/log.h>
Jesse Hall04f4f472015-08-16 19:51:04 -070029
Jesse Hall1f91d392015-12-11 16:28:44 -080030#include "null_driver_gen.h"
Jesse Hall04f4f472015-08-16 19:51:04 -070031
32using namespace null_driver;
33
34struct VkPhysicalDevice_T {
35 hwvulkan_dispatch_t dispatch;
36};
37
38struct VkInstance_T {
39 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -080040 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -070041 VkPhysicalDevice_T physical_device;
Jesse Hall715b86a2016-01-16 16:34:29 -080042 uint64_t next_callback_handle;
Jesse Hall04f4f472015-08-16 19:51:04 -070043};
44
45struct VkQueue_T {
46 hwvulkan_dispatch_t dispatch;
47};
48
Jesse Hall3fbc8562015-11-29 22:10:52 -080049struct VkCommandBuffer_T {
Jesse Hall04f4f472015-08-16 19:51:04 -070050 hwvulkan_dispatch_t dispatch;
51};
52
Jesse Hallf8faf0c2015-08-31 11:34:32 -070053namespace {
54// Handles for non-dispatchable objects are either pointers, or arbitrary
55// 64-bit non-zero values. We only use pointers when we need to keep state for
56// the object even in a null driver. For the rest, we form a handle as:
57// [63:63] = 1 to distinguish from pointer handles*
58// [62:56] = non-zero handle type enum value
59// [55: 0] = per-handle-type incrementing counter
60// * This works because virtual addresses with the high bit set are reserved
61// for kernel data in all ABIs we run on.
62//
63// We never reclaim handles on vkDestroy*. It's not even necessary for us to
64// have distinct handles for live objects, and practically speaking we won't
65// ever create 2^56 objects of the same type from a single VkDevice in a null
66// driver.
67//
68// Using a namespace here instead of 'enum class' since we want scoped
69// constants but also want implicit conversions to integral types.
70namespace HandleType {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070071enum Enum {
Jesse Hallc7a6eb52015-08-31 12:52:03 -070072 kBufferView,
Jesse Hall715b86a2016-01-16 16:34:29 -080073 kDebugReportCallbackEXT,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070074 kDescriptorPool,
75 kDescriptorSet,
76 kDescriptorSetLayout,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070077 kEvent,
78 kFence,
79 kFramebuffer,
80 kImageView,
81 kPipeline,
82 kPipelineCache,
83 kPipelineLayout,
84 kQueryPool,
85 kRenderPass,
86 kSampler,
87 kSemaphore,
Jesse Hallc7a6eb52015-08-31 12:52:03 -070088 kShaderModule,
Jesse Hallf8faf0c2015-08-31 11:34:32 -070089
Jesse Hallc7a6eb52015-08-31 12:52:03 -070090 kNumTypes
91};
92} // namespace HandleType
Jesse Hallbde8ee32015-09-01 16:24:29 -070093
Jesse Hall00f10fe2016-02-08 21:20:20 -080094const VkDeviceSize kMaxDeviceMemory = 0x10000000; // 256 MiB, arbitrary
Jesse Hallbde8ee32015-09-01 16:24:29 -070095
Jesse Hallc7a6eb52015-08-31 12:52:03 -070096} // anonymous namespace
Jesse Hallf8faf0c2015-08-31 11:34:32 -070097
Jesse Hall04f4f472015-08-16 19:51:04 -070098struct VkDevice_T {
99 hwvulkan_dispatch_t dispatch;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800100 VkAllocationCallbacks allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700101 VkInstance_T* instance;
102 VkQueue_T queue;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700103 std::array<uint64_t, HandleType::kNumTypes> next_handle;
Jesse Hall04f4f472015-08-16 19:51:04 -0700104};
105
106// -----------------------------------------------------------------------------
107// Declare HAL_MODULE_INFO_SYM early so it can be referenced by nulldrv_device
108// later.
109
110namespace {
111int OpenDevice(const hw_module_t* module, const char* id, hw_device_t** device);
112hw_module_methods_t nulldrv_module_methods = {.open = OpenDevice};
113} // namespace
114
115#pragma clang diagnostic push
116#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
117__attribute__((visibility("default"))) hwvulkan_module_t HAL_MODULE_INFO_SYM = {
118 .common =
119 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500120 .tag = HARDWARE_MODULE_TAG,
121 .module_api_version = HWVULKAN_MODULE_API_VERSION_0_1,
122 .hal_api_version = HARDWARE_HAL_API_VERSION,
123 .id = HWVULKAN_HARDWARE_MODULE_ID,
124 .name = "Null Vulkan Driver",
125 .author = "The Android Open Source Project",
126 .methods = &nulldrv_module_methods,
Jesse Hall04f4f472015-08-16 19:51:04 -0700127 },
128};
129#pragma clang diagnostic pop
130
131// -----------------------------------------------------------------------------
132
133namespace {
134
Jesse Hall04f4f472015-08-16 19:51:04 -0700135int CloseDevice(struct hw_device_t* /*device*/) {
136 // nothing to do - opening a device doesn't allocate any resources
137 return 0;
138}
139
140hwvulkan_device_t nulldrv_device = {
141 .common =
142 {
Michael Lentine03c64b02015-08-26 18:27:26 -0500143 .tag = HARDWARE_DEVICE_TAG,
144 .version = HWVULKAN_DEVICE_API_VERSION_0_1,
145 .module = &HAL_MODULE_INFO_SYM.common,
146 .close = CloseDevice,
Jesse Hall04f4f472015-08-16 19:51:04 -0700147 },
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700148 .EnumerateInstanceExtensionProperties =
149 EnumerateInstanceExtensionProperties,
Jesse Hall04f4f472015-08-16 19:51:04 -0700150 .CreateInstance = CreateInstance,
151 .GetInstanceProcAddr = GetInstanceProcAddr};
152
153int OpenDevice(const hw_module_t* /*module*/,
154 const char* id,
155 hw_device_t** device) {
156 if (strcmp(id, HWVULKAN_DEVICE_0) == 0) {
157 *device = &nulldrv_device.common;
158 return 0;
159 }
160 return -ENOENT;
161}
162
163VkInstance_T* GetInstanceFromPhysicalDevice(
164 VkPhysicalDevice_T* physical_device) {
165 return reinterpret_cast<VkInstance_T*>(
166 reinterpret_cast<uintptr_t>(physical_device) -
167 offsetof(VkInstance_T, physical_device));
168}
169
Jesse Hall715b86a2016-01-16 16:34:29 -0800170uint64_t AllocHandle(uint64_t type, uint64_t* next_handle) {
171 const uint64_t kHandleMask = (UINT64_C(1) << 56) - 1;
172 ALOGE_IF(*next_handle == kHandleMask,
173 "non-dispatchable handles of type=%" PRIu64
174 " are about to overflow",
175 type);
176 return (UINT64_C(1) << 63) | ((type & 0x7) << 56) |
177 ((*next_handle)++ & kHandleMask);
178}
179
180template <class Handle>
181Handle AllocHandle(VkInstance instance, HandleType::Enum type) {
182 return reinterpret_cast<Handle>(
183 AllocHandle(type, &instance->next_callback_handle));
184}
185
Michael Lentine3fec89e2015-12-04 16:25:11 -0800186template <class Handle>
187Handle AllocHandle(VkDevice device, HandleType::Enum type) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800188 return reinterpret_cast<Handle>(
Jesse Hall715b86a2016-01-16 16:34:29 -0800189 AllocHandle(type, &device->next_handle[type]));
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700190}
191
Jesse Halld3b14502016-04-20 16:58:11 -0700192VKAPI_ATTR void* DefaultAllocate(void*,
193 size_t size,
194 size_t alignment,
195 VkSystemAllocationScope) {
196 void* ptr = nullptr;
197 // Vulkan requires 'alignment' to be a power of two, but posix_memalign
198 // additionally requires that it be at least sizeof(void*).
199 int ret = posix_memalign(&ptr, std::max(alignment, sizeof(void*)), size);
200 return ret == 0 ? ptr : nullptr;
201}
202
203VKAPI_ATTR void* DefaultReallocate(void*,
204 void* ptr,
205 size_t size,
206 size_t alignment,
207 VkSystemAllocationScope) {
208 if (size == 0) {
209 free(ptr);
210 return nullptr;
211 }
212
213 // TODO(jessehall): Right now we never shrink allocations; if the new
214 // request is smaller than the existing chunk, we just continue using it.
215 // The null driver never reallocs, so this doesn't matter. If that changes,
216 // or if this code is copied into some other project, this should probably
217 // have a heuristic to allocate-copy-free when doing so will save "enough"
218 // space.
219 size_t old_size = ptr ? malloc_usable_size(ptr) : 0;
220 if (size <= old_size)
221 return ptr;
222
223 void* new_ptr = nullptr;
224 if (posix_memalign(&new_ptr, std::max(alignment, sizeof(void*)), size) != 0)
225 return nullptr;
226 if (ptr) {
227 memcpy(new_ptr, ptr, std::min(old_size, size));
228 free(ptr);
229 }
230 return new_ptr;
231}
232
233VKAPI_ATTR void DefaultFree(void*, void* ptr) {
234 free(ptr);
235}
236
237const VkAllocationCallbacks kDefaultAllocCallbacks = {
238 .pUserData = nullptr,
239 .pfnAllocation = DefaultAllocate,
240 .pfnReallocation = DefaultReallocate,
241 .pfnFree = DefaultFree,
242};
243
Jesse Hall04f4f472015-08-16 19:51:04 -0700244} // namespace
245
246namespace null_driver {
247
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800248#define DEFINE_OBJECT_HANDLE_CONVERSION(T) \
249 T* Get##T##FromHandle(Vk##T h); \
250 T* Get##T##FromHandle(Vk##T h) { \
251 return reinterpret_cast<T*>(uintptr_t(h)); \
252 } \
253 Vk##T GetHandleTo##T(const T* obj); \
254 Vk##T GetHandleTo##T(const T* obj) { \
255 return Vk##T(reinterpret_cast<uintptr_t>(obj)); \
256 }
Jesse Hallf6578742015-08-29 17:06:12 +0100257
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100258// -----------------------------------------------------------------------------
259// Global
260
Jesse Halle1b12782015-11-30 11:27:32 -0800261VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800262VkResult EnumerateInstanceExtensionProperties(
263 const char* layer_name,
264 uint32_t* count,
265 VkExtensionProperties* properties) {
266 if (layer_name) {
267 ALOGW(
268 "Driver vkEnumerateInstanceExtensionProperties shouldn't be called "
269 "with a layer name ('%s')",
270 layer_name);
Jesse Hall715b86a2016-01-16 16:34:29 -0800271 }
272
273 const VkExtensionProperties kExtensions[] = {
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300274 {VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION}};
Jesse Hall715b86a2016-01-16 16:34:29 -0800275 const uint32_t kExtensionsCount =
276 sizeof(kExtensions) / sizeof(kExtensions[0]);
277
278 if (!properties || *count > kExtensionsCount)
279 *count = kExtensionsCount;
280 if (properties)
281 std::copy(kExtensions, kExtensions + *count, properties);
282 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100283}
284
Jesse Halle1b12782015-11-30 11:27:32 -0800285VKAPI_ATTR
Jesse Hall715b86a2016-01-16 16:34:29 -0800286VkResult CreateInstance(const VkInstanceCreateInfo* create_info,
Jesse Hall1f91d392015-12-11 16:28:44 -0800287 const VkAllocationCallbacks* allocator,
288 VkInstance* out_instance) {
Jesse Halld3b14502016-04-20 16:58:11 -0700289 if (!allocator)
290 allocator = &kDefaultAllocCallbacks;
Jesse Hall1f91d392015-12-11 16:28:44 -0800291
292 VkInstance_T* instance =
293 static_cast<VkInstance_T*>(allocator->pfnAllocation(
294 allocator->pUserData, sizeof(VkInstance_T), alignof(VkInstance_T),
295 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE));
296 if (!instance)
297 return VK_ERROR_OUT_OF_HOST_MEMORY;
298
299 instance->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
300 instance->allocator = *allocator;
301 instance->physical_device.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall715b86a2016-01-16 16:34:29 -0800302 instance->next_callback_handle = 0;
Jesse Hall715b86a2016-01-16 16:34:29 -0800303
304 for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
305 if (strcmp(create_info->ppEnabledExtensionNames[i],
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300306 VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME) == 0) {
307 ALOGV("instance extension '%s' requested",
308 create_info->ppEnabledExtensionNames[i]);
309 } else if (strcmp(create_info->ppEnabledExtensionNames[i],
Jesse Hall715b86a2016-01-16 16:34:29 -0800310 VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) {
Jesse Hallb1471272016-01-17 21:36:58 -0800311 ALOGV("instance extension '%s' requested",
312 create_info->ppEnabledExtensionNames[i]);
313 } else {
314 ALOGW("unsupported extension '%s' requested",
315 create_info->ppEnabledExtensionNames[i]);
Jesse Hall715b86a2016-01-16 16:34:29 -0800316 }
317 }
Jesse Hall1f91d392015-12-11 16:28:44 -0800318
319 *out_instance = instance;
320 return VK_SUCCESS;
321}
322
323VKAPI_ATTR
324PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* name) {
325 return instance ? GetInstanceProcAddr(name) : GetGlobalProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700326}
327
Jesse Halle1b12782015-11-30 11:27:32 -0800328VKAPI_ATTR
Jesse Hall04f4f472015-08-16 19:51:04 -0700329PFN_vkVoidFunction GetDeviceProcAddr(VkDevice, const char* name) {
Jesse Hall1f91d392015-12-11 16:28:44 -0800330 return GetInstanceProcAddr(name);
Jesse Hall04f4f472015-08-16 19:51:04 -0700331}
332
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100333// -----------------------------------------------------------------------------
334// Instance
335
Jesse Hall03b6fe12015-11-24 12:44:21 -0800336void DestroyInstance(VkInstance instance,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800337 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800338 instance->allocator.pfnFree(instance->allocator.pUserData, instance);
Jesse Hall04f4f472015-08-16 19:51:04 -0700339}
340
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100341// -----------------------------------------------------------------------------
342// PhysicalDevice
343
Jesse Hall04f4f472015-08-16 19:51:04 -0700344VkResult EnumeratePhysicalDevices(VkInstance instance,
345 uint32_t* physical_device_count,
346 VkPhysicalDevice* physical_devices) {
Ian Elliott3fe21f62017-10-20 10:41:01 -0600347 if (!physical_devices)
348 *physical_device_count = 1;
349 else if (*physical_device_count == 0)
350 return VK_INCOMPLETE;
351 else {
Jesse Hall04f4f472015-08-16 19:51:04 -0700352 physical_devices[0] = &instance->physical_device;
Ian Elliott3fe21f62017-10-20 10:41:01 -0600353 *physical_device_count = 1;
354 }
Jesse Hall04f4f472015-08-16 19:51:04 -0700355 return VK_SUCCESS;
356}
357
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800358VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice /*gpu*/,
359 uint32_t* count,
360 VkLayerProperties* /*properties*/) {
361 ALOGW("Driver vkEnumerateDeviceLayerProperties shouldn't be called");
362 *count = 0;
363 return VK_SUCCESS;
364}
365
366VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice /*gpu*/,
367 const char* layer_name,
368 uint32_t* count,
369 VkExtensionProperties* properties) {
370 if (layer_name) {
371 ALOGW(
372 "Driver vkEnumerateDeviceExtensionProperties shouldn't be called "
373 "with a layer name ('%s')",
374 layer_name);
375 *count = 0;
376 return VK_SUCCESS;
377 }
378
379 const VkExtensionProperties kExtensions[] = {
380 {VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME,
381 VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION}};
382 const uint32_t kExtensionsCount =
383 sizeof(kExtensions) / sizeof(kExtensions[0]);
384
385 if (!properties || *count > kExtensionsCount)
386 *count = kExtensionsCount;
387 if (properties)
388 std::copy(kExtensions, kExtensions + *count, properties);
389 return *count < kExtensionsCount ? VK_INCOMPLETE : VK_SUCCESS;
390}
391
Jesse Hall606a54e2015-11-19 22:17:28 -0800392void GetPhysicalDeviceProperties(VkPhysicalDevice,
393 VkPhysicalDeviceProperties* properties) {
Jesse Hall26763382016-05-20 07:13:52 -0700394 properties->apiVersion = VK_MAKE_VERSION(1, 0, VK_HEADER_VERSION);
Jesse Hall04f4f472015-08-16 19:51:04 -0700395 properties->driverVersion = VK_MAKE_VERSION(0, 0, 1);
Jesse Hall65ab5522015-11-30 00:07:16 -0800396 properties->vendorID = 0;
397 properties->deviceID = 0;
Jesse Hall04f4f472015-08-16 19:51:04 -0700398 properties->deviceType = VK_PHYSICAL_DEVICE_TYPE_OTHER;
399 strcpy(properties->deviceName, "Android Vulkan Null Driver");
400 memset(properties->pipelineCacheUUID, 0,
401 sizeof(properties->pipelineCacheUUID));
Jesse Hallc34849e2016-02-09 22:35:04 -0800402 properties->limits = VkPhysicalDeviceLimits{
403 4096, // maxImageDimension1D
404 4096, // maxImageDimension2D
405 256, // maxImageDimension3D
406 4096, // maxImageDimensionCube
407 256, // maxImageArrayLayers
408 65536, // maxTexelBufferElements
409 16384, // maxUniformBufferRange
410 1 << 27, // maxStorageBufferRange
411 128, // maxPushConstantsSize
412 4096, // maxMemoryAllocationCount
413 4000, // maxSamplerAllocationCount
414 1, // bufferImageGranularity
415 0, // sparseAddressSpaceSize
416 4, // maxBoundDescriptorSets
417 16, // maxPerStageDescriptorSamplers
418 12, // maxPerStageDescriptorUniformBuffers
419 4, // maxPerStageDescriptorStorageBuffers
420 16, // maxPerStageDescriptorSampledImages
421 4, // maxPerStageDescriptorStorageImages
422 4, // maxPerStageDescriptorInputAttachments
423 128, // maxPerStageResources
424 96, // maxDescriptorSetSamplers
425 72, // maxDescriptorSetUniformBuffers
426 8, // maxDescriptorSetUniformBuffersDynamic
427 24, // maxDescriptorSetStorageBuffers
428 4, // maxDescriptorSetStorageBuffersDynamic
429 96, // maxDescriptorSetSampledImages
430 24, // maxDescriptorSetStorageImages
431 4, // maxDescriptorSetInputAttachments
432 16, // maxVertexInputAttributes
433 16, // maxVertexInputBindings
434 2047, // maxVertexInputAttributeOffset
435 2048, // maxVertexInputBindingStride
436 64, // maxVertexOutputComponents
437 0, // maxTessellationGenerationLevel
438 0, // maxTessellationPatchSize
439 0, // maxTessellationControlPerVertexInputComponents
440 0, // maxTessellationControlPerVertexOutputComponents
441 0, // maxTessellationControlPerPatchOutputComponents
442 0, // maxTessellationControlTotalOutputComponents
443 0, // maxTessellationEvaluationInputComponents
444 0, // maxTessellationEvaluationOutputComponents
445 0, // maxGeometryShaderInvocations
446 0, // maxGeometryInputComponents
447 0, // maxGeometryOutputComponents
448 0, // maxGeometryOutputVertices
449 0, // maxGeometryTotalOutputComponents
450 64, // maxFragmentInputComponents
451 4, // maxFragmentOutputAttachments
452 0, // maxFragmentDualSrcAttachments
453 4, // maxFragmentCombinedOutputResources
454 16384, // maxComputeSharedMemorySize
455 {65536, 65536, 65536}, // maxComputeWorkGroupCount[3]
456 128, // maxComputeWorkGroupInvocations
457 {128, 128, 64}, // maxComputeWorkGroupSize[3]
458 4, // subPixelPrecisionBits
459 4, // subTexelPrecisionBits
460 4, // mipmapPrecisionBits
461 UINT32_MAX, // maxDrawIndexedIndexValue
462 1, // maxDrawIndirectCount
463 2, // maxSamplerLodBias
464 1, // maxSamplerAnisotropy
465 1, // maxViewports
466 {4096, 4096}, // maxViewportDimensions[2]
467 {-8192.0f, 8191.0f}, // viewportBoundsRange[2]
468 0, // viewportSubPixelBits
469 64, // minMemoryMapAlignment
470 256, // minTexelBufferOffsetAlignment
471 256, // minUniformBufferOffsetAlignment
472 256, // minStorageBufferOffsetAlignment
473 -8, // minTexelOffset
474 7, // maxTexelOffset
475 0, // minTexelGatherOffset
476 0, // maxTexelGatherOffset
477 0.0f, // minInterpolationOffset
478 0.0f, // maxInterpolationOffset
479 0, // subPixelInterpolationOffsetBits
480 4096, // maxFramebufferWidth
481 4096, // maxFramebufferHeight
482 256, // maxFramebufferLayers
483 VK_SAMPLE_COUNT_1_BIT |
484 VK_SAMPLE_COUNT_4_BIT, // framebufferColorSampleCounts
485 VK_SAMPLE_COUNT_1_BIT |
486 VK_SAMPLE_COUNT_4_BIT, // framebufferDepthSampleCounts
487 VK_SAMPLE_COUNT_1_BIT |
488 VK_SAMPLE_COUNT_4_BIT, // framebufferStencilSampleCounts
489 VK_SAMPLE_COUNT_1_BIT |
490 VK_SAMPLE_COUNT_4_BIT, // framebufferNoAttachmentsSampleCounts
491 4, // maxColorAttachments
492 VK_SAMPLE_COUNT_1_BIT |
493 VK_SAMPLE_COUNT_4_BIT, // sampledImageColorSampleCounts
494 VK_SAMPLE_COUNT_1_BIT, // sampledImageIntegerSampleCounts
495 VK_SAMPLE_COUNT_1_BIT |
496 VK_SAMPLE_COUNT_4_BIT, // sampledImageDepthSampleCounts
497 VK_SAMPLE_COUNT_1_BIT |
498 VK_SAMPLE_COUNT_4_BIT, // sampledImageStencilSampleCounts
499 VK_SAMPLE_COUNT_1_BIT, // storageImageSampleCounts
500 1, // maxSampleMaskWords
501 VK_TRUE, // timestampComputeAndGraphics
502 1, // timestampPeriod
503 0, // maxClipDistances
504 0, // maxCullDistances
505 0, // maxCombinedClipAndCullDistances
506 2, // discreteQueuePriorities
507 {1.0f, 1.0f}, // pointSizeRange[2]
508 {1.0f, 1.0f}, // lineWidthRange[2]
509 0.0f, // pointSizeGranularity
510 0.0f, // lineWidthGranularity
511 VK_TRUE, // strictLines
512 VK_TRUE, // standardSampleLocations
513 1, // optimalBufferCopyOffsetAlignment
514 1, // optimalBufferCopyRowPitchAlignment
515 64, // nonCoherentAtomSize
516 };
Jesse Hall04f4f472015-08-16 19:51:04 -0700517}
518
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300519void GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physical_device,
520 VkPhysicalDeviceProperties2KHR* properties) {
521 GetPhysicalDeviceProperties(physical_device, &properties->properties);
Chris Forbesb4eb2782017-03-15 16:09:15 +1300522
523 while (properties->pNext) {
524 properties = reinterpret_cast<VkPhysicalDeviceProperties2KHR *>(properties->pNext);
525
526#pragma clang diagnostic push
527#pragma clang diagnostic ignored "-Wold-style-cast"
528 switch ((VkFlags)properties->sType) {
529 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID: {
530 VkPhysicalDevicePresentationPropertiesANDROID *presentation_properties =
531 reinterpret_cast<VkPhysicalDevicePresentationPropertiesANDROID *>(properties);
532#pragma clang diagnostic pop
533
534 // Claim that we do all the right things for the loader to
535 // expose KHR_shared_presentable_image on our behalf.
536 presentation_properties->sharedImage = VK_TRUE;
537 } break;
538
539 default:
540 // Silently ignore other extension query structs
541 break;
542 }
543 }
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300544}
545
Jesse Hall606a54e2015-11-19 22:17:28 -0800546void GetPhysicalDeviceQueueFamilyProperties(
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700547 VkPhysicalDevice,
548 uint32_t* count,
549 VkQueueFamilyProperties* properties) {
Jesse Hall715b86a2016-01-16 16:34:29 -0800550 if (!properties || *count > 1)
551 *count = 1;
552 if (properties && *count == 1) {
Jesse Hall65ab5522015-11-30 00:07:16 -0800553 properties->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT |
554 VK_QUEUE_TRANSFER_BIT;
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700555 properties->queueCount = 1;
Jesse Hallacfa5342015-11-19 21:51:33 -0800556 properties->timestampValidBits = 64;
Jesse Hall715b86a2016-01-16 16:34:29 -0800557 properties->minImageTransferGranularity = VkExtent3D{1, 1, 1};
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700558 }
Jesse Hall5ae3abb2015-10-08 14:00:22 -0700559}
560
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300561void GetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physical_device, uint32_t* count, VkQueueFamilyProperties2KHR* properties) {
562 // note: even though multiple structures, this is safe to forward in this
563 // case since we only expose one queue family.
564 GetPhysicalDeviceQueueFamilyProperties(physical_device, count, properties ? &properties->queueFamilyProperties : nullptr);
565}
566
Jesse Hall606a54e2015-11-19 22:17:28 -0800567void GetPhysicalDeviceMemoryProperties(
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100568 VkPhysicalDevice,
569 VkPhysicalDeviceMemoryProperties* properties) {
570 properties->memoryTypeCount = 1;
571 properties->memoryTypes[0].propertyFlags =
Jesse Halld1af8122015-11-29 23:50:38 -0800572 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
573 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
574 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
575 VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100576 properties->memoryTypes[0].heapIndex = 0;
577 properties->memoryHeapCount = 1;
Jesse Hallbde8ee32015-09-01 16:24:29 -0700578 properties->memoryHeaps[0].size = kMaxDeviceMemory;
Jesse Halld1af8122015-11-29 23:50:38 -0800579 properties->memoryHeaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
Jesse Hall04f4f472015-08-16 19:51:04 -0700580}
581
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300582void GetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceMemoryProperties2KHR* properties) {
583 GetPhysicalDeviceMemoryProperties(physical_device, &properties->memoryProperties);
584}
585
Jesse Hall8e37cf32016-01-18 04:00:57 -0800586void GetPhysicalDeviceFeatures(VkPhysicalDevice /*gpu*/,
587 VkPhysicalDeviceFeatures* features) {
588 *features = VkPhysicalDeviceFeatures{
589 VK_TRUE, // robustBufferAccess
590 VK_FALSE, // fullDrawIndexUint32
591 VK_FALSE, // imageCubeArray
592 VK_FALSE, // independentBlend
593 VK_FALSE, // geometryShader
594 VK_FALSE, // tessellationShader
595 VK_FALSE, // sampleRateShading
596 VK_FALSE, // dualSrcBlend
597 VK_FALSE, // logicOp
598 VK_FALSE, // multiDrawIndirect
599 VK_FALSE, // drawIndirectFirstInstance
600 VK_FALSE, // depthClamp
601 VK_FALSE, // depthBiasClamp
602 VK_FALSE, // fillModeNonSolid
603 VK_FALSE, // depthBounds
604 VK_FALSE, // wideLines
605 VK_FALSE, // largePoints
606 VK_FALSE, // alphaToOne
607 VK_FALSE, // multiViewport
608 VK_FALSE, // samplerAnisotropy
609 VK_FALSE, // textureCompressionETC2
610 VK_FALSE, // textureCompressionASTC_LDR
611 VK_FALSE, // textureCompressionBC
612 VK_FALSE, // occlusionQueryPrecise
613 VK_FALSE, // pipelineStatisticsQuery
614 VK_FALSE, // vertexPipelineStoresAndAtomics
615 VK_FALSE, // fragmentStoresAndAtomics
616 VK_FALSE, // shaderTessellationAndGeometryPointSize
617 VK_FALSE, // shaderImageGatherExtended
618 VK_FALSE, // shaderStorageImageExtendedFormats
619 VK_FALSE, // shaderStorageImageMultisample
620 VK_FALSE, // shaderStorageImageReadWithoutFormat
621 VK_FALSE, // shaderStorageImageWriteWithoutFormat
622 VK_FALSE, // shaderUniformBufferArrayDynamicIndexing
623 VK_FALSE, // shaderSampledImageArrayDynamicIndexing
624 VK_FALSE, // shaderStorageBufferArrayDynamicIndexing
625 VK_FALSE, // shaderStorageImageArrayDynamicIndexing
626 VK_FALSE, // shaderClipDistance
627 VK_FALSE, // shaderCullDistance
628 VK_FALSE, // shaderFloat64
629 VK_FALSE, // shaderInt64
630 VK_FALSE, // shaderInt16
631 VK_FALSE, // shaderResourceResidency
632 VK_FALSE, // shaderResourceMinLod
633 VK_FALSE, // sparseBinding
634 VK_FALSE, // sparseResidencyBuffer
635 VK_FALSE, // sparseResidencyImage2D
636 VK_FALSE, // sparseResidencyImage3D
637 VK_FALSE, // sparseResidency2Samples
638 VK_FALSE, // sparseResidency4Samples
639 VK_FALSE, // sparseResidency8Samples
640 VK_FALSE, // sparseResidency16Samples
641 VK_FALSE, // sparseResidencyAliased
642 VK_FALSE, // variableMultisampleRate
643 VK_FALSE, // inheritedQueries
644 };
645}
646
Chris Forbes86bdfbe2017-01-26 12:45:49 +1300647void GetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physical_device, VkPhysicalDeviceFeatures2KHR* features) {
648 GetPhysicalDeviceFeatures(physical_device, &features->features);
649}
650
Jesse Hall73ab0ac2015-08-25 15:09:15 +0100651// -----------------------------------------------------------------------------
652// Device
653
Jesse Hall04f4f472015-08-16 19:51:04 -0700654VkResult CreateDevice(VkPhysicalDevice physical_device,
Jesse Hallb1471272016-01-17 21:36:58 -0800655 const VkDeviceCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800656 const VkAllocationCallbacks* allocator,
Jesse Hall04f4f472015-08-16 19:51:04 -0700657 VkDevice* out_device) {
658 VkInstance_T* instance = GetInstanceFromPhysicalDevice(physical_device);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800659 if (!allocator)
660 allocator = &instance->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800661 VkDevice_T* device = static_cast<VkDevice_T*>(allocator->pfnAllocation(
662 allocator->pUserData, sizeof(VkDevice_T), alignof(VkDevice_T),
663 VK_SYSTEM_ALLOCATION_SCOPE_DEVICE));
Jesse Hall04f4f472015-08-16 19:51:04 -0700664 if (!device)
665 return VK_ERROR_OUT_OF_HOST_MEMORY;
666
667 device->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800668 device->allocator = *allocator;
Jesse Hall04f4f472015-08-16 19:51:04 -0700669 device->instance = instance;
670 device->queue.dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700671 std::fill(device->next_handle.begin(), device->next_handle.end(),
672 UINT64_C(0));
Jesse Hall04f4f472015-08-16 19:51:04 -0700673
Jesse Hallb1471272016-01-17 21:36:58 -0800674 for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) {
675 if (strcmp(create_info->ppEnabledExtensionNames[i],
676 VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME) == 0) {
677 ALOGV("Enabling " VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME);
678 }
679 }
680
Jesse Hall04f4f472015-08-16 19:51:04 -0700681 *out_device = device;
682 return VK_SUCCESS;
683}
684
Jesse Hall3fbc8562015-11-29 22:10:52 -0800685void DestroyDevice(VkDevice device,
686 const VkAllocationCallbacks* /*allocator*/) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700687 if (!device)
Jesse Hallcf25c412015-10-29 17:14:50 -0700688 return;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800689 device->allocator.pfnFree(device->allocator.pUserData, device);
Jesse Hall04f4f472015-08-16 19:51:04 -0700690}
691
Jesse Hall606a54e2015-11-19 22:17:28 -0800692void GetDeviceQueue(VkDevice device, uint32_t, uint32_t, VkQueue* queue) {
Jesse Hall04f4f472015-08-16 19:51:04 -0700693 *queue = &device->queue;
Jesse Hall04f4f472015-08-16 19:51:04 -0700694}
695
696// -----------------------------------------------------------------------------
Jesse Hall3fbc8562015-11-29 22:10:52 -0800697// CommandPool
Jesse Hall03b6fe12015-11-24 12:44:21 -0800698
Jesse Hall3fbc8562015-11-29 22:10:52 -0800699struct CommandPool {
700 typedef VkCommandPool HandleType;
701 VkAllocationCallbacks allocator;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800702};
Jesse Hall3fbc8562015-11-29 22:10:52 -0800703DEFINE_OBJECT_HANDLE_CONVERSION(CommandPool)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800704
705VkResult CreateCommandPool(VkDevice device,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800706 const VkCommandPoolCreateInfo* /*create_info*/,
707 const VkAllocationCallbacks* allocator,
708 VkCommandPool* cmd_pool) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800709 if (!allocator)
710 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800711 CommandPool* pool = static_cast<CommandPool*>(allocator->pfnAllocation(
712 allocator->pUserData, sizeof(CommandPool), alignof(CommandPool),
713 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall03b6fe12015-11-24 12:44:21 -0800714 if (!pool)
715 return VK_ERROR_OUT_OF_HOST_MEMORY;
716 pool->allocator = *allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800717 *cmd_pool = GetHandleToCommandPool(pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800718 return VK_SUCCESS;
719}
720
721void DestroyCommandPool(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800722 VkCommandPool cmd_pool,
723 const VkAllocationCallbacks* /*allocator*/) {
724 CommandPool* pool = GetCommandPoolFromHandle(cmd_pool);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800725 pool->allocator.pfnFree(pool->allocator.pUserData, pool);
726}
727
728// -----------------------------------------------------------------------------
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700729// CmdBuffer
730
Jesse Hall3fbc8562015-11-29 22:10:52 -0800731VkResult AllocateCommandBuffers(VkDevice /*device*/,
732 const VkCommandBufferAllocateInfo* alloc_info,
733 VkCommandBuffer* cmdbufs) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800734 VkResult result = VK_SUCCESS;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800735 CommandPool& pool = *GetCommandPoolFromHandle(alloc_info->commandPool);
Jesse Hall3dd678a2016-01-08 21:52:01 -0800736 std::fill(cmdbufs, cmdbufs + alloc_info->commandBufferCount, nullptr);
737 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hall3fbc8562015-11-29 22:10:52 -0800738 cmdbufs[i] =
739 static_cast<VkCommandBuffer_T*>(pool.allocator.pfnAllocation(
740 pool.allocator.pUserData, sizeof(VkCommandBuffer_T),
741 alignof(VkCommandBuffer_T), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallfbf97b02015-11-20 14:17:03 -0800742 if (!cmdbufs[i]) {
743 result = VK_ERROR_OUT_OF_HOST_MEMORY;
744 break;
745 }
746 cmdbufs[i]->dispatch.magic = HWVULKAN_DISPATCH_MAGIC;
747 }
748 if (result != VK_SUCCESS) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800749 for (uint32_t i = 0; i < alloc_info->commandBufferCount; i++) {
Jesse Hallfbf97b02015-11-20 14:17:03 -0800750 if (!cmdbufs[i])
751 break;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800752 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800753 }
754 }
Jesse Hallfbf97b02015-11-20 14:17:03 -0800755 return result;
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700756}
757
Jesse Hall03b6fe12015-11-24 12:44:21 -0800758void FreeCommandBuffers(VkDevice /*device*/,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800759 VkCommandPool cmd_pool,
Jesse Hallfbf97b02015-11-20 14:17:03 -0800760 uint32_t count,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800761 const VkCommandBuffer* cmdbufs) {
762 CommandPool& pool = *GetCommandPoolFromHandle(cmd_pool);
Jesse Hallfbf97b02015-11-20 14:17:03 -0800763 for (uint32_t i = 0; i < count; i++)
Jesse Hall03b6fe12015-11-24 12:44:21 -0800764 pool.allocator.pfnFree(pool.allocator.pUserData, cmdbufs[i]);
Jesse Hallc7a6eb52015-08-31 12:52:03 -0700765}
766
767// -----------------------------------------------------------------------------
Jesse Hall2077ce02015-08-29 18:10:59 +0100768// DeviceMemory
769
770struct DeviceMemory {
771 typedef VkDeviceMemory HandleType;
772 VkDeviceSize size;
773 alignas(16) uint8_t data[0];
774};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800775DEFINE_OBJECT_HANDLE_CONVERSION(DeviceMemory)
Jesse Hall2077ce02015-08-29 18:10:59 +0100776
Jesse Hall3fbc8562015-11-29 22:10:52 -0800777VkResult AllocateMemory(VkDevice device,
778 const VkMemoryAllocateInfo* alloc_info,
779 const VkAllocationCallbacks* allocator,
780 VkDeviceMemory* mem_handle) {
Jesse Hall2077ce02015-08-29 18:10:59 +0100781 if (SIZE_MAX - sizeof(DeviceMemory) <= alloc_info->allocationSize)
782 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall03b6fe12015-11-24 12:44:21 -0800783 if (!allocator)
784 allocator = &device->allocator;
Jesse Hall2077ce02015-08-29 18:10:59 +0100785
Jesse Hall2077ce02015-08-29 18:10:59 +0100786 size_t size = sizeof(DeviceMemory) + size_t(alloc_info->allocationSize);
Jesse Hall3fbc8562015-11-29 22:10:52 -0800787 DeviceMemory* mem = static_cast<DeviceMemory*>(allocator->pfnAllocation(
788 allocator->pUserData, size, alignof(DeviceMemory),
789 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall2077ce02015-08-29 18:10:59 +0100790 if (!mem)
791 return VK_ERROR_OUT_OF_HOST_MEMORY;
792 mem->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800793 *mem_handle = GetHandleToDeviceMemory(mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100794 return VK_SUCCESS;
795}
796
Jesse Hall03b6fe12015-11-24 12:44:21 -0800797void FreeMemory(VkDevice device,
798 VkDeviceMemory mem_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800799 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800800 if (!allocator)
801 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800802 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800803 allocator->pfnFree(allocator->pUserData, mem);
Jesse Hall2077ce02015-08-29 18:10:59 +0100804}
805
806VkResult MapMemory(VkDevice,
807 VkDeviceMemory mem_handle,
808 VkDeviceSize offset,
809 VkDeviceSize,
810 VkMemoryMapFlags,
811 void** out_ptr) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800812 DeviceMemory* mem = GetDeviceMemoryFromHandle(mem_handle);
Jesse Hall2077ce02015-08-29 18:10:59 +0100813 *out_ptr = &mem->data[0] + offset;
814 return VK_SUCCESS;
815}
816
817// -----------------------------------------------------------------------------
Jesse Hallf6578742015-08-29 17:06:12 +0100818// Buffer
819
820struct Buffer {
821 typedef VkBuffer HandleType;
822 VkDeviceSize size;
823};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800824DEFINE_OBJECT_HANDLE_CONVERSION(Buffer)
Jesse Hallf6578742015-08-29 17:06:12 +0100825
826VkResult CreateBuffer(VkDevice device,
827 const VkBufferCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800828 const VkAllocationCallbacks* allocator,
Jesse Hallf6578742015-08-29 17:06:12 +0100829 VkBuffer* buffer_handle) {
Jesse Hallbde8ee32015-09-01 16:24:29 -0700830 ALOGW_IF(create_info->size > kMaxDeviceMemory,
831 "CreateBuffer: requested size 0x%" PRIx64
832 " exceeds max device memory size 0x%" PRIx64,
833 create_info->size, kMaxDeviceMemory);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800834 if (!allocator)
835 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800836 Buffer* buffer = static_cast<Buffer*>(allocator->pfnAllocation(
837 allocator->pUserData, sizeof(Buffer), alignof(Buffer),
838 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hallf6578742015-08-29 17:06:12 +0100839 if (!buffer)
840 return VK_ERROR_OUT_OF_HOST_MEMORY;
841 buffer->size = create_info->size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800842 *buffer_handle = GetHandleToBuffer(buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100843 return VK_SUCCESS;
844}
845
Jesse Hall606a54e2015-11-19 22:17:28 -0800846void GetBufferMemoryRequirements(VkDevice,
847 VkBuffer buffer_handle,
848 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800849 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hallf6578742015-08-29 17:06:12 +0100850 requirements->size = buffer->size;
851 requirements->alignment = 16; // allow fast Neon/SSE memcpy
852 requirements->memoryTypeBits = 0x1;
Jesse Hallf6578742015-08-29 17:06:12 +0100853}
854
Jesse Hall03b6fe12015-11-24 12:44:21 -0800855void DestroyBuffer(VkDevice device,
856 VkBuffer buffer_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800857 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800858 if (!allocator)
859 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800860 Buffer* buffer = GetBufferFromHandle(buffer_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800861 allocator->pfnFree(allocator->pUserData, buffer);
Jesse Hallf6578742015-08-29 17:06:12 +0100862}
863
864// -----------------------------------------------------------------------------
Jesse Hall85c05b62015-09-01 18:07:41 -0700865// Image
866
867struct Image {
868 typedef VkImage HandleType;
869 VkDeviceSize size;
870};
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800871DEFINE_OBJECT_HANDLE_CONVERSION(Image)
Jesse Hall85c05b62015-09-01 18:07:41 -0700872
873VkResult CreateImage(VkDevice device,
874 const VkImageCreateInfo* create_info,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800875 const VkAllocationCallbacks* allocator,
Jesse Hall85c05b62015-09-01 18:07:41 -0700876 VkImage* image_handle) {
877 if (create_info->imageType != VK_IMAGE_TYPE_2D ||
878 create_info->format != VK_FORMAT_R8G8B8A8_UNORM ||
879 create_info->mipLevels != 1) {
880 ALOGE("CreateImage: not yet implemented: type=%d format=%d mips=%u",
881 create_info->imageType, create_info->format,
882 create_info->mipLevels);
Jesse Halla15a4bf2015-11-19 22:48:02 -0800883 return VK_ERROR_OUT_OF_HOST_MEMORY;
Jesse Hall85c05b62015-09-01 18:07:41 -0700884 }
885
886 VkDeviceSize size =
887 VkDeviceSize(create_info->extent.width * create_info->extent.height) *
Jesse Halla15a4bf2015-11-19 22:48:02 -0800888 create_info->arrayLayers * create_info->samples * 4u;
Jesse Hall85c05b62015-09-01 18:07:41 -0700889 ALOGW_IF(size > kMaxDeviceMemory,
890 "CreateImage: image size 0x%" PRIx64
891 " exceeds max device memory size 0x%" PRIx64,
892 size, kMaxDeviceMemory);
893
Jesse Hall03b6fe12015-11-24 12:44:21 -0800894 if (!allocator)
895 allocator = &device->allocator;
Jesse Hall3fbc8562015-11-29 22:10:52 -0800896 Image* image = static_cast<Image*>(allocator->pfnAllocation(
897 allocator->pUserData, sizeof(Image), alignof(Image),
898 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
Jesse Hall85c05b62015-09-01 18:07:41 -0700899 if (!image)
900 return VK_ERROR_OUT_OF_HOST_MEMORY;
901 image->size = size;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800902 *image_handle = GetHandleToImage(image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700903 return VK_SUCCESS;
904}
905
Jesse Hall606a54e2015-11-19 22:17:28 -0800906void GetImageMemoryRequirements(VkDevice,
907 VkImage image_handle,
908 VkMemoryRequirements* requirements) {
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800909 Image* image = GetImageFromHandle(image_handle);
Jesse Hall85c05b62015-09-01 18:07:41 -0700910 requirements->size = image->size;
911 requirements->alignment = 16; // allow fast Neon/SSE memcpy
912 requirements->memoryTypeBits = 0x1;
Jesse Hall85c05b62015-09-01 18:07:41 -0700913}
914
Jesse Hall03b6fe12015-11-24 12:44:21 -0800915void DestroyImage(VkDevice device,
916 VkImage image_handle,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800917 const VkAllocationCallbacks* allocator) {
Jesse Hall03b6fe12015-11-24 12:44:21 -0800918 if (!allocator)
919 allocator = &device->allocator;
Jesse Halla3a7a1d2015-11-24 11:37:23 -0800920 Image* image = GetImageFromHandle(image_handle);
Jesse Hall03b6fe12015-11-24 12:44:21 -0800921 allocator->pfnFree(allocator->pUserData, image);
Jesse Hall85c05b62015-09-01 18:07:41 -0700922}
923
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800924VkResult GetSwapchainGrallocUsageANDROID(VkDevice,
925 VkFormat,
926 VkImageUsageFlags,
927 int* grallocUsage) {
928 // The null driver never reads or writes the gralloc buffer
929 *grallocUsage = 0;
930 return VK_SUCCESS;
931}
932
Chris Forbes8e4438b2016-12-07 16:26:49 +1300933VkResult GetSwapchainGrallocUsage2ANDROID(VkDevice,
934 VkFormat,
935 VkImageUsageFlags,
936 VkSwapchainImageUsageFlagsANDROID,
Jesse Halld1abd742017-02-09 21:45:51 -0800937 uint64_t* grallocConsumerUsage,
938 uint64_t* grallocProducerUsage) {
Chris Forbes8e4438b2016-12-07 16:26:49 +1300939 // The null driver never reads or writes the gralloc buffer
Jesse Halld1abd742017-02-09 21:45:51 -0800940 *grallocConsumerUsage = 0;
941 *grallocProducerUsage = 0;
Chris Forbes8e4438b2016-12-07 16:26:49 +1300942 return VK_SUCCESS;
943}
944
Jesse Hall57f7f8c2016-01-17 17:21:36 -0800945VkResult AcquireImageANDROID(VkDevice,
946 VkImage,
947 int fence,
948 VkSemaphore,
949 VkFence) {
950 close(fence);
951 return VK_SUCCESS;
952}
953
954VkResult QueueSignalReleaseImageANDROID(VkQueue,
955 uint32_t,
956 const VkSemaphore*,
957 VkImage,
958 int* fence) {
959 *fence = -1;
960 return VK_SUCCESS;
961}
962
Jesse Hall85c05b62015-09-01 18:07:41 -0700963// -----------------------------------------------------------------------------
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700964// No-op types
965
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700966VkResult CreateBufferView(VkDevice device,
967 const VkBufferViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800968 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700969 VkBufferView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800970 *view = AllocHandle<VkBufferView>(device, HandleType::kBufferView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700971 return VK_SUCCESS;
972}
973
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700974VkResult CreateDescriptorPool(VkDevice device,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700975 const VkDescriptorPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800976 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700977 VkDescriptorPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800978 *pool = AllocHandle<VkDescriptorPool>(device, HandleType::kDescriptorPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700979 return VK_SUCCESS;
980}
981
Jesse Hall3fbc8562015-11-29 22:10:52 -0800982VkResult AllocateDescriptorSets(VkDevice device,
983 const VkDescriptorSetAllocateInfo* alloc_info,
984 VkDescriptorSet* descriptor_sets) {
Jesse Hall3dd678a2016-01-08 21:52:01 -0800985 for (uint32_t i = 0; i < alloc_info->descriptorSetCount; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -0800986 descriptor_sets[i] =
987 AllocHandle<VkDescriptorSet>(device, HandleType::kDescriptorSet);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700988 return VK_SUCCESS;
989}
990
991VkResult CreateDescriptorSetLayout(VkDevice device,
992 const VkDescriptorSetLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -0800993 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700994 VkDescriptorSetLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -0800995 *layout = AllocHandle<VkDescriptorSetLayout>(
996 device, HandleType::kDescriptorSetLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -0700997 return VK_SUCCESS;
998}
999
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001000VkResult CreateEvent(VkDevice device,
1001 const VkEventCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001002 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001003 VkEvent* event) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001004 *event = AllocHandle<VkEvent>(device, HandleType::kEvent);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001005 return VK_SUCCESS;
1006}
1007
1008VkResult CreateFence(VkDevice device,
1009 const VkFenceCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001010 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001011 VkFence* fence) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001012 *fence = AllocHandle<VkFence>(device, HandleType::kFence);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001013 return VK_SUCCESS;
1014}
1015
1016VkResult CreateFramebuffer(VkDevice device,
1017 const VkFramebufferCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001018 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001019 VkFramebuffer* framebuffer) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001020 *framebuffer = AllocHandle<VkFramebuffer>(device, HandleType::kFramebuffer);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001021 return VK_SUCCESS;
1022}
1023
1024VkResult CreateImageView(VkDevice device,
1025 const VkImageViewCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001026 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001027 VkImageView* view) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001028 *view = AllocHandle<VkImageView>(device, HandleType::kImageView);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001029 return VK_SUCCESS;
1030}
1031
1032VkResult CreateGraphicsPipelines(VkDevice device,
1033 VkPipelineCache,
1034 uint32_t count,
1035 const VkGraphicsPipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001036 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001037 VkPipeline* pipelines) {
1038 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -08001039 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001040 return VK_SUCCESS;
1041}
1042
1043VkResult CreateComputePipelines(VkDevice device,
1044 VkPipelineCache,
1045 uint32_t count,
1046 const VkComputePipelineCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001047 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001048 VkPipeline* pipelines) {
1049 for (uint32_t i = 0; i < count; i++)
Michael Lentine3fec89e2015-12-04 16:25:11 -08001050 pipelines[i] = AllocHandle<VkPipeline>(device, HandleType::kPipeline);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001051 return VK_SUCCESS;
1052}
1053
1054VkResult CreatePipelineCache(VkDevice device,
1055 const VkPipelineCacheCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001056 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001057 VkPipelineCache* cache) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001058 *cache = AllocHandle<VkPipelineCache>(device, HandleType::kPipelineCache);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001059 return VK_SUCCESS;
1060}
1061
1062VkResult CreatePipelineLayout(VkDevice device,
1063 const VkPipelineLayoutCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001064 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001065 VkPipelineLayout* layout) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001066 *layout =
1067 AllocHandle<VkPipelineLayout>(device, HandleType::kPipelineLayout);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001068 return VK_SUCCESS;
1069}
1070
1071VkResult CreateQueryPool(VkDevice device,
1072 const VkQueryPoolCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001073 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001074 VkQueryPool* pool) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001075 *pool = AllocHandle<VkQueryPool>(device, HandleType::kQueryPool);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001076 return VK_SUCCESS;
1077}
1078
1079VkResult CreateRenderPass(VkDevice device,
1080 const VkRenderPassCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001081 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001082 VkRenderPass* renderpass) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001083 *renderpass = AllocHandle<VkRenderPass>(device, HandleType::kRenderPass);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001084 return VK_SUCCESS;
1085}
1086
1087VkResult CreateSampler(VkDevice device,
1088 const VkSamplerCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001089 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001090 VkSampler* sampler) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001091 *sampler = AllocHandle<VkSampler>(device, HandleType::kSampler);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001092 return VK_SUCCESS;
1093}
1094
1095VkResult CreateSemaphore(VkDevice device,
1096 const VkSemaphoreCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001097 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001098 VkSemaphore* semaphore) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001099 *semaphore = AllocHandle<VkSemaphore>(device, HandleType::kSemaphore);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001100 return VK_SUCCESS;
1101}
1102
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001103VkResult CreateShaderModule(VkDevice device,
1104 const VkShaderModuleCreateInfo*,
Jesse Hall3fbc8562015-11-29 22:10:52 -08001105 const VkAllocationCallbacks* /*allocator*/,
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001106 VkShaderModule* module) {
Michael Lentine3fec89e2015-12-04 16:25:11 -08001107 *module = AllocHandle<VkShaderModule>(device, HandleType::kShaderModule);
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001108 return VK_SUCCESS;
1109}
1110
Jesse Hall715b86a2016-01-16 16:34:29 -08001111VkResult CreateDebugReportCallbackEXT(VkInstance instance,
1112 const VkDebugReportCallbackCreateInfoEXT*,
1113 const VkAllocationCallbacks*,
1114 VkDebugReportCallbackEXT* callback) {
1115 *callback = AllocHandle<VkDebugReportCallbackEXT>(
1116 instance, HandleType::kDebugReportCallbackEXT);
1117 return VK_SUCCESS;
1118}
1119
Jesse Hallf8faf0c2015-08-31 11:34:32 -07001120// -----------------------------------------------------------------------------
Jesse Hall04f4f472015-08-16 19:51:04 -07001121// No-op entrypoints
1122
1123// clang-format off
1124#pragma clang diagnostic push
1125#pragma clang diagnostic ignored "-Wunused-parameter"
1126
Jesse Hall606a54e2015-11-19 22:17:28 -08001127void GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001128 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001129}
1130
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001131void GetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR* pFormatProperties) {
1132 ALOGV("TODO: vk%s", __FUNCTION__);
1133}
1134
Jesse Halla9e57032015-11-30 01:03:10 -08001135VkResult GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001136 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Halla9e57032015-11-30 01:03:10 -08001137 return VK_SUCCESS;
Jesse Hall04f4f472015-08-16 19:51:04 -07001138}
1139
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001140VkResult GetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1141 const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo,
1142 VkImageFormatProperties2KHR* pImageFormatProperties) {
1143 ALOGV("TODO: vk%s", __FUNCTION__);
1144 return VK_SUCCESS;
1145}
1146
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001147VkResult EnumerateInstanceLayerProperties(uint32_t* pCount, VkLayerProperties* pProperties) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001148 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001149 return VK_SUCCESS;
1150}
1151
Jesse Halla366a512015-11-19 22:30:07 -08001152VkResult QueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmitInfo, VkFence fence) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001153 return VK_SUCCESS;
1154}
1155
1156VkResult QueueWaitIdle(VkQueue queue) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001157 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001158 return VK_SUCCESS;
1159}
1160
1161VkResult DeviceWaitIdle(VkDevice device) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001162 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001163 return VK_SUCCESS;
1164}
1165
Jesse Hallcf25c412015-10-29 17:14:50 -07001166void UnmapMemory(VkDevice device, VkDeviceMemory mem) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001167}
1168
1169VkResult FlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001170 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001171 return VK_SUCCESS;
1172}
1173
1174VkResult InvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001175 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001176 return VK_SUCCESS;
1177}
1178
Jesse Hall606a54e2015-11-19 22:17:28 -08001179void GetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001180 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001181}
1182
Jesse Hall04f4f472015-08-16 19:51:04 -07001183VkResult BindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memOffset) {
1184 return VK_SUCCESS;
1185}
1186
Jesse Hall04f4f472015-08-16 19:51:04 -07001187VkResult BindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, VkDeviceSize memOffset) {
1188 return VK_SUCCESS;
1189}
1190
Jesse Hall606a54e2015-11-19 22:17:28 -08001191void GetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pNumRequirements, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001192 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001193}
1194
Jesse Hall091ed9e2015-11-30 00:55:29 -08001195void 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 +01001196 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001197}
1198
Chris Forbes86bdfbe2017-01-26 12:45:49 +13001199void GetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice,
1200 VkPhysicalDeviceSparseImageFormatInfo2KHR const* pInfo,
1201 unsigned int* pNumProperties,
1202 VkSparseImageFormatProperties2KHR* pProperties) {
1203 ALOGV("TODO: vk%s", __FUNCTION__);
1204}
1205
1206
Jesse Halla6429252015-11-29 18:59:42 -08001207VkResult QueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001208 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001209 return VK_SUCCESS;
1210}
1211
Jesse Hall3fbc8562015-11-29 22:10:52 -08001212void DestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001213}
1214
1215VkResult ResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) {
1216 return VK_SUCCESS;
1217}
1218
1219VkResult GetFenceStatus(VkDevice device, VkFence fence) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001220 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001221 return VK_SUCCESS;
1222}
1223
1224VkResult WaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) {
1225 return VK_SUCCESS;
1226}
1227
Jesse Hall3fbc8562015-11-29 22:10:52 -08001228void DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001229}
1230
Jesse Hall3fbc8562015-11-29 22:10:52 -08001231void DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001232}
1233
1234VkResult GetEventStatus(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001235 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001236 return VK_SUCCESS;
1237}
1238
1239VkResult SetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001240 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001241 return VK_SUCCESS;
1242}
1243
1244VkResult ResetEvent(VkDevice device, VkEvent event) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001245 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001246 return VK_SUCCESS;
1247}
1248
Jesse Hall3fbc8562015-11-29 22:10:52 -08001249void DestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001250}
1251
Jesse Halla9bb62b2015-11-21 19:31:56 -08001252VkResult 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 +01001253 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001254 return VK_SUCCESS;
1255}
1256
Jesse Hall3fbc8562015-11-29 22:10:52 -08001257void DestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001258}
1259
Jesse Hall606a54e2015-11-19 22:17:28 -08001260void GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001261 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001262}
1263
Jesse Hall3fbc8562015-11-29 22:10:52 -08001264void DestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001265}
1266
Jesse Hall3fbc8562015-11-29 22:10:52 -08001267void DestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001268}
1269
Jesse Hall3fbc8562015-11-29 22:10:52 -08001270void DestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001271}
1272
Jesse Halla9bb62b2015-11-21 19:31:56 -08001273VkResult GetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001274 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001275 return VK_SUCCESS;
1276}
1277
1278VkResult MergePipelineCaches(VkDevice device, VkPipelineCache destCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001279 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001280 return VK_SUCCESS;
1281}
1282
Jesse Hall3fbc8562015-11-29 22:10:52 -08001283void DestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001284}
1285
Jesse Hall3fbc8562015-11-29 22:10:52 -08001286void DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001287}
1288
Jesse Hall3fbc8562015-11-29 22:10:52 -08001289void DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001290}
1291
Jesse Hall3fbc8562015-11-29 22:10:52 -08001292void DestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001293}
1294
Jesse Hall3fbc8562015-11-29 22:10:52 -08001295void DestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001296}
1297
Jesse Hallfbf97b02015-11-20 14:17:03 -08001298VkResult ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001299 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001300 return VK_SUCCESS;
1301}
1302
Jesse Hallcf25c412015-10-29 17:14:50 -07001303void UpdateDescriptorSets(VkDevice device, uint32_t writeCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t copyCount, const VkCopyDescriptorSet* pDescriptorCopies) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001304 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001305}
1306
1307VkResult FreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001308 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001309 return VK_SUCCESS;
1310}
1311
Jesse Hall3fbc8562015-11-29 22:10:52 -08001312void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001313}
1314
Jesse Hall3fbc8562015-11-29 22:10:52 -08001315void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* allocator) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001316}
1317
Jesse Hall606a54e2015-11-19 22:17:28 -08001318void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001319 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001320}
1321
Jesse Hall3fbc8562015-11-29 22:10:52 -08001322VkResult ResetCommandPool(VkDevice device, VkCommandPool cmdPool, VkCommandPoolResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001323 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001324 return VK_SUCCESS;
1325}
1326
Jesse Hall3fbc8562015-11-29 22:10:52 -08001327VkResult BeginCommandBuffer(VkCommandBuffer cmdBuffer, const VkCommandBufferBeginInfo* pBeginInfo) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001328 return VK_SUCCESS;
1329}
1330
Jesse Hall3fbc8562015-11-29 22:10:52 -08001331VkResult EndCommandBuffer(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001332 return VK_SUCCESS;
1333}
1334
Jesse Hall3fbc8562015-11-29 22:10:52 -08001335VkResult ResetCommandBuffer(VkCommandBuffer cmdBuffer, VkCommandBufferResetFlags flags) {
Jesse Hall73ab0ac2015-08-25 15:09:15 +01001336 ALOGV("TODO: vk%s", __FUNCTION__);
Jesse Hall04f4f472015-08-16 19:51:04 -07001337 return VK_SUCCESS;
1338}
1339
Jesse Hall3fbc8562015-11-29 22:10:52 -08001340void CmdBindPipeline(VkCommandBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001341}
1342
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001343void CmdSetViewport(VkCommandBuffer cmdBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001344}
1345
Jesse Hallf9fa9a52016-01-08 16:08:51 -08001346void CmdSetScissor(VkCommandBuffer cmdBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001347}
1348
Jesse Hall3fbc8562015-11-29 22:10:52 -08001349void CmdSetLineWidth(VkCommandBuffer cmdBuffer, float lineWidth) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001350}
1351
Jesse Hall3fbc8562015-11-29 22:10:52 -08001352void CmdSetDepthBias(VkCommandBuffer cmdBuffer, float depthBias, float depthBiasClamp, float slopeScaledDepthBias) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001353}
1354
Jesse Hall3fbc8562015-11-29 22:10:52 -08001355void CmdSetBlendConstants(VkCommandBuffer cmdBuffer, const float blendConst[4]) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001356}
1357
Jesse Hall3fbc8562015-11-29 22:10:52 -08001358void CmdSetDepthBounds(VkCommandBuffer cmdBuffer, float minDepthBounds, float maxDepthBounds) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001359}
1360
Jesse Hall3fbc8562015-11-29 22:10:52 -08001361void CmdSetStencilCompareMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilCompareMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001362}
1363
Jesse Hall3fbc8562015-11-29 22:10:52 -08001364void CmdSetStencilWriteMask(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilWriteMask) {
Jesse Hall5ae3abb2015-10-08 14:00:22 -07001365}
1366
Jesse Hall3fbc8562015-11-29 22:10:52 -08001367void CmdSetStencilReference(VkCommandBuffer cmdBuffer, VkStencilFaceFlags faceMask, uint32_t stencilReference) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001368}
1369
Jesse Hall3fbc8562015-11-29 22:10:52 -08001370void 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 -07001371}
1372
Jesse Hall3fbc8562015-11-29 22:10:52 -08001373void CmdBindIndexBuffer(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001374}
1375
Jesse Hall3fbc8562015-11-29 22:10:52 -08001376void CmdBindVertexBuffers(VkCommandBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001377}
1378
Jesse Hall3fbc8562015-11-29 22:10:52 -08001379void CmdDraw(VkCommandBuffer cmdBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001380}
1381
Jesse Hall3fbc8562015-11-29 22:10:52 -08001382void 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 -07001383}
1384
Jesse Hall3fbc8562015-11-29 22:10:52 -08001385void CmdDrawIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001386}
1387
Jesse Hall3fbc8562015-11-29 22:10:52 -08001388void CmdDrawIndexedIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001389}
1390
Jesse Hall3fbc8562015-11-29 22:10:52 -08001391void CmdDispatch(VkCommandBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001392}
1393
Jesse Hall3fbc8562015-11-29 22:10:52 -08001394void CmdDispatchIndirect(VkCommandBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001395}
1396
Jesse Hall3fbc8562015-11-29 22:10:52 -08001397void CmdCopyBuffer(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001398}
1399
Jesse Hall3fbc8562015-11-29 22:10:52 -08001400void CmdCopyImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001401}
1402
Jesse Hall3fbc8562015-11-29 22:10:52 -08001403void 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 -07001404}
1405
Jesse Hall3fbc8562015-11-29 22:10:52 -08001406void CmdCopyBufferToImage(VkCommandBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001407}
1408
Jesse Hall3fbc8562015-11-29 22:10:52 -08001409void CmdCopyImageToBuffer(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001410}
1411
Jesse Hall56d386a2016-07-26 15:20:40 -07001412void CmdUpdateBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const void* pData) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001413}
1414
Jesse Hall3fbc8562015-11-29 22:10:52 -08001415void CmdFillBuffer(VkCommandBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001416}
1417
Jesse Hall3fbc8562015-11-29 22:10:52 -08001418void CmdClearColorImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001419}
1420
Jesse Hall3fbc8562015-11-29 22:10:52 -08001421void CmdClearDepthStencilImage(VkCommandBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001422}
1423
Jesse Hall3fbc8562015-11-29 22:10:52 -08001424void CmdClearAttachments(VkCommandBuffer cmdBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001425}
1426
Jesse Hall3fbc8562015-11-29 22:10:52 -08001427void CmdResolveImage(VkCommandBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001428}
1429
Jesse Hall3fbc8562015-11-29 22:10:52 -08001430void CmdSetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001431}
1432
Jesse Hall3fbc8562015-11-29 22:10:52 -08001433void CmdResetEvent(VkCommandBuffer cmdBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001434}
1435
Jesse Hall3dd678a2016-01-08 21:52:01 -08001436void 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 -07001437}
1438
Jesse Hall3dd678a2016-01-08 21:52:01 -08001439void 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 -07001440}
1441
Jesse Hall3fbc8562015-11-29 22:10:52 -08001442void CmdBeginQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001443}
1444
Jesse Hall3fbc8562015-11-29 22:10:52 -08001445void CmdEndQuery(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001446}
1447
Jesse Hall3fbc8562015-11-29 22:10:52 -08001448void CmdResetQueryPool(VkCommandBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001449}
1450
Jesse Hall3fbc8562015-11-29 22:10:52 -08001451void CmdWriteTimestamp(VkCommandBuffer cmdBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t slot) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001452}
1453
Jesse Hall3fbc8562015-11-29 22:10:52 -08001454void 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 -07001455}
1456
Jesse Hall3fbc8562015-11-29 22:10:52 -08001457void CmdPushConstants(VkCommandBuffer cmdBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t start, uint32_t length, const void* values) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001458}
1459
Jesse Hall65ab5522015-11-30 00:07:16 -08001460void CmdBeginRenderPass(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001461}
1462
Jesse Hall65ab5522015-11-30 00:07:16 -08001463void CmdNextSubpass(VkCommandBuffer cmdBuffer, VkSubpassContents contents) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001464}
1465
Jesse Hall3fbc8562015-11-29 22:10:52 -08001466void CmdEndRenderPass(VkCommandBuffer cmdBuffer) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001467}
1468
Jesse Hall3fbc8562015-11-29 22:10:52 -08001469void CmdExecuteCommands(VkCommandBuffer cmdBuffer, uint32_t cmdBuffersCount, const VkCommandBuffer* pCmdBuffers) {
Jesse Hall04f4f472015-08-16 19:51:04 -07001470}
1471
Jesse Hall715b86a2016-01-16 16:34:29 -08001472void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator) {
1473}
1474
1475void DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage) {
1476}
1477
Jesse Hall04f4f472015-08-16 19:51:04 -07001478#pragma clang diagnostic pop
1479// clang-format on
1480
1481} // namespace null_driver