video_core/memory_manager: Add a const qualified variant of GetPointer()
Allows retrieving read-only pointers from a const context externally.
This commit is contained in:
parent
085b388a7a
commit
34510bcda8
|
@ -180,8 +180,22 @@ u8* MemoryManager::GetPointer(GPUVAddr addr) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
u8* page_pointer{page_table.pointers[addr >> page_bits]};
|
u8* const page_pointer{page_table.pointers[addr >> page_bits]};
|
||||||
if (page_pointer) {
|
if (page_pointer != nullptr) {
|
||||||
|
return page_pointer + (addr & page_mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ERROR(HW_GPU, "Unknown GetPointer @ 0x{:016X}", addr);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const u8* MemoryManager::GetPointer(GPUVAddr addr) const {
|
||||||
|
if (!IsAddressValid(addr)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const u8* const page_pointer{page_table.pointers[addr >> page_bits]};
|
||||||
|
if (page_pointer != nullptr) {
|
||||||
return page_pointer + (addr & page_mask);
|
return page_pointer + (addr & page_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ public:
|
||||||
void Write(GPUVAddr addr, T data);
|
void Write(GPUVAddr addr, T data);
|
||||||
|
|
||||||
u8* GetPointer(GPUVAddr addr);
|
u8* GetPointer(GPUVAddr addr);
|
||||||
|
const u8* GetPointer(GPUVAddr addr) const;
|
||||||
|
|
||||||
void ReadBlock(GPUVAddr src_addr, void* dest_buffer, std::size_t size);
|
void ReadBlock(GPUVAddr src_addr, void* dest_buffer, std::size_t size);
|
||||||
void WriteBlock(GPUVAddr dest_addr, const void* src_buffer, std::size_t size);
|
void WriteBlock(GPUVAddr dest_addr, const void* src_buffer, std::size_t size);
|
||||||
|
|
Loading…
Reference in a new issue