Don't mark ref'd descriptor sets that are just updated.

This commit is contained in:
baldurk
2015-10-06 21:50:13 +02:00
parent 448df65773
commit a595df5cf7
2 changed files with 25 additions and 7 deletions
+6 -1
View File
@@ -382,7 +382,12 @@ void WrappedVulkan::Create_InitialState(ResourceId id, WrappedVkRes *live, bool
if(type == eResDescriptorSet)
{
RDCERR("Unexpected attempt to create initial state for descriptor set");
// VKTODOMED need to create some default initial state for descriptor sets.
// if a descriptor set is alloc'd then used in frame we won't have prepared anything,
// but likewise all writes must happen within that frame so the initial state doesn't
// technically matter. We assume the app doesn't try to read from an uninitialised
// descriptor, so for now we can leave the initial state empty.
VULKANNOTIMP("Need to create initial state for descriptor set");
}
else if(type == eResImage)
{
@@ -363,7 +363,11 @@ bool WrappedVulkan::Serialise_vkUpdateDescriptorSets(
// will be invalid with some missing handles. It's safe though to just skip this
// update as we only get here if it's never used.
bool valid = true;
// if a set was never bind, it will have been omitted and we just drop any writes to it
bool valid = (writeDesc.destSet != VK_NULL_HANDLE);
if(!valid)
return true;
switch(writeDesc.descriptorType)
{
@@ -501,6 +505,9 @@ VkResult WrappedVulkan::vkUpdateDescriptorSets(
{
if(m_State == WRITING_CAPFRAME)
{
// don't have to mark referenced any of the resources pointed to by the descriptor set - that's handled
// on queue submission by marking ref'd all the current bindings of the sets referenced by the cmd buffer
for(uint32_t i=0; i < writeCount; i++)
{
{
@@ -512,9 +519,11 @@ VkResult WrappedVulkan::vkUpdateDescriptorSets(
m_FrameCaptureRecord->AddChunk(scope.Get());
}
// don't have to mark referenced any of the resources pointed to by the descriptor set - that's handled
// on queue submission by marking ref'd all the current bindings of the sets referenced by the cmd buffer
GetResourceManager()->MarkResourceFrameReferenced(GetResID(pDescriptorWrites[i].destSet), eFrameRef_Write);
// as long as descriptor sets are forced to have initial states, we don't have to mark them ref'd for
// write here. The reason being that as long as we only mark them as ref'd when they're actually bound,
// we can safely skip the ref here and it means any descriptor set updates of descriptor sets that are
// never used in the frame can be ignored.
//GetResourceManager()->MarkResourceFrameReferenced(GetResID(pDescriptorWrites[i].destSet), eFrameRef_Write);
}
for(uint32_t i=0; i < copyCount; i++)
@@ -528,8 +537,12 @@ VkResult WrappedVulkan::vkUpdateDescriptorSets(
m_FrameCaptureRecord->AddChunk(scope.Get());
}
GetResourceManager()->MarkResourceFrameReferenced(GetResID(pDescriptorCopies[i].destSet), eFrameRef_Write);
GetResourceManager()->MarkResourceFrameReferenced(GetResID(pDescriptorCopies[i].srcSet), eFrameRef_Read);
// as long as descriptor sets are forced to have initial states, we don't have to mark them ref'd for
// write here. The reason being that as long as we only mark them as ref'd when they're actually bound,
// we can safely skip the ref here and it means any descriptor set updates of descriptor sets that are
// never used in the frame can be ignored.
//GetResourceManager()->MarkResourceFrameReferenced(GetResID(pDescriptorCopies[i].destSet), eFrameRef_Write);
//GetResourceManager()->MarkResourceFrameReferenced(GetResID(pDescriptorCopies[i].srcSet), eFrameRef_Read);
}
}