nCine::RHI::FixedFunctionPass struct

One pass of a fixed-function effect, as described by a shader's fixed_function block.

The fixed-function backends (PVR on the Dreamcast, GX on the Wii/GameCube) have no fragment shaders; every effect is a short list of passes over the same sprite quad, each pass a small bundle of hardware state. This struct is that bundle, with concrete values: the generated effect code (see Docs/FixedFunctionShaderDesign.md) computes the fields at draw time and hands the pass to the backend's EffectContext, which turns it into a polygon header (PVR) or a TEV/blend setup (GX) and submits the quad.

Fields a backend has no hardware for are ignored by it (Gx* on the PVR and the other way round), which is also what makes one shared description usable by both. Everything defaults to a plain modulated sprite pass with the material's own blending.

Public types

enum class BlendMode : std::uint8_t { Material, Additive, Opaque, Alpha }
How the pass blends over what is already in the frame.
enum class TevPreset : std::uint8_t { Modulate, Silhouette, ModulateX2, ModulateX4, TintMix, LumaRamp }
GX texture-environment preset for this pass (the PVR always modulates).

Public variables

float Color
Per-vertex colour of the pass (the PVR argb, the GX raster colour), premultiplied by nothing.
float OffsetColor
Post-texture additive term (the PVR offset colour; the GX runs a silhouette pass instead).
bool HasOffsetColor
Whether OffsetColor is used at all (enables PVR_SPECULAR on the polygon).
float ScreenOffset
Displacement of the whole quad in the quad's own coordinate space (the Outline ring taps).
float LumaGain
How much TevPreset::LumaRamp amplifies the texel's luminance before saturating it.
BlendMode Blend
Blend override for this pass.
TevPreset Tev
GX combiner preset.

Enum documentation

enum class nCine::RHI::FixedFunctionPass::BlendMode : std::uint8_t

How the pass blends over what is already in the frame.

Enumerators
Material

Whatever the material configured (the default)

Additive

Additive blending for glow and split-multiplier passes. The GX maps it to ONE + ONE; the PVR deliberately maps it to SRCALPHA + ONE — the additive mechanism the split-multiplier passes (Colorized) have always used there, whose contributions are scaled by the pass alpha, so the mapping stays bit-identical with the handwritten code.

Opaque

ONE + ZERO

Alpha

Standard source-alpha over (SRCALPHA + INVSRCALPHA), independent of whatever the material configured — the horizon tint of the TexturedBackground warp runs over a material whose own blend does not apply to that pass.

enum class nCine::RHI::FixedFunctionPass::TevPreset : std::uint8_t

GX texture-environment preset for this pass (the PVR always modulates).

Enumerators
Modulate

texture * vertex colour (the default)

Silhouette

Vertex colour where the texture has alpha (flat masks, shadows, glows)

ModulateX2

Modulate with the combiner's x2 output scale

ModulateX4

Modulate with the combiner's x4 output scale

TintMix

mix(texel, colour, alpha) with an opaque result - the texel lerped toward the pass colour by the pass alpha. GX ONLY (one combiner stage d + mix(a, b, c); the PVR has no texture environment that can lerp a texel toward a colour, so the transpiler rejects it outside a void fixed_function(gx) block).

With a shaded strip both terms come from the per-vertex colour, which is how the TexturedBackground warp folds its horizon tint into the band's own draw instead of laying a second gradient pass over it.

LumaRamp

Silhouette whose colour is a per-texel ramp instead of a flat tone: grey is the texel's Rec.601 luminance amplified by LumaGain and saturated, and the colour is mix(Color.rgb, OffsetColor, grey) - i.e. Color carries the tone at grey = 0 and OffsetColor the tone at grey = 1. Coverage stays the silhouette's texel alpha * Color.a. GX ONLY (channel swizzles through the TEV swap tables plus a KONST-weighted dot product; the PVR has no per-texel arithmetic at all, so the transpiler rejects it outside a void fixed_function(gx) block).

Variable documentation

float nCine::RHI::FixedFunctionPass::LumaGain

How much TevPreset::LumaRamp amplifies the texel's luminance before saturating it.

Only read by that preset (the GLSL it approximates saturates a scaled luma - FrozenMask's min(luma * 2.6, 1.0)). The GX folds it into the KONST-held luminance weights and the combiner's output scale, so any value up to 4 costs nothing extra.