Improve source generator support for dynamic shaders

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

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

+8 -3
ファイルの表示
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -7,16 +8,20 @@ namespace ComputeSharp.__Internals;
/// <summary>
/// A <see langword="class"/> that uses the DXC APIs to compile compute shaders.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This type is not intended to be used directly by user code")]
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>
/// <param name="builder">The <see cref="ArrayPoolStringBuilder"/> instance with the HLSL source code to compile.</param>
/// <returns>The bytecode for the compiled shader.</returns>
public static unsafe IntPtr CompileShader(ReadOnlySpan<char> source)
public static unsafe IntPtr CompileShader(ref ArrayPoolStringBuilder builder)
{
using ComPtr<IDxcBlob> shader = Shaders.Translation.ShaderCompiler.Instance.CompileShader(source);
using ComPtr<IDxcBlob> shader = Shaders.Translation.ShaderCompiler.Instance.CompileShader(builder.WrittenSpan);
builder.Dispose();
_ = shader.Get()->AddRef();