Class Fx2EffectWriter
- Namespace
- ShadowDusk.Core
- Assembly
- ShadowDusk.Core.dll
Emits the D3D9 Effects Framework binary ("fx_2_0", version token 0xFEFF0901) that FNA
consumes via FNA3D/MojoShader — the FNA analog of MgfxWriter. There is no
public spec for this format; the byte layout implemented here follows MojoShader's parser
as documented field-by-field in docs/fx2-binary-format.md, cross-checked against
real fxc /T fx_2_0 output (tests/fixtures/golden/FNA/).
Layout recap: 8-byte header (token + pool size), then a "data pool" holding every typedef/string/value blob addressed by offsets relative to file offset 8, then the structured stream (counts → parameter records → technique/pass/state records → small / large object sections). MojoShader performs no bounds checking on pool offsets, so this writer is solely responsible for their validity.
public sealed class Fx2EffectWriter
- Inheritance
-
Fx2EffectWriter
- Inherited Members
Methods
Write(Fx2EffectDesc)
Serializes effect into the D3D9 fx_2_0 effects binary (.fxb)
FNA loads.
public Result<byte[], ShaderError> Write(Fx2EffectDesc effect)
Parameters
effectFx2EffectDescThe fx_2_0 effect description to serialize.
Returns
- Result<byte[], ShaderError>
The fx_2_0 bytes on success, or a ShaderError when the effect uses a render or sampler state FNA's runtime would throw on (and which the writer rejects up front).