mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
29 lines
841 B
C++
29 lines
841 B
C++
#include <mutex>
|
|
#include <set>
|
|
|
|
#include "Common/GPU/GPUBackendCommon.h"
|
|
|
|
// Global push buffer tracker for GPU memory profiling.
|
|
// Don't want to manually dig up all the active push buffers.
|
|
static std::mutex g_pushBufferListMutex;
|
|
static std::set<GPUMemoryManager *> g_pushBuffers;
|
|
|
|
std::vector<GPUMemoryManager *> GetActiveGPUMemoryManagers() {
|
|
std::vector<GPUMemoryManager *> buffers;
|
|
std::lock_guard<std::mutex> guard(g_pushBufferListMutex);
|
|
for (auto iter : g_pushBuffers) {
|
|
buffers.push_back(iter);
|
|
}
|
|
return buffers;
|
|
}
|
|
|
|
void RegisterGPUMemoryManager(GPUMemoryManager *manager) {
|
|
std::lock_guard<std::mutex> guard(g_pushBufferListMutex);
|
|
g_pushBuffers.insert(manager);
|
|
}
|
|
|
|
void UnregisterGPUMemoryManager(GPUMemoryManager *manager) {
|
|
std::lock_guard<std::mutex> guard(g_pushBufferListMutex);
|
|
g_pushBuffers.erase(manager);
|
|
}
|