Skip to content

PR 0018 ENG 2026 523 Validate linear texture source spans

github-actions[bot] edited this page Sep 14, 2026 · 1 revision

PR #18 — ENG-2026-523: Validate linear texture source spans

PR #18

Status

  • GitHub state: Closed unmerged
  • Disposition at review: Negative result
  • Current head at review: 2e801ab07c4a8d0a87defd2ba70ddad3b3e1041c (fix/eng-2026-523-linear-texture-source-span)
  • Reviewed head: 2e801ab07c4a8d0a87defd2ba70ddad3b3e1041c
  • Last reviewed: 2026-09-14 UTC
  • Base: fix/eng-2026-523-texture-dma-contract-ue7eb6770 at 37823ccf18263764c82ceb6698201330a22a6c65
  • Subsystem: NV2A texture / layout

Review freshness: this page records the final/known PR head at review time. If the PR is reopened or rewritten, re-review before relying on implementation details.

At a glance

  • What it changes: ENG-2026-523: Validate linear texture source spans
  • Why it was attempted: Observed problem: A decoder-consumed packed row could exceed the separately approved linear source span. Profiling evidence: N/A — no matched current-main profile exists; historical evidence remains below. Suspected cause: Approved span length did not consistently include the format-aware decoder row consumption. Why this is worth investigating: The check prevents out-of-range source reads for linear texture conversion.
  • Current/final result: Closed historical validation: guarded old-head failure plus repaired consuming-path tests established the texture-span fix for that source state.
  • Lesson: Linear texture source-span calculations need consuming-path tests that fail on the old head and pass on the repair; exact byte spans matter for correctness and later overlap/coherency work.

Code impact

Implementation file Δ Why it matters
hw/xbox/nv2a/pgraph/texture-layout.h +47/-4 Shared texture byte-span, mip, and face-layout calculations.
hw/xbox/nv2a/pgraph/texture.c +4/-5 Texture source identity, cache, upload, binding, or freshness path.
tests/unit/test-xbox-nv2a-texture.c +155/-0 Focused/regression validation for the implementation contract.

Flow

flowchart LR
    subgraph Before
        A[Guest texture state] --> B[Compute source/layout] --> C[Upload/cache decision] --> D[Draw]
    end
    subgraph PR_18[PR #18]
        E[Guest texture state] --> F[PR #18 layout/identity rule] --> G[Validated reuse/copy/fallback] --> H[Draw]
    end
Loading

What changed

Add checked linear-span arithmetic. - Handle packed YUY2/UYVY macropixels in consumed-row width. - Use the checked helper in public length and conversion paths. Main code path: NV2A linear texture source span calculation and conversion. Commits: 18

Result

Closed historical validation: guarded old-head failure plus repaired consuming-path tests established the texture-span fix for that source state.

Lesson learned

Linear texture source-span calculations need consuming-path tests that fail on the old head and pass on the repair; exact byte spans matter for correctness and later overlap/coherency work.

Avoid repeating

Do not accept formula-only tests that never exercise the real consuming path or rely on broad page/allocation spans when exact bytes are available.

Docs / evidence

Pointers only; the detailed evidence remains in its original location.

Related architecture

Related PRs referenced by this PR:

Clone this wiki locally