mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #326] runtime: the index buffer view size bounds the index fetch in the Vulkan replay (reads past the view are 0) #378
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#378
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/326
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/10061📝 Commits (6)
7c56e90fix: index buffer view SizeInBytes bounds the index fetch; reads outside the view are 0561a063fix: a draw that crosses the index view's end reads index 0 past it, from a staged copyfc9b2f3fix: scratch buffers allow index-buffer use for the staged index copy3e70e82fix: bound null index views to zero page74fc913test: the null index view test releases its buffers before the device proxy reference check5f86fa5test: replay_index_view_test covers the index view bounds in prepare_draw without a GPU📊 Changes
5 files changed (+288 additions, -11 deletions)
View changed files
📝
runtime/CMakeLists.txt(+7 -0)📝
runtime/src/vulkan_replay.h(+58 -6)📝
runtime/src/vulkan_scratch.h(+2 -1)📝
runtime/test/d3d12_draw_test.cpp(+87 -4)➕
runtime/test/replay_index_view_test.cpp(+134 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):What
An indexed draw now honours the index buffer view's
SizeInBytesin the Vulkan replay (prepare_draw,runtime/src/vulkan_replay.h):vkCmdBindIndexBufferhas no size without VK_KHR_maintenance5, so it binds to the end of the whole buffer);Why
D3D12 defines an index fetch outside the view as 0. The replay bound the whole buffer, so a title that leaves stale or larger data behind its view (common with suballocated index buffers) drew geometry it should not, or read other resources' bytes: wrong 3D rendering.
Rebased cleanly on current main; supersedes
#7808closed during org migration (same 5 commits, cherry-picked without conflicts) plus a new CPU-only test.Tested
No GPU pod was available (all down), so:
replay_index_view_test(native g++, no GPU, drivesprepare_drawwith fake Vulkan callbacks): 5 cases pass (inside / outside / straddle / null view / null view bigger than the zero page).prepare_draw: 3 of 5 FAIL ("outside: the zero page is bound", "straddle: a staged copy is bound", "null view, large draw: a zeroed scratch covers the whole draw").d3d12_draw_test.cpp(the original GPU test with the pixel checks for view_out / view_in / straddle / null / zero / live) compiles clean with clang-cl 19 (-fsyntax-only), but I could NOT run it: it needs a Vulkan device (and main's d3d12_vulkan_device.cpp does not build until#9809/#9815 land). Its GPU result is unverified in this PR.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.