[GPU] Check if memory page is available while copying data

This commit is contained in:
Gliniak 2023-03-11 16:20:01 +01:00
parent eb5da8e557
commit 23bd18cfca
1 changed files with 15 additions and 0 deletions

View File

@ -435,6 +435,21 @@ bool D3D12SharedMemory::UploadRanges(
MakeRangeValid(upload_range_start << page_size_log2(),
uint32_t(upload_buffer_size), false, false);
// Handling for certain games that crashes due to accessing unallocated
// pages. It's usually happens with base_page that is completely different
// that any previously used ones. It always is completely not allocated.
// Additionally these requests are usually quite small 1-2 pages.
memory::PageAccess page_access =
memory().GetPhysicalHeap()->QueryRangeAccess(
upload_range_start << page_size_log2(),
(upload_range_start << page_size_log2()) +
(uint32_t)1); // Check only first page
if (page_access == xe::memory::PageAccess::kNoAccess) {
XELOGE("Invalid upload range for GPU: {:08X}", upload_range_start);
return false;
}
if (upload_buffer_size < (1ULL << 32) && upload_buffer_size > 8192) {
memory::vastcpy(
upload_buffer_mapping,