Pass bindless feedback data to UI through vulkan pipeline state

* Each binding element within an arrayed descriptor has a bool indicating if
  it's dynamically used or not (which will be set to true if the feedback isn't
  available). Each descriptor has a uint32_t indicating how many elements are
  dynamically used - which is useful for the UI to hide the root of an array
  that has no used elements, or to heuristically decide whether to expand or
  elide the contents.
This commit is contained in:
baldurk
2019-04-05 09:19:22 +01:00
parent 7f56704a92
commit f256218e17
19 changed files with 191 additions and 52 deletions
+20 -11
View File
@@ -2095,20 +2095,24 @@ void TextureViewer::InitStageResourcePreviews(ShaderStage stage,
const Bindpoint &key = mapping[idx];
const rdcarray<BoundResource> *resArray = NULL;
uint32_t dynamicallyUsedResCount = 1;
int residx = ResList.indexOf(key);
if(residx >= 0)
resArray = &ResList[residx].resources;
int arrayLen = resArray != NULL ? resArray->count() : 1;
// it's too expensive in bindless-type cases to create a thumbnail for every array element, so
// for now we create one just for the first element and add an array size indicator to the slot
// name
// for(int arrayIdx = 0; arrayIdx < arrayLen; arrayIdx++)
int arrayIdx = 0;
{
resArray = &ResList[residx].resources;
dynamicallyUsedResCount = ResList[residx].dynamicallyUsedCount;
}
const bool collapseArray = dynamicallyUsedResCount > 20;
const int arrayLen = resArray != NULL ? resArray->count() : 1;
for(int arrayIdx = 0; arrayIdx < arrayLen; arrayIdx++)
{
if(resArray && !resArray->at(arrayIdx).dynamicallyUsed)
continue;
ResourceId id = resArray != NULL ? resArray->at(arrayIdx).resourceId : ResourceId();
CompType typeHint = resArray != NULL ? resArray->at(arrayIdx).typeHint : CompType::Typeless;
@@ -2137,8 +2141,10 @@ void TextureViewer::InitStageResourcePreviews(ShaderStage stage,
.arg(rw ? lit("RW ") : lit(""))
.arg(idx);
if(arrayLen > 1)
if(collapseArray)
slotName += QFormatStr(" Arr[%1]").arg(arrayLen);
else
slotName += QFormatStr("[%1]").arg(arrayIdx);
if(copy)
slotName = tr("SRC");
@@ -2177,6 +2183,9 @@ void TextureViewer::InitStageResourcePreviews(ShaderStage stage,
prevIndex++;
InitResourcePreview(prev, show ? id : ResourceId(), typeHint, show, follow, bindName, slotName);
if(collapseArray)
break;
}
}
}