Share HlslBytecodeInfo model across D3D12/D2D1 generators

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-14 00:35:04 +02:00
1 親 fa8d9446cd
コミット 2c8d0d2385
8ファイル変更
+11 -47

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

@@ -1,5 +1,6 @@
using ComputeSharp.SourceGeneration.Extensions;
using ComputeSharp.SourceGeneration.Helpers;
using ComputeSharp.SourceGeneration.Models;
using ComputeSharp.SourceGenerators.Models;
namespace ComputeSharp.SourceGenerators;
+2 -2
ファイルの表示
@@ -160,7 +160,7 @@ partial class IShaderGenerator
}
catch (DxcCompilationException e)
{
return new HlslBytecodeInfo.DxcError(FixupExceptionMessage(e.Message));
return new HlslBytecodeInfo.CompilerError(FixupExceptionMessage(e.Message));
}
}
@@ -184,7 +184,7 @@ partial class IShaderGenerator
structDeclarationSymbol,
new object[] { structDeclarationSymbol, win32Error.HResult, win32Error.Message });
}
else if (info is HlslBytecodeInfo.DxcError dxcError)
else if (info is HlslBytecodeInfo.CompilerError dxcError)
{
diagnostic = DiagnosticInfo.Create(
EmbeddedBytecodeFailedWithDxcCompilationException,
-39
ファイルの表示
@@ -1,39 +0,0 @@
using ComputeSharp.SourceGeneration.Helpers;
namespace ComputeSharp.SourceGenerators.Models;
/// <summary>
/// A model representing info on compiled HLSL bytecode, if available.
/// </summary>
internal abstract record HlslBytecodeInfo
{
/// <summary>
/// A successfully compiled HLSL shader.
/// </summary>
/// <param name="Bytecode">The resulting HLSL bytecode.</param>
public sealed record Success(EquatableArray<byte> Bytecode) : HlslBytecodeInfo;
/// <summary>
/// An HLSL shader that failed to compile due to a Win32 error.
/// </summary>
/// <param name="HResult">The HRESULT for the error.</param>
/// <param name="Message">The error message from compiling the shader.</param>
public sealed record Win32Error(int HResult, string Message) : HlslBytecodeInfo;
/// <summary>
/// An HLSL shader that failed to compile due to an DXC compiler error.
/// </summary>
/// <param name="Message">The error message from compiling the shader.</param>
public sealed record DxcError(string Message) : HlslBytecodeInfo;
/// <summary>
/// No HLSL bytecode is available (ie. compilation was not requested or some other error was detected).
/// </summary>
public sealed record Missing : HlslBytecodeInfo
{
/// <summary>
/// Gets the shared <see cref="Missing"/> instance.
/// </summary>
public static Missing Instance { get; } = new();
}
}