forked from Ports/goldeneye-pc-port
port: D397 — D397SHM input-mapping probe; H1 LERP-factor variant ruled out
New env-gated D397SHM probe in gfx_generate_cc dumps which G_CCMUX inputs a combine feeds as vInput1..N. For the gun-barrow row-strip shader (id0=0000000010001218): vInput1=PRIMITIVE, vInput2=ENV_ALPHA, so the front.c LERP renders out = PRIM + (TEXEL-PRIM)*(envA/255). The PD ground-truth port feeds the identical env_color.a/255 factor for the same ENV_ALPHA LERP input, so the LERP factor is not a port-side scaling bug (H1's 1/255-vs-1/32 variant refuted). A uniform factor cannot produce the *periodic* comb, which points to H2 (row-strip geometry / 256-tri vertex-ring wrap). Next: Q3 gfx_flush() probe + Q5 native FBO capture. Findings §D397 + handoff updated.
This commit is contained in:
1 parent
65875ad45b
commit
2a60b8a912
2 files changed
+25
No files matched your search
@@ -15178,6 +15178,13 @@ I logged all of this as **D397** (`docs/dev/findings.md`, index CSV, and the D18
|
||||
**Status (2026-09-28, per `scratch/d397_fs/HANDOFF-D397.md`) — OPEN, re-scoped; no fix landed.** An in-tree CI→I import-routing block in `gfx_pc.cpp` `import_texture` was tried and is **ineffective** (the D116 stale-tile-metadata hypothesis is REFUTED: D161 already routes `fmt==CI && palette==G_TT_NONE` to `import_texture_i8`; the GE_TEXI logs show `palfmt=0` on all 299 rows) — the block was removed 2026-09-28. Established: the data path is 100% clean (299 row strips upload byte-exact vs `scratch/d397_fs/gunbarrel.pgm`); the artifact is static; MSAA, mips, RAND_NOISE, 5-bit quant and texture-cache aliasing are ruled out. Leading hypotheses: **H1** — the file-select custom-CC LERP (`gDPSetCombineLERP(TEXEL0, PRIMITIVE, ENV_ALPHA, ...)`) uses ENV_ALPHA 0x14 as the mix factor; the port feeds it as `20/255 ≈ 0.078` (`G_CCMUX_ENV_ALPHA` input, `gfx_pc.cpp`), so a black texel renders ≈0.92×prim ≈ the measured 27/28/17 black-region census — the N64 RDP 5-bit coefficient scaling (check `rsp/graphics/gmain.s` and the PD port's CC engine for the same combine id) is the root-cause question; **H2** — the 6-of-9-row comb is a second, separate row-strip-geometry defect (non-integer quad y + NEAREST, or the 256-tri vertex-ring wrap between the two tris of a row); **H3** — part of the darkened look is authentic N64 (G_TC_FILT 4-bit intensity dither, unimplemented here). A `GE_D397SH` env-gated shader-formula probe (in `gfx_opengl.cpp`, ~30 lines) stays in-tree until the root cause lands, then is removed. Next steps per the handoff: Q1 correlate which of the 20 compiled shaders is the gun-barrel row-strip one, Q4 settle the LERP-factor scaling against gmain.s/PD, Q5 native 640×480 FBO capture to re-measure the comb period.
|
||||
|
||||
|
||||
**2026-09-28 progress (this session — D397SH/D397SHM probes, env-gated in `gfx_opengl.cpp`/`gfx_pc.cpp`):**
|
||||
- **Q1 answered:** the gun-barrel row-strip shader is `id0=0000000010001218`, formula `texel = mix(vInput1, texVal0.rgb, vInput2)`, with (D397SHM) **vInput1 = G_CCMUX_PRIMITIVE, vInput2 = G_CCMUX_ENV_ALPHA**, so the LERP (front.c:2596 `gDPSetCombineLERP(TEXEL0, PRIMITIVE, ENV_ALPHA, PRIMITIVE, …)`) renders `out = PRIM + (TEXEL − PRIM)·(envA/255)`; black texels → `prim·(1 − envA/255)`. The 5-bit LERP coef-C in the packed combine word is 0x14 (= 20, i.e. the env-alpha value travels in the coef slot).
|
||||
- **H1's "1/255 vs N64 1/32 coefficient" variant is effectively ruled out:** the PD ground-truth port feeds the *same* `env_color.a / 255.0` factor for the identical ENV_ALPHA LERP input (`pd_port/port/fast3d/gfx_pc.cpp` ~1548→1580; same `append_formula`/`mix` generation, same 5-bit-coef packing at :1949). The GE port matches the reference implementation, so the LERP factor is **not** a port-side scaling bug. (If the *N64 hardware* itself scaled the 5-bit coefficient differently, that would be a shared PD/GE port interpretation, not a GE regression — and it cannot explain a *periodic* pattern regardless.)
|
||||
- **The visible defect is periodic (the 6-of-9-row comb), which a uniform LERP factor cannot produce** → the comb is **H2 (row-strip geometry / vertex-ring)**, not H1. The gray census (27/28/17) is the LERP factor applied on top; the *lines* are H2.
|
||||
- **Next steps (next session):** (1) extend the probe / add an env-gated counter in `gfx_flush()` to test Q3 (does a 256-tri ring flush land between the two tris of a row strip, splitting them across draw calls with attribute-state drops?); (2) Q5 native 640×480 FBO capture to re-measure the comb period in native rows (expect ≈3 if it's the 40px-window period scaled); (3) H3 control — an N64/PD screenshot of the equivalent screen to bound how much of the darkened look is authentic.
|
||||
- **Cleanup owed before merge:** remove the `GE_D397SH` probes in `gfx_opengl.cpp` (formula dump) and `gfx_pc.cpp` (D397SHM mapping dump).
|
||||
|
||||
## D398 — PC Options label: IMG_DOT texture replaces the D348 procedural slider glyph (2026-09-27)
|
||||
|
||||
User request: drop the D348 mini-slider glyph in favour of a real sprite from
|
||||
|
||||
@@ -550,6 +550,24 @@ static void gfx_generate_cc(struct ColorCombiner* comb, const ColorCombinerKey&
|
||||
comb->used_textures[1] = used_textures[1];
|
||||
// comb->prg = gfx_lookup_or_create_shader_program(shader_id0, shader_id1);
|
||||
memcpy(comb->shader_input_mapping, shader_input_mapping, sizeof(shader_input_mapping));
|
||||
#ifdef PORT
|
||||
/* D397 TEMP probe (env-gated, remove before merge): dump which runtime
|
||||
* G_CCMUX inputs this combine feeds as vInput1..N so the file-select
|
||||
* LERP factor source can be settled against the measured census. */
|
||||
if (getenv("GE_D397SH")) {
|
||||
fprintf(stderr,
|
||||
"D397SHM: id0=%016llx cmode=0x%016llx map0=[%u %u %u %u %u %u %u] map1=[%u %u %u %u %u %u %u]\n",
|
||||
(unsigned long long)comb->shader_id0, (unsigned long long)key.combine_mode,
|
||||
(unsigned)comb->shader_input_mapping[0][0], (unsigned)comb->shader_input_mapping[0][1],
|
||||
(unsigned)comb->shader_input_mapping[0][2], (unsigned)comb->shader_input_mapping[0][3],
|
||||
(unsigned)comb->shader_input_mapping[0][4], (unsigned)comb->shader_input_mapping[0][5],
|
||||
(unsigned)comb->shader_input_mapping[0][6],
|
||||
(unsigned)comb->shader_input_mapping[1][0], (unsigned)comb->shader_input_mapping[1][1],
|
||||
(unsigned)comb->shader_input_mapping[1][2], (unsigned)comb->shader_input_mapping[1][3],
|
||||
(unsigned)comb->shader_input_mapping[1][4], (unsigned)comb->shader_input_mapping[1][5],
|
||||
(unsigned)comb->shader_input_mapping[1][6]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct ColorCombiner* gfx_lookup_or_create_color_combiner(const ColorCombinerKey& key) {
|
||||
|
||||
Reference in new issue
Block a user