Class PlatformMacros
- Namespace
- ShadowDusk.Core.Preprocessor
- Assembly
- ShadowDusk.Core.dll
Provides the standard preprocessor macros (e.g. MGFX, GLSL/HLSL,
per-target flags) that shaders branch on for each PlatformTarget, mirroring
the macros mgfxc defines.
public static class PlatformMacros
- Inheritance
-
PlatformMacros
- Inherited Members
Methods
For(PlatformTarget)
Returns the macro set for the given platform target.
public static MacroSet For(PlatformTarget platform)
Parameters
platformPlatformTargetThe target backend.
Returns
- MacroSet
The macros to define for that target.
Exceptions
- ArgumentOutOfRangeException
Thrown for an unsupported target (e.g. Metal, which is not yet implemented).
For(PlatformTarget, EffectContainer)
Returns the macro set for the given target AND output container. Identical to the
single-target For overload, plus KNIFX = 1 when the container is
Knifx.
public static MacroSet For(PlatformTarget platform, EffectContainer container)
Parameters
platformPlatformTargetcontainerEffectContainer
Returns
Remarks
KNI's effect compiler (MojoEffectProcessor) unconditionally defines
KNIFX = 1 for every KNI build, and KNI's own Macros.fxh plus real KNI
shaders (e.g. Apos.Shapes, used by Gum) branch on it — #ifdef KNIFX
switches the _vs/_ps/_cb register macros, and #if KNIFX selects the
SM4 profile. Targeting the KNIFX container IS, by definition, a KNI build, so ShadowDusk
defines KNIFX there to stay faithful to KNI's compiler. The default MGFX
container is target-agnostic (it loads on MonoGame AND KNI), so it deliberately does NOT
define KNIFX — that would make the universal output KNI-specific.
IsSupported(PlatformTarget)
Whether For can produce a macro set for the given target — i.e. the
target is one ShadowDusk compiles. Callers pre-check this instead of catching the
ArgumentOutOfRangeException (no exception-as-control-flow).
public static bool IsSupported(PlatformTarget platform)
Parameters
platformPlatformTarget