10 #define Eegeo_LOG_VIDEO_MEMORY_STATS
12 #if defined(Eegeo_LOG_VIDEO_MEMORY_STATS)
13 #define Eegeo_TEXTURE_MEMORY_ADD(textureID, internalFormat, width, height, faceCount, isMipped) \
14 Eegeo::VideoMemoryMonitor::Get().AddTexture((textureID), Eegeo::VideoMemoryMonitor::EstimateGLTextureSize((internalFormat), (width), (height), (faceCount), (isMipped)))
15 #define Eegeo_TEXTURE_MEMORY_REMOVE(textureID) \
16 Eegeo::VideoMemoryMonitor::Get().RemoveTexture((textureID))
18 #define Eegeo_BUFFER_MEMORY_ADD(bufferID, bufferSize) \
19 Eegeo::VideoMemoryMonitor::Get().AddBuffer((bufferID), (bufferSize))
20 #define Eegeo_BUFFER_MEMORY_REMOVE(bufferID) \
21 Eegeo::VideoMemoryMonitor::Get().RemoveBuffer((bufferID))
25 #define Eegeo_TEXTURE_MEMORY_ADD(textureID, internalFormat, width, height, faceCount, isMipped)
26 #define Eegeo_TEXTURE_MEMORY_REMOVE(textureID)
28 #define Eegeo_BUFFER_MEMORY_ADD(bufferID, bufferSize)
29 #define Eegeo_BUFFER_MEMORY_REMOVE(bufferID)
40 void AddNameWithUsage(uint32_t name,
size_t usage)
44 if (m_namesToUsage.find(name) == m_namesToUsage.end())
46 m_namesToUsage.insert(std::make_pair(name, usage));
50 m_namesToUsage[name] = usage;
54 void RemoveName(uint32_t name)
57 m_namesToUsage.erase(name);
60 size_t GetCount()
const
63 return m_namesToUsage.size();
66 size_t GetTotal()
const
71 for (std::map<uint32_t, size_t>::const_iterator it = m_namesToUsage.begin(); it != m_namesToUsage.end(); ++it)
82 std::map<uint32_t, size_t> m_namesToUsage;
89 void AddTexture(uint32_t texture,
size_t size);
90 void RemoveTexture(uint32_t texture);
92 void AddBuffer(uint32_t buffer,
size_t size);
93 void RemoveBuffer(uint32_t buffer);
101 std::string GenerateReport();
103 size_t GetBufferByteCount()
const {
return m_buffers.GetTotal(); }
104 size_t GetBufferCount()
const {
return m_buffers.GetCount(); }
105 size_t GetTextureByteCount()
const {
return m_textures.GetTotal(); }
106 size_t GetTextureCount()
const {
return m_textures.GetCount(); }
108 static size_t EstimateGLTextureSize(
int internalFormat, uint32_t width, uint32_t height, uint32_t faceCount,
bool isMipped);
112 static size_t GetBitsPerTexelBlock(
int internalFormat,
int &blockWidthInTexels,
int &blockHeightInTexels);