diff options
| author | Moriz82 <72836413+Moriz82@users.noreply.github.com> | 2026-11-25 03:44:31 -0600 |
|---|---|---|
| committer | Moriz82 <72836413+Moriz82@users.noreply.github.com> | 2026-11-25 03:44:43 -0600 |
| commit | ba626820ec54776fb0faffa2413727285befe85b (patch) | |
| tree | 95a99f8029785bec5f3b07b7efc4277e5bc7510b /runtime/shims/dstorage.cpp | |
| parent | 3de22a19047b168d28a7a11152bf05d18ed0062e (diff) | |
Integrate post-story-load memory, queue and Vulkan runtime changes
Preserve physical window aliases across remaps, order console list values,
and replay bounded indirect graphics with captured draw state. Coordinate
pipeline lifetime, texture refresh and queue teardown. Add synthetic CPU
and GPU coverage for the integrated paths.
Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-authored-by: ivanepsilondelta <264061546+ivanepsilondelta@users.noreply.github.com>
Diffstat (limited to 'runtime/shims/dstorage.cpp')
| -rw-r--r-- | runtime/shims/dstorage.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/runtime/shims/dstorage.cpp b/runtime/shims/dstorage.cpp index 7f4cef9d9..fe800fe68 100644 --- a/runtime/shims/dstorage.cpp +++ b/runtime/shims/dstorage.cpp | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #include "../src/shader_library.h" // leonida::zlib_inflate | 34 | #include "../src/shader_library.h" // leonida::zlib_inflate |
| 35 | #include "../src/title_page_watch.h" // title_gpu_views, title_texel_writes, kernel_writes | 35 | #include "../src/title_page_watch.h" // title_gpu_views, title_texel_writes, kernel_writes |
| 36 | #include "../src/bcpack.h" | 36 | #include "../src/bcpack.h" |
| 37 | #include "../src/guarded_copy.h" | ||
| 37 | #include "../src/shader_directory.h" | 38 | #include "../src/shader_directory.h" |
| 38 | #include "../src/dstorage_swizzle.h" | 39 | #include "../src/dstorage_swizzle.h" |
| 39 | #include "../src/dstorage_trace.h" | 40 | #include "../src/dstorage_trace.h" |
| @@ -405,10 +406,11 @@ File* live_file(IDStorageFileX* p) { | |||
| 405 | // ---- Reads -------------------------------------------------------------------------------------------------------- | 406 | // ---- Reads -------------------------------------------------------------------------------------------------------- |
| 406 | 407 | ||
| 407 | // memmove that turns an access violation into an error instead of ending the process. No C++ objects here: a | 408 | // memmove that turns an access violation into an error instead of ending the process. No C++ objects here: a |
| 408 | // function with __try cannot have any that need unwinding. | 409 | // function with __try cannot have any that need unwinding. The bytes move in leonida::guarded::move, not the CRT's |
| 410 | // memmove: under Wine a fault inside ucrtbase never reaches this __except (src/guarded_copy.h). | ||
| 409 | bool guarded_move(void* destination, const void* source, size_t size) { | 411 | bool guarded_move(void* destination, const void* source, size_t size) { |
| 410 | __try { | 412 | __try { |
| 411 | std::memmove(destination, source, size); | 413 | leonida::guarded::move(destination, source, size); |
| 412 | return true; | 414 | return true; |
| 413 | } __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER | 415 | } __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER |
| 414 | : EXCEPTION_CONTINUE_SEARCH) { | 416 | : EXCEPTION_CONTINUE_SEARCH) { |
| @@ -429,6 +431,14 @@ void touch_pages(void* buffer, size_t size) { | |||
| 429 | } | 431 | } |
| 430 | } | 432 | } |
| 431 | 433 | ||
| 434 | // A copy into a request's destination, title memory: through kernel_writes like the file reads into it, so a page the | ||
| 435 | // D3D12 layer keeps read-only (a slot-133 shadow's guard, a geometry tile's) is opened and pinned first, and the GPU | ||
| 436 | // copies of it take the bytes at the next submission. A copy that faults anyway is retried once after the range is | ||
| 437 | // reopened (title_page_watch.h); false only when it still faults. | ||
| 438 | bool title_write(void* destination, const void* source, size_t size) { | ||
| 439 | return leonida::kernel_writes::write(destination, source, size); | ||
| 440 | } | ||
| 441 | |||
| 432 | HRESULT read_error(DWORD error) { | 442 | HRESULT read_error(DWORD error) { |
| 433 | switch (error) { | 443 | switch (error) { |
| 434 | case ERROR_NOACCESS: | 444 | case ERROR_NOACCESS: |
| @@ -1042,7 +1052,7 @@ private: | |||
| 1042 | void* const destination = cpu_destination(r); | 1052 | void* const destination = cpu_destination(r); |
| 1043 | if (memory) { | 1053 | if (memory) { |
| 1044 | const auto begin = Timing::start(); | 1054 | const auto begin = Timing::start(); |
| 1045 | const auto hr = written(r, guarded_move(destination, r.Source, r.SourceSize) ? S_OK : E_DSTORAGE_ACCESS_VIOLATION); | 1055 | const auto hr = written(r, title_write(destination, r.Source, r.SourceSize) ? S_OK : E_DSTORAGE_ACCESS_VIOLATION); |
| 1046 | e.timing.copy = Timing::elapsed(begin); | 1056 | e.timing.copy = Timing::elapsed(begin); |
| 1047 | if (FAILED(hr)) e.reason = "copy"; | 1057 | if (FAILED(hr)) e.reason = "copy"; |
| 1048 | return hr; | 1058 | return hr; |
| @@ -1187,7 +1197,7 @@ private: | |||
| 1187 | e.reason = "destination-commit"; | 1197 | e.reason = "destination-commit"; |
| 1188 | return E_DSTORAGE_ACCESS_VIOLATION; | 1198 | return E_DSTORAGE_ACCESS_VIOLATION; |
| 1189 | } | 1199 | } |
| 1190 | hr = written(r, guarded_move(dest, data.data(), data.size()) ? S_OK : E_DSTORAGE_ACCESS_VIOLATION); | 1200 | hr = written(r, title_write(dest, data.data(), data.size()) ? S_OK : E_DSTORAGE_ACCESS_VIOLATION); |
| 1191 | } | 1201 | } |
| 1192 | e.timing.copy = Timing::elapsed(copy_begin); | 1202 | e.timing.copy = Timing::elapsed(copy_begin); |
| 1193 | if (FAILED(hr)) e.reason = "publish"; | 1203 | if (FAILED(hr)) e.reason = "publish"; |