diff --git a/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs b/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs index ad880f5d..2f65e9a8 100644 --- a/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs +++ b/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs @@ -1,5 +1,5 @@ using System; -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; namespace ComputeSharp.Graphics.Buffers.Abstract { diff --git a/src/ComputeSharp.Graphics/Buffers/Abstract/HlslStructuredBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/Abstract/HlslStructuredBuffer{T}.cs index e7a0f2d0..92ad8911 100644 --- a/src/ComputeSharp.Graphics/Buffers/Abstract/HlslStructuredBuffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/Abstract/HlslStructuredBuffer{T}.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using ComputeSharp.Graphics.Buffers.Enums; using ComputeSharp.Graphics.Helpers; -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; using CommandList = ComputeSharp.Graphics.Commands.CommandList; namespace ComputeSharp.Graphics.Buffers.Abstract diff --git a/src/ComputeSharp.Graphics/Buffers/Buffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/Buffer{T}.cs index 7ccd975e..aefda97e 100644 --- a/src/ComputeSharp.Graphics/Buffers/Buffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/Buffer{T}.cs @@ -3,7 +3,7 @@ using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; using ComputeSharp.Graphics.Buffers.Abstract; using ComputeSharp.Graphics.Buffers.Enums; -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; namespace ComputeSharp.Graphics.Buffers { diff --git a/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs index 4d5dc28f..591d6dda 100644 --- a/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs @@ -7,7 +7,7 @@ using ComputeSharp.Graphics; using ComputeSharp.Graphics.Buffers.Abstract; using ComputeSharp.Graphics.Buffers.Enums; using ComputeSharp.Graphics.Helpers; -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; using CommandList = ComputeSharp.Graphics.Commands.CommandList; namespace ComputeSharp diff --git a/src/ComputeSharp.Graphics/Commands/Abstract/CommandController.cs b/src/ComputeSharp.Graphics/Commands/Abstract/CommandController.cs index 2c0d895e..618eecfa 100644 --- a/src/ComputeSharp.Graphics/Commands/Abstract/CommandController.cs +++ b/src/ComputeSharp.Graphics/Commands/Abstract/CommandController.cs @@ -1,5 +1,5 @@ using System; -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; namespace ComputeSharp.Graphics.Commands.Abstract { diff --git a/src/ComputeSharp.Graphics/Commands/CommandAllocatorPool.cs b/src/ComputeSharp.Graphics/Commands/CommandAllocatorPool.cs index 8beff52f..0081dbce 100644 --- a/src/ComputeSharp.Graphics/Commands/CommandAllocatorPool.cs +++ b/src/ComputeSharp.Graphics/Commands/CommandAllocatorPool.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Diagnostics.Contracts; using ComputeSharp.Graphics.Commands.Abstract; -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; namespace ComputeSharp.Graphics.Commands { diff --git a/src/ComputeSharp.Graphics/Commands/CommandList.cs b/src/ComputeSharp.Graphics/Commands/CommandList.cs index de0a4d99..52128f17 100644 --- a/src/ComputeSharp.Graphics/Commands/CommandList.cs +++ b/src/ComputeSharp.Graphics/Commands/CommandList.cs @@ -1,7 +1,7 @@ using System; using ComputeSharp.Graphics.Buffers.Abstract; using ComputeSharp.Graphics.Commands.Abstract; -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; namespace ComputeSharp.Graphics.Commands { diff --git a/src/ComputeSharp.Graphics/Commands/PipelineState.cs b/src/ComputeSharp.Graphics/Commands/PipelineState.cs index 64350e46..cdf5ae86 100644 --- a/src/ComputeSharp.Graphics/Commands/PipelineState.cs +++ b/src/ComputeSharp.Graphics/Commands/PipelineState.cs @@ -1,4 +1,4 @@ -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; namespace ComputeSharp.Graphics.Commands { diff --git a/src/ComputeSharp.Graphics/ComputeSharp.Graphics.csproj b/src/ComputeSharp.Graphics/ComputeSharp.Graphics.csproj index c9360703..68ebf225 100644 --- a/src/ComputeSharp.Graphics/ComputeSharp.Graphics.csproj +++ b/src/ComputeSharp.Graphics/ComputeSharp.Graphics.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/ComputeSharp.Graphics/DescriptorAllocator.cs b/src/ComputeSharp.Graphics/DescriptorAllocator.cs index b222f967..38ffbb17 100644 --- a/src/ComputeSharp.Graphics/DescriptorAllocator.cs +++ b/src/ComputeSharp.Graphics/DescriptorAllocator.cs @@ -1,5 +1,5 @@ using System; -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; namespace ComputeSharp.Graphics { diff --git a/src/ComputeSharp.Graphics/GraphicsDevice.cs b/src/ComputeSharp.Graphics/GraphicsDevice.cs index 8094c30a..eba25ff1 100644 --- a/src/ComputeSharp.Graphics/GraphicsDevice.cs +++ b/src/ComputeSharp.Graphics/GraphicsDevice.cs @@ -1,9 +1,9 @@ using System; using System.Threading; using ComputeSharp.Graphics.Commands; +using Vortice.Direct3D12; using Vortice.DirectX.Direct3D; -using Vortice.DirectX.Direct3D12; -using Vortice.DirectX.DXGI; +using Vortice.DXGI; using CommandList = ComputeSharp.Graphics.Commands.CommandList; namespace ComputeSharp.Graphics diff --git a/src/ComputeSharp.Graphics/Helpers/DeviceHelper.cs b/src/ComputeSharp.Graphics/Helpers/DeviceHelper.cs index 7b19ebd9..ff73ec3a 100644 --- a/src/ComputeSharp.Graphics/Helpers/DeviceHelper.cs +++ b/src/ComputeSharp.Graphics/Helpers/DeviceHelper.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using System.Diagnostics.Contracts; +using Vortice.Direct3D12; using Vortice.DirectX.Direct3D; -using Vortice.DirectX.Direct3D12; -using Vortice.DirectX.DXGI; +using Vortice.DXGI; namespace ComputeSharp.Graphics.Helpers { diff --git a/src/ComputeSharp.Shaders/ComputeSharp.Shaders.csproj b/src/ComputeSharp.Shaders/ComputeSharp.Shaders.csproj index d637e7d3..91e57c24 100644 --- a/src/ComputeSharp.Shaders/ComputeSharp.Shaders.csproj +++ b/src/ComputeSharp.Shaders/ComputeSharp.Shaders.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/ComputeSharp.Shaders/Renderer/Templates/ShaderTemplate.mustache b/src/ComputeSharp.Shaders/Renderer/Templates/ShaderTemplate.mustache index f760a911..8375efb6 100644 --- a/src/ComputeSharp.Shaders/Renderer/Templates/ShaderTemplate.mustache +++ b/src/ComputeSharp.Shaders/Renderer/Templates/ShaderTemplate.mustache @@ -2,7 +2,6 @@ * AUTO GENERATED * =============== * This shader was created by ComputeSharp. - * Builder version: 1.0.0 * For info or issues: https://github.com/Sergio0694/ComputeSharp */ {{!Captured variables buffer}} diff --git a/src/ComputeSharp.Shaders/ShaderRunner.cs b/src/ComputeSharp.Shaders/ShaderRunner.cs index 01f3818d..b962676d 100644 --- a/src/ComputeSharp.Shaders/ShaderRunner.cs +++ b/src/ComputeSharp.Shaders/ShaderRunner.cs @@ -8,7 +8,7 @@ using ComputeSharp.Graphics.Buffers.Extensions; using ComputeSharp.Shaders.Renderer; using ComputeSharp.Shaders.Renderer.Models; using ComputeSharp.Shaders.Translation; -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; using CommandList = ComputeSharp.Graphics.Commands.CommandList; using PipelineState = ComputeSharp.Graphics.Commands.PipelineState; @@ -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 e217ca18..0cedbcaf 100644 --- a/src/ComputeSharp.Shaders/Translation/ShaderCompiler.cs +++ b/src/ComputeSharp.Shaders/Translation/ShaderCompiler.cs @@ -1,6 +1,6 @@ using System; using System.Diagnostics.Contracts; -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; using Vortice.Dxc; namespace ComputeSharp.Shaders.Translation @@ -8,17 +8,19 @@ namespace ComputeSharp.Shaders.Translation /// /// A that uses the APIs to compile compute shaders /// - internal sealed class ShaderCompiler + internal static class ShaderCompiler { - /// - /// Gets the singleton instance to use - /// - public static ShaderCompiler Instance { get; } = new 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 + } /// /// 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 @@ -26,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 }); diff --git a/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs b/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs index d550d1dc..599ade23 100644 --- a/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs +++ b/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs @@ -11,7 +11,7 @@ using ComputeSharp.Shaders.Renderer.Models.Fields.Abstract; using ComputeSharp.Shaders.Translation.Models; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; -using Vortice.DirectX.Direct3D12; +using Vortice.Direct3D12; #pragma warning disable CS8618 // Non-nullable field is uninitialized diff --git a/src/ComputeSharp/Gpu.cs b/src/ComputeSharp/Gpu.cs index ed09bbcf..f6971963 100644 --- a/src/ComputeSharp/Gpu.cs +++ b/src/ComputeSharp/Gpu.cs @@ -4,8 +4,8 @@ using System.Diagnostics.Contracts; using System.Linq; using ComputeSharp.Graphics; using ComputeSharp.Graphics.Helpers; -using Vortice.DirectX.Direct3D12; -using Vortice.DirectX.DXGI; +using Vortice.Direct3D12; +using Vortice.DXGI; namespace ComputeSharp {