graphics: quiet two misleading render diagnostics #416

Manually merged
github merged 2 commits from gh-pr/416/head into gh-pr/416/base 2026-11-26 09:19:42 +00:00
Owner

@⁠MehmetCambaz on GitHub · 2026-08-30 16:11 UTC · original
MehmetCambaz:fix/log-noise → main · +25 −20 · 2 files · 2 commits · merged 2026-08-30 23:33 UTC

Problem

Two render diagnostics point at the wrong thing, and one of them dominates the log.

Register-offset normalization. pm4Handlers.cpp normalizes a PM4 register offset in three
places -- the direct UCONFIG path and the two indirect SH/UC paths -- and each logs every single
time it happens, with no limit, in Log::Color::Red. Normalizing the offset is routine, so a short
session fills the log with it. Both titles I have hit the same path, and in both the message is
always the same one: normalized UC register offset 0x20000243 -> 0x00000243.

PAC-MAN WORLD 2 Re-PAC (PPSA18189) emitted 35350 of them in about 40 seconds, carrying exactly one
distinct offset value between them. It grows linearly with session length, and it is coloured as if
something were wrong. The two indirect sites are inside per-register loops, so they have more room
to run away still.

Every neighbouring diagnostic in these same files is already rate-limited -- < 4, < 16, < 64
and < 128 all appear within pm4Handlers.cpp. These three were simply missed.

EQAA controls. EqaaCheck warns whenever an EQAA control register is non-zero, without
checking whether multisampling is on. Those controls only take effect while multisampling, so on a
single-sample target they are inert. PAC-MAN never multisamples -- all 128 of its render targets
report samples=1 -- yet it still produced the warning, sending anyone reading the log after an
anti-aliasing problem that cannot exist.

Fix

Rate-limit all three normalization sites at 16, matching the convention already used throughout
these files. The first occurrences are kept; the repetition is dropped.

Return early from EqaaCheck when msaa_num_samples == 0, which is how the neighbouring
AaCheck already reads that field. A title that does multisample still gets the warning.

Log output only. No rendering path is touched.

Measured

Same title, same scene, before and after:

  • normalization log lines: 24969 -> 16
  • EQAA warnings: 16 -> 0
  • frame rate: 60 fps -> 59.997 fps

The count is now bounded rather than merely smaller -- it stays at 16 however long the session
runs, where before it grew without limit.

Testing

  • ctest -- 35/35 passing.
  • PAC-MAN WORLD 2 Re-PAC: 4860 frames at a steady 59.997 fps through the intro video, frames
    captured throughout and compared against the previous build. Rendering is unchanged.
  • Tetris Forever (PPSA25646): run on this branch alone, 60.02 fps, renders correctly, normalization
    logs capped at 16.
  • Verified separately, with the caps temporarily raised, that all 35350 normalization events in a
    run carry a single distinct offset value, so capping hides nothing in either title.

Two things worth stating plainly. Only the direct UCONFIG site fires in the titles I can test; the
two indirect sites are rate-limited for consistency rather than from an observed problem. And a
plain counter is a count, not a set -- if some other title normalized a second distinct offset only
after the first 16 occurrences, that value would not appear. I kept the simple counter because it
is what the surrounding code does and because it costs nothing on a path that runs tens of
thousands of times a minute, but a per-value cap would be the stricter choice if you prefer it.

AI use disclosure

Per the AI Use policy in the README. I used an AI assistant for development assistance here:
analysing the emulator log to find what was flooding it, and drafting the change.

I reviewed the change in full and ran the testing above myself. The numbers quoted are measurements
from my own machine, not the model's estimates -- including the distinct-value check, which I ran
specifically to confirm that a plain counter does not discard information before accepting that
approach.

