Fix byte stride for indexed view addresses #7

Manually merged
github merged 1 commit from gh-pr/7/head into gh-pr/7/base 2026-11-26 03:40:34 +00:00
Owner

@⁠Lilith133T on GitHub · 2026-11-25 03:04 UTC · original
Lilith133T:fix/view-address-table-stride → main · +103 −23 · 4 files · 1 commits · merged 2026-11-25 09:49 UTC

A view-table entry contains four 32-bit words. The host writes entries 16 bytes apart, but the shader indexed them eight bytes apart. A lookup of slot 1 therefore returned the last two words of slot 0 and the first two words of slot 1.

Use the same entry stride when allocating, writing, and reading the table. The test dispatches the actual DXIL load on WARP against two distinct adjacent entries and checks all eight words. It reproduces the overlap with the original offset and passes with this change.

Validation on Windows

  • The adjacent-slot WARP regression test passes.
  • Workspace Clippy passes for all targets and features with warnings denied.

The base branch already reports an unrelated depth-bounds assertion failure. Base CI run

**@⁠Lilith133T** on GitHub · 2026-11-25 03:04 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/7) `Lilith133T:fix/view-address-table-stride` → `main` · +103 −23 · 4 files · 1 commits · merged 2026-11-25 09:49 UTC A view-table entry contains four 32-bit words. The host writes entries 16 bytes apart, but the shader indexed them eight bytes apart. A lookup of slot 1 therefore returned the last two words of slot 0 and the first two words of slot 1. Use the same entry stride when allocating, writing, and reading the table. The test dispatches the actual DXIL load on WARP against two distinct adjacent entries and checks all eight words. It reproduces the overlap with the original offset and passes with this change. Validation on Windows - The adjacent-slot WARP regression test passes. - Workspace Clippy passes for all targets and features with warnings denied. The base branch already reports an unrelated depth-bounds assertion failure. [Base CI run](https://github.com/uiliannn/VItoriaBr/actions/runs/45536121308)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:40:31 +00:00
github manually merged commit 5603b45d64 into gh-pr/7/base 2026-11-26 03:40:34 +00:00
Author
Owner

@⁠flale1 on GitHub · 2026-11-25 04:00 UTC · original

Thanks, this fixes the SLOT_VIEWS stride mismatch we reported in #4. Read through the diff (not run): allocation, host write and shader read now all use SLOT_VIEW_BYTES, and the adjacent-entry WARP test would catch the old 8-byte offset.

Two small notes:

  • The doc comment on SLOT_VIEWS still says "Two dwords per slot: the title address" (shader.rs:33-34); with this change an entry is four dwords (address lo/hi, byte length, stride), as SLOT_VIEW_BYTES says.
  • Possibly related, but separate from this PR: the indexed path puts the entry's byte length straight into dword 2 of the rebuilt descriptor (lower.rs:5719-5724), while the root-view path converts bytes to records for structured views (lower.rs:5844-5852). For a structured view with stride > 1 reached through the indexed path, the record count would then be stride times too large. We have not confirmed a concrete consumer that hits this.

AI-assisted (Claude Code).

**@⁠flale1** on GitHub · 2026-11-25 04:00 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/7#issuecomment-7152447485) Thanks, this fixes the `SLOT_VIEWS` stride mismatch we reported in #4. Read through the diff (not run): allocation, host write and shader read now all use `SLOT_VIEW_BYTES`, and the adjacent-entry WARP test would catch the old 8-byte offset. Two small notes: - The doc comment on `SLOT_VIEWS` still says "Two dwords per slot: the title address" ([`shader.rs:33-34`](https://github.com/uiliannn/VItoriaBr/blob/5603b45/crates/victory-shader/src/emit/shader.rs#L33-L34)); with this change an entry is four dwords (address lo/hi, byte length, stride), as `SLOT_VIEW_BYTES` says. - Possibly related, but separate from this PR: the indexed path puts the entry's byte length straight into dword 2 of the rebuilt descriptor ([`lower.rs:5719-5724`](https://github.com/uiliannn/VItoriaBr/blob/5603b45/crates/victory-shader/src/emit/lower.rs#L5719-L5724)), while the root-view path converts bytes to records for structured views ([`lower.rs:5844-5852`](https://github.com/uiliannn/VItoriaBr/blob/5603b45/crates/victory-shader/src/emit/lower.rs#L5844-L5852)). For a structured view with stride > 1 reached through the indexed path, the record count would then be `stride` times too large. We have not confirmed a concrete consumer that hits this. AI-assisted (Claude Code).
This discussion has been locked. Commenting is limited to contributors.
No description provided.