mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 05:20:45 +00:00
Add locking around access to descriptor set references
* With VK_EXT_descriptor_indexing descriptor sets can be updated while a submission is going on, leading to potentially parallel access to the references.
This commit is contained in:
@@ -831,6 +831,8 @@ bool IsValid(const VkWriteDescriptorSet &write, uint32_t arrayElement)
|
||||
|
||||
void DescriptorSetSlot::RemoveBindRefs(VkResourceRecord *record)
|
||||
{
|
||||
SCOPED_LOCK(record->descInfo->refLock);
|
||||
|
||||
if(texelBufferView != VK_NULL_HANDLE)
|
||||
{
|
||||
record->RemoveBindFrameRef(GetResID(texelBufferView));
|
||||
@@ -874,6 +876,8 @@ void DescriptorSetSlot::RemoveBindRefs(VkResourceRecord *record)
|
||||
|
||||
void DescriptorSetSlot::AddBindRefs(VkResourceRecord *record, FrameRefType ref)
|
||||
{
|
||||
SCOPED_LOCK(record->descInfo->refLock);
|
||||
|
||||
if(texelBufferView != VK_NULL_HANDLE)
|
||||
{
|
||||
VkResourceRecord *bufView = GetRecord(texelBufferView);
|
||||
|
||||
@@ -957,6 +957,9 @@ struct DescriptorSetData
|
||||
// create from the layout.
|
||||
vector<DescriptorSetSlot *> descBindings;
|
||||
|
||||
// lock protecting bindFrameRefs and bindMemRefs
|
||||
Threading::CriticalSection refLock;
|
||||
|
||||
// contains the framerefs (ref counted) for the bound resources
|
||||
// in the binding slots. Updated when updating descriptor sets
|
||||
// and then applied in a block on descriptor set bind.
|
||||
|
||||
@@ -956,6 +956,8 @@ void WrappedVulkan::vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount,
|
||||
|
||||
VkResourceRecord *setrecord = GetRecord(pDescriptorCopies[i].srcSet);
|
||||
|
||||
SCOPED_LOCK(setrecord->descInfo->refLock);
|
||||
|
||||
for(auto refit = setrecord->descInfo->bindFrameRefs.begin();
|
||||
refit != setrecord->descInfo->bindFrameRefs.end(); ++refit)
|
||||
{
|
||||
|
||||
@@ -827,6 +827,8 @@ VkResult WrappedVulkan::vkQueueSubmit(VkQueue queue, uint32_t submitCount,
|
||||
{
|
||||
VkResourceRecord *setrecord = GetRecord(*it);
|
||||
|
||||
SCOPED_LOCK(setrecord->descInfo->refLock);
|
||||
|
||||
const std::map<ResourceId, pair<uint32_t, FrameRefType>> &frameRefs =
|
||||
setrecord->descInfo->bindFrameRefs;
|
||||
|
||||
@@ -865,6 +867,8 @@ VkResult WrappedVulkan::vkQueueSubmit(VkQueue queue, uint32_t submitCount,
|
||||
|
||||
VkResourceRecord *setrecord = GetRecord(*it);
|
||||
|
||||
SCOPED_LOCK(setrecord->descInfo->refLock);
|
||||
|
||||
for(auto refit = setrecord->descInfo->bindFrameRefs.begin();
|
||||
refit != setrecord->descInfo->bindFrameRefs.end(); ++refit)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user