From bf85ad4b6ab3c2ee9e114dd47e207ec840dc33e3 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 17 Mar 2019 22:27:48 +0100 Subject: [PATCH] - remove tracking translation in VkHardwareTexture - only reset the descriptors when recreating the samplers --- src/rendering/vulkan/system/vk_framebuffer.cpp | 7 ++++++- src/rendering/vulkan/system/vk_framebuffer.h | 1 + src/rendering/vulkan/textures/vk_hwtexture.cpp | 6 +++++- src/rendering/vulkan/textures/vk_hwtexture.h | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/rendering/vulkan/system/vk_framebuffer.cpp b/src/rendering/vulkan/system/vk_framebuffer.cpp index 585f86c09c..401365c9c7 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/rendering/vulkan/system/vk_framebuffer.cpp @@ -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(); } diff --git a/src/rendering/vulkan/system/vk_framebuffer.h b/src/rendering/vulkan/system/vk_framebuffer.h index 770bcf376f..58e682fe56 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.h +++ b/src/rendering/vulkan/system/vk_framebuffer.h @@ -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; diff --git a/src/rendering/vulkan/textures/vk_hwtexture.cpp b/src/rendering/vulkan/textures/vk_hwtexture.cpp index 6fb8d37a55..48c9c1baab 100644 --- a/src/rendering/vulkan/textures/vk_hwtexture.cpp +++ b/src/rendering/vulkan/textures/vk_hwtexture.cpp @@ -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) diff --git a/src/rendering/vulkan/textures/vk_hwtexture.h b/src/rendering/vulkan/textures/vk_hwtexture.h index 82ae92c90f..d8f4ba6b20 100644 --- a/src/rendering/vulkan/textures/vk_hwtexture.h +++ b/src/rendering/vulkan/textures/vk_hwtexture.h @@ -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; }