CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Common/GPU/GPUBackendCommon.cpp
Views: 1401
1
#include <mutex>
2
#include <set>
3
4
#include "Common/GPU/GPUBackendCommon.h"
5
6
// Global push buffer tracker for GPU memory profiling.
7
// Don't want to manually dig up all the active push buffers.
8
static std::mutex g_pushBufferListMutex;
9
static std::set<GPUMemoryManager *> g_pushBuffers;
10
11
std::vector<GPUMemoryManager *> GetActiveGPUMemoryManagers() {
12
std::vector<GPUMemoryManager *> buffers;
13
std::lock_guard<std::mutex> guard(g_pushBufferListMutex);
14
for (auto iter : g_pushBuffers) {
15
buffers.push_back(iter);
16
}
17
return buffers;
18
}
19
20
void RegisterGPUMemoryManager(GPUMemoryManager *manager) {
21
std::lock_guard<std::mutex> guard(g_pushBufferListMutex);
22
g_pushBuffers.insert(manager);
23
}
24
25
void UnregisterGPUMemoryManager(GPUMemoryManager *manager) {
26
std::lock_guard<std::mutex> guard(g_pushBufferListMutex);
27
g_pushBuffers.erase(manager);
28
}
29
30