diff --git a/src/ComputeSharp.Shaders/ShaderRunner.cs b/src/ComputeSharp.Shaders/ShaderRunner.cs
index 85bc2429..b962676d 100644
--- a/src/ComputeSharp.Shaders/ShaderRunner.cs
+++ b/src/ComputeSharp.Shaders/ShaderRunner.cs
@@ -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);
diff --git a/src/ComputeSharp.Shaders/Translation/ShaderCompiler.cs b/src/ComputeSharp.Shaders/Translation/ShaderCompiler.cs
index 639d6eee..0cedbcaf 100644
--- a/src/ComputeSharp.Shaders/Translation/ShaderCompiler.cs
+++ b/src/ComputeSharp.Shaders/Translation/ShaderCompiler.cs
@@ -8,23 +8,19 @@ namespace ComputeSharp.Shaders.Translation
///
/// A that uses the APIs to compile compute shaders
///
- 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
}
- ///
- /// Gets the singleton instance to use
- ///
- public static ShaderCompiler Instance { get; } = new ShaderCompiler();
-
///
/// The instance to use to create the bytecode for HLSL sources
///
- private readonly IDxcLibrary Library = Dxc.CreateDxcLibrary();
+ private static readonly IDxcLibrary Library;
///
/// Compiles a new HLSL shader from the input source code
@@ -32,7 +28,7 @@ namespace ComputeSharp.Shaders.Translation
/// The HLSL source code to compile
/// The bytecode for the compiled shader
[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 });