Skip to content

Commit 2bf4855

Browse files
committed
skip DXC when DXCompiler not available.
1 parent 5cbab29 commit 2bf4855

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Tests/DiligentCoreTest/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if(WEBGPU_SUPPORTED)
6464
target_link_libraries(DiligentCoreTest PRIVATE libtint)
6565
endif()
6666

67-
if(PLATFORM_WIN32 AND NOT ${DILIGENT_NO_HLSL})
67+
if(PLATFORM_WIN32)
6868
copy_required_dlls(DiligentCoreTest
6969
DXC_REQUIRED YES
7070
)

Tests/DiligentCoreTest/src/ShaderTools/SPIRVShaderResourcesTest.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,20 @@ void TestSPIRVResources(const char* FilePa
244244

245245
if (!IsGLSL)
246246
{
247-
//Test with DXC
248-
const auto& SPIRV_DXC = LoadSPIRVFromHLSL(FilePath, ShaderType, true);
249-
ASSERT_FALSE(SPIRV_DXC.empty()) << "Failed to compile HLSL to SPIRV with DXC: " << FilePath;
247+
if (g_pDXCompiler && g_pDXCompiler->IsLoaded())
248+
{
249+
//Test with DXC
250+
const auto& SPIRV_DXC = LoadSPIRVFromHLSL(FilePath, ShaderType, true);
251+
ASSERT_FALSE(SPIRV_DXC.empty()) << "Failed to compile HLSL to SPIRV with DXC: " << FilePath;
250252

251-
LOG_INFO_MESSAGE("Testing with HLSL->SPIRV with DXC:\n", FilePath);
253+
LOG_INFO_MESSAGE("Testing with HLSL->SPIRV with DXC:\n", FilePath);
252254

253-
TestSPIRVResourcesInternal(FilePath, RefResources, SPIRV_DXC, ShaderType, CombinedSamplerSuffix);
255+
TestSPIRVResourcesInternal(FilePath, RefResources, SPIRV_DXC, ShaderType, CombinedSamplerSuffix);
256+
}
257+
else
258+
{
259+
LOG_INFO_MESSAGE("HLSL->SPIRV with DXC skipped because DXCompiler is not available:\n", FilePath);
260+
}
254261
}
255262
}
256263

0 commit comments

Comments
 (0)