Table of Contents

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

File string

The source file the diagnostic refers to.

Line int

The 1-based line number, or 0 when not applicable.

Column int

The 1-based column number, or 0 when not applicable.

Code string

The diagnostic code (e.g. SD0001 or an underlying compiler code).

Message string

The human-readable diagnostic message.

Severity ShaderErrorSeverity

The severity; defaults to Error.

Kind ShaderErrorKind

The kind of failure; defaults to Compile.

IncludingFilePath string

For include errors, the file that issued the #include.

IncludingLineNumber int

For include errors, the line of the #include directive.

RequestedPath string

For include errors, the path that was requested.

SearchedPaths IReadOnlyList<string>

For IncludeNotFound, the directories searched.

RawDiagnostics string

The 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

string

Column

The 1-based column number, or 0 when not applicable.

public int Column { get; init; }

Property Value

int

File

The source file the diagnostic refers to.

public string File { get; init; }

Property Value

string

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

string

IncludingFilePath

For include errors, the file that issued the #include.

public string? IncludingFilePath { get; init; }

Property Value

string

IncludingLineNumber

For include errors, the line of the #include directive.

public int IncludingLineNumber { get; init; }

Property Value

int

Kind

The kind of failure; defaults to Compile.

public ShaderErrorKind Kind { get; init; }

Property Value

ShaderErrorKind

Line

The 1-based line number, or 0 when not applicable.

public int Line { get; init; }

Property Value

int

Message

The human-readable diagnostic message.

public string Message { get; init; }

Property Value

string

RawDiagnostics

The raw, unparsed diagnostic text from the underlying compiler, when available.

public string? RawDiagnostics { get; init; }

Property Value

string

RequestedPath

For include errors, the path that was requested.

public string? RequestedPath { get; init; }

Property Value

string

SearchedPaths

For IncludeNotFound, the directories searched.

public IReadOnlyList<string>? SearchedPaths { get; init; }

Property Value

IReadOnlyList<string>

Severity

The severity; defaults to Error.

public ShaderErrorSeverity Severity { get; init; }

Property Value

ShaderErrorSeverity

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

includingFile string

The file that issued the cyclic #include.

line int

The line of the #include directive.

requested string

The include path that re-entered the cycle.

Returns

ShaderError

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

includingFile string

The file that issued the #include.

line int

The line of the #include directive.

requested string

The include path that was requested.

searched IReadOnlyList<string>

The directories that were searched.

Returns

ShaderError