Skip to content

Tools: distinguish InnerCoverage metadata absence from unknown - #4498

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
73N1X:feat/inner-coverage-metadata-pr
Nov 23, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
73N1X:feat/inner-coverage-metadata-pr

Conversation

@73N1X

@73N1X 73N1X commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Problem and behavior

feature_scan.py already counts the SFI0 InnerCoverage feature bit, but that total alone does not distinguish an unset bit from missing or truncated metadata, or explain its relationship to the input signature. A missing ISG1 entry must not be interpreted as proof that a shader does not use InnerCoverage.

Add a per-stage cross-tabulation of independent observations:

  • SFI0: set, clear, or unknown for feature bit 0x400.
  • ISG1: present, absent, or unknown for system value 70.
  • Missing/truncated metadata remains unknown; unreadable containers retain the existing unreadable count.

The additive JSON field is dxbc.inner_coverage_metadata; the CLI prints the same aggregate counts with an explicit interpretation warning. No shader names or contents are added to the output.

Contract and scope

DXC defines the feature bit and signature system value separately. The DXIL semantic interpretation table classifies InnerCoverage as NotInSig. This is why a set feature bit and an absent signature entry are retained as independent observations.

This is metadata research tooling, not an Xbox FSSM/VGPR mapping or a runtime capability change. It does not establish feature non-use in a real shader collection. No real-corpus measurement is claimed; every test input is constructed synthetically.

Claim: #4421 (comment)

Related research: #4290. This PR is independently based on main 03b09a086592a197db64d91655c6e65c30764d96 and does not depend on #4290, #3970 or #3451.

Validation

Windows, Python standard library; no GPU required. All passed:

  • python -I tests/test_inner_coverage_metadata.py (3 tests, including the set/clear/signature matrix, truncated/missing metadata and end-to-end counts-only CLI/JSON output).
  • python -I tests/test_feature_scan.py
  • python -I tests/test_feature_scan_bad_index.py
  • python -I tests/test_feature_scan_order.py
  • python -I tests/test_text_write_line_endings.py
  • python -I tests/test_text_encoding.py
  • git diff --check

@mrbean56

Copy link
Copy Markdown

Tested d657527348 on Linux (Debian 13), Python 3.13.5: pass.

  • pytest tests/test_inner_coverage_metadata.py tests/test_feature_scan.py -q (the tests this branch touches): 81 passed, 1 skipped, 41 subtests passed. Negative control: the new file cannot even import against main's tools/feature_scan.py (no inner_coverage_metadata), so it pins the addition.
  • Checked the element layout against the repo's own ISG1 parsers rather than trusting the new code: tools/ps_interp_modes.py:isg1_elements and tools/rdna2spirv.py:output_signature_full both unpack <6I with SystemValueType as the fourth dword, i.e. element offset +12, which is what this reads. 70 is D3D_NAME_INNER_COVERAGE. The 8 <= first <= len and count <= (len-first)//32 bounds make a truncated or absurd header unknown instead of a false absent, which is the whole point.

No GPU, no game data. AI-assisted.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at d6575273 on Windows 11: python -I tests/test_inner_coverage_metadata.py -> 3 tests, OK; git diff --check clean.

The feature scan now distinguishes InnerCoverage metadata absence from an unknown value, and the synthetic cases cover both. No blocking issue.

@Flyander Flyander left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation preserves the two independent metadata signals and classifies missing or truncated chunks as unknown. I checked the DXC definitions: InnerCoverage is feature bit 0x400 and system value 70 is NotInSig for pixel-shader input, so the warning against treating ISG1 absence as non-use is accurate. Counts-only output and the malformed-signature bounds checks are covered by the added synthetic tests.

@Atomic258

Copy link
Copy Markdown
Contributor

Tested d6575273 on Linux, Python 3.10, CPU only, synthetic fixtures, no game files: pass.

  • python -I tests/test_inner_coverage_metadata.py → 3/3 pass.
  • Negative control on main: ImportError — inner_coverage_metadata doesn't exist there.
  • Read: SFI0 bit 0x400 and ISG1 system-value 70 match the cited DXC constants; missing/truncated parts map to unknown (never to absence), and the census reports counts only. The 8 <= first and count <= (len(sig) - first) // 32 bounds reject malformed headers before scanning.
  • git diff --check and check_no_game_data.py clean.

AI-assisted (Devin).

@kapitche

Copy link
Copy Markdown
Contributor

Tested d657527 merged with main 03b09a0 (already up to date) on Linux (WSL2) Python 3.12.16 and native Windows 11 Python 3.13.1: pass.

  • tests/test_inner_coverage_metadata.py: 3/3 OK on both.
  • Negative control: tools/feature_scan.py from main, same test: ImportError: cannot import name 'inner_coverage_metadata' on Linux and on Windows.
  • Read the diff: the constants match DXC (SFI0 InnerCoverage bit 0x400, SV_InnerCoverage = 70 at word 3 of a 32-byte ISG1 element); truncated or oversize ISG1 counts are guarded and give unknown; the census prints counts only (the test asserts no fixture name appears in stdout or JSON). Fixtures are hand-built DXBC, no game data.

@memorypressure

Copy link
Copy Markdown

Verified d657527 merged with main 3faac55: merge clean; the new tests/test_inner_coverage_metadata.py is green under python -I (class correctly above unittest.main(), re-run) and the five feature_scan neighbours plus the newline guard are unaffected. The SFI0/ISG1 cross-tab keeps missing/truncated metadata as unknown rather than absent, all reads are bounds-checked before use, and the 0x400/70 constants carry their spec citations. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@ItsNotRexed
ItsNotRexed merged commit fc8fa3c into ItsNotRexed:main Nov 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants