Skip to content

Commit 64f3075

Browse files
committed
Add module-dual-target-verify test
Fixes shader-slang#6517 Adds a new test to verify that dxil and spirv targets are stored separately in the precompiled blob.
1 parent d49f90d commit 64f3075

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

source/slang/slang.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -3752,12 +3752,18 @@ SlangResult EndToEndCompileRequest::executeActionsInner()
37523752
{
37533753
DiagnosticSinkWriter writer(frontEndReq->getSink());
37543754

3755-
dumpIR(
3755+
dumpIR(
37563756
translationUnit->getModule()->getIRModule(),
37573757
frontEndReq->m_irDumpOptions,
37583758
"PRECOMPILE_FOR_TARGET_COMPLETE_ALL",
37593759
frontEndReq->getSourceManager(),
37603760
&writer);
3761+
3762+
dumpIR(
3763+
translationUnit->getModule()->getIRModule()->getModuleInst(),
3764+
frontEndReq->m_irDumpOptions,
3765+
frontEndReq->getSourceManager(),
3766+
&writer);
37613767
}
37623768
}
37633769
}
@@ -5527,7 +5533,6 @@ RefPtr<ComponentType> CompositeComponentType::create(
55275533
// Y = compose(C,D);
55285534
// Z = compose(X,Y);
55295535
//
5530-
// W = compose(A, B, C, D);
55315536
//
55325537
// Then there is no observable difference between
55335538
// Z and W, so we might prefer to have them be identical.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// module-dual-target-verify.slang
2+
// Test that a slang-module can retrieve both SPIR-V and DXIL targets independently
3+
// and one does not affect the other
4+
5+
//TEST:SIMPLE(filecheck=CHECK):-multi-module -verify-module-dual-target
6+
7+
// First create a module that has both DXIL and SPIRV embedded
8+
// CHECK: Creating module with both DXIL and SPIRV embedded
9+
10+
// Verify both targets are present
11+
// CHECK: Precompiled blob for target DXIL exists: true
12+
// CHECK: Precompiled blob for target SPIRV exists: true
13+
14+
// Retrieve and check DXIL content
15+
// CHECK: Retrieved DXIL blob size: {{[1-9][0-9]+}}
16+
17+
// Retrieve and check SPIRV content
18+
// CHECK: Retrieved SPIRV blob size: {{[1-9][0-9]+}}
19+
20+
// When retrieving DXIL, SPIRV should remain untouched
21+
// CHECK: DXIL retrieval does not modify SPIRV blob
22+
23+
// When retrieving SPIRV, DXIL should remain untouched
24+
// CHECK: SPIRV retrieval does not modify DXIL blob
25+
26+
// Both blobs should have distinct hash values
27+
// CHECK-NOT: DXIL hash matches SPIRV hash
28+
// CHECK: DXIL and SPIRV blobs are separate

0 commit comments

Comments
 (0)