Add buffer logging

This commit is contained in:
Jack Andersen 2017-11-01 23:37:50 -10:00
parent 10364557b9
commit 4615641a12
1 changed files with 4 additions and 2 deletions

View File

@ -110,13 +110,14 @@ class GLGraphicsBufferS : public IGraphicsBufferS
GLGraphicsBufferS(IGraphicsData* parent, BufferUse use, const void* data, size_t sz)
: IGraphicsBufferS(parent)
{
Log.report(logvisor::Info, "Create static buffer %p\n", this);
m_target = USE_TABLE[int(use)];
glGenBuffers(1, &m_buf);
glBindBuffer(m_target, m_buf);
glBufferData(m_target, sz, data, GL_STATIC_DRAW);
}
public:
~GLGraphicsBufferS() {glDeleteBuffers(1, &m_buf);}
~GLGraphicsBufferS() {glDeleteBuffers(1, &m_buf); Log.report(logvisor::Info, "Delete static buffer %p\n", this); }
void bindVertex() const
{glBindBuffer(GL_ARRAY_BUFFER, m_buf);}
@ -142,6 +143,7 @@ class GLGraphicsBufferD : public IGraphicsBufferD
: boo::IGraphicsBufferD(parent),
m_target(USE_TABLE[int(use)]), m_cpuBuf(new uint8_t[sz]), m_cpuSz(sz)
{
Log.report(logvisor::Info, "Create dynamic buffer %p\n", this);
glGenBuffers(3, m_bufs);
for (int i=0 ; i<3 ; ++i)
{
@ -151,7 +153,7 @@ class GLGraphicsBufferD : public IGraphicsBufferD
}
void update(int b);
public:
~GLGraphicsBufferD() {glDeleteBuffers(3, m_bufs);}
~GLGraphicsBufferD() {glDeleteBuffers(3, m_bufs); Log.report(logvisor::Info, "Delete dynamic buffer %p\n", this);}
void load(const void* data, size_t sz);
void* map(size_t sz);