blob: d35c6c78725d4f34c2dc0cef7d2f1b2205e4a4fb [file] [log] [blame]
/*
** Copyright (c) 2015-2018 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.
**
*/
#include "mock_icd.h"
#include <stdlib.h>
#include <algorithm>
#include <array>
#include <vector>
#include "vk_typemap_helper.h"
namespace vkmock {
using std::unordered_map;
static constexpr uint32_t icd_physical_device_count = 1;
static constexpr uint32_t kSupportedVulkanAPIVersion = VK_API_VERSION_1_1;
static unordered_map<VkInstance, std::array<VkPhysicalDevice, icd_physical_device_count>> physical_device_map;
// Map device memory handle to any mapped allocations that we'll need to free on unmap
static unordered_map<VkDeviceMemory, std::vector<void*>> mapped_memory_map;
// Map device memory allocation handle to the size
static unordered_map<VkDeviceMemory, VkDeviceSize> allocated_memory_size_map;
static unordered_map<VkDevice, unordered_map<uint32_t, unordered_map<uint32_t, VkQueue>>> queue_map;
static unordered_map<VkDevice, unordered_map<VkBuffer, VkBufferCreateInfo>> buffer_map;
static unordered_map<VkDevice, unordered_map<VkImage, VkDeviceSize>> image_memory_size_map;
static constexpr uint32_t icd_swapchain_image_count = 1;
static unordered_map<VkSwapchainKHR, VkImage[icd_swapchain_image_count]> swapchain_image_map;
// TODO: Would like to codegen this but limits aren't in XML
static VkPhysicalDeviceLimits SetLimits(VkPhysicalDeviceLimits *limits) {
limits->maxImageDimension1D = 4096;
limits->maxImageDimension2D = 4096;
limits->maxImageDimension3D = 256;
limits->maxImageDimensionCube = 4096;
limits->maxImageArrayLayers = 256;
limits->maxTexelBufferElements = 65536;
limits->maxUniformBufferRange = 16384;
limits->maxStorageBufferRange = 134217728;
limits->maxPushConstantsSize = 128;
limits->maxMemoryAllocationCount = 4096;
limits->maxSamplerAllocationCount = 4000;
limits->bufferImageGranularity = 1;
limits->sparseAddressSpaceSize = 2147483648;
limits->maxBoundDescriptorSets = 4;
limits->maxPerStageDescriptorSamplers = 16;
limits->maxPerStageDescriptorUniformBuffers = 12;
limits->maxPerStageDescriptorStorageBuffers = 4;
limits->maxPerStageDescriptorSampledImages = 16;
limits->maxPerStageDescriptorStorageImages = 4;
limits->maxPerStageDescriptorInputAttachments = 4;
limits->maxPerStageResources = 128;
limits->maxDescriptorSetSamplers = 96;
limits->maxDescriptorSetUniformBuffers = 72;
limits->maxDescriptorSetUniformBuffersDynamic = 8;
limits->maxDescriptorSetStorageBuffers = 24;
limits->maxDescriptorSetStorageBuffersDynamic = 4;
limits->maxDescriptorSetSampledImages = 96;
limits->maxDescriptorSetStorageImages = 24;
limits->maxDescriptorSetInputAttachments = 4;
limits->maxVertexInputAttributes = 16;
limits->maxVertexInputBindings = 16;
limits->maxVertexInputAttributeOffset = 2047;
limits->maxVertexInputBindingStride = 2048;
limits->maxVertexOutputComponents = 64;
limits->maxTessellationGenerationLevel = 64;
limits->maxTessellationPatchSize = 32;
limits->maxTessellationControlPerVertexInputComponents = 64;
limits->maxTessellationControlPerVertexOutputComponents = 64;
limits->maxTessellationControlPerPatchOutputComponents = 120;
limits->maxTessellationControlTotalOutputComponents = 2048;
limits->maxTessellationEvaluationInputComponents = 64;
limits->maxTessellationEvaluationOutputComponents = 64;
limits->maxGeometryShaderInvocations = 32;
limits->maxGeometryInputComponents = 64;
limits->maxGeometryOutputComponents = 64;
limits->maxGeometryOutputVertices = 256;
limits->maxGeometryTotalOutputComponents = 1024;
limits->maxFragmentInputComponents = 64;
limits->maxFragmentOutputAttachments = 4;
limits->maxFragmentDualSrcAttachments = 1;
limits->maxFragmentCombinedOutputResources = 4;
limits->maxComputeSharedMemorySize = 16384;
limits->maxComputeWorkGroupCount[0] = 65535;
limits->maxComputeWorkGroupCount[1] = 65535;
limits->maxComputeWorkGroupCount[2] = 65535;
limits->maxComputeWorkGroupInvocations = 128;
limits->maxComputeWorkGroupSize[0] = 128;
limits->maxComputeWorkGroupSize[1] = 128;
limits->maxComputeWorkGroupSize[2] = 64;
limits->subPixelPrecisionBits = 4;
limits->subTexelPrecisionBits = 4;
limits->mipmapPrecisionBits = 4;
limits->maxDrawIndexedIndexValue = UINT32_MAX;
limits->maxDrawIndirectCount = UINT16_MAX;
limits->maxSamplerLodBias = 2.0f;
limits->maxSamplerAnisotropy = 16;
limits->maxViewports = 16;
limits->maxViewportDimensions[0] = 4096;
limits->maxViewportDimensions[1] = 4096;
limits->viewportBoundsRange[0] = -8192;
limits->viewportBoundsRange[1] = 8191;
limits->viewportSubPixelBits = 0;
limits->minMemoryMapAlignment = 64;
limits->minTexelBufferOffsetAlignment = 16;
limits->minUniformBufferOffsetAlignment = 16;
limits->minStorageBufferOffsetAlignment = 16;
limits->minTexelOffset = -8;
limits->maxTexelOffset = 7;
limits->minTexelGatherOffset = -8;
limits->maxTexelGatherOffset = 7;
limits->minInterpolationOffset = 0.0f;
limits->maxInterpolationOffset = 0.5f;
limits->subPixelInterpolationOffsetBits = 4;
limits->maxFramebufferWidth = 4096;
limits->maxFramebufferHeight = 4096;
limits->maxFramebufferLayers = 256;
limits->framebufferColorSampleCounts = 0x7F;
limits->framebufferDepthSampleCounts = 0x7F;
limits->framebufferStencilSampleCounts = 0x7F;
limits->framebufferNoAttachmentsSampleCounts = 0x7F;
limits->maxColorAttachments = 4;
limits->sampledImageColorSampleCounts = 0x7F;
limits->sampledImageIntegerSampleCounts = 0x7F;
limits->sampledImageDepthSampleCounts = 0x7F;
limits->sampledImageStencilSampleCounts = 0x7F;
limits->storageImageSampleCounts = 0x7F;
limits->maxSampleMaskWords = 1;
limits->timestampComputeAndGraphics = VK_TRUE;
limits->timestampPeriod = 1;
limits->maxClipDistances = 8;
limits->maxCullDistances = 8;
limits->maxCombinedClipAndCullDistances = 8;
limits->discreteQueuePriorities = 2;
limits->pointSizeRange[0] = 1.0f;
limits->pointSizeRange[1] = 64.0f;
limits->lineWidthRange[0] = 1.0f;
limits->lineWidthRange[1] = 8.0f;
limits->pointSizeGranularity = 1.0f;
limits->lineWidthGranularity = 1.0f;
limits->strictLines = VK_TRUE;
limits->standardSampleLocations = VK_TRUE;
limits->optimalBufferCopyOffsetAlignment = 1;
limits->optimalBufferCopyRowPitchAlignment = 1;
limits->nonCoherentAtomSize = 256;
return *limits;
}
void SetBoolArrayTrue(VkBool32* bool_array, uint32_t num_bools)
{
for (uint32_t i = 0; i < num_bools; ++i) {
bool_array[i] = VK_TRUE;
}
}
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))
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 {
// TODO: Just returning full support for everything initially
*pFormatProperties = { 0x00FFFFFF, 0x00FFFFFF, 0x00FFFFFF };
}
}
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)
{
// TODO: Just hard-coding some values for now
pProperties->apiVersion = kSupportedVulkanAPIVersion;
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) {
*pQueueFamilyPropertyCount = 1;
} else {
if (*pQueueFamilyPropertyCount) {
pQueueFamilyProperties[0].queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT | VK_QUEUE_SPARSE_BINDING_BIT;
pQueueFamilyProperties[0].queueCount = 1;
pQueueFamilyProperties[0].timestampValidBits = 0;
pQueueFamilyProperties[0].minImageTransferGranularity = {1,1,1};
}
}
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceMemoryProperties* pMemoryProperties)
{
pMemoryProperties->memoryTypeCount = 2;
pMemoryProperties->memoryTypes[0].propertyFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
pMemoryProperties->memoryTypes[0].heapIndex = 0;
pMemoryProperties->memoryTypes[1].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[1].heapIndex = 1;
pMemoryProperties->memoryHeapCount = 2;
pMemoryProperties->memoryHeaps[0].flags = 0;
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 dev_queue_map_pair : queue_map) {
for (auto queue_family_map_pair : queue_map[dev_queue_map_pair.first]) {
for (auto index_queue_pair : queue_map[dev_queue_map_pair.first][queue_family_map_pair.first]) {
DestroyDispObjHandle((void*)index_queue_pair.second);
}
}
}
queue_map.clear();
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)
{
//Not a CREATE or DESTROY function
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
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.
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;
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)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkImageType type,
VkSampleCountFlagBits samples,
VkImageUsageFlags usage,
VkImageTiling tiling,
uint32_t* pPropertyCount,
VkSparseImageFormatProperties* pProperties)
{
//Not a CREATE or DESTROY function
}
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;
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++;
// TODO: A pixel size is 32 bytes. This accounts for the largest possible pixel size of any format. It could be changed to more accurate size if need be.
image_memory_size_map[device][*pImage] = pCreateInfo->extent.width * pCreateInfo->extent.height * pCreateInfo->extent.depth *
32 * pCreateInfo->arrayLayers * (pCreateInfo->mipLevels > 1 ? 2 : 1);
// plane count
switch (pCreateInfo->format) {
case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:
case VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM:
case VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16:
case VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM:
case VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM:
case VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM:
image_memory_size_map[device][*pImage] *= 3;
break;
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
case VK_FORMAT_G8_B8R8_2PLANE_422_UNORM:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16:
case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM:
case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM:
image_memory_size_map[device][*pImage] *= 2;
break;
default:
break;
}
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)
{
//Not a CREATE or DESTROY function
}
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++;
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL DestroyCommandPool(
VkDevice device,
VkCommandPool commandPool,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
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();
}
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL FreeCommandBuffers(
VkDevice device,
VkCommandPool commandPool,
uint32_t commandBufferCount,
const VkCommandBuffer* pCommandBuffers)
{
//Destroy object
}
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 = kSupportedVulkanAPIVersion;
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)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
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)
{
//Not a CREATE or DESTROY function
}
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)
{
//Not a CREATE or DESTROY function
}
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)
{
// Hard-code support for all handle types and features
pExternalBufferProperties->externalMemoryProperties.externalMemoryFeatures = 0x7;
pExternalBufferProperties->externalMemoryProperties.exportFromImportedHandleTypes = 0x1FF;
pExternalBufferProperties->externalMemoryProperties.compatibleHandleTypes = 0x1FF;
}
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)
{
//Not a CREATE or DESTROY function
}
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)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
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 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 = 3840;
pSurfaceCapabilities->maxImageExtent.height = 2160;
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 {
// Intentionally falling through and just filling however many types are requested
switch(*pSurfaceFormatCount) {
case 2:
pSurfaceFormats[1].format = VK_FORMAT_R8G8B8A8_UNORM;
pSurfaceFormats[1].colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
// fall through
default:
pSurfaceFormats[0].format = VK_FORMAT_B8G8R8A8_UNORM;
pSurfaceFormats[0].colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
break;
}
}
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 {
// Intentionally falling through and just filling however many modes are requested
switch(*pPresentModeCount) {
case 6:
pPresentModes[5] = VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR;
// fall through
case 5:
pPresentModes[4] = VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR;
// fall through
case 4:
pPresentModes[3] = VK_PRESENT_MODE_FIFO_RELAXED_KHR;
// fall through
case 3:
pPresentModes[2] = VK_PRESENT_MODE_FIFO_KHR;
// fall through
case 2:
pPresentModes[1] = VK_PRESENT_MODE_MAILBOX_KHR;
// fall through
default:
pPresentModes[0] = VK_PRESENT_MODE_IMMEDIATE_KHR;
break;
}
}
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)
{
//Not a CREATE or DESTROY function
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 void VKAPI_CALL GetPhysicalDeviceFeatures2KHR(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures2* pFeatures)
{
GetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features);
uint32_t num_bools = 0; // Count number of VkBool32s in extension structs
VkBool32* feat_bools = nullptr;
const auto *desc_idx_features = lvl_find_in_chain<VkPhysicalDeviceDescriptorIndexingFeaturesEXT>(pFeatures->pNext);
if (desc_idx_features) {
const auto bool_size = sizeof(VkPhysicalDeviceDescriptorIndexingFeaturesEXT) - offsetof(VkPhysicalDeviceDescriptorIndexingFeaturesEXT, shaderInputAttachmentArrayDynamicIndexing);
num_bools = bool_size/sizeof(VkBool32);
feat_bools = (VkBool32*)&desc_idx_features->shaderInputAttachmentArrayDynamicIndexing;
SetBoolArrayTrue(feat_bools, num_bools);
}
const auto *blendop_features = lvl_find_in_chain<VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT>(pFeatures->pNext);
if (blendop_features) {
const auto bool_size = sizeof(VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT) - offsetof(VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT, advancedBlendCoherentOperations);
num_bools = bool_size/sizeof(VkBool32);
feat_bools = (VkBool32*)&blendop_features->advancedBlendCoherentOperations;
SetBoolArrayTrue(feat_bools, num_bools);
}
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties2KHR(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties2* pProperties)
{
GetPhysicalDeviceProperties(physicalDevice, &pProperties->properties);
const auto *desc_idx_props = lvl_find_in_chain<VkPhysicalDeviceDescriptorIndexingPropertiesEXT>(pProperties->pNext);
if (desc_idx_props) {
VkPhysicalDeviceDescriptorIndexingPropertiesEXT* write_props = (VkPhysicalDeviceDescriptorIndexingPropertiesEXT*)desc_idx_props;
write_props->maxUpdateAfterBindDescriptorsInAllPools = 500000;
write_props->shaderUniformBufferArrayNonUniformIndexingNative = false;
write_props->shaderSampledImageArrayNonUniformIndexingNative = false;
write_props->shaderStorageBufferArrayNonUniformIndexingNative = false;
write_props->shaderStorageImageArrayNonUniformIndexingNative = false;
write_props->shaderInputAttachmentArrayNonUniformIndexingNative = false;
write_props->robustBufferAccessUpdateAfterBind = true;
write_props->quadDivergentImplicitLod = true;
write_props->maxPerStageDescriptorUpdateAfterBindSamplers = 500000;
write_props->maxPerStageDescriptorUpdateAfterBindUniformBuffers = 500000;
write_props->maxPerStageDescriptorUpdateAfterBindStorageBuffers = 500000;
write_props->maxPerStageDescriptorUpdateAfterBindSampledImages = 500000;
write_props->maxPerStageDescriptorUpdateAfterBindStorageImages = 500000;
write_props->maxPerStageDescriptorUpdateAfterBindInputAttachments = 500000;
write_props->maxPerStageUpdateAfterBindResources = 500000;
write_props->maxDescriptorSetUpdateAfterBindSamplers = 500000;
write_props->maxDescriptorSetUpdateAfterBindUniformBuffers = 96;
write_props->maxDescriptorSetUpdateAfterBindUniformBuffersDynamic = 8;
write_props->maxDescriptorSetUpdateAfterBindStorageBuffers = 500000;
write_props->maxDescriptorSetUpdateAfterBindStorageBuffersDynamic = 4;
write_props->maxDescriptorSetUpdateAfterBindSampledImages = 500000;
write_props->maxDescriptorSetUpdateAfterBindStorageImages = 500000;
write_props->maxDescriptorSetUpdateAfterBindInputAttachments = 500000;
}
const auto *push_descriptor_props = lvl_find_in_chain<VkPhysicalDevicePushDescriptorPropertiesKHR>(pProperties->pNext);
if (push_descriptor_props) {
VkPhysicalDevicePushDescriptorPropertiesKHR* write_props = (VkPhysicalDevicePushDescriptorPropertiesKHR*)push_descriptor_props;
write_props->maxPushDescriptors = 256;
}
const auto *depth_stencil_resolve_props = lvl_find_in_chain<VkPhysicalDeviceDepthStencilResolvePropertiesKHR>(pProperties->pNext);
if (depth_stencil_resolve_props) {
VkPhysicalDeviceDepthStencilResolvePropertiesKHR* write_props = (VkPhysicalDeviceDepthStencilResolvePropertiesKHR*)depth_stencil_resolve_props;
write_props->supportedDepthResolveModes = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR;
write_props->supportedStencilResolveModes = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR;
}
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceFormatProperties2KHR(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkFormatProperties2* pFormatProperties)
{
GetPhysicalDeviceFormatProperties(physicalDevice, format, &pFormatProperties->formatProperties);
}
static VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceImageFormatProperties2KHR(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo,
VkImageFormatProperties2* pImageFormatProperties)
{
GetPhysicalDeviceImageFormatProperties(physicalDevice, pImageFormatInfo->format, pImageFormatInfo->type, pImageFormatInfo->tiling, pImageFormatInfo->usage, pImageFormatInfo->flags, &pImageFormatProperties->imageFormatProperties);
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceQueueFamilyProperties2KHR(
VkPhysicalDevice physicalDevice,
uint32_t* pQueueFamilyPropertyCount,
VkQueueFamilyProperties2* pQueueFamilyProperties)
{
if (pQueueFamilyPropertyCount && pQueueFamilyProperties) {
GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, &pQueueFamilyProperties->queueFamilyProperties);
} else {
GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, nullptr);
}
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceMemoryProperties2KHR(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceMemoryProperties2* pMemoryProperties)
{
GetPhysicalDeviceMemoryProperties(physicalDevice, &pMemoryProperties->memoryProperties);
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceSparseImageFormatProperties2KHR(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo,
uint32_t* pPropertyCount,
VkSparseImageFormatProperties2* pProperties)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL GetDeviceGroupPeerMemoryFeaturesKHR(
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 CmdSetDeviceMaskKHR(
VkCommandBuffer commandBuffer,
uint32_t deviceMask)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdDispatchBaseKHR(
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 void VKAPI_CALL TrimCommandPoolKHR(
VkDevice device,
VkCommandPool commandPool,
VkCommandPoolTrimFlags flags)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceGroupsKHR(
VkInstance instance,
uint32_t* pPhysicalDeviceGroupCount,
VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalBufferPropertiesKHR(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo,
VkExternalBufferProperties* pExternalBufferProperties)
{
GetPhysicalDeviceExternalBufferProperties(physicalDevice, pExternalBufferInfo, pExternalBufferProperties);
}
#ifdef VK_USE_PLATFORM_WIN32_KHR
static VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandleKHR(
VkDevice device,
const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo,
HANDLE* pHandle)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetMemoryWin32HandlePropertiesKHR(
VkDevice device,
VkExternalMemoryHandleTypeFlagBits handleType,
HANDLE handle,
VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
#endif /* VK_USE_PLATFORM_WIN32_KHR */
static VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdKHR(
VkDevice device,
const VkMemoryGetFdInfoKHR* pGetFdInfo,
int* pFd)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetMemoryFdPropertiesKHR(
VkDevice device,
VkExternalMemoryHandleTypeFlagBits handleType,
int fd,
VkMemoryFdPropertiesKHR* pMemoryFdProperties)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
#ifdef VK_USE_PLATFORM_WIN32_KHR
#endif /* VK_USE_PLATFORM_WIN32_KHR */
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalSemaphorePropertiesKHR(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo,
VkExternalSemaphoreProperties* pExternalSemaphoreProperties)
{
GetPhysicalDeviceExternalSemaphoreProperties(physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties);
}
#ifdef VK_USE_PLATFORM_WIN32_KHR
static VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreWin32HandleKHR(
VkDevice device,
const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreWin32HandleKHR(
VkDevice device,
const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo,
HANDLE* pHandle)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
#endif /* VK_USE_PLATFORM_WIN32_KHR */
static VKAPI_ATTR VkResult VKAPI_CALL ImportSemaphoreFdKHR(
VkDevice device,
const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR VkResult VKAPI_CALL GetSemaphoreFdKHR(
VkDevice device,
const VkSemaphoreGetFdInfoKHR* pGetFdInfo,
int* pFd)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetKHR(
VkCommandBuffer commandBuffer,
VkPipelineBindPoint pipelineBindPoint,
VkPipelineLayout layout,
uint32_t set,
uint32_t descriptorWriteCount,
const VkWriteDescriptorSet* pDescriptorWrites)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdPushDescriptorSetWithTemplateKHR(
VkCommandBuffer commandBuffer,
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
VkPipelineLayout layout,
uint32_t set,
const void* pData)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorUpdateTemplateKHR(
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 DestroyDescriptorUpdateTemplateKHR(
VkDevice device,
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
const VkAllocationCallbacks* pAllocator)
{
//Destroy object
}
static VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSetWithTemplateKHR(
VkDevice device,
VkDescriptorSet descriptorSet,
VkDescriptorUpdateTemplate descriptorUpdateTemplate,
const void* pData)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass2KHR(
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 CmdBeginRenderPass2KHR(
VkCommandBuffer commandBuffer,
const VkRenderPassBeginInfo* pRenderPassBegin,
const VkSubpassBeginInfo* pSubpassBeginInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdNextSubpass2KHR(
VkCommandBuffer commandBuffer,
const VkSubpassBeginInfo* pSubpassBeginInfo,
const VkSubpassEndInfo* pSubpassEndInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass2KHR(
VkCommandBuffer commandBuffer,
const VkSubpassEndInfo* pSubpassEndInfo)
{
//Not a CREATE or DESTROY function
}
static VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainStatusKHR(
VkDevice device,
VkSwapchainKHR swapchain)
{
//Not a CREATE or DESTROY function
return VK_SUCCESS;
}
static VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceExternalFencePropertiesKHR(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo,