mesa: Initially populate the display list with the exec list.

This cuts out a ton of code to make functions not set to a save_ variant
match.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Eric Anholt 2013-01-17 16:39:27 -08:00
parent 7820e2dd8d
commit ab4c549378
11 changed files with 7 additions and 283 deletions

View File

@ -9570,6 +9570,13 @@ void
_mesa_initialize_save_table(const struct gl_context *ctx)
{
struct _glapi_table *table = ctx->Save;
int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
/* Initially populate the dispatch table with the contents of the
* normal-execution dispatch table. This lets us skip populating functions
* that should be called directly instead of compiled into display lists.
*/
memcpy(table, ctx->Exec, numEntries * sizeof(_glapi_proc));
_mesa_loopback_init_api_table(ctx, table);
@ -9592,7 +9599,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_ColorMaterial(table, save_ColorMaterial);
SET_CopyPixels(table, save_CopyPixels);
SET_CullFace(table, save_CullFace);
SET_DeleteLists(table, _mesa_DeleteLists);
SET_DepthFunc(table, save_DepthFunc);
SET_DepthMask(table, save_DepthMask);
SET_DepthRange(table, save_DepthRange);
@ -9602,7 +9608,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_DrawPixels(table, save_DrawPixels);
SET_Enable(table, save_Enable);
SET_Enablei(table, save_EnableIndexed);
SET_EndList(table, _mesa_EndList);
SET_EvalMesh1(table, save_EvalMesh1);
SET_EvalMesh2(table, save_EvalMesh2);
SET_Finish(table, exec_Finish);
@ -9613,7 +9618,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_Fogiv(table, save_Fogiv);
SET_FrontFace(table, save_FrontFace);
SET_Frustum(table, save_Frustum);
SET_GenLists(table, _mesa_GenLists);
SET_GetBooleanv(table, exec_GetBooleanv);
SET_GetClipPlane(table, exec_GetClipPlane);
SET_GetDoublev(table, exec_GetDoublev);
@ -9646,7 +9650,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_IndexMask(table, save_IndexMask);
SET_InitNames(table, save_InitNames);
SET_IsEnabled(table, exec_IsEnabled);
SET_IsList(table, _mesa_IsList);
SET_LightModelf(table, save_LightModelf);
SET_LightModelfv(table, save_LightModelfv);
SET_LightModeli(table, save_LightModeli);
@ -9886,9 +9889,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
/* 173. GL_EXT_blend_func_separate */
SET_BlendFuncSeparate(table, save_BlendFuncSeparateEXT);
/* 196. GL_MESA_resize_buffers */
SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA);
/* 197. GL_MESA_window_pos */
SET_WindowPos2d(table, save_WindowPos2dMESA);
SET_WindowPos2dv(table, save_WindowPos2dvMESA);
@ -9925,9 +9925,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
* VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
*/
SET_BindProgramARB(table, save_BindProgramNV);
SET_DeleteProgramsARB(table, _mesa_DeleteProgramsARB);
SET_GenProgramsARB(table, _mesa_GenProgramsARB);
SET_IsProgramARB(table, _mesa_IsProgramARB);
/* 244. GL_ATI_envmap_bumpmap */
SET_TexBumpParameterivATI(table, save_TexBumpParameterivATI);
@ -9944,34 +9941,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
/* 268. GL_EXT_stencil_two_side */
SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
/* 273. GL_APPLE_vertex_array_object */
SET_BindVertexArrayAPPLE(table, _mesa_BindVertexArrayAPPLE);
SET_DeleteVertexArrays(table, _mesa_DeleteVertexArrays);
SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE);
SET_IsVertexArray(table, _mesa_IsVertexArray);
/* 310. GL_EXT_framebuffer_object */
SET_GenFramebuffers(table, _mesa_GenFramebuffers);
SET_BindFramebuffer(table, _mesa_BindFramebuffer);
SET_DeleteFramebuffers(table, _mesa_DeleteFramebuffers);
SET_CheckFramebufferStatus(table, _mesa_CheckFramebufferStatus);
SET_GenRenderbuffers(table, _mesa_GenRenderbuffers);
SET_BindRenderbuffer(table, _mesa_BindRenderbuffer);
SET_DeleteRenderbuffers(table, _mesa_DeleteRenderbuffers);
SET_RenderbufferStorage(table, _mesa_RenderbufferStorage);
SET_FramebufferTexture1D(table, _mesa_FramebufferTexture1D);
SET_FramebufferTexture2D(table, _mesa_FramebufferTexture2D);
SET_FramebufferTexture3D(table, _mesa_FramebufferTexture3D);
SET_FramebufferRenderbuffer(table, _mesa_FramebufferRenderbuffer);
SET_GenerateMipmap(table, _mesa_GenerateMipmap);
/* 317. GL_EXT_framebuffer_multisample */
SET_RenderbufferStorageMultisample(table, _mesa_RenderbufferStorageMultisample);
/* GL_ARB_vertex_array_object */
SET_BindVertexArray(table, _mesa_BindVertexArray);
SET_GenVertexArrays(table, _mesa_GenVertexArrays);
/* ???. GL_EXT_depth_bounds_test */
SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
@ -10006,18 +9975,8 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
/* ARB 26. GL_ARB_vertex_program */
/* ARB 27. GL_ARB_fragment_program */
/* glVertexAttrib* functions alias the NV ones, handled elsewhere */
SET_VertexAttribPointer(table, _mesa_VertexAttribPointer);
SET_EnableVertexAttribArray(table, _mesa_EnableVertexAttribArray);
SET_DisableVertexAttribArray(table, _mesa_DisableVertexAttribArray);
SET_ProgramStringARB(table, save_ProgramStringARB);
SET_BindProgramARB(table, save_BindProgramNV);
SET_DeleteProgramsARB(table, _mesa_DeleteProgramsARB);
SET_GenProgramsARB(table, _mesa_GenProgramsARB);
SET_IsProgramARB(table, _mesa_IsProgramARB);
SET_GetVertexAttribdv(table, _mesa_GetVertexAttribdv);
SET_GetVertexAttribfv(table, _mesa_GetVertexAttribfv);
SET_GetVertexAttribiv(table, _mesa_GetVertexAttribiv);
SET_GetVertexAttribPointerv(table, _mesa_GetVertexAttribPointerv);
SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
@ -10026,30 +9985,7 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB);
SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB);
SET_GetProgramLocalParameterdvARB(table,
_mesa_GetProgramLocalParameterdvARB);
SET_GetProgramLocalParameterfvARB(table,
_mesa_GetProgramLocalParameterfvARB);
SET_GetProgramivARB(table, _mesa_GetProgramivARB);
SET_GetProgramStringARB(table, _mesa_GetProgramStringARB);
/* ARB 28. GL_ARB_vertex_buffer_object */
/* None of the extension's functions get compiled */
SET_BindBuffer(table, _mesa_BindBuffer);
SET_BufferData(table, _mesa_BufferData);
SET_BufferSubData(table, _mesa_BufferSubData);
SET_DeleteBuffers(table, _mesa_DeleteBuffers);
SET_GenBuffers(table, _mesa_GenBuffers);
SET_GetBufferParameteriv(table, _mesa_GetBufferParameteriv);
SET_GetBufferPointerv(table, _mesa_GetBufferPointerv);
SET_GetBufferSubData(table, _mesa_GetBufferSubData);
SET_IsBuffer(table, _mesa_IsBuffer);
SET_MapBuffer(table, _mesa_MapBuffer);
SET_UnmapBuffer(table, _mesa_UnmapBuffer);
_mesa_init_queryobj_dispatch(ctx, table); /* glGetQuery, etc */
SET_BeginQuery(table, save_BeginQueryARB);
SET_EndQuery(table, save_EndQueryARB);
SET_QueryCounter(table, save_QueryCounter);
@ -10058,8 +9994,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
/* GL_ARB_shader_objects */
_mesa_init_shader_dispatch(ctx, table); /* Plug in glCreate/Delete/Get, etc */
SET_UseProgram(table, save_UseProgramObjectARB);
SET_Uniform1f(table, save_Uniform1fARB);
SET_Uniform2f(table, save_Uniform2fARB);
@ -10100,24 +10034,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
/* ARB 50. GL_ARB_map_buffer_range */
SET_MapBufferRange(table, _mesa_MapBufferRange); /* no dlist save */
SET_FlushMappedBufferRange(table, _mesa_FlushMappedBufferRange); /* no dl */
/* ARB 51. GL_ARB_texture_buffer_object */
SET_TexBuffer(table, _mesa_TexBuffer); /* no dlist save */
/* ARB 59. GL_ARB_copy_buffer */
SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */
/* 364. GL_EXT_provoking_vertex */
SET_ProvokingVertex(table, save_ProvokingVertexEXT);
/* 371. GL_APPLE_object_purgeable */
SET_ObjectPurgeableAPPLE(table, _mesa_ObjectPurgeableAPPLE);
SET_ObjectUnpurgeableAPPLE(table, _mesa_ObjectUnpurgeableAPPLE);
SET_GetObjectParameterivAPPLE(table, _mesa_GetObjectParameterivAPPLE);
/* GL_EXT_texture_integer */
SET_ClearColorIiEXT(table, save_ClearColorIi);
SET_ClearColorIuiEXT(table, save_ClearColorIui);
@ -10158,11 +10077,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
(void) save_Uniform4uiv;
#endif
/* These are not compiled into display lists: */
SET_BindBufferBase(table, _mesa_BindBufferBase);
SET_BindBufferOffsetEXT(table, _mesa_BindBufferOffsetEXT);
SET_BindBufferRange(table, _mesa_BindBufferRange);
SET_TransformFeedbackVaryings(table, _mesa_TransformFeedbackVaryings);
/* These are: */
SET_BeginTransformFeedback(table, save_BeginTransformFeedback);
SET_EndTransformFeedback(table, save_EndTransformFeedback);
@ -10184,8 +10098,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
/* GL_NV_texture_barrier */
SET_TextureBarrierNV(table, save_TextureBarrierNV);
/* GL_ARB_sampler_objects */
_mesa_init_sampler_object_dispatch(ctx, table); /* plug in Gen/Get/etc functions */
SET_BindSampler(table, save_BindSampler);
SET_SamplerParameteri(table, save_SamplerParameteri);
SET_SamplerParameterf(table, save_SamplerParameterf);
@ -10210,25 +10122,10 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_EndConditionalRender(table, save_EndConditionalRender);
/* GL_ARB_sync */
_mesa_init_sync_dispatch(table);
SET_WaitSync(table, save_WaitSync);
/* GL_ARB_texture_storage (no dlist support) */
SET_TexStorage1D(table, _mesa_TexStorage1D);
SET_TexStorage2D(table, _mesa_TexStorage2D);
SET_TexStorage3D(table, _mesa_TexStorage3D);
SET_TextureStorage1DEXT(table, _mesa_TextureStorage1DEXT);
SET_TextureStorage2DEXT(table, _mesa_TextureStorage2DEXT);
SET_TextureStorage3DEXT(table, _mesa_TextureStorage3DEXT);
/* GL_ARB_debug_output (no dlist support) */
_mesa_init_errors_dispatch(table);
/* GL_ARB_uniform_buffer_object */
SET_UniformBlockBinding(table, save_UniformBlockBinding);
/* GL_NV_primitive_restart */
SET_PrimitiveRestartIndex(table, _mesa_PrimitiveRestartIndex);
}

