mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-29 02:41:08 +00:00
Handle specialising pipeline being different from final linked pipeline
* With graphics pipeline libraries there can be a different pipeline bound to the state as the one used to specialise a shader. Since this is a many:1 relationship (per shader object) we can express it with a simple map lookup to redirect the specialised pipeline.
This commit is contained in:
@@ -1264,7 +1264,10 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan,
|
||||
subpass = pipeInfo.subpass;
|
||||
|
||||
for(uint32_t i = 0; i < 4; i++)
|
||||
{
|
||||
shaders[i] = pipeInfo.shaders[i];
|
||||
info.m_ShaderModule[shaders[i].module].m_PipeReferences[id] = pipeid;
|
||||
}
|
||||
|
||||
vertLayout = pipeInfo.vertLayout;
|
||||
|
||||
@@ -1310,6 +1313,7 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan,
|
||||
subpass = pipeInfo.subpass;
|
||||
|
||||
shaders[4] = pipeInfo.shaders[4];
|
||||
info.m_ShaderModule[shaders[4].module].m_PipeReferences[id] = pipeid;
|
||||
|
||||
fragLayout = pipeInfo.fragLayout;
|
||||
|
||||
|
||||
@@ -718,6 +718,10 @@ struct VulkanCreationInfo
|
||||
|
||||
ShaderModuleReflection &GetReflection(ShaderStage stage, const rdcstr &entry, ResourceId pipe)
|
||||
{
|
||||
auto redirIt = m_PipeReferences.find(pipe);
|
||||
if(redirIt != m_PipeReferences.end())
|
||||
pipe = redirIt->second;
|
||||
|
||||
// look for one from this pipeline specifically, if it was specialised
|
||||
auto it = m_Reflections.find({stage, entry, pipe});
|
||||
if(it != m_Reflections.end())
|
||||
@@ -732,6 +736,10 @@ struct VulkanCreationInfo
|
||||
rdcstr unstrippedPath;
|
||||
|
||||
std::map<ShaderModuleReflectionKey, ShaderModuleReflection> m_Reflections;
|
||||
// in graphics pipeline library the linked pipeline may reference a different pipeline where the
|
||||
// shaders are. So when looking up the reflection as specialised by a given pipeline we may want
|
||||
// to redirect to the 'real' pipeline that specialised it.
|
||||
std::unordered_map<ResourceId, ResourceId> m_PipeReferences;
|
||||
};
|
||||
std::unordered_map<ResourceId, ShaderModule> m_ShaderModule;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user