https://github.com/shader-slang/slang
Raw File
Tip revision: d06a78d935b2743494d47ed5cd3f36e38ac9c5ac authored by Yong He on 04 February 2022, 03:17:30 UTC
Add gfx interop to allow more direct D3D12 usage scenarios. (#2117)
Tip revision: d06a78d
slang-ir-strip-witness-tables.cpp
// slang-ir-strip-witness-tables.cpp
#include "slang-ir-strip-witness-tables.h"

#include "slang-ir.h"
#include "slang-ir-insts.h"

namespace Slang
{

void stripWitnessTables(IRModule* module)
{
    // Our goal here is to empty out any witness tables in
    // the IR so that they don't keep other symbols alive
    // further into compilation. Luckily we expect all
    // witness tables to live directly at the global scope
    // (or inside of a generic, which we can ignore for
    // now because the emit logic also ignores generics),
    // and there is a single function we can call to
    // remove all of the content from the witness tables
    // (since the key-value associations are stored as
    // children of each table).

    for( auto inst : module->getGlobalInsts() )
    {
        auto witnessTable = as<IRWitnessTable>(inst);
        if(!witnessTable)
            continue;

        witnessTable->removeAndDeallocateAllDecorationsAndChildren();
    }
}

}
back to top