[PR #2051] Normalize SPIR-V file byte order (SPIRV-WORDS-ENDIAN) #2057

Open
opened 2026-11-26 21:19:53 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2051
Author: @alexandersato0830
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: codex/spirv-word-endianness


📝 Commits (1)

  • 09014c5 Normalize file byte order in the SPIR-V reader

📊 Changes

2 files changed (+23 additions, -3 deletions)

View changed files

📝 runtime/src/spirv_words.h (+13 -3)
📝 runtime/test/shader_library_test.cpp (+10 -0)

📄 Description

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

  • On Windows 11, MSVC 19.51, CMake RelWithDebInfo: the word-by-word reversed synthetic fixture failed on main 9f9a7c5 and the shader_library CTest target passed with the fix. The test checks the entire output, including a word beyond the header.
  • Verified the source-only check and git diff --check.

GPUs tested: n/a (CPU-only reader test).

AI-assisted: yes.

  • Based on current main.
  • One topic.
  • Uses source and synthetic test words only.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2051 **Author:** [@alexandersato0830](https://github.com/alexandersato0830) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/spirv-word-endianness` --- ### 📝 Commits (1) - [`09014c5`](https://github.com/ubiquitarianism/leonida/commit/09014c5e6f58a6add45d55d7f3baefe2db0fb460) Normalize file byte order in the SPIR-V reader ### 📊 Changes **2 files changed** (+23 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `runtime/src/spirv_words.h` (+13 -3) 📝 `runtime/test/shader_library_test.cpp` (+10 -0) </details> ### 📄 Description Claimed in the coordination issue as: [SPIRV-WORDS-ENDIAN](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7171693644) ### 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](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#MagicNumber) · [Vulkan SPIR-V environment](https://docs.vulkan.org/spec/latest/appendices/spirvenv.html) ### Tested - On Windows 11, MSVC 19.51, CMake RelWithDebInfo: the word-by-word reversed synthetic fixture failed on main `9f9a7c5` and the `shader_library` CTest target passed with the fix. The test checks the entire output, including a word beyond the header. - Verified the source-only check and `git diff --check`. GPUs tested: n/a (CPU-only reader test). AI-assisted: yes. - [x] Based on current `main`. - [x] One topic. - [x] Uses source and synthetic test words only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2057
No description provided.