Encode formatted-load metadata from recorded typed buffer views #2273
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2281"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T09:34:25Z.
Refs #874
Add a source-built, adapter-independent check for the metadata needed by gfx10 formatted loads. The helper reads a D3D12 typed buffer SRV description and encodes FORMAT and the four destination selectors. It takes no address, guesses no format from buffer stride, and refuses raw, structured, texture and malformed descriptions. It can be used by the recorded-view binding follow-up without changing #2138's native V# descriptor path.
Local Windows Release-style check on
28eaad07, using the x64 MSVC environment fromtools/dev.ps1and running from an ignoredout/directory:Passed all 13 FORMAT mappings, the swizzle with forced zero and one, and seven refusal controls. The raw and structured controls include a nonempty 8-byte structured record. This PR adds the CTest entry
startup_typed_buffer_view. Production binding and GPU bytecode cache integration are outside this helper change.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T09:38:41Z.
Review: COMMENTED
Review of head
28eaad0790e44d3bea6677dcca2620dac0cfaa2a(comment only, no approval).Summary: The encoder is correct for what it covers. I found no P1. I found one P2 (a test gap) and two nits.
Checked locally
python3 tests/docs_links_check.py: passed (18 files, 435 links).python3 tests/bidi_controls_check.py: passed.git diff --check origin/main...HEAD: clean.MTBUF_FORMATSintools/disasm_rdna2.py. They also match the siblingFETCH_DXGIpairs intools/startup/gfx2hlsl.py.0xfac. The swizzle(1,4,0,5)gives5 | 0<<3 | 4<<6 | 1<<9 = 0x305, and with format 29 that is0x1d305. Both match the test.tests/startup_typed_buffer_view.cppwith mingw-w64 g++ (-std=c++17 -static) and ran it under wine. Output:typed buffer FORMAT and DST_SEL verified (13 formats, 1 swizzle, 7 refusals), exit 0. This is not a Win2025 run. The change is a header-only helper with no shader or GPU path, so I did not queue the Windows VM.Mutations of the new logic (each reverted with
git checkout -- .)NumElements == 0refusal: killed ("empty view").(mapping & ~(present | 0xfffu)): survived. Exit 0.Findings
src/startup_stubs/typed_buffer_view.h:40. The branch that refuses a mapping with bits set outsidepresent | 0xfffhas no negative control. The mutation above passes. Add a case such asD3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING | (1u << 13)that expectsnullopt. Or drop the check if it is not intended.FirstElementandNumElementsare not used for encoding apart from the zero check. The header comment says range is supplied separately, which is fine. It would help to say that a non-zeroFirstElementis accepted and ignored.FETCH_FORMATS) fills missing components with 0, 0, 0, 1.CI and other notes
Run platform-independent Python checks on LinuxandCheck machine-code inputs with LLVM 15were failing, and the Windows jobs were still pending. The logs were not yet available (run in progress), so I cannot tell whether the failure comes from this PR. The diff touches no Python. Please re-run after the next push and confirm.docs/experiments.mdentry. That is acceptable for a helper that is not wired in yet.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T10:01:08Z.
Review: COMMENTED
Re-review of head
9778dfd3b3e5ab9d722986a5941d8a0c733e0f6f(comment only, no approval).Summary: The earlier P2 is NOT resolved. No P1. CI is now green.
What changed since
28eaad07:git diff 28eaad07 HEAD -- src/startup_stubs/typed_buffer_view.h tests/startup_typed_buffer_view.cppis empty. Only a merge of main landed. The only diff in the PR files is the CMake block that was already there.Checked locally
python3 tests/docs_links_check.py: passed (18 files, 435 links).python3 tests/bidi_controls_check.py: passed.git diff --check origin/main...HEAD: clean.(mapping & ~(present | 0xfffu))atsrc/startup_stubs/typed_buffer_view.h:39, rebuilttests/startup_typed_buffer_view.cppwith mingw-w64 g++ and ran under wine. Output:typed buffer FORMAT and DST_SEL verified (13 formats, 1 swizzle, 7 refusals), exit 0. The mutation survives. Reverted withgit checkout -- ..Findings
src/startup_stubs/typed_buffer_view.h:39. No test covers the refusal of a mapping with bits outsidepresent | 0xfff. Add a case such asD3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING | (1u << 13)expectingnullopt, or drop the check.FirstElementaccepted and ignored; DST_SEL not checked against format components). Worth one sentence in the PR text.CI:
Run platform-independent Python checks on Linux,Assemble and translate gfx1013 fixturesandBuild and test on Windowspass. The earlier Linux failure is gone. PR is MERGEABLE, title neutral.AI-assisted; commands listed were executed locally.