d3d12: preserve offsets in sub-page host buffer imports (RT-HOST-IMPORT-PREFIX) #1192

Manually merged
github merged 7 commits from gh-pr/1192/head into gh-pr/1192/base 2026-11-26 09:42:15 +00:00
Owner

@⁠GGandCo on GitHub · 2026-11-24 19:56 UTC · original
GGandCo:fix/host-import-prefix → main · +194 −20 · 5 files · 7 commits · merged 2026-11-25 14:49 UTC

Claimed in the coordination issue as: RT-HOST-IMPORT-PREFIX

Claim: #14 (posted before this PR).

Depends on: none.

Overlaps: #1190 and #1100 touch the same existing-heap fixture/backend file. This PR only changes per-resource imported-buffer prefix alignment; it does not implement existing-heap placed resources or deferred image backing. I will rebase and preserve both sets of tests if either lands first.

What and why

A buffer 16 or 32 bytes into an importable host page can be valid for the logical resource while failing the Vulkan memory-binding alignment. Binding the logical VkBuffer at that prefix currently falls back to an unrelated allocation, so the caller's writes do not share its GPU memory.

Bind a VkBuffer covering the page prefix plus logical range at memory offset zero. Carry the logical prefix in ResourceBinding::buffer_offset and in a valid returned device address. Preserve logical VA, size, initial contents and the existing ordinary-buffer fallback for byte-unaligned addresses.

Extend the existing synthetic fixture with bidirectional copies and surrounding-byte sentinels. Add d3d12_host_prefix / --host-prefix-only so this behavior can be tested independently of OpenExistingHeapFromAddress. The full existing-heap suite remains enabled and includes the new cases.

Review regression fixed

The +4-byte host-prefix RGBA16 texture-copy regression reported in review is fixed with aligned transfer scratch, preserving the host alias. The isolated test now covers 0/4/8/16/32/64 prefixes, buffer copies and two-row RGBA16 texture copies in both directions, including every padding byte. Normal and Vulkan-validation runs pass locally; the unchanged previous head fails the new CPU replay fixture. Wine/Proton revalidation is pending.

Tested

Rebased onto main 98c2f7777 (current PR head 002c720f2). Conflict resolution keeps main's import-failure cleanup and page-pin release, BDA word padding, low-address import guards, shadow-fallback behavior and additional heap/placed-texture tests, plus this PR's logical prefix and aligned texture-copy staging. The RelWithDebInfo target build, isolated d3d12_host_prefix test normally and with Vulkan validation, and changed-file game-data/whitespace checks pass again on the rebased head. The negative control below was measured against main6293c1c4 / main58be9cdf8 before this rebase.

Local Windows / Intel UHD Graphics (101.6314):

  • Isolated candidate d3d12_host_prefix passes normally and with Vulkan validation enabled: 0, 16, 32 and 64-byte offsets, CPU-to-GPU and GPU-to-CPU coherence, initial contents, and unchanged prefix/tail.
  • Exact unchanged-main backend plus the identical isolated test fails at the 16- and 32-byte offsets because the resource VA differs from the caller VA. Aligned and 64-byte cases succeed. Restoring the candidate passes normally and with validation again.
  • Our separate local PR984 integration also passes this isolated test in both modes and its TLS/xmem/proxy regressions. That integration is not the clean-main build used above.

Independent reports on 02a2717b (before adding the isolated test):

  • RTX3060Ti, native Windows11, NVIDIA621.24: unchanged-main control fails exactly the two new offsets; the candidate passes the full existing-heap executable, including bidirectional coherence and surrounding bytes: #1192
  • RTX3060Ti, Arch Linux / Wine11.22, NVIDIA595.58.03: full existing-heap CTest passes: #1192

Known limitation: the monolithic existing-heap executable on the local Intel machine still intermittently loses the device in its earlier aligned copy after the existing-heap checks, on both unchanged main and candidate. The isolated test above avoids those preceding operations; it does not remove their coverage. PR #1259 separately addresses that earlier-import lifetime issue: applied privately on top of this PR before the latest rebase, the full test passes normally, with validation and in three further repeats on this Intel machine (#1259). That fix is not included here. A private queue-barrier experiment was not reproducible and is not included. No game boot, gameplay or performance claim is made by this PR.

