Skip to content

Commit

Permalink
Debug|libgui: Counting render buffer allocs
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 22, 2017
1 parent 700238d commit 4d7e547
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion doomsday/sdk/libgui/src/graphics/glframebuffer.cpp
Expand Up @@ -31,6 +31,8 @@ namespace de {
static Vector2ui const nullSize;
static GLuint defaultFramebuffer = 0;

static int rBufCounter;

DENG2_PIMPL(GLFramebuffer),
DENG2_OBSERVES(Asset, Deletion)
{
Expand Down Expand Up @@ -86,7 +88,6 @@ DENG2_OBSERVES(Asset, Deletion)
Vector4f clearColor;
Rectangleui activeRect; ///< Initially null.
int sampleCount;
//GLFramebuffer const *proxy;

Impl(Public *i)
: Base(i)
Expand Down Expand Up @@ -129,6 +130,7 @@ DENG2_OBSERVES(Asset, Deletion)
~Impl()
{
release();
qDebug() << "~GLFramebuffer:" << rBufCounter;
}

bool isDefault() const
Expand Down Expand Up @@ -210,6 +212,8 @@ DENG2_OBSERVES(Asset, Deletion)
GLInfo::EXT_framebuffer_object()->glBindRenderbufferEXT(GL_RENDERBUFFER, renderBufs[id]);
LIBGUI_ASSERT_GL_OK();

++rBufCounter;

if (sampleCount > 1)
{
if (GLInfo::extensions().NV_framebuffer_multisample_coverage)
Expand Down Expand Up @@ -316,6 +320,11 @@ DENG2_OBSERVES(Asset, Deletion)

void releaseRenderBuffers()
{
for (auto &rb : renderBufs)
{
if (rb) --rBufCounter;
}

GLInfo::EXT_framebuffer_object()->glDeleteRenderbuffersEXT(MAX_ATTACHMENTS, renderBufs);
zap(renderBufs);
zap(bufTextures);
Expand Down Expand Up @@ -350,6 +359,7 @@ DENG2_OBSERVES(Asset, Deletion)
{
GLInfo::EXT_framebuffer_object()->glDeleteRenderbuffersEXT(1, &renderBufs[id]);
renderBufs[id] = 0;
--rBufCounter;
}
}

Expand Down

0 comments on commit 4d7e547

Please sign in to comment.