Check for immutable samplers in push descriptor updates

* Because these fields can be randomly garbage
This commit is contained in:
baldurk
2026-09-03 10:11:00 +01:00
parent dff9454bbb
commit ca7db72a5b
2 changed files with 14 additions and 1 deletions
+11
View File
@@ -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];
@@ -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);