microsoft / DirectXShaderCompiler

This repo hosts the source for the DirectX Shader Compiler which is based on LLVM/Clang.
Other
3.05k stars 677 forks source link

Exception when compiling shaders with the Release version built from source #6916

Open GlassBeaver opened 1 week ago

GlassBeaver commented 1 week ago

Description Compiling shaders with DXC built from source in the Release configuration from commit 05334a7 produces an exception. The Debug configuration works fine.

Steps to Reproduce Build DXC from source from commit 05334a7 in the Release configuration and try & compile any shader with it via the exe.

Actual Behavior

Exception thrown at 0x00007FFDD9302E20 (msvcp140.dll) in dxc.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

Stack trace:

msvcp140.dll!00007ffdd9302e20()    Unknown
>    [Inline Frame] dxcompiler.dll!std::_Mutex_base::lock() Line 52    C++
     [Inline Frame] dxcompiler.dll!std::lock_guard<std::recursive_mutex>::{ctor}(std::recursive_mutex &) Line 454    C++
     dxcompiler.dll!llvm::ManagedStaticBase::RegisterManagedStatic(void *(*)() Creator, void(*)(void *) Deleter) Line 45    C++
     [Inline Frame] dxcompiler.dll!llvm::ManagedStatic<llvm::PassRegistry,llvm::object_creator<llvm::PassRegistry>,llvm::object_deleter<llvm::PassRegistry>>::operator*() Line 103    C++
     dxcompiler.dll!llvm::PassRegistry::getPassRegistry() Line 57    C++
     dxcompiler.dll!hlsl::SetupRegistryPassForHLSL() Line 8    C++
     [Inline Frame] dxcompiler.dll!InitMaybeFail() Line 66    C++
     dxcompiler.dll!DllMain(HINSTANCE__ * hinstDLL, unsigned long Reason, void * reserved) Line 104    C++
     dxcompiler.dll!dllmain_dispatch(HINSTANCE__ * const instance, const unsigned long reason, void * const reserved) Line 281    C++
     ntdll.dll!00007ffdf57d8b7f()    Unknown
     ntdll.dll!00007ffdf581d51d()    Unknown
     ntdll.dll!00007ffdf581d2ce()    Unknown
     ntdll.dll!00007ffdf57ddb0d()    Unknown
     ntdll.dll!00007ffdf57d8e20()    Unknown
     ntdll.dll!00007ffdf57c90ac()    Unknown
     ntdll.dll!00007ffdf57da73a()    Unknown
     KernelBase.dll!00007ffdf2dcb412()    Unknown
     KernelBase.dll!00007ffdf2dc74b1()    Unknown
     KernelBase.dll!00007ffdf2e21acf()    Unknown
     [Inline Frame] dxc.exe!dxc::DxcDllSupport::InitializeInternal(const char *) Line 34    C++
     [Inline Frame] dxc.exe!dxc::DxcDllSupport::Initialize() Line 91    C++
     dxc.exe!dxc::EnsureEnabled(dxc::DxcDllSupport & dxcSupport) Line 78    C++
     dxc.exe!dxc::main(int argc, const wchar_t * * argv_) Line 1465    C++
     [Inline Frame] dxc.exe!invoke_main() Line 90    C++
     dxc.exe!__scrt_common_main_seh() Line 288    C++
     kernel32.dll!00007ffdf429257d()    Unknown
     ntdll.dll!00007ffdf580af28()    Unknown

Environment

damyanp commented 3 days ago

This seems likely caused by https://learn.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=msvc-170.

I'll keep this issue open and in dormant for now, but if you find this does resolve things for you can you let us know please? Thanks!

GlassBeaver commented 1 day ago

Hi, Thanks for the link but I'll have to admit I'm not sure what I should be looking for - I'm compiling everything with the same version of VS2022, MSVC, Win 11 and Windows SDK.