fix(agc): bind misaligned buffer views through copies of their own #122
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/122"
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?
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-29T00:24:59Z.
What
A region decides its storage-buffer offset alignment by its first byte alone, so a V# inside it at a misaligned distance from the region's binding base fails
Descriptor("violates storage buffer offset alignment") and the draw or dispatch is skipped. This is separate from the misaligned regions main already copies out of imports: here the region itself is fine and one view inside it is not. Two shapes reach it: an element at an odd offset inside a region bound in place from an import, and the second of two overlapping allocations whose merged region starts at the first. The recompiled shaders index a binding from the V#'s base, so there is no per-binding offset to pass a remainder through.Such views now bind an alias: a buffer holding the view's bytes from the view's address, bound at offset 0.
recordGpuCopies, so the input snapshots for deferred copies (#94) apply to it like any copied region. A written alias is copied back into the import byRecordCopyBacks, or stored from its host-visible copy byWriteBackwhen the use records no copy-back.WriteBackstores only the bytes the GPU changed.Still throws: written views bound through different bindings that overlap (one binding's copy-back would roll back the other's stores), naming both views. Builds with aliases are not reused (
DirectRegions). The remaining alignment error names the view, its owner region, the binding base and its kind.Tested
agc_driver_recorder_testswith the newtests/ViewAliases.cpp(GPU copy path over a host import: odd view in a region bound in place with copy-back, overlapping allocations with no copy-back, rejected overlap of two written views). It is added to theagc_driver_recorder_teststarget; that target is not under ctest because it needs a Vulkan device. With alias binding disabled it fails.agc_driver_graphics_tests(BdaResources, CPU path) passes with #113 merged in, and fails with alias binding disabled.ctest: 57/57 pass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-30T11:03:54Z.
Closing this one:
3dec6cedon main now binds misaligned views from the aligned offset below them and passes the difference to the shader, which covers what this PR was for. Main still throws for a remainder that is not a multiple of 4 bytes and for shaders whose shader data is a buffer; PPSA21564 has not hit either case, so there is nothing left here worth merging. If one of them shows up I will open a small PR on top of the current code. Thanks!Pull request closed