Skip to content

Commit cc075b7

Browse files
authored
Fix spSetDumpIntermediates. (shader-slang#1931)
1 parent ebb29e6 commit cc075b7

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

source/slang/slang-compiler.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2049,6 +2049,7 @@ namespace Slang
20492049
m_program);
20502050
backEndRequest->shouldDumpIR =
20512051
(m_targetReq->getTargetFlags() & SLANG_TARGET_FLAG_DUMP_IR) != 0;
2052+
backEndRequest->shouldDumpIntermediates = m_targetReq->shouldDumpIntermediates();
20522053

20532054
return _createEntryPointResult(
20542055
entryPointIndex,

source/slang/slang-compiler.h

+7
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,10 @@ namespace Slang
13011301
{
13021302
lineDirectiveMode = mode;
13031303
}
1304+
void setDumpIntermediates(bool value)
1305+
{
1306+
dumpIntermediates = value;
1307+
}
13041308
void addCapability(CapabilityAtom capability);
13051309

13061310
bool shouldEmitSPIRVDirectly()
@@ -1313,6 +1317,8 @@ namespace Slang
13131317
return (targetFlags & SLANG_TARGET_FLAG_GENERATE_WHOLE_PROGRAM) != 0;
13141318
}
13151319

1320+
bool shouldDumpIntermediates() { return dumpIntermediates; }
1321+
13161322
Linkage* getLinkage() { return linkage; }
13171323
CodeGenTarget getTarget() { return format; }
13181324
Profile getTargetProfile() { return targetProfile; }
@@ -1340,6 +1346,7 @@ namespace Slang
13401346
List<CapabilityAtom> rawCapabilities;
13411347
CapabilitySet cookedCapabilities;
13421348
LineDirectiveMode lineDirectiveMode = LineDirectiveMode::Default;
1349+
bool dumpIntermediates = false;
13431350
};
13441351

13451352
/// Are we generating code for a D3D API?

source/slang/slang.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -3921,6 +3921,13 @@ void EndToEndCompileRequest::setCompileFlags(SlangCompileFlags flags)
39213921
void EndToEndCompileRequest::setDumpIntermediates(int enable)
39223922
{
39233923
getBackEndReq()->shouldDumpIntermediates = (enable != 0);
3924+
3925+
// Change all existing targets to use the new setting.
3926+
auto linkage = getLinkage();
3927+
for (auto& target : linkage->targets)
3928+
{
3929+
target->setDumpIntermediates(enable != 0);
3930+
}
39243931
}
39253932

39263933
void EndToEndCompileRequest::setDumpIntermediatePrefix(const char* prefix)

0 commit comments

Comments
 (0)