View File

@ -725,15 +725,6 @@ _mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, const GLvoid *userParam)
ctx->Debug.CallbackData = (void *) userParam;
}
void
_mesa_init_errors_dispatch(struct _glapi_table *disp)
{
SET_DebugMessageCallbackARB(disp, _mesa_DebugMessageCallbackARB);
SET_DebugMessageControlARB(disp, _mesa_DebugMessageControlARB);
SET_DebugMessageInsertARB(disp, _mesa_DebugMessageInsertARB);
SET_GetDebugMessageLogARB(disp, _mesa_GetDebugMessageLogARB);
}
void
_mesa_init_errors(struct gl_context *ctx)
{

View File

@ -47,9 +47,6 @@ extern "C" {
struct _glapi_table;
struct gl_context;
extern void
_mesa_init_errors_dispatch(struct _glapi_table *disp);
extern void
_mesa_init_errors( struct gl_context *ctx );

View File

@ -753,33 +753,6 @@ _mesa_GetQueryObjectui64v(GLuint id, GLenum pname, GLuint64EXT *params)
}
}
void
_mesa_init_queryobj_dispatch(const struct gl_context *ctx,
struct _glapi_table *disp)
{
SET_GenQueries(disp, _mesa_GenQueries);
SET_DeleteQueries(disp, _mesa_DeleteQueries);
SET_IsQuery(disp, _mesa_IsQuery);
SET_BeginQuery(disp, _mesa_BeginQuery);
SET_EndQuery(disp, _mesa_EndQuery);
SET_GetQueryiv(disp, _mesa_GetQueryiv);
SET_GetQueryObjectuiv(disp, _mesa_GetQueryObjectuiv);
if (_mesa_is_desktop_gl(ctx)) {
SET_GetQueryObjectiv(disp, _mesa_GetQueryObjectiv);
SET_QueryCounter(disp, _mesa_QueryCounter);
SET_GetQueryObjecti64v(disp, _mesa_GetQueryObjecti64v);
SET_GetQueryObjectui64v(disp, _mesa_GetQueryObjectui64v);
SET_BeginQueryIndexed(disp, _mesa_BeginQueryIndexed);
SET_EndQueryIndexed(disp, _mesa_EndQueryIndexed);
SET_GetQueryIndexediv(disp, _mesa_GetQueryIndexediv);
}
}
/**
* Allocate/init the context state related to query objects.
*/

