Add HlslBytecodeSyntaxProcessor shared helper type

このコミットが含まれているのは:
Sergio Pedri committed 2023-12-17 13:31:17 +01:00
1 親 ef821be2b2
コミット 2a519c3f51
11ファイル変更
+284 -22

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

@@ -0,0 +1,39 @@
using System;
using System.Threading;
using ComputeSharp.D2D1.Shaders.Translation;
using ComputeSharp.D2D1.SourceGenerators.Models;
using Windows.Win32;
using Windows.Win32.Graphics.Direct3D;
namespace ComputeSharp.SourceGeneration.SyntaxProcessors;
/// <inheritdoc/>
partial class HlslBytecodeSyntaxProcessor
{
/// <summary>
/// The name of the attribute to enable double precision support.
/// </summary>
private const string RequiresDoublePrecisionSupportAttributeName = "ComputeSharp.D2D1.D2DRequiresDoublePrecisionSupportAttribute";
/// <inheritdoc/>
private static partial ComPtr<ID3DBlob> Compile(HlslBytecodeInfoKey key, CancellationToken token)
{
return D3DCompiler.Compile(
key.HlslSource.AsSpan(),
key.ShaderProfile,
key.CompileOptions,
token);
}
/// <inheritdoc/>
private static unsafe partial bool IsDoublePrecisionSupportRequired(ID3DBlob* d3DBlob)
{
return D3DCompiler.IsDoublePrecisionSupportRequired(d3DBlob);
}
/// <inheritdoc/>
private static partial string FixupErrorMessage(string message)
{
return D3DCompiler.PrettifyFxcErrorMessage(message);
}
}