diff --git a/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp b/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp index 95d6788af..3a04c5d24 100644 --- a/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp @@ -2383,6 +2383,48 @@ const DXIL::Type *Program::GetBoolType() return m_BoolType; } +const Type *Program::GetInt32Type() +{ + if(m_Int32Type) + return m_Int32Type; + + for(size_t i = 0; i < m_Types.size(); i++) + { + if(m_Types[i].type == Type::Scalar && m_Types[i].scalarType == Type::Int && + m_Types[i].bitWidth == 32) + { + m_Int32Type = &m_Types[i]; + break; + } + } + + if(!m_Int32Type) + RDCERR("Couldn't find void type"); + + return m_Int32Type; +} + +const Type *Program::GetInt8Type() +{ + if(m_Int8Type) + return m_Int8Type; + + for(size_t i = 0; i < m_Types.size(); i++) + { + if(m_Types[i].type == Type::Scalar && m_Types[i].scalarType == Type::Int && + m_Types[i].bitWidth == 8) + { + m_Int8Type = &m_Types[i]; + break; + } + } + + if(!m_Int8Type) + RDCERR("Couldn't find void type"); + + return m_Int8Type; +} + const Type *Program::GetPointerType(const Type *type, Type::PointerAddrSpace addrSpace) const { for(const Type &t : m_Types) diff --git a/renderdoc/driver/shaders/dxil/dxil_bytecode.h b/renderdoc/driver/shaders/dxil/dxil_bytecode.h index 083d88515..5889764a8 100644 --- a/renderdoc/driver/shaders/dxil/dxil_bytecode.h +++ b/renderdoc/driver/shaders/dxil/dxil_bytecode.h @@ -679,6 +679,8 @@ protected: uint32_t GetOrAssignMetaID(DebugLocation &l); const Type *GetVoidType(); const Type *GetBoolType(); + const Type *GetInt32Type(); + const Type *GetInt8Type(); const Type *GetPointerType(const Type *type, Type::PointerAddrSpace addrSpace) const; bytebuf m_Bytes; @@ -704,6 +706,8 @@ protected: rdcarray m_Types; const Type *m_VoidType = NULL; const Type *m_BoolType = NULL; + const Type *m_Int32Type = NULL; + const Type *m_Int8Type = NULL; rdcarray m_AttributeGroups; rdcarray m_AttributeSets;