Merge pull request #133 from AWoloszyn/spirv-memory

Free memory associated with SPIR-V generation and the pragmaTable.
This commit is contained in:
John Kessenich 2016-01-18 10:48:07 -07:00
commit 3e9add360d
5 changed files with 109 additions and 93 deletions

View file

@ -1613,7 +1613,13 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
void TIntermAggregate::addToPragmaTable(const TPragmaTable& pTable)
{
assert(!pragmaTable);
pragmaTable = new TPragmaTable();
// We allocate this with the thread-pool allocator because the destructors
// for TIntermNode's are never called. When TIntermNodes are no longer
// needed, the pool allocator destroys all memory at once without
// destruction.
void* memory = GetThreadPoolAllocator().allocate(sizeof(TPragmaTable));
pragmaTable = new(memory) TPragmaTable();
*pragmaTable = pTable;
}