xboxbvhbuilder: add XboxBvhBuilder acceleration structure interface shim #357

Open
FilimonEnc wants to merge 2 commits from upstream-pr/357 into main
FilimonEnc commented 2026-11-24 05:43:26 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by FilimonEnc on 2026-11-24T05:43:26Z.


Implements the crates/compat/xboxbvhbuilder crate:

  • Adds C++ COM interface IXboxBvhBuilder (IUnknown, GetPrebuildInfo, BuildBottomLevelAS, BuildTopLevelAS, CopyAS).
  • Exports 7 C API functions (CreateXboxBvhBuilder, XboxBvhBuilderInitialize, XboxBvhBuilderGetPrebuildInfo, XboxBvhBuilderBuildBottomLevel, XboxBvhBuilderBuildTopLevel, XboxBvhBuilderCopy, XboxBvhBuilderDestroy).
  • Populates prebuild buffer sizing requirements and passes all unit and gate tests.
<!-- greyfinch-sync:omonkeyz/xbox-emulator:issue:6575482746 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/357). Originally posted by [FilimonEnc](https://github.com/FilimonEnc) on 2026-11-24T05:43:26Z. --- Implements the crates/compat/xboxbvhbuilder crate: - Adds C++ COM interface IXboxBvhBuilder (IUnknown, GetPrebuildInfo, BuildBottomLevelAS, BuildTopLevelAS, CopyAS). - Exports 7 C API functions (CreateXboxBvhBuilder, XboxBvhBuilderInitialize, XboxBvhBuilderGetPrebuildInfo, XboxBvhBuilderBuildBottomLevel, XboxBvhBuilderBuildTopLevel, XboxBvhBuilderCopy, XboxBvhBuilderDestroy). - Populates prebuild buffer sizing requirements and passes all unit and gate tests.
omonkeyz commented 2026-11-25 13:51:43 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-25T13:51:43Z.


Thanks. GetPrebuildInfo returns a fixed 64 KiB and the build and copy calls return S_OK without recording anything on the command list, while exports.txt marks them implemented. The project rule is no fake success. Could you map these onto real D3D12 acceleration-structure builds (or return an error and mark the rows not implemented), and say where the export names and interface layout come from?

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7164397557 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/357#issuecomment-7164397557). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-25T13:51:43Z. --- Thanks. GetPrebuildInfo returns a fixed 64 KiB and the build and copy calls return S_OK without recording anything on the command list, while exports.txt marks them implemented. The project rule is no fake success. Could you map these onto real D3D12 acceleration-structure builds (or return an error and mark the rows not implemented), and say where the export names and interface layout come from?
FilimonEnc commented 2026-11-25 15:41:28 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by FilimonEnc on 2026-11-25T15:41:28Z.


Makes sense — I've updated the crate to follow the no-fake-success rule:

XboxBvhBuilderGetPrebuildInfo, XboxBvhBuilderBuildBottomLevel, XboxBvhBuilderBuildTopLevel, and XboxBvhBuilderCopy now zero the output struct (if non-null) and return E_NOTIMPL instead of returning a fixed 64 KiB or S_OK.
Marked those 4 rows as stub in exports.txt (leaving CreateXboxBvhBuilder, XboxBvhBuilderInitialize, and XboxBvhBuilderDestroy as implemented since they only manage the COM object lifecycle).
Updated src/tests.rs to verify the E_NOTIMPL returns (cargo test -p xboxbvhbuilder and pr_gate.py pass).

Provenance: XboxBvhBuilder.dll is shipped alongside game_scarlett_master.exe (GTA VI Scarlett). The export names come from its export table, and the COM vtable layout was inferred from those exports; real D3D12 ID3D12Device5 / ID3D12GraphicsCommandList4 acceleration-structure mapping will be added once the exact descriptor layouts are verified against the title's callers.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7167231654 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/357#issuecomment-7167231654). Originally posted by [FilimonEnc](https://github.com/FilimonEnc) on 2026-11-25T15:41:28Z. --- Makes sense — I've updated the crate to follow the no-fake-success rule: XboxBvhBuilderGetPrebuildInfo, XboxBvhBuilderBuildBottomLevel, XboxBvhBuilderBuildTopLevel, and XboxBvhBuilderCopy now zero the output struct (if non-null) and return E_NOTIMPL instead of returning a fixed 64 KiB or S_OK. Marked those 4 rows as stub in exports.txt (leaving CreateXboxBvhBuilder, XboxBvhBuilderInitialize, and XboxBvhBuilderDestroy as implemented since they only manage the COM object lifecycle). Updated src/tests.rs to verify the E_NOTIMPL returns (cargo test -p xboxbvhbuilder and pr_gate.py pass). Provenance: XboxBvhBuilder.dll is shipped alongside game_scarlett_master.exe (GTA VI Scarlett). The export names come from its export table, and the COM vtable layout was inferred from those exports; real D3D12 ID3D12Device5 / ID3D12GraphicsCommandList4 acceleration-structure mapping will be added once the exact descriptor layouts are verified against the title's callers.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/357:upstream-pr/357'
git switch 'upstream-pr/357'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/357'
git switch 'upstream-pr/357'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/357'
git switch 'upstream-pr/357'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/357'
git switch 'main'
git merge --squash 'upstream-pr/357'
git switch 'main'
git merge --ff-only 'upstream-pr/357'
git switch 'main'
git merge 'upstream-pr/357'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
omonkeyz/xbox-emulator!357
No description provided.