GPUs tested: Intel UHD Graphics / Windows, 101.6314 (local); NVIDIA RTX3060Ti / Windows,621.24 and Arch Linux+Wine11.22,595.58.03 (independent reports linked above).

AI-assisted: yes.

Checklist

  • Based on current main and rebased cleanly.
  • One topic; independent GPU/heap issues remain separate.
  • No game data, keys, decryption, generated shaders, captures or private runtime logs included.
  • No translator rule changed.
**@⁠GGandCo** on GitHub · 2026-11-24 19:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192) `GGandCo:fix/host-import-prefix` → `main` · +194 −20 · 5 files · 7 commits · merged 2026-11-25 14:49 UTC Claimed in the coordination issue as: RT-HOST-IMPORT-PREFIX Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 (posted before this PR). Depends on: none. Overlaps: #1190 and #1100 touch the same existing-heap fixture/backend file. This PR only changes per-resource imported-buffer prefix alignment; it does not implement existing-heap placed resources or deferred image backing. I will rebase and preserve both sets of tests if either lands first. ### What and why A buffer 16 or 32 bytes into an importable host page can be valid for the logical resource while failing the Vulkan memory-binding alignment. Binding the logical VkBuffer at that prefix currently falls back to an unrelated allocation, so the caller's writes do not share its GPU memory. Bind a VkBuffer covering the page prefix plus logical range at memory offset zero. Carry the logical prefix in ResourceBinding::buffer_offset and in a valid returned device address. Preserve logical VA, size, initial contents and the existing ordinary-buffer fallback for byte-unaligned addresses. Extend the existing synthetic fixture with bidirectional copies and surrounding-byte sentinels. Add d3d12_host_prefix / --host-prefix-only so this behavior can be tested independently of OpenExistingHeapFromAddress. The full existing-heap suite remains enabled and includes the new cases. ### Review regression fixed The +4-byte host-prefix RGBA16 texture-copy regression reported in review is fixed with aligned transfer scratch, preserving the host alias. The isolated test now covers 0/4/8/16/32/64 prefixes, buffer copies and two-row RGBA16 texture copies in both directions, including every padding byte. Normal and Vulkan-validation runs pass locally; the unchanged previous head fails the new CPU replay fixture. Wine/Proton revalidation is pending. ### Tested Rebased onto main 98c2f7777 (current PR head 002c720f2). Conflict resolution keeps main's import-failure cleanup and page-pin release, BDA word padding, low-address import guards, shadow-fallback behavior and additional heap/placed-texture tests, plus this PR's logical prefix and aligned texture-copy staging. The RelWithDebInfo target build, isolated d3d12_host_prefix test normally and with Vulkan validation, and changed-file game-data/whitespace checks pass again on the rebased head. The negative control below was measured against main6293c1c4 / main58be9cdf8 before this rebase. Local Windows / Intel UHD Graphics (101.6314): - Isolated candidate d3d12_host_prefix passes normally and with Vulkan validation enabled: 0, 16, 32 and 64-byte offsets, CPU-to-GPU and GPU-to-CPU coherence, initial contents, and unchanged prefix/tail. - Exact unchanged-main backend plus the identical isolated test fails at the 16- and 32-byte offsets because the resource VA differs from the caller VA. Aligned and 64-byte cases succeed. Restoring the candidate passes normally and with validation again. - Our separate local PR984 integration also passes this isolated test in both modes and its TLS/xmem/proxy regressions. That integration is not the clean-main build used above. Independent reports on 02a2717b (before adding the isolated test): - RTX3060Ti, native Windows11, NVIDIA621.24: unchanged-main control fails exactly the two new offsets; the candidate passes the full existing-heap executable, including bidirectional coherence and surrounding bytes: https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/1192 - RTX3060Ti, Arch Linux / Wine11.22, NVIDIA595.58.03: full existing-heap CTest passes: https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/1192 Known limitation: the monolithic existing-heap executable on the local Intel machine still intermittently loses the device in its earlier aligned copy after the existing-heap checks, on both unchanged main and candidate. The isolated test above avoids those preceding operations; it does not remove their coverage. PR #1259 separately addresses that earlier-import lifetime issue: applied privately on top of this PR before the latest rebase, the full test passes normally, with validation and in three further repeats on this Intel machine (https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/1259). That fix is not included here. A private queue-barrier experiment was not reproducible and is not included. No game boot, gameplay or performance claim is made by this PR. GPUs tested: Intel UHD Graphics / Windows, 101.6314 (local); NVIDIA RTX3060Ti / Windows,621.24 and Arch Linux+Wine11.22,595.58.03 (independent reports linked above). AI-assisted: yes. ### Checklist - [x] Based on current main and rebased cleanly. - [x] One topic; independent GPU/heap issues remain separate. - [x] No game data, keys, decryption, generated shaders, captures or private runtime logs included. - [x] No translator rule changed.
On a driver that refuses importing a section view (RADV: amdgpu userptr takes
anonymous memory only), the layer answers with a shadow at the same title VA,
so the `may_refuse` early return never fires. The forward readback still
passes through the shadow, but a shadow is never written back, so the new
reverse-copy check failed on an AMD iGPU under Wine. Check the caller's pages
only when the buffer is a real import.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:42:11 +00:00
github manually merged commit 45219a6400 into gh-pr/1192/base 2026-11-26 09:42:15 +00:00
Author
Owner

