⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 state.c

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 C
📖 第 1 页 / 共 4 页
字号:
   /* glVertexAttrib4uivARB handled in api_loopback.c */   /* glVertexAttrib4NbvARB handled in api_loopback.c */   /* glVertexAttrib4NsvARB handled in api_loopback.c */   /* glVertexAttrib4NivARB handled in api_loopback.c */   /* glVertexAttrib4NusvARB handled in api_loopback.c */   /* glVertexAttrib4NuivARB handled in api_loopback.c */   SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB);   SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB);   SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB);   SET_ProgramStringARB(exec, _mesa_ProgramStringARB);   /* glBindProgramARB aliases glBindProgramNV */   /* glDeleteProgramsARB aliases glDeleteProgramsNV */   /* glGenProgramsARB aliases glGenProgramsNV */   /* glIsProgramARB aliases glIsProgramNV */   SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB);   SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB);   SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB);   /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */   SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB);   SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB);   SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB);   SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB);   SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);   SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);   SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);   SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);   SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB);   SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB);   SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);   SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);   SET_GetProgramivARB(exec, _mesa_GetProgramivARB);   SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB);#endif   /* ARB 28. GL_ARB_vertex_buffer_object */#if FEATURE_ARB_vertex_buffer_object   SET_BindBufferARB(exec, _mesa_BindBufferARB);   SET_BufferDataARB(exec, _mesa_BufferDataARB);   SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB);   SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB);   SET_GenBuffersARB(exec, _mesa_GenBuffersARB);   SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB);   SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB);   SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB);   SET_IsBufferARB(exec, _mesa_IsBufferARB);   SET_MapBufferARB(exec, _mesa_MapBufferARB);   SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB);#endif   /* ARB 29. GL_ARB_occlusion_query */#if FEATURE_ARB_occlusion_query   SET_GenQueriesARB(exec, _mesa_GenQueriesARB);   SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB);   SET_IsQueryARB(exec, _mesa_IsQueryARB);   SET_BeginQueryARB(exec, _mesa_BeginQueryARB);   SET_EndQueryARB(exec, _mesa_EndQueryARB);   SET_GetQueryivARB(exec, _mesa_GetQueryivARB);   SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB);   SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB);#endif   /* ARB 37. GL_ARB_draw_buffers */   SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB);   #if FEATURE_ARB_shader_objects   SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);   SET_GetHandleARB(exec, _mesa_GetHandleARB);   SET_DetachObjectARB(exec, _mesa_DetachObjectARB);   SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB);   SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB);   SET_CompileShaderARB(exec, _mesa_CompileShaderARB);   SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB);   SET_AttachObjectARB(exec, _mesa_AttachObjectARB);   SET_LinkProgramARB(exec, _mesa_LinkProgramARB);   SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB);   SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB);   SET_Uniform1fARB(exec, _mesa_Uniform1fARB);   SET_Uniform2fARB(exec, _mesa_Uniform2fARB);   SET_Uniform3fARB(exec, _mesa_Uniform3fARB);   SET_Uniform4fARB(exec, _mesa_Uniform4fARB);   SET_Uniform1iARB(exec, _mesa_Uniform1iARB);   SET_Uniform2iARB(exec, _mesa_Uniform2iARB);   SET_Uniform3iARB(exec, _mesa_Uniform3iARB);   SET_Uniform4iARB(exec, _mesa_Uniform4iARB);   SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB);   SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB);   SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB);   SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB);   SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB);   SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB);   SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB);   SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB);   SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB);   SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB);   SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB);   SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB);   SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB);   SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB);   SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);   SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB);   SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB);   SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB);   SET_GetUniformivARB(exec, _mesa_GetUniformivARB);   SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB);#endif    /* FEATURE_ARB_shader_objects */#if FEATURE_ARB_vertex_shader   SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB);   SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB);   SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB);#endif    /* FEATURE_ARB_vertex_shader */  /* GL_ATI_fragment_shader */#if FEATURE_ATI_fragment_shader   SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI);   SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI);   SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI);   SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI);   SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI);   SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI);   SET_SampleMapATI(exec, _mesa_SampleMapATI);   SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI);   SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI);   SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI);   SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI);   SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI);   SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI);   SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI);#endif#if FEATURE_EXT_framebuffer_object   SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT);   SET_BindRenderbufferEXT(exec, _mesa_BindRenderbufferEXT);   SET_DeleteRenderbuffersEXT(exec, _mesa_DeleteRenderbuffersEXT);   SET_GenRenderbuffersEXT(exec, _mesa_GenRenderbuffersEXT);   SET_RenderbufferStorageEXT(exec, _mesa_RenderbufferStorageEXT);   SET_GetRenderbufferParameterivEXT(exec, _mesa_GetRenderbufferParameterivEXT);   SET_IsFramebufferEXT(exec, _mesa_IsFramebufferEXT);   SET_BindFramebufferEXT(exec, _mesa_BindFramebufferEXT);   SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT);   SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT);   SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT);   SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT);   SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT);   SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT);   SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT);   SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT);   SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT);#endif#if FEATURE_EXT_timer_query   SET_GetQueryObjecti64vEXT(exec, _mesa_GetQueryObjecti64vEXT);   SET_GetQueryObjectui64vEXT(exec, _mesa_GetQueryObjectui64vEXT);#endif#if FEATURE_EXT_framebuffer_blit   SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);#endif   /* GL_EXT_gpu_program_parameters */#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program   SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT);   SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT);#endif   /* GL_MESA_texture_array / GL_EXT_texture_array */#if FEATURE_EXT_framebuffer_object   SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT);#endif   /* GL_ATI_separate_stencil */   SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI);}/**********************************************************************//** \name State update logic *//*@{*/static voidupdate_separate_specular(GLcontext *ctx){   if (NEED_SECONDARY_COLOR(ctx))      ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;   else      ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;}/** * Update state dependent on vertex arrays. */static voidupdate_arrays( GLcontext *ctx ){   GLuint i, min;   /* find min of _MaxElement values for all enabled arrays */   /* 0 */   if (ctx->VertexProgram._Current       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) {      min = ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS]._MaxElement;   }   else if (ctx->Array.ArrayObj->Vertex.Enabled) {      min = ctx->Array.ArrayObj->Vertex._MaxElement;   }   else {      /* can't draw anything without vertex positions! */      min = 0;   }   /* 1 */   if (ctx->VertexProgram._Enabled       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT]._MaxElement);   }   /* no conventional vertex weight array */   /* 2 */   if (ctx->VertexProgram._Enabled       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]._MaxElement);   }   else if (ctx->Array.ArrayObj->Normal.Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->Normal._MaxElement);   }   /* 3 */   if (ctx->VertexProgram._Enabled       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]._MaxElement);   }   else if (ctx->Array.ArrayObj->Color.Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->Color._MaxElement);   }   /* 4 */   if (ctx->VertexProgram._Enabled       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]._MaxElement);   }   else if (ctx->Array.ArrayObj->SecondaryColor.Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->SecondaryColor._MaxElement);   }   /* 5 */   if (ctx->VertexProgram._Enabled       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG]._MaxElement);   }   else if (ctx->Array.ArrayObj->FogCoord.Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->FogCoord._MaxElement);   }   /* 6 */   if (ctx->VertexProgram._Enabled       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]._MaxElement);   }   else if (ctx->Array.ArrayObj->Index.Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->Index._MaxElement);   }   /* 7 */   if (ctx->VertexProgram._Enabled       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]._MaxElement);   }   /* 8..15 */   for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++) {      if (ctx->VertexProgram._Enabled          && ctx->Array.ArrayObj->VertexAttrib[i].Enabled) {         min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[i]._MaxElement);      }      else if (i - VERT_ATTRIB_TEX0 < ctx->Const.MaxTextureCoordUnits               && ctx->Array.ArrayObj->TexCoord[i - VERT_ATTRIB_TEX0].Enabled) {         min = MIN2(min, ctx->Array.ArrayObj->TexCoord[i - VERT_ATTRIB_TEX0]._MaxElement);      }   }   /* 16..31 */   if (ctx->VertexProgram._Current) {      for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {         if (ctx->Array.ArrayObj->VertexAttrib[i].Enabled) {            min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[i]._MaxElement);         }      }   }   if (ctx->Array.ArrayObj->EdgeFlag.Enabled) {      min = MIN2(min, ctx->Array.ArrayObj->EdgeFlag._MaxElement);   }   /* _MaxElement is one past the last legal array element */   ctx->Array._MaxElement = min;}/** * Update derived vertex/fragment program state. */static voidupdate_program(GLcontext *ctx){   const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;   /* These _Enabled flags indicate if the program is enabled AND valid. */   ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled      && ctx->VertexProgram.Current->Base.Instructions;   ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled      && ctx->FragmentProgram.Current->Base.Instructions;   ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled      && ctx->ATIFragmentShader.Current->Instructions[0];   /*    * Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current    * pointers to the programs that should be enabled/used.    *    * These programs may come from several sources.  The priority is as    * follows:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -