Class ShaderError
- Namespace
- ShadowDusk.Core
- Assembly
- ShadowDusk.Core.dll
A single diagnostic produced during compilation, carrying the source location and the underlying compiler's message verbatim. Errors are returned (never swallowed or reformatted) so callers can surface the exact file, line, column, and message.
public sealed record ShaderError : IEquatable<ShaderError>
- Inheritance
-
ShaderError
- Implements
- Inherited Members
Constructors
ShaderError(string, int, int, string, string, ShaderErrorSeverity, ShaderErrorKind, string?, int, string?, IReadOnlyList<string>?, string?)
A single diagnostic produced during compilation, carrying the source location and the underlying compiler's message verbatim. Errors are returned (never swallowed or reformatted) so callers can surface the exact file, line, column, and message.
public ShaderError(string File, int Line, int Column, string Code, string Message, ShaderErrorSeverity Severity = ShaderErrorSeverity.Error, ShaderErrorKind Kind = ShaderErrorKind.Compile, string? IncludingFilePath = null, int IncludingLineNumber = 0, string? RequestedPath = null, IReadOnlyList<string>? SearchedPaths = null, string? RawDiagnostics = null)
Parameters
FilestringThe source file the diagnostic refers to.
LineintThe 1-based line number, or 0 when not applicable.
ColumnintThe 1-based column number, or 0 when not applicable.
CodestringThe diagnostic code (e.g.
SD0001or an underlying compiler code).MessagestringThe human-readable diagnostic message.
SeverityShaderErrorSeverityThe severity; defaults to Error.
KindShaderErrorKindThe kind of failure; defaults to Compile.
IncludingFilePathstringFor include errors, the file that issued the
#include.IncludingLineNumberintFor include errors, the line of the
#includedirective.RequestedPathstringFor include errors, the path that was requested.
SearchedPathsIReadOnlyList<string>For IncludeNotFound, the directories searched.
RawDiagnosticsstringThe raw, unparsed diagnostic text from the underlying compiler, when available.
Properties
Code
The diagnostic code (e.g. SD0001 or an underlying compiler code).
public string Code { get; init; }
Property Value
Column
The 1-based column number, or 0 when not applicable.
public int Column { get; init; }
Property Value
File
The source file the diagnostic refers to.
public string File { get; init; }
Property Value
FxcFormattedMessage
The diagnostic rendered in the fxc/mgfxc message format
(file(line,col-col): severity code: message), so MGCB and IDEs can parse it.
public string FxcFormattedMessage { get; }
Property Value
IncludingFilePath
For include errors, the file that issued the #include.
public string? IncludingFilePath { get; init; }
Property Value
IncludingLineNumber
For include errors, the line of the #include directive.
public int IncludingLineNumber { get; init; }
Property Value
Kind
The kind of failure; defaults to Compile.
public ShaderErrorKind Kind { get; init; }
Property Value
Line
The 1-based line number, or 0 when not applicable.
public int Line { get; init; }
Property Value
Message
The human-readable diagnostic message.
public string Message { get; init; }
Property Value
RawDiagnostics
The raw, unparsed diagnostic text from the underlying compiler, when available.
public string? RawDiagnostics { get; init; }
Property Value
RequestedPath
For include errors, the path that was requested.
public string? RequestedPath { get; init; }
Property Value
SearchedPaths
For IncludeNotFound, the directories searched.
public IReadOnlyList<string>? SearchedPaths { get; init; }
Property Value
Severity
The severity; defaults to Error.
public ShaderErrorSeverity Severity { get; init; }
Property Value
Methods
CircularInclude(string, int, string)
Creates a CircularInclude error (code SD0002) for a
detected #include cycle.
public static ShaderError CircularInclude(string includingFile, int line, string requested)
Parameters
includingFilestringThe file that issued the cyclic
#include.lineintThe line of the
#includedirective.requestedstringThe include path that re-entered the cycle.
Returns
IncludeNotFound(string, int, string, IReadOnlyList<string>)
Creates an IncludeNotFound error (code SD0001) for
an #include that could not be resolved on any search path.
public static ShaderError IncludeNotFound(string includingFile, int line, string requested, IReadOnlyList<string> searched)
Parameters
includingFilestringThe file that issued the
#include.lineintThe line of the
#includedirective.requestedstringThe include path that was requested.
searchedIReadOnlyList<string>The directories that were searched.