- remove tracking translation in VkHardwareTexture

- only reset the descriptors when recreating the samplers
This commit is contained in:
Magnus Norddahl 2019-03-17 22:27:48 +01:00
parent 2429eba8f6
commit bf85ad4b6a
4 changed files with 13 additions and 3 deletions

View file

@ -643,13 +643,18 @@ IDataBuffer *VulkanFrameBuffer::CreateDataBuffer(int bindingpoint, bool ssbo)
return buffer;
}
void VulkanFrameBuffer::SetTextureFilterMode()
{
TextureFilterChanged();
}
void VulkanFrameBuffer::TextureFilterChanged()
{
if (mSamplerManager)
{
// Destroy the texture descriptors as they used the old samplers
for (VkHardwareTexture *cur = VkHardwareTexture::First; cur; cur = cur->Next)
cur->Reset();
cur->ResetDescriptors();
mSamplerManager->SetTextureFilterMode();
}

View file

@ -73,6 +73,7 @@ public:
uint32_t GetCaps() override;
void WriteSavePic(player_t *player, FileWriter *file, int width, int height) override;
sector_t *RenderView(player_t *player) override;
void SetTextureFilterMode() override;
void TextureFilterChanged() override;
void BeginFrame() override;
void BlurScene(float amount) override;

View file

@ -74,6 +74,11 @@ void VkHardwareTexture::Reset()
mStagingBuffer.reset();
}
void VkHardwareTexture::ResetDescriptors()
{
mDescriptorSets.clear();
}
VulkanDescriptorSet *VkHardwareTexture::GetDescriptorSet(const FMaterialState &state)
{
FMaterial *mat = state.mMaterial;
@ -92,7 +97,6 @@ VulkanDescriptorSet *VkHardwareTexture::GetDescriptorSet(const FMaterialState &s
DescriptorKey key;
key.clampmode = clampmode;
key.translation = translation;
key.flags = flags;
auto &descriptorSet = mDescriptorSets[key];
if (!descriptorSet)

View file

@ -24,6 +24,7 @@ public:
~VkHardwareTexture();
void Reset();
void ResetDescriptors();
VulkanDescriptorSet *GetDescriptorSet(const FMaterialState &state);
@ -52,7 +53,6 @@ private:
struct DescriptorKey
{
int clampmode;
int translation;
int flags;
bool operator<(const DescriptorKey &other) const { return memcmp(this, &other, sizeof(DescriptorKey)) < 0; }