From c11729c2bb04ca26fca76fb78b3e7655742eb492 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 1 Jun 2022 16:47:54 +0200 Subject: [PATCH] - fixed: Vulkan descriptor sets must check the real translation, not just the translation ID. In particular the one for the menu's player sprite and ACS translations can alter a translation ID's actual translation at run time, these changes never triggered a descriptor set change. --- src/common/rendering/vulkan/textures/vk_hwtexture.cpp | 5 +++-- src/common/rendering/vulkan/textures/vk_hwtexture.h | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/common/rendering/vulkan/textures/vk_hwtexture.cpp b/src/common/rendering/vulkan/textures/vk_hwtexture.cpp index 83733d6ec..15b2f7f26 100644 --- a/src/common/rendering/vulkan/textures/vk_hwtexture.cpp +++ b/src/common/rendering/vulkan/textures/vk_hwtexture.cpp @@ -380,12 +380,13 @@ VulkanDescriptorSet* VkMaterial::GetDescriptorSet(const FMaterialState& state) auto base = Source(); int clampmode = state.mClampMode; int translation = state.mTranslation; + auto translationp = IsLuminosityTranslation(translation)? translation : intptr_t(GPalette.GetTranslation(GetTranslationType(translation), GetTranslationIndex(translation))); clampmode = base->GetClampMode(clampmode); for (auto& set : mDescriptorSets) { - if (set.descriptor && set.clampmode == clampmode && set.flags == translation) return set.descriptor.get(); + if (set.descriptor && set.clampmode == clampmode && set.remap == translationp) return set.descriptor.get(); } int numLayers = NumLayers(); @@ -430,7 +431,7 @@ VulkanDescriptorSet* VkMaterial::GetDescriptorSet(const FMaterialState& state) } update.updateSets(fb->device); - mDescriptorSets.emplace_back(clampmode, translation, std::move(descriptor)); + mDescriptorSets.emplace_back(clampmode, translationp, std::move(descriptor)); return mDescriptorSets.back().descriptor.get(); } diff --git a/src/common/rendering/vulkan/textures/vk_hwtexture.h b/src/common/rendering/vulkan/textures/vk_hwtexture.h index 22958c494..91bc5e1b7 100644 --- a/src/common/rendering/vulkan/textures/vk_hwtexture.h +++ b/src/common/rendering/vulkan/textures/vk_hwtexture.h @@ -70,13 +70,13 @@ class VkMaterial : public FMaterial struct DescriptorEntry { int clampmode; - int flags; + intptr_t remap; std::unique_ptr descriptor; - DescriptorEntry(int cm, int f, std::unique_ptr&& d) + DescriptorEntry(int cm, intptr_t f, std::unique_ptr&& d) { clampmode = cm; - flags = f; + remap = f; descriptor = std::move(d); } };