mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:50:52 +01:00
[PR #513] [CLOSED] d3d12: a constant-buffer view's V# steps 16 bytes a row (RT-CBV-VSHARP-STRIDE) #562
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#562
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/513
Author: @oscarlosu-lab
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:pr/cbv-vsharp-stride📝 Commits (1)
a29c21bd3d12: a constant-buffer view's V# steps 16 bytes a row (RT-CBV-VSHARP-STRIDE)📊 Changes
3 files changed (+19 additions, -6 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+9 -3)📝
runtime/shims/d3d12_vulkan_device.cpp(+8 -1)📝
runtime/test/d3d12_compute_test.cpp(+2 -2)📄 Description
Claimed in the coordination issue as: RT-CBV-VSHARP-STRIDE
What and why
CreateConstantBufferViewwrote the CBV's raw GFX10 V# with STRIDE 0. A translated buffer access withidxenadds index × V# STRIDE to the address (tools/rdna2spirv.py, buffer addressing), so a program that indexes its constant buffer by 16-byte row read row 0 for every index.ThatRecompDev/five-star-recomp (GPL-3.0), commit
4c6bce59b, measured this on the retail title: the UI's batch programs read each vertex's matrix rows from their CBV by index (row batch × 4 + k); with stride 0 both screen coordinates came out equal and every vector shape of the UI fell on the line x = y (the diagonal across the first-run screens, letters drawn as shapes). Their fix gives a buffer view's record the element stride: 16 for a CBV, the structure for a structured view, the element for a typed one, 0 for raw. In Leonida the structured and typed buffer SRV/UAV paths already write their stride and raw views keep 0, so the CBV is the only gap.Change
runtime/shims/d3d12_vulkan_device.cpp: the CBV V#'s STRIDE is 16 (kConstantBufferRow). NUM_RECORDS stays the view's size in bytes with OOB_SELECT RAW: RAW bounds a MUBUF access by its offset, not index × STRIDE (docs/design.md, Buffer bounds checking), so that bound is unchanged. Ans_buffer_loadbound becomes NUM_RECORDS × STRIDE, past the end of any constant a program declares.runtime/test/d3d12_compute_test.cpp: the decoded CBV words expect STRIDE 16.docs/d3d12_vulkan.md: describes the CBV V#; the known-gaps list still said CBVs and buffer SRVs were not written.Tested
Windows 11, MSVC 19.52 x64, NVIDIA GeForce RTX 3060 (driver 621.35): runtime builds with no warnings in the touched files;
d3d12_compute_test,d3d12_descriptor_testandd3d12_vulkan_device_testpass.scripts/check_no_game_data.pyandtests/test_docs_links.pypass. Not yet measured on a retail boot here; I will add the result when we have it.AI-assisted (Claude Code). No game files.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.