upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorNolan Cotter <186326284+NolanCotter@users.noreply.github.com>2026-11-22 17:05:02 -0700
committerNolan Cotter <186326284+NolanCotter@users.noreply.github.com>2026-11-22 17:05:48 -0700
commit6e81f46bbcf6964e892f235adf6a8724fcceecc9 (patch)
treeb9821a74c6bdf9b1dc6f009fda2a59f78cecdbc1 /runtime
parent2de9fce57c92ea6a121b45fdc6886273d394a0f1 (diff)
shims: translate the two VAs of each stream-output view
SOSetTargets (console 49) carries BufferLocation and BufferFilledSizeLocation, both GPU VAs; both now translate through the upload arena in the proxy's scratch copy. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/shims/d3d12_xs_device.cpp15
-rw-r--r--runtime/test/xs_proxy_mock_test.cpp4
2 files changed, 19 insertions, 0 deletions
diff --git a/runtime/shims/d3d12_xs_device.cpp b/runtime/shims/d3d12_xs_device.cpp
index 7a86f8f8e..1255a9906 100644
--- a/runtime/shims/d3d12_xs_device.cpp
+++ b/runtime/shims/d3d12_xs_device.cpp
@@ -1192,6 +1192,7 @@ struct ListProxy {
1192 std::atomic<unsigned long> refs; // past the console body 1192 std::atomic<unsigned long> refs; // past the console body
1193 unsigned pc_slot_count; // slots the real list implements; mapped slots past it are refused 1193 unsigned pc_slot_count; // slots the real list implements; mapped slots past it are refused
1194 std::vector<D3D12_VERTEX_BUFFER_VIEW> vb_scratch; // slot-48 views with their VAs translated 1194 std::vector<D3D12_VERTEX_BUFFER_VIEW> vb_scratch; // slot-48 views with their VAs translated
1195 std::vector<D3D12_STREAM_OUTPUT_BUFFER_VIEW> so_scratch; // slot-49 views, same treatment
1195 1196
1196 void pin_cursor_at_limit() { 1197 void pin_cursor_at_limit() {
1197 const std::uint64_t at_limit = static_cast<std::uint64_t>( 1198 const std::uint64_t at_limit = static_cast<std::uint64_t>(
@@ -1359,6 +1360,20 @@ std::uint64_t WINAPI list_slot(ListProxy* self, std::uint64_t a1, std::uint64_t
1359 self->real, a1, a2, reinterpret_cast<std::uint64_t>(self->vb_scratch.data()), a4, a5, 1360 self->real, a1, a2, reinterpret_cast<std::uint64_t>(self->vb_scratch.data()), a4, a5,
1360 a6, a7, a8, a9, a10, a11, a12, a13, a14); 1361 a6, a7, a8, a9, a10, a11, a12, a13, a14);
1361 } 1362 }
1363 } else if constexpr (Slot == 49) {
1364 // SOSetTargets(start, count, views): BufferLocation and BufferFilledSizeLocation are both VAs.
1365 if (a3 && a2) {
1366 const auto* in = reinterpret_cast<const D3D12_STREAM_OUTPUT_BUFFER_VIEW*>(a3);
1367 self->so_scratch.assign(in, in + a2);
1368 for (auto& view : self->so_scratch) {
1369 view.BufferLocation = upload_translate(self->device, view.BufferLocation);
1370 view.BufferFilledSizeLocation =
1371 upload_translate(self->device, view.BufferFilledSizeLocation);
1372 }
1373 return reinterpret_cast<ForwardFn>(real_vtable[pc])(
1374 self->real, a1, a2, reinterpret_cast<std::uint64_t>(self->so_scratch.data()), a4, a5,
1375 a6, a7, a8, a9, a10, a11, a12, a13, a14);
1376 }
1362 } else if constexpr (Slot == kConsoleSetDescriptorHeaps) { 1377 } else if constexpr (Slot == kConsoleSetDescriptorHeaps) {
1363 UnwrappedArray heaps; 1378 UnwrappedArray heaps;
1364 if (!heaps.fill(a2, a1)) return 0; // void on the PC side; the call simply does not happen 1379 if (!heaps.fill(a2, a1)) return 0; // void on the PC side; the call simply does not happen
diff --git a/runtime/test/xs_proxy_mock_test.cpp b/runtime/test/xs_proxy_mock_test.cpp
index f2ae346c9..c77b9e8af 100644
--- a/runtime/test/xs_proxy_mock_test.cpp
+++ b/runtime/test/xs_proxy_mock_test.cpp
@@ -710,6 +710,10 @@ int check_lists() {
710 vb_views[0].BufferLocation = p1; 710 vb_views[0].BufferLocation = p1;
711 vb_views[1].BufferLocation = 0xDEAD0000; // a VA outside the arena passes through 711 vb_views[1].BufferLocation = 0xDEAD0000; // a VA outside the arena passes through
712 EXPECT(hr_of(raw(list, 48, 0, 2, word(vb_views))) == S_OK && real->calls[44] == 1); 712 EXPECT(hr_of(raw(list, 48, 0, 2, word(vb_views))) == S_OK && real->calls[44] == 1);
713 D3D12_STREAM_OUTPUT_BUFFER_VIEW so_view{};
714 so_view.BufferLocation = p1;
715 so_view.BufferFilledSizeLocation = p2;
716 EXPECT(hr_of(raw(list, 49, 0, 1, word(&so_view))) == S_OK && real->calls[45] == 1);
713 // The console tail past the PC chain is refused with E_NOTIMPL only when the mapped PC slot is missing. 717 // The console tail past the PC chain is refused with E_NOTIMPL only when the mapped PC slot is missing.
714 EXPECT(hr_of(raw(list, 146, word(list), 0)) == S_OK && real->calls[80] == 1); // enhanced Barrier -> GCL7 80 718 EXPECT(hr_of(raw(list, 146, word(list), 0)) == S_OK && real->calls[80] == 1); // enhanced Barrier -> GCL7 80
715 EXPECT(release(list) == 0 && real->refs == 0); 719 EXPECT(release(list) == 0 && real->refs == 0);