aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/bufferobj.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-04-13 11:42:04 +0200
committermarha <marha@users.sourceforge.net>2012-04-13 11:42:04 +0200
commitd2d4fd66a0c1fca50d07fce3f383d6a84a57f09a (patch)
treeb50ae20ca22bc564b145906d6c84395285933859 /mesalib/src/mesa/main/bufferobj.c
parent120bd371deb2b73a0bae5ce331511e4ea27bcff2 (diff)
parentfffd436e9c2ec6f5aa501ee57d0e4ade7293ee60 (diff)
downloadvcxsrv-d2d4fd66a0c1fca50d07fce3f383d6a84a57f09a.tar.gz
vcxsrv-d2d4fd66a0c1fca50d07fce3f383d6a84a57f09a.tar.bz2
vcxsrv-d2d4fd66a0c1fca50d07fce3f383d6a84a57f09a.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/main/bufferobj.c')
-rw-r--r--mesalib/src/mesa/main/bufferobj.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index ada42c515..33aa3b7dc 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -347,6 +347,36 @@ _mesa_initialize_buffer_object( struct gl_context *ctx,
}
+
+/**
+ * Callback called from _mesa_HashWalk()
+ */
+static void
+count_buffer_size(GLuint key, void *data, void *userData)
+{
+ const struct gl_buffer_object *bufObj =
+ (const struct gl_buffer_object *) data;
+ GLuint *total = (GLuint *) userData;
+
+ *total = *total + bufObj->Size;
+}
+
+
+/**
+ * Compute total size (in bytes) of all buffer objects for the given context.
+ * For debugging purposes.
+ */
+GLuint
+_mesa_total_buffer_object_memory(struct gl_context *ctx)
+{
+ GLuint total = 0;
+
+ _mesa_HashWalk(ctx->Shared->BufferObjects, count_buffer_size, &total);
+
+ return total;
+}
+
+
/**
* Allocate space for and store data in a buffer object. Any data that was
* previously stored in the buffer object is lost. If \c data is \c NULL,