@⁠madhyn on GitHub · 2026-11-24 20:08 UTC · original

Tested 02a2717b8 on Arch Linux + Wine 11.22 + NVIDIA RTX 3060 Ti (595.58.03 / Vulkan):

  • ctest --test-dir runtime/build/win -R "^d3d12_existing_heap$" --output-on-failure: Passed (5.49 s)

AI-assisted: yes

**@⁠madhyn** on GitHub · 2026-11-24 20:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192#issuecomment-7143088780) Tested `02a2717b8` on Arch Linux + Wine 11.22 + NVIDIA RTX 3060 Ti (595.58.03 / Vulkan): - `ctest --test-dir runtime/build/win -R "^d3d12_existing_heap$" --output-on-failure`: **Passed** (5.49 s) AI-assisted: yes
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:08 UTC · original

Recommendation: [WAIT]

Reasoning: Draft: binds sub-page host buffer imports from the page start and keeps the prefix in buffer_offset, instead of falling back to an unrelated allocation when the offset is misaligned. The approach looks right and the existing-heap test is extended. But the PR is still marked draft, has no description template or claim, and overlaps #1190/#1100 in the same test file. Mark it ready, fill in the claim/testing sections, and coordinate merge order. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main.

Impact level: 4/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192#issuecomment-7143097079) **Recommendation:** [WAIT] **Reasoning:** Draft: binds sub-page host buffer imports from the page start and keeps the prefix in `buffer_offset`, instead of falling back to an unrelated allocation when the offset is misaligned. The approach looks right and the existing-heap test is extended. But the PR is still marked draft, has no description template or claim, and overlaps #1190/#1100 in the same test file. Mark it ready, fill in the claim/testing sections, and coordinate merge order. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. **Impact level:** 4/10
Author
Owner

@⁠hubeton on GitHub · 2026-11-24 20:09 UTC · original

Independent A/B result on native Windows 11 build 26300.9974 with an Intel Core i9-13900K (24 cores, 32 threads), 64 GB RAM and an RTX 3060 Ti 8 GB (NVIDIA 621.24, Vulkan). Both executables were built with clang-cl/xwin in RelWithDebInfo.

I used the PR's identical d3d12_existing_heap_test.cpp in both builds. The control had the runtime from 6293c1c4 and the candidate had the runtime from 02a2717b.

  • Control (exit 1) reached both new cases. At offsets +16 and +32 bytes, the buffer's GPU VA differed from the caller address. The aligned and +64-byte cases passed.
  • PR (exit 0) passed both new cases, including preservation of the caller VA and initial data, copies in both directions, and unchanged bytes before and after the logical buffer. The existing heap cases matched native D3D12 on both the RTX 3060 Ti and WARP.

This is a synthetic memory-coherence test. I did not run the game. AI-assisted testing and report.

