From 7b3350ae1e5d2d47d581dbe3c7fdc1886a745efe Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 18 Mar 2019 00:38:09 +0100 Subject: [PATCH] - the material descriptor set must be bound again if the pipeline changes and the new shader uses more textures than the old one --- src/rendering/vulkan/renderer/vk_renderstate.cpp | 2 ++ src/rendering/vulkan/textures/vk_hwtexture.cpp | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/rendering/vulkan/renderer/vk_renderstate.cpp b/src/rendering/vulkan/renderer/vk_renderstate.cpp index addde18f6..c71ad49fb 100644 --- a/src/rendering/vulkan/renderer/vk_renderstate.cpp +++ b/src/rendering/vulkan/renderer/vk_renderstate.cpp @@ -627,6 +627,8 @@ void VkRenderState::BeginRenderPass(const VkRenderPassKey &key, VulkanCommandBuf beginInfo.addClearDepthStencil(1.0f, 0); cmdbuffer->beginRenderPass(beginInfo); cmdbuffer->bindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, passSetup->Pipeline.get()); + + mMaterial.mChanged = true; } ///////////////////////////////////////////////////////////////////////////// diff --git a/src/rendering/vulkan/textures/vk_hwtexture.cpp b/src/rendering/vulkan/textures/vk_hwtexture.cpp index f7d0f022a..cb2e4bb90 100644 --- a/src/rendering/vulkan/textures/vk_hwtexture.cpp +++ b/src/rendering/vulkan/textures/vk_hwtexture.cpp @@ -121,9 +121,9 @@ VulkanDescriptorSet *VkHardwareTexture::GetDescriptorSet(const FMaterialState &s VulkanSampler *sampler = fb->GetSamplerManager()->Get(clampmode); int numLayers = mat->GetLayers(); - int maxTextures = 6; + //int maxTextures = 6; auto baseView = GetImageView(tex, translation, flags); - numLayers = clamp(numLayers, 1, maxTextures); + //numLayers = clamp(numLayers, 1, maxTextures); WriteDescriptors update; update.addCombinedImageSampler(descriptorSet.get(), 0, baseView, sampler, mImageLayout); @@ -133,10 +133,6 @@ VulkanDescriptorSet *VkHardwareTexture::GetDescriptorSet(const FMaterialState &s auto systex = static_cast(mat->GetLayer(i, 0, &layer)); update.addCombinedImageSampler(descriptorSet.get(), i, systex->GetImageView(layer, 0, mat->isExpanded() ? CTF_Expand : 0), sampler, systex->mImageLayout); } - for (int i = numLayers; i < maxTextures; i++) - { - update.addCombinedImageSampler(descriptorSet.get(), i, baseView, sampler, mImageLayout); - } update.updateSets(fb->device); }