Normalize SPIR-V file byte order (SPIRV-WORDS-ENDIAN) #2051
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2051
Loading…
Reference in a new issue
No description provided.
Delete branch "codex/spirv-word-endianness"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: SPIRV-WORDS-ENDIAN
What and why
The shared shader reader rejected SPIR-V files in the opposite byte order, although the Python reflector accepts either order. Use the SPIR-V magic to detect the file’s byte order and return native-endian words to Vulkan. The existing byte-count and short-read checks still apply. SPIR-V binary format · Vulkan SPIR-V environment
Tested
9f9a7c5and theshader_libraryCTest target passed with the fix. The test checks the entire output, including a word beyond the header.git diff --check.GPUs tested: n/a (CPU-only reader test).
AI-assisted: yes.
main.Verified on Windows 11 (
10.0.26200.9974) with MSVC19.44.35228(x64,/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2) againstmain24549bdb1+09014c5e6(claim#2570#issuecomment-7238799031):runtime/src/spirv_words.h,runtime/test/shader_library_test.cpp); accepts byte-swapped SPIR-V magic0x03022307alongside native0x07230203and byte-swaps the header and payload words into host byte order.check_no_game_data.pyclean.24549bdb1+ PR test):shader_library_test.exefails (rc=1atline 552: read_spirv_words(input, input.tellg()) == module).24549bdb1+09014c5e6merge): Auto-merges cleanly (rc=0), compiles with0warnings inspirv_words.h, andshader_library_test.exepasses (SHA-256, inflate (stored/fixed/dynamic), JSON, FSSM extraction, FSPX programs and index lookup OK,rc=0).AI-assisted.
Run of #2051 (ctest, red/green), by enlight3d. Nothing pushed.
Heads: PR
09014c5e6(base9f9a7c5f3, older than main), main1bc055e6c.git merge-tree --write-tree main <PR head>is clean (no conflicts).The PR changes
runtime/src/spirv_words.h(existing code, new behaviour: accept a byte-swapped SPIR-V file) and adds one case toruntime/test/shader_library_test.cpp. CPU-only test, no GPU used.Machine: NVIDIA GeForce RTX 3090 24 GB, driver 621.40, Windows 11 Pro (build 10.0.26300), MSVC 19.44 (VS 2022 Build Tools), CMake + Ninja, RelWithDebInfo.
Commands (vcvars64 environment, only this target built):
shader_libraryPassed (1/1, 0.27 s).spirv_words.htaken from main, test kept): Failed atline 552: read_spirv_words(input, input.tellg()) == module. This is a behavioural red: the header exists on main, the reversed-order input is rejected (empty result) instead of returned in native order.Link check: merged into main 1bc055e6c, gta6rt.exe builds and links (RelWithDebInfo, MSVC 19.44); no new imports vs main.
Merged. Tested by @enlight3d on head 09014c5e6 (CPU only (test); host RTX 3090, Windows 11): shader_library: red with spirv_words.h from main (line 552, byte-swapped SPIR-V rejected); green with PR. Correction: no CI check run or commit status exists for this head, so CI did not validate it. My earlier sentence about red jobs was wrong. Thanks @alexandersato0830!
AI-assisted: yes