View File

@ -43,10 +43,6 @@ _mesa_lookup_query_object(struct gl_context *ctx, GLuint id)
extern void
_mesa_init_query_object_functions(struct dd_function_table *driver);
extern void
_mesa_init_queryobj_dispatch(const struct gl_context *ctx,
struct _glapi_table *disp);
extern void
_mesa_init_queryobj(struct gl_context *ctx);

View File

@ -1434,27 +1434,3 @@ _mesa_init_sampler_object_functions(struct dd_function_table *driver)
driver->NewSamplerObject = _mesa_new_sampler_object;
driver->DeleteSamplerObject = _mesa_delete_sampler_object;
}
void
_mesa_init_sampler_object_dispatch(const struct gl_context *ctx,
struct _glapi_table *disp)
{
SET_GenSamplers(disp, _mesa_GenSamplers);
SET_DeleteSamplers(disp, _mesa_DeleteSamplers);
SET_IsSampler(disp, _mesa_IsSampler);
SET_BindSampler(disp, _mesa_BindSampler);
SET_SamplerParameteri(disp, _mesa_SamplerParameteri);
SET_SamplerParameterf(disp, _mesa_SamplerParameterf);
SET_SamplerParameteriv(disp, _mesa_SamplerParameteriv);
SET_SamplerParameterfv(disp, _mesa_SamplerParameterfv);
SET_GetSamplerParameteriv(disp, _mesa_GetSamplerParameteriv);
SET_GetSamplerParameterfv(disp, _mesa_GetSamplerParameterfv);
if (_mesa_is_desktop_gl(ctx)) {
SET_SamplerParameterIiv(disp, _mesa_SamplerParameterIiv);
SET_SamplerParameterIuiv(disp, _mesa_SamplerParameterIuiv);
SET_GetSamplerParameterIiv(disp, _mesa_GetSamplerParameterIiv);
SET_GetSamplerParameterIuiv(disp, _mesa_GetSamplerParameterIuiv);
}
}

