📄 state.c
字号:
/*
* Mesa 3-D graphics library
* Version: 6.4
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file state.c
* State management.
*
* This file manages recalculation of derived values in the __GLcontextRec.
* Also, this is where we initialize the API dispatch table.
*/
#include "glheader.h"
#include "accum.h"
#include "api_loopback.h"
#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
#include "arbprogram.h"
#endif
#if FEATURE_ATI_fragment_shader
#include "atifragshader.h"
#endif
#include "attrib.h"
#include "blend.h"
#if FEATURE_ARB_vertex_buffer_object
#include "bufferobj.h"
#endif
#include "buffers.h"
#include "clip.h"
#include "colortab.h"
#include "context.h"
#include "convolve.h"
#include "depth.h"
#include "dlist.h"
#include "drawpix.h"
#include "enable.h"
#include "eval.h"
#include "get.h"
#include "feedback.h"
#include "fog.h"
#if FEATURE_EXT_framebuffer_object
#include "fbobject.h"
#endif
#include "framebuffer.h"
#include "hint.h"
#include "histogram.h"
#include "imports.h"
#include "light.h"
#include "lines.h"
#include "macros.h"
#include "matrix.h"
#if FEATURE_ARB_occlusion_query
#include "occlude.h"
#endif
#include "pixel.h"
#include "points.h"
#include "polygon.h"
#include "rastpos.h"
#include "state.h"
#include "stencil.h"
#include "teximage.h"
#include "texobj.h"
#include "texstate.h"
#include "mtypes.h"
#include "varray.h"
#if FEATURE_NV_vertex_program
#include "nvprogram.h"
#endif
#if FEATURE_NV_fragment_program
#include "nvfragprog.h"
#include "nvprogram.h"
#include "program.h"
#include "texenvprogram.h"
#endif
#if FEATURE_ARB_shader_objects
#include "shaderobjects.h"
#endif
#include "debug.h"
#include "dispatch.h"
/**
* Initialize a dispatch table with pointers to Mesa's immediate-mode
* commands.
*
* Pointers to glBegin()/glEnd() object commands and a few others
* are provided via the GLvertexformat interface.
*
* \param ctx GL context to which \c exec belongs.
* \param exec dispatch table.
*/
void
_mesa_init_exec_table(struct _glapi_table *exec)
{
#if _HAVE_FULL_GL
_mesa_loopback_init_api_table( exec );
#endif
/* load the dispatch slots we understand */
SET_AlphaFunc(exec, _mesa_AlphaFunc);
SET_BlendFunc(exec, _mesa_BlendFunc);
SET_Clear(exec, _mesa_Clear);
SET_ClearColor(exec, _mesa_ClearColor);
SET_ClearStencil(exec, _mesa_ClearStencil);
SET_ColorMask(exec, _mesa_ColorMask);
SET_CullFace(exec, _mesa_CullFace);
SET_Disable(exec, _mesa_Disable);
SET_DrawBuffer(exec, _mesa_DrawBuffer);
SET_Enable(exec, _mesa_Enable);
SET_Finish(exec, _mesa_Finish);
SET_Flush(exec, _mesa_Flush);
SET_FrontFace(exec, _mesa_FrontFace);
SET_Frustum(exec, _mesa_Frustum);
SET_GetError(exec, _mesa_GetError);
SET_GetFloatv(exec, _mesa_GetFloatv);
SET_GetString(exec, _mesa_GetString);
SET_InitNames(exec, _mesa_InitNames);
SET_LineStipple(exec, _mesa_LineStipple);
SET_LineWidth(exec, _mesa_LineWidth);
SET_LoadIdentity(exec, _mesa_LoadIdentity);
SET_LoadMatrixf(exec, _mesa_LoadMatrixf);
SET_LoadName(exec, _mesa_LoadName);
SET_LogicOp(exec, _mesa_LogicOp);
SET_MatrixMode(exec, _mesa_MatrixMode);
SET_MultMatrixf(exec, _mesa_MultMatrixf);
SET_Ortho(exec, _mesa_Ortho);
SET_PixelStorei(exec, _mesa_PixelStorei);
SET_PopMatrix(exec, _mesa_PopMatrix);
SET_PopName(exec, _mesa_PopName);
SET_PushMatrix(exec, _mesa_PushMatrix);
SET_PushName(exec, _mesa_PushName);
SET_RasterPos2f(exec, _mesa_RasterPos2f);
SET_RasterPos2fv(exec, _mesa_RasterPos2fv);
SET_RasterPos2i(exec, _mesa_RasterPos2i);
SET_RasterPos2iv(exec, _mesa_RasterPos2iv);
SET_ReadBuffer(exec, _mesa_ReadBuffer);
SET_RenderMode(exec, _mesa_RenderMode);
SET_Rotatef(exec, _mesa_Rotatef);
SET_Scalef(exec, _mesa_Scalef);
SET_Scissor(exec, _mesa_Scissor);
SET_SelectBuffer(exec, _mesa_SelectBuffer);
SET_ShadeModel(exec, _mesa_ShadeModel);
SET_StencilFunc(exec, _mesa_StencilFunc);
SET_StencilMask(exec, _mesa_StencilMask);
SET_StencilOp(exec, _mesa_StencilOp);
SET_TexEnvfv(exec, _mesa_TexEnvfv);
SET_TexEnvi(exec, _mesa_TexEnvi);
SET_TexImage2D(exec, _mesa_TexImage2D);
SET_TexParameteri(exec, _mesa_TexParameteri);
SET_Translatef(exec, _mesa_Translatef);
SET_Viewport(exec, _mesa_Viewport);
#if _HAVE_FULL_GL
SET_Accum(exec, _mesa_Accum);
SET_Bitmap(exec, _mesa_Bitmap);
SET_CallList(exec, _mesa_CallList);
SET_CallLists(exec, _mesa_CallLists);
SET_ClearAccum(exec, _mesa_ClearAccum);
SET_ClearDepth(exec, _mesa_ClearDepth);
SET_ClearIndex(exec, _mesa_ClearIndex);
SET_ClipPlane(exec, _mesa_ClipPlane);
SET_ColorMaterial(exec, _mesa_ColorMaterial);
SET_CopyPixels(exec, _mesa_CopyPixels);
SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT);
SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT);
SET_DeleteLists(exec, _mesa_DeleteLists);
SET_DepthFunc(exec, _mesa_DepthFunc);
SET_DepthMask(exec, _mesa_DepthMask);
SET_DepthRange(exec, _mesa_DepthRange);
SET_DrawPixels(exec, _mesa_DrawPixels);
SET_EndList(exec, _mesa_EndList);
SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer);
SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
SET_Fogf(exec, _mesa_Fogf);
SET_Fogfv(exec, _mesa_Fogfv);
SET_Fogi(exec, _mesa_Fogi);
SET_Fogiv(exec, _mesa_Fogiv);
SET_GenLists(exec, _mesa_GenLists);
SET_GetClipPlane(exec, _mesa_GetClipPlane);
SET_GetBooleanv(exec, _mesa_GetBooleanv);
SET_GetDoublev(exec, _mesa_GetDoublev);
SET_GetIntegerv(exec, _mesa_GetIntegerv);
SET_GetLightfv(exec, _mesa_GetLightfv);
SET_GetLightiv(exec, _mesa_GetLightiv);
SET_GetMapdv(exec, _mesa_GetMapdv);
SET_GetMapfv(exec, _mesa_GetMapfv);
SET_GetMapiv(exec, _mesa_GetMapiv);
SET_GetMaterialfv(exec, _mesa_GetMaterialfv);
SET_GetMaterialiv(exec, _mesa_GetMaterialiv);
SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv);
SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv);
SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv);
SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple);
SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv);
SET_GetTexEnviv(exec, _mesa_GetTexEnviv);
SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv);
SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
SET_GetTexGendv(exec, _mesa_GetTexGendv);
SET_GetTexGenfv(exec, _mesa_GetTexGenfv);
SET_GetTexGeniv(exec, _mesa_GetTexGeniv);
SET_GetTexImage(exec, _mesa_GetTexImage);
SET_Hint(exec, _mesa_Hint);
SET_IndexMask(exec, _mesa_IndexMask);
SET_IsEnabled(exec, _mesa_IsEnabled);
SET_IsList(exec, _mesa_IsList);
SET_LightModelf(exec, _mesa_LightModelf);
SET_LightModelfv(exec, _mesa_LightModelfv);
SET_LightModeli(exec, _mesa_LightModeli);
SET_LightModeliv(exec, _mesa_LightModeliv);
SET_Lightf(exec, _mesa_Lightf);
SET_Lightfv(exec, _mesa_Lightfv);
SET_Lighti(exec, _mesa_Lighti);
SET_Lightiv(exec, _mesa_Lightiv);
SET_ListBase(exec, _mesa_ListBase);
SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
SET_Map1d(exec, _mesa_Map1d);
SET_Map1f(exec, _mesa_Map1f);
SET_Map2d(exec, _mesa_Map2d);
SET_Map2f(exec, _mesa_Map2f);
SET_MapGrid1d(exec, _mesa_MapGrid1d);
SET_MapGrid1f(exec, _mesa_MapGrid1f);
SET_MapGrid2d(exec, _mesa_MapGrid2d);
SET_MapGrid2f(exec, _mesa_MapGrid2f);
SET_MultMatrixd(exec, _mesa_MultMatrixd);
SET_NewList(exec, _mesa_NewList);
SET_PassThrough(exec, _mesa_PassThrough);
SET_PixelMapfv(exec, _mesa_PixelMapfv);
SET_PixelMapuiv(exec, _mesa_PixelMapuiv);
SET_PixelMapusv(exec, _mesa_PixelMapusv);
SET_PixelStoref(exec, _mesa_PixelStoref);
SET_PixelTransferf(exec, _mesa_PixelTransferf);
SET_PixelTransferi(exec, _mesa_PixelTransferi);
SET_PixelZoom(exec, _mesa_PixelZoom);
SET_PointSize(exec, _mesa_PointSize);
SET_PolygonMode(exec, _mesa_PolygonMode);
SET_PolygonOffset(exec, _mesa_PolygonOffset);
SET_PolygonStipple(exec, _mesa_PolygonStipple);
SET_PopAttrib(exec, _mesa_PopAttrib);
SET_PushAttrib(exec, _mesa_PushAttrib);
SET_RasterPos2d(exec, _mesa_RasterPos2d);
SET_RasterPos2dv(exec, _mesa_RasterPos2dv);
SET_RasterPos2s(exec, _mesa_RasterPos2s);
SET_RasterPos2sv(exec, _mesa_RasterPos2sv);
SET_RasterPos3d(exec, _mesa_RasterPos3d);
SET_RasterPos3dv(exec, _mesa_RasterPos3dv);
SET_RasterPos3f(exec, _mesa_RasterPos3f);
SET_RasterPos3fv(exec, _mesa_RasterPos3fv);
SET_RasterPos3i(exec, _mesa_RasterPos3i);
SET_RasterPos3iv(exec, _mesa_RasterPos3iv);
SET_RasterPos3s(exec, _mesa_RasterPos3s);
SET_RasterPos3sv(exec, _mesa_RasterPos3sv);
SET_RasterPos4d(exec, _mesa_RasterPos4d);
SET_RasterPos4dv(exec, _mesa_RasterPos4dv);
SET_RasterPos4f(exec, _mesa_RasterPos4f);
SET_RasterPos4fv(exec, _mesa_RasterPos4fv);
SET_RasterPos4i(exec, _mesa_RasterPos4i);
SET_RasterPos4iv(exec, _mesa_RasterPos4iv);
SET_RasterPos4s(exec, _mesa_RasterPos4s);
SET_RasterPos4sv(exec, _mesa_RasterPos4sv);
SET_ReadPixels(exec, _mesa_ReadPixels);
SET_Rotated(exec, _mesa_Rotated);
SET_Scaled(exec, _mesa_Scaled);
SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT);
SET_TexEnvf(exec, _mesa_TexEnvf);
SET_TexEnviv(exec, _mesa_TexEnviv);
SET_TexGend(exec, _mesa_TexGend);
SET_TexGendv(exec, _mesa_TexGendv);
SET_TexGenf(exec, _mesa_TexGenf);
SET_TexGenfv(exec, _mesa_TexGenfv);
SET_TexGeni(exec, _mesa_TexGeni);
SET_TexGeniv(exec, _mesa_TexGeniv);
SET_TexImage1D(exec, _mesa_TexImage1D);
SET_TexParameterf(exec, _mesa_TexParameterf);
SET_TexParameterfv(exec, _mesa_TexParameterfv);
SET_TexParameteriv(exec, _mesa_TexParameteriv);
SET_Translated(exec, _mesa_Translated);
#endif
/* 1.1 */
SET_BindTexture(exec, _mesa_BindTexture);
SET_DeleteTextures(exec, _mesa_DeleteTextures);
SET_GenTextures(exec, _mesa_GenTextures);
#if _HAVE_FULL_GL
SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
SET_AreTexturesResidentEXT(exec, _mesa_AreTexturesResident);
SET_ColorPointer(exec, _mesa_ColorPointer);
SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D);
SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D);
SET_DisableClientState(exec, _mesa_DisableClientState);
SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer);
SET_EnableClientState(exec, _mesa_EnableClientState);
SET_GenTexturesEXT(exec, _mesa_GenTextures);
SET_GetPointerv(exec, _mesa_GetPointerv);
SET_IndexPointer(exec, _mesa_IndexPointer);
SET_InterleavedArrays(exec, _mesa_InterleavedArrays);
SET_IsTexture(exec, _mesa_IsTexture);
SET_IsTextureEXT(exec, _mesa_IsTexture);
SET_NormalPointer(exec, _mesa_NormalPointer);
SET_PopClientAttrib(exec, _mesa_PopClientAttrib);
SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
SET_PushClientAttrib(exec, _mesa_PushClientAttrib);
SET_TexCoordPointer(exec, _mesa_TexCoordPointer);
SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
SET_VertexPointer(exec, _mesa_VertexPointer);
#endif
/* 1.2 */
#if _HAVE_FULL_GL
SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D);
SET_TexImage3D(exec, _mesa_TexImage3D);
SET_TexSubImage3D(exec, _mesa_TexSubImage3D);
#endif
/* OpenGL 1.2 GL_ARB_imaging */
#if _HAVE_FULL_GL
SET_BlendColor(exec, _mesa_BlendColor);
SET_BlendEquation(exec, _mesa_BlendEquation);
SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);
SET_ColorSubTable(exec, _mesa_ColorSubTable);
SET_ColorTable(exec, _mesa_ColorTable);
SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv);
SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -