From: Brian Paul Date: Thu, 27 May 2010 15:24:43 +0000 (-0600) Subject: vbo: update/add comments X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b6187057be07a9652e807e2cfab872eb410c1fa7;p=mesa.git vbo: update/add comments --- diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index d4dbc8d2562..775645ffee9 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -40,7 +40,8 @@ /** - * Compute min and max elements for glDraw[Range]Elements() calls. + * Compute min and max elements by scanning the index buffer for + * glDraw[Range]Elements() calls. */ void vbo_get_minmax_index(GLcontext *ctx, @@ -112,6 +113,7 @@ vbo_get_minmax_index(GLcontext *ctx, /** * Check that element 'j' of the array has reasonable data. * Map VBO if needed. + * For debugging purposes; not normally used. */ static void check_array_data(GLcontext *ctx, struct gl_client_array *array, @@ -172,6 +174,7 @@ unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array) /** * Examine the array's data for NaNs, etc. + * For debug purposes; not normally used. */ static void check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType, @@ -249,7 +252,7 @@ check_draw_arrays_data(GLcontext *ctx, GLint start, GLsizei count) /** - * Print info/data for glDrawArrays(). + * Print info/data for glDrawArrays(), for debugging. */ static void print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec, @@ -295,6 +298,9 @@ print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec, /** + * Bind the VBO executor to the current vertex array object prior + * to drawing. + * * Just translate the arrayobj into a sane layout. */ static void @@ -334,6 +340,14 @@ bind_array_obj(GLcontext *ctx) } +/** + * Set the vbo->exec->inputs[] pointers to point to the enabled + * vertex arrays. This depends on the current vertex program/shader + * being executed because of whether or not generic vertex arrays + * alias the conventional vertex arrays. + * For arrays that aren't enabled, we set the input[attrib] pointer + * to point at a zero-stride current value "array". + */ static void recalculate_input_bindings(GLcontext *ctx) { @@ -470,10 +484,9 @@ bind_arrays(GLcontext *ctx) -/*********************************************************************** - * API functions. +/** + * Called from glDrawArrays when in immediate mode (not display list mode). */ - static void GLAPIENTRY vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) { @@ -533,6 +546,10 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) } +/** + * Called from glDrawArraysInstanced when in immediate mode (not + * display list mode). + */ static void GLAPIENTRY vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count, GLsizei primcount) @@ -591,6 +608,7 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count, /** * Map GL_ELEMENT_ARRAY_BUFFER and print contents. + * For debugging. */ static void dump_element_buffer(GLcontext *ctx, GLenum type) @@ -645,7 +663,11 @@ dump_element_buffer(GLcontext *ctx, GLenum type) } -/* Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */ +/** + * Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements. + * Do the rendering for a glDrawElements or glDrawRangeElements call after + * we've validated buffer bounds, etc. + */ static void vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode, GLboolean index_bounds_valid, @@ -722,6 +744,10 @@ vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode, index_bounds_valid, start, end ); } + +/** + * Called by glDrawRangeElementsBaseVertex() in immediate mode. + */ static void GLAPIENTRY vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, @@ -831,6 +857,9 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, } +/** + * Called by glDrawRangeElements() in immediate mode. + */ static void GLAPIENTRY vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) @@ -848,6 +877,9 @@ vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end, } +/** + * Called by glDrawElements() in immediate mode. + */ static void GLAPIENTRY vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) @@ -867,6 +899,9 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, } +/** + * Called by glDrawElementsBaseVertex() in immediate mode. + */ static void GLAPIENTRY vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) @@ -887,6 +922,9 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, } +/** + * Called by glDrawElementsInstanced() in immediate mode. + */ static void GLAPIENTRY vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount) @@ -907,7 +945,11 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, } -/** Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */ +/** + * Inner support for both _mesa_MultiDrawElements() and + * _mesa_MultiDrawRangeElements(). + * This does the actual rendering after we've checked array indexes, etc. + */ static void vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode, const GLsizei *count, GLenum type, @@ -939,7 +981,8 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode, } /* Decide if we can do this all as one set of primitives sharing the - * same index buffer, or if we have to reset the index pointer per primitive. + * same index buffer, or if we have to reset the index pointer per + * primitive. */ bind_arrays( ctx ); @@ -1089,10 +1132,10 @@ vbo_exec_MultiDrawElementsBaseVertex(GLenum mode, } -/*********************************************************************** - * Initialization +/** + * Plug in the immediate-mode vertex array drawing commands into the + * givven vbo_exec_context object. */ - void vbo_exec_array_init( struct vbo_exec_context *exec ) { @@ -1125,7 +1168,13 @@ vbo_exec_array_destroy( struct vbo_exec_context *exec ) } -/* This API entrypoint is not ordinarily used */ + +/** + * The following functions are only used for OpenGL ES 1/2 support. + * And some aren't even supported (yet) in ES 1/2. + */ + + void GLAPIENTRY _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count) { @@ -1133,7 +1182,6 @@ _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count) } -/* This API entrypoint is not ordinarily used */ void GLAPIENTRY _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) @@ -1141,6 +1189,7 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, vbo_exec_DrawElements(mode, count, type, indices); } + void GLAPIENTRY _mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) @@ -1149,7 +1198,6 @@ _mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, } -/* This API entrypoint is not ordinarily used */ void GLAPIENTRY _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) @@ -1168,7 +1216,6 @@ _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, } -/* GL_EXT_multi_draw_arrays */ void GLAPIENTRY _mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)