mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 05:20:45 +00:00
Add helper to find and cache void type
This commit is contained in:
@@ -1233,14 +1233,7 @@ Program::Program(const byte *bytes, size_t length)
|
||||
|
||||
if(op.ops.empty())
|
||||
{
|
||||
for(size_t i = 0; i < m_Types.size(); i++)
|
||||
{
|
||||
if(m_Types[i].isVoid())
|
||||
{
|
||||
inst.type = &m_Types[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
inst.type = GetVoidType();
|
||||
|
||||
RDCASSERT(inst.type);
|
||||
}
|
||||
@@ -1441,6 +1434,26 @@ const Metadata *Program::GetFunctionMetadata(const Function &f, uint64_t v)
|
||||
return idx < m_Metadata.size() ? &m_Metadata[idx] : &f.metadata[idx - m_Metadata.size()];
|
||||
}
|
||||
|
||||
const DXIL::Type *Program::GetVoidType()
|
||||
{
|
||||
if(m_VoidType)
|
||||
return m_VoidType;
|
||||
|
||||
for(size_t i = 0; i < m_Types.size(); i++)
|
||||
{
|
||||
if(m_Types[i].isVoid())
|
||||
{
|
||||
m_VoidType = &m_Types[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!m_VoidType)
|
||||
RDCERR("Couldn't find void type");
|
||||
|
||||
return m_VoidType;
|
||||
}
|
||||
|
||||
Metadata::~Metadata()
|
||||
{
|
||||
SAFE_DELETE(dwarf);
|
||||
|
||||
@@ -395,6 +395,7 @@ private:
|
||||
const Type *GetSymbolType(const Function &f, Symbol s);
|
||||
const Value *GetFunctionValue(const Function &f, uint64_t v);
|
||||
const Metadata *GetFunctionMetadata(const Function &f, uint64_t v);
|
||||
const Type *GetVoidType();
|
||||
|
||||
DXBC::ShaderType m_Type;
|
||||
uint32_t m_Major, m_Minor;
|
||||
@@ -407,6 +408,7 @@ private:
|
||||
rdcarray<rdcstr> m_Kinds;
|
||||
|
||||
rdcarray<Type> m_Types;
|
||||
const Type *m_VoidType = NULL;
|
||||
|
||||
rdcarray<Attributes> m_AttributeGroups;
|
||||
rdcarray<Attributes> m_Attributes;
|
||||
|
||||
Reference in New Issue
Block a user