From 0db6e249293b85338acb77f8858c823422949c3f Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 16 Jan 2019 21:49:38 -0500 Subject: Not finding dxil no longer an error. Outputs a warning. (#781) * * Allow dxc compilation to take place if dxil is not found. * Output a warning that output will not be signed. * Remove .dll from dxil in warning so more applicable cross platform. --- source/slang/compiler.cpp | 3 +-- source/slang/diagnostic-defs.h | 1 + source/slang/dxc-support.cpp | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/slang/compiler.cpp b/source/slang/compiler.cpp index 895c8d159..a003cf33d 100644 --- a/source/slang/compiler.cpp +++ b/source/slang/compiler.cpp @@ -192,8 +192,7 @@ namespace Slang { #if SLANG_ENABLE_DXIL_SUPPORT // Must have dxc - return (session->getOrLoadSharedLibrary(SharedLibraryType::Dxc, nullptr) && - session->getOrLoadSharedLibrary(SharedLibraryType::Dxil, nullptr)) ? SLANG_OK : SLANG_E_NOT_FOUND; + return session->getOrLoadSharedLibrary(SharedLibraryType::Dxc, nullptr) ? SLANG_OK : SLANG_E_NOT_FOUND; #endif break; } diff --git a/source/slang/diagnostic-defs.h b/source/slang/diagnostic-defs.h index 4a43cf8e4..a7c89321d 100644 --- a/source/slang/diagnostic-defs.h +++ b/source/slang/diagnostic-defs.h @@ -447,6 +447,7 @@ DIAGNOSTIC(51092, Error, stageDoesntHaveInputWorld, "'$0' doesn't appear to have DIAGNOSTIC(52000, Error, multiLevelBreakUnsupported, "control flow appears to require multi-level `break`, which Slang does not yet support"); +DIAGNOSTIC(52001, Warning, dxilNotFound, "dxil shared library not found, so 'dxc' output cannot be signed! Shader code will not be runnable in non-development environments."); // 99999 - Internal compiler errors, and not-yet-classified diagnostics. diff --git a/source/slang/dxc-support.cpp b/source/slang/dxc-support.cpp index 7fe22191b..7d2d6dc0c 100644 --- a/source/slang/dxc-support.cpp +++ b/source/slang/dxc-support.cpp @@ -64,6 +64,17 @@ namespace Slang return SLANG_FAIL; } + { + if (!session->getSharedLibrary(SharedLibraryType::Dxil)) + { + // If can't load dxil - dxc will not be able to sign output + // Output a suitable warning to the user + auto& sink = entryPoint->compileRequest->mSink; + + sink.diagnose(SourceLoc(), Diagnostics::dxilNotFound); + } + } + ComPtr dxcCompiler; SLANG_RETURN_ON_FAIL(dxcCreateInstance( CLSID_DxcCompiler, -- cgit v1.2.3