Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix D3D12Core.dll loading problem for debug build #5315

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,21 @@ endif()

if(SLANG_ENABLE_PREBUILT_BINARIES)
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
# DX Agility SDK requires the D3D12*.DLL files to be placed under a sub-directory, "D3D12".
# https://devblogs.microsoft.com/directx/gettingstarted-dx12agility/#d3d12sdkpath-should-not-be-the-same-directory-as-the-application-exe
file(GLOB prebuilt_binaries "${CMAKE_SOURCE_DIR}/external/slang-binaries/bin/windows-x64/*")
file(GLOB prebuilt_d3d12_binaries "${CMAKE_SOURCE_DIR}/external/slang-binaries/bin/windows-x64/[dD]3[dD]12*")
list(REMOVE_ITEM prebuilt_binaries ${prebuilt_d3d12_binaries})
add_custom_target(
copy-prebuilt-binaries ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/$<CONFIG>/${runtime_subdir}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${prebuilt_binaries}
${CMAKE_BINARY_DIR}/$<CONFIG>/${runtime_subdir}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/$<CONFIG>/${runtime_subdir}/D3D12
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${prebuilt_d3d12_binaries}
${CMAKE_BINARY_DIR}/$<CONFIG>/${runtime_subdir}/D3D12
VERBATIM
)
endif()
Expand Down
8 changes: 0 additions & 8 deletions source/core/slang-render-api-util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,9 @@ static bool _canLoadSharedLibrary(const char* libName)
#if SLANG_WINDOWS_FAMILY
case RenderApiType::Vulkan: return _canLoadSharedLibrary("vulkan-1") || _canLoadSharedLibrary("vk_swiftshader");
case RenderApiType::WebGPU:
#if _DEBUG
// At the moment, some CI issue is preventing tests to run in Debug builds.
// As a work-around in order to allow us to enable tests in Release builds ASSP,
// we skip WebGPU tests in by returning false here.
// https://github.com/shader-slang/slang/issues/5233#issuecomment-2411380030
return false;
#else
return _canLoadSharedLibrary("webgpu_dawn") &&
_canLoadSharedLibrary("dxcompiler") &&
_canLoadSharedLibrary("dxil");
#endif // if SLANG_DEBUG
#elif SLANG_APPLE_FAMILY
case RenderApiType::Vulkan: return true;
case RenderApiType::Metal: return true;
Expand Down
3 changes: 3 additions & 0 deletions tools/render-test/slang-support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ void ShaderCompilerUtil::Output::reset()
case SLANG_SOURCE_LANGUAGE_CUDA:
spAddPreprocessorDefine(slangRequest, "__CUDA__", "1");
break;
case SLANG_SOURCE_LANGUAGE_WGSL:
spAddPreprocessorDefine(slangRequest, "__WGSL__", "1");
break;

default:
assert(!"unexpected");
Expand Down
4 changes: 3 additions & 1 deletion tools/slang-test/slang-test-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,8 @@ static SlangResult _extractRenderTestRequirements(const CommandLine& cmdLine, Te
break;
case RenderApiType::WebGPU:
target = SLANG_WGSL;
SLANG_ASSERT(!usePassthru);
nativeLanguage = SLANG_SOURCE_LANGUAGE_WGSL;
passThru = SLANG_PASS_THROUGH_TINT;
break;
}

Expand Down Expand Up @@ -4661,6 +4662,7 @@ SlangResult innerMain(int argc, char** argv)
for (auto& test : context.failedFileTests)
{
FileTestInfoImpl* fileTestInfo = static_cast<FileTestInfoImpl*>(test.Ptr());
TestReporter::SuiteScope suiteScope(&reporter, "tests");
TestReporter::TestScope scope(&reporter, fileTestInfo->testName);
reporter.addResult(TestResult::Fail);
}
Expand Down
Loading