renderer_vulkan: Import host memory for screenshots (#7132)

This commit is contained in:
Wunk 2023-11-12 13:02:55 -08:00 committed by GitHub
parent 23ca10472a
commit 831c9c4a38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 254 additions and 21 deletions

View file

@ -8,12 +8,11 @@
#include <sysinfoapi.h>
#else
#include <sys/types.h>
#include <unistd.h>
#if defined(__APPLE__) || defined(__FreeBSD__)
#include <sys/sysctl.h>
#elif defined(__linux__)
#include <sys/sysinfo.h>
#else
#include <unistd.h>
#endif
#endif
@ -64,4 +63,14 @@ const MemoryInfo GetMemInfo() {
return mem_info;
}
u64 GetPageSize() {
#ifdef _WIN32
SYSTEM_INFO info;
::GetSystemInfo(&info);
return static_cast<u64>(info.dwPageSize);
#else
return static_cast<u64>(sysconf(_SC_PAGESIZE));
#endif
}
} // namespace Common

View file

@ -19,4 +19,10 @@ struct MemoryInfo {
*/
[[nodiscard]] const MemoryInfo GetMemInfo();
/**
* Gets the page size of the host system
* @return Page size in bytes of the host system
*/
u64 GetPageSize();
} // namespace Common