Include per-shader and per-program pools in the new C++ interface to glslang. (And picked up missing test result from previous check in.)

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23844 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-11-01 03:08:40 +00:00
parent 83a6b1edfc
commit 5b0f13acbc
4 changed files with 123 additions and 101 deletions

View file

@ -537,7 +537,7 @@ void CompileAndLinkShaders()
// Per-shader processing...
//
glslang::TProgram program;
glslang::TProgram& program = *new glslang::TProgram;
glslang::TWorkItem* workItem;
while (Worklist.remove(workItem)) {
EShLanguage stage = FindLanguage(workItem->name);
@ -575,13 +575,15 @@ void CompileAndLinkShaders()
puts(program.getInfoDebugLog());
}
// free everything up
// Free everything up, program has to go before the shaders
// because it might have merged stuff from the shaders, and
// the stuff from the shaders has to have its destructors called
// before the pools holding the memory in the shaders is freed.
delete &program;
while (shaders.size() > 0) {
delete shaders.back();
shaders.pop_back();
}
// TODO: memory: for each compile, need a GetThreadPoolAllocator().pop();
}
int C_DECL main(int argc, char* argv[])
@ -613,7 +615,6 @@ int C_DECL main(int argc, char* argv[])
ProcessConfigFile();
//
// Two modes:
// 1) linking all arguments together, single-threaded, new C++ interface