using ComputeSharp.SourceGeneration.Helpers;
namespace ComputeSharp.SourceGeneration.Models;
///
/// A model representing info on compiled HLSL bytecode, if available.
///
internal abstract record HlslBytecodeInfo
{
///
/// A successfully compiled HLSL shader.
///
/// The resulting HLSL bytecode.
/// Whether the shader requires support for double precision operations.
public sealed record Success(EquatableArray Bytecode, bool RequiresDoublePrecisionSupport) : HlslBytecodeInfo;
///
/// An HLSL shader that failed to compile due to a Win32 error.
///
/// The HRESULT for the error.
/// The error message from compiling the shader.
public sealed record Win32Error(int HResult, string Message) : HlslBytecodeInfo;
///
/// An HLSL shader that failed to compile due to a compiler error.
///
/// The error message from compiling the shader.
public sealed record CompilerError(string Message) : HlslBytecodeInfo;
///
/// No HLSL bytecode is available (ie. compilation was not requested or some other error was detected).
///
public sealed record Missing : HlslBytecodeInfo
{
///
/// Gets the shared instance.
///
public static Missing Instance { get; } = new();
}
}