_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);
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);
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);
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);
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);
/* 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);
* 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);
/* 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);
/* 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);
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);
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);
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);
(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);
/* 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);
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);
}
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 */
-}
-