Class CompiledShader
- Namespace
- ShadowDusk.Core
- Assembly
- ShadowDusk.Core.dll
The successful output of CompileAsync(string, CompilerOptions, CancellationToken): the compiled effect
bytes together with the platform they were produced for. For MonoGame/KNI targets the
bytes are a .mgfx effect; for Fna they are the D3D9
fx_2_0 effects binary (.fxb). Either way they can be written to a file or fed
directly to the consumer runtime's Effect constructor.
public sealed record CompiledShader : IEquatable<CompiledShader>
- Inheritance
-
CompiledShader
- Implements
- Inherited Members
Constructors
CompiledShader(PlatformTarget, byte[])
The successful output of CompileAsync(string, CompilerOptions, CancellationToken): the compiled effect
bytes together with the platform they were produced for. For MonoGame/KNI targets the
bytes are a .mgfx effect; for Fna they are the D3D9
fx_2_0 effects binary (.fxb). Either way they can be written to a file or fed
directly to the consumer runtime's Effect constructor.
public CompiledShader(PlatformTarget Target, byte[] Data)
Parameters
TargetPlatformTargetThe platform backend the effect was compiled for.
Databyte[]The compiled effect bytes, ready to load into the target runtime's
Effect.
Properties
Data
The compiled effect bytes, ready to load into the target runtime's Effect.
public byte[] Data { get; init; }
Property Value
- byte[]
Target
The platform backend the effect was compiled for.
public PlatformTarget Target { get; init; }
Property Value
Warnings
Non-fatal diagnostics produced while compiling: the underlying compiler's own
warnings (verbatim — never reworded) plus ShadowDusk's GL portability findings
(SD0400–SD0499: constructs that compile here but are known to fail
or misbehave at runtime on some GL stacks — e.g. WebGL1/KNI Reach loop limits,
ANGLE derivative zeroing, a SpriteBatch-incompatible pixel-shader input, a
GLSL-1.30+/ES-3.00-only construct in the versionless GL source) and its
reflection findings (SD0104: a vertex-input semantic that fell through to
the TextureCoordinate default, exactly as mgfxc warns). Empty
when there is nothing to report. The effect bytes in Data are
valid regardless — warnings never gate output.
public IReadOnlyList<ShaderError> Warnings { get; init; }
Property Value
Methods
ToXnb()
Returns Data wrapped in an XNB content container, ready to drop into a
content directory where Content.Load<Effect>("Foo") will find it —
no consumer code change at all (issue #199).
public byte[] ToXnb()
Returns
- byte[]
The complete
.xnbfile bytes.
Remarks
A container only: the payload is Data verbatim, so the effect bytes are
identical to what a plain .mgfx / .fxb write would produce. The XNB
platform identifier is derived from Target (see
PlatformIdentifierFor(PlatformTarget)) and is never something the consumer
selects. Write the result to <AssetName>.xnb; the asset name
Content.Load uses is the file name, so no companion file is needed.