Add a function to dump the info for all attribute arrays.

This commit is contained in:
Bill Currie 2011-12-28 14:27:59 +09:00
parent 411ab8f359
commit 4e7af5c3e0
2 changed files with 36 additions and 0 deletions

View file

@ -43,5 +43,6 @@ void GL_EndRendering (void);
int GL_CompileShader (const char *name, const char *shader_src, int type); int GL_CompileShader (const char *name, const char *shader_src, int type);
int GL_LinkProgram (const char *name, int vert, int frag); int GL_LinkProgram (const char *name, int vert, int frag);
int GL_ResolveShaderParam (int program, shaderparam_t *param); int GL_ResolveShaderParam (int program, shaderparam_t *param);
void GL_DumpAttribArrays (void);
#endif // __QF_GLSL_vid_h #endif // __QF_GLSL_vid_h

View file

@ -336,3 +336,38 @@ GL_ResolveShaderParam (int program, shaderparam_t *param)
} }
return param->location; 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, &current);
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);
}
}