1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

[dxvk] Fix image view swizzling

This commit is contained in:
Philip Rebohle 2024-09-26 17:42:02 +02:00
parent 5e5c283149
commit 78f5136fde

View File

@ -96,14 +96,11 @@ namespace dxvk {
key.mipCount = info.numLevels;
key.layerIndex = info.minLayer;
key.layerCount = info.numLayers;
if (info.usage == VK_IMAGE_USAGE_SAMPLED_BIT) {
key.packedSwizzle =
(uint16_t(info.swizzle.r) << 0) |
(uint16_t(info.swizzle.g) << 4) |
(uint16_t(info.swizzle.b) << 8) |
(uint16_t(info.swizzle.a) << 12);
}
key.packedSwizzle =
(uint16_t(info.swizzle.r) << 0) |
(uint16_t(info.swizzle.g) << 4) |
(uint16_t(info.swizzle.b) << 8) |
(uint16_t(info.swizzle.a) << 12);
std::unique_lock lock(m_viewMutex);
@ -298,6 +295,11 @@ namespace dxvk {
return VK_NULL_HANDLE;
}
// We need to expose RT and UAV swizzles to the backend,
// but cannot legally pass them down to Vulkan
if (key.usage != VK_IMAGE_USAGE_SAMPLED_BIT)
key.packedSwizzle = 0u;
return m_image->m_storage->createImageView(key);
}