**@⁠hubeton** on GitHub · 2026-11-24 20:09 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192#issuecomment-7143110601) Independent A/B result on native Windows 11 build 26300.9974 with an Intel Core i9-13900K (24 cores, 32 threads), 64 GB RAM and an RTX 3060 Ti 8 GB (NVIDIA 621.24, Vulkan). Both executables were built with clang-cl/xwin in RelWithDebInfo. I used the PR's identical `d3d12_existing_heap_test.cpp` in both builds. The control had the runtime from `6293c1c4` and the candidate had the runtime from `02a2717b`. - **Control (exit 1)** reached both new cases. At offsets +16 and +32 bytes, the buffer's GPU VA differed from the caller address. The aligned and +64-byte cases passed. - **PR (exit 0)** passed both new cases, including preservation of the caller VA and initial data, copies in both directions, and unchanged bytes before and after the logical buffer. The existing heap cases matched native D3D12 on both the RTX 3060 Ti and WARP. This is a synthetic memory-coherence test. I did not run the game. AI-assisted testing and report.
Author
Owner

@⁠GGandCo on GitHub · 2026-11-24 20:32 UTC · original

Thanks for the independent A/B and Wine tests. The claim predates this PR and is linked at the top of the description: #14. I filled the repository template, rebased onto current main58be9cdf8, and added an isolated host-prefix CTest without removing the full existing-heap suite.

Our Intel A/B now reaches the behavior directly: unchanged backend fails only the 16/32-byte prefix cases; candidate passes normally and with Vulkan validation. The separate Intel failure after existing-heap operations is still disclosed. No experimental barrier change is included.

For merge order, #1190 owns existing-heap placed buffers and #1100 owns deferred attachments; this PR changes neither feature. They share files/test context, so I will rebase and retain their coverage if either merges first. CI workflow approval remains with maintainers.

**@⁠GGandCo** on GitHub · 2026-11-24 20:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192#issuecomment-7143711032) Thanks for the independent A/B and Wine tests. The claim predates this PR and is linked at the top of the description: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14. I filled the repository template, rebased onto current main58be9cdf8, and added an isolated host-prefix CTest without removing the full existing-heap suite. Our Intel A/B now reaches the behavior directly: unchanged backend fails only the 16/32-byte prefix cases; candidate passes normally and with Vulkan validation. The separate Intel failure after existing-heap operations is still disclosed. No experimental barrier change is included. For merge order, #1190 owns existing-heap placed buffers and #1100 owns deferred attachments; this PR changes neither feature. They share files/test context, so I will rebase and retain their coverage if either merges first. CI workflow approval remains with maintainers.
Author
Owner

@⁠qhukz13 on GitHub · 2026-11-24 21:40 UTC · original

A second hardware point, where main fails without this PR: GeForce GTX 1050 Ti (Pascal, 4 GB), NVIDIA 582.66, Windows 10 Pro 19045, MSVC RelWithDebInfo.

  • main at 6261ca916: d3d12_existing_heap fails. The case that breaks is the existing "64 bytes into a page" one (check_title_placed, test line 271): the layer logs a title-placed buffer (device slot 133) could not import its pages ... HRESULT -2147467263 (E_NOTIMPL) and the check at line 196, GetGPUVirtualAddress() == pages, fails. The other slot-133 cases (VirtualAlloc range, section view, the two cache modifiers, the partly committed range) pass, and the 8 OpenExistingHeapFromAddress cases match the host.
  • This PR at 5ea48706b, built the same way: d3d12_existing_heap passes.

So on Pascal it is not only the 16- and 32-byte offsets: a 64-byte offset into a page is refused on main too, presumably because this driver's memory-binding alignment for the imported buffer is larger than 64, which the old offset % requirements.alignment check turned into the fallback. Binding at zero and carrying the offset fixes it here as well. That matters for the boot: slot 133 is how the title places its buffers on its own pages, and on this card main silently gives such a buffer memory the title's writes never reach.

The same failure is one of the five that #1217 lists as reproduced natively on a Pascal card.

No game files. AI-assisted (Claude Code).