View File

@ -69,10 +69,6 @@ _mesa_new_sampler_object(struct gl_context *ctx, GLuint name);
extern void
_mesa_init_sampler_object_functions(struct dd_function_table *driver);
extern void
_mesa_init_sampler_object_dispatch(const struct gl_context *ctx,
struct _glapi_table *disp);
void GLAPIENTRY
_mesa_GenSamplers(GLsizei count, GLuint *samplers);
void GLAPIENTRY

View File

@ -1789,84 +1789,3 @@ _mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string)
return program;
}
/**
* Plug in shader-related functions into API dispatch table.
*/
void
_mesa_init_shader_dispatch(const struct gl_context *ctx,
struct _glapi_table *exec)
{
#if FEATURE_GL
/* GL_ARB_vertex/fragment_shader */
if (_mesa_is_desktop_gl(ctx)) {
SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);
SET_GetHandleARB(exec, _mesa_GetHandleARB);
SET_DetachObjectARB(exec, _mesa_DetachObjectARB);
SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB);
SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB);
SET_AttachObjectARB(exec, _mesa_AttachObjectARB);
SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB);
SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB);
SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB);
SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);
}
if (ctx->API != API_OPENGLES) {
SET_ShaderSource(exec, _mesa_ShaderSource);
SET_CompileShader(exec, _mesa_CompileShader);
SET_LinkProgram(exec, _mesa_LinkProgram);
SET_UseProgram(exec, _mesa_UseProgram);
SET_ValidateProgram(exec, _mesa_ValidateProgram);
SET_GetShaderSource(exec, _mesa_GetShaderSource);
/* OpenGL 2.0 */
SET_AttachShader(exec, _mesa_AttachShader);
SET_CreateProgram(exec, _mesa_CreateProgram);
SET_CreateShader(exec, _mesa_CreateShader);
SET_DeleteProgram(exec, _mesa_DeleteProgram);
SET_DeleteShader(exec, _mesa_DeleteShader);
SET_DetachShader(exec, _mesa_DetachShader);
SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders);
SET_GetProgramiv(exec, _mesa_GetProgramiv);
SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog);
SET_GetShaderiv(exec, _mesa_GetShaderiv);
SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog);
SET_IsProgram(exec, _mesa_IsProgram);
SET_IsShader(exec, _mesa_IsShader);
/* GL_ARB_vertex_shader */
SET_BindAttribLocation(exec, _mesa_BindAttribLocation);
SET_GetActiveAttrib(exec, _mesa_GetActiveAttrib);
SET_GetAttribLocation(exec, _mesa_GetAttribLocation);
}
if (ctx->API == API_OPENGL_COMPAT) {
SET_UseShaderProgramEXT(exec, _mesa_UseShaderProgramEXT);
SET_ActiveProgramEXT(exec, _mesa_ActiveProgramEXT);
SET_CreateShaderProgramEXT(exec, _mesa_CreateShaderProgramEXT);
}
/* GL_EXT_gpu_shader4 / GL 3.0 */
if (_mesa_is_desktop_gl(ctx)) {
SET_BindFragDataLocation(exec, _mesa_BindFragDataLocation);
}
if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
SET_GetFragDataLocation(exec, _mesa_GetFragDataLocation);
}
/* GL_ARB_ES2_compatibility */
if (ctx->API != API_OPENGLES) {
SET_ReleaseShaderCompiler(exec, _mesa_ReleaseShaderCompiler);
SET_GetShaderPrecisionFormat(exec, _mesa_GetShaderPrecisionFormat);
SET_ShaderBinary(exec, _mesa_ShaderBinary);
}
/* GL_ARB_blend_func_extended */
if (_mesa_is_desktop_gl(ctx)) {
SET_BindFragDataLocationIndexed(exec, _mesa_BindFragDataLocationIndexed);
SET_GetFragDataIndex(exec, _mesa_GetFragDataIndex);
}
#endif /* FEATURE_GL */
}

