Skip to content

[Blocker 4/6] Combiner producing alpha=0 → coverage discard #4

@mgrz18

Description

@mgrz18

Symptom

Real combiner pipeline produces zero-alpha pixels, killing every fragment via coverage discard. The early-return-stopgap shader at `RasterPS.hlsl:125` is currently used to bypass this and produce visible output.

What we know

GE's main combiner during boot/menu is `0xFC121824FF33FFFF`. Decoded:

  • RGB = `(TEXEL0 - 0) * TEXEL0 + 0` = TEXEL0² (texel modulated by itself)
  • ALPHA = `(SHADE - 0) * TEXEL0 + PRIMITIVE` = SHADE_alpha · TEXEL0 + PRIM_alpha

With:

  • `shade=0` (G_SHADE bit not set in geometryMode by default — fixed via `GE_FORCE_SHADE`)
  • TEXEL0 zero (textures load from corrupt addresses — see Blocker 5)
  • primAlpha=0 (G_SETPRIMCOLOR may not fire)

→ output alpha = 0 → `resultCvg < CoverageThreshold` at `RasterPS.hlsl:223` → `return false`.

What was tried

  • ✅ `GE_FORCE_SHADE=1` propagates vertex colors but SHADE alpha still effectively zero
  • ✅ Force vertex shade to (0.7, 0.7, 0.7, 1.0) when zero — produces visible content
  • ✅ Force prim color to white when zero
  • ✅ Pin coverage to full for non-rect tris
  • ⚠️ Combined fixes work in some runs but produce uniform colors, not scene structure

Try next

  1. Find where game emits `gDPSetPrimColor` and verify RT64's `setPrimColor` handler fires
  2. Verify `gSPSetGeometryMode(G_SHADE)` is being processed correctly (look for the opcode in DL walk logs)
  3. Bisect each kill path in `RasterPS.hlsl` — comment out one at a time, find minimum set
  4. Once textures are correct (Blocker 5), TEXEL0² will produce real output

Files

  • `lib/rt64/src/shaders/RasterPS.hlsl` (early-return stopgap + alpha forces)
  • `lib/rt64/src/shaders/Color.hlsli` (combiner)
  • `lib/rt64/src/shared/rt64_color_combiner.h` (combiner struct)
  • `lib/rt64/src/hle/rt64_rdp.cpp` (setPrimColor)

Acceptance criteria

Per-tri color variation visible in PPM (non-uniform output) without the early-return stopgap.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions