mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-25 15:16:22 +00:00
Store descriptor type directly in shader resources for shader reflection
This commit is contained in:
@@ -256,6 +256,24 @@ static void MakeResourceList(bool srv, DXBC::DXBCContainer *dxbc,
|
||||
res.fixedBindSetOrSpace = r.space;
|
||||
res.bindArraySize = r.bindCount == 0 ? ~0U : r.bindCount;
|
||||
|
||||
if(res.isReadOnly)
|
||||
{
|
||||
res.descriptorType = DescriptorType::Image;
|
||||
if(!res.isTexture)
|
||||
res.descriptorType = (r.type == DXBC::ShaderInputBind::TYPE_TBUFFER ||
|
||||
r.type == DXBC::ShaderInputBind::TYPE_TEXTURE)
|
||||
? DescriptorType::TypedBuffer
|
||||
: DescriptorType::Buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.descriptorType = DescriptorType::ReadWriteImage;
|
||||
if(!res.isTexture)
|
||||
res.descriptorType = r.type == DXBC::ShaderInputBind::TYPE_UAV_RWTYPED
|
||||
? DescriptorType::ReadWriteTypedBuffer
|
||||
: DescriptorType::ReadWriteBuffer;
|
||||
}
|
||||
|
||||
Bindpoint map;
|
||||
map.arraySize = r.bindCount == 0 ? ~0U : r.bindCount;
|
||||
map.bindset = r.space;
|
||||
|
||||
@@ -1399,6 +1399,7 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
|
||||
if(res.name.empty())
|
||||
res.name = StringFormat::Fmt("atomic%u", global.id.value());
|
||||
res.resType = TextureType::Buffer;
|
||||
res.descriptorType = DescriptorType::ReadWriteBuffer;
|
||||
|
||||
res.variableType.columns = 1;
|
||||
res.variableType.rows = 1;
|
||||
@@ -1479,9 +1480,22 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
|
||||
res.variableType.baseType = imageType.retType.Type();
|
||||
|
||||
if(res.isReadOnly)
|
||||
{
|
||||
res.descriptorType =
|
||||
res.hasSampler ? DescriptorType::ImageSampler : DescriptorType::Image;
|
||||
if(!res.isTexture)
|
||||
res.descriptorType = DescriptorType::TypedBuffer;
|
||||
|
||||
roresources.push_back(shaderrespair(bindmap, global.id, res));
|
||||
}
|
||||
else
|
||||
{
|
||||
res.descriptorType = DescriptorType::ReadWriteImage;
|
||||
if(!res.isTexture)
|
||||
res.descriptorType = DescriptorType::ReadWriteTypedBuffer;
|
||||
|
||||
rwresources.push_back(shaderrespair(bindmap, global.id, res));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1552,6 +1566,7 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
|
||||
if(res.name.empty())
|
||||
res.name = StringFormat::Fmt("ssbo%u", global.id.value());
|
||||
res.resType = TextureType::Buffer;
|
||||
res.descriptorType = DescriptorType::ReadWriteBuffer;
|
||||
|
||||
res.fixedBindNumber = bindmap.bind;
|
||||
res.fixedBindSetOrSpace = bindmap.bindset;
|
||||
|
||||
Reference in New Issue
Block a user