From 4e7af5c3e0995a737a64fad8ed841b24e8f58f13 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 28 Dec 2011 14:27:59 +0900 Subject: [PATCH] Add a function to dump the info for all attribute arrays. --- include/QF/GLSL/qf_vid.h | 1 + libs/video/targets/vid_common_glsl.c | 35 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/QF/GLSL/qf_vid.h b/include/QF/GLSL/qf_vid.h index c731315eb..a6feb89f5 100644 --- a/include/QF/GLSL/qf_vid.h +++ b/include/QF/GLSL/qf_vid.h @@ -43,5 +43,6 @@ void GL_EndRendering (void); int GL_CompileShader (const char *name, const char *shader_src, int type); int GL_LinkProgram (const char *name, int vert, int frag); int GL_ResolveShaderParam (int program, shaderparam_t *param); +void GL_DumpAttribArrays (void); #endif // __QF_GLSL_vid_h diff --git a/libs/video/targets/vid_common_glsl.c b/libs/video/targets/vid_common_glsl.c index 0c32bf283..6a2a2ac10 100644 --- a/libs/video/targets/vid_common_glsl.c +++ b/libs/video/targets/vid_common_glsl.c @@ -336,3 +336,38 @@ GL_ResolveShaderParam (int program, shaderparam_t *param) } return param->location; } + +void +GL_DumpAttribArrays (void) +{ + GLint max = 0; + GLint ind; + GLint enabled; + GLint size = -1; + GLint stride = -1; + GLint type = -1; + GLint norm = -1; + GLint binding = -1; + GLint current = -1; + void *pointer = 0; + + qfglGetIntegerv (GL_MAX_VERTEX_ATTRIBS, &max); + + for (ind = 0; ind < max; ind++) { + qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &enabled); + if (!enabled) + continue; + Sys_Printf ("attrib %d: %sabled\n", ind, enabled ? "en" : "dis"); + qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_SIZE, &size); + qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &stride); + qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_TYPE, &type); + qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &norm); + qfglGetVertexAttribiv (ind, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, + &binding); + qfglGetVertexAttribiv (ind, GL_CURRENT_VERTEX_ATTRIB, ¤t); + qfglGetVertexAttribPointerv (ind, GL_VERTEX_ATTRIB_ARRAY_POINTER, + &pointer); + Sys_Printf (" %d %d '%s' %d %d %d %p\n", size, stride, + type_name (type), norm, binding, current, pointer); + } +}