blob: e05e5ab4ed29778f898f277e9b4de12093b809a8 [file] [log] [blame] [edit]
/*
** Copyright (c) 2015-2024 The Khronos Group Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*
** This header is generated from the Khronos Vulkan XML API Registry.
**
*/
#pragma once
#include "mock_icd.h"
#include "function_declarations.h"
namespace vkmock {
static VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(
const VkInstanceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkInstance* pInstance)
{
// TODO: If loader ver <=4 ICD must fail with VK_ERROR_INCOMPATIBLE_DRIVER for all vkCreateInstance calls with
// apiVersion set to > Vulkan 1.0 because the loader is still at interface version <= 4. Otherwise, the
// ICD should behave as normal.
if (loader_interface_version <= 4) {
return VK_ERROR_INCOMPATIBLE_DRIVER;
}
*pInstance = (VkInstance)CreateDispObjHandle();
for (auto& physical_device : physical_device_map[*pInstance])
physical_device = (VkPhysicalDevice)CreateDispObjHandle();
// TODO: If emulating specific device caps, will need to add intelligence here
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyInstance(
VkInstance instance,
const VkAllocationCallbacks* pAllocator)
{
if (instance) {
for (const auto physical_device : physical_device_map.at(instance)) {
display_map.erase(physical_device);
DestroyDispObjHandle((void*)physical_device);
}
physical_device_map.erase(instance);
DestroyDispObjHandle((void*)instance);
}
}
static VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDevices(
VkInstance instance,
uint32_t* pPhysicalDeviceCount,
VkPhysicalDevice* pPhysicalDevices)
{
VkResult result_code = VK_SUCCESS;
if (pPhysicalDevices) {
const auto return_count = (std::min)(*pPhysicalDeviceCount, icd_physical_device_count);
for (uint32_t i = 0; i < return_count; ++i) pPhysicalDevices[i] = physical_device_map.at(instance)[i];
if (return_count < icd_physical_device_count) result_code = VK_INCOMPLETE;
*pPhysicalDeviceCount = return_count;
} else {
*pPhysicalDeviceCount = icd_physical_device_count;
}
return result_code;
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures* pFeatures)
{
uint32_t num_bools = sizeof(VkPhysicalDeviceFeatures) / sizeof(VkBool32);
VkBool32 *bool_array = &pFeatures->robustBufferAccess;
SetBoolArrayTrue(bool_array, num_bools);
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkFormatProperties* pFormatProperties)
{
if (VK_FORMAT_UNDEFINED == format) {
*pFormatProperties = { 0x0, 0x0, 0x0 };
} else {
// Default to a color format, skip DS bit
*pFormatProperties = { 0x00FFFDFF, 0x00FFFDFF, 0x00FFFDFF };
switch (format) {
case VK_FORMAT_D16_UNORM:
case VK_FORMAT_X8_D24_UNORM_PACK32:
case VK_FORMAT_D32_SFLOAT:
case VK_FORMAT_S8_UINT:
case VK_FORMAT_D16_UNORM_S8_UINT:
case VK_FORMAT_D24_UNORM_S8_UINT:
case VK_FORMAT_D32_SFLOAT_S8_UINT:
// Don't set color bits for DS formats
*pFormatProperties = { 0x00FFFE7F, 0x00FFFE7F, 0x00FFFE7F };
break;
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:
case VK_FORMAT_G8_B8R8_2PLANE_422_UNORM:
case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16:
case VK_FORMAT_G8_B8R8_2PLANE_444_UNORM:
// Set decode/encode bits for these formats
*pFormatProperties = { 0x1EFFFDFF, 0x1EFFFDFF, 0x00FFFDFF };
break;
default:
break;
}
}
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkImageType type,
VkImageTiling tiling,
VkImageUsageFlags usage,
VkImageCreateFlags flags,
VkImageFormatProperties* pImageFormatProperties)
{
// A hardcoded unsupported format
if (format == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) {
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
// TODO: Just hard-coding some values for now
// TODO: If tiling is linear, limit the mips, levels, & sample count
if (VK_IMAGE_TILING_LINEAR == tiling) {
*pImageFormatProperties = { { 4096, 4096, 256 }, 1, 1, VK_SAMPLE_COUNT_1_BIT, 4294967296 };
} else {
// We hard-code support for all sample counts except 64 bits.
*pImageFormatProperties = { { 4096, 4096, 256 }, 12, 256, 0x7F & ~VK_SAMPLE_COUNT_64_BIT, 4294967296 };
}
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties* pProperties)
{
pProperties->apiVersion = VK_HEADER_VERSION_COMPLETE;
pProperties->driverVersion = 1;
pProperties->vendorID = 0xba5eba11;
pProperties->deviceID = 0xf005ba11;
pProperties->deviceType = VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU;
//std::string devName = "Vulkan Mock Device";
strcpy(pProperties->deviceName, "Vulkan Mock Device");
pProperties->pipelineCacheUUID[0] = 18;
pProperties->limits = SetLimits(&pProperties->limits);
pProperties->sparseProperties = { VK_TRUE, VK_TRUE, VK_TRUE, VK_TRUE, VK_TRUE };
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties(
VkPhysicalDevice physicalDevice,
uint32_t* pQueueFamilyPropertyCount,
VkQueueFamilyProperties* pQueueFamilyProperties)
{
if (pQueueFamilyProperties) {
std::vector<VkQueueFamilyProperties2KHR> props2(*pQueueFamilyPropertyCount, {
VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR});
GetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice, pQueueFamilyPropertyCount, props2.data());
for (uint32_t i = 0; i < *pQueueFamilyPropertyCount; ++i) {
pQueueFamilyProperties[i] = props2[i].queueFamilyProperties;
}
} else {
GetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice, pQueueFamilyPropertyCount, nullptr);
}
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceMemoryProperties* pMemoryProperties)
{
pMemoryProperties->memoryTypeCount = 6;
// Host visible Coherent
pMemoryProperties->memoryTypes[0].propertyFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
pMemoryProperties->memoryTypes[0].heapIndex = 0;
// Host visible Cached
pMemoryProperties->memoryTypes[1].propertyFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
pMemoryProperties->memoryTypes[1].heapIndex = 0;
// Device local and Host visible
pMemoryProperties->memoryTypes[2].propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
pMemoryProperties->memoryTypes[2].heapIndex = 1;
// Device local lazily
pMemoryProperties->memoryTypes[3].propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT;
pMemoryProperties->memoryTypes[3].heapIndex = 1;
// Device local protected
pMemoryProperties->memoryTypes[4].propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_PROTECTED_BIT;
pMemoryProperties->memoryTypes[4].heapIndex = 1;
// Device local only
pMemoryProperties->memoryTypes[5].propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
pMemoryProperties->memoryTypes[5].heapIndex = 1;
pMemoryProperties->memoryHeapCount = 2;
pMemoryProperties->memoryHeaps[0].flags = VK_MEMORY_HEAP_MULTI_INSTANCE_BIT;
pMemoryProperties->memoryHeaps[0].size = 8000000000;
pMemoryProperties->memoryHeaps[1].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
pMemoryProperties->memoryHeaps[1].size = 8000000000;
}
static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(
VkInstance instance,
const char* pName)
{
if (!negotiate_loader_icd_interface_called) {
loader_interface_version = 0;
}
const auto &item = name_to_funcptr_map.find(pName);
if (item != name_to_funcptr_map.end()) {
return reinterpret_cast<PFN_vkVoidFunction>(item->second);
}
// Mock should intercept all functions so if we get here just return null
return nullptr;
}
static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(
VkDevice device,
const char* pName)
{
return GetInstanceProcAddr(nullptr, pName);
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(
VkPhysicalDevice physicalDevice,
const VkDeviceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDevice* pDevice)
{
*pDevice = (VkDevice)CreateDispObjHandle();
// TODO: If emulating specific device caps, will need to add intelligence here
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyDevice(
VkDevice device,
const VkAllocationCallbacks* pAllocator)
{
unique_lock_t lock(global_lock);
// First destroy sub-device objects
// Destroy Queues
for (auto queue_family_map_pair : queue_map[device]) {
for (auto index_queue_pair : queue_map[device][queue_family_map_pair.first]) {
DestroyDispObjHandle((void*)index_queue_pair.second);
}
}
for (auto& cp : command_pool_map[device]) {
for (auto& cb : command_pool_buffer_map[cp]) {
DestroyDispObjHandle((void*) cb);
}
command_pool_buffer_map.erase(cp);
}
command_pool_map[device].clear();
queue_map.erase(device);
buffer_map.erase(device);
image_memory_size_map.erase(device);
// Now destroy device
DestroyDispObjHandle((void*)device);
// TODO: If emulating specific device caps, will need to add intelligence here
}
static VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceExtensionProperties(
const char* pLayerName,
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties)
{
// If requesting number of extensions, return that
if (!pLayerName) {
if (!pProperties) {
*pPropertyCount = (uint32_t)instance_extension_map.size();
} else {
uint32_t i = 0;
for (const auto &name_ver_pair : instance_extension_map) {
if (i == *pPropertyCount) {
break;
}
std::strncpy(pProperties[i].extensionName, name_ver_pair.first.c_str(), sizeof(pProperties[i].extensionName));
pProperties[i].extensionName[sizeof(pProperties[i].extensionName) - 1] = 0;
pProperties[i].specVersion = name_ver_pair.second;
++i;
}
if (i != instance_extension_map.size()) {
return VK_INCOMPLETE;
}
}
}
// If requesting extension properties, fill in data struct for number of extensions
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(
VkPhysicalDevice physicalDevice,
const char* pLayerName,
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties)
{
// If requesting number of extensions, return that
if (!pLayerName) {
if (!pProperties) {
*pPropertyCount = (uint32_t)device_extension_map.size();
} else {
uint32_t i = 0;
for (const auto &name_ver_pair : device_extension_map) {
if (i == *pPropertyCount) {
break;
}
std::strncpy(pProperties[i].extensionName, name_ver_pair.first.c_str(), sizeof(pProperties[i].extensionName));
pProperties[i].extensionName[sizeof(pProperties[i].extensionName) - 1] = 0;
pProperties[i].specVersion = name_ver_pair.second;
++i;
}
if (i != device_extension_map.size()) {
return VK_INCOMPLETE;
}
}
}
// If requesting extension properties, fill in data struct for number of extensions
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceLayerProperties(
uint32_t* pPropertyCount,
VkLayerProperties* pProperties)
{
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceLayerProperties(
VkPhysicalDevice physicalDevice,
uint32_t* pPropertyCount,
VkLayerProperties* pProperties)
{
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL GetDeviceQueue(
VkDevice device,
uint32_t queueFamilyIndex,
uint32_t queueIndex,
VkQueue* pQueue)
{
unique_lock_t lock(global_lock);
auto queue = queue_map[device][queueFamilyIndex][queueIndex];
if (queue) {
*pQueue = queue;
} else {
*pQueue = queue_map[device][queueFamilyIndex][queueIndex] = (VkQueue)CreateDispObjHandle();
}
// TODO: If emulating specific device caps, will need to add intelligence here
return;
}
static VKAPI_ATTR VkResult VKAPI_CALL QueueSubmit(
VkQueue queue,
uint32_t submitCount,
const VkSubmitInfo* pSubmits,
VkFence fence)
{
// Special way to cause DEVICE_LOST
// Picked VkExportFenceCreateInfo because needed some struct that wouldn't get cleared by validation Safe Struct
// ... TODO - It would be MUCH nicer to have a layer or other setting control when this occured
// For now this is used to allow Validation Layers test reacting to device losts
if (submitCount > 0 && pSubmits) {
auto pNext = reinterpret_cast<const VkBaseInStructure *>(pSubmits[0].pNext);
if (pNext && pNext->sType == VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO && pNext->pNext == nullptr) {
return VK_ERROR_DEVICE_LOST;
}
}
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL QueueWaitIdle(
VkQueue queue)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL DeviceWaitIdle(
VkDevice device)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL AllocateMemory(
VkDevice device,
const VkMemoryAllocateInfo* pAllocateInfo,
const VkAllocationCallbacks* pAllocator,
VkDeviceMemory* pMemory)
{
unique_lock_t lock(global_lock);
allocated_memory_size_map[(VkDeviceMemory)global_unique_handle] = pAllocateInfo->allocationSize;
*pMemory = (VkDeviceMemory)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL FreeMemory(
VkDevice device,
VkDeviceMemory memory,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
UnmapMemory(device, memory);
unique_lock_t lock(global_lock);
allocated_memory_size_map.erase(memory);
}
static VKAPI_ATTR VkResult VKAPI_CALL MapMemory(
VkDevice device,
VkDeviceMemory memory,
VkDeviceSize offset,
VkDeviceSize size,
VkMemoryMapFlags flags,
void** ppData)
{
unique_lock_t lock(global_lock);
if (VK_WHOLE_SIZE == size) {
if (allocated_memory_size_map.count(memory) != 0)
size = allocated_memory_size_map[memory] - offset;
else
size = 0x10000;
}
void* map_addr = malloc((size_t)size);
mapped_memory_map[memory].push_back(map_addr);
*ppData = map_addr;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL UnmapMemory(
VkDevice device,
VkDeviceMemory memory)
{
unique_lock_t lock(global_lock);
for (auto map_addr : mapped_memory_map[memory]) {
free(map_addr);
}
mapped_memory_map.erase(memory);
}
static VKAPI_ATTR VkResult VKAPI_CALL FlushMappedMemoryRanges(
VkDevice device,
uint32_t memoryRangeCount,
const VkMappedMemoryRange* pMemoryRanges)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL InvalidateMappedMemoryRanges(
VkDevice device,
uint32_t memoryRangeCount,
const VkMappedMemoryRange* pMemoryRanges)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL GetDeviceMemoryCommitment(
VkDevice device,
VkDeviceMemory memory,
VkDeviceSize* pCommittedMemoryInBytes)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory(
VkDevice device,
VkBuffer buffer,
VkDeviceMemory memory,
VkDeviceSize memoryOffset)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL BindImageMemory(
VkDevice device,
VkImage image,
VkDeviceMemory memory,
VkDeviceSize memoryOffset)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL GetBufferMemoryRequirements(
VkDevice device,
VkBuffer buffer,
VkMemoryRequirements* pMemoryRequirements)
{
// TODO: Just hard-coding reqs for now
pMemoryRequirements->size = 4096;
pMemoryRequirements->alignment = 1;
pMemoryRequirements->memoryTypeBits = 0xFFFF;
// Return a better size based on the buffer size from the create info.
unique_lock_t lock(global_lock);
auto d_iter = buffer_map.find(device);
if (d_iter != buffer_map.end()) {
auto iter = d_iter->second.find(buffer);
if (iter != d_iter->second.end()) {
pMemoryRequirements->size = ((iter->second.size + 4095) / 4096) * 4096;
}
}
}
static VKAPI_ATTR void VKAPI_CALL GetImageMemoryRequirements(
VkDevice device,
VkImage image,
VkMemoryRequirements* pMemoryRequirements)
{
pMemoryRequirements->size = 0;
pMemoryRequirements->alignment = 1;
unique_lock_t lock(global_lock);
auto d_iter = image_memory_size_map.find(device);
if(d_iter != image_memory_size_map.end()){
auto iter = d_iter->second.find(image);
if (iter != d_iter->second.end()) {
pMemoryRequirements->size = iter->second;
}
}
// Here we hard-code that the memory type at index 3 doesn't support this image.
pMemoryRequirements->memoryTypeBits = 0xFFFF & ~(0x1 << 3);
}
static VKAPI_ATTR void VKAPI_CALL GetImageSparseMemoryRequirements(
VkDevice device,
VkImage image,
uint32_t* pSparseMemoryRequirementCount,
VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
{
if (!pSparseMemoryRequirements) {
*pSparseMemoryRequirementCount = 1;
} else {
// arbitrary
pSparseMemoryRequirements->imageMipTailFirstLod = 0;
pSparseMemoryRequirements->imageMipTailSize = 8;
pSparseMemoryRequirements->imageMipTailOffset = 0;
pSparseMemoryRequirements->imageMipTailStride = 4;
pSparseMemoryRequirements->formatProperties.imageGranularity = {4, 4, 4};
pSparseMemoryRequirements->formatProperties.flags = VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT;
// Would need to track the VkImage to know format for better value here
pSparseMemoryRequirements->formatProperties.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_METADATA_BIT;
}
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkImageType type,
VkSampleCountFlagBits samples,
VkImageUsageFlags usage,
VkImageTiling tiling,
uint32_t* pPropertyCount,
VkSparseImageFormatProperties* pProperties)
{
if (!pProperties) {
*pPropertyCount = 1;
} else {
// arbitrary
pProperties->imageGranularity = {4, 4, 4};
pProperties->flags = VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT;
switch (format) {
case VK_FORMAT_D16_UNORM:
case VK_FORMAT_D32_SFLOAT:
pProperties->aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
break;
case VK_FORMAT_S8_UINT:
pProperties->aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT;
break;
case VK_FORMAT_X8_D24_UNORM_PACK32:
case VK_FORMAT_D16_UNORM_S8_UINT:
case VK_FORMAT_D24_UNORM_S8_UINT:
case VK_FORMAT_D32_SFLOAT_S8_UINT:
pProperties->aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
break;
default:
pProperties->aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
break;
}
}
}
static VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(
VkQueue queue,
uint32_t bindInfoCount,
const VkBindSparseInfo* pBindInfo,
VkFence fence)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateFence(
VkDevice device,
const VkFenceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkFence* pFence)
{
unique_lock_t lock(global_lock);
*pFence = (VkFence)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyFence(
VkDevice device,
VkFence fence,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL ResetFences(
VkDevice device,
uint32_t fenceCount,
const VkFence* pFences)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetFenceStatus(
VkDevice device,
VkFence fence)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL WaitForFences(
VkDevice device,
uint32_t fenceCount,
const VkFence* pFences,
VkBool32 waitAll,
uint64_t timeout)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateSemaphore(
VkDevice device,
const VkSemaphoreCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSemaphore* pSemaphore)
{
unique_lock_t lock(global_lock);
*pSemaphore = (VkSemaphore)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroySemaphore(
VkDevice device,
VkSemaphore semaphore,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateEvent(
VkDevice device,
const VkEventCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkEvent* pEvent)
{
unique_lock_t lock(global_lock);
*pEvent = (VkEvent)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyEvent(
VkDevice device,
VkEvent event,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL GetEventStatus(
VkDevice device,
VkEvent event)
{
//Not a CREATE or DESTROY function
return VK_EVENT_SET;
}
static VKAPI_ATTR VkResult VKAPI_CALL SetEvent(
VkDevice device,
VkEvent event)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL ResetEvent(
VkDevice device,
VkEvent event)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateQueryPool(
VkDevice device,
const VkQueryPoolCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkQueryPool* pQueryPool)
{
unique_lock_t lock(global_lock);
*pQueryPool = (VkQueryPool)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyQueryPool(
VkDevice device,
VkQueryPool queryPool,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL GetQueryPoolResults(
VkDevice device,
VkQueryPool queryPool,
uint32_t firstQuery,
uint32_t queryCount,
size_t dataSize,
void* pData,
VkDeviceSize stride,
VkQueryResultFlags flags)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateBuffer(
VkDevice device,
const VkBufferCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkBuffer* pBuffer)
{
unique_lock_t lock(global_lock);
*pBuffer = (VkBuffer)global_unique_handle++;
buffer_map[device][*pBuffer] = {
pCreateInfo->size,
current_available_address
};
current_available_address += pCreateInfo->size;
// Always align to next 64-bit pointer
const uint64_t alignment = current_available_address % 64;
if (alignment != 0) {
current_available_address += (64 - alignment);
}
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyBuffer(
VkDevice device,
VkBuffer buffer,
const VkAllocationCallbacks* pAllocator)
{
unique_lock_t lock(global_lock);
buffer_map[device].erase(buffer);
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateBufferView(
VkDevice device,
const VkBufferViewCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkBufferView* pView)
{
unique_lock_t lock(global_lock);
*pView = (VkBufferView)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyBufferView(
VkDevice device,
VkBufferView bufferView,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateImage(
VkDevice device,
const VkImageCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkImage* pImage)
{
unique_lock_t lock(global_lock);
*pImage = (VkImage)global_unique_handle++;
image_memory_size_map[device][*pImage] = GetImageSizeFromCreateInfo(pCreateInfo);
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyImage(
VkDevice device,
VkImage image,
const VkAllocationCallbacks* pAllocator)
{
unique_lock_t lock(global_lock);
image_memory_size_map[device].erase(image);
}
static VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout(
VkDevice device,
VkImage image,
const VkImageSubresource* pSubresource,
VkSubresourceLayout* pLayout)
{
// Need safe values. Callers are computing memory offsets from pLayout, with no return code to flag failure.
*pLayout = VkSubresourceLayout(); // Default constructor zero values.
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateImageView(
VkDevice device,
const VkImageViewCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkImageView* pView)
{
unique_lock_t lock(global_lock);
*pView = (VkImageView)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyImageView(
VkDevice device,
VkImageView imageView,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateShaderModule(
VkDevice device,
const VkShaderModuleCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkShaderModule* pShaderModule)
{
unique_lock_t lock(global_lock);
*pShaderModule = (VkShaderModule)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyShaderModule(
VkDevice device,
VkShaderModule shaderModule,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineCache(
VkDevice device,
const VkPipelineCacheCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkPipelineCache* pPipelineCache)
{
unique_lock_t lock(global_lock);
*pPipelineCache = (VkPipelineCache)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyPipelineCache(
VkDevice device,
VkPipelineCache pipelineCache,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPipelineCacheData(
VkDevice device,
VkPipelineCache pipelineCache,
size_t* pDataSize,
void* pData)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL MergePipelineCaches(
VkDevice device,
VkPipelineCache dstCache,
uint32_t srcCacheCount,
const VkPipelineCache* pSrcCaches)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateGraphicsPipelines(
VkDevice device,
VkPipelineCache pipelineCache,
uint32_t createInfoCount,
const VkGraphicsPipelineCreateInfo* pCreateInfos,
const VkAllocationCallbacks* pAllocator,
VkPipeline* pPipelines)
{
unique_lock_t lock(global_lock);
for (uint32_t i = 0; i < createInfoCount; ++i) {
pPipelines[i] = (VkPipeline)global_unique_handle++;
}
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateComputePipelines(
VkDevice device,
VkPipelineCache pipelineCache,
uint32_t createInfoCount,
const VkComputePipelineCreateInfo* pCreateInfos,
const VkAllocationCallbacks* pAllocator,
VkPipeline* pPipelines)
{
unique_lock_t lock(global_lock);
for (uint32_t i = 0; i < createInfoCount; ++i) {
pPipelines[i] = (VkPipeline)global_unique_handle++;
}
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyPipeline(
VkDevice device,
VkPipeline pipeline,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL CreatePipelineLayout(
VkDevice device,
const VkPipelineLayoutCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkPipelineLayout* pPipelineLayout)
{
unique_lock_t lock(global_lock);
*pPipelineLayout = (VkPipelineLayout)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyPipelineLayout(
VkDevice device,
VkPipelineLayout pipelineLayout,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateSampler(
VkDevice device,
const VkSamplerCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSampler* pSampler)
{
unique_lock_t lock(global_lock);
*pSampler = (VkSampler)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroySampler(
VkDevice device,
VkSampler sampler,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorSetLayout(
VkDevice device,
const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDescriptorSetLayout* pSetLayout)
{
unique_lock_t lock(global_lock);
*pSetLayout = (VkDescriptorSetLayout)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyDescriptorSetLayout(
VkDevice device,
VkDescriptorSetLayout descriptorSetLayout,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorPool(
VkDevice device,
const VkDescriptorPoolCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDescriptorPool* pDescriptorPool)
{
unique_lock_t lock(global_lock);
*pDescriptorPool = (VkDescriptorPool)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyDescriptorPool(
VkDevice device,
VkDescriptorPool descriptorPool,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL ResetDescriptorPool(
VkDevice device,
VkDescriptorPool descriptorPool,
VkDescriptorPoolResetFlags flags)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL AllocateDescriptorSets(
VkDevice device,
const VkDescriptorSetAllocateInfo* pAllocateInfo,
VkDescriptorSet* pDescriptorSets)
{
unique_lock_t lock(global_lock);
for (uint32_t i = 0; i < pAllocateInfo->descriptorSetCount; ++i) {
pDescriptorSets[i] = (VkDescriptorSet)global_unique_handle++;
}
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL FreeDescriptorSets(
VkDevice device,
VkDescriptorPool descriptorPool,
uint32_t descriptorSetCount,
const VkDescriptorSet* pDescriptorSets)
{
//Destroy object
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSets(
VkDevice device,
uint32_t descriptorWriteCount,
const VkWriteDescriptorSet* pDescriptorWrites,
uint32_t descriptorCopyCount,
const VkCopyDescriptorSet* pDescriptorCopies)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateFramebuffer(
VkDevice device,
const VkFramebufferCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkFramebuffer* pFramebuffer)
{
unique_lock_t lock(global_lock);
*pFramebuffer = (VkFramebuffer)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyFramebuffer(
VkDevice device,
VkFramebuffer framebuffer,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(
VkDevice device,
const VkRenderPassCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkRenderPass* pRenderPass)
{
unique_lock_t lock(global_lock);
*pRenderPass = (VkRenderPass)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyRenderPass(
VkDevice device,
VkRenderPass renderPass,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR void VKAPI_CALL GetRenderAreaGranularity(
VkDevice device,
VkRenderPass renderPass,
VkExtent2D* pGranularity)
{
pGranularity->width = 1;
pGranularity->height = 1;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateCommandPool(
VkDevice device,
const VkCommandPoolCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkCommandPool* pCommandPool)
{
unique_lock_t lock(global_lock);
*pCommandPool = (VkCommandPool)global_unique_handle++;
command_pool_map[device].insert(*pCommandPool);
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyCommandPool(
VkDevice device,
VkCommandPool commandPool,
const VkAllocationCallbacks* pAllocator)
{
// destroy command buffers for this pool
unique_lock_t lock(global_lock);
auto it = command_pool_buffer_map.find(commandPool);
if (it != command_pool_buffer_map.end()) {
for (auto& cb : it->second) {
DestroyDispObjHandle((void*) cb);
}
command_pool_buffer_map.erase(it);
}
command_pool_map[device].erase(commandPool);
}
static VKAPI_ATTR VkResult VKAPI_CALL ResetCommandPool(
VkDevice device,
VkCommandPool commandPool,
VkCommandPoolResetFlags flags)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL AllocateCommandBuffers(
VkDevice device,
const VkCommandBufferAllocateInfo* pAllocateInfo,
VkCommandBuffer* pCommandBuffers)
{
unique_lock_t lock(global_lock);
for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; ++i) {
pCommandBuffers[i] = (VkCommandBuffer)CreateDispObjHandle();
command_pool_buffer_map[pAllocateInfo->commandPool].push_back(pCommandBuffers[i]);
}
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL FreeCommandBuffers(
VkDevice device,
VkCommandPool commandPool,
uint32_t commandBufferCount,
const VkCommandBuffer* pCommandBuffers)
{
unique_lock_t lock(global_lock);
for (auto i = 0u; i < commandBufferCount; ++i) {
if (!pCommandBuffers[i]) {
continue;
}
for (auto& pair : command_pool_buffer_map) {
auto& cbs = pair.second;
auto it = std::find(cbs.begin(), cbs.end(), pCommandBuffers[i]);
if (it != cbs.end()) {
cbs.erase(it);
}
}
DestroyDispObjHandle((void*) pCommandBuffers[i]);
}
}
static VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(
VkCommandBuffer commandBuffer,
const VkCommandBufferBeginInfo* pBeginInfo)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL EndCommandBuffer(
VkCommandBuffer commandBuffer)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL ResetCommandBuffer(
VkCommandBuffer commandBuffer,
VkCommandBufferResetFlags flags)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL CmdBindPipeline(
VkCommandBuffer commandBuffer,
VkPipelineBindPoint pipelineBindPoint,
VkPipeline pipeline)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetViewport(
VkCommandBuffer commandBuffer,
uint32_t firstViewport,
uint32_t viewportCount,
const VkViewport* pViewports)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetScissor(
VkCommandBuffer commandBuffer,
uint32_t firstScissor,
uint32_t scissorCount,
const VkRect2D* pScissors)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetLineWidth(
VkCommandBuffer commandBuffer,
float lineWidth)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetDepthBias(
VkCommandBuffer commandBuffer,
float depthBiasConstantFactor,
float depthBiasClamp,
float depthBiasSlopeFactor)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetBlendConstants(
VkCommandBuffer commandBuffer,
const float blendConstants[4])
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetDepthBounds(
VkCommandBuffer commandBuffer,
float minDepthBounds,
float maxDepthBounds)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetStencilCompareMask(
VkCommandBuffer commandBuffer,
VkStencilFaceFlags faceMask,
uint32_t compareMask)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetStencilWriteMask(
VkCommandBuffer commandBuffer,
VkStencilFaceFlags faceMask,
uint32_t writeMask)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetStencilReference(
VkCommandBuffer commandBuffer,
VkStencilFaceFlags faceMask,
uint32_t reference)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(
VkCommandBuffer commandBuffer,
VkPipelineBindPoint pipelineBindPoint,
VkPipelineLayout layout,
uint32_t firstSet,
uint32_t descriptorSetCount,
const VkDescriptorSet* pDescriptorSets,
uint32_t dynamicOffsetCount,
const uint32_t* pDynamicOffsets)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer(
VkCommandBuffer commandBuffer,
VkBuffer buffer,
VkDeviceSize offset,
VkIndexType indexType)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers(
VkCommandBuffer commandBuffer,
uint32_t firstBinding,
uint32_t bindingCount,
const VkBuffer* pBuffers,
const VkDeviceSize* pOffsets)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdDraw(
VkCommandBuffer commandBuffer,
uint32_t vertexCount,
uint32_t instanceCount,
uint32_t firstVertex,
uint32_t firstInstance)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdDrawIndexed(
VkCommandBuffer commandBuffer,
uint32_t indexCount,
uint32_t instanceCount,
uint32_t firstIndex,
int32_t vertexOffset,
uint32_t firstInstance)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdDrawIndirect(
VkCommandBuffer commandBuffer,
VkBuffer buffer,
VkDeviceSize offset,
uint32_t drawCount,
uint32_t stride)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirect(
VkCommandBuffer commandBuffer,
VkBuffer buffer,
VkDeviceSize offset,
uint32_t drawCount,
uint32_t stride)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdDispatch(
VkCommandBuffer commandBuffer,
uint32_t groupCountX,
uint32_t groupCountY,
uint32_t groupCountZ)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdDispatchIndirect(
VkCommandBuffer commandBuffer,
VkBuffer buffer,
VkDeviceSize offset)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdCopyBuffer(
VkCommandBuffer commandBuffer,
VkBuffer srcBuffer,
VkBuffer dstBuffer,
uint32_t regionCount,
const VkBufferCopy* pRegions)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdCopyImage(
VkCommandBuffer commandBuffer,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
VkImageLayout dstImageLayout,
uint32_t regionCount,
const VkImageCopy* pRegions)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdBlitImage(
VkCommandBuffer commandBuffer,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
VkImageLayout dstImageLayout,
uint32_t regionCount,
const VkImageBlit* pRegions,
VkFilter filter)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage(
VkCommandBuffer commandBuffer,
VkBuffer srcBuffer,
VkImage dstImage,
VkImageLayout dstImageLayout,
uint32_t regionCount,
const VkBufferImageCopy* pRegions)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer(
VkCommandBuffer commandBuffer,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkBuffer dstBuffer,
uint32_t regionCount,
const VkBufferImageCopy* pRegions)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdUpdateBuffer(
VkCommandBuffer commandBuffer,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
VkDeviceSize dataSize,
const void* pData)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdFillBuffer(
VkCommandBuffer commandBuffer,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
VkDeviceSize size,
uint32_t data)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdClearColorImage(
VkCommandBuffer commandBuffer,
VkImage image,
VkImageLayout imageLayout,
const VkClearColorValue* pColor,
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdClearDepthStencilImage(
VkCommandBuffer commandBuffer,
VkImage image,
VkImageLayout imageLayout,
const VkClearDepthStencilValue* pDepthStencil,
uint32_t rangeCount,
const VkImageSubresourceRange* pRanges)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdClearAttachments(
VkCommandBuffer commandBuffer,
uint32_t attachmentCount,
const VkClearAttachment* pAttachments,
uint32_t rectCount,
const VkClearRect* pRects)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdResolveImage(
VkCommandBuffer commandBuffer,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
VkImageLayout dstImageLayout,
uint32_t regionCount,
const VkImageResolve* pRegions)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetEvent(
VkCommandBuffer commandBuffer,
VkEvent event,
VkPipelineStageFlags stageMask)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdResetEvent(
VkCommandBuffer commandBuffer,
VkEvent event,
VkPipelineStageFlags stageMask)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL 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)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL 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)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdBeginQuery(
VkCommandBuffer commandBuffer,
VkQueryPool queryPool,
uint32_t query,
VkQueryControlFlags flags)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdEndQuery(
VkCommandBuffer commandBuffer,
VkQueryPool queryPool,
uint32_t query)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdResetQueryPool(
VkCommandBuffer commandBuffer,
VkQueryPool queryPool,
uint32_t firstQuery,
uint32_t queryCount)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdWriteTimestamp(
VkCommandBuffer commandBuffer,
VkPipelineStageFlagBits pipelineStage,
VkQueryPool queryPool,
uint32_t query)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdCopyQueryPoolResults(
VkCommandBuffer commandBuffer,
VkQueryPool queryPool,
uint32_t firstQuery,
uint32_t queryCount,
VkBuffer dstBuffer,
VkDeviceSize dstOffset,
VkDeviceSize stride,
VkQueryResultFlags flags)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdPushConstants(
VkCommandBuffer commandBuffer,
VkPipelineLayout layout,
VkShaderStageFlags stageFlags,
uint32_t offset,
uint32_t size,
const void* pValues)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass(
VkCommandBuffer commandBuffer,
const VkRenderPassBeginInfo* pRenderPassBegin,
VkSubpassContents contents)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdNextSubpass(
VkCommandBuffer commandBuffer,
VkSubpassContents contents)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(
VkCommandBuffer commandBuffer)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(
VkCommandBuffer commandBuffer,
uint32_t commandBufferCount,
const VkCommandBuffer* pCommandBuffers)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR VkResult VKAPI_CALL EnumerateInstanceVersion(
uint32_t* pApiVersion)
{
*pApiVersion = VK_HEADER_VERSION_COMPLETE;
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL BindBufferMemory2(
VkDevice device,
uint32_t bindInfoCount,
const VkBindBufferMemoryInfo* pBindInfos)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL BindImageMemory2(
VkDevice device,
uint32_t bindInfoCount,
const VkBindImageMemoryInfo* pBindInfos)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL GetDeviceGroupPeerMemoryFeatures(
VkDevice device,
uint32_t heapIndex,
uint32_t localDeviceIndex,
uint32_t remoteDeviceIndex,
VkPeerMemoryFeatureFlags* pPeerMemoryFeatures)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetDeviceMask(
VkCommandBuffer commandBuffer,
uint32_t deviceMask)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdDispatchBase(
VkCommandBuffer commandBuffer,
uint32_t baseGroupX,
uint32_t baseGroupY,
uint32_t baseGroupZ,
uint32_t groupCountX,
uint32_t groupCountY,
uint32_t groupCountZ)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceGroups(
VkInstance instance,
uint32_t* pPhysicalDeviceGroupCount,
VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties)
{
return EnumeratePhysicalDeviceGroupsKHR(instance, pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties);
}
static VKAPI_ATTR void VKAPI_CALL GetImageMemoryRequirements2(
VkDevice device,
const VkImageMemoryRequirementsInfo2* pInfo,
VkMemoryRequirements2* pMemoryRequirements)
{
GetImageMemoryRequirements2KHR(device, pInfo, pMemoryRequirements);
}
static VKAPI_ATTR void VKAPI_CALL GetBufferMemoryRequirements2(
VkDevice device,
const VkBufferMemoryRequirementsInfo2* pInfo,
VkMemoryRequirements2* pMemoryRequirements)
{
GetBufferMemoryRequirements2KHR(device, pInfo, pMemoryRequirements);
}
static VKAPI_ATTR void VKAPI_CALL GetImageSparseMemoryRequirements2(
VkDevice device,
const VkImageSparseMemoryRequirementsInfo2* pInfo,
uint32_t* pSparseMemoryRequirementCount,
VkSparseImageMemoryRequirements2* pSparseMemoryRequirements)
{
GetImageSparseMemoryRequirements2KHR(device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFeatures2(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures2* pFeatures)
{
GetPhysicalDeviceFeatures2KHR(physicalDevice, pFeatures);
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties2* pProperties)
{
GetPhysicalDeviceProperties2KHR(physicalDevice, pProperties);
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties2(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkFormatProperties2* pFormatProperties)
{
GetPhysicalDeviceFormatProperties2KHR(physicalDevice, format, pFormatProperties);
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties2(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo,
VkImageFormatProperties2* pImageFormatProperties)
{
return GetPhysicalDeviceImageFormatProperties2KHR(physicalDevice, pImageFormatInfo, pImageFormatProperties);
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties2(
VkPhysicalDevice physicalDevice,
uint32_t* pQueueFamilyPropertyCount,
VkQueueFamilyProperties2* pQueueFamilyProperties)
{
GetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties2(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceMemoryProperties2* pMemoryProperties)
{
GetPhysicalDeviceMemoryProperties2KHR(physicalDevice, pMemoryProperties);
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties2(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo,
uint32_t* pPropertyCount,
VkSparseImageFormatProperties2* pProperties)
{
GetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice, pFormatInfo, pPropertyCount, pProperties);
}
static VKAPI_ATTR void VKAPI_CALL TrimCommandPool(
VkDevice device,
VkCommandPool commandPool,
VkCommandPoolTrimFlags flags)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL GetDeviceQueue2(
VkDevice device,
const VkDeviceQueueInfo2* pQueueInfo,
VkQueue* pQueue)
{
GetDeviceQueue(device, pQueueInfo->queueFamilyIndex, pQueueInfo->queueIndex, pQueue);
// TODO: Add further support for GetDeviceQueue2 features
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateSamplerYcbcrConversion(
VkDevice device,
const VkSamplerYcbcrConversionCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSamplerYcbcrConversion* pYcbcrConversion)
{
unique_lock_t lock(global_lock);
*pYcbcrConversion = (VkSamplerYcbcrConversion)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroySamplerYcbcrConversion(
VkDevice device,
VkSamplerYcbcrConversion ycbcrConversion,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorUpdateTemplate(
VkDevice device,
const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate)
{
unique_lock_t lock(global_lock);
*pDescriptorUpdateTemplate = (VkDescriptorUpdateTemplate)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyDescriptorUpdateTemplate(
VkDevice device,
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSetWithTemplate(
VkDevice device,
VkDescriptorSet descriptorSet,
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
const void* pData)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalBufferProperties(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo,
VkExternalBufferProperties* pExternalBufferProperties)
{
constexpr VkExternalMemoryHandleTypeFlags supported_flags = 0x1FF;
if (pExternalBufferInfo->handleType & VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID) {
// Can't have dedicated memory with AHB
pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT | VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT;
pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = pExternalBufferInfo->handleType;
pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = pExternalBufferInfo->handleType;
} else if (pExternalBufferInfo->handleType & supported_flags) {
pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0x7;
pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = supported_flags;
pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = supported_flags;
} else {
pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0;
pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = 0;
// According to spec, handle type is always compatible with itself. Even if export/import
// not supported, it's important to properly implement self-compatibility property since
// application's control flow can rely on this.
pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = pExternalBufferInfo->handleType;
}
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalFenceProperties(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo,
VkExternalFenceProperties* pExternalFenceProperties)
{
// Hard-code support for all handle types and features
pExternalFenceProperties->exportFromImportedHandleTypes = 0xF;
pExternalFenceProperties->compatibleHandleTypes = 0xF;
pExternalFenceProperties->externalFenceFeatures = 0x3;
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalSemaphoreProperties(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo,
VkExternalSemaphoreProperties* pExternalSemaphoreProperties)
{
// Hard code support for all handle types and features
pExternalSemaphoreProperties->exportFromImportedHandleTypes = 0x1F;
pExternalSemaphoreProperties->compatibleHandleTypes = 0x1F;
pExternalSemaphoreProperties->externalSemaphoreFeatures = 0x3;
}
static VKAPI_ATTR void VKAPI_CALL GetDescriptorSetLayoutSupport(
VkDevice device,
const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
VkDescriptorSetLayoutSupport* pSupport)
{
if (pSupport) {
pSupport->supported = VK_TRUE;
}
}
static VKAPI_ATTR void VKAPI_CALL CmdDrawIndirectCount(
VkCommandBuffer commandBuffer,
VkBuffer buffer,
VkDeviceSize offset,
VkBuffer countBuffer,
VkDeviceSize countBufferOffset,
uint32_t maxDrawCount,
uint32_t stride)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdDrawIndexedIndirectCount(
VkCommandBuffer commandBuffer,
VkBuffer buffer,
VkDeviceSize offset,
VkBuffer countBuffer,
VkDeviceSize countBufferOffset,
uint32_t maxDrawCount,
uint32_t stride)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass2(
VkDevice device,
const VkRenderPassCreateInfo2* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkRenderPass* pRenderPass)
{
unique_lock_t lock(global_lock);
*pRenderPass = (VkRenderPass)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass2(
VkCommandBuffer commandBuffer,
const VkRenderPassBeginInfo* pRenderPassBegin,
const VkSubpassBeginInfo* pSubpassBeginInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdNextSubpass2(
VkCommandBuffer commandBuffer,
const VkSubpassBeginInfo* pSubpassBeginInfo,
const VkSubpassEndInfo* pSubpassEndInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass2(
VkCommandBuffer commandBuffer,
const VkSubpassEndInfo* pSubpassEndInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL ResetQueryPool(
VkDevice device,
VkQueryPool queryPool,
uint32_t firstQuery,
uint32_t queryCount)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreCounterValue(
VkDevice device,
VkSemaphore semaphore,
uint64_t* pValue)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL WaitSemaphores(
VkDevice device,
const VkSemaphoreWaitInfo* pWaitInfo,
uint64_t timeout)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL SignalSemaphore(
VkDevice device,
const VkSemaphoreSignalInfo* pSignalInfo)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkDeviceAddress VKAPI_CALL GetBufferDeviceAddress(
VkDevice device,
const VkBufferDeviceAddressInfo* pInfo)
{
VkDeviceAddress address = 0;
auto d_iter = buffer_map.find(device);
if (d_iter != buffer_map.end()) {
auto iter = d_iter->second.find(pInfo->buffer);
if (iter != d_iter->second.end()) {
address = iter->second.address;
}
}
return address;
}
static VKAPI_ATTR uint64_t VKAPI_CALL GetBufferOpaqueCaptureAddress(
VkDevice device,
const VkBufferDeviceAddressInfo* pInfo)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR uint64_t VKAPI_CALL GetDeviceMemoryOpaqueCaptureAddress(
VkDevice device,
const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceToolProperties(
VkPhysicalDevice physicalDevice,
uint32_t* pToolCount,
VkPhysicalDeviceToolProperties* pToolProperties)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreatePrivateDataSlot(
VkDevice device,
const VkPrivateDataSlotCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkPrivateDataSlot* pPrivateDataSlot)
{
unique_lock_t lock(global_lock);
*pPrivateDataSlot = (VkPrivateDataSlot)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyPrivateDataSlot(
VkDevice device,
VkPrivateDataSlot privateDataSlot,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL SetPrivateData(
VkDevice device,
VkObjectType objectType,
uint64_t objectHandle,
VkPrivateDataSlot privateDataSlot,
uint64_t data)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL GetPrivateData(
VkDevice device,
VkObjectType objectType,
uint64_t objectHandle,
VkPrivateDataSlot privateDataSlot,
uint64_t* pData)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetEvent2(
VkCommandBuffer commandBuffer,
VkEvent event,
const VkDependencyInfo* pDependencyInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdResetEvent2(
VkCommandBuffer commandBuffer,
VkEvent event,
VkPipelineStageFlags2 stageMask)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdWaitEvents2(
VkCommandBuffer commandBuffer,
uint32_t eventCount,
const VkEvent* pEvents,
const VkDependencyInfo* pDependencyInfos)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdPipelineBarrier2(
VkCommandBuffer commandBuffer,
const VkDependencyInfo* pDependencyInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdWriteTimestamp2(
VkCommandBuffer commandBuffer,
VkPipelineStageFlags2 stage,
VkQueryPool queryPool,
uint32_t query)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR VkResult VKAPI_CALL QueueSubmit2(
VkQueue queue,
uint32_t submitCount,
const VkSubmitInfo2* pSubmits,
VkFence fence)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL CmdCopyBuffer2(
VkCommandBuffer commandBuffer,
const VkCopyBufferInfo2* pCopyBufferInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdCopyImage2(
VkCommandBuffer commandBuffer,
const VkCopyImageInfo2* pCopyImageInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage2(
VkCommandBuffer commandBuffer,
const VkCopyBufferToImageInfo2* pCopyBufferToImageInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer2(
VkCommandBuffer commandBuffer,
const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdBlitImage2(
VkCommandBuffer commandBuffer,
const VkBlitImageInfo2* pBlitImageInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdResolveImage2(
VkCommandBuffer commandBuffer,
const VkResolveImageInfo2* pResolveImageInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdBeginRendering(
VkCommandBuffer commandBuffer,
const VkRenderingInfo* pRenderingInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdEndRendering(
VkCommandBuffer commandBuffer)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetCullMode(
VkCommandBuffer commandBuffer,
VkCullModeFlags cullMode)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetFrontFace(
VkCommandBuffer commandBuffer,
VkFrontFace frontFace)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetPrimitiveTopology(
VkCommandBuffer commandBuffer,
VkPrimitiveTopology primitiveTopology)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetViewportWithCount(
VkCommandBuffer commandBuffer,
uint32_t viewportCount,
const VkViewport* pViewports)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetScissorWithCount(
VkCommandBuffer commandBuffer,
uint32_t scissorCount,
const VkRect2D* pScissors)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers2(
VkCommandBuffer commandBuffer,
uint32_t firstBinding,
uint32_t bindingCount,
const VkBuffer* pBuffers,
const VkDeviceSize* pOffsets,
const VkDeviceSize* pSizes,
const VkDeviceSize* pStrides)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetDepthTestEnable(
VkCommandBuffer commandBuffer,
VkBool32 depthTestEnable)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetDepthWriteEnable(
VkCommandBuffer commandBuffer,
VkBool32 depthWriteEnable)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetDepthCompareOp(
VkCommandBuffer commandBuffer,
VkCompareOp depthCompareOp)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetDepthBoundsTestEnable(
VkCommandBuffer commandBuffer,
VkBool32 depthBoundsTestEnable)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetStencilTestEnable(
VkCommandBuffer commandBuffer,
VkBool32 stencilTestEnable)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetStencilOp(
VkCommandBuffer commandBuffer,
VkStencilFaceFlags faceMask,
VkStencilOp failOp,
VkStencilOp passOp,
VkStencilOp depthFailOp,
VkCompareOp compareOp)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetRasterizerDiscardEnable(
VkCommandBuffer commandBuffer,
VkBool32 rasterizerDiscardEnable)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetDepthBiasEnable(
VkCommandBuffer commandBuffer,
VkBool32 depthBiasEnable)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdSetPrimitiveRestartEnable(
VkCommandBuffer commandBuffer,
VkBool32 primitiveRestartEnable)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL GetDeviceBufferMemoryRequirements(
VkDevice device,
const VkDeviceBufferMemoryRequirements* pInfo,
VkMemoryRequirements2* pMemoryRequirements)
{
// TODO: Just hard-coding reqs for now
pMemoryRequirements->memoryRequirements.alignment = 1;
pMemoryRequirements->memoryRequirements.memoryTypeBits = 0xFFFF;
// Return a size based on the buffer size from the create info.
pMemoryRequirements->memoryRequirements.size = ((pInfo->pCreateInfo->size + 4095) / 4096) * 4096;
}
static VKAPI_ATTR void VKAPI_CALL GetDeviceImageMemoryRequirements(
VkDevice device,
const VkDeviceImageMemoryRequirements* pInfo,
VkMemoryRequirements2* pMemoryRequirements)
{
pMemoryRequirements->memoryRequirements.size = GetImageSizeFromCreateInfo(pInfo->pCreateInfo);
pMemoryRequirements->memoryRequirements.alignment = 1;
// Here we hard-code that the memory type at index 3 doesn't support this image.
pMemoryRequirements->memoryRequirements.memoryTypeBits = 0xFFFF & ~(0x1 << 3);
}
static VKAPI_ATTR void VKAPI_CALL GetDeviceImageSparseMemoryRequirements(
VkDevice device,
const VkDeviceImageMemoryRequirements* pInfo,
uint32_t* pSparseMemoryRequirementCount,
VkSparseImageMemoryRequirements2* pSparseMemoryRequirements)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL DestroySurfaceKHR(
VkInstance instance,
VkSurfaceKHR surface,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex,
VkSurfaceKHR surface,
VkBool32* pSupported)
{
// Currently say that all surface/queue combos are supported
*pSupported = VK_TRUE;
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilitiesKHR(
VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
VkSurfaceCapabilitiesKHR* pSurfaceCapabilities)
{
// In general just say max supported is available for requested surface
pSurfaceCapabilities->minImageCount = 1;
pSurfaceCapabilities->maxImageCount = 0;
pSurfaceCapabilities->currentExtent.width = 0xFFFFFFFF;
pSurfaceCapabilities->currentExtent.height = 0xFFFFFFFF;
pSurfaceCapabilities->minImageExtent.width = 1;
pSurfaceCapabilities->minImageExtent.height = 1;
pSurfaceCapabilities->maxImageExtent.width = 0xFFFF;
pSurfaceCapabilities->maxImageExtent.height = 0xFFFF;
pSurfaceCapabilities->maxImageArrayLayers = 128;
pSurfaceCapabilities->supportedTransforms = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR |
VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR |
VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR |
VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR |
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR |
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR |
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR |
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR |
VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR;
pSurfaceCapabilities->currentTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
pSurfaceCapabilities->supportedCompositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR |
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR |
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR |
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR;
pSurfaceCapabilities->supportedUsageFlags = VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
VK_IMAGE_USAGE_TRANSFER_DST_BIT |
VK_IMAGE_USAGE_SAMPLED_BIT |
VK_IMAGE_USAGE_STORAGE_BIT |
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT |
VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT |
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormatsKHR(
VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
uint32_t* pSurfaceFormatCount,
VkSurfaceFormatKHR* pSurfaceFormats)
{
// Currently always say that RGBA8 & BGRA8 are supported
if (!pSurfaceFormats) {
*pSurfaceFormatCount = 2;
} else {
if (*pSurfaceFormatCount >= 2) {
pSurfaceFormats[1].format = VK_FORMAT_R8G8B8A8_UNORM;
pSurfaceFormats[1].colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
}
if (*pSurfaceFormatCount >= 1) {
pSurfaceFormats[0].format = VK_FORMAT_B8G8R8A8_UNORM;
pSurfaceFormats[0].colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
}
}
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(
VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
uint32_t* pPresentModeCount,
VkPresentModeKHR* pPresentModes)
{
// Currently always say that all present modes are supported
if (!pPresentModes) {
*pPresentModeCount = 6;
} else {
if (*pPresentModeCount >= 6) pPresentModes[5] = VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR;
if (*pPresentModeCount >= 5) pPresentModes[4] = VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR;
if (*pPresentModeCount >= 4) pPresentModes[3] = VK_PRESENT_MODE_FIFO_RELAXED_KHR;
if (*pPresentModeCount >= 3) pPresentModes[2] = VK_PRESENT_MODE_FIFO_KHR;
if (*pPresentModeCount >= 2) pPresentModes[1] = VK_PRESENT_MODE_MAILBOX_KHR;
if (*pPresentModeCount >= 1) pPresentModes[0] = VK_PRESENT_MODE_IMMEDIATE_KHR;
}
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(
VkDevice device,
const VkSwapchainCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSwapchainKHR* pSwapchain)
{
unique_lock_t lock(global_lock);
*pSwapchain = (VkSwapchainKHR)global_unique_handle++;
for(uint32_t i = 0; i < icd_swapchain_image_count; ++i){
swapchain_image_map[*pSwapchain][i] = (VkImage)global_unique_handle++;
}
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroySwapchainKHR(
VkDevice device,
VkSwapchainKHR swapchain,
const VkAllocationCallbacks* pAllocator)
{
unique_lock_t lock(global_lock);
swapchain_image_map.clear();
}
static VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainImagesKHR(
VkDevice device,
VkSwapchainKHR swapchain,
uint32_t* pSwapchainImageCount,
VkImage* pSwapchainImages)
{
if (!pSwapchainImages) {
*pSwapchainImageCount = icd_swapchain_image_count;
} else {
unique_lock_t lock(global_lock);
for (uint32_t img_i = 0; img_i < (std::min)(*pSwapchainImageCount, icd_swapchain_image_count); ++img_i){
pSwapchainImages[img_i] = swapchain_image_map.at(swapchain)[img_i];
}
if (*pSwapchainImageCount < icd_swapchain_image_count) return VK_INCOMPLETE;
else if (*pSwapchainImageCount > icd_swapchain_image_count) *pSwapchainImageCount = icd_swapchain_image_count;
}
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(
VkDevice device,
VkSwapchainKHR swapchain,
uint64_t timeout,
VkSemaphore semaphore,
VkFence fence,
uint32_t* pImageIndex)
{
*pImageIndex = 0;
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(
VkQueue queue,
const VkPresentInfoKHR* pPresentInfo)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetDeviceGroupPresentCapabilitiesKHR(
VkDevice device,
VkDeviceGroupPresentCapabilitiesKHR* pDeviceGroupPresentCapabilities)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetDeviceGroupSurfacePresentModesKHR(
VkDevice device,
VkSurfaceKHR surface,
VkDeviceGroupPresentModeFlagsKHR* pModes)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDevicePresentRectanglesKHR(
VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
uint32_t* pRectCount,
VkRect2D* pRects)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImage2KHR(
VkDevice device,
const VkAcquireNextImageInfoKHR* pAcquireInfo,
uint32_t* pImageIndex)
{
*pImageIndex = 0;
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPropertiesKHR(
VkPhysicalDevice physicalDevice,
uint32_t* pPropertyCount,
VkDisplayPropertiesKHR* pProperties)
{
if (!pProperties) {
*pPropertyCount = 1;
} else {
unique_lock_t lock(global_lock);
pProperties[0].display = (VkDisplayKHR)global_unique_handle++;
display_map[physicalDevice].insert(pProperties[0].display);
}
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceDisplayPlanePropertiesKHR(
VkPhysicalDevice physicalDevice,
uint32_t* pPropertyCount,
VkDisplayPlanePropertiesKHR* pProperties)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneSupportedDisplaysKHR(
VkPhysicalDevice physicalDevice,
uint32_t planeIndex,
uint32_t* pDisplayCount,
VkDisplayKHR* pDisplays)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetDisplayModePropertiesKHR(
VkPhysicalDevice physicalDevice,
VkDisplayKHR display,
uint32_t* pPropertyCount,
VkDisplayModePropertiesKHR* pProperties)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayModeKHR(
VkPhysicalDevice physicalDevice,
VkDisplayKHR display,
const VkDisplayModeCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDisplayModeKHR* pMode)
{
unique_lock_t lock(global_lock);
*pMode = (VkDisplayModeKHR)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetDisplayPlaneCapabilitiesKHR(
VkPhysicalDevice physicalDevice,
VkDisplayModeKHR mode,
uint32_t planeIndex,
VkDisplayPlaneCapabilitiesKHR* pCapabilities)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateDisplayPlaneSurfaceKHR(
VkInstance instance,
const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
unique_lock_t lock(global_lock);
*pSurface = (VkSurfaceKHR)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateSharedSwapchainsKHR(
VkDevice device,
uint32_t swapchainCount,
const VkSwapchainCreateInfoKHR* pCreateInfos,
const VkAllocationCallbacks* pAllocator,
VkSwapchainKHR* pSwapchains)
{
unique_lock_t lock(global_lock);
for (uint32_t i = 0; i < swapchainCount; ++i) {
pSwapchains[i] = (VkSwapchainKHR)global_unique_handle++;
}
return VK_SUCCESS;
}
#ifdef VK_USE_PLATFORM_XLIB_KHR
static VKAPI_ATTR VkResult VKAPI_CALL CreateXlibSurfaceKHR(
VkInstance instance,
const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
unique_lock_t lock(global_lock);
*pSurface = (VkSurfaceKHR)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXlibPresentationSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex,
Display* dpy,
VisualID visualID)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
#endif /* VK_USE_PLATFORM_XLIB_KHR */
#ifdef VK_USE_PLATFORM_XCB_KHR
static VKAPI_ATTR VkResult VKAPI_CALL CreateXcbSurfaceKHR(
VkInstance instance,
const VkXcbSurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
unique_lock_t lock(global_lock);
*pSurface = (VkSurfaceKHR)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceXcbPresentationSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex,
xcb_connection_t* connection,
xcb_visualid_t visual_id)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
#endif /* VK_USE_PLATFORM_XCB_KHR */
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
static VKAPI_ATTR VkResult VKAPI_CALL CreateWaylandSurfaceKHR(
VkInstance instance,
const VkWaylandSurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
unique_lock_t lock(global_lock);
*pSurface = (VkSurfaceKHR)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWaylandPresentationSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex,
struct wl_display* display)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
#endif /* VK_USE_PLATFORM_WAYLAND_KHR */
#ifdef VK_USE_PLATFORM_ANDROID_KHR
static VKAPI_ATTR VkResult VKAPI_CALL CreateAndroidSurfaceKHR(
VkInstance instance,
const VkAndroidSurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
unique_lock_t lock(global_lock);
*pSurface = (VkSurfaceKHR)global_unique_handle++;
return VK_SUCCESS;
}
#endif /* VK_USE_PLATFORM_ANDROID_KHR */
#ifdef VK_USE_PLATFORM_WIN32_KHR
static VKAPI_ATTR VkResult VKAPI_CALL CreateWin32SurfaceKHR(
VkInstance instance,
const VkWin32SurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
unique_lock_t lock(global_lock);
*pSurface = (VkSurfaceKHR)global_unique_handle++;
return VK_SUCCESS;
}
static VKAPI_ATTR VkBool32 VKAPI_CALL GetPhysicalDeviceWin32PresentationSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
#endif /* VK_USE_PLATFORM_WIN32_KHR */
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceVideoCapabilitiesKHR(
VkPhysicalDevice physicalDevice,
const VkVideoProfileInfoKHR* pVideoProfile,
VkVideoCapabilitiesKHR* pCapabilities)
{
// We include some reasonable set of capability combinations to cover a wide range of use cases
auto caps = pCapabilities;
auto caps_decode = lvl_find_mod_in_chain<VkVideoDecodeCapabilitiesKHR>(pCapabilities->pNext);
auto caps_decode_h264 = lvl_find_mod_in_chain<VkVideoDecodeH264CapabilitiesKHR>(pCapabilities->pNext);
auto caps_decode_h265 = lvl_find_mod_in_chain<VkVideoDecodeH265CapabilitiesKHR>(pCapabilities->pNext);
auto caps_decode_av1 = lvl_find_mod_in_chain<VkVideoDecodeAV1CapabilitiesKHR>(pCapabilities->pNext);
auto caps_encode = lvl_find_mod_in_chain<VkVideoEncodeCapabilitiesKHR>(pCapabilities->pNext);
auto caps_encode_h264 = lvl_find_mod_in_chain<VkVideoEncodeH264CapabilitiesKHR>(pCapabilities->pNext);
auto caps_encode_h265 = lvl_find_mod_in_chain<VkVideoEncodeH265CapabilitiesKHR>(pCapabilities->pNext);
switch (pVideoProfile->videoCodecOperation) {
case VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR: {
auto profile = lvl_find_in_chain<VkVideoDecodeH264ProfileInfoKHR>(pVideoProfile->pNext);
if (profile->stdProfileIdc != STD_VIDEO_H264_PROFILE_IDC_BASELINE &&
profile->stdProfileIdc != STD_VIDEO_H264_PROFILE_IDC_MAIN) {
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
caps->flags = VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR;
caps->minBitstreamBufferOffsetAlignment = 256;
caps->minBitstreamBufferSizeAlignment = 256;
caps->pictureAccessGranularity = {16,16};
caps->minCodedExtent = {16,16};
caps->maxCodedExtent = {1920,1080};
caps->maxDpbSlots = 33;
caps->maxActiveReferencePictures = 32;
std::strncpy(caps->stdHeaderVersion.extensionName, VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME,
sizeof(caps->stdHeaderVersion.extensionName));
caps->stdHeaderVersion.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION;
switch (pVideoProfile->chromaSubsampling) {
case VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR:
if (profile->pictureLayout != VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR) {
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
caps_decode->flags = VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR;
caps_decode_h264->maxLevelIdc = STD_VIDEO_H264_LEVEL_IDC_6_2;
caps_decode_h264->fieldOffsetGranularity = {0,0};
break;
case VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR:
if (profile->pictureLayout != VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR &&
profile->pictureLayout != VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR) {
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
caps_decode->flags = VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR;
caps_decode_h264->maxLevelIdc = STD_VIDEO_H264_LEVEL_IDC_5_0;
caps_decode_h264->fieldOffsetGranularity = {0,16};
break;
case VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR:
if (profile->pictureLayout != VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR &&
profile->pictureLayout != VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR) {
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
caps_decode->flags = VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR
| VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR;
caps_decode_h264->maxLevelIdc = STD_VIDEO_H264_LEVEL_IDC_3_2;
caps_decode_h264->fieldOffsetGranularity = {0,1};
break;
default:
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
break;
}
case VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR: {
auto profile = lvl_find_in_chain<VkVideoDecodeH265ProfileInfoKHR>(pVideoProfile->pNext);
if (profile->stdProfileIdc != STD_VIDEO_H265_PROFILE_IDC_MAIN) {
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
caps->flags = VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR;
caps->minBitstreamBufferOffsetAlignment = 64;
caps->minBitstreamBufferSizeAlignment = 64;
caps->pictureAccessGranularity = {32,32};
caps->minCodedExtent = {48,48};
caps->maxCodedExtent = {3840,2160};
caps->maxDpbSlots = 16;
caps->maxActiveReferencePictures = 15;
std::strncpy(caps->stdHeaderVersion.extensionName, VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME,
sizeof(caps->stdHeaderVersion.extensionName));
caps->stdHeaderVersion.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION;
switch (pVideoProfile->chromaSubsampling) {
case VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR:
caps_decode->flags = VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR;
caps_decode_h265->maxLevelIdc = STD_VIDEO_H265_LEVEL_IDC_6_0;
break;
case VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR:
caps_decode->flags = VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR;
caps_decode_h265->maxLevelIdc = STD_VIDEO_H265_LEVEL_IDC_5_2;
break;
case VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR:
caps_decode->flags = VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR
| VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR;
caps_decode_h265->maxLevelIdc = STD_VIDEO_H265_LEVEL_IDC_4_1;
break;
default:
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
break;
}
case VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR: {
auto profile = lvl_find_in_chain<VkVideoDecodeAV1ProfileInfoKHR>(pVideoProfile->pNext);
if (profile->stdProfile != STD_VIDEO_AV1_PROFILE_MAIN) {
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
caps->flags = VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR;
caps->minBitstreamBufferOffsetAlignment = 256;
caps->minBitstreamBufferSizeAlignment = 256;
caps->pictureAccessGranularity = {16,16};
caps->minCodedExtent = {16,16};
caps->maxCodedExtent = {1920,1080};
caps->maxDpbSlots = 8;
caps->maxActiveReferencePictures = 7;
std::strncpy(caps->stdHeaderVersion.extensionName, VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_EXTENSION_NAME,
sizeof(caps->stdHeaderVersion.extensionName));
caps->stdHeaderVersion.specVersion = VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION;
switch (pVideoProfile->chromaSubsampling) {
case VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR:
caps_decode->flags = VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR;
caps_decode_av1->maxLevel = STD_VIDEO_AV1_LEVEL_6_2;
break;
case VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR:
if (profile->filmGrainSupport) {
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
caps_decode->flags = VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR;
caps_decode_av1->maxLevel = STD_VIDEO_AV1_LEVEL_5_0;
break;
case VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR:
caps_decode->flags = VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR
| VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR;
caps_decode_av1->maxLevel = STD_VIDEO_AV1_LEVEL_3_2;
break;
default:
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
break;
}
case VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR: {
auto profile = lvl_find_in_chain<VkVideoEncodeH264ProfileInfoKHR>(pVideoProfile->pNext);
if (profile->stdProfileIdc != STD_VIDEO_H264_PROFILE_IDC_BASELINE) {
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
caps->flags = VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR;
caps->minBitstreamBufferOffsetAlignment = 4096;
caps->minBitstreamBufferSizeAlignment = 4096;
caps->pictureAccessGranularity = {16,16};
caps->minCodedExtent = {160,128};
caps->maxCodedExtent = {1920,1080};
caps->maxDpbSlots = 10;
caps->maxActiveReferencePictures = 4;
std::strncpy(caps->stdHeaderVersion.extensionName, VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME,
sizeof(caps->stdHeaderVersion.extensionName));
caps->stdHeaderVersion.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION;
switch (pVideoProfile->chromaSubsampling) {
case VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR:
caps_encode->flags = VK_VIDEO_ENCODE_CAPABILITY_PRECEDING_EXTERNALLY_ENCODED_BYTES_BIT_KHR;
caps_encode->rateControlModes = VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR
| VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR
| VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR;
caps_encode->maxRateControlLayers = 4;
caps_encode->maxBitrate = 800000000;
caps_encode->maxQualityLevels = 4;
caps_encode->encodeInputPictureGranularity = {16,16};
caps_encode->supportedEncodeFeedbackFlags = VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR
| VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR
| VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_HAS_OVERRIDES_BIT_KHR;
caps_encode_h264->flags = VK_VIDEO_ENCODE_H264_CAPABILITY_HRD_COMPLIANCE_BIT_KHR
| VK_VIDEO_ENCODE_H264_CAPABILITY_PREDICTION_WEIGHT_TABLE_GENERATED_BIT_KHR
| VK_VIDEO_ENCODE_H264_CAPABILITY_ROW_UNALIGNED_SLICE_BIT_KHR
| VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L0_LIST_BIT_KHR
| VK_VIDEO_ENCODE_H264_CAPABILITY_PER_PICTURE_TYPE_MIN_MAX_QP_BIT_KHR
| VK_VIDEO_ENCODE_H264_CAPABILITY_GENERATE_PREFIX_NALU_BIT_KHR;
caps_encode_h264->maxLevelIdc = STD_VIDEO_H264_LEVEL_IDC_6_2;
caps_encode_h264->maxSliceCount = 8;
caps_encode_h264->maxPPictureL0ReferenceCount = 4;
caps_encode_h264->maxBPictureL0ReferenceCount = 3;
caps_encode_h264->maxL1ReferenceCount = 2;
caps_encode_h264->maxTemporalLayerCount = 4;
caps_encode_h264->expectDyadicTemporalLayerPattern = VK_FALSE;
caps_encode_h264->minQp = 0;
caps_encode_h264->maxQp = 51;
caps_encode_h264->prefersGopRemainingFrames = VK_FALSE;
caps_encode_h264->requiresGopRemainingFrames = VK_FALSE;
break;
case VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR:
caps_encode->flags = VK_VIDEO_ENCODE_CAPABILITY_PRECEDING_EXTERNALLY_ENCODED_BYTES_BIT_KHR;
caps_encode->rateControlModes = VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR
| VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR;
caps_encode->maxRateControlLayers = 1;
caps_encode->maxBitrate = 480000000;
caps_encode->maxQualityLevels = 3;
caps_encode->encodeInputPictureGranularity = {32,32};
caps_encode->supportedEncodeFeedbackFlags = VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR
| VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR;
caps_encode_h264->flags = VK_VIDEO_ENCODE_H264_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_KHR
| VK_VIDEO_ENCODE_H264_CAPABILITY_PER_SLICE_CONSTANT_QP_BIT_KHR
| VK_VIDEO_ENCODE_H264_CAPABILITY_GENERATE_PREFIX_NALU_BIT_KHR;
caps_encode_h264->maxLevelIdc = STD_VIDEO_H264_LEVEL_IDC_6_1;
caps_encode_h264->maxSliceCount = 4;
caps_encode_h264->maxPPictureL0ReferenceCount = 4;
caps_encode_h264->maxBPictureL0ReferenceCount = 0;
caps_encode_h264->maxL1ReferenceCount = 0;
caps_encode_h264->maxTemporalLayerCount = 4;
caps_encode_h264->expectDyadicTemporalLayerPattern = VK_TRUE;
caps_encode_h264->minQp = 0;
caps_encode_h264->maxQp = 30;
caps_encode_h264->prefersGopRemainingFrames = VK_TRUE;
caps_encode_h264->requiresGopRemainingFrames = VK_FALSE;
break;
case VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR:
caps_encode->flags = 0;
caps_encode->rateControlModes = VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR;
caps_encode->maxRateControlLayers = 1;
caps_encode->maxBitrate = 240000000;
caps_encode->maxQualityLevels = 1;
caps_encode->encodeInputPictureGranularity = {1,1};
caps_encode->supportedEncodeFeedbackFlags = VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR
| VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR;
caps_encode_h264->flags = VK_VIDEO_ENCODE_H264_CAPABILITY_ROW_UNALIGNED_SLICE_BIT_KHR
| VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_KHR
| VK_VIDEO_ENCODE_H264_CAPABILITY_PER_PICTURE_TYPE_MIN_MAX_QP_BIT_KHR;
caps_encode_h264->maxLevelIdc = STD_VIDEO_H264_LEVEL_IDC_5_1;
caps_encode_h264->maxSliceCount = 1;
caps_encode_h264->maxPPictureL0ReferenceCount = 0;
caps_encode_h264->maxBPictureL0ReferenceCount = 2;
caps_encode_h264->maxL1ReferenceCount = 2;
caps_encode_h264->maxTemporalLayerCount = 1;
caps_encode_h264->expectDyadicTemporalLayerPattern = VK_FALSE;
caps_encode_h264->minQp = 5;
caps_encode_h264->maxQp = 40;
caps_encode_h264->prefersGopRemainingFrames = VK_TRUE;
caps_encode_h264->requiresGopRemainingFrames = VK_TRUE;
break;
default:
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
break;
}
case VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR: {
auto profile = lvl_find_in_chain<VkVideoEncodeH265ProfileInfoKHR>(pVideoProfile->pNext);
if (profile->stdProfileIdc != STD_VIDEO_H265_PROFILE_IDC_MAIN) {
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
caps->flags = VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR;
caps->minBitstreamBufferOffsetAlignment = 1;
caps->minBitstreamBufferSizeAlignment = 1;
caps->pictureAccessGranularity = {8,8};
caps->minCodedExtent = {64,48};
caps->maxCodedExtent = {4096,2560};
caps->maxDpbSlots = 8;
caps->maxActiveReferencePictures = 2;
std::strncpy(caps->stdHeaderVersion.extensionName, VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME, sizeof(caps->stdHeaderVersion.extensionName));
caps->stdHeaderVersion.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_SPEC_VERSION;
switch (pVideoProfile->chromaSubsampling) {
case VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR:
caps_encode->flags = 0;
caps_encode->rateControlModes = VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR;
caps_encode->maxRateControlLayers = 1;
caps_encode->maxBitrate = 800000000;
caps_encode->maxQualityLevels = 1;
caps_encode->encodeInputPictureGranularity = {64,64};
caps_encode->supportedEncodeFeedbackFlags = VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR
| VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR;
caps_encode_h265->flags = VK_VIDEO_ENCODE_H265_CAPABILITY_HRD_COMPLIANCE_BIT_KHR
| VK_VIDEO_ENCODE_H265_CAPABILITY_PREDICTION_WEIGHT_TABLE_GENERATED_BIT_KHR
| VK_VIDEO_ENCODE_H265_CAPABILITY_ROW_UNALIGNED_SLICE_SEGMENT_BIT_KHR
| VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L0_LIST_BIT_KHR
| VK_VIDEO_ENCODE_H265_CAPABILITY_PER_SLICE_SEGMENT_CONSTANT_QP_BIT_KHR
| VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_SLICE_SEGMENTS_PER_TILE_BIT_KHR;
caps_encode_h265->maxLevelIdc = STD_VIDEO_H265_LEVEL_IDC_6_2;
caps_encode_h265->maxSliceSegmentCount = 8;
caps_encode_h265->maxTiles = {1,1};
caps_encode_h265->ctbSizes = VK_VIDEO_ENCODE_H265_CTB_SIZE_32_BIT_KHR
| VK_VIDEO_ENCODE_H265_CTB_SIZE_64_BIT_KHR;
caps_encode_h265->transformBlockSizes = VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_4_BIT_KHR
| VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_8_BIT_KHR
| VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_32_BIT_KHR;
caps_encode_h265->maxPPictureL0ReferenceCount = 4;
caps_encode_h265->maxBPictureL0ReferenceCount = 3;
caps_encode_h265->maxL1ReferenceCount = 2;
caps_encode_h265->maxSubLayerCount = 1;
caps_encode_h265->expectDyadicTemporalSubLayerPattern = VK_FALSE;
caps_encode_h265->minQp = 16;
caps_encode_h265->maxQp = 32;
caps_encode_h265->prefersGopRemainingFrames = VK_FALSE;
caps_encode_h265->requiresGopRemainingFrames = VK_FALSE;
break;
case VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR:
caps_encode->flags = 0;
caps_encode->rateControlModes = VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR;
caps_encode->maxRateControlLayers = 0;
caps_encode->maxBitrate = 480000000;
caps_encode->maxQualityLevels = 2;
caps_encode->encodeInputPictureGranularity = {32,32};
caps_encode->supportedEncodeFeedbackFlags = VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR
| VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR;
caps_encode_h265->flags = VK_VIDEO_ENCODE_H265_CAPABILITY_DIFFERENT_SLICE_SEGMENT_TYPE_BIT_KHR;
caps_encode_h265->maxLevelIdc = STD_VIDEO_H265_LEVEL_IDC_6_1;
caps_encode_h265->maxSliceSegmentCount = 4;
caps_encode_h265->maxTiles = {2,2};
caps_encode_h265->ctbSizes = VK_VIDEO_ENCODE_H265_CTB_SIZE_16_BIT_KHR
| VK_VIDEO_ENCODE_H265_CTB_SIZE_64_BIT_KHR;
caps_encode_h265->transformBlockSizes = VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_8_BIT_KHR
| VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_16_BIT_KHR
| VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_32_BIT_KHR;
caps_encode_h265->maxPPictureL0ReferenceCount = 4;
caps_encode_h265->maxBPictureL0ReferenceCount = 0;
caps_encode_h265->maxL1ReferenceCount = 0;
caps_encode_h265->maxSubLayerCount = 1;
caps_encode_h265->expectDyadicTemporalSubLayerPattern = VK_FALSE;
caps_encode_h265->minQp = 0;
caps_encode_h265->maxQp = 51;
caps_encode_h265->prefersGopRemainingFrames = VK_TRUE;
caps_encode_h265->requiresGopRemainingFrames = VK_FALSE;
break;
case VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR:
caps_encode->flags = VK_VIDEO_ENCODE_CAPABILITY_PRECEDING_EXTERNALLY_ENCODED_BYTES_BIT_KHR;
caps_encode->rateControlModes = VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR
| VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR
| VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR;
caps_encode->maxRateControlLayers = 2;
caps_encode->maxBitrate = 240000000;
caps_encode->maxQualityLevels = 3;
caps_encode->encodeInputPictureGranularity = {16,16};
caps_encode->supportedEncodeFeedbackFlags = VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR
| VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR
| VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_HAS_OVERRIDES_BIT_KHR;
caps_encode_h265->flags = VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_KHR
| VK_VIDEO_ENCODE_H265_CAPABILITY_PER_PICTURE_TYPE_MIN_MAX_QP_BIT_KHR
| VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILES_PER_SLICE_SEGMENT_BIT_KHR;
caps_encode_h265->maxLevelIdc = STD_VIDEO_H265_LEVEL_IDC_5_1;
caps_encode_h265->maxSliceSegmentCount = 1;
caps_encode_h265->maxTiles = {2,2};
caps_encode_h265->ctbSizes = VK_VIDEO_ENCODE_H265_CTB_SIZE_32_BIT_KHR;
caps_encode_h265->transformBlockSizes = VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_32_BIT_KHR;
caps_encode_h265->maxPPictureL0ReferenceCount = 0;
caps_encode_h265->maxBPictureL0ReferenceCount = 2;
caps_encode_h265->maxL1ReferenceCount = 2;
caps_encode_h265->maxSubLayerCount = 4;
caps_encode_h265->expectDyadicTemporalSubLayerPattern = VK_TRUE;
caps_encode_h265->minQp = 16;
caps_encode_h265->maxQp = 51;
caps_encode_h265->prefersGopRemainingFrames = VK_TRUE;
caps_encode_h265->requiresGopRemainingFrames = VK_TRUE;
break;
default:
return VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR;
}
break;
}
default:
break;
}
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceVideoFormatPropertiesKHR(