Files
mesa/src/glx/indirect_vertex_array.c
T
Paul Berry 1a1db1746d mesa: Standardize names of OpenGL functions.
This patch adjusts the aliasing pattern in the GL API description XML,
and the functions that implement the GL API within Mesa, to
consistently follow these naming conventions:

- When several function names are aliases of each other, the primary
  name is the one with no extension suffix (or the name with the
  suffix "ARB", if no unsuffixed name is available).  (By "primary
  name", I mean the name that all the other functions point to using
  the XML "alias" attribute).

- The name of the mesa implementation of each function is the same as
  the primary name, with the prefix "_mesa_".

This patch renames the following mesa functions:
  _check_GetTexGenxvOES => _mesa_GetTexGenxvOES
  _check_TexGenxOES => _mesa_TexGenxOES
  _check_TexGenxvOES => _mesa_TexGenxvOES
  _es_AlphaFuncx => _mesa_AlphaFuncx
  _es_ClearColorx => _mesa_ClearColorx
  _es_ClearDepthx => _mesa_ClearDepthx
  _es_ClipPlanef => _mesa_ClipPlanef
  _es_ClipPlanex => _mesa_ClipPlanex
  _es_Color4x => _mesa_Color4x
  _es_DepthRangex => _mesa_DepthRangex
  _es_DrawTexxOES => _mesa_DrawTexxOES
  _es_DrawTexxvOES => _mesa_DrawTexxvOES
  _es_Fogx => _mesa_Fogx
  _es_Fogxv => _mesa_Fogxv
  _es_Frustumf => _mesa_Frustumf
  _es_Frustumx => _mesa_Frustumx
  _es_GetClipPlanef => _mesa_GetClipPlanef
  _es_GetClipPlanex => _mesa_GetClipPlanex
  _es_GetLightxv => _mesa_GetLightxv
  _es_GetMaterialxv => _mesa_GetMaterialxv
  _es_GetTexEnvxv => _mesa_GetTexEnvxv
  _es_GetTexParameterxv => _mesa_GetTexParameterxv
  _es_LightModelx => _mesa_LightModelx
  _es_LightModelxv => _mesa_LightModelxv
  _es_Lightx => _mesa_Lightx
  _es_Lightxv => _mesa_Lightxv
  _es_LineWidthx => _mesa_LineWidthx
  _es_LoadMatrixx => _mesa_LoadMatrixx
  _es_Materialx => _mesa_Materialx
  _es_Materialxv => _mesa_Materialxv
  _es_MultMatrixx => _mesa_MultMatrixx
  _es_MultiTexCoord4x => _mesa_MultiTexCoord4x
  _es_Normal3x => _mesa_Normal3x
  _es_Orthof => _mesa_Orthof
  _es_Orthox => _mesa_Orthox
  _es_PointParameterx => _mesa_PointParameterx
  _es_PointParameterxv => _mesa_PointParameterxv
  _es_PointSizex => _mesa_PointSizex
  _es_PolygonOffsetx => _mesa_PolygonOffsetx
  _es_QueryMatrixxOES => _mesa_QueryMatrixxOES
  _es_Rotatex => _mesa_Rotatex
  _es_SampleCoveragex => _mesa_SampleCoveragex
  _es_Scalex => _mesa_Scalex
  _es_TexEnvx => _mesa_TexEnvx
  _es_TexEnvxv => _mesa_TexEnvxv
  _es_TexParameterx => _mesa_TexParameterx
  _es_TexParameterxv => _mesa_TexParameterxv
  _es_Translatex => _mesa_Translatex
  _mesa_ActiveTextureARB => _mesa_ActiveTexture
  _mesa_BeginQueryARB => _mesa_BeginQuery
  _mesa_BindAttribLocationARB => _mesa_BindAttribLocation
  _mesa_BindBufferARB => _mesa_BindBuffer
  _mesa_BindFramebufferEXT => _mesa_BindFramebuffer
  _mesa_BindProgram => _mesa_BindProgramARB
  _mesa_BindRenderbufferEXT => _mesa_BindRenderbuffer
  _mesa_BlendEquationSeparateEXT => _mesa_BlendEquationSeparate
  _mesa_BlendEquationSeparatei => _mesa_BlendEquationSeparateiARB
  _mesa_BlendEquationi => _mesa_BlendEquationiARB
  _mesa_BlendFuncSeparateEXT => _mesa_BlendFuncSeparate
  _mesa_BlendFuncSeparatei => _mesa_BlendFuncSeparateiARB
  _mesa_BlendFunci => _mesa_BlendFunciARB
  _mesa_BlitFramebufferEXT => _mesa_BlitFramebuffer
  _mesa_BufferDataARB => _mesa_BufferData
  _mesa_BufferSubDataARB => _mesa_BufferSubData
  _mesa_CheckFramebufferStatusEXT => _mesa_CheckFramebufferStatus
  _mesa_ClampColorARB => _mesa_ClampColor
  _mesa_ClientActiveTextureARB => _mesa_ClientActiveTexture
  _mesa_ColorMaskIndexed => _mesa_ColorMaski
  _mesa_CompileShaderARB => _mesa_CompileShader
  _mesa_CompressedTexImage1DARB => _mesa_CompressedTexImage1D
  _mesa_CompressedTexImage2DARB => _mesa_CompressedTexImage2D
  _mesa_CompressedTexImage3DARB => _mesa_CompressedTexImage3D
  _mesa_CompressedTexSubImage1DARB => _mesa_CompressedTexSubImage1D
  _mesa_CompressedTexSubImage2DARB => _mesa_CompressedTexSubImage2D
  _mesa_CompressedTexSubImage3DARB => _mesa_CompressedTexSubImage3D
  _mesa_DeleteBuffersARB => _mesa_DeleteBuffers
  _mesa_DeleteFramebuffersEXT => _mesa_DeleteFramebuffers
  _mesa_DeletePrograms => _mesa_DeleteProgramsARB
  _mesa_DeleteQueriesARB => _mesa_DeleteQueries
  _mesa_DeleteRenderbuffersEXT => _mesa_DeleteRenderbuffers
  _mesa_DeleteVertexArraysAPPLE => _mesa_DeleteVertexArrays
  _mesa_DisableIndexed => _mesa_Disablei
  _mesa_DisableVertexAttribArrayARB => _mesa_DisableVertexAttribArray
  _mesa_DrawBuffersARB => _mesa_DrawBuffers
  _mesa_DrawTexf => _mesa_DrawTexfOES
  _mesa_DrawTexfv => _mesa_DrawTexfvOES
  _mesa_DrawTexi => _mesa_DrawTexiOES
  _mesa_DrawTexiv => _mesa_DrawTexivOES
  _mesa_DrawTexs => _mesa_DrawTexsOES
  _mesa_DrawTexsv => _mesa_DrawTexsvOES
  _mesa_EnableIndexed => _mesa_Enablei
  _mesa_EnableVertexAttribArrayARB => _mesa_EnableVertexAttribArray
  _mesa_EndQueryARB => _mesa_EndQuery
  _mesa_FogCoordPointerEXT => _mesa_FogCoordPointer
  _mesa_FramebufferRenderbufferEXT => _mesa_FramebufferRenderbuffer
  _mesa_FramebufferTexture1DEXT => _mesa_FramebufferTexture1D
  _mesa_FramebufferTexture2DEXT => _mesa_FramebufferTexture2D
  _mesa_FramebufferTexture3DEXT => _mesa_FramebufferTexture3D
  _mesa_FramebufferTextureLayerEXT => _mesa_FramebufferTextureLayer
  _mesa_GenBuffersARB => _mesa_GenBuffers
  _mesa_GenFramebuffersEXT => _mesa_GenFramebuffers
  _mesa_GenPrograms => _mesa_GenProgramsARB
  _mesa_GenQueriesARB => _mesa_GenQueries
  _mesa_GenRenderbuffersEXT => _mesa_GenRenderbuffers
  _mesa_GenerateMipmapEXT => _mesa_GenerateMipmap
  _mesa_GetActiveAttribARB => _mesa_GetActiveAttrib
  _mesa_GetActiveUniformARB => _mesa_GetActiveUniform
  _mesa_GetAttribLocationARB => _mesa_GetAttribLocation
  _mesa_GetBooleanIndexedv => _mesa_GetBooleani_v
  _mesa_GetBufferParameterivARB => _mesa_GetBufferParameteriv
  _mesa_GetBufferPointervARB => _mesa_GetBufferPointerv
  _mesa_GetBufferSubDataARB => _mesa_GetBufferSubData
  _mesa_GetCompressedTexImageARB => _mesa_GetCompressedTexImage
  _mesa_GetFramebufferAttachmentParameterivEXT => _mesa_GetFramebufferAttachmentParameteriv
  _mesa_GetIntegerIndexedv => _mesa_GetIntegeri_v
  _mesa_GetQueryObjecti64vEXT => _mesa_GetQueryObjecti64v
  _mesa_GetQueryObjectivARB => _mesa_GetQueryObjectiv
  _mesa_GetQueryObjectui64vEXT => _mesa_GetQueryObjectui64v
  _mesa_GetQueryObjectuivARB => _mesa_GetQueryObjectuiv
  _mesa_GetQueryivARB => _mesa_GetQueryiv
  _mesa_GetRenderbufferParameterivEXT => _mesa_GetRenderbufferParameteriv
  _mesa_GetShaderSourceARB => _mesa_GetShaderSource
  _mesa_GetUniformLocationARB => _mesa_GetUniformLocation
  _mesa_GetUniformfvARB => _mesa_GetUniformfv
  _mesa_GetUniformivARB => _mesa_GetUniformiv
  _mesa_GetVertexAttribPointervARB => _mesa_GetVertexAttribPointerv
  _mesa_GetVertexAttribdvARB => _mesa_GetVertexAttribdv
  _mesa_GetVertexAttribfvARB => _mesa_GetVertexAttribfv
  _mesa_GetVertexAttribivARB => _mesa_GetVertexAttribiv
  _mesa_IsBufferARB => _mesa_IsBuffer
  _mesa_IsEnabledIndexed => _mesa_IsEnabledi
  _mesa_IsFramebufferEXT => _mesa_IsFramebuffer
  _mesa_IsQueryARB => _mesa_IsQuery
  _mesa_IsRenderbufferEXT => _mesa_IsRenderbuffer
  _mesa_IsVertexArrayAPPLE => _mesa_IsVertexArray
  _mesa_LinkProgramARB => _mesa_LinkProgram
  _mesa_LoadTransposeMatrixdARB => _mesa_LoadTransposeMatrixd
  _mesa_LoadTransposeMatrixfARB => _mesa_LoadTransposeMatrixf
  _mesa_MapBufferARB => _mesa_MapBuffer
  _mesa_MultTransposeMatrixdARB => _mesa_MultTransposeMatrixd
  _mesa_MultTransposeMatrixfARB => _mesa_MultTransposeMatrixf
  _mesa_MultiDrawArraysEXT => _mesa_MultiDrawArrays
  _mesa_PointSizePointer => _mesa_PointSizePointerOES
  _mesa_ProvokingVertexEXT => _mesa_ProvokingVertex
  _mesa_RenderbufferStorageEXT => _mesa_RenderbufferStorage
  _mesa_SampleCoverageARB => _mesa_SampleCoverage
  _mesa_SecondaryColorPointerEXT => _mesa_SecondaryColorPointer
  _mesa_ShaderSourceARB => _mesa_ShaderSource
  _mesa_Uniform1fARB => _mesa_Uniform1f
  _mesa_Uniform1fvARB => _mesa_Uniform1fv
  _mesa_Uniform1iARB => _mesa_Uniform1i
  _mesa_Uniform1ivARB => _mesa_Uniform1iv
  _mesa_Uniform2fARB => _mesa_Uniform2f
  _mesa_Uniform2fvARB => _mesa_Uniform2fv
  _mesa_Uniform2iARB => _mesa_Uniform2i
  _mesa_Uniform2ivARB => _mesa_Uniform2iv
  _mesa_Uniform3fARB => _mesa_Uniform3f
  _mesa_Uniform3fvARB => _mesa_Uniform3fv
  _mesa_Uniform3iARB => _mesa_Uniform3i
  _mesa_Uniform3ivARB => _mesa_Uniform3iv
  _mesa_Uniform4fARB => _mesa_Uniform4f
  _mesa_Uniform4fvARB => _mesa_Uniform4fv
  _mesa_Uniform4iARB => _mesa_Uniform4i
  _mesa_Uniform4ivARB => _mesa_Uniform4iv
  _mesa_UniformMatrix2fvARB => _mesa_UniformMatrix2fv
  _mesa_UniformMatrix3fvARB => _mesa_UniformMatrix3fv
  _mesa_UniformMatrix4fvARB => _mesa_UniformMatrix4fv
  _mesa_UnmapBufferARB => _mesa_UnmapBuffer
  _mesa_UseProgramObjectARB => _mesa_UseProgram
  _mesa_ValidateProgramARB => _mesa_ValidateProgram
  _mesa_VertexAttribPointerARB => _mesa_VertexAttribPointer
  _mesa_WindowPos2dMESA => _mesa_WindowPos2d
  _mesa_WindowPos2dvMESA => _mesa_WindowPos2dv
  _mesa_WindowPos2fMESA => _mesa_WindowPos2f
  _mesa_WindowPos2fvMESA => _mesa_WindowPos2fv
  _mesa_WindowPos2iMESA => _mesa_WindowPos2i
  _mesa_WindowPos2ivMESA => _mesa_WindowPos2iv
  _mesa_WindowPos2sMESA => _mesa_WindowPos2s
  _mesa_WindowPos2svMESA => _mesa_WindowPos2sv
  _mesa_WindowPos3dMESA => _mesa_WindowPos3d
  _mesa_WindowPos3dvMESA => _mesa_WindowPos3dv
  _mesa_WindowPos3fMESA => _mesa_WindowPos3f
  _mesa_WindowPos3fvMESA => _mesa_WindowPos3fv
  _mesa_WindowPos3iMESA => _mesa_WindowPos3i
  _mesa_WindowPos3ivMESA => _mesa_WindowPos3iv
  _mesa_WindowPos3sMESA => _mesa_WindowPos3s
  _mesa_WindowPos3svMESA => _mesa_WindowPos3sv
  loopback_Color3b_f => _mesa_Color3b
  loopback_Color3bv_f => _mesa_Color3bv
  loopback_Color3d_f => _mesa_Color3d
  loopback_Color3dv_f => _mesa_Color3dv
  loopback_Color3i_f => _mesa_Color3i
  loopback_Color3iv_f => _mesa_Color3iv
  loopback_Color3s_f => _mesa_Color3s
  loopback_Color3sv_f => _mesa_Color3sv
  loopback_Color3ub_f => _mesa_Color3ub
  loopback_Color3ubv_f => _mesa_Color3ubv
  loopback_Color3ui_f => _mesa_Color3ui
  loopback_Color3uiv_f => _mesa_Color3uiv
  loopback_Color3us_f => _mesa_Color3us
  loopback_Color3usv_f => _mesa_Color3usv
  loopback_Color4b_f => _mesa_Color4b
  loopback_Color4bv_f => _mesa_Color4bv
  loopback_Color4d_f => _mesa_Color4d
  loopback_Color4dv_f => _mesa_Color4dv
  loopback_Color4i_f => _mesa_Color4i
  loopback_Color4iv_f => _mesa_Color4iv
  loopback_Color4s_f => _mesa_Color4s
  loopback_Color4sv_f => _mesa_Color4sv
  loopback_Color4ub_f => _mesa_Color4ub
  loopback_Color4ubv_f => _mesa_Color4ubv
  loopback_Color4ui_f => _mesa_Color4ui
  loopback_Color4uiv_f => _mesa_Color4uiv
  loopback_Color4us_f => _mesa_Color4us
  loopback_Color4usv_f => _mesa_Color4usv
  loopback_EdgeFlagv => _mesa_EdgeFlagv
  loopback_EvalCoord1d => _mesa_EvalCoord1d
  loopback_EvalCoord1dv => _mesa_EvalCoord1dv
  loopback_EvalCoord1fv => _mesa_EvalCoord1fv
  loopback_EvalCoord2d => _mesa_EvalCoord2d
  loopback_EvalCoord2dv => _mesa_EvalCoord2dv
  loopback_EvalCoord2fv => _mesa_EvalCoord2fv
  loopback_FogCoorddEXT => _mesa_FogCoordd
  loopback_FogCoorddvEXT => _mesa_FogCoorddv
  loopback_Indexd => _mesa_Indexd
  loopback_Indexdv => _mesa_Indexdv
  loopback_Indexi => _mesa_Indexi
  loopback_Indexiv => _mesa_Indexiv
  loopback_Indexs => _mesa_Indexs
  loopback_Indexsv => _mesa_Indexsv
  loopback_Indexub => _mesa_Indexub
  loopback_Indexubv => _mesa_Indexubv
  loopback_Materialf => _mesa_Materialf
  loopback_Materiali => _mesa_Materiali
  loopback_Materialiv => _mesa_Materialiv
  loopback_MultiTexCoord1dARB => _mesa_MultiTexCoord1d
  loopback_MultiTexCoord1dvARB => _mesa_MultiTexCoord1dv
  loopback_MultiTexCoord1iARB => _mesa_MultiTexCoord1i
  loopback_MultiTexCoord1ivARB => _mesa_MultiTexCoord1iv
  loopback_MultiTexCoord1sARB => _mesa_MultiTexCoord1s
  loopback_MultiTexCoord1svARB => _mesa_MultiTexCoord1sv
  loopback_MultiTexCoord2dARB => _mesa_MultiTexCoord2d
  loopback_MultiTexCoord2dvARB => _mesa_MultiTexCoord2dv
  loopback_MultiTexCoord2iARB => _mesa_MultiTexCoord2i
  loopback_MultiTexCoord2ivARB => _mesa_MultiTexCoord2iv
  loopback_MultiTexCoord2sARB => _mesa_MultiTexCoord2s
  loopback_MultiTexCoord2svARB => _mesa_MultiTexCoord2sv
  loopback_MultiTexCoord3dARB => _mesa_MultiTexCoord3d
  loopback_MultiTexCoord3dvARB => _mesa_MultiTexCoord3dv
  loopback_MultiTexCoord3iARB => _mesa_MultiTexCoord3i
  loopback_MultiTexCoord3ivARB => _mesa_MultiTexCoord3iv
  loopback_MultiTexCoord3sARB => _mesa_MultiTexCoord3s
  loopback_MultiTexCoord3svARB => _mesa_MultiTexCoord3sv
  loopback_MultiTexCoord4dARB => _mesa_MultiTexCoord4d
  loopback_MultiTexCoord4dvARB => _mesa_MultiTexCoord4dv
  loopback_MultiTexCoord4iARB => _mesa_MultiTexCoord4i
  loopback_MultiTexCoord4ivARB => _mesa_MultiTexCoord4iv
  loopback_MultiTexCoord4sARB => _mesa_MultiTexCoord4s
  loopback_MultiTexCoord4svARB => _mesa_MultiTexCoord4sv
  loopback_Normal3b => _mesa_Normal3b
  loopback_Normal3bv => _mesa_Normal3bv
  loopback_Normal3d => _mesa_Normal3d
  loopback_Normal3dv => _mesa_Normal3dv
  loopback_Normal3i => _mesa_Normal3i
  loopback_Normal3iv => _mesa_Normal3iv
  loopback_Normal3s => _mesa_Normal3s
  loopback_Normal3sv => _mesa_Normal3sv
  loopback_Rectd => _mesa_Rectd
  loopback_Rectdv => _mesa_Rectdv
  loopback_Rectfv => _mesa_Rectfv
  loopback_Recti => _mesa_Recti
  loopback_Rectiv => _mesa_Rectiv
  loopback_Rects => _mesa_Rects
  loopback_Rectsv => _mesa_Rectsv
  loopback_SecondaryColor3bEXT_f => _mesa_SecondaryColor3b
  loopback_SecondaryColor3bvEXT_f => _mesa_SecondaryColor3bv
  loopback_SecondaryColor3dEXT_f => _mesa_SecondaryColor3d
  loopback_SecondaryColor3dvEXT_f => _mesa_SecondaryColor3dv
  loopback_SecondaryColor3iEXT_f => _mesa_SecondaryColor3i
  loopback_SecondaryColor3ivEXT_f => _mesa_SecondaryColor3iv
  loopback_SecondaryColor3sEXT_f => _mesa_SecondaryColor3s
  loopback_SecondaryColor3svEXT_f => _mesa_SecondaryColor3sv
  loopback_SecondaryColor3ubEXT_f => _mesa_SecondaryColor3ub
  loopback_SecondaryColor3ubvEXT_f => _mesa_SecondaryColor3ubv
  loopback_SecondaryColor3uiEXT_f => _mesa_SecondaryColor3ui
  loopback_SecondaryColor3uivEXT_f => _mesa_SecondaryColor3uiv
  loopback_SecondaryColor3usEXT_f => _mesa_SecondaryColor3us
  loopback_SecondaryColor3usvEXT_f => _mesa_SecondaryColor3usv
  loopback_TexCoord1d => _mesa_TexCoord1d
  loopback_TexCoord1dv => _mesa_TexCoord1dv
  loopback_TexCoord1i => _mesa_TexCoord1i
  loopback_TexCoord1iv => _mesa_TexCoord1iv
  loopback_TexCoord1s => _mesa_TexCoord1s
  loopback_TexCoord1sv => _mesa_TexCoord1sv
  loopback_TexCoord2d => _mesa_TexCoord2d
  loopback_TexCoord2dv => _mesa_TexCoord2dv
  loopback_TexCoord2i => _mesa_TexCoord2i
  loopback_TexCoord2iv => _mesa_TexCoord2iv
  loopback_TexCoord2s => _mesa_TexCoord2s
  loopback_TexCoord2sv => _mesa_TexCoord2sv
  loopback_TexCoord3d => _mesa_TexCoord3d
  loopback_TexCoord3dv => _mesa_TexCoord3dv
  loopback_TexCoord3i => _mesa_TexCoord3i
  loopback_TexCoord3iv => _mesa_TexCoord3iv
  loopback_TexCoord3s => _mesa_TexCoord3s
  loopback_TexCoord3sv => _mesa_TexCoord3sv
  loopback_TexCoord4d => _mesa_TexCoord4d
  loopback_TexCoord4dv => _mesa_TexCoord4dv
  loopback_TexCoord4i => _mesa_TexCoord4i
  loopback_TexCoord4iv => _mesa_TexCoord4iv
  loopback_TexCoord4s => _mesa_TexCoord4s
  loopback_TexCoord4sv => _mesa_TexCoord4sv
  loopback_Vertex2d => _mesa_Vertex2d
  loopback_Vertex2dv => _mesa_Vertex2dv
  loopback_Vertex2i => _mesa_Vertex2i
  loopback_Vertex2iv => _mesa_Vertex2iv
  loopback_Vertex2s => _mesa_Vertex2s
  loopback_Vertex2sv => _mesa_Vertex2sv
  loopback_Vertex3d => _mesa_Vertex3d
  loopback_Vertex3dv => _mesa_Vertex3dv
  loopback_Vertex3i => _mesa_Vertex3i
  loopback_Vertex3iv => _mesa_Vertex3iv
  loopback_Vertex3s => _mesa_Vertex3s
  loopback_Vertex3sv => _mesa_Vertex3sv
  loopback_Vertex4d => _mesa_Vertex4d
  loopback_Vertex4dv => _mesa_Vertex4dv
  loopback_Vertex4i => _mesa_Vertex4i
  loopback_Vertex4iv => _mesa_Vertex4iv
  loopback_Vertex4s => _mesa_Vertex4s
  loopback_Vertex4sv => _mesa_Vertex4sv
  loopback_VertexAttrib1dARB => _mesa_VertexAttrib1d
  loopback_VertexAttrib1dNV => _mesa_VertexAttrib1dNV
  loopback_VertexAttrib1dvARB => _mesa_VertexAttrib1dv
  loopback_VertexAttrib1dvNV => _mesa_VertexAttrib1dvNV
  loopback_VertexAttrib1sARB => _mesa_VertexAttrib1s
  loopback_VertexAttrib1sNV => _mesa_VertexAttrib1sNV
  loopback_VertexAttrib1svARB => _mesa_VertexAttrib1sv
  loopback_VertexAttrib1svNV => _mesa_VertexAttrib1svNV
  loopback_VertexAttrib2dARB => _mesa_VertexAttrib2d
  loopback_VertexAttrib2dNV => _mesa_VertexAttrib2dNV
  loopback_VertexAttrib2dvARB => _mesa_VertexAttrib2dv
  loopback_VertexAttrib2dvNV => _mesa_VertexAttrib2dvNV
  loopback_VertexAttrib2sARB => _mesa_VertexAttrib2s
  loopback_VertexAttrib2sNV => _mesa_VertexAttrib2sNV
  loopback_VertexAttrib2svARB => _mesa_VertexAttrib2sv
  loopback_VertexAttrib2svNV => _mesa_VertexAttrib2svNV
  loopback_VertexAttrib3dARB => _mesa_VertexAttrib3d
  loopback_VertexAttrib3dNV => _mesa_VertexAttrib3dNV
  loopback_VertexAttrib3dvARB => _mesa_VertexAttrib3dv
  loopback_VertexAttrib3dvNV => _mesa_VertexAttrib3dvNV
  loopback_VertexAttrib3sARB => _mesa_VertexAttrib3s
  loopback_VertexAttrib3sNV => _mesa_VertexAttrib3sNV
  loopback_VertexAttrib3svARB => _mesa_VertexAttrib3sv
  loopback_VertexAttrib3svNV => _mesa_VertexAttrib3svNV
  loopback_VertexAttrib4NbvARB => _mesa_VertexAttrib4Nbv
  loopback_VertexAttrib4NivARB => _mesa_VertexAttrib4Niv
  loopback_VertexAttrib4NsvARB => _mesa_VertexAttrib4Nsv
  loopback_VertexAttrib4NubARB => _mesa_VertexAttrib4Nub
  loopback_VertexAttrib4NubvARB => _mesa_VertexAttrib4Nubv
  loopback_VertexAttrib4NuivARB => _mesa_VertexAttrib4Nuiv
  loopback_VertexAttrib4NusvARB => _mesa_VertexAttrib4Nusv
  loopback_VertexAttrib4bvARB => _mesa_VertexAttrib4bv
  loopback_VertexAttrib4dARB => _mesa_VertexAttrib4d
  loopback_VertexAttrib4dNV => _mesa_VertexAttrib4dNV
  loopback_VertexAttrib4dvARB => _mesa_VertexAttrib4dv
  loopback_VertexAttrib4dvNV => _mesa_VertexAttrib4dvNV
  loopback_VertexAttrib4ivARB => _mesa_VertexAttrib4iv
  loopback_VertexAttrib4sARB => _mesa_VertexAttrib4s
  loopback_VertexAttrib4sNV => _mesa_VertexAttrib4sNV
  loopback_VertexAttrib4svARB => _mesa_VertexAttrib4sv
  loopback_VertexAttrib4svNV => _mesa_VertexAttrib4svNV
  loopback_VertexAttrib4ubNV => _mesa_VertexAttrib4ubNV
  loopback_VertexAttrib4ubvARB => _mesa_VertexAttrib4ubv
  loopback_VertexAttrib4ubvNV => _mesa_VertexAttrib4ubvNV
  loopback_VertexAttrib4uivARB => _mesa_VertexAttrib4uiv
  loopback_VertexAttrib4usvARB => _mesa_VertexAttrib4usv
  loopback_VertexAttribI1iv => _mesa_VertexAttribI1iv
  loopback_VertexAttribI1uiv => _mesa_VertexAttribI1uiv
  loopback_VertexAttribI4bv => _mesa_VertexAttribI4bv
  loopback_VertexAttribI4sv => _mesa_VertexAttribI4sv
  loopback_VertexAttribI4ubv => _mesa_VertexAttribI4ubv
  loopback_VertexAttribI4usv => _mesa_VertexAttribI4usv
  loopback_VertexAttribs1dvNV => _mesa_VertexAttribs1dvNV
  loopback_VertexAttribs1fvNV => _mesa_VertexAttribs1fvNV
  loopback_VertexAttribs1svNV => _mesa_VertexAttribs1svNV
  loopback_VertexAttribs2dvNV => _mesa_VertexAttribs2dvNV
  loopback_VertexAttribs2fvNV => _mesa_VertexAttribs2fvNV
  loopback_VertexAttribs2svNV => _mesa_VertexAttribs2svNV
  loopback_VertexAttribs3dvNV => _mesa_VertexAttribs3dvNV
  loopback_VertexAttribs3fvNV => _mesa_VertexAttribs3fvNV
  loopback_VertexAttribs3svNV => _mesa_VertexAttribs3svNV
  loopback_VertexAttribs4dvNV => _mesa_VertexAttribs4dvNV
  loopback_VertexAttribs4fvNV => _mesa_VertexAttribs4fvNV
  loopback_VertexAttribs4svNV => _mesa_VertexAttribs4svNV
  loopback_VertexAttribs4ubvNV => _mesa_VertexAttribs4ubvNV

And changes the primary name assignment in the XML as follows:
  ActiveTextureARB => ActiveTexture
  AlphaFuncxOES => AlphaFuncx
  BeginConditionalRenderNV => BeginConditionalRender
  BeginQueryARB => BeginQuery
  BeginTransformFeedbackEXT => BeginTransformFeedback
  BindAttribLocationARB => BindAttribLocation
  BindBufferARB => BindBuffer
  BindBufferBaseEXT => BindBufferBase
  BindBufferRangeEXT => BindBufferRange
  BindFragDataLocationEXT => BindFragDataLocation
  BindFramebufferEXT => BindFramebuffer
  BindProgramNV => BindProgramARB
  BindRenderbufferEXT => BindRenderbuffer
  BlendEquationSeparateEXT => BlendEquationSeparate
  BlendFuncSeparateEXT => BlendFuncSeparate
  BlitFramebufferEXT => BlitFramebuffer
  BufferDataARB => BufferData
  BufferSubDataARB => BufferSubData
  CheckFramebufferStatusEXT => CheckFramebufferStatus
  ClampColorARB => ClampColor
  ClearColorxOES => ClearColorx
  ClearDepthxOES => ClearDepthx
  ClientActiveTextureARB => ClientActiveTexture
  ClipPlanefOES => ClipPlanef
  ClipPlanexOES => ClipPlanex
  Color4xOES => Color4x
  ColorMaskIndexedEXT => ColorMaski
  CompileShaderARB => CompileShader
  CompressedTexImage1DARB => CompressedTexImage1D
  CompressedTexImage2DARB => CompressedTexImage2D
  CompressedTexImage3DARB => CompressedTexImage3D
  CompressedTexSubImage1DARB => CompressedTexSubImage1D
  CompressedTexSubImage2DARB => CompressedTexSubImage2D
  CompressedTexSubImage3DARB => CompressedTexSubImage3D
  DeleteBuffersARB => DeleteBuffers
  DeleteFramebuffersEXT => DeleteFramebuffers
  DeleteProgramsNV => DeleteProgramsARB
  DeleteQueriesARB => DeleteQueries
  DeleteRenderbuffersEXT => DeleteRenderbuffers
  DeleteVertexArraysAPPLE => DeleteVertexArrays
  DepthRangexOES => DepthRangex
  DisableIndexedEXT => Disablei
  DisableVertexAttribArrayARB => DisableVertexAttribArray
  DrawBuffersARB => DrawBuffers
  EnableIndexedEXT => Enablei
  EnableVertexAttribArrayARB => EnableVertexAttribArray
  EndConditionalRenderNV => EndConditionalRender
  EndQueryARB => EndQuery
  EndTransformFeedbackEXT => EndTransformFeedback
  FogCoordPointerEXT => FogCoordPointer
  FogCoorddEXT => FogCoordd
  FogCoorddvEXT => FogCoorddv
  FogxOES => Fogx
  FogxvOES => Fogxv
  FramebufferRenderbufferEXT => FramebufferRenderbuffer
  FramebufferTexture1DEXT => FramebufferTexture1D
  FramebufferTexture2DEXT => FramebufferTexture2D
  FramebufferTexture3DEXT => FramebufferTexture3D
  FramebufferTextureLayerEXT => FramebufferTextureLayer
  FrustumfOES => Frustumf
  FrustumxOES => Frustumx
  GenBuffersARB => GenBuffers
  GenFramebuffersEXT => GenFramebuffers
  GenProgramsNV => GenProgramsARB
  GenQueriesARB => GenQueries
  GenRenderbuffersEXT => GenRenderbuffers
  GenerateMipmapEXT => GenerateMipmap
  GetActiveAttribARB => GetActiveAttrib
  GetActiveUniformARB => GetActiveUniform
  GetAttribLocationARB => GetAttribLocation
  GetBooleanIndexedvEXT => GetBooleani_v
  GetBufferParameterivARB => GetBufferParameteriv
  GetBufferPointervARB => GetBufferPointerv
  GetBufferSubDataARB => GetBufferSubData
  GetClipPlanefOES => GetClipPlanef
  GetClipPlanexOES => GetClipPlanex
  GetCompressedTexImageARB => GetCompressedTexImage
  GetFixedvOES => GetFixedv
  GetFragDataLocationEXT => GetFragDataLocation
  GetFramebufferAttachmentParameterivEXT => GetFramebufferAttachmentParameteriv
  GetIntegerIndexedvEXT => GetIntegeri_v
  GetLightxvOES => GetLightxv
  GetMaterialxvOES => GetMaterialxv
  GetQueryObjecti64vEXT => GetQueryObjecti64v
  GetQueryObjectivARB => GetQueryObjectiv
  GetQueryObjectui64vEXT => GetQueryObjectui64v
  GetQueryObjectuivARB => GetQueryObjectuiv
  GetQueryivARB => GetQueryiv
  GetRenderbufferParameterivEXT => GetRenderbufferParameteriv
  GetShaderSourceARB => GetShaderSource
  GetTexEnvxvOES => GetTexEnvxv
  GetTexParameterIivEXT => GetTexParameterIiv
  GetTexParameterIuivEXT => GetTexParameterIuiv
  GetTexParameterxvOES => GetTexParameterxv
  GetTransformFeedbackVaryingEXT => GetTransformFeedbackVarying
  GetUniformLocationARB => GetUniformLocation
  GetUniformfvARB => GetUniformfv
  GetUniformivARB => GetUniformiv
  GetUniformuivEXT => GetUniformuiv
  GetVertexAttribIivEXT => GetVertexAttribIiv
  GetVertexAttribIuivEXT => GetVertexAttribIuiv
  GetVertexAttribPointervNV => GetVertexAttribPointerv
  GetVertexAttribdvARB => GetVertexAttribdv
  GetVertexAttribfvARB => GetVertexAttribfv
  GetVertexAttribivARB => GetVertexAttribiv
  IsBufferARB => IsBuffer
  IsEnabledIndexedEXT => IsEnabledi
  IsFramebufferEXT => IsFramebuffer
  IsProgramNV => IsProgramARB
  IsQueryARB => IsQuery
  IsRenderbufferEXT => IsRenderbuffer
  IsVertexArrayAPPLE => IsVertexArray
  LightModelxOES => LightModelx
  LightModelxvOES => LightModelxv
  LightxOES => Lightx
  LightxvOES => Lightxv
  LineWidthxOES => LineWidthx
  LinkProgramARB => LinkProgram
  LoadMatrixxOES => LoadMatrixx
  LoadTransposeMatrixdARB => LoadTransposeMatrixd
  LoadTransposeMatrixfARB => LoadTransposeMatrixf
  MapBufferARB => MapBuffer
  MaterialxOES => Materialx
  MaterialxvOES => Materialxv
  MultMatrixxOES => MultMatrixx
  MultTransposeMatrixdARB => MultTransposeMatrixd
  MultTransposeMatrixfARB => MultTransposeMatrixf
  MultiDrawArraysEXT => MultiDrawArrays
  MultiTexCoord1dARB => MultiTexCoord1d
  MultiTexCoord1dvARB => MultiTexCoord1dv
  MultiTexCoord1iARB => MultiTexCoord1i
  MultiTexCoord1ivARB => MultiTexCoord1iv
  MultiTexCoord1sARB => MultiTexCoord1s
  MultiTexCoord1svARB => MultiTexCoord1sv
  MultiTexCoord2dARB => MultiTexCoord2d
  MultiTexCoord2dvARB => MultiTexCoord2dv
  MultiTexCoord2iARB => MultiTexCoord2i
  MultiTexCoord2ivARB => MultiTexCoord2iv
  MultiTexCoord2sARB => MultiTexCoord2s
  MultiTexCoord2svARB => MultiTexCoord2sv
  MultiTexCoord3dARB => MultiTexCoord3d
  MultiTexCoord3dvARB => MultiTexCoord3dv
  MultiTexCoord3iARB => MultiTexCoord3i
  MultiTexCoord3ivARB => MultiTexCoord3iv
  MultiTexCoord3sARB => MultiTexCoord3s
  MultiTexCoord3svARB => MultiTexCoord3sv
  MultiTexCoord4dARB => MultiTexCoord4d
  MultiTexCoord4dvARB => MultiTexCoord4dv
  MultiTexCoord4iARB => MultiTexCoord4i
  MultiTexCoord4ivARB => MultiTexCoord4iv
  MultiTexCoord4sARB => MultiTexCoord4s
  MultiTexCoord4svARB => MultiTexCoord4sv
  MultiTexCoord4xOES => MultiTexCoord4x
  Normal3xOES => Normal3x
  OrthofOES => Orthof
  OrthoxOES => Orthox
  PointParameterfEXT => PointParameterf
  PointParameterfvEXT => PointParameterfv
  PointParameteriNV => PointParameteri
  PointParameterivNV => PointParameteriv
  PointParameterxOES => PointParameterx
  PointParameterxvOES => PointParameterxv
  PointSizexOES => PointSizex
  PolygonOffsetxOES => PolygonOffsetx
  PrimitiveRestartIndexNV => PrimitiveRestartIndex
  ProvokingVertexEXT => ProvokingVertex
  RenderbufferStorageEXT => RenderbufferStorage
  RotatexOES => Rotatex
  SampleCoverageARB => SampleCoverage
  SampleCoveragexOES => SampleCoveragex
  ScalexOES => Scalex
  SecondaryColor3bEXT => SecondaryColor3b
  SecondaryColor3bvEXT => SecondaryColor3bv
  SecondaryColor3dEXT => SecondaryColor3d
  SecondaryColor3dvEXT => SecondaryColor3dv
  SecondaryColor3iEXT => SecondaryColor3i
  SecondaryColor3ivEXT => SecondaryColor3iv
  SecondaryColor3sEXT => SecondaryColor3s
  SecondaryColor3svEXT => SecondaryColor3sv
  SecondaryColor3ubEXT => SecondaryColor3ub
  SecondaryColor3ubvEXT => SecondaryColor3ubv
  SecondaryColor3uiEXT => SecondaryColor3ui
  SecondaryColor3uivEXT => SecondaryColor3uiv
  SecondaryColor3usEXT => SecondaryColor3us
  SecondaryColor3usvEXT => SecondaryColor3usv
  SecondaryColorPointerEXT => SecondaryColorPointer
  ShaderSourceARB => ShaderSource
  TexBufferARB => TexBuffer
  TexEnvxOES => TexEnvx
  TexEnvxvOES => TexEnvxv
  TexParameterIivEXT => TexParameterIiv
  TexParameterIuivEXT => TexParameterIuiv
  TexParameterxOES => TexParameterx
  TexParameterxvOES => TexParameterxv
  TransformFeedbackVaryingsEXT => TransformFeedbackVaryings
  TranslatexOES => Translatex
  Uniform1fARB => Uniform1f
  Uniform1fvARB => Uniform1fv
  Uniform1iARB => Uniform1i
  Uniform1ivARB => Uniform1iv
  Uniform1uiEXT => Uniform1ui
  Uniform1uivEXT => Uniform1uiv
  Uniform2fARB => Uniform2f
  Uniform2fvARB => Uniform2fv
  Uniform2iARB => Uniform2i
  Uniform2ivARB => Uniform2iv
  Uniform2uiEXT => Uniform2ui
  Uniform2uivEXT => Uniform2uiv
  Uniform3fARB => Uniform3f
  Uniform3fvARB => Uniform3fv
  Uniform3iARB => Uniform3i
  Uniform3ivARB => Uniform3iv
  Uniform3uiEXT => Uniform3ui
  Uniform3uivEXT => Uniform3uiv
  Uniform4fARB => Uniform4f
  Uniform4fvARB => Uniform4fv
  Uniform4iARB => Uniform4i
  Uniform4ivARB => Uniform4iv
  Uniform4uiEXT => Uniform4ui
  Uniform4uivEXT => Uniform4uiv
  UniformMatrix2fvARB => UniformMatrix2fv
  UniformMatrix3fvARB => UniformMatrix3fv
  UniformMatrix4fvARB => UniformMatrix4fv
  UnmapBufferARB => UnmapBuffer
  UseProgramObjectARB => UseProgram
  ValidateProgramARB => ValidateProgram
  VertexAttrib1dARB => VertexAttrib1d
  VertexAttrib1dvARB => VertexAttrib1dv
  VertexAttrib1sARB => VertexAttrib1s
  VertexAttrib1svARB => VertexAttrib1sv
  VertexAttrib2dARB => VertexAttrib2d
  VertexAttrib2dvARB => VertexAttrib2dv
  VertexAttrib2sARB => VertexAttrib2s
  VertexAttrib2svARB => VertexAttrib2sv
  VertexAttrib3dARB => VertexAttrib3d
  VertexAttrib3dvARB => VertexAttrib3dv
  VertexAttrib3sARB => VertexAttrib3s
  VertexAttrib3svARB => VertexAttrib3sv
  VertexAttrib4NbvARB => VertexAttrib4Nbv
  VertexAttrib4NivARB => VertexAttrib4Niv
  VertexAttrib4NsvARB => VertexAttrib4Nsv
  VertexAttrib4NubARB => VertexAttrib4Nub
  VertexAttrib4NubvARB => VertexAttrib4Nubv
  VertexAttrib4NuivARB => VertexAttrib4Nuiv
  VertexAttrib4NusvARB => VertexAttrib4Nusv
  VertexAttrib4bvARB => VertexAttrib4bv
  VertexAttrib4dARB => VertexAttrib4d
  VertexAttrib4dvARB => VertexAttrib4dv
  VertexAttrib4ivARB => VertexAttrib4iv
  VertexAttrib4sARB => VertexAttrib4s
  VertexAttrib4svARB => VertexAttrib4sv
  VertexAttrib4ubvARB => VertexAttrib4ubv
  VertexAttrib4uivARB => VertexAttrib4uiv
  VertexAttrib4usvARB => VertexAttrib4usv
  VertexAttribDivisorARB => VertexAttribDivisor
  VertexAttribI1ivEXT => VertexAttribI1iv
  VertexAttribI1uivEXT => VertexAttribI1uiv
  VertexAttribI4bvEXT => VertexAttribI4bv
  VertexAttribI4svEXT => VertexAttribI4sv
  VertexAttribI4ubvEXT => VertexAttribI4ubv
  VertexAttribI4usvEXT => VertexAttribI4usv
  VertexAttribIPointerEXT => VertexAttribIPointer
  VertexAttribPointerARB => VertexAttribPointer
  WindowPos2dMESA => WindowPos2d
  WindowPos2dvMESA => WindowPos2dv
  WindowPos2fMESA => WindowPos2f
  WindowPos2fvMESA => WindowPos2fv
  WindowPos2iMESA => WindowPos2i
  WindowPos2ivMESA => WindowPos2iv
  WindowPos2sMESA => WindowPos2s
  WindowPos2svMESA => WindowPos2sv
  WindowPos3dMESA => WindowPos3d
  WindowPos3dvMESA => WindowPos3dv
  WindowPos3fMESA => WindowPos3f
  WindowPos3fvMESA => WindowPos3fv
  WindowPos3iMESA => WindowPos3i
  WindowPos3ivMESA => WindowPos3iv
  WindowPos3sMESA => WindowPos3s
  WindowPos3svMESA => WindowPos3sv

