mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 17:36:36 +00:00
Extend GL reflection matching to SPIRV reflection for resource arrays
GL resource arrays are expanded in the GL reflection i.e. texture[0], texture[1] but they are collapsed in the SPIRV reflection. For SPIRV resource arrays if matching the full name fails then try to match by the expanded name i.e. texture[<ARRAY_ELEMENT>]
This commit is contained in:
@@ -462,12 +462,28 @@ void WrappedOpenGL::ShaderData::ProcessCompilation(WrappedOpenGL &drv, ResourceI
|
||||
for(size_t j = 0; j < spvReflection.readOnlyResources.size(); j++)
|
||||
{
|
||||
if(reflection->readOnlyResources[i].name == spvReflection.readOnlyResources[j].name)
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
else if((spvReflection.readOnlyResources[j].bindArraySize > 1))
|
||||
{
|
||||
rdcstr &baseName = spvReflection.readOnlyResources[j].name;
|
||||
for(uint32_t idx = 0; idx < spvReflection.readOnlyResources[j].bindArraySize; idx++)
|
||||
{
|
||||
rdcstr resName = StringFormat::Fmt("%s[%u]", baseName.c_str(), idx);
|
||||
if(reflection->readOnlyResources[i].name == resName)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(found)
|
||||
{
|
||||
convertedPatchData.roInterface.resize_for_index(i);
|
||||
convertedPatchData.roInterface[i] = spvPatchData.roInterface[j];
|
||||
convertedRefl.readOnlyResources.resize_for_index(i);
|
||||
convertedRefl.readOnlyResources[i] = spvReflection.readOnlyResources[j];
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -490,12 +506,28 @@ void WrappedOpenGL::ShaderData::ProcessCompilation(WrappedOpenGL &drv, ResourceI
|
||||
for(size_t j = 0; j < spvReflection.readWriteResources.size(); j++)
|
||||
{
|
||||
if(reflection->readWriteResources[i].name == spvReflection.readWriteResources[j].name)
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
else if((spvReflection.readWriteResources[j].bindArraySize > 1))
|
||||
{
|
||||
rdcstr &baseName = spvReflection.readWriteResources[j].name;
|
||||
for(uint32_t idx = 0; idx < spvReflection.readWriteResources[j].bindArraySize; idx++)
|
||||
{
|
||||
rdcstr resName = StringFormat::Fmt("%s[%u]", baseName.c_str(), idx);
|
||||
if(reflection->readWriteResources[i].name == resName)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(found)
|
||||
{
|
||||
convertedPatchData.rwInterface.resize_for_index(i);
|
||||
convertedPatchData.rwInterface[i] = spvPatchData.rwInterface[j];
|
||||
convertedRefl.readWriteResources.resize_for_index(i);
|
||||
convertedRefl.readWriteResources[i] = spvReflection.readWriteResources[j];
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -560,12 +592,28 @@ void WrappedOpenGL::ShaderData::ProcessCompilation(WrappedOpenGL &drv, ResourceI
|
||||
for(size_t j = 0; j < spvReflection.samplers.size(); j++)
|
||||
{
|
||||
if(reflection->samplers[i].name == spvReflection.samplers[j].name)
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
else if((spvReflection.samplers[j].bindArraySize > 1))
|
||||
{
|
||||
rdcstr &baseName = spvReflection.samplers[j].name;
|
||||
for(uint32_t idx = 0; idx < spvReflection.samplers[j].bindArraySize; idx++)
|
||||
{
|
||||
rdcstr resName = StringFormat::Fmt("%s[%u]", baseName.c_str(), idx);
|
||||
if(reflection->samplers[i].name == resName)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(found)
|
||||
{
|
||||
convertedPatchData.samplerInterface.resize_for_index(i);
|
||||
convertedPatchData.samplerInterface[i] = spvPatchData.samplerInterface[j];
|
||||
convertedRefl.samplers.resize_for_index(i);
|
||||
convertedRefl.samplers[i] = spvReflection.samplers[j];
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user