1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 05:52:11 +01:00

[dxvk] Pass image format list to the driver

Allows drivers to enable DCC in some situations.
This commit is contained in:
Philip Rebohle 2018-07-03 12:44:01 +02:00
parent c1334e7601
commit 9b78738d2c
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 22 additions and 1 deletions

View File

@ -8,10 +8,24 @@ namespace dxvk {
DxvkMemoryAllocator& memAlloc,
VkMemoryPropertyFlags memFlags)
: m_vkd(vkd), m_info(createInfo), m_memFlags(memFlags) {
// Copy the compatible view formats to a persistent array
m_viewFormats.resize(createInfo.viewFormatCount);
for (uint32_t i = 0; i < createInfo.viewFormatCount; i++)
m_viewFormats[i] = createInfo.viewFormats[i];
m_info.viewFormats = m_viewFormats.data();
// If defined, we should provide a format list, which
// allows some drivers to enable image compression
VkImageFormatListCreateInfoKHR formatList;
formatList.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR;
formatList.pNext = nullptr;
formatList.viewFormatCount = createInfo.viewFormatCount;
formatList.pViewFormats = createInfo.viewFormats;
VkImageCreateInfo info;
info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
info.pNext = nullptr;
info.pNext = &formatList;
info.flags = createInfo.flags;
info.imageType = createInfo.type;
info.format = createInfo.format;

View File

@ -50,6 +50,11 @@ namespace dxvk {
/// Common image layout
VkImageLayout layout;
// Image view formats that can
// be used with this image
uint32_t viewFormatCount = 0;
const VkFormat* viewFormats = nullptr;
};
@ -240,6 +245,8 @@ namespace dxvk {
VkMemoryPropertyFlags m_memFlags;
DxvkMemory m_memory;
VkImage m_image = VK_NULL_HANDLE;
std::vector<VkFormat> m_viewFormats;
};