mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-29 17:52:18 +01:00
[dxvk] Allow querying external memory features for image formats
This commit is contained in:
parent
3a636f6094
commit
c0fdf1449c
@ -46,6 +46,9 @@ namespace dxvk {
|
||||
const DxvkFormatQuery& query) const {
|
||||
auto vk = m_adapter->vki();
|
||||
|
||||
VkPhysicalDeviceExternalImageFormatInfo externalInfo = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO };
|
||||
externalInfo.handleType = query.handleType;
|
||||
|
||||
VkPhysicalDeviceImageFormatInfo2 info = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2 };
|
||||
info.format = query.format;
|
||||
info.type = query.type;
|
||||
@ -53,20 +56,28 @@ namespace dxvk {
|
||||
info.usage = query.usage;
|
||||
info.flags = query.flags;
|
||||
|
||||
if (externalInfo.handleType)
|
||||
externalInfo.pNext = std::exchange(info.pNext, &externalInfo);
|
||||
|
||||
VkExternalImageFormatProperties externalProperties = { VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES };
|
||||
VkImageFormatProperties2 properties = { VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2 };
|
||||
|
||||
if (externalInfo.handleType)
|
||||
externalProperties.pNext = std::exchange(properties.pNext, &externalProperties);
|
||||
|
||||
VkResult vr = vk->vkGetPhysicalDeviceImageFormatProperties2(
|
||||
m_adapter->handle(), &info, &properties);
|
||||
|
||||
if (vr != VK_SUCCESS)
|
||||
return std::nullopt;
|
||||
|
||||
DxvkFormatLimits result;
|
||||
DxvkFormatLimits result = { };
|
||||
result.maxExtent = properties.imageFormatProperties.maxExtent;
|
||||
result.maxMipLevels = properties.imageFormatProperties.maxMipLevels;
|
||||
result.maxArrayLayers = properties.imageFormatProperties.maxArrayLayers;
|
||||
result.sampleCounts = properties.imageFormatProperties.sampleCounts;
|
||||
result.maxResourceSize = properties.imageFormatProperties.maxResourceSize;
|
||||
result.externalFeatures = externalProperties.externalMemoryProperties.externalMemoryFeatures;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -27,22 +27,24 @@ namespace dxvk {
|
||||
* \brief Format support limits for a given set of image usage flags
|
||||
*/
|
||||
struct DxvkFormatLimits {
|
||||
VkExtent3D maxExtent;
|
||||
uint32_t maxMipLevels;
|
||||
uint32_t maxArrayLayers;
|
||||
VkSampleCountFlags sampleCounts;
|
||||
VkDeviceSize maxResourceSize;
|
||||
VkExtent3D maxExtent;
|
||||
uint32_t maxMipLevels;
|
||||
uint32_t maxArrayLayers;
|
||||
VkSampleCountFlags sampleCounts;
|
||||
VkDeviceSize maxResourceSize;
|
||||
VkExternalMemoryFeatureFlags externalFeatures;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Format query info
|
||||
*/
|
||||
struct DxvkFormatQuery {
|
||||
VkFormat format;
|
||||
VkImageType type;
|
||||
VkImageTiling tiling;
|
||||
VkImageUsageFlags usage;
|
||||
VkImageCreateFlags flags;
|
||||
VkFormat format;
|
||||
VkImageType type;
|
||||
VkImageTiling tiling;
|
||||
VkImageUsageFlags usage;
|
||||
VkImageCreateFlags flags;
|
||||
VkExternalMemoryHandleTypeFlagBits handleType;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user