diff --git a/renderdoc/driver/vulkan/vk_info.cpp b/renderdoc/driver/vulkan/vk_info.cpp index bffa7c2fe..c54d0bcc4 100644 --- a/renderdoc/driver/vulkan/vk_info.cpp +++ b/renderdoc/driver/vulkan/vk_info.cpp @@ -3379,10 +3379,21 @@ void DescUpdateTemplate::Apply(const void *pData, DescUpdateTemplateApplication application.imgInfo.resize(idx + entry.descriptorCount); + const DescSetLayout::Binding *layoutBinding = &layout.bindings[entry.dstBinding]; + for(uint32_t d = 0; d < entry.descriptorCount; d++) { memcpy(&application.imgInfo[idx + d], src, sizeof(VkDescriptorImageInfo)); src += entry.stride; + + if((entry.descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER || + entry.descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) && + layoutBinding->immutableSampler != NULL) + { + // force potentially garbage samplers to NULL here as by the time we get to serialising we + // will have no way to determine this anymore + application.imgInfo[idx + d].sampler = VK_NULL_HANDLE; + } } write.pImageInfo = &application.imgInfo[idx]; diff --git a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp index 8b530afba..e516e8090 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp @@ -100,13 +100,15 @@ struct DescriptorTemplateRefs entry.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE || entry.descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT); + const DescSetLayout::Binding *layoutBinding = &tempInfo->layout.bindings[entry.dstBinding]; + for(uint32_t d = 0; d < entry.descriptorCount; d++) { memcpy(dst, src, sizeof(VkDescriptorImageInfo)); VkDescriptorImageInfo *info = (VkDescriptorImageInfo *)dst; - if(hasSampler && info->sampler != VK_NULL_HANDLE) + if(hasSampler && layoutBinding->immutableSampler == NULL && info->sampler != VK_NULL_HANDLE) { frameRefs.push_back(make_rdcpair(GetResID(info->sampler), eFrameRef_Read)); info->sampler = Unwrap(info->sampler);