From b62d5784af2416b3a965fadab6de2fe39ae0fd1f Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 17 Mar 2019 23:24:50 +0100 Subject: [PATCH] - bind a texture in all descriptor slots --- src/rendering/vulkan/textures/vk_hwtexture.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/rendering/vulkan/textures/vk_hwtexture.cpp b/src/rendering/vulkan/textures/vk_hwtexture.cpp index 0e6d58b318..f7d0f022a6 100644 --- a/src/rendering/vulkan/textures/vk_hwtexture.cpp +++ b/src/rendering/vulkan/textures/vk_hwtexture.cpp @@ -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(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); }