Fixed error handling for SetDllDirectoryW
このコミットが含まれているのは:
1 親
db21568970
コミット
6b50fe2261
1ファイル変更
+17
-6
@@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.Core.Extensions;
|
||||
using ComputeSharp.Exceptions;
|
||||
using Microsoft.Toolkit.Diagnostics;
|
||||
using TerraFX.Interop;
|
||||
using FX = TerraFX.Interop.Windows;
|
||||
|
||||
@@ -37,12 +38,7 @@ namespace ComputeSharp.Shaders.Translation
|
||||
/// </summary>
|
||||
static ShaderCompiler()
|
||||
{
|
||||
FX.ResolveLibrary += ResolveLibrary;
|
||||
|
||||
fixed (char* p = @"runtimes\win-x64\native")
|
||||
{
|
||||
FX.SetDllDirectoryW((ushort*)p).Assert();
|
||||
}
|
||||
InitializeDxcLibrariesLoading();
|
||||
|
||||
using ComPtr<IDxcCompiler> dxcCompiler = default;
|
||||
using ComPtr<IDxcLibrary> dxcLibrary = default;
|
||||
@@ -61,6 +57,21 @@ namespace ComputeSharp.Shaders.Translation
|
||||
DxcIncludeHandler = dxcIncludeHandler.Move();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the DLL resolvers for the dxcompiler.dll and dxil.dll libraries.
|
||||
/// </summary>
|
||||
private static void InitializeDxcLibrariesLoading()
|
||||
{
|
||||
FX.ResolveLibrary += ResolveLibrary;
|
||||
|
||||
fixed (char* p = @"runtimes\win-x64\native")
|
||||
{
|
||||
int result = FX.SetDllDirectoryW((ushort*)p);
|
||||
|
||||
if (result == 0) ThrowHelper.ThrowWin32Exception();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A custom resolver to override the default library resolution behavior for the DXC and DXIL libraries.
|
||||
/// </summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする