Add an interface to get the GLSL IO mapper and resolver

The TProgram::mapIO method takes a TIoMapResolver and a TIoMapper,
however the only way to obtain instances of these was from methods in
iomapper.h. Rather than try to expose that header as part of the API,
new methods are added to the public ShaderLang.h header to create a
TDefaultGlslIoResolver and a TGlslIoMapper and return them as pointers
to their respective base classes, which are defined in the public
header.
This commit is contained in:
Arcady Goldmints-Orlov 2024-09-13 08:44:40 -07:00 committed by arcady-lunarg
parent 8bd9083bec
commit d081b4d8c6
3 changed files with 28 additions and 10 deletions

View file

@ -1716,6 +1716,10 @@ public:
virtual bool compile(TIntermNode*, int = 0, EProfile = ENoProfile) { return true; }
};
TIoMapper* GetGlslIoMapper() {
return static_cast<TIoMapper*>(new TGlslIoMapper());
}
TShader::TShader(EShLanguage s)
: stage(s), lengths(nullptr), stringNames(nullptr), preamble(""), overrideVersion(0)
{
@ -2164,6 +2168,12 @@ int TProgram::getNumAtomicCounters() const { return r
const TObjectReflection& TProgram::getAtomicCounter(int index) const { return reflection->getAtomicCounter(index); }
void TProgram::dumpReflection() { if (reflection != nullptr) reflection->dump(); }
TIoMapResolver* TProgram::getGlslIoResolver(EShLanguage stage) {
auto *intermediate = getIntermediate(stage);
if (!intermediate)
return NULL;
return static_cast<TIoMapResolver*>(new TDefaultGlslIoResolver(*intermediate));
}
//
// I/O mapping implementation.
//