- the material descriptor set must be bound again if the pipeline changes and the new shader uses more textures than the old one

This commit is contained in:
Magnus Norddahl 2019-03-18 00:38:09 +01:00
parent b62d5784af
commit 7b3350ae1e
2 changed files with 4 additions and 6 deletions

View file

@ -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;
}
/////////////////////////////////////////////////////////////////////////////

View file

@ -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<VkHardwareTexture*>(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);
}