View File

@ -50,10 +50,6 @@ extern void
_mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg,
const char *caller);
extern void
_mesa_init_shader_dispatch(const struct gl_context *ctx,
struct _glapi_table *exec);
extern unsigned
_mesa_count_active_attribs(struct gl_shader_program *shProg);

View File

@ -141,20 +141,6 @@ _mesa_init_sync_object_functions(struct dd_function_table *driver)
driver->ServerWaitSync = _mesa_wait_sync;
}
void
_mesa_init_sync_dispatch(struct _glapi_table *disp)
{
SET_IsSync(disp, _mesa_IsSync);
SET_DeleteSync(disp, _mesa_DeleteSync);
SET_FenceSync(disp, _mesa_FenceSync);
SET_ClientWaitSync(disp, _mesa_ClientWaitSync);
SET_WaitSync(disp, _mesa_WaitSync);
SET_GetInteger64v(disp, _mesa_GetInteger64v);
SET_GetSynciv(disp, _mesa_GetSynciv);
}
/**
* Allocate/init the context state related to sync objects.
*/

View File

@ -42,9 +42,6 @@ struct gl_sync_object;
extern void
_mesa_init_sync_object_functions(struct dd_function_table *driver);
extern void
_mesa_init_sync_dispatch(struct _glapi_table *disp);
extern void
_mesa_init_sync(struct gl_context *);