Repository navigation
vulkan_replay, d3d12: keep indexed BLAS primitive count from falling back to vertex_count - #8146
Open
CourtyardGames wants to merge 1 commit into
Open
CourtyardGames wants to merge 1 commit into
CourtyardGames wants to merge 1 commit into
Conversation
…back to vertex_count
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: #8047 (comment)
What and why
Both KHR BLAS triangle paths (
runtime/src/vulkan_replay.hinemit()andruntime/shims/d3d12_vulkan_device.cppinGetRaytracingAccelerationStructurePrebuildInfo()) computed the triangle primitive count as:When an indexed triangle geometry (
VK_INDEX_TYPE_UINT16/VK_INDEX_TYPE_UINT32) hasindex_count < 3(for exampleindex_count == 0for an empty submesh sharing a non-empty vertex buffer),tr.indexTyperemains indexed while the primitive count fell back tovertex_count / 3, asking Vulkan to build triangles from an out-of-bounds or null index buffer (and inflating prebuild sizes). Conversely, an unknownindex_typethat mapped toVK_INDEX_TYPE_NONE_KHRstill took the indexed branch ifindex_count >= 3.This matches the XDXR path (
runtime/src/vulkan_backend.h:1314,1324) and derives primitive count directly from whethertr.indexType != VK_INDEX_TYPE_NONE_KHR:index_count / 3when indexed,vertex_count / 3when non-indexed.Also adds a portable CPU mock test (
runtime/test/replay_blas_prim_count_test.cpp, registered asreplay_blas_prim_countinruntime/CMakeLists.txt) coveringUINT16with 0 indices,UINT32with 2 indices,UINT16with 9 indices, non-indexed geometry, and unknownindex_type.Tested
RelWithDebInfo, Ninja); CPU mock tests need no GPU or game files (d3d12_dxr_validationalso compiled and passed).replay_blas_prim_count_testfails on unpatchedmainon all three buggy cases (UINT16with 0 indices,UINT32with 2 indices, and unknownindex_type).ctest --test-dir runtime/build -R "^(replay_blas_prim_count|replay_clear_gate|replay_copy_offset|replay_query_edges|d3d12_dxr_validation)$" --output-on-failure— 5/5 passed.python -I scripts/check_no_game_data.py runtime/src/vulkan_replay.h runtime/shims/d3d12_vulkan_device.cpp runtime/CMakeLists.txt runtime/test/replay_blas_prim_count_test.cpp— passed (exit 0).AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (N/A — runtime D3D12/Vulkan replay fix, not a shader-translator rule.)