feat(debug): geom_correction TCP command — is the correction engaging?

Both [video] enhancements are silent no-ops on anything they cannot prove is
projected geometry: a vertex whose sub-pixel fraction was never cached, or a
packet whose position words lack full GTE projection provenance, just draws the
faithful way. So the enable flag alone says nothing about whether a given title
benefits, and the existing hit counters had no reader.

geom_correction reports the flag plus the free-running geometry_vertex_hits and
perspective_triangles totals, so per-title bring-up can tell an engaged
correction from an inert one before anyone argues about screenshots. Sample
twice and diff for a per-window rate.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthew Stanley
2026-08-05 14:42:37 -07:00
parent 2bdaff3244
commit 5a64a98440
3 changed files with 29 additions and 0 deletions
+1
View File
@@ -50,6 +50,7 @@ Columns: **N** = native, **D** = DuckStation oracle.
| `read_scratch` | | ✓ | `addr`, `len` | Read PS1 scratchpad (0x1F800000 region) |
| `read_vram` / `vram_peek` | ✓¹ | ✓ | `x`, `y`, `w`, `h` | Read 16-bit VRAM pixels (max 128×128) |
| `gpu_state` | ✓ | ✓ | — | Display area, display depth, draw offset, GPUSTAT, clip rect, xfer state |
| `geom_correction` | | ✓ | — | `[video] geometry_correction` / `perspective_texturing` engagement: enable flag plus free-running `geometry_vertex_hits` and `perspective_triangles` totals. Both enhancements silently fall back to the faithful path on anything they cannot prove is projected geometry, so a zero counter with the flag on means the title never qualifies — sample twice and diff for a rate |
| `sio_state` | ✓ | ✓ | — | SIO registers + (native only) pad/memcard protocol + TX/RX history |
| `irq_state` | ✓ | ✓ | — | `I_STAT`, `I_MASK` (both), plus chain state on native |
| `dma_state` | ✓ | ✓ | — | DPCR, DICR, all 7 channel states (madr/bcr/chcr) |
+23
View File
@@ -4874,6 +4874,28 @@ static void handle_write_ram(int id, const char *json)
send_ok(id);
}
/* geom_correction — is [video] geometry_correction / perspective_texturing
* actually doing anything on THIS title?
*
* Both enhancements are silent no-ops on content they cannot prove is
* projected geometry: a vertex whose sub-pixel fraction was never cached, or a
* packet whose position words lack full GTE projection provenance, simply draws
* the faithful way. So "enabled" alone tells you nothing — these counters are
* how you tell an engaged correction from an inert one. Both are free-running
* totals; sample twice and diff for a per-window rate. */
static void handle_geom_correction(int id, const char *json)
{
(void)json;
send_fmt("{\"id\":%d,\"ok\":true,"
"\"geometry_correction\":%d,"
"\"geometry_vertex_hits\":%u,"
"\"perspective_triangles\":%u}",
id,
gte_geometry_correction_enabled(),
(unsigned)gte_geometry_correction_hits(),
(unsigned)gpu_texture_correction_hits());
}
static void handle_gpu_state(int id, const char *json)
{
(void)json;
@@ -12603,6 +12625,7 @@ static const CmdEntry s_commands[] = {
{ "dump_ram", handle_read_ram }, /* alias: one request, one response */
{ "write_ram", handle_write_ram },
{ "gpu_state", handle_gpu_state },
{ "geom_correction", handle_geom_correction },
{ "ws_aspect_cone_site", handle_ws_aspect_cone_site },
{ "ws_margin", handle_ws_margin },
{ "ws_hud_mode", handle_ws_hud_mode },
+5
View File
@@ -220,6 +220,11 @@ def build_cmd(args):
return {"cmd": "read_scratch", "addr": addr, "len": length}, pretty_json
elif cmd == "gpu":
return {"cmd": "gpu_state"}, pretty_json
elif cmd in ("geom", "geom_correction"):
# Are the [video] geometry_correction / perspective_texturing
# enhancements actually engaging on this title? Free-running totals;
# sample twice and diff for a per-window rate.
return {"cmd": "geom_correction"}, pretty_json
elif cmd == "overlay":
return {"cmd": "overlay_state"}, pretty_json
elif cmd == "watch":