- 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.
This commit is contained in:
Christoph Oelckers 2022-06-01 16:47:54 +02:00
parent 298407aaf3
commit c11729c2bb
2 changed files with 6 additions and 5 deletions

View file

@ -380,12 +380,13 @@ VulkanDescriptorSet* VkMaterial::GetDescriptorSet(const FMaterialState& state)
auto base = Source(); auto base = Source();
int clampmode = state.mClampMode; int clampmode = state.mClampMode;
int translation = state.mTranslation; int translation = state.mTranslation;
auto translationp = IsLuminosityTranslation(translation)? translation : intptr_t(GPalette.GetTranslation(GetTranslationType(translation), GetTranslationIndex(translation)));
clampmode = base->GetClampMode(clampmode); clampmode = base->GetClampMode(clampmode);
for (auto& set : mDescriptorSets) 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(); int numLayers = NumLayers();
@ -430,7 +431,7 @@ VulkanDescriptorSet* VkMaterial::GetDescriptorSet(const FMaterialState& state)
} }
update.updateSets(fb->device); 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(); return mDescriptorSets.back().descriptor.get();
} }

View file

@ -70,13 +70,13 @@ class VkMaterial : public FMaterial
struct DescriptorEntry struct DescriptorEntry
{ {
int clampmode; int clampmode;
int flags; intptr_t remap;
std::unique_ptr<VulkanDescriptorSet> descriptor; std::unique_ptr<VulkanDescriptorSet> descriptor;
DescriptorEntry(int cm, int f, std::unique_ptr<VulkanDescriptorSet>&& d) DescriptorEntry(int cm, intptr_t f, std::unique_ptr<VulkanDescriptorSet>&& d)
{ {
clampmode = cm; clampmode = cm;
flags = f; remap = f;
descriptor = std::move(d); descriptor = std::move(d);
} }
}; };