diff options
| author | tedin7 <tommasoderosa94@gmail.com> | 2026-11-23 17:46:16 +0100 |
|---|---|---|
| committer | tedin7 <tommasoderosa94@gmail.com> | 2026-11-23 17:46:16 +0100 |
| commit | 1d8d1d355d9b37ac1fb88103433f88d2d0975a52 (patch) | |
| tree | db3fd6a4e0d1391f90fd3d055789c883bb8717ed /runtime/src | |
| parent | 9c8522d224291c094af14e1e10b7e40f418e3ed0 (diff) | |
d3d12_xs: slot 70 takes its buffer reference under the registry lock and asks for a buffer that holds the whole width (review of the raw view)
AI-assisted.
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/vulkan_backend.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h index bbf6936bc..5977ebe8d 100644 --- a/runtime/src/vulkan_backend.h +++ b/runtime/src/vulkan_backend.h | |||
| @@ -1287,12 +1287,17 @@ public: | |||
| 1287 | return resources_.find(id) != resources_.end(); | 1287 | return resources_.find(id) != resources_.end(); |
| 1288 | } | 1288 | } |
| 1289 | 1289 | ||
| 1290 | // The registered buffer whose VA range holds `va`: its ID, first VA and size in bytes. False when none does (the | 1290 | // The registered buffer whose VA range holds `va`, preferring one that holds [va, va + bytes) as buffer_at does: its |
| 1291 | // same index buffer_at searches). Used where a console call names a buffer by VA only (Xbox device slot 70). | 1291 | // ID, first VA and size in bytes. False when none does, or when `acquire(id)` returns false. `acquire` runs with |
| 1292 | bool buffer_resource_at(std::uint64_t va, ResourceId& id, std::uint64_t& start, std::uint64_t& size) { | 1292 | // the registry locked, so the resource cannot finish being removed under it: it takes the caller's reference |
| 1293 | // (Resource's destructor removes its entry first, which waits for this lock). Used where a console call names a | ||
| 1294 | // buffer by VA only (Xbox device slot 70). | ||
| 1295 | template<class Acquire> | ||
| 1296 | bool buffer_resource_at(std::uint64_t va, std::uint64_t bytes, ResourceId& id, std::uint64_t& start, | ||
| 1297 | std::uint64_t& size, Acquire&& acquire) { | ||
| 1293 | std::shared_lock lock(resource_mutex_); | 1298 | std::shared_lock lock(resource_mutex_); |
| 1294 | BufferVaIndex<ResourceId>::Hit hit{}; | 1299 | BufferVaIndex<ResourceId>::Hit hit{}; |
| 1295 | if (!buffer_vas_.find(va, hit)) return false; | 1300 | if (!buffer_vas_.find(va, hit, bytes) || !acquire(hit.id)) return false; |
| 1296 | id = hit.id; | 1301 | id = hit.id; |
| 1297 | start = hit.start; | 1302 | start = hit.start; |
| 1298 | size = hit.size; | 1303 | size = hit.size; |