summaryrefslogtreecommitdiff
path: root/retrace/glstate.cpp
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2013-10-09 18:40:14 -0700
committerJosé Fonseca <jfonseca@vmware.com>2013-10-09 18:40:14 -0700
commit17f8a32687c040c652e6d018100bab08bb0487bd (patch)
treec5be52071eb65d10255c82a050abff2702998428 /retrace/glstate.cpp
parent9d9eb81d94075181c360d4712b9fd3baa58d5782 (diff)
glstate: Dump a few object labels.
Diffstat (limited to 'retrace/glstate.cpp')
-rw-r--r--retrace/glstate.cpp50
1 files changed, 44 insertions, 6 deletions
diff --git a/retrace/glstate.cpp b/retrace/glstate.cpp
index a07b7f6a..3a65d20a 100644
--- a/retrace/glstate.cpp
+++ b/retrace/glstate.cpp
@@ -77,17 +77,22 @@ Context::Context(void) {
glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
for (GLint i = 0; i < num_extensions; ++i) {
const char *extension = (const char *)glGetStringi(GL_EXTENSIONS, i);
- if (extension &&
- strcmp(extension, "ARB_sampler_objects")) {
- ARB_sampler_objects = true;
+ if (extension) {
+ if (strcmp(extension, "GL_ARB_sampler_objects") == 0) {
+ ARB_sampler_objects = true;
+ } else if (strcmp(extension, "GL_KHR_debug") == 0) {
+ KHR_debug = true;
+ }
}
}
} else {
const char *extensions = (const char *)glGetString(GL_EXTENSIONS);
- if (glws::checkExtension("ARB_sampler_objects", extensions)) {
- ARB_sampler_objects = true;
- }
+ ARB_sampler_objects = glws::checkExtension("GL_ARB_sampler_objects", extensions);
+ KHR_debug = glws::checkExtension("GL_KHR_debug", extensions);
}
+ } else {
+ const char *extensions = (const char *)glGetString(GL_EXTENSIONS);
+ KHR_debug = glws::checkExtension("GL_KHR_debug", extensions);
}
}
@@ -147,6 +152,39 @@ Context::restorePixelPackState(void) {
}
+/**
+ * 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);
+}
+
+
static const GLenum bindings[] = {
GL_DRAW_BUFFER,
GL_READ_BUFFER,