[Mesa-dev] Dispatch table question: VBO
Rogovin, Kevin
kevin.rogovin at intel.com
Mon Sep 30 04:43:29 PDT 2013
Hi all,
I've been tracking through src/mesa/vbo and tracking down the dispatch stuff in relation to the stuff in src/mesa/vbo. I see how the function entries in vbo_context#exec and vbo_context#save are filled (by essentially macros defined in of src/mesa/vbo/vbo_attrib_tmp.h interacting with macros defined in src/mesa/vbo/vbo_save_api.c for save and src/mesa/vbo/vbo_exec_api.c for exec). I also see the functions in src/mesa/main:
_mesa_install_exec_vtxfmt
and
_mesa_install_save_vtxfmt
The save one is very simple, it just inserts the functions from vbo_context#save into the GL dispatch table gl_context#Save. What is trickier for me to follow is what is happening on exec. The function _mesa_install_exec_vtxfmt sets both gl_context#BeginEnd and gl_context#Exec table values to that which is in vbo_context#exec, but leaves gl_context#OutsideBeginEnd as is, i.e. nothing but no-op functions.
_A_ dispatch table is initialized as having no-ops for all functions and then is filled with _mesa_initialize_dispatch_tables(), which uses _mesa_initialize_exec_table() and _mesa_initialize_save_table(),
which populate gl_context#Exec and gl_context#Save respectively. However I dot not see anything that populates gl_context#OutsideBeginEnd (except for it's initialization of all no-op functions). This would be okay, but...
My confusion starts in vbo_exec_Begin():
ctx->Exec = ctx->BeginEnd;
/* We may have been called from a display list, in which case we should
* leave dlist.c's dispatch table in place.
*/
if (ctx->CurrentDispatch == ctx->OutsideBeginEnd) {
ctx->CurrentDispatch = ctx->BeginEnd;
_glapi_set_dispatch(ctx->CurrentDispatch);
} else {
assert(ctx->CurrentDispatch == ctx->Save);
}
and this block in vbo_exec_End():
ctx->Exec = ctx->OutsideBeginEnd;
if (ctx->CurrentDispatch == ctx->BeginEnd) {
ctx->CurrentDispatch = ctx->OutsideBeginEnd;
_glapi_set_dispatch(ctx->CurrentDispatch);
}
for i965, there is a chain of calls so that _mesa_install_exec_vtxfmt() is called at context creation,
which sets both Exec and BeginEnd (for compatibility profiles) to the value as found in vbo_context#exec. The initial value of CurrentDispatch is OutsideBeginEnd, atleast afaik set in _mesa_initialize_context(). Thus I see that after a glBegin, CurrentDispatch is set to BeginEnd and after glEnd(), CurrentDispatch is set to OutsideBeginEnd, which I cannot track down where it is populated with something besides no-op functions... what am I missing?
-Kevin
More information about the mesa-dev
mailing list