**@⁠qhukz13** on GitHub · 2026-11-24 21:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192#issuecomment-7145239358) A second hardware point, where `main` fails without this PR: GeForce GTX 1050 Ti (Pascal, 4 GB), NVIDIA 582.66, Windows 10 Pro 19045, MSVC RelWithDebInfo. - `main` at `6261ca916`: `d3d12_existing_heap` **fails**. The case that breaks is the existing "64 bytes into a page" one (`check_title_placed`, test line 271): the layer logs `a title-placed buffer (device slot 133) could not import its pages ... HRESULT -2147467263` (`E_NOTIMPL`) and the check at line 196, `GetGPUVirtualAddress() == pages`, fails. The other slot-133 cases (VirtualAlloc range, section view, the two cache modifiers, the partly committed range) pass, and the 8 `OpenExistingHeapFromAddress` cases match the host. - This PR at `5ea48706b`, built the same way: `d3d12_existing_heap` **passes**. So on Pascal it is not only the 16- and 32-byte offsets: a 64-byte offset into a page is refused on `main` too, presumably because this driver's memory-binding alignment for the imported buffer is larger than 64, which the old `offset % requirements.alignment` check turned into the fallback. Binding at zero and carrying the offset fixes it here as well. That matters for the boot: slot 133 is how the title places its buffers on its own pages, and on this card `main` silently gives such a buffer memory the title's writes never reach. The same failure is one of the five that #1217 lists as reproduced natively on a Pascal card. No game files. AI-assisted (Claude Code).
Author
Owner

@⁠moffington on GitHub · 2026-11-24 22:04 UTC · original

Reviewed 1e525c53 on Linux with an RTX 3060 (615.78.08), under Wine 11.20 and Proton Experimental.

The isolated host-prefix fixture passes at 0, 16, 32 and 64 bytes, including bidirectional coherence and surrounding sentinels. Both the published base and merge base fail the +16/+32 VA checks as expected.

I found one regression with a +4-byte host prefix:

  • 256-byte imported buffer.
  • CopyTextureRegion into a 1×1 R16G16B16A16_UNORM texture.
  • Resource-relative footprint offset 0, row pitch 256.

Both bases complete the copy through their ordinary-buffer fallback. HEAD successfully imports the buffer but returns ReplayResult::unsupported during texture-copy replay. The same test passes at +8 and +64 on HEAD, and ordinary buffer copies at +4 also pass.

The prefix added through ResourceBinding::buffer_offset triggers the 8-byte alignment guard in vulkan_replay.h:1869.

Reproduced under both runners, with and without validation. Could the existing aligned staging approach be extended to handle this case while preserving the host alias?

Native Xbox parity is unverified, but this is a reproducible regression relative to both base revisions.

**@⁠moffington** on GitHub · 2026-11-24 22:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192#issuecomment-7145758743) Reviewed `1e525c53` on Linux with an RTX 3060 (615.78.08), under Wine 11.20 and Proton Experimental. The isolated host-prefix fixture passes at 0, 16, 32 and 64 bytes, including bidirectional coherence and surrounding sentinels. Both the published base and merge base fail the +16/+32 VA checks as expected. I found one regression with a +4-byte host prefix: - 256-byte imported buffer. - CopyTextureRegion into a 1×1 R16G16B16A16_UNORM texture. - Resource-relative footprint offset 0, row pitch 256. Both bases complete the copy through their ordinary-buffer fallback. HEAD successfully imports the buffer but returns ReplayResult::unsupported during texture-copy replay. The same test passes at +8 and +64 on HEAD, and ordinary buffer copies at +4 also pass. The prefix added through `ResourceBinding::buffer_offset` triggers the 8-byte alignment guard in `vulkan_replay.h:1869`. Reproduced under both runners, with and without validation. Could the existing aligned staging approach be extended to handle this case while preserving the host alias? Native Xbox parity is unverified, but this is a reproducible regression relative to both base revisions.
Author
Owner

@⁠GGandCo on GitHub · 2026-11-24 22:43 UTC · original

Thanks for the reproducible +4 report. Fixed in 5e6d4048d (code in 3df5d0cb9).

The imported host alias is retained. Texture-copy replay now uses the existing aligned transfer scratch when a word-aligned host prefix violates the image's texel/block alignment, in both directions. Only occupied texels are copied; prefix, row padding and tail stay untouched. The direct path remains for already aligned copies, including byte-aligned R8; invalid logical offsets and overflowing spans remain rejected.

