Update source generators to support dynamic plugin

このコミットが含まれているのは:
Sergio Pedri committed 2021-12-19 16:45:12 +01:00
1 親 405f92d481
コミット 80044d69fd
5ファイル変更
+335 -195

検索条件に一致するファイルはありません

+25
ファイルの表示
@@ -0,0 +1,25 @@
using System;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
namespace ComputeSharp.__Internals;
/// <summary>
/// A <see langword="class"/> that uses the DXC APIs to compile compute shaders.
/// </summary>
public static class ShaderCompiler
{
/// <summary>
/// Compiles a new HLSL shader from the input source code.
/// </summary>
/// <param name="source">The HLSL source code to compile.</param>
/// <returns>The bytecode for the compiled shader.</returns>
public static unsafe IntPtr CompileShader(ReadOnlySpan<char> source)
{
using ComPtr<IDxcBlob> shader = Shaders.Translation.ShaderCompiler.Instance.CompileShader(source);
_ = shader.Get()->AddRef();
return (IntPtr)shader.Get();
}
}