Improve error handling in graphics memory init

This commit is contained in:
Herman S.
2025-10-08 09:11:26 +09:00
parent 337afcf318
commit 1e23aaf4fc
4 changed files with 14 additions and 4 deletions

View File

@@ -23,7 +23,7 @@ SharedMemory::SharedMemory(Memory& memory) : memory_(memory) {
SharedMemory::~SharedMemory() { ShutdownCommon(); }
void SharedMemory::InitializeCommon() {
bool SharedMemory::InitializeCommon() {
size_t num_system_page_flags_entries =
((kBufferSize >> page_size_log2_) + 63) / 64;
num_system_page_flags_ = static_cast<uint32_t>(num_system_page_flags_entries);
@@ -36,6 +36,11 @@ void SharedMemory::InitializeCommon() {
nullptr, num_system_page_flags_ * 3 * sizeof(uint64_t),
memory::AllocationType::kReserveCommit, memory::PageAccess::kReadWrite);
if (!system_page_flags_base) {
XELOGE("SharedMemory: Failed to allocate system page flags");
return false;
}
system_page_flags_valid_ = system_page_flags_base,
system_page_flags_valid_and_gpu_resolved_ =
system_page_flags_base + (num_system_page_flags_),
@@ -49,6 +54,7 @@ void SharedMemory::InitializeCommon() {
memory_invalidation_callback_handle_ =
memory_.RegisterPhysicalMemoryInvalidationCallback(
MemoryInvalidationCallbackThunk, this);
return true;
}
void SharedMemory::InitializeSparseHostGpuMemory(uint32_t granularity_log2) {