Fixed dxil.dll loading
このコミットが含まれているのは:
1 親
7dcefba4fe
コミット
0e51830adb
2ファイル変更
+5
-9
検索条件に一致するファイルはありません
@@ -87,7 +87,7 @@ namespace ComputeSharp.Shaders
|
||||
string shaderSource = ShaderRenderer.Instance.Render(shaderInfo);
|
||||
|
||||
// Compile the loaded shader to HLSL bytecode
|
||||
ShaderBytecode shaderBytecode = ShaderCompiler.Instance.CompileShader(shaderSource);
|
||||
ShaderBytecode shaderBytecode = ShaderCompiler.CompileShader(shaderSource);
|
||||
|
||||
// Cache for later use
|
||||
shaderData = (shaderLoader, shaderBytecode);
|
||||
|
||||
@@ -8,23 +8,19 @@ namespace ComputeSharp.Shaders.Translation
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that uses the <see cref="DxcCompiler"/> APIs to compile compute shaders
|
||||
/// </summary>
|
||||
internal sealed class ShaderCompiler
|
||||
internal static class ShaderCompiler
|
||||
{
|
||||
// Loads the dxil.dll library, needed to create a pipeline state for a shader to dispatch
|
||||
static ShaderCompiler()
|
||||
{
|
||||
Dxil.LoadLibrary();
|
||||
Library = Dxc.CreateDxcLibrary(); // This needs to be loaded after dxil.dll
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the singleton <see cref="ShaderCompiler"/> instance to use
|
||||
/// </summary>
|
||||
public static ShaderCompiler Instance { get; } = new ShaderCompiler();
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IDxcLibrary"/> instance to use to create the bytecode for HLSL sources
|
||||
/// </summary>
|
||||
private readonly IDxcLibrary Library = Dxc.CreateDxcLibrary();
|
||||
private static readonly IDxcLibrary Library;
|
||||
|
||||
/// <summary>
|
||||
/// Compiles a new HLSL shader from the input source code
|
||||
@@ -32,7 +28,7 @@ namespace ComputeSharp.Shaders.Translation
|
||||
/// <param name="source">The HLSL source code to compile</param>
|
||||
/// <returns>The bytecode for the compiled shader</returns>
|
||||
[Pure]
|
||||
public ShaderBytecode CompileShader(string source)
|
||||
public static ShaderBytecode CompileShader(string source)
|
||||
{
|
||||
var result = DxcCompiler.Compile(DxcShaderStage.ComputeShader, source, "CSMain", string.Empty, new DxcCompilerOptions { ShaderModel = DxcShaderModel.Model6_1 });
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする