- 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; return buffer;
} }
void VulkanFrameBuffer::SetTextureFilterMode()
{
TextureFilterChanged();
}
void VulkanFrameBuffer::TextureFilterChanged() void VulkanFrameBuffer::TextureFilterChanged()
{ {
if (mSamplerManager) if (mSamplerManager)
{ {
// Destroy the texture descriptors as they used the old samplers // Destroy the texture descriptors as they used the old samplers
for (VkHardwareTexture *cur = VkHardwareTexture::First; cur; cur = cur->Next) for (VkHardwareTexture *cur = VkHardwareTexture::First; cur; cur = cur->Next)
cur->Reset(); cur->ResetDescriptors();
mSamplerManager->SetTextureFilterMode(); mSamplerManager->SetTextureFilterMode();
} }

View file

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

View file

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

View file

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