**@⁠MehmetCambaz** on GitHub · 2026-08-30 16:11 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/416) `MehmetCambaz:fix/log-noise` → `main` · +25 −20 · 2 files · 2 commits · merged 2026-08-30 23:33 UTC ## Problem Two render diagnostics point at the wrong thing, and one of them dominates the log. **Register-offset normalization.** `pm4Handlers.cpp` normalizes a PM4 register offset in three places -- the direct UCONFIG path and the two indirect SH/UC paths -- and each logs every single time it happens, with no limit, in `Log::Color::Red`. Normalizing the offset is routine, so a short session fills the log with it. Both titles I have hit the same path, and in both the message is always the same one: `normalized UC register offset 0x20000243 -> 0x00000243`. PAC-MAN WORLD 2 Re-PAC (PPSA18189) emitted 35350 of them in about 40 seconds, carrying exactly one distinct offset value between them. It grows linearly with session length, and it is coloured as if something were wrong. The two indirect sites are inside per-register loops, so they have more room to run away still. Every neighbouring diagnostic in these same files is already rate-limited -- `< 4`, `< 16`, `< 64` and `< 128` all appear within `pm4Handlers.cpp`. These three were simply missed. **EQAA controls.** `EqaaCheck` warns whenever an EQAA control register is non-zero, without checking whether multisampling is on. Those controls only take effect while multisampling, so on a single-sample target they are inert. PAC-MAN never multisamples -- all 128 of its render targets report `samples=1` -- yet it still produced the warning, sending anyone reading the log after an anti-aliasing problem that cannot exist. ## Fix Rate-limit all three normalization sites at 16, matching the convention already used throughout these files. The first occurrences are kept; the repetition is dropped. Return early from `EqaaCheck` when `msaa_num_samples == 0`, which is how the neighbouring `AaCheck` already reads that field. A title that does multisample still gets the warning. Log output only. No rendering path is touched. ## Measured Same title, same scene, before and after: - normalization log lines: 24969 -> 16 - EQAA warnings: 16 -> 0 - frame rate: 60 fps -> 59.997 fps The count is now bounded rather than merely smaller -- it stays at 16 however long the session runs, where before it grew without limit. ## Testing - `ctest` -- 35/35 passing. - PAC-MAN WORLD 2 Re-PAC: 4860 frames at a steady 59.997 fps through the intro video, frames captured throughout and compared against the previous build. Rendering is unchanged. - Tetris Forever (PPSA25646): run on this branch alone, 60.02 fps, renders correctly, normalization logs capped at 16. - Verified separately, with the caps temporarily raised, that all 35350 normalization events in a run carry a single distinct offset value, so capping hides nothing in either title. Two things worth stating plainly. Only the direct UCONFIG site fires in the titles I can test; the two indirect sites are rate-limited for consistency rather than from an observed problem. And a plain counter is a count, not a set -- if some other title normalized a second distinct offset only after the first 16 occurrences, that value would not appear. I kept the simple counter because it is what the surrounding code does and because it costs nothing on a path that runs tens of thousands of times a minute, but a per-value cap would be the stricter choice if you prefer it. ## AI use disclosure Per the AI Use policy in the README. I used an AI assistant for development assistance here: analysing the emulator log to find what was flooding it, and drafting the change. I reviewed the change in full and ran the testing above myself. The numbers quoted are measurements from my own machine, not the model's estimates -- including the distinct-value check, which I ran specifically to confirm that a plain counter does not discard information before accepting that approach.
The three PM4 register-offset normalization messages logged once per occurrence with no
limit. They are printed in the colour reserved for problems, and normalizing the offset is
routine, so a short session buries the log in them: PAC-MAN WORLD 2 Re-PAC (PPSA18189)
emitted 24969 of them in about a minute, a fifth of a megabyte and 1.9% of every line
written. Rate-limit all three the way the surrounding diagnostics in these files already
are, which keeps the first occurrences without drowning what follows.

The EQAA check warned whenever a control register was set, including on single-sample
targets where those controls do nothing. That title never multisamples -- all 128 of its
render targets are samples=1 -- yet it still produced the warning, pointing at a cause that
could not apply. Return early when multisampling is off, matching how the neighbouring
sample-location check already reads msaa_num_samples.

Log output only; no rendering behaviour changes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:19:40 +00:00
github manually merged commit 9e04ab0eeb into gh-pr/416/base 2026-11-26 09:19:42 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.