nvk: Add external memory queries
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:

committed by
Marge Bot

parent
3d247f447e
commit
702326d013
@@ -64,6 +64,50 @@ nvk_GetDeviceBufferMemoryRequirements(VkDevice _device,
|
||||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
nvk_GetPhysicalDeviceExternalBufferProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo,
|
||||
VkExternalBufferProperties *pExternalBufferProperties)
|
||||
{
|
||||
/* The Vulkan 1.3.256 spec says:
|
||||
*
|
||||
* VUID-VkPhysicalDeviceExternalBufferInfo-handleType-parameter
|
||||
*
|
||||
* "handleType must be a valid VkExternalMemoryHandleTypeFlagBits value"
|
||||
*
|
||||
* This differs from VkPhysicalDeviceExternalImageFormatInfo, which
|
||||
* surprisingly permits handleType == 0.
|
||||
*/
|
||||
assert(pExternalBufferInfo->handleType != 0);
|
||||
|
||||
/* All of the current flags are for sparse which we don't support yet.
|
||||
* Even when we do support it, doing sparse on external memory sounds
|
||||
* sketchy. Also, just disallowing flags is the safe option.
|
||||
*/
|
||||
if (pExternalBufferInfo->flags)
|
||||
goto unsupported;
|
||||
|
||||
switch (pExternalBufferInfo->handleType) {
|
||||
case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT:
|
||||
case VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT:
|
||||
pExternalBufferProperties->externalMemoryProperties = nvk_dma_buf_mem_props;
|
||||
return;
|
||||
default:
|
||||
goto unsupported;
|
||||
}
|
||||
|
||||
unsupported:
|
||||
/* From the Vulkan 1.3.256 spec:
|
||||
*
|
||||
* compatibleHandleTypes must include at least handleType.
|
||||
*/
|
||||
pExternalBufferProperties->externalMemoryProperties =
|
||||
(VkExternalMemoryProperties) {
|
||||
.compatibleHandleTypes = pExternalBufferInfo->handleType,
|
||||
};
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
nvk_BindBufferMemory2(VkDevice _device,
|
||||
uint32_t bindInfoCount,
|
||||
|
Reference in New Issue
Block a user