Tests on Windows 11 / Intel UHD Graphics 101.6314:

  • Expanded isolated d3d12_host_prefix: offsets 0/4/8/16/32/64, buffer coherence plus two-row R16G16B16A16_UNORM texture upload/readback with 256-byte row pitch and every untouched byte checked: passes normally and with Vulkan validation (no validation errors).
  • CPU replay_copy_offset fixture checks the exact scratch regions both ways, missing-scratch refusal and the R8 direct path: passes.
  • Negative control: identical new RGBA16 replay fixture against unchanged 1e525c532 fails both +4 directions; restoring the fix passes.

Could you repeat your Wine/Proton reproduction on this head? That environment has not been tested locally. No game boot or gameplay claim. AI-assisted.

**@⁠GGandCo** on GitHub · 2026-11-24 22:43 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192#issuecomment-7146563027) Thanks for the reproducible +4 report. Fixed in 5e6d4048d (code in 3df5d0cb9). The imported host alias is retained. Texture-copy replay now uses the existing aligned transfer scratch when a word-aligned host prefix violates the image's texel/block alignment, in both directions. Only occupied texels are copied; prefix, row padding and tail stay untouched. The direct path remains for already aligned copies, including byte-aligned R8; invalid logical offsets and overflowing spans remain rejected. Tests on Windows 11 / Intel UHD Graphics 101.6314: - Expanded isolated d3d12_host_prefix: offsets 0/4/8/16/32/64, buffer coherence plus two-row R16G16B16A16_UNORM texture upload/readback with 256-byte row pitch and every untouched byte checked: passes normally and with Vulkan validation (no validation errors). - CPU replay_copy_offset fixture checks the exact scratch regions both ways, missing-scratch refusal and the R8 direct path: passes. - Negative control: identical new RGBA16 replay fixture against unchanged 1e525c532 fails both +4 directions; restoring the fix passes. Could you repeat your Wine/Proton reproduction on this head? That environment has not been tested locally. No game boot or gameplay claim. AI-assisted.
Author
Owner

@⁠GGandCo on GitHub · 2026-11-25 05:46 UTC · original

Rebased onto main 42537e7b6; new head 7e467c6b5. The conflicts are resolved while preserving main's BDA word padding, low-address import guards, shadow fallback, additional placed-texture/shadow tests and texture-refresh test setup. This PR still adds only the host-prefix handling, isolated fixture and review regression fix.

Rebuilt RelWithDebInfo on Windows / Intel UHD Graphics 101.6314. d3d12_host_prefix and replay_copy_offset pass; the isolated GPU test also passes with Vulkan validation. Coverage remains offsets 0/4/8/16/32/64, buffer and two-row RGBA16 transfers in both directions, prefix/padding/tail preservation and safe missing-scratch refusal. Changed-file data and whitespace checks pass. The full monolithic heap suite was not rerun for this rebase. AI-assisted. Wine/Proton retest of the +4 review case remains welcome.

**@⁠GGandCo** on GitHub · 2026-11-25 05:46 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192#issuecomment-7154127524) Rebased onto main 42537e7b6; new head 7e467c6b5. The conflicts are resolved while preserving main's BDA word padding, low-address import guards, shadow fallback, additional placed-texture/shadow tests and texture-refresh test setup. This PR still adds only the host-prefix handling, isolated fixture and review regression fix. Rebuilt RelWithDebInfo on Windows / Intel UHD Graphics 101.6314. d3d12_host_prefix and replay_copy_offset pass; the isolated GPU test also passes with Vulkan validation. Coverage remains offsets 0/4/8/16/32/64, buffer and two-row RGBA16 transfers in both directions, prefix/padding/tail preservation and safe missing-scratch refusal. Changed-file data and whitespace checks pass. The full monolithic heap suite was not rerun for this rebase. AI-assisted. Wine/Proton retest of the +4 review case remains welcome.
Author
Owner

@⁠GGandCo on GitHub · 2026-11-25 10:56 UTC · original

Rebased again onto main bcaa13dad; head 4bee7a33a. The new conflict was in create_host_buffer's import-refusal cleanup. Resolution retains main's decline() cleanup (including import memory and page-pin release) while keeping the prefix inside the VkBuffer and binding at zero.

RelWithDebInfo build, d3d12_host_prefix and replay_copy_offset pass on Windows / Intel UHD Graphics 101.6314. The isolated buffer/texture-prefix fixture also passes with Vulkan validation. Changed-file game-data/whitespace checks pass. Full monolithic heap suite not rerun. AI-assisted.

**@⁠GGandCo** on GitHub · 2026-11-25 10:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192#issuecomment-7160385799) Rebased again onto main bcaa13dad; head 4bee7a33a. The new conflict was in create_host_buffer's import-refusal cleanup. Resolution retains main's decline() cleanup (including import memory and page-pin release) while keeping the prefix inside the VkBuffer and binding at zero. RelWithDebInfo build, d3d12_host_prefix and replay_copy_offset pass on Windows / Intel UHD Graphics 101.6314. The isolated buffer/texture-prefix fixture also passes with Vulkan validation. Changed-file game-data/whitespace checks pass. Full monolithic heap suite not rerun. AI-assisted.
Author
Owner

@⁠GGandCo on GitHub · 2026-11-25 13:07 UTC · original

Rebased onto main 98c2f7777; head 002c720f2. The conflict was in imported-buffer ResourceBinding initialization: both main's indirect_arguments flag and this PR's logical buffer_offset are retained. RelWithDebInfo build, isolated d3d12_host_prefix/replay_copy_offset tests and the isolated GPU prefix fixture with Vulkan validation pass on Windows / Intel UHD Graphics 101.6314. Changed-file checks pass. Full heap suite not rerun. AI-assisted.

**@⁠GGandCo** on GitHub · 2026-11-25 13:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192#issuecomment-7163331114) Rebased onto main 98c2f7777; head 002c720f2. The conflict was in imported-buffer ResourceBinding initialization: both main's indirect_arguments flag and this PR's logical buffer_offset are retained. RelWithDebInfo build, isolated d3d12_host_prefix/replay_copy_offset tests and the isolated GPU prefix fixture with Vulkan validation pass on Windows / Intel UHD Graphics 101.6314. Changed-file checks pass. Full heap suite not rerun. AI-assisted.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 14:49 UTC · original

Merged. Thank you, @⁠GGandCo, and thanks to @⁠moffington for the +4 RGBA16 regression that the texture-copy staging now covers.

  • What I pushed to the branch: a merge of main and one test fix, no force-push.
    • The test fix: on a driver that refuses importing a section view (RADV, where amdgpu userptr takes anonymous memory only), the layer answers with a shadow at the same title VA, so the may_refuse early return never fired.
    • The new reverse-copy check then read a one-way shadow. It now checks the caller's pages only when title_shadow_buffer says the buffer is a real import.
  • Tested: Windows suite under Wine (llvmpipe and an RDNA2 iGPU) on current main + this branch. Nothing goes from pass to fail. The new d3d12_host_prefix passes on both devices, and so do the three d3d12_existing_heap variants that failed on the iGPU before.
  • #1768 makes the same change in create_host_buffer without the staging, so it will be closed as a duplicate.
  • Checked on main 446574e76 + 45219a640: it merges cleanly; the semantic suite passes (489 files, 6,288 tests, 0 files failed); the 14 docs and writer tests pass; check_no_game_data.py is clean on the 5 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-25 14:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1192#issuecomment-7165876337) Merged. Thank you, @⁠GGandCo, and thanks to @⁠moffington for the +4 RGBA16 regression that the texture-copy staging now covers. - **What I pushed to the branch:** a merge of `main` and one test fix, no force-push. - The test fix: on a driver that refuses importing a section view (RADV, where amdgpu userptr takes anonymous memory only), the layer answers with a shadow at the same title VA, so the `may_refuse` early return never fired. - The new reverse-copy check then read a one-way shadow. It now checks the caller's pages only when `title_shadow_buffer` says the buffer is a real import. - **Tested:** Windows suite under Wine (llvmpipe and an RDNA2 iGPU) on current `main` + this branch. Nothing goes from pass to fail. The new `d3d12_host_prefix` passes on both devices, and so do the three `d3d12_existing_heap` variants that failed on the iGPU before. - #1768 makes the same change in `create_host_buffer` without the staging, so it will be closed as a duplicate. - **Checked on `main` `446574e76` + `45219a640`:** it merges cleanly; the semantic suite passes (489 files, 6,288 tests, 0 files failed); the 14 docs and writer tests pass; `check_no_game_data.py` is clean on the 5 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.