本文整理汇总了C++中VkResourceRecord::RemoveBindFrameRef方法的典型用法代码示例。如果您正苦于以下问题:C++ VkResourceRecord::RemoveBindFrameRef方法的具体用法?C++ VkResourceRecord::RemoveBindFrameRef怎么用?C++ VkResourceRecord::RemoveBindFrameRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VkResourceRecord
的用法示例。
在下文中一共展示了VkResourceRecord::RemoveBindFrameRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vkUpdateDescriptorSets
//.........这里部分代码省略.........
ref = eFrameRef_Read;
break;
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
ref = eFrameRef_Write;
break;
default:
RDCERR("Unexpected descriptor type");
}
// We need to handle the cases where these bindings are stale:
// ie. image handle 0xf00baa is allocated
// bound into a descriptor set
// image is released
// descriptor set is bound but this image is never used by shader etc.
//
// worst case, a new image or something has been added with this handle -
// in this case we end up ref'ing an image that isn't actually used.
// Worst worst case, we ref an image as write when actually it's not, but
// this is likewise not a serious problem, and rather difficult to solve
// (would need to version handles somehow, but don't have enough bits
// to do that reliably).
//
// This is handled by RemoveBindFrameRef silently dropping id == ResourceId()
for(uint32_t d=0; d < pDescriptorWrites[i].descriptorCount; d++)
{
DescriptorSetSlot &bind = binding[pDescriptorWrites[i].dstArrayElement + d];
if(bind.texelBufferView != VK_NULL_HANDLE)
{
record->RemoveBindFrameRef(GetResID(bind.texelBufferView));
if(GetRecord(bind.texelBufferView)->baseResource != ResourceId())
record->RemoveBindFrameRef(GetRecord(bind.texelBufferView)->baseResource);
}
if(bind.imageInfo.imageView != VK_NULL_HANDLE)
{
record->RemoveBindFrameRef(GetResID(bind.imageInfo.imageView));
record->RemoveBindFrameRef(GetRecord(bind.imageInfo.imageView)->baseResource);
if(GetRecord(bind.imageInfo.imageView)->baseResourceMem != ResourceId())
record->RemoveBindFrameRef(GetRecord(bind.imageInfo.imageView)->baseResourceMem);
}
if(bind.imageInfo.sampler != VK_NULL_HANDLE)
{
record->RemoveBindFrameRef(GetResID(bind.imageInfo.sampler));
}
if(bind.bufferInfo.buffer != VK_NULL_HANDLE)
{
record->RemoveBindFrameRef(GetResID(bind.bufferInfo.buffer));
if(GetRecord(bind.bufferInfo.buffer)->baseResource != ResourceId())
record->RemoveBindFrameRef(GetRecord(bind.bufferInfo.buffer)->baseResource);
}
// NULL everything out now so that we don't accidentally reference an object
// that was removed already
bind.texelBufferView = VK_NULL_HANDLE;
bind.bufferInfo.buffer = VK_NULL_HANDLE;
bind.imageInfo.imageView = VK_NULL_HANDLE;
bind.imageInfo.sampler = VK_NULL_HANDLE;
if(pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER ||
pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)
{
bind.texelBufferView = pDescriptorWrites[i].pTexelBufferView[d];