Acked-by: Brian Paul <brianp@vmware.com>
2012-11-12 10:53:57 -08:00

1983 lines
54 KiB
C

/*
* (C) Copyright IBM Corporation 2004, 2005
* 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, sub license,
* 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 (including the next
* paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* IBM,
* AND/OR THEIR SUPPLIERS 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.
*/
#include <inttypes.h>
#include <assert.h>
#include <string.h>
#include "glxclient.h"
#include "indirect.h"
#include <GL/glxproto.h>
#include "glxextensions.h"
#include "indirect_vertex_array.h"
#include "indirect_vertex_array_priv.h"
#define __GLX_PAD(n) (((n)+3) & ~3)
/**
* \file indirect_vertex_array.c
* Implement GLX protocol for vertex arrays and vertex buffer objects.
*
* The most important function in this fill is \c fill_array_info_cache.
* The \c array_state_vector contains a cache of the ARRAY_INFO data sent
* in the DrawArrays protocol. Certain operations, such as enabling or
* disabling an array, can invalidate this cache. \c fill_array_info_cache
* fills-in this data. Additionally, it examines the enabled state and
* other factors to determine what "version" of DrawArrays protocoal can be
* used.
*
* Current, only two versions of DrawArrays protocol are implemented. The
* first version is the "none" protocol. This is the fallback when the
* server does not support GL 1.1 / EXT_vertex_arrays. It is implemented
* by sending batches of immediate mode commands that are equivalent to the
* DrawArrays protocol.
*
* The other protocol that is currently implemented is the "old" protocol.
* This is the GL 1.1 DrawArrays protocol. The only difference between GL
* 1.1 and EXT_vertex_arrays is the opcode used for the DrawArrays command.
* This protocol is called "old" because the ARB is in the process of
* defining a new protocol, which will probably be called wither "new" or
* "vbo", to support multiple texture coordinate arrays, generic attributes,
* and vertex buffer objects.
*
* \author Ian Romanick <ian.d.romanick@intel.com>
*/
static void emit_DrawArrays_none(GLenum mode, GLint first, GLsizei count);
static void emit_DrawArrays_old(GLenum mode, GLint first, GLsizei count);
static void emit_DrawElements_none(GLenum mode, GLsizei count, GLenum type,
const GLvoid * indices);
static void emit_DrawElements_old(GLenum mode, GLsizei count, GLenum type,
const GLvoid * indices);
static GLubyte *emit_element_none(GLubyte * dst,
const struct array_state_vector *arrays,
unsigned index);
static GLubyte *emit_element_old(GLubyte * dst,
const struct array_state_vector *arrays,
unsigned index);
static struct array_state *get_array_entry(const struct array_state_vector
*arrays, GLenum key,
unsigned index);
static void fill_array_info_cache(struct array_state_vector *arrays);
static GLboolean validate_mode(struct glx_context * gc, GLenum mode);
static GLboolean validate_count(struct glx_context * gc, GLsizei count);
static GLboolean validate_type(struct glx_context * gc, GLenum type);
/**
* Table of sizes, in bytes, of a GL types. All of the type enums are be in
* the range 0x1400 - 0x140F. That includes types added by extensions (i.e.,
* \c GL_HALF_FLOAT_NV). This elements of this table correspond to the
* type enums masked with 0x0f.
*
* \notes
* \c GL_HALF_FLOAT_NV is not included. Neither are \c GL_2_BYTES,
* \c GL_3_BYTES, or \c GL_4_BYTES.
*/
const GLuint __glXTypeSize_table[16] = {
1, 1, 2, 2, 4, 4, 4, 0, 0, 0, 8, 0, 0, 0, 0, 0
};
/**
* Free the per-context array state that was allocated with
* __glXInitVertexArrayState().
*/
void
__glXFreeVertexArrayState(struct glx_context * gc)
{
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
if (arrays) {
free(arrays->stack);
arrays->stack = NULL;
free(arrays->arrays);
arrays->arrays = NULL;
free(arrays);
state->array_state = NULL;
}
}
/**
* Initialize vertex array state of a GLX context.
*
* \param gc GLX context whose vertex array state is to be initialized.
*
* \warning
* This function may only be called after struct glx_context::gl_extension_bits,
* struct glx_context::server_minor, and __GLXcontext::server_major have been
* initialized. These values are used to determine what vertex arrays are
* supported.
*
* \bug
* Return values from malloc are not properly tested.
*/
void
__glXInitVertexArrayState(struct glx_context * gc)
{
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays;
unsigned array_count;
int texture_units = 1, vertex_program_attribs = 0;
unsigned i, j;
GLboolean got_fog = GL_FALSE;
GLboolean got_secondary_color = GL_FALSE;
arrays = calloc(1, sizeof(struct array_state_vector));
state->array_state = arrays;
arrays->old_DrawArrays_possible = !state->NoDrawArraysProtocol;
arrays->new_DrawArrays_possible = GL_FALSE;
arrays->DrawArrays = NULL;
arrays->active_texture_unit = 0;
/* Determine how many arrays are actually needed. Only arrays that
* are supported by the server are create. For example, if the server
* supports only 2 texture units, then only 2 texture coordinate arrays
* are created.
*
* At the very least, GL_VERTEX_ARRAY, GL_NORMAL_ARRAY,
* GL_COLOR_ARRAY, GL_INDEX_ARRAY, GL_TEXTURE_COORD_ARRAY, and
* GL_EDGE_FLAG_ARRAY are supported.
*/
array_count = 5;
if (__glExtensionBitIsEnabled(gc, GL_EXT_fog_coord_bit)
|| (gc->server_major > 1) || (gc->server_minor >= 4)) {
got_fog = GL_TRUE;
array_count++;
}
if (__glExtensionBitIsEnabled(gc, GL_EXT_secondary_color_bit)
|| (gc->server_major > 1) || (gc->server_minor >= 4)) {
got_secondary_color = GL_TRUE;
array_count++;
}
if (__glExtensionBitIsEnabled(gc, GL_ARB_multitexture_bit)
|| (gc->server_major > 1) || (gc->server_minor >= 3)) {
__indirect_glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_units);
}
if (__glExtensionBitIsEnabled(gc, GL_ARB_vertex_program_bit)) {
__indirect_glGetProgramivARB(GL_VERTEX_PROGRAM_ARB,
GL_MAX_PROGRAM_ATTRIBS_ARB,
&vertex_program_attribs);
}
arrays->num_texture_units = texture_units;
arrays->num_vertex_program_attribs = vertex_program_attribs;
array_count += texture_units + vertex_program_attribs;
arrays->num_arrays = array_count;
arrays->arrays = calloc(array_count, sizeof(struct array_state));
arrays->arrays[0].data_type = GL_FLOAT;
arrays->arrays[0].count = 3;
arrays->arrays[0].key = GL_NORMAL_ARRAY;
arrays->arrays[0].normalized = GL_TRUE;
arrays->arrays[0].old_DrawArrays_possible = GL_TRUE;
arrays->arrays[1].data_type = GL_FLOAT;
arrays->arrays[1].count = 4;
arrays->arrays[1].key = GL_COLOR_ARRAY;
arrays->arrays[1].normalized = GL_TRUE;
arrays->arrays[1].old_DrawArrays_possible = GL_TRUE;
arrays->arrays[2].data_type = GL_FLOAT;
arrays->arrays[2].count = 1;
arrays->arrays[2].key = GL_INDEX_ARRAY;
arrays->arrays[2].old_DrawArrays_possible = GL_TRUE;
arrays->arrays[3].data_type = GL_UNSIGNED_BYTE;
arrays->arrays[3].count = 1;
arrays->arrays[3].key = GL_EDGE_FLAG_ARRAY;
arrays->arrays[3].old_DrawArrays_possible = GL_TRUE;
for (i = 0; i < texture_units; i++) {
arrays->arrays[4 + i].data_type = GL_FLOAT;
arrays->arrays[4 + i].count = 4;
arrays->arrays[4 + i].key = GL_TEXTURE_COORD_ARRAY;
arrays->arrays[4 + i].old_DrawArrays_possible = (i == 0);
arrays->arrays[4 + i].index = i;
arrays->arrays[4 + i].header[1] = i + GL_TEXTURE0;
}
i = 4 + texture_units;
if (got_fog) {
arrays->arrays[i].data_type = GL_FLOAT;
arrays->arrays[i].count = 1;
arrays->arrays[i].key = GL_FOG_COORDINATE_ARRAY;
arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
i++;
}
if (got_secondary_color) {
arrays->arrays[i].data_type = GL_FLOAT;
arrays->arrays[i].count = 3;
arrays->arrays[i].key = GL_SECONDARY_COLOR_ARRAY;
arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
arrays->arrays[i].normalized = GL_TRUE;
i++;
}
for (j = 0; j < vertex_program_attribs; j++) {
const unsigned idx = (vertex_program_attribs - (j + 1));
arrays->arrays[idx + i].data_type = GL_FLOAT;
arrays->arrays[idx + i].count = 4;
arrays->arrays[idx + i].key = GL_VERTEX_ATTRIB_ARRAY_POINTER;
arrays->arrays[idx + i].old_DrawArrays_possible = 0;
arrays->arrays[idx + i].index = idx;
arrays->arrays[idx + i].header[1] = idx;
}
i += vertex_program_attribs;
/* Vertex array *must* be last becuase of the way that
* emit_DrawArrays_none works.
*/
arrays->arrays[i].data_type = GL_FLOAT;
arrays->arrays[i].count = 4;
arrays->arrays[i].key = GL_VERTEX_ARRAY;
arrays->arrays[i].old_DrawArrays_possible = GL_TRUE;
assert((i + 1) == arrays->num_arrays);
arrays->stack_index = 0;
arrays->stack = malloc(sizeof(struct array_stack_state)
* arrays->num_arrays
* __GL_CLIENT_ATTRIB_STACK_DEPTH);
}
/**
* Calculate the size of a single vertex for the "none" protocol. This is
* essentially the size of all the immediate-mode commands required to
* implement the enabled vertex arrays.
*/
static size_t
calculate_single_vertex_size_none(const struct array_state_vector *arrays)
{
size_t single_vertex_size = 0;
unsigned i;
for (i = 0; i < arrays->num_arrays; i++) {
if (arrays->arrays[i].enabled) {
single_vertex_size += ((uint16_t *) arrays->arrays[i].header)[0];
}
}
return single_vertex_size;
}
/**
* Emit a single element using non-DrawArrays protocol.
*/
GLubyte *
emit_element_none(GLubyte * dst,
const struct array_state_vector * arrays, unsigned index)
{
unsigned i;
for (i = 0; i < arrays->num_arrays; i++) {
if (arrays->arrays[i].enabled) {
const size_t offset = index * arrays->arrays[i].true_stride;
/* The generic attributes can have more data than is in the
* elements. This is because a vertex array can be a 2 element,
* normalized, unsigned short, but the "closest" immediate mode
* protocol is for a 4Nus. Since the sizes are small, the
* performance impact on modern processors should be negligible.
*/
(void) memset(dst, 0, ((uint16_t *) arrays->arrays[i].header)[0]);
(void) memcpy(dst, arrays->arrays[i].header,
arrays->arrays[i].header_size);
dst += arrays->arrays[i].header_size;
(void) memcpy(dst, ((GLubyte *) arrays->arrays[i].data) + offset,
arrays->arrays[i].element_size);
dst += __GLX_PAD(arrays->arrays[i].element_size);
}
}
return dst;
}
/**
* Emit a single element using "old" DrawArrays protocol from
* EXT_vertex_arrays / OpenGL 1.1.
*/
GLubyte *
emit_element_old(GLubyte * dst,
const struct array_state_vector * arrays, unsigned index)
{
unsigned i;
for (i = 0; i < arrays->num_arrays; i++) {
if (arrays->arrays[i].enabled) {
const size_t offset = index * arrays->arrays[i].true_stride;
(void) memcpy(dst, ((GLubyte *) arrays->arrays[i].data) + offset,
arrays->arrays[i].element_size);
dst += __GLX_PAD(arrays->arrays[i].element_size);
}
}
return dst;
}
struct array_state *
get_array_entry(const struct array_state_vector *arrays,
GLenum key, unsigned index)
{
unsigned i;
for (i = 0; i < arrays->num_arrays; i++) {
if ((arrays->arrays[i].key == key)
&& (arrays->arrays[i].index == index)) {
return &arrays->arrays[i];
}
}
return NULL;
}
static GLboolean
allocate_array_info_cache(struct array_state_vector *arrays,
size_t required_size)
{
#define MAX_HEADER_SIZE 20
if (arrays->array_info_cache_buffer_size < required_size) {
GLubyte *temp = realloc(arrays->array_info_cache_base,
required_size + MAX_HEADER_SIZE);
if (temp == NULL) {
return GL_FALSE;
}
arrays->array_info_cache_base = temp;
arrays->array_info_cache = temp + MAX_HEADER_SIZE;
arrays->array_info_cache_buffer_size = required_size;
}
arrays->array_info_cache_size = required_size;
return GL_TRUE;
}
/**
*/
void
fill_array_info_cache(struct array_state_vector *arrays)
{
GLboolean old_DrawArrays_possible;
unsigned i;
/* Determine how many arrays are enabled.
*/
arrays->enabled_client_array_count = 0;
old_DrawArrays_possible = arrays->old_DrawArrays_possible;
for (i = 0; i < arrays->num_arrays; i++) {
if (arrays->arrays[i].enabled) {
arrays->enabled_client_array_count++;
old_DrawArrays_possible &= arrays->arrays[i].old_DrawArrays_possible;
}
}
if (arrays->new_DrawArrays_possible) {
assert(!arrays->new_DrawArrays_possible);
}
else if (old_DrawArrays_possible) {
const size_t required_size = arrays->enabled_client_array_count * 12;
uint32_t *info;
if (!allocate_array_info_cache(arrays, required_size)) {
return;
}
info = (uint32_t *) arrays->array_info_cache;
for (i = 0; i < arrays->num_arrays; i++) {
if (arrays->arrays[i].enabled) {
*(info++) = arrays->arrays[i].data_type;
*(info++) = arrays->arrays[i].count;
*(info++) = arrays->arrays[i].key;
}
}
arrays->DrawArrays = emit_DrawArrays_old;
arrays->DrawElements = emit_DrawElements_old;
}
else {
arrays->DrawArrays = emit_DrawArrays_none;
arrays->DrawElements = emit_DrawElements_none;
}
arrays->array_info_cache_valid = GL_TRUE;
}
/**
* Emit a \c glDrawArrays command using the "none" protocol. That is,
* emit immediate-mode commands that are equivalent to the requiested
* \c glDrawArrays command. This is used with servers that don't support
* the OpenGL 1.1 / EXT_vertex_arrays DrawArrays protocol or in cases where
* vertex state is enabled that is not compatible with that protocol.
*/
void
emit_DrawArrays_none(GLenum mode, GLint first, GLsizei count)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
(const __GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
size_t single_vertex_size;
GLubyte *pc;
unsigned i;
static const uint16_t begin_cmd[2] = { 8, X_GLrop_Begin };
static const uint16_t end_cmd[2] = { 4, X_GLrop_End };
single_vertex_size = calculate_single_vertex_size_none(arrays);
pc = gc->pc;
(void) memcpy(pc, begin_cmd, 4);
*(int *) (pc + 4) = mode;
pc += 8;
for (i = 0; i < count; i++) {
if ((pc + single_vertex_size) >= gc->bufEnd) {
pc = __glXFlushRenderBuffer(gc, pc);
}
pc = emit_element_none(pc, arrays, first + i);
}
if ((pc + 4) >= gc->bufEnd) {
pc = __glXFlushRenderBuffer(gc, pc);
}
(void) memcpy(pc, end_cmd, 4);
pc += 4;
gc->pc = pc;
if (gc->pc > gc->limit) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
}
}
/**
* Emit the header data for the GL 1.1 / EXT_vertex_arrays DrawArrays
* protocol.
*
* \param gc GLX context.
* \param arrays Array state.
* \param elements_per_request Location to store the number of elements that
* can fit in a single Render / RenderLarge
* command.
* \param total_request Total number of requests for a RenderLarge
* command. If a Render command is used, this
* will be zero.
* \param mode Drawing mode.
* \param count Number of vertices.
*
* \returns
* A pointer to the buffer for array data.
*/
static GLubyte *
emit_DrawArrays_header_old(struct glx_context * gc,
struct array_state_vector *arrays,
size_t * elements_per_request,
unsigned int *total_requests,
GLenum mode, GLsizei count)
{
size_t command_size;
size_t single_vertex_size;
const unsigned header_size = 16;
unsigned i;
GLubyte *pc;
/* Determine the size of the whole command. This includes the header,
* the ARRAY_INFO data and the array data. Once this size is calculated,
* it will be known whether a Render or RenderLarge command is needed.
*/
single_vertex_size = 0;
for (i = 0; i < arrays->num_arrays; i++) {
if (arrays->arrays[i].enabled) {
single_vertex_size += __GLX_PAD(arrays->arrays[i].element_size);
}
}
command_size = arrays->array_info_cache_size + header_size
+ (single_vertex_size * count);
/* Write the header for either a Render command or a RenderLarge
* command. After the header is written, write the ARRAY_INFO data.
*/
if (command_size > gc->maxSmallRenderCommandSize) {
/* maxSize is the maximum amount of data can be stuffed into a single
* packet. sz_xGLXRenderReq is added because bufSize is the maximum
* packet size minus sz_xGLXRenderReq.
*/
const size_t maxSize = (gc->bufSize + sz_xGLXRenderReq)
- sz_xGLXRenderLargeReq;
unsigned vertex_requests;
/* Calculate the number of data packets that will be required to send
* the whole command. To do this, the number of verticies that
* will fit in a single buffer must be calculated.
*
* The important value here is elements_per_request. This is the
* number of complete array elements that will fit in a single
* buffer. There may be some wasted space at the end of the buffer,
* but splitting elements across buffer boundries would be painful.
*/
elements_per_request[0] = maxSize / single_vertex_size;
vertex_requests = (count + elements_per_request[0] - 1)
/ elements_per_request[0];
*total_requests = vertex_requests + 1;
__glXFlushRenderBuffer(gc, gc->pc);
command_size += 4;
pc = ((GLubyte *) arrays->array_info_cache) - (header_size + 4);
*(uint32_t *) (pc + 0) = command_size;
*(uint32_t *) (pc + 4) = X_GLrop_DrawArrays;
*(uint32_t *) (pc + 8) = count;
*(uint32_t *) (pc + 12) = arrays->enabled_client_array_count;
*(uint32_t *) (pc + 16) = mode;
__glXSendLargeChunk(gc, 1, *total_requests, pc,
header_size + 4 + arrays->array_info_cache_size);
pc = gc->pc;
}
else {
if ((gc->pc + command_size) >= gc->bufEnd) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
}
pc = gc->pc;
*(uint16_t *) (pc + 0) = command_size;
*(uint16_t *) (pc + 2) = X_GLrop_DrawArrays;
*(uint32_t *) (pc + 4) = count;
*(uint32_t *) (pc + 8) = arrays->enabled_client_array_count;
*(uint32_t *) (pc + 12) = mode;
pc += header_size;
(void) memcpy(pc, arrays->array_info_cache,
arrays->array_info_cache_size);
pc += arrays->array_info_cache_size;
*elements_per_request = count;
*total_requests = 0;
}
return pc;
}
/**
*/
void
emit_DrawArrays_old(GLenum mode, GLint first, GLsizei count)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
(const __GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
GLubyte *pc;
size_t elements_per_request;
unsigned total_requests = 0;
unsigned i;
size_t total_sent = 0;
pc = emit_DrawArrays_header_old(gc, arrays, &elements_per_request,
&total_requests, mode, count);
/* Write the arrays.
*/
if (total_requests == 0) {
assert(elements_per_request >= count);
for (i = 0; i < count; i++) {
pc = emit_element_old(pc, arrays, i + first);
}
assert(pc <= gc->bufEnd);
gc->pc = pc;
if (gc->pc > gc->limit) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
}
}
else {
unsigned req;
for (req = 2; req <= total_requests; req++) {
if (count < elements_per_request) {
elements_per_request = count;
}
pc = gc->pc;
for (i = 0; i < elements_per_request; i++) {
pc = emit_element_old(pc, arrays, i + first);
}
first += elements_per_request;
total_sent += (size_t) (pc - gc->pc);
__glXSendLargeChunk(gc, req, total_requests, gc->pc, pc - gc->pc);
count -= elements_per_request;
}
}
}
void
emit_DrawElements_none(GLenum mode, GLsizei count, GLenum type,
const GLvoid * indices)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
(const __GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
static const uint16_t begin_cmd[2] = { 8, X_GLrop_Begin };
static const uint16_t end_cmd[2] = { 4, X_GLrop_End };
GLubyte *pc;
size_t single_vertex_size;
unsigned i;
single_vertex_size = calculate_single_vertex_size_none(arrays);
if ((gc->pc + single_vertex_size) >= gc->bufEnd) {
gc->pc = __glXFlushRenderBuffer(gc, gc->pc);
}
pc = gc->pc;
(void) memcpy(pc, begin_cmd, 4);
*(int *) (pc + 4) = mode;
pc += 8;
for (i = 0; i < count; i++) {
unsigned index = 0;
if ((pc + single_vertex_size) >= gc->bufEnd) {
pc = __glXFlushRenderBuffer(gc, pc);
}
switch (type) {
case GL_UNSIGNED_INT:
index = (unsigned) (((GLuint *) indices)[i]);
break;
case GL_UNSIGNED_SHORT:
index = (unsigned) (((GLushort *) indices)[i]);
break;
case GL_UNSIGNED_BYTE:
index = (unsigned) (((GLubyte *) indices)[i]);
break;
}
pc = emit_element_none(pc, arrays, index);
}
if ((pc + 4) >= gc->bufEnd) {
pc = __glXFlushRenderBuffer(gc, pc);
}
(void) memcpy(pc, end_cmd, 4);
pc += 4;
gc->pc = pc;
if (gc->pc > gc->limit) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
}
}
/**
*/
void
emit_DrawElements_old(GLenum mode, GLsizei count, GLenum type,
const GLvoid * indices)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
(const __GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
GLubyte *pc;
size_t elements_per_request;
unsigned total_requests = 0;
unsigned i;
unsigned req;
unsigned req_element = 0;
pc = emit_DrawArrays_header_old(gc, arrays, &elements_per_request,
&total_requests, mode, count);
/* Write the arrays.
*/
req = 2;
while (count > 0) {
if (count < elements_per_request) {
elements_per_request = count;
}
switch (type) {
case GL_UNSIGNED_INT:{
const GLuint *ui_ptr = (const GLuint *) indices + req_element;
for (i = 0; i < elements_per_request; i++) {
const GLint index = (GLint) * (ui_ptr++);
pc = emit_element_old(pc, arrays, index);
}
break;
}
case GL_UNSIGNED_SHORT:{
const GLushort *us_ptr = (const GLushort *) indices + req_element;
for (i = 0; i < elements_per_request; i++) {
const GLint index = (GLint) * (us_ptr++);
pc = emit_element_old(pc, arrays, index);
}
break;
}
case GL_UNSIGNED_BYTE:{
const GLubyte *ub_ptr = (const GLubyte *) indices + req_element;
for (i = 0; i < elements_per_request; i++) {
const GLint index = (GLint) * (ub_ptr++);
pc = emit_element_old(pc, arrays, index);
}
break;
}
}
if (total_requests != 0) {
__glXSendLargeChunk(gc, req, total_requests, gc->pc, pc - gc->pc);
pc = gc->pc;
req++;
}
count -= elements_per_request;
req_element += elements_per_request;
}
assert((total_requests == 0) || ((req - 1) == total_requests));
if (total_requests == 0) {
assert(pc <= gc->bufEnd);
gc->pc = pc;
if (gc->pc > gc->limit) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
}
}
}
/**
* Validate that the \c mode parameter to \c glDrawArrays, et. al. is valid.
* If it is not valid, then an error code is set in the GLX context.
*
* \returns
* \c GL_TRUE if the argument is valid, \c GL_FALSE if is not.
*/
static GLboolean
validate_mode(struct glx_context * gc, GLenum mode)
{
switch (mode) {
case GL_POINTS:
case GL_LINE_STRIP:
case GL_LINE_LOOP:
case GL_LINES:
case GL_TRIANGLE_STRIP:
case GL_TRIANGLE_FAN:
case GL_TRIANGLES:
case GL_QUAD_STRIP:
case GL_QUADS:
case GL_POLYGON:
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return GL_FALSE;
}
return GL_TRUE;
}
/**
* Validate that the \c count parameter to \c glDrawArrays, et. al. is valid.
* A value less than zero is invalid and will result in \c GL_INVALID_VALUE
* being set. A value of zero will not result in an error being set, but
* will result in \c GL_FALSE being returned.
*
* \returns
* \c GL_TRUE if the argument is valid, \c GL_FALSE if it is not.
*/
static GLboolean
validate_count(struct glx_context * gc, GLsizei count)
{
if (count < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
}
return (count > 0);
}
/**
* Validate that the \c type parameter to \c glDrawElements, et. al. is
* valid. Only \c GL_UNSIGNED_BYTE, \c GL_UNSIGNED_SHORT, and
* \c GL_UNSIGNED_INT are valid.
*
* \returns
* \c GL_TRUE if the argument is valid, \c GL_FALSE if it is not.
*/
static GLboolean
validate_type(struct glx_context * gc, GLenum type)
{
switch (type) {
case GL_UNSIGNED_INT:
case GL_UNSIGNED_SHORT:
case GL_UNSIGNED_BYTE:
return GL_TRUE;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return GL_FALSE;
}
}
void
__indirect_glDrawArrays(GLenum mode, GLint first, GLsizei count)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
(const __GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
if (validate_mode(gc, mode) && validate_count(gc, count)) {
if (!arrays->array_info_cache_valid) {
fill_array_info_cache(arrays);
}
arrays->DrawArrays(mode, first, count);
}
}
void
__indirect_glArrayElement(GLint index)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
(const __GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
size_t single_vertex_size;
single_vertex_size = calculate_single_vertex_size_none(arrays);
if ((gc->pc + single_vertex_size) >= gc->bufEnd) {
gc->pc = __glXFlushRenderBuffer(gc, gc->pc);
}
gc->pc = emit_element_none(gc->pc, arrays, index);
if (gc->pc > gc->limit) {
(void) __glXFlushRenderBuffer(gc, gc->pc);
}
}
void
__indirect_glDrawElements(GLenum mode, GLsizei count, GLenum type,
const GLvoid * indices)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
(const __GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
if (validate_mode(gc, mode) && validate_count(gc, count)
&& validate_type(gc, type)) {
if (!arrays->array_info_cache_valid) {
fill_array_info_cache(arrays);
}
arrays->DrawElements(mode, count, type, indices);
}
}
void
__indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end,
GLsizei count, GLenum type,
const GLvoid * indices)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
(const __GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
if (validate_mode(gc, mode) && validate_count(gc, count)
&& validate_type(gc, type)) {
if (end < start) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
if (!arrays->array_info_cache_valid) {
fill_array_info_cache(arrays);
}
arrays->DrawElements(mode, count, type, indices);
}
}
void
__indirect_glMultiDrawArrays(GLenum mode, const GLint *first,
const GLsizei *count, GLsizei primcount)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
(const __GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
GLsizei i;
if (validate_mode(gc, mode)) {
if (!arrays->array_info_cache_valid) {
fill_array_info_cache(arrays);
}
for (i = 0; i < primcount; i++) {
if (validate_count(gc, count[i])) {
arrays->DrawArrays(mode, first[i], count[i]);
}
}
}
}
void
__indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count,
GLenum type, const GLvoid ** indices,
GLsizei primcount)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
(const __GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
GLsizei i;
if (validate_mode(gc, mode) && validate_type(gc, type)) {
if (!arrays->array_info_cache_valid) {
fill_array_info_cache(arrays);
}
for (i = 0; i < primcount; i++) {
if (validate_count(gc, count[i])) {
arrays->DrawElements(mode, count[i], type, indices[i]);
}
}
}
}
#define COMMON_ARRAY_DATA_INIT(a, PTR, TYPE, STRIDE, COUNT, NORMALIZED, HDR_SIZE, OPCODE) \
do { \
(a)->data = PTR; \
(a)->data_type = TYPE; \
(a)->user_stride = STRIDE; \
(a)->count = COUNT; \
(a)->normalized = NORMALIZED; \
\
(a)->element_size = __glXTypeSize( TYPE ) * COUNT; \
(a)->true_stride = (STRIDE == 0) \
? (a)->element_size : STRIDE; \
\
(a)->header_size = HDR_SIZE; \
((uint16_t *) (a)->header)[0] = __GLX_PAD((a)->header_size + (a)->element_size); \
((uint16_t *) (a)->header)[1] = OPCODE; \
} while(0)
void
__indirect_glVertexPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid * pointer)
{
static const uint16_t short_ops[5] = {
0, 0, X_GLrop_Vertex2sv, X_GLrop_Vertex3sv, X_GLrop_Vertex4sv
};
static const uint16_t int_ops[5] = {
0, 0, X_GLrop_Vertex2iv, X_GLrop_Vertex3iv, X_GLrop_Vertex4iv
};
static const uint16_t float_ops[5] = {
0, 0, X_GLrop_Vertex2fv, X_GLrop_Vertex3fv, X_GLrop_Vertex4fv
};
static const uint16_t double_ops[5] = {
0, 0, X_GLrop_Vertex2dv, X_GLrop_Vertex3dv, X_GLrop_Vertex4dv
};
uint16_t opcode;
struct glx_context *gc = __glXGetCurrentContext();
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
struct array_state *a;
if (size < 2 || size > 4 || stride < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
switch (type) {
case GL_SHORT:
opcode = short_ops[size];
break;
case GL_INT:
opcode = int_ops[size];
break;
case GL_FLOAT:
opcode = float_ops[size];
break;
case GL_DOUBLE:
opcode = double_ops[size];
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
a = get_array_entry(arrays, GL_VERTEX_ARRAY, 0);
assert(a != NULL);
COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_FALSE, 4,
opcode);
if (a->enabled) {
arrays->array_info_cache_valid = GL_FALSE;
}
}
void
__indirect_glNormalPointer(GLenum type, GLsizei stride,
const GLvoid * pointer)
{
uint16_t opcode;
struct glx_context *gc = __glXGetCurrentContext();
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
struct array_state *a;
if (stride < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
switch (type) {
case GL_BYTE:
opcode = X_GLrop_Normal3bv;
break;
case GL_SHORT:
opcode = X_GLrop_Normal3sv;
break;
case GL_INT:
opcode = X_GLrop_Normal3iv;
break;
case GL_FLOAT:
opcode = X_GLrop_Normal3fv;
break;
case GL_DOUBLE:
opcode = X_GLrop_Normal3dv;
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
a = get_array_entry(arrays, GL_NORMAL_ARRAY, 0);
assert(a != NULL);
COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 3, GL_TRUE, 4, opcode);
if (a->enabled) {
arrays->array_info_cache_valid = GL_FALSE;
}
}
void
__indirect_glColorPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid * pointer)
{
static const uint16_t byte_ops[5] = {
0, 0, 0, X_GLrop_Color3bv, X_GLrop_Color4bv
};
static const uint16_t ubyte_ops[5] = {
0, 0, 0, X_GLrop_Color3ubv, X_GLrop_Color4ubv
};
static const uint16_t short_ops[5] = {
0, 0, 0, X_GLrop_Color3sv, X_GLrop_Color4sv
};
static const uint16_t ushort_ops[5] = {
0, 0, 0, X_GLrop_Color3usv, X_GLrop_Color4usv
};
static const uint16_t int_ops[5] = {
0, 0, 0, X_GLrop_Color3iv, X_GLrop_Color4iv
};
static const uint16_t uint_ops[5] = {
0, 0, 0, X_GLrop_Color3uiv, X_GLrop_Color4uiv
};
static const uint16_t float_ops[5] = {
0, 0, 0, X_GLrop_Color3fv, X_GLrop_Color4fv
};
static const uint16_t double_ops[5] = {
0, 0, 0, X_GLrop_Color3dv, X_GLrop_Color4dv
};
uint16_t opcode;
struct glx_context *gc = __glXGetCurrentContext();
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
struct array_state *a;
if (size < 3 || size > 4 || stride < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
switch (type) {
case GL_BYTE:
opcode = byte_ops[size];
break;
case GL_UNSIGNED_BYTE:
opcode = ubyte_ops[size];
break;
case GL_SHORT:
opcode = short_ops[size];
break;
case GL_UNSIGNED_SHORT:
opcode = ushort_ops[size];
break;
case GL_INT:
opcode = int_ops[size];
break;
case GL_UNSIGNED_INT:
opcode = uint_ops[size];
break;
case GL_FLOAT:
opcode = float_ops[size];
break;
case GL_DOUBLE:
opcode = double_ops[size];
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
a = get_array_entry(arrays, GL_COLOR_ARRAY, 0);
assert(a != NULL);
COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_TRUE, 4, opcode);
if (a->enabled) {
arrays->array_info_cache_valid = GL_FALSE;
}
}
void
__indirect_glIndexPointer(GLenum type, GLsizei stride, const GLvoid * pointer)
{
uint16_t opcode;
struct glx_context *gc = __glXGetCurrentContext();
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
struct array_state *a;
if (stride < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
switch (type) {
case GL_UNSIGNED_BYTE:
opcode = X_GLrop_Indexubv;
break;
case GL_SHORT:
opcode = X_GLrop_Indexsv;
break;
case GL_INT:
opcode = X_GLrop_Indexiv;
break;
case GL_FLOAT:
opcode = X_GLrop_Indexfv;
break;
case GL_DOUBLE:
opcode = X_GLrop_Indexdv;
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
a = get_array_entry(arrays, GL_INDEX_ARRAY, 0);
assert(a != NULL);
COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 1, GL_FALSE, 4, opcode);
if (a->enabled) {
arrays->array_info_cache_valid = GL_FALSE;
}
}
void
__indirect_glEdgeFlagPointer(GLsizei stride, const GLvoid * pointer)
{
struct glx_context *gc = __glXGetCurrentContext();
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
struct array_state *a;
if (stride < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
a = get_array_entry(arrays, GL_EDGE_FLAG_ARRAY, 0);
assert(a != NULL);
COMMON_ARRAY_DATA_INIT(a, pointer, GL_UNSIGNED_BYTE, stride, 1, GL_FALSE,
4, X_GLrop_EdgeFlagv);
if (a->enabled) {
arrays->array_info_cache_valid = GL_FALSE;
}
}
void
__indirect_glTexCoordPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid * pointer)
{
static const uint16_t short_ops[5] = {
0, X_GLrop_TexCoord1sv, X_GLrop_TexCoord2sv, X_GLrop_TexCoord3sv,
X_GLrop_TexCoord4sv
};
static const uint16_t int_ops[5] = {
0, X_GLrop_TexCoord1iv, X_GLrop_TexCoord2iv, X_GLrop_TexCoord3iv,
X_GLrop_TexCoord4iv
};
static const uint16_t float_ops[5] = {
0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2fv, X_GLrop_TexCoord3fv,
X_GLrop_TexCoord4fv
};
static const uint16_t double_ops[5] = {
0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2dv, X_GLrop_TexCoord3dv,
X_GLrop_TexCoord4dv
};
static const uint16_t mshort_ops[5] = {
0, X_GLrop_MultiTexCoord1svARB, X_GLrop_MultiTexCoord2svARB,
X_GLrop_MultiTexCoord3svARB, X_GLrop_MultiTexCoord4svARB
};
static const uint16_t mint_ops[5] = {
0, X_GLrop_MultiTexCoord1ivARB, X_GLrop_MultiTexCoord2ivARB,
X_GLrop_MultiTexCoord3ivARB, X_GLrop_MultiTexCoord4ivARB
};
static const uint16_t mfloat_ops[5] = {
0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2fvARB,
X_GLrop_MultiTexCoord3fvARB, X_GLrop_MultiTexCoord4fvARB
};
static const uint16_t mdouble_ops[5] = {
0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2dvARB,
X_GLrop_MultiTexCoord3dvARB, X_GLrop_MultiTexCoord4dvARB
};
uint16_t opcode;
struct glx_context *gc = __glXGetCurrentContext();
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
struct array_state *a;
unsigned header_size;
unsigned index;
if (size < 1 || size > 4 || stride < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
index = arrays->active_texture_unit;
if (index == 0) {
switch (type) {
case GL_SHORT:
opcode = short_ops[size];
break;
case GL_INT:
opcode = int_ops[size];
break;
case GL_FLOAT:
opcode = float_ops[size];
break;
case GL_DOUBLE:
opcode = double_ops[size];
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
header_size = 4;
}
else {
switch (type) {
case GL_SHORT:
opcode = mshort_ops[size];
break;
case GL_INT:
opcode = mint_ops[size];
break;
case GL_FLOAT:
opcode = mfloat_ops[size];
break;
case GL_DOUBLE:
opcode = mdouble_ops[size];
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
header_size = 8;
}
a = get_array_entry(arrays, GL_TEXTURE_COORD_ARRAY, index);
assert(a != NULL);
COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_FALSE,
header_size, opcode);
if (a->enabled) {
arrays->array_info_cache_valid = GL_FALSE;
}
}
void
__indirect_glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid * pointer)
{
uint16_t opcode;
struct glx_context *gc = __glXGetCurrentContext();
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
struct array_state *a;
if (size != 3 || stride < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
switch (type) {
case GL_BYTE:
opcode = 4126;
break;
case GL_UNSIGNED_BYTE:
opcode = 4131;
break;
case GL_SHORT:
opcode = 4127;
break;
case GL_UNSIGNED_SHORT:
opcode = 4132;
break;
case GL_INT:
opcode = 4128;
break;
case GL_UNSIGNED_INT:
opcode = 4133;
break;
case GL_FLOAT:
opcode = 4129;
break;
case GL_DOUBLE:
opcode = 4130;
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
a = get_array_entry(arrays, GL_SECONDARY_COLOR_ARRAY, 0);
if (a == NULL) {
__glXSetError(gc, GL_INVALID_OPERATION);
return;
}
COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, GL_TRUE, 4, opcode);
if (a->enabled) {
arrays->array_info_cache_valid = GL_FALSE;
}
}
void
__indirect_glFogCoordPointer(GLenum type, GLsizei stride,
const GLvoid * pointer)
{
uint16_t opcode;
struct glx_context *gc = __glXGetCurrentContext();
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
struct array_state *a;
if (stride < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
switch (type) {
case GL_FLOAT:
opcode = 4124;
break;
case GL_DOUBLE:
opcode = 4125;
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
a = get_array_entry(arrays, GL_FOG_COORD_ARRAY, 0);
if (a == NULL) {
__glXSetError(gc, GL_INVALID_OPERATION);
return;
}
COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, 1, GL_FALSE, 4, opcode);
if (a->enabled) {
arrays->array_info_cache_valid = GL_FALSE;
}
}
void
__indirect_glVertexAttribPointer(GLuint index, GLint size,
GLenum type, GLboolean normalized,
GLsizei stride, const GLvoid * pointer)
{
static const uint16_t short_ops[5] = { 0, 4189, 4190, 4191, 4192 };
static const uint16_t float_ops[5] = { 0, 4193, 4194, 4195, 4196 };
static const uint16_t double_ops[5] = { 0, 4197, 4198, 4199, 4200 };
uint16_t opcode;
struct glx_context *gc = __glXGetCurrentContext();
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
struct array_state_vector *arrays = state->array_state;
struct array_state *a;
unsigned true_immediate_count;
unsigned true_immediate_size;
if ((size < 1) || (size > 4) || (stride < 0)
|| (index > arrays->num_vertex_program_attribs)) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
if (normalized && (type != GL_FLOAT) && (type != GL_DOUBLE)) {
switch (type) {
case GL_BYTE:
opcode = X_GLrop_VertexAttrib4NbvARB;
break;
case GL_UNSIGNED_BYTE:
opcode = X_GLrop_VertexAttrib4NubvARB;
break;
case GL_SHORT:
opcode = X_GLrop_VertexAttrib4NsvARB;
break;
case GL_UNSIGNED_SHORT:
opcode = X_GLrop_VertexAttrib4NusvARB;
break;
case GL_INT:
opcode = X_GLrop_VertexAttrib4NivARB;
break;
case GL_UNSIGNED_INT:
opcode = X_GLrop_VertexAttrib4NuivARB;
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
true_immediate_count = 4;
}
else {
true_immediate_count = size;
switch (type) {
case GL_BYTE:
opcode = X_GLrop_VertexAttrib4bvARB;
true_immediate_count = 4;
break;
case GL_UNSIGNED_BYTE:
opcode = X_GLrop_VertexAttrib4ubvARB;
true_immediate_count = 4;
break;
case GL_SHORT:
opcode = short_ops[size];
break;
case GL_UNSIGNED_SHORT:
opcode = X_GLrop_VertexAttrib4usvARB;
true_immediate_count = 4;
break;
case GL_INT:
opcode = X_GLrop_VertexAttrib4ivARB;
true_immediate_count = 4;
break;
case GL_UNSIGNED_INT:
opcode = X_GLrop_VertexAttrib4uivARB;
true_immediate_count = 4;
break;
case GL_FLOAT:
opcode = float_ops[size];
break;
case GL_DOUBLE:
opcode = double_ops[size];
break;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
}
a = get_array_entry(arrays, GL_VERTEX_ATTRIB_ARRAY_POINTER, index);
if (a == NULL) {
__glXSetError(gc, GL_INVALID_OPERATION);
return;
}
COMMON_ARRAY_DATA_INIT(a, pointer, type, stride, size, normalized, 8,
opcode);
true_immediate_size = __glXTypeSize(type) * true_immediate_count;
((uint16_t *) (a)->header)[0] = __GLX_PAD(a->header_size
+ true_immediate_size);
if (a->enabled) {
arrays->array_info_cache_valid = GL_FALSE;
}
}
/**
* I don't have 100% confidence that this is correct. The different rules
* about whether or not generic vertex attributes alias "classic" vertex
* attributes (i.e., attrib1 ?= primary color) between ARB_vertex_program,
* ARB_vertex_shader, and NV_vertex_program are a bit confusing. My
* feeling is that the client-side doesn't have to worry about it. The
* client just sends all the data to the server and lets the server deal
* with it.
*/
void
__indirect_glVertexAttribPointerNV(GLuint index, GLint size,
GLenum type, GLsizei stride,
const GLvoid * pointer)
{
struct glx_context *gc = __glXGetCurrentContext();
GLboolean normalized = GL_FALSE;
switch (type) {
case GL_UNSIGNED_BYTE:
if (size != 4) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
}
normalized = GL_TRUE;
case GL_SHORT:
case GL_FLOAT:
case GL_DOUBLE:
__indirect_glVertexAttribPointer(index, size, type,
normalized, stride, pointer);
return;
default:
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
}
void
__indirect_glClientActiveTexture(GLenum texture)
{
struct glx_context *const gc = __glXGetCurrentContext();
__GLXattribute *const state =
(__GLXattribute *) (gc->client_state_private);
struct array_state_vector *const arrays = state->array_state;
const GLint unit = (GLint) texture - GL_TEXTURE0;
if ((unit < 0) || (unit >= arrays->num_texture_units)) {
__glXSetError(gc, GL_INVALID_ENUM);
return;
}
arrays->active_texture_unit = unit;
}
/**
* Modify the enable state for the selected array
*/
GLboolean
__glXSetArrayEnable(__GLXattribute * state, GLenum key, unsigned index,
GLboolean enable)
{
struct array_state_vector *arrays = state->array_state;
struct array_state *a;
/* Texture coordinate arrays have an implict index set when the
* application calls glClientActiveTexture.
*/
if (key == GL_TEXTURE_COORD_ARRAY) {
index = arrays->active_texture_unit;
}
a = get_array_entry(arrays, key, index);
if ((a != NULL) && (a->enabled != enable)) {
a->enabled = enable;
arrays->array_info_cache_valid = GL_FALSE;
}
return (a != NULL);
}
void
__glXArrayDisableAll(__GLXattribute * state)
{
struct array_state_vector *arrays = state->array_state;
unsigned i;
for (i = 0; i < arrays->num_arrays; i++) {
arrays->arrays[i].enabled = GL_FALSE;
}
arrays->array_info_cache_valid = GL_FALSE;
}
/**
*/
GLboolean
__glXGetArrayEnable(const __GLXattribute * const state,
GLenum key, unsigned index, GLintptr * dest)
{
const struct array_state_vector *arrays = state->array_state;
const struct array_state *a =
get_array_entry((struct array_state_vector *) arrays,
key, index);
if (a != NULL) {
*dest = (GLintptr) a->enabled;
}
return (a != NULL);
}
/**
*/
GLboolean
__glXGetArrayType(const __GLXattribute * const state,
GLenum key, unsigned index, GLintptr * dest)
{
const struct array_state_vector *arrays = state->array_state;
const struct array_state *a =
get_array_entry((struct array_state_vector *) arrays,
key, index);
if (a != NULL) {
*dest = (GLintptr) a->data_type;
}
return (a != NULL);
}
/**
*/
GLboolean
__glXGetArraySize(const __GLXattribute * const state,
GLenum key, unsigned index, GLintptr * dest)
{
const struct array_state_vector *arrays = state->array_state;
const struct array_state *a =
get_array_entry((struct array_state_vector *) arrays,
key, index);
if (a != NULL) {
*dest = (GLintptr) a->count;
}
return (a != NULL);
}
/**
*/
GLboolean
__glXGetArrayStride(const __GLXattribute * const state,
GLenum key, unsigned index, GLintptr * dest)
{
const struct array_state_vector *arrays = state->array_state;
const struct array_state *a =
get_array_entry((struct array_state_vector *) arrays,
key, index);
if (a != NULL) {
*dest = (GLintptr) a->user_stride;
}
return (a != NULL);
}
/**
*/
GLboolean
__glXGetArrayPointer(const __GLXattribute * const state,
GLenum key, unsigned index, void **dest)
{
const struct array_state_vector *arrays = state->array_state;
const struct array_state *a =
get_array_entry((struct array_state_vector *) arrays,
key, index);
if (a != NULL) {
*dest = (void *) (a->data);
}
return (a != NULL);
}
/**
*/
GLboolean
__glXGetArrayNormalized(const __GLXattribute * const state,
GLenum key, unsigned index, GLintptr * dest)
{
const struct array_state_vector *arrays = state->array_state;
const struct array_state *a =
get_array_entry((struct array_state_vector *) arrays,
key, index);
if (a != NULL) {
*dest = (GLintptr) a->normalized;
}
return (a != NULL);
}
/**
*/
GLuint
__glXGetActiveTextureUnit(const __GLXattribute * const state)
{
return state->array_state->active_texture_unit;
}
void
__glXPushArrayState(__GLXattribute * state)
{
struct array_state_vector *arrays = state->array_state;
struct array_stack_state *stack =
&arrays->stack[(arrays->stack_index * arrays->num_arrays)];
unsigned i;
/* XXX are we pushing _all_ the necessary fields? */
for (i = 0; i < arrays->num_arrays; i++) {
stack[i].data = arrays->arrays[i].data;
stack[i].data_type = arrays->arrays[i].data_type;
stack[i].user_stride = arrays->arrays[i].user_stride;
stack[i].count = arrays->arrays[i].count;
stack[i].key = arrays->arrays[i].key;
stack[i].index = arrays->arrays[i].index;
stack[i].enabled = arrays->arrays[i].enabled;
}
arrays->active_texture_unit_stack[arrays->stack_index] =
arrays->active_texture_unit;
arrays->stack_index++;
}
void
__glXPopArrayState(__GLXattribute * state)
{
struct array_state_vector *arrays = state->array_state;
struct array_stack_state *stack;
unsigned i;
arrays->stack_index--;
stack = &arrays->stack[(arrays->stack_index * arrays->num_arrays)];
for (i = 0; i < arrays->num_arrays; i++) {
switch (stack[i].key) {
case GL_NORMAL_ARRAY:
__indirect_glNormalPointer(stack[i].data_type,
stack[i].user_stride, stack[i].data);
break;
case GL_COLOR_ARRAY:
__indirect_glColorPointer(stack[i].count,
stack[i].data_type,
stack[i].user_stride, stack[i].data);
break;
case GL_INDEX_ARRAY:
__indirect_glIndexPointer(stack[i].data_type,
stack[i].user_stride, stack[i].data);
break;
case GL_EDGE_FLAG_ARRAY:
__indirect_glEdgeFlagPointer(stack[i].user_stride, stack[i].data);
break;
case GL_TEXTURE_COORD_ARRAY:
arrays->active_texture_unit = stack[i].index;
__indirect_glTexCoordPointer(stack[i].count,
stack[i].data_type,
stack[i].user_stride, stack[i].data);
break;
case GL_SECONDARY_COLOR_ARRAY:
__indirect_glSecondaryColorPointer(stack[i].count,
stack[i].data_type,
stack[i].user_stride,
stack[i].data);
break;
case GL_FOG_COORDINATE_ARRAY:
__indirect_glFogCoordPointer(stack[i].data_type,
stack[i].user_stride, stack[i].data);
break;
}
__glXSetArrayEnable(state, stack[i].key, stack[i].index,
stack[i].enabled);
}
arrays->active_texture_unit =
arrays->active_texture_unit_stack[arrays->stack_index];
}