+/**
+ * Dump a GL_KHR_debug object label.
+ */
+void
+dumpObjectLabel(JSONWriter &json, Context &context, GLenum identifier, GLuint name)
+{
+ if (!name) {
+ return;
+ }
+
+ if (!context.KHR_debug) {
+ return;
+ }
+
+ GLsizei length = 0;
+ glGetObjectLabel(identifier, name, 0, &length, NULL);
+ if (!length) {
+ return;
+ }
+
+ char *label = (char *)malloc(length);
+ if (!label) {
+ return;
+ }
+
+ glGetObjectLabel(identifier, name, length, NULL, label);
+
+ json.writeStringMember("GL_OBJECT_LABEL", label);
+
+ free(label);
+}
+
+