- bind a texture in all descriptor slots

This commit is contained in:
Magnus Norddahl 2019-03-17 23:24:50 +01:00
parent ec7a874a61
commit b62d5784af

View file

@ -121,14 +121,22 @@ VulkanDescriptorSet *VkHardwareTexture::GetDescriptorSet(const FMaterialState &s
VulkanSampler *sampler = fb->GetSamplerManager()->Get(clampmode);
int numLayers = mat->GetLayers();
int maxTextures = 6;
auto baseView = GetImageView(tex, translation, flags);
numLayers = clamp(numLayers, 1, maxTextures);
WriteDescriptors update;
update.addCombinedImageSampler(descriptorSet.get(), 0, GetImageView(tex, translation, flags), sampler, mImageLayout);
update.addCombinedImageSampler(descriptorSet.get(), 0, baseView, sampler, mImageLayout);
for (int i = 1; i < numLayers; i++)
{
FTexture *layer;
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);
}