[PR #2091] RT-MAP-READBACK-RANGE: skip GPU readback for write-only texture maps #2098

Open
opened 2026-11-26 21:20:01 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2091
Author: @lixonik
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/map-readback-range


📝 Commits (1)

  • 7ea8728 d3d12: skip placed texture readback for empty Map ranges

📊 Changes

3 files changed (+51 additions, -2 deletions)

View changed files

📝 runtime/CMakeLists.txt (+2 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+1 -1)
📝 runtime/test/d3d12_existing_heap_test.cpp (+48 -1)

📄 Description

Claimed as RT-MAP-READBACK-RANGE in the coordination thread.

With LEONIDA_MAP_READBACK=1, Map on an eligible title-placed texture could wait for a GPU copy and overwrite the CPU backing even when the caller declared it would read no bytes. Skip that copy when End <= Begin. A null range and a nonempty range still read back, as specified by ID3D12Resource::Map.

The new CTest uses a synthetic 1x1 RGBA32F render target and distinct CPU and GPU texels. It checks empty, inverted, nonempty and null ranges. The old implementation failed because the empty range overwrote the CPU texel. The fix passed all four cases and all five existing-heap/placement CTests on native Windows with a GeForce RTX 5070 and NVIDIA driver 610.88. The full translator semantic suite passed (491 files, 6,285 tests).

The reported retail exposure path was not exercised in this run.

AI-assisted.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2091 **Author:** [@lixonik](https://github.com/lixonik) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/map-readback-range` --- ### 📝 Commits (1) - [`7ea8728`](https://github.com/ubiquitarianism/leonida/commit/7ea8728b9ac2ba7bf51982e7040b5129361b8d8f) d3d12: skip placed texture readback for empty Map ranges ### 📊 Changes **3 files changed** (+51 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+2 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+1 -1) 📝 `runtime/test/d3d12_existing_heap_test.cpp` (+48 -1) </details> ### 📄 Description Claimed as `RT-MAP-READBACK-RANGE` in the [coordination thread](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7172880286). With `LEONIDA_MAP_READBACK=1`, `Map` on an eligible title-placed texture could wait for a GPU copy and overwrite the CPU backing even when the caller declared it would read no bytes. Skip that copy when `End <= Begin`. A null range and a nonempty range still read back, as specified by [ID3D12Resource::Map](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12resource-map). The new CTest uses a synthetic 1x1 RGBA32F render target and distinct CPU and GPU texels. It checks empty, inverted, nonempty and null ranges. The old implementation failed because the empty range overwrote the CPU texel. The fix passed all four cases and all five existing-heap/placement CTests on native Windows with a GeForce RTX 5070 and NVIDIA driver 610.88. The full translator semantic suite passed (491 files, 6,285 tests). The [reported retail exposure path](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7167966834) was not exercised in this run. AI-assisted. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#2098
No description provided.