mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-22 14:36:35 +00:00
Fixes for storing & displaying dynamic offsets in pipeline state
This commit is contained in:
@@ -1681,6 +1681,8 @@ void VulkanReplay::SavePipelineState()
|
||||
VkDescriptorInfo *info = m_pDriver->m_DescriptorSetState[src].currentBindings[b];
|
||||
const DescSetLayout::Binding &layoutBind = c.m_DescSetLayout[layoutId].bindings[b];
|
||||
|
||||
bool dynamicOffset = false;
|
||||
|
||||
dst.bindings[b].arraySize = layoutBind.arraySize;
|
||||
dst.bindings[b].stageFlags = (ShaderStageBits)layoutBind.stageFlags;
|
||||
switch(layoutBind.descriptorType)
|
||||
@@ -1693,8 +1695,8 @@ void VulkanReplay::SavePipelineState()
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: dst.bindings[b].type = eBindType_ReadWriteTBuffer; break;
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: dst.bindings[b].type = eBindType_ReadOnlyBuffer; break;
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: dst.bindings[b].type = eBindType_ReadWriteBuffer; break;
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: dst.bindings[b].type = eBindType_ReadOnlyBuffer; break;
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: dst.bindings[b].type = eBindType_ReadWriteBuffer; break;
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: dst.bindings[b].type = eBindType_ReadOnlyBuffer; dynamicOffset = true; break;
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: dst.bindings[b].type = eBindType_ReadWriteBuffer; dynamicOffset = true; break;
|
||||
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: dst.bindings[b].type = eBindType_InputAttachment; break;
|
||||
default:
|
||||
dst.bindings[b].type = eBindType_Unknown;
|
||||
@@ -1723,8 +1725,9 @@ void VulkanReplay::SavePipelineState()
|
||||
|
||||
dst.bindings[b].binds[a].view = rm->GetOriginalID(viewid);
|
||||
dst.bindings[b].binds[a].res = rm->GetOriginalID(c.m_BufferView[viewid].buffer);
|
||||
dst.bindings[b].binds[a].offset = *(uint32_t *)&info->imageLayout;
|
||||
dst.bindings[b].binds[a].offset += c.m_BufferView[viewid].offset;
|
||||
dst.bindings[b].binds[a].offset = c.m_BufferView[viewid].offset;
|
||||
if(dynamicOffset)
|
||||
dst.bindings[b].binds[a].offset += *(uint32_t *)&info->imageLayout;
|
||||
dst.bindings[b].binds[a].size = c.m_BufferView[viewid].size;
|
||||
}
|
||||
if(info->bufferInfo.buffer != VK_NULL_HANDLE)
|
||||
@@ -1732,6 +1735,8 @@ void VulkanReplay::SavePipelineState()
|
||||
dst.bindings[b].binds[a].view = ResourceId();
|
||||
dst.bindings[b].binds[a].res = rm->GetOriginalID(rm->GetNonDispWrapper(info->bufferInfo.buffer)->id);
|
||||
dst.bindings[b].binds[a].offset = info->bufferInfo.offset;
|
||||
if(dynamicOffset)
|
||||
dst.bindings[b].binds[a].offset += *(uint32_t *)&info->imageLayout;
|
||||
dst.bindings[b].binds[a].size = info->bufferInfo.range;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1099,17 +1099,17 @@ bool WrappedVulkan::Serialise_vkCmdBindDescriptorSets(
|
||||
// and in array element order within a binding
|
||||
for(uint32_t i=0; i < numSets; i++)
|
||||
{
|
||||
const DescSetLayout &layout = m_CreationInfo.m_DescSetLayout[descriptorIDs[i]];
|
||||
const DescSetLayout &layoutinfo = m_CreationInfo.m_DescSetLayout[ descSetLayouts[first+i] ];
|
||||
|
||||
for(size_t b=0; b < layout.bindings.size(); b++)
|
||||
for(size_t b=0; b < layoutinfo.bindings.size(); b++)
|
||||
{
|
||||
// not dynamic, doesn't need an offset
|
||||
if(layout.bindings[b].descriptorType != VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC &&
|
||||
layout.bindings[b].descriptorType != VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)
|
||||
if(layoutinfo.bindings[b].descriptorType != VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC &&
|
||||
layoutinfo.bindings[b].descriptorType != VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)
|
||||
continue;
|
||||
|
||||
// assign every array element an offset according to array size
|
||||
for(uint32_t a=0; a < layout.bindings[b].arraySize; a++)
|
||||
for(uint32_t a=0; a < layoutinfo.bindings[b].arraySize; a++)
|
||||
{
|
||||
RDCASSERT(o < offsCount);
|
||||
uint32_t *alias = (uint32_t *)&m_DescriptorSetState[descriptorIDs[i]].currentBindings[b][a].imageLayout;
|
||||
|
||||
Reference in New Issue
Block a user