From 2e1868b560315a8b20d688e646c489a5ad93eeae Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 16 Jun 2004 09:25:21 +0000 Subject: DRI trunk-20040613 import --- GL/glx/g_disptab.c | 44 +++--- GL/glx/g_disptab.h | 8 + GL/glx/g_disptab_EXT.c | 68 +++++---- GL/glx/g_disptab_EXT.h | 33 ++++- GL/glx/g_render.c | 160 ++++++++++++++++++++ GL/glx/g_renderswap.c | 12 ++ GL/glx/glxcmds.c | 385 ++++++++++++++++++++++++++++++++++++------------- GL/glx/glxcmdsswap.c | 205 +++++++++++++++----------- GL/glx/glxcontext.h | 1 - GL/glx/glxdrawable.h | 5 +- GL/glx/glxext.c | 3 + GL/glx/glxext.h | 17 ++- GL/glx/glxscreens.c | 93 ++---------- GL/glx/glxscreens.h | 6 +- GL/glx/glxserver.h | 1 + GL/glx/glxutil.c | 62 +------- GL/glx/glxutil.h | 1 - GL/glx/impsize.h | 3 +- GL/glx/render2.c | 13 +- GL/glx/render2swap.c | 3 +- GL/glx/rensize.c | 8 + GL/glx/rensizetab.c | 28 ++-- GL/glx/single2.c | 36 ++++- GL/glx/single2swap.c | 53 +------ GL/glx/singlesize.c | 298 +++++++++++++++++++++++++++++++++++--- 25 files changed, 1064 insertions(+), 482 deletions(-) (limited to 'GL/glx') diff --git a/GL/glx/g_disptab.c b/GL/glx/g_disptab.c index b85d5d844..85bca389a 100644 --- a/GL/glx/g_disptab.c +++ b/GL/glx/g_disptab.c @@ -54,18 +54,18 @@ __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE] = { __glXQueryExtensionsString, __glXQueryServerString, __glXClientInfo, - __glXNoSuchSingleOpcode, /* glXGetFBConfigs */ - __glXNoSuchSingleOpcode, /* glXCreatePixmap */ - __glXNoSuchSingleOpcode, /* glXDestroyPixmap */ - __glXNoSuchSingleOpcode, /* glXCreateNewContext */ + __glXGetFBConfigs, + __glXCreatePixmap, + __glXDestroyGLXPixmap, /* glXDestroyPixmap */ + __glXCreateNewContext, __glXNoSuchSingleOpcode, /* glXQueryContext */ __glXMakeContextCurrent, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, /* glXCreatePbuffer */ + __glXNoSuchSingleOpcode, /* glXDestroyPbuffer */ + __glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXCreateWindow */ + __glXNoSuchSingleOpcode, /* glXDestroyWindow */ __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, @@ -425,7 +425,7 @@ __GLXdispatchRenderProcPtr __glXRenderTable[] = { __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDisp_SampleCoverageARB, __glXDisp_WindowPos3fARB /* 230 */ }; @@ -451,18 +451,18 @@ __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE] = { __glXSwapQueryExtensionsString, __glXSwapQueryServerString, __glXSwapClientInfo, - __glXNoSuchSingleOpcode, /* glXGetFBConfigs */ - __glXNoSuchSingleOpcode, /* glXCreatePixmap */ - __glXNoSuchSingleOpcode, /* glXDestroyPixmap */ - __glXNoSuchSingleOpcode, /* glXCreateNewContext */ + __glXSwapGetFBConfigs, + __glXSwapCreatePixmap, + __glXSwapDestroyGLXPixmap, /* glXDestroyPixmap */ + __glXSwapCreateNewContext, __glXNoSuchSingleOpcode, /* glXQueryContext */ __glXSwapMakeContextCurrent, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, /* glXCreatePbuffer */ + __glXNoSuchSingleOpcode, /* glXDestroyPbuffer */ + __glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXCreateWindow */ + __glXNoSuchSingleOpcode, /* glXDestroyWindow */ __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, @@ -822,6 +822,6 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable[__GLX_RENDER_TABLE_SIZE] = { __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDispSwap_SampleCoverageARB, __glXDispSwap_WindowPos3fARB /* 230 */ }; diff --git a/GL/glx/g_disptab.h b/GL/glx/g_disptab.h index 65a594d3e..6702980b9 100644 --- a/GL/glx/g_disptab.h +++ b/GL/glx/g_disptab.h @@ -52,6 +52,9 @@ extern int __glXQueryExtensionsString(__GLXclientState*, GLbyte*); extern int __glXQueryServerString(__GLXclientState*, GLbyte*); extern int __glXClientInfo(__GLXclientState*, GLbyte*); extern int __glXMakeContextCurrent(__GLXclientState*, GLbyte*); +extern int __glXGetFBConfigs(__GLXclientState*, GLbyte*); +extern int __glXCreateNewContext(__GLXclientState*, GLbyte*); +extern int __glXCreatePixmap(__GLXclientState*, GLbyte*); extern int __glXDisp_NewList(__GLXclientState*, GLbyte*); extern int __glXDisp_EndList(__GLXclientState*, GLbyte*); @@ -325,6 +328,7 @@ extern void __glXDisp_MultiTexCoord4dvARB(GLbyte*); extern void __glXDisp_MultiTexCoord4fvARB(GLbyte*); extern void __glXDisp_MultiTexCoord4ivARB(GLbyte*); extern void __glXDisp_MultiTexCoord4svARB(GLbyte*); +extern void __glXDisp_SampleCoverageARB(GLbyte *); extern void __glXDisp_WindowPos3fARB(GLbyte *); extern int __glXSwapRender(__GLXclientState*, GLbyte*); @@ -348,6 +352,9 @@ extern int __glXSwapQueryExtensionsString(__GLXclientState*, GLbyte*); extern int __glXSwapQueryServerString(__GLXclientState*, GLbyte*); extern int __glXSwapClientInfo(__GLXclientState*, GLbyte*); extern int __glXSwapMakeContextCurrent(__GLXclientState*, GLbyte*); +extern int __glXSwapGetFBConfigs(__GLXclientState*, GLbyte*); +extern int __glXSwapCreateNewContext(__GLXclientState*, GLbyte*); +extern int __glXSwapCreatePixmap(__GLXclientState*, GLbyte*); extern int __glXDispSwap_NewList(__GLXclientState*, GLbyte*); extern int __glXDispSwap_EndList(__GLXclientState*, GLbyte*); @@ -621,6 +628,7 @@ extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte*); +extern void __glXDispSwap_SampleCoverageARB(GLbyte *); extern void __glXDispSwap_WindowPos3fARB(GLbyte *); #define __GLX_MIN_GLXCMD_OPCODE 1 diff --git a/GL/glx/g_disptab_EXT.c b/GL/glx/g_disptab_EXT.c index be82264a4..c37a236db 100644 --- a/GL/glx/g_disptab_EXT.c +++ b/GL/glx/g_disptab_EXT.c @@ -2104,22 +2104,22 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __ __glXDisp_CopyTexSubImage1D, /* 4121 */ __glXDisp_CopyTexSubImage2D, /* 4122 */ __glXDisp_CopyTexSubImage3D, /* 4123 */ - __glXNoSuchRenderOpcode, /* 4124 */ - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, /* 4130 */ - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDisp_FogCoordfv, /* 4124 */ + __glXDisp_FogCoorddv, /* 4125 */ + __glXDisp_SecondaryColor3bv, /* 4126 */ + __glXDisp_SecondaryColor3sv, /* 4127 */ + __glXDisp_SecondaryColor3iv, /* 4128 */ + __glXDisp_SecondaryColor3fv, /* 4129 */ + __glXDisp_SecondaryColor3dv, /* 4130 */ + __glXDisp_SecondaryColor3ubv, /* 4131 */ + __glXDisp_SecondaryColor3usv, /* 4132 */ + __glXDisp_SecondaryColor3uiv, /* 4133 */ + __glXDisp_BlendFuncSeparate, /* 4134 */ + __glXNoSuchRenderOpcode, /* 4135 */ + __glXNoSuchRenderOpcode, /* 4136 */ + __glXNoSuchRenderOpcode, /* 4137 */ + __glXNoSuchRenderOpcode, /* 4138 */ + __glXNoSuchRenderOpcode, /* 4139 */ __glXNoSuchRenderOpcode, /* 4140 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, @@ -2201,6 +2201,8 @@ __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4219 */ __glXDisp_ActiveStencilFaceEXT, /* 4220 */ + __glXDisp_PointParameteri, /* 4221 */ + __glXDisp_PointParameteriv, /* 4222 */ }; __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1] = { __glXDisp_AreTexturesResidentEXT, /* 11 */ @@ -4282,22 +4284,22 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT __glXDispSwap_CopyTexSubImage1D, /* 4121 */ __glXDispSwap_CopyTexSubImage2D, /* 4122 */ __glXDispSwap_CopyTexSubImage3D, /* 4123 */ - __glXNoSuchRenderOpcode, /* 4124 */ - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, /* 4130 */ - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, - __glXNoSuchRenderOpcode, + __glXDispSwap_FogCoordfv, /* 4124 */ + __glXDispSwap_FogCoorddv, /* 4125 */ + __glXDispSwap_SecondaryColor3bv, /* 4126 */ + __glXDispSwap_SecondaryColor3sv, /* 4127 */ + __glXDispSwap_SecondaryColor3iv, /* 4128 */ + __glXDispSwap_SecondaryColor3fv, /* 4129 */ + __glXDispSwap_SecondaryColor3dv, /* 4130 */ + __glXDispSwap_SecondaryColor3ubv, /* 4131 */ + __glXDispSwap_SecondaryColor3usv, /* 4132 */ + __glXDispSwap_SecondaryColor3uiv, /* 4133 */ + __glXDisp_BlendFuncSeparate, /* 4134 */ + __glXNoSuchRenderOpcode, /* 4135 */ + __glXNoSuchRenderOpcode, /* 4136 */ + __glXNoSuchRenderOpcode, /* 4137 */ + __glXNoSuchRenderOpcode, /* 4138 */ + __glXNoSuchRenderOpcode, /* 4139 */ __glXNoSuchRenderOpcode, /* 4140 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, @@ -4379,6 +4381,8 @@ __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4219 */ __glXDispSwap_ActiveStencilFaceEXT, /* 4220 */ + __glXDispSwap_PointParameteri, /* 4221 */ + __glXDispSwap_PointParameteriv, /* 4222 */ }; __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1] = { __glXDispSwap_AreTexturesResidentEXT, /* 11 */ diff --git a/GL/glx/g_disptab_EXT.h b/GL/glx/g_disptab_EXT.h index 0d118c5c4..52eb44324 100644 --- a/GL/glx/g_disptab_EXT.h +++ b/GL/glx/g_disptab_EXT.h @@ -69,6 +69,37 @@ extern void __glXDisp_CopyTexSubImage2D(GLbyte*); extern void __glXDisp_CopyTexSubImage3D(GLbyte*); extern void __glXDisp_PointParameterfARB(GLbyte*); extern void __glXDisp_PointParameterfvARB(GLbyte*); + +extern void __glXDisp_FogCoordfv(GLbyte *); +extern void __glXDisp_FogCoorddv(GLbyte *); +extern void __glXDispSwap_FogCoordfv(GLbyte *); +extern void __glXDispSwap_FogCoorddv(GLbyte *); + +extern void __glXDisp_SecondaryColor3bv(GLbyte *); +extern void __glXDisp_SecondaryColor3sv(GLbyte *); +extern void __glXDisp_SecondaryColor3iv(GLbyte *); +extern void __glXDisp_SecondaryColor3ubv(GLbyte *); +extern void __glXDisp_SecondaryColor3usv(GLbyte *); +extern void __glXDisp_SecondaryColor3uiv(GLbyte *); +extern void __glXDisp_SecondaryColor3fv(GLbyte *); +extern void __glXDisp_SecondaryColor3dv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3bv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3sv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3iv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3ubv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3usv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3uiv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3fv(GLbyte *); +extern void __glXDispSwap_SecondaryColor3dv(GLbyte *); + +extern void __glXDisp_BlendFuncSeparate(GLbyte *); +extern void __glXDispSwap_BlendFuncSeparate(GLbyte *); + +extern void __glXDisp_PointParameteri(GLbyte *); +extern void __glXDisp_PointParameteriv(GLbyte *); +extern void __glXDispSwap_PointParameteri(GLbyte *); +extern void __glXDispSwap_PointParameteriv(GLbyte *); + extern void __glXDisp_ActiveStencilFaceEXT(GLbyte*); extern int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState*, GLbyte*); @@ -112,7 +143,7 @@ extern void __glXDispSwap_PointParameterfvARB(GLbyte*); extern void __glXDispSwap_ActiveStencilFaceEXT(GLbyte*); #define __GLX_MIN_RENDER_OPCODE_EXT 2053 -#define __GLX_MAX_RENDER_OPCODE_EXT 4220 +#define __GLX_MAX_RENDER_OPCODE_EXT 4222 #define __GLX_MIN_VENDPRIV_OPCODE_EXT 11 #define __GLX_MAX_VENDPRIV_OPCODE_EXT 14 #define __GLX_VENDPRIV_TABLE_SIZE_EXT (__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1) diff --git a/GL/glx/g_render.c b/GL/glx/g_render.c index 35e083399..c1aa6a115 100644 --- a/GL/glx/g_render.c +++ b/GL/glx/g_render.c @@ -59,6 +59,155 @@ void __glXDisp_Begin(GLbyte *pc) ); } +#define __GLX_SWAP_GLbyte(ptr) +#define __GLX_SWAP_GLshort(ptr) __GLX_SWAP_SHORT(ptr) +#define __GLX_SWAP_GLint(ptr) __GLX_SWAP_INT(ptr) +#define __GLX_SWAP_GLubyte(ptr) +#define __GLX_SWAP_GLushort(ptr) __GLX_SWAP_SHORT(ptr) +#define __GLX_SWAP_GLuint(ptr) __GLX_SWAP_INT(ptr) +#define __GLX_SWAP_GLdouble(ptr) __GLX_SWAP_DOUBLE(ptr) +#define __GLX_SWAP_GLfloat(ptr) __GLX_SWAP_FLOAT(ptr) + +#define __GLX_SWAP_GLbyte_ARRAY(ptr,count) (void) swapEnd; (void) swapPC; (void) sw; +#define __GLX_SWAP_GLshort_ARRAY(ptr,count) __GLX_SWAP_SHORT_ARRAY(ptr,count) +#define __GLX_SWAP_GLint_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) +#define __GLX_SWAP_GLenum_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) +#define __GLX_SWAP_GLubyte_ARRAY(ptr,count) (void) swapEnd; (void) swapPC; (void) sw; +#define __GLX_SWAP_GLushort_ARRAY(ptr,count) __GLX_SWAP_SHORT_ARRAY(ptr,count) +#define __GLX_SWAP_GLuint_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) +#define __GLX_SWAP_GLdouble_ARRAY(ptr,count) __GLX_SWAP_DOUBLE_ARRAY(ptr,count) +#define __GLX_SWAP_GLfloat_ARRAY(ptr,count) __GLX_SWAP_FLOAT_ARRAY(ptr,count) + +#ifdef __GLX_ALIGN64 +/* If type is not GLdouble, the compiler should optimize this away. + */ +# define GLX_DO_ALIGN_MAGIC(count, type) \ + do { \ + if ( (sizeof(type) == 8) && ((unsigned long)(pc) & 7)) \ + { \ + __GLX_MEM_COPY(pc-4, pc, (count * sizeof( type ) )); \ + pc -= 4; \ + } \ + } while( 0 ) +#else +# define GLX_DO_ALIGN_MAGIC(count, type) +#endif + +#define dispatch_template_1( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + GLX_DO_ALIGN_MAGIC( 1, type ); \ + gl ## name ( (type *) pc ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + __GLX_DECLARE_SWAP_VARIABLES; \ + GLX_DO_ALIGN_MAGIC( 1, type ); \ + __GLX_SWAP_ ## type ( pc ); \ + gl ## name ( (type *) pc ); \ + } + +#define dispatch_template_3( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + GLX_DO_ALIGN_MAGIC( 3, type ); \ + gl ## name ( (type *) pc ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + __GLX_DECLARE_SWAP_VARIABLES; \ + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ + GLX_DO_ALIGN_MAGIC( 3, type ); \ + __GLX_SWAP_ ## type ## _ARRAY(pc, 3); \ + gl ## name ( (type *) pc ); \ + } + +#define dispatch_template_4( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + GLX_DO_ALIGN_MAGIC( 4, type ); \ + gl ## name ( (type *) pc ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + __GLX_DECLARE_SWAP_VARIABLES; \ + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ + GLX_DO_ALIGN_MAGIC( 4, type ); \ + __GLX_SWAP_ ## type ## _ARRAY(pc, 4); \ + gl ## name ( (type *) pc ); \ + } + +#define dispatch_template_4s( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + GLX_DO_ALIGN_MAGIC( 4, type ); \ + gl ## name ( ((type *) pc)[0], ((type *) pc)[1], \ + ((type *) pc)[2], ((type *) pc)[3] ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + __GLX_DECLARE_SWAP_VARIABLES; \ + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ + GLX_DO_ALIGN_MAGIC( 4, type ); \ + __GLX_SWAP_ ## type ## _ARRAY(pc, 4); \ + gl ## name ( ((type *) pc)[0], ((type *) pc)[1], \ + ((type *) pc)[2], ((type *) pc)[3] ); \ + } + +/** + * \bug All of the enum1 templates need to be updated to handle the case where + * \c type is \c GLdouble. When the type is a double, the data comes before + * the enum. This is also the reason the invocation of the + * \c GLX_DO_ALIGN_MAGIC macro was removed. + */ +#define dispatch_template_enum1_1s( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + gl ## name ( *(GLenum *) (pc + 0), \ + *(type *) (pc + 4) ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + __GLX_DECLARE_SWAP_VARIABLES; \ + __GLX_SWAP_INT (pc + 0); \ + __GLX_SWAP_ ## type (pc + 4); \ + gl ## name ( *(GLenum *) (pc + 0), \ + *(type *) (pc + 4) ); \ + } + +#define dispatch_template_enum1_Vv( name, type ) \ + void __glXDisp_ ## name ( GLbyte * pc ) \ + { \ + gl ## name ( *(GLenum *) (pc + 0), \ + (type *) (pc + 4) ); \ + } \ + void __glXDispSwap_ ## name ( GLbyte * pc ) \ + { \ + GLenum pname; GLint compsize; \ + __GLX_DECLARE_SWAP_VARIABLES; \ + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ + __GLX_SWAP_INT(pc + 0); \ + pname = *(GLenum *)(pc + 0); \ + compsize = __gl ## name ## _size(pname); \ + if (compsize < 0) compsize = 0; \ + __GLX_SWAP_ ## type ## _ARRAY(pc + 4, compsize); \ + gl ## name ( *(GLenum *) (pc + 0), \ + (type *) (pc + 4) ); \ + } + +dispatch_template_1( FogCoordfv, GLfloat ) +dispatch_template_1( FogCoorddv, GLdouble ) +dispatch_template_3( SecondaryColor3bv, GLbyte ) +dispatch_template_3( SecondaryColor3sv, GLshort ) +dispatch_template_3( SecondaryColor3iv, GLint ) +dispatch_template_3( SecondaryColor3ubv, GLubyte ) +dispatch_template_3( SecondaryColor3usv, GLushort ) +dispatch_template_3( SecondaryColor3uiv, GLuint ) +dispatch_template_3( SecondaryColor3fv, GLfloat ) +dispatch_template_3( SecondaryColor3dv, GLdouble ) + +dispatch_template_4s( BlendFuncSeparate, GLenum ) + void __glXDisp_Color3bv(GLbyte *pc) { glColor3bv( @@ -2097,6 +2246,9 @@ void __glXDisp_PointParameterfvARB(GLbyte *pc) ); } +dispatch_template_enum1_1s(PointParameteri, GLint) +dispatch_template_enum1_Vv(PointParameteriv, GLint) + void __glXDisp_ActiveStencilFaceEXT(GLbyte *pc) { glActiveStencilFaceEXT( @@ -2112,3 +2264,11 @@ void __glXDisp_WindowPos3fARB(GLbyte *pc) *(GLfloat *)(pc + 8) ); } + +void __glXDisp_SampleCoverageARB(GLbyte *pc) +{ + glSampleCoverageARB( + *(GLfloat *)(pc + 0), + *(GLboolean *)(pc + 4) + ); +} diff --git a/GL/glx/g_renderswap.c b/GL/glx/g_renderswap.c index 6a199d8c7..5c74d2598 100644 --- a/GL/glx/g_renderswap.c +++ b/GL/glx/g_renderswap.c @@ -3364,3 +3364,15 @@ void __glXDispSwap_WindowPos3fARB(GLbyte *pc) *(GLfloat *)(pc + 8) ); } + +void __glXDispSwap_SampleCoverageARB(GLbyte *pc) +{ + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_SWAP_FLOAT(pc + 0); + __GLX_SWAP_INT(pc + 4); + + glSampleCoverageARB( + *(GLfloat *)(pc + 0), + *(GLboolean *)(pc + 4) + ); +} diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index b6f358f2e..d3c9f2565 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -47,6 +47,7 @@ #include "glxutil.h" #include "glxext.h" #include "GL/glx_ansic.h" +#include "glcontextmodes.h" /************************************************************************/ @@ -68,29 +69,32 @@ static __GLimports imports = { NULL }; -static int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId, - GLXDrawable readId, GLXContextID contextId, GLXContextTag tag ); +static int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); /************************************************************************/ -/* -** Create a GL context with the given properties. -*/ -int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) +/** + * Create a GL context with the given properties. This routine is used + * to implement \c glXCreateContext, \c glXCreateNewContext, and + * \c glXCreateContextWithConfigSGIX. This works becuase of the hack way + * that GLXFBConfigs are implemented. Basically, the FBConfigID is the + * same as the VisualID. + */ + +int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, + GLXContextID shareList, VisualID visual, + GLuint screen, GLboolean isDirect) { ClientPtr client = cl->client; - xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; VisualPtr pVisual; ScreenPtr pScreen; __GLXcontext *glxc, *shareglxc; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; __GLXscreenInfo *pGlxScreen; __GLinterface *shareGC; - GLXContextID gcId = req->context; - GLXContextID shareList = req->shareList; - VisualID visual = req->visual; - GLuint screen = req->screen; - GLboolean isDirect = req->isDirect; GLint i; /* @@ -123,13 +127,9 @@ int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) ** subset of Visuals that are supported by this implementation of the ** OpenGL. */ - pGlxVisual = pGlxScreen->pGlxVisual; - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == visual) { - break; - } - } - if (i == pGlxScreen->numVisuals) { + + modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual ); + if (modes == NULL) { /* ** Visual not support on this screen by this OpenGL implementation. */ @@ -192,22 +192,15 @@ int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) glxc->pScreen = pScreen; glxc->pGlxScreen = pGlxScreen; glxc->pVisual = pVisual; - glxc->pGlxVisual = pGlxVisual; + glxc->modes = modes; if (!isDirect) { - __GLcontextModes *modes; - /* - ** first build __GLcontextModes from __GLXvisualConfig - */ - modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes)); - glxc->modes = modes; - __glXFormatGLModes(modes, pGlxVisual); /* ** Allocate a GL context */ imports.other = (void *)glxc; - glxc->gc = (*pGlxScreen->createContext)(&imports, modes, shareGC); + glxc->gc = (*pGlxScreen->createContext)(&imports, glxc->modes, shareGC); if (!glxc->gc) { __glXFree(glxc); client->errorValue = gcId; @@ -245,6 +238,31 @@ int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) return Success; } + +int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; + return DoCreateContext( cl, req->context, req->shareList, req->visual, + req->screen, req->isDirect ); +} + + +int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); +} + + +int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextWithConfigSGIXReq *req = + (xGLXCreateContextWithConfigSGIXReq *) pc; + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); +} + /* ** Destroy a GL context as an X resource. */ @@ -370,24 +388,24 @@ int __glXMakeCurrent(__GLXclientState *cl, GLbyte *pc) { xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; - return DoMakeCurrent( cl, req->drawable, req->drawable, - req->context, req->oldContextTag ); + return DoMakeCurrent( cl, req->drawable, req->drawable, + req->context, req->oldContextTag ); } int __glXMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) { xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; - return DoMakeCurrent( cl, req->drawable, req->readdrawable, - req->context, req->oldContextTag ); + return DoMakeCurrent( cl, req->drawable, req->readdrawable, + req->context, req->oldContextTag ); } int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) { xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; - return DoMakeCurrent( cl, req->drawable, req->readable, - req->context, req->oldContextTag ); + return DoMakeCurrent( cl, req->drawable, req->readable, + req->context, req->oldContextTag ); } @@ -449,7 +467,7 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId, ** Check if pixmap and context are similar. */ if (drawPixmap->pScreen != glxc->pScreen || - drawPixmap->pGlxVisual != glxc->pGlxVisual) { + drawPixmap->modes->visualID != glxc->modes->visualID) { client->errorValue = drawId; return BadMatch; } @@ -471,9 +489,9 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId, } -static int DoMakeCurrent( __GLXclientState *cl, - GLXDrawable drawId, GLXDrawable readId, - GLXContextID contextId, GLXContextTag tag ) +int DoMakeCurrent( __GLXclientState *cl, + GLXDrawable drawId, GLXDrawable readId, + GLXContextID contextId, GLXContextTag tag ) { ClientPtr client = cl->client; DrawablePtr pDraw; @@ -879,18 +897,19 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc) return Success; } -int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) + +int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, + GLboolean do_swap) { ClientPtr client = cl->client; - xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; xGLXGetVisualConfigsReply reply; __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; CARD32 buf[__GLX_TOTAL_CONFIG]; - unsigned int screen; - int i, p; + int p; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - screen = req->screen; if (screen >= screenInfo.numScreens) { /* The client library must send a valid screen number. */ client->errorValue = screen; @@ -905,77 +924,206 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) reply.type = X_Reply; reply.sequenceNumber = client->sequence; + if ( do_swap ) { + __GLX_SWAP_SHORT(&reply.sequenceNumber); + __GLX_SWAP_INT(&reply.length); + __GLX_SWAP_INT(&reply.numVisuals); + __GLX_SWAP_INT(&reply.numProps); + } + WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply); - for (i=0; i < pGlxScreen->numVisuals; i++) { - pGlxVisual = &pGlxScreen->pGlxVisual[i]; - if (pGlxVisual->vid == 0) { + for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { + if (modes->visualID == 0) { /* not a usable visual */ continue; } p = 0; - buf[p++] = pGlxVisual->vid; - buf[p++] = pGlxVisual->class; - buf[p++] = pGlxVisual->rgba; - - buf[p++] = pGlxVisual->redSize; - buf[p++] = pGlxVisual->greenSize; - buf[p++] = pGlxVisual->blueSize; - buf[p++] = pGlxVisual->alphaSize; - buf[p++] = pGlxVisual->accumRedSize; - buf[p++] = pGlxVisual->accumGreenSize; - buf[p++] = pGlxVisual->accumBlueSize; - buf[p++] = pGlxVisual->accumAlphaSize; - - buf[p++] = pGlxVisual->doubleBuffer; - buf[p++] = pGlxVisual->stereo; - - buf[p++] = pGlxVisual->bufferSize; - buf[p++] = pGlxVisual->depthSize; - buf[p++] = pGlxVisual->stencilSize; - buf[p++] = pGlxVisual->auxBuffers; - buf[p++] = pGlxVisual->level; + buf[p++] = modes->visualID; + buf[p++] = _gl_convert_to_x_visual_type( modes->visualType ); + buf[p++] = modes->rgbMode; + + buf[p++] = modes->redBits; + buf[p++] = modes->greenBits; + buf[p++] = modes->blueBits; + buf[p++] = modes->alphaBits; + buf[p++] = modes->accumRedBits; + buf[p++] = modes->accumGreenBits; + buf[p++] = modes->accumBlueBits; + buf[p++] = modes->accumAlphaBits; + + buf[p++] = modes->doubleBufferMode; + buf[p++] = modes->stereoMode; + + buf[p++] = modes->rgbBits; + buf[p++] = modes->depthBits; + buf[p++] = modes->stencilBits; + buf[p++] = modes->numAuxBuffers; + buf[p++] = modes->level; /* ** Add token/value pairs for extensions. */ buf[p++] = GLX_VISUAL_CAVEAT_EXT; - buf[p++] = pGlxVisual->visualRating; - buf[p++] = GLX_TRANSPARENT_TYPE_EXT; - buf[p++] = pGlxVisual->transparentPixel; - buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; - buf[p++] = pGlxVisual->transparentRed; - buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; - buf[p++] = pGlxVisual->transparentGreen; - buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; - buf[p++] = pGlxVisual->transparentBlue; - buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; - buf[p++] = pGlxVisual->transparentAlpha; - buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; - buf[p++] = pGlxVisual->transparentIndex; - + buf[p++] = modes->visualRating; + buf[p++] = GLX_TRANSPARENT_TYPE; + buf[p++] = modes->transparentPixel; + buf[p++] = GLX_TRANSPARENT_RED_VALUE; + buf[p++] = modes->transparentRed; + buf[p++] = GLX_TRANSPARENT_GREEN_VALUE; + buf[p++] = modes->transparentGreen; + buf[p++] = GLX_TRANSPARENT_BLUE_VALUE; + buf[p++] = modes->transparentBlue; + buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE; + buf[p++] = modes->transparentAlpha; + buf[p++] = GLX_TRANSPARENT_INDEX_VALUE; + buf[p++] = modes->transparentIndex; + + if ( do_swap ) { + __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); + } WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, (char *)buf); } return Success; } +int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; + return DoGetVisualConfigs( cl, req->screen, GL_FALSE ); +} + + + +#define __GLX_TOTAL_FBCONFIG_ATTRIBS (28) + +/** + * Send the set of GLXFBConfigs to the client. There is not currently + * and interface into the driver on the server-side to get GLXFBConfigs, + * so we "invent" some based on the \c __GLXvisualConfig structures that + * the driver does supply. + * + * The reply format for both \c glXGetFBConfigs and \c glXGetFBConfigsSGIX + * is the same, so this routine pulls double duty. + */ + +int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) +{ + ClientPtr client = cl->client; + xGLXGetFBConfigsReply reply; + __GLXscreenInfo *pGlxScreen; + CARD32 buf[__GLX_TOTAL_FBCONFIG_ATTRIBS * 2]; + int p; + __GLcontextModes *modes; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + + + if (screen >= screenInfo.numScreens) { + /* The client library must send a valid screen number. */ + client->errorValue = screen; + return BadValue; + } + pGlxScreen = &__glXActiveScreens[screen]; + + reply.numFBConfigs = pGlxScreen->numUsableVisuals; + reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS; + reply.length = (reply.numAttribs * reply.numFBConfigs); + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + + if ( do_swap ) { + __GLX_SWAP_SHORT(&reply.sequenceNumber); + __GLX_SWAP_INT(&reply.length); + __GLX_SWAP_INT(&reply.numFBConfigs); + __GLX_SWAP_INT(&reply.numAttribs); + } + + WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply); + + for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { + if (modes->visualID == 0) { + /* not a usable visual */ + continue; + } + p = 0; + +#define WRITE_PAIR(tag,value) \ + do { buf[p++] = tag ; buf[p++] = value ; } while( 0 ) + + WRITE_PAIR( GLX_VISUAL_ID, modes->visualID ); + WRITE_PAIR( GLX_FBCONFIG_ID, modes->visualID ); + WRITE_PAIR( GLX_X_RENDERABLE, GL_TRUE ); + + WRITE_PAIR( GLX_RGBA, modes->rgbMode ); + WRITE_PAIR( GLX_DOUBLEBUFFER, modes->doubleBufferMode ); + WRITE_PAIR( GLX_STEREO, modes->stereoMode ); + + WRITE_PAIR( GLX_BUFFER_SIZE, modes->rgbBits ); + WRITE_PAIR( GLX_LEVEL, modes->level ); + WRITE_PAIR( GLX_AUX_BUFFERS, modes->numAuxBuffers ); + WRITE_PAIR( GLX_RED_SIZE, modes->redBits ); + WRITE_PAIR( GLX_GREEN_SIZE, modes->greenBits ); + WRITE_PAIR( GLX_BLUE_SIZE, modes->blueBits ); + WRITE_PAIR( GLX_ALPHA_SIZE, modes->alphaBits ); + WRITE_PAIR( GLX_ACCUM_RED_SIZE, modes->accumRedBits ); + WRITE_PAIR( GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits ); + WRITE_PAIR( GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits ); + WRITE_PAIR( GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits ); + WRITE_PAIR( GLX_DEPTH_SIZE, modes->depthBits ); + WRITE_PAIR( GLX_STENCIL_SIZE, modes->stencilBits ); + + WRITE_PAIR( GLX_X_VISUAL_TYPE, modes->visualType ); + + /* + ** Add token/value pairs for extensions. + */ + WRITE_PAIR( GLX_CONFIG_CAVEAT, modes->visualRating ); + WRITE_PAIR( GLX_TRANSPARENT_TYPE, modes->transparentPixel ); + WRITE_PAIR( GLX_TRANSPARENT_RED_VALUE, modes->transparentRed ); + WRITE_PAIR( GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen ); + WRITE_PAIR( GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue ); + WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha ); + WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex ); + WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod ); + + if ( do_swap ) { + __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_FBCONFIG_ATTRIBS * 2); + } + WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_FBCONFIG_ATTRIBS * 2, + (char *)buf); + } + return Success; +} + + +int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + return DoGetFBConfigs( cl, req->screen, GL_FALSE ); +} + + +int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; + return DoGetFBConfigs( cl, req->screen, GL_FALSE ); +} + + /* ** Create a GLX Pixmap from an X Pixmap. */ -int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) +int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, + GLuint screenNum, XID pixmapId, XID glxpixmapId) { ClientPtr client = cl->client; - xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; - VisualID visual = req->visual; - GLuint screenNum = req->screen; - XID pixmapId = req->pixmap; - XID glxpixmapId = req->glxpixmap; DrawablePtr pDraw; ScreenPtr pScreen; VisualPtr pVisual; __GLXpixmap *pGlxPixmap; __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; int i; pDraw = (DrawablePtr) LookupDrawable(pixmapId, client); @@ -1016,13 +1164,8 @@ int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) ** Get configuration of the visual. */ pGlxScreen = &__glXActiveScreens[screenNum]; - pGlxVisual = pGlxScreen->pGlxVisual; - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == visual) { - break; - } - } - if (i == pGlxScreen->numVisuals) { + modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual ); + if (modes == NULL) { /* ** Visual not support on this screen by this OpenGL implementation. */ @@ -1039,11 +1182,12 @@ int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) } pGlxPixmap->pDraw = pDraw; pGlxPixmap->pGlxScreen = pGlxScreen; - pGlxPixmap->pGlxVisual = pGlxVisual; pGlxPixmap->pScreen = pScreen; pGlxPixmap->idExists = True; pGlxPixmap->refcnt = 0; + pGlxPixmap->modes = modes; + /* ** Bump the ref count on the X pixmap so it won't disappear. */ @@ -1052,6 +1196,34 @@ int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) return Success; } +int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; + return DoCreateGLXPixmap( cl, req->visual, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapWithConfigSGIXReq *req = + (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); +} + + +/** + * Destroy a GLX pixmap. This function is used for both + * \c glXDestroyGLXPixmap and \c glXDestroyPixmap. + */ + int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; @@ -1552,6 +1724,17 @@ int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc) req = (xGLXVendorPrivateReq *) pc; vendorcode = req->vendorCode; + switch( vendorcode ) { + case X_GLvop_SampleMaskSGIS: + glSampleMaskSGIS(*(GLfloat *)(pc + 4), + *(GLboolean *)(pc + 8)); + return Success; + case X_GLvop_SamplePatternSGIS: + glSamplePatternSGIS( *(GLenum *)(pc + 4)); + return Success; + } + + if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { (*__glXVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT]) @@ -1578,6 +1761,12 @@ int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) return __glXQueryContextInfoEXT(cl, pc); case X_GLXvop_MakeCurrentReadSGI: return __glXMakeCurrentReadSGI(cl, pc); + case X_GLXvop_GetFBConfigsSGIX: + return __glXGetFBConfigsSGIX(cl, pc); + case X_GLXvop_CreateContextWithConfigSGIX: + return __glXCreateContextWithConfigSGIX(cl, pc); + case X_GLXvop_CreateGLXPixmapWithConfigSGIX: + return __glXCreateGLXPixmapWithConfigSGIX(cl, pc); default: break; } diff --git a/GL/glx/glxcmdsswap.c b/GL/glx/glxcmdsswap.c index c6623db2f..6e63fc580 100644 --- a/GL/glx/glxcmdsswap.c +++ b/GL/glx/glxcmdsswap.c @@ -47,6 +47,11 @@ #include "glxext.h" #include "GL/glx_ansic.h" +static int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXSwapCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); + /************************************************************************/ /* @@ -67,7 +72,41 @@ int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->shareList); - return __glXCreateContext(cl, pc); + return DoCreateContext( cl, req->context, req->shareList, req->visual, + req->screen, req->isDirect ); +} + +int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->renderType); + __GLX_SWAP_INT(&req->shareList); + + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); +} + +int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextWithConfigSGIXReq *req = + (xGLXCreateContextWithConfigSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->renderType); + __GLX_SWAP_INT(&req->shareList); + + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); } int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc) @@ -91,7 +130,8 @@ int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); - return __glXMakeCurrent(cl, pc); + return DoMakeCurrent( cl, req->drawable, req->drawable, + req->context, req->oldContextTag ); } int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) @@ -105,7 +145,8 @@ int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); - return __glXMakeContextCurrent(cl, pc); + return DoMakeCurrent( cl, req->drawable, req->readdrawable, + req->context, req->oldContextTag ); } int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) @@ -119,7 +160,8 @@ int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); - return __glXMakeCurrentReadSGI(cl, pc); + return DoMakeCurrent( cl, req->drawable, req->readable, + req->context, req->oldContextTag ); } int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc) @@ -182,90 +224,29 @@ int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc) int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) { - ClientPtr client = cl->client; xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; - xGLXGetVisualConfigsReply reply; - __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; - CARD32 buf[__GLX_TOTAL_CONFIG]; - unsigned int screen; - int i, p; __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&req->screen); - screen = req->screen; - if (screen > screenInfo.numScreens) { - /* The client library must send a valid screen number. */ - client->errorValue = screen; - return BadValue; - } - pGlxScreen = &__glXActiveScreens[screen]; - - reply.numVisuals = pGlxScreen->numUsableVisuals; - reply.numProps = __GLX_TOTAL_CONFIG; - reply.length = (pGlxScreen->numUsableVisuals * __GLX_SIZE_CARD32 * - __GLX_TOTAL_CONFIG) >> 2; - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; - - __GLX_SWAP_SHORT(&reply.sequenceNumber); - __GLX_SWAP_INT(&reply.length); - __GLX_SWAP_INT(&reply.numVisuals); - __GLX_SWAP_INT(&reply.numProps); - WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply); - - for (i=0; i < pGlxScreen->numVisuals; i++) { - pGlxVisual = &pGlxScreen->pGlxVisual[i]; - if (pGlxVisual->vid == 0) { - /* not a usable visual */ - continue; - } - p = 0; - buf[p++] = pGlxVisual->vid; - buf[p++] = pGlxVisual->class; - buf[p++] = pGlxVisual->rgba; - - buf[p++] = pGlxVisual->redSize; - buf[p++] = pGlxVisual->greenSize; - buf[p++] = pGlxVisual->blueSize; - buf[p++] = pGlxVisual->alphaSize; - buf[p++] = pGlxVisual->accumRedSize; - buf[p++] = pGlxVisual->accumGreenSize; - buf[p++] = pGlxVisual->accumBlueSize; - buf[p++] = pGlxVisual->accumAlphaSize; - - buf[p++] = pGlxVisual->doubleBuffer; - buf[p++] = pGlxVisual->stereo; - - buf[p++] = pGlxVisual->bufferSize; - buf[p++] = pGlxVisual->depthSize; - buf[p++] = pGlxVisual->stencilSize; - buf[p++] = pGlxVisual->auxBuffers; - buf[p++] = pGlxVisual->level; - /* - ** Add token/value pairs for extensions. - */ - buf[p++] = GLX_VISUAL_CAVEAT_EXT; - buf[p++] = pGlxVisual->visualRating; - buf[p++] = GLX_TRANSPARENT_TYPE_EXT; - buf[p++] = pGlxVisual->transparentPixel; - buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; - buf[p++] = pGlxVisual->transparentRed; - buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; - buf[p++] = pGlxVisual->transparentGreen; - buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; - buf[p++] = pGlxVisual->transparentBlue; - buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; - buf[p++] = pGlxVisual->transparentAlpha; - buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; - buf[p++] = pGlxVisual->transparentIndex; - - __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); - WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, - (char *)buf); - } - return Success; + return DoGetVisualConfigs( cl, req->screen, GL_TRUE ); +} + +int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&req->screen); + return DoGetFBConfigs( cl, req->screen, GL_TRUE ); +} + +int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&req->screen); + return DoGetFBConfigs( cl, req->screen, GL_TRUE ); } int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) @@ -279,7 +260,39 @@ int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->pixmap); __GLX_SWAP_INT(&req->glxpixmap); - return __glXCreateGLXPixmap(cl, pc); + return DoCreateGLXPixmap( cl, req->visual, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pixmap); + __GLX_SWAP_INT(&req->glxpixmap); + + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXSwapCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapWithConfigSGIXReq *req = + (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pixmap); + __GLX_SWAP_INT(&req->glxpixmap); + + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); } int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) @@ -357,7 +370,7 @@ int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc) return __glXClientInfo(cl, pc); } -int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc) +int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) { xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; @@ -791,6 +804,20 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) vendorcode = req->vendorCode; + switch( vendorcode ) { + case X_GLvop_SampleMaskSGIS: + __GLX_SWAP_FLOAT(pc + 4); + __GLX_SWAP_INT(pc + 8); + glSampleMaskSGIS(*(GLfloat *)(pc + 4), + *(GLboolean *)(pc + 8)); + return Success; + case X_GLvop_SamplePatternSGIS: + __GLX_SWAP_INT(pc + 4); + glSamplePatternSGIS( *(GLenum *)(pc + 4)); + return Success; + } + + if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); @@ -818,6 +845,12 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) return __glXSwapQueryContextInfoEXT(cl, pc); case X_GLXvop_MakeCurrentReadSGI: return __glXSwapMakeCurrentReadSGI(cl, pc); + case X_GLXvop_GetFBConfigsSGIX: + return __glXSwapGetFBConfigsSGIX(cl, pc); + case X_GLXvop_CreateContextWithConfigSGIX: + return __glXSwapCreateContextWithConfigSGIX(cl, pc); + case X_GLXvop_CreateGLXPixmapWithConfigSGIX: + return __glXSwapCreateGLXPixmapWithConfigSGIX(cl, pc); default: break; } diff --git a/GL/glx/glxcontext.h b/GL/glx/glxcontext.h index 5eb72177e..9a16851f0 100644 --- a/GL/glx/glxcontext.h +++ b/GL/glx/glxcontext.h @@ -80,7 +80,6 @@ struct __GLXcontextRec { ** This context is created with respect to this visual. */ VisualRec *pVisual; - __GLXvisualConfig *pGlxVisual; /* ** The XID of this context. diff --git a/GL/glx/glxdrawable.h b/GL/glx/glxdrawable.h index 972a6045f..1d7f44352 100644 --- a/GL/glx/glxdrawable.h +++ b/GL/glx/glxdrawable.h @@ -40,7 +40,7 @@ typedef struct { DrawablePtr pDraw; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; __GLXscreenInfo *pGlxScreen; ScreenPtr pScreen; Bool idExists; @@ -69,11 +69,12 @@ struct __GLXdrawablePrivateRec { /* ** Configuration of the visual to which this drawable was created. */ - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; /* ** cached drawable size and origin */ + GLint xorigin, yorigin; GLint width, height; diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c index 4515c702c..5e6801744 100644 --- a/GL/glx/glxext.c +++ b/GL/glx/glxext.c @@ -31,6 +31,9 @@ extern __GLXextensionInfo __glDDXExtensionInfo; +void GlxWrapInitVisuals(miInitVisualsProcPtr *); +void GlxSetVisualConfigs(int nconfigs, + __GLXvisualConfig *configs, void **privates); __GLXextensionInfo *__glXExt = &__glDDXExtensionInfo; diff --git a/GL/glx/glxext.h b/GL/glx/glxext.h index 7d0383d8d..a5bf34d7f 100644 --- a/GL/glx/glxext.h +++ b/GL/glx/glxext.h @@ -71,15 +71,26 @@ extern GLboolean __glXErrorOccured(void); extern void __glXResetLargeCommandStatus(__GLXclientState*); extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); -extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc); +extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); -extern int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); -extern int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); +extern int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId, + GLXDrawable readId, GLXContextID contextId, GLXContextTag tag ); +extern int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, + GLboolean do_swap); +extern int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, + GLboolean do_swap); +extern int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, + GLXContextID shareList, VisualID visual, GLuint screen, GLboolean isDirect); +extern int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, + GLuint screenNum, XID pixmapId, XID glxpixmapId); extern void GlxExtensionInit(void); extern Bool __glXCoreType(void); +extern const char GLServerVersion[]; +extern int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap); + extern int GlxInitVisuals( #if NeedFunctionPrototypes VisualPtr * visualp, diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index aea774105..04882098a 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.10 2002/04/04 14:05:36 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.11 2003/06/23 17:35:44 eich Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -46,11 +46,13 @@ #include "glxserver.h" #include "glxutil.h" +const char GLServerVersion[] = "1.2"; static const char GLServerExtensions[] = "GL_ARB_depth_texture " "GL_ARB_imaging " "GL_ARB_multitexture " "GL_ARB_point_parameters " + "GL_ARB_point_sprite " "GL_ARB_shadow " "GL_ARB_shadow_ambient " "GL_ARB_texture_border_clamp " @@ -108,6 +110,7 @@ static const char GLServerExtensions[] = "GL_MESA_pack_invert " "GL_MESA_ycbcr_texture " "GL_NV_blend_square " + "GL_NV_point_sprite " "GL_NV_texgen_reflection " "GL_NV_texture_rectangle " "GL_SGIS_generate_mipmap " @@ -125,11 +128,15 @@ static const char GLServerExtensions[] = */ static char GLXServerVendorName[] = "SGI"; static char GLXServerVersion[] = "1.2"; -static char GLXServerExtensions[] = +static char GLXServerExtensions[] = + "GLX_ARB_multisample " "GLX_EXT_visual_info " "GLX_EXT_visual_rating " "GLX_EXT_import_context " + "GLX_OML_swap_method " "GLX_SGI_make_current_read " + "GLX_SGIS_multisample " + "GLX_SGIX_fbconfig " ; /* @@ -149,81 +156,6 @@ GLint __glXNumActiveScreens; RESTYPE __glXDrawableRes; -#if 0 -static int -CountBits(unsigned long mask) -{ - int count = 0; - - while(mask) { - count += (mask&1); - mask >>= 1; - } - - return count; -} -#endif - -#if 0 -/* -** A typical implementation would not probably not run through the screen's -** visuals to find ones that match the visual configs supplied by the DDX -** Sample OpenGL as we do here; we have done this to make this code easy to -** drop into an existing X server. -*/ -static int matchVisuals(__GLXvisualConfig *pGlxVisual, int numVisuals, - int screen) -{ - int i, j; - __GLXvisualConfig *pvis = pGlxVisual; - ScreenPtr pScreen = screenInfo.screens[screen]; - VisualPtr pVisual; - int numMatchingVisuals = 0; - int *used; - - used = (int *)__glXMalloc(pScreen->numVisuals*sizeof(int)); - __glXMemset(used, 0, pScreen->numVisuals*sizeof(int)); - - for (i=0; i < numVisuals; i++, pvis++) { - /* - ** Look through all the server's visuals to see which match. - */ - pvis->vid = 0; - pVisual = pScreen->visuals; - for (j=0; j < pScreen->numVisuals; j++, pVisual++) { - if (pvis->class == pVisual->class && - pvis->bufferSize == pVisual->nplanes && - !used[j]) { - int rBits, gBits, bBits, aBits; - - /* count bits per rgb */ - rBits = CountBits(pVisual->redMask); - gBits = CountBits(pVisual->greenMask); - bBits = CountBits(pVisual->blueMask); - aBits = 0; - if ((pvis->redSize == rBits) && - (pvis->greenSize == gBits) && - (pvis->blueSize == bBits) && - (pvis->alphaSize == aBits)) { - /* - ** We'll consider this a match. - */ - pvis->vid = pVisual->vid; - pvis->redMask = pVisual->redMask; - pvis->greenMask = pVisual->greenMask; - pvis->blueMask = pVisual->blueMask; - pvis->alphaMask = 0; - numMatchingVisuals++; - used[j] = 1; - break; - } - } - } - } - __glXFree(used); - return numMatchingVisuals; -} -#endif /* ** Destroy routine that gets called when a drawable is freed. A drawable @@ -353,14 +285,7 @@ void __glXScreenInit(GLint numscreens) if ((*__glXScreens[j]->screenProbe)(i)) { __glXActiveScreens[i] = *__glXScreens[j]; -#if 0 - /* we don't use this since matchVisuals doesn't allow alpha */ - __glXActiveScreens[i].numUsableVisuals = - matchVisuals(__glXActiveScreens[i].pGlxVisual, - __glXActiveScreens[i].numVisuals, i); -#else __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; -#endif __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions); __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); diff --git a/GL/glx/glxscreens.h b/GL/glx/glxscreens.h index 99f76dc38..9ca166b74 100644 --- a/GL/glx/glxscreens.h +++ b/GL/glx/glxscreens.h @@ -70,7 +70,11 @@ typedef struct { */ void (*createBuffer)(__GLXdrawablePrivate *glxPriv); - __GLXvisualConfig *pGlxVisual; + /** + * Linked list of valid context modes for this screen. + */ + __GLcontextModes *modes; + void **pVisualPriv; GLint numVisuals; GLint numUsableVisuals; diff --git a/GL/glx/glxserver.h b/GL/glx/glxserver.h index cfefd4096..67f5e961f 100644 --- a/GL/glx/glxserver.h +++ b/GL/glx/glxserver.h @@ -280,5 +280,6 @@ extern int __glXColorTableParameterfvSize(GLenum pname); extern int __glXColorTableParameterivSize(GLenum pname); extern int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap); +extern int __glXPointParameterivReqSize(GLbyte *pc, Bool swap); #endif /* !__GLX_server_h__ */ diff --git a/GL/glx/glxutil.c b/GL/glx/glxutil.c index 7aafd0065..4512aa5e9 100644 --- a/GL/glx/glxutil.c +++ b/GL/glx/glxutil.c @@ -44,6 +44,9 @@ #include "glxutil.h" #include "glxbuf.h" #include "GL/glx_ansic.h" +#include "GL/internal/glcore.h" +#include "GL/glxint.h" +#include "glcontextmodes.h" /************************************************************************/ @@ -214,53 +217,6 @@ __glXResizeDrawable(__GLdrawablePrivate *glPriv) } -/************************************************************************/ - -void -__glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config) -{ - __glXMemset(modes, 0, sizeof(__GLcontextModes)); - - modes->rgbMode = (config->rgba != 0); - modes->colorIndexMode = !(modes->rgbMode); - modes->doubleBufferMode = (config->doubleBuffer != 0); - modes->stereoMode = (config->stereo != 0); - - modes->haveAccumBuffer = ((config->accumRedSize + - config->accumGreenSize + - config->accumBlueSize + - config->accumAlphaSize) > 0); - modes->haveDepthBuffer = (config->depthSize > 0); - modes->haveStencilBuffer = (config->stencilSize > 0); - - modes->redBits = config->redSize; - modes->greenBits = config->greenSize; - modes->blueBits = config->blueSize; - modes->alphaBits = config->alphaSize; - modes->redMask = config->redMask; - modes->greenMask = config->greenMask; - modes->blueMask = config->blueMask; - modes->alphaMask = config->alphaMask; -#if 0 - modes->rgbBits = modes->redBits + modes->greenBits + - modes->blueBits + modes->alphaBits; -#endif - assert( !modes->rgbMode || ((config->bufferSize & 0x7) == 0) ); - modes->rgbBits = config->bufferSize; - modes->indexBits = config->bufferSize; - - modes->accumRedBits = config->accumRedSize; - modes->accumGreenBits = config->accumGreenSize; - modes->accumBlueBits = config->accumBlueSize; - modes->accumAlphaBits = config->accumAlphaSize; - modes->depthBits = config->depthSize; - modes->stencilBits = config->stencilSize; - - modes->numAuxBuffers = 0; /* XXX: should be picked up from the visual */ - - modes->level = config->level; -} - /*****************************************************************************/ /* accessing the drawable private */ @@ -382,21 +338,13 @@ __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId, pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum]; - /* allocate the buffers */ if (glxPriv->type == DRAWABLE_WINDOW) { - int i; VisualID vid = wVisual((WindowPtr)pDraw); - __GLXvisualConfig *pGlxVisual = pGlxScreen->pGlxVisual; - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == vid) { - glxPriv->pGlxVisual = pGlxVisual; - break; - } - } + glxPriv->modes = _gl_context_modes_find_visual( pGlxScreen->modes, vid ); __glXFBInitDrawable(glxPriv, modes); } else { - glxPriv->pGlxVisual = glxPriv->pGlxPixmap->pGlxVisual; + glxPriv->modes = glxPriv->pGlxPixmap->modes; __glXPixInitDrawable(glxPriv, modes); } diff --git a/GL/glx/glxutil.h b/GL/glx/glxutil.h index 67bfb06f9..970683cb1 100644 --- a/GL/glx/glxutil.h +++ b/GL/glx/glxutil.h @@ -55,7 +55,6 @@ extern void __glXGetDrawableSize(__GLdrawablePrivate *glPriv, GLuint *width, GLuint *height); extern GLboolean __glXResizeDrawable(__GLdrawablePrivate *glPriv); extern GLboolean __glXResizeDrawableBuffers(__GLXdrawablePrivate *glxPriv); -extern void __glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config); /* drawable management */ extern void __glXRefDrawablePrivate(__GLXdrawablePrivate *glxPriv); diff --git a/GL/glx/impsize.h b/GL/glx/impsize.h index 63fdcef20..8932fb33f 100644 --- a/GL/glx/impsize.h +++ b/GL/glx/impsize.h @@ -67,6 +67,7 @@ extern int __glTexParameterfv_size(GLenum e); extern int __glTexParameteriv_size(GLenum e); extern int __glEvalComputeK(GLenum target); -extern int __glPointParameterfvARB_size(GLenum pname); +extern int __glPointParameterfvARB_size(GLenum e); +extern int __glPointParameteriv_size(GLenum e); #endif /* _impsize_h_ */ diff --git a/GL/glx/render2.c b/GL/glx/render2.c index 04bef0e8c..8ef67e2a2 100644 --- a/GL/glx/render2.c +++ b/GL/glx/render2.c @@ -220,6 +220,14 @@ void __glXDisp_DrawArrays(GLbyte *pc) glEnableClientState(GL_EDGE_FLAG_ARRAY); glEdgeFlagPointer(stride, (const GLboolean *)pc); break; + case GL_SECONDARY_COLOR_ARRAY: + glEnableClientState(GL_SECONDARY_COLOR_ARRAY); + glSecondaryColorPointer(numVals, datatype, stride, pc); + break; + case GL_FOG_COORD_ARRAY: + glEnableClientState(GL_FOG_COORD_ARRAY); + glFogCoordPointer(datatype, stride, pc); + break; default: break; } @@ -236,10 +244,11 @@ void __glXDisp_DrawArrays(GLbyte *pc) glDisableClientState(GL_INDEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); + glDisableClientState(GL_SECONDARY_COLOR_ARRAY); + glDisableClientState(GL_FOG_COORD_ARRAY); } void __glXDisp_DrawArraysEXT(GLbyte *pc) { -#ifdef XXX_STUB -#endif /*XXX_STUB*/ + __glXDisp_DrawArrays(pc); } diff --git a/GL/glx/render2swap.c b/GL/glx/render2swap.c index e873d88aa..7c94b5268 100644 --- a/GL/glx/render2swap.c +++ b/GL/glx/render2swap.c @@ -386,6 +386,5 @@ void __glXDispSwap_DrawArrays(GLbyte *pc) void __glXDispSwap_DrawArraysEXT(GLbyte *pc) { -#ifdef XXX_STUB -#endif /*XXX_STUB*/ + __glXDispSwap_DrawArrays(pc); } diff --git a/GL/glx/rensize.c b/GL/glx/rensize.c index 95a10e2e2..519c6a90e 100644 --- a/GL/glx/rensize.c +++ b/GL/glx/rensize.c @@ -551,12 +551,14 @@ int __glXDrawArraysSize( GLbyte *pc, Bool swap ) case GL_COLOR_ARRAY: case GL_TEXTURE_COORD_ARRAY: break; + case GL_SECONDARY_COLOR_ARRAY: case GL_NORMAL_ARRAY: if (numVals != 3) { /* bad size */ return -1; } break; + case GL_FOG_COORD_ARRAY: case GL_INDEX_ARRAY: if (numVals != 1) { /* bad size */ @@ -918,3 +920,9 @@ int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap ) } return 4 * __glPointParameterfvARB_size( pname ); } + +int __glXPointParameterivReqSize(GLbyte *pc, Bool swap ) +{ + /* no difference between fv and iv versions */ + return __glXPointParameterfvARBReqSize(pc, swap); +} diff --git a/GL/glx/rensizetab.c b/GL/glx/rensizetab.c index feaac9869..95ba462b2 100644 --- a/GL/glx/rensizetab.c +++ b/GL/glx/rensizetab.c @@ -231,9 +231,9 @@ __GLXrenderSizeData __glXRenderSizeTable[__GLX_MAX_RENDER_OPCODE_EXT - __GLX_MIN /* Translatef */ { 16, 0 }, /* Viewport */ { 20, 0 }, /* PolygonOffset */ { 12, 0 }, - /* no such opcode */ { 0, 0 }, + /* DrawArrays */ { 16, __glXDrawArraysSize }, /* Indexubv */ { 8, 0 }, - /* ColorSubTable */ { 44, __glXColorSubTableReqSize }, + /* ColorSubTable */ { 44, __glXColorSubTableReqSize }, /* CopyColorSubTable */ { 24, 0 }, /* ActiveTextureARB */ { 8, 0 }, /* MultiTexCoord1dvARB */ { 16, 0 }, @@ -2342,17 +2342,17 @@ __GLXrenderSizeData __glXRenderSizeTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __GLX /* CopyTexSubImage1D */ { 28, 0 }, /* CopyTexSubImage2D */ { 36, 0 }, /* CopyTexSubImage3D 4123 */ { 40, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, - /* no such opcode */ { 0, 0 }, + /* FogCoordfv 4124 */ { 8, 0 }, + /* FogCoorddv 4125 */ { 12, 0 }, + /* SecondaryColor3bv 4126 */ { 8, 0 }, + /* SecondaryColor3sv 4127 */ { 12, 0 }, + /* SecondaryColor3iv 4128 */ { 16, 0 }, + /* SecondaryColor3fv 4129 */ { 16, 0 }, + /* SecondaryColor3dv 4130 */ { 28, 0 }, + /* SecondaryColor3ubv 4131 */ { 8, 0 }, + /* SecondaryColor3usv 4132 */ { 12, 0 }, + /* SecondaryColor3uiv 4133 */ { 16, 0 }, + /* BlendFuncSeparate 4134 */ { 20, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, @@ -2439,4 +2439,6 @@ __GLXrenderSizeData __glXRenderSizeTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __GLX /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* ActiveStencilFaceEXT 4220 */ { 8, 0 }, + /* PointParameteri 4221 */ { 12, 0 }, + /* PointParameteriv 4222 */ { 8, __glXPointParameterivReqSize }, }; diff --git a/GL/glx/single2.c b/GL/glx/single2.c index 286f63d70..c542d60f4 100644 --- a/GL/glx/single2.c +++ b/GL/glx/single2.c @@ -296,16 +296,25 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string) return combo_string; } -int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) +int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) { ClientPtr client; __GLXcontext *cx; GLenum name; const char *string; + __GLX_DECLARE_SWAP_VARIABLES; int error; char *buf = NULL, *buf1 = NULL; GLint length = 0; + /* If the client has the opposite byte order, swap the contextTag and + * the name. + */ + if ( need_swap ) { + __GLX_SWAP_INT(pc + 4); + __GLX_SWAP_INT(pc + __GLX_SINGLE_HDR_SIZE); + } + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; @@ -331,12 +340,32 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) } string = buf; } + else if ( name == GL_VERSION ) { + if ( xf86atof( string ) > xf86atof( GLServerVersion ) ) { + buf = __glXMalloc( __glXStrlen( string ) + + __glXStrlen( GLServerVersion ) + + 4 ); + if ( buf == NULL ) { + string = GLServerVersion; + } + else { + __glXSprintf( buf, "%s (%s)", GLServerVersion, string ); + string = buf; + } + } + } if (string) { length = __glXStrlen((const char *) string) + 1; } __GLX_BEGIN_REPLY(length); __GLX_PUT_SIZE(length); + + if ( need_swap ) { + __GLX_SWAP_REPLY_SIZE(); + __GLX_SWAP_REPLY_HEADER(); + } + __GLX_SEND_HEADER(); WriteToClient(client, length, (char *) string); if (buf != NULL) { @@ -345,6 +374,11 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) return Success; } +int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) +{ + return DoGetString(cl, pc, GL_FALSE); +} + int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; diff --git a/GL/glx/single2swap.c b/GL/glx/single2swap.c index 96db415f9..c8c496871 100644 --- a/GL/glx/single2swap.c +++ b/GL/glx/single2swap.c @@ -262,58 +262,7 @@ int __glXDispSwap_Finish(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc) { - ClientPtr client; - __GLXcontext *cx; - GLenum name; - const char *string; - __GLX_DECLARE_SWAP_VARIABLES; - int error; - char *buf = NULL, *buf1 = NULL; - GLint length = 0; - - __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); - cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); - if (!cx) { - return error; - } - - pc += __GLX_SINGLE_HDR_SIZE; - __GLX_SWAP_INT(pc + 0); - name = *(GLenum *)(pc + 0); - string = (const char *)glGetString(name); - client = cl->client; - - /* - ** Restrict extensions to those that are supported by both the - ** implementation and the connection. That is, return the - ** intersection of client, server, and core extension strings. - */ - if (name == GL_EXTENSIONS) { - buf1 = __glXcombine_strings(string, - cl->GLClientextensions); - buf = __glXcombine_strings(buf1, - cx->pGlxScreen->GLextensions); - if (buf1 != NULL) { - __glXFree(buf1); - } - string = buf; - } - if (string) { - length = __glXStrlen((const char *) string) + 1; - } - - __GLX_BEGIN_REPLY(length); - __GLX_PUT_SIZE(length); - - __GLX_SWAP_REPLY_SIZE(); - __GLX_SWAP_REPLY_HEADER(); - __GLX_SEND_HEADER(); - WriteToClient(client, length, (char *) string); - if (buf != NULL) { - __glXFree(buf); - } - - return Success; + return DoGetString(cl, pc, GL_TRUE); } int __glXDispSwap_GetClipPlane(__GLXclientState *cl, GLbyte *pc) diff --git a/GL/glx/singlesize.c b/GL/glx/singlesize.c index 7f59816e9..836ace25d 100644 --- a/GL/glx/singlesize.c +++ b/GL/glx/singlesize.c @@ -49,32 +49,48 @@ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) return __glXImage3DSize( format, type, w, h, 1, 0, 0, 0, 0, 4 ); } +/** + * Determine the number of data elements that go with the specified \c pname + * to a \c glGetTexEnvfv or \c glGetTexEnviv call. + * + * \todo + * Replace this function with a call to \c __glTexEnvfv_size. Make that there + * aren't any values of \c pname that are valid for one but not the other. + */ GLint __glGetTexEnvfv_size(GLenum pname) { switch (pname) { case GL_TEXTURE_ENV_MODE: + case GL_TEXTURE_LOD_BIAS: + case GL_COMBINE_RGB: + case GL_COMBINE_ALPHA: + case GL_SOURCE0_RGB: + case GL_SOURCE1_RGB: + case GL_SOURCE2_RGB: + case GL_SOURCE0_ALPHA: + case GL_SOURCE1_ALPHA: + case GL_SOURCE2_ALPHA: + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + case GL_OPERAND2_RGB: + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + case GL_OPERAND2_ALPHA: + case GL_RGB_SCALE: + case GL_ALPHA_SCALE: + + /* GL_ARB_point_sprite / GL_NV_point_sprite */ + case GL_COORD_REPLACE_ARB: + + /* GL_NV_texture_env_combine4 */ + case GL_SOURCE3_RGB_NV: + case GL_SOURCE3_ALPHA_NV: + case GL_OPERAND3_RGB_NV: + case GL_OPERAND3_ALPHA_NV: return 1; + case GL_TEXTURE_ENV_COLOR: return 4; - case GL_TEXTURE_LOD_BIAS_EXT: - return 1; - case GL_COMBINE_RGB_ARB: - case GL_COMBINE_ALPHA_ARB: - case GL_SOURCE0_RGB_ARB: - case GL_SOURCE1_RGB_ARB: - case GL_SOURCE2_RGB_ARB: - case GL_SOURCE0_ALPHA_ARB: - case GL_SOURCE1_ALPHA_ARB: - case GL_SOURCE2_ALPHA_ARB: - case GL_OPERAND0_RGB_ARB: - case GL_OPERAND1_RGB_ARB: - case GL_OPERAND2_RGB_ARB: - case GL_OPERAND0_ALPHA_ARB: - case GL_OPERAND1_ALPHA_ARB: - case GL_OPERAND2_ALPHA_ARB: - case GL_RGB_SCALE_ARB: - case GL_ALPHA_SCALE: - return 1; default: return -1; } @@ -139,6 +155,15 @@ GLint __glGetTexParameterfv_size(GLenum pname) case GL_TEXTURE_COMPARE_MODE: case GL_TEXTURE_COMPARE_FUNC: + /* GL_SGIS_generate_mipmap / GL 1.4 */ + case GL_GENERATE_MIPMAP: + + /* GL_ARB_depth_texture / GL 1.4 */ + case GL_DEPTH_TEXTURE_MODE: + + /* GL_EXT_texture_lod_bias / GL 1.4 */ + case GL_TEXTURE_LOD_BIAS: + /* GL_SGIX_shadow_ambient / GL_ARB_shadow_ambient */ case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: @@ -150,6 +175,12 @@ GLint __glGetTexParameterfv_size(GLenum pname) case GL_TEXTURE_MAX_CLAMP_S_SGIX: case GL_TEXTURE_MAX_CLAMP_T_SGIX: case GL_TEXTURE_MAX_CLAMP_R_SGIX: + + /* GL_EXT_texture_filter_anisotropic */ + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + + /* GL_NV_texture_expand_normal */ + case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: return 1; default: @@ -833,10 +864,6 @@ GLint __glGet_size(GLenum sq) case GL_MAX_CONVOLUTION_WIDTH: case GL_MAX_CONVOLUTION_HEIGHT: return 1; - case GL_TEXTURE_CUBE_MAP_ARB: - case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - return 1; case GL_OCCLUSION_TEST_RESULT_HP: case GL_OCCLUSION_TEST_HP: return 1; @@ -846,6 +873,223 @@ GLint __glGet_size(GLenum sq) return 1; case GL_RASTER_POSITION_UNCLIPPED_IBM: return 1; + + /* GL_ARB_texture_cube_map / GL 1.3 */ + case GL_TEXTURE_CUBE_MAP: + case GL_TEXTURE_BINDING_CUBE_MAP: + case GL_MAX_CUBE_MAP_TEXTURE_SIZE: + + /* GL_ARB_multisample / GL 1.3 */ + case GL_MULTISAMPLE: + case GL_SAMPLE_ALPHA_TO_COVERAGE: + case GL_SAMPLE_ALPHA_TO_ONE: + case GL_SAMPLE_COVERAGE: + case GL_SAMPLE_BUFFERS: + case GL_SAMPLES: + case GL_SAMPLE_COVERAGE_VALUE: + case GL_SAMPLE_COVERAGE_INVERT: + + /* GL_ARB_texture_comrpession / GL 1.3 */ + case GL_TEXTURE_COMPRESSION_HINT: + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: + + /* GL_EXT_blend_func_separate / GL 1.4 */ + case GL_BLEND_DST_RGB: + case GL_BLEND_SRC_RGB: + case GL_BLEND_DST_ALPHA: + case GL_BLEND_SRC_ALPHA: + + /* GL_EXT_fog_coord / GL 1.4 */ + case GL_CURRENT_FOG_COORD: + case GL_FOG_COORD_ARRAY_TYPE: + case GL_FOG_COORD_ARRAY_STRIDE: + case GL_FOG_COORD_ARRAY: + case GL_FOG_COORD_SOURCE: + + /* GL_EXT_secondary_color / GL 1.4 */ + case GL_COLOR_SUM: + case GL_SECONDARY_COLOR_ARRAY_SIZE: + case GL_SECONDARY_COLOR_ARRAY_TYPE: + case GL_SECONDARY_COLOR_ARRAY_STRIDE: + case GL_SECONDARY_COLOR_ARRAY: + + /* GL_EXT_texture_lod_bias / GL 1.4 */ + case GL_MAX_TEXTURE_LOD_BIAS: + + /* GL_ARB_point_sprite */ + case GL_POINT_SPRITE_ARB: + + /* GL_ARB_vertex_blend */ + case GL_MAX_VERTEX_UNITS_ARB: + case GL_ACTIVE_VERTEX_UNITS_ARB: + case GL_WEIGHT_SUM_UNITY_ARB: + case GL_VERTEX_BLEND_ARB: + case GL_CURRENT_WEIGHT_ARB: + case GL_WEIGHT_ARRAY_ARB: + case GL_WEIGHT_ARRAY_TYPE_ARB: + case GL_WEIGHT_ARRAY_STRIDE_ARB: + case GL_WEIGHT_ARRAY_SIZE_ARB: + + /* GL_ARB_matrix_palette */ + case GL_MATRIX_PALETTE_ARB: + case GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB: + case GL_MAX_PALETTE_MATRICES_ARB: + case GL_CURRENT_PALETTE_MATRIX_ARB: + case GL_CURRENT_MATRIX_INDEX_ARB: + case GL_MATRIX_INDEX_ARRAY_ARB: + case GL_MATRIX_INDEX_ARRAY_SIZE_ARB: + case GL_MATRIX_INDEX_ARRAY_TYPE_ARB: + case GL_MATRIX_INDEX_ARRAY_STRIDE_ARB: + + /* GL_EXT_clip_volume_hint */ + case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: + + /* GL_EXT_depth_bounds_test */ + case GL_DEPTH_BOUNDS_TEST_EXT: + + /* GL_EXT_stencil_two_size */ + case GL_STENCIL_TEST_TWO_SIDE_EXT: + case GL_ACTIVE_STENCIL_FACE_EXT: + + /* GL_EXT_vertex_weighting */ + case GL_VERTEX_WEIGHTING_EXT: + case GL_MODELVIEW0_EXT: + case GL_MODELVIEW1_EXT: + case GL_CURRENT_VERTEX_WEIGHT_EXT: + case GL_VERTEX_WEIGHT_ARRAY_EXT: + case GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT: + case GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT: + case GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT: + /* case GL_MODELVIEW0_STACK_DEPTH_EXT: */ /* alias */ + case GL_MODELVIEW1_STACK_DEPTH_EXT: + + /* GL_EXT_blend_equation_separate */ + /* case GL_BLEND_EQUATION_RGB_EXT: */ /* alias */ + case GL_BLEND_EQUATION_ALPHA_EXT: + + /* GL_ATI_vertex_streams */ + case GL_MAX_VERTEX_STREAMS_ATI: + + /* GL_ATI_draw_buffers */ + case GL_MAX_DRAW_BUFFERS_ATI: + case GL_DRAW_BUFFER0_ATI: + case GL_DRAW_BUFFER1_ATI: + case GL_DRAW_BUFFER2_ATI: + case GL_DRAW_BUFFER3_ATI: + case GL_DRAW_BUFFER4_ATI: + case GL_DRAW_BUFFER5_ATI: + case GL_DRAW_BUFFER6_ATI: + case GL_DRAW_BUFFER7_ATI: + case GL_DRAW_BUFFER8_ATI: + case GL_DRAW_BUFFER9_ATI: + case GL_DRAW_BUFFER10_ATI: + case GL_DRAW_BUFFER11_ATI: + case GL_DRAW_BUFFER12_ATI: + case GL_DRAW_BUFFER13_ATI: + case GL_DRAW_BUFFER14_ATI: + case GL_DRAW_BUFFER15_ATI: + + /* GL_ATI_separate_stencil */ + case GL_STENCIL_BACK_FUNC_ATI: + case GL_STENCIL_BACK_FAIL_ATI: + case GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI: + case GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI: + + /* GL_NV_depth_clamp */ + case GL_DEPTH_CLAMP_NV: + + /* GL_NV_fog_distance */ + case GL_FOG_DISTANCE_MODE_NV: + + /* GL_NV_light_max_exponent */ + case GL_MAX_SHININESS_NV: + case GL_MAX_SPOT_EXPONENT_NV: + + /* GL_NV_multisample_filter_hint */ + case GL_MULTISAMPLE_FILTER_HINT_NV: + + /* GL_NV_point_sprite */ + /* case GL_POINT_SPRITE_NV: */ /* alias */ + case GL_POINT_SPRITE_R_MODE_NV: + + /* GL_NV_primitive_restart */ + case GL_PRIMITIVE_RESTART_NV: + case GL_PRIMITIVE_RESTART_INDEX_NV: + + /* GL_NV_register_combiners */ + case GL_REGISTER_COMBINERS_NV: + case GL_NUM_GENERAL_COMBINERS_NV: + case GL_COLOR_SUM_CLAMP_NV: + case GL_MAX_GENERAL_COMBINERS_NV: + + /* GL_NV_register_combiners2 */ + case GL_PER_STAGE_CONSTANTS_NV: + + /* GL_NV_texture_rectangle */ + case GL_TEXTURE_RECTANGLE_NV: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: + return 1; + + /* GL_EXT_depth_bounds_test */ + case GL_DEPTH_BOUNDS_EXT: + return 2; + + /* GL_EXT_secondary_color / GL 1.4 */ + case GL_CURRENT_SECONDARY_COLOR: + + /* GL_NV_register_combiners */ + case GL_CONSTANT_COLOR0_NV: + case GL_CONSTANT_COLOR1_NV: + return 4; + + /* GL_ARB_vertex_blend */ + /* case GL_MODELVIEW0_ARB: */ /* alias */ + /* case GL_MODELVIEW1_ARB: */ /* alias */ + case GL_MODELVIEW2_ARB: + case GL_MODELVIEW3_ARB: + case GL_MODELVIEW4_ARB: + case GL_MODELVIEW5_ARB: + case GL_MODELVIEW6_ARB: + case GL_MODELVIEW7_ARB: + case GL_MODELVIEW8_ARB: + case GL_MODELVIEW9_ARB: + case GL_MODELVIEW10_ARB: + case GL_MODELVIEW11_ARB: + case GL_MODELVIEW12_ARB: + case GL_MODELVIEW13_ARB: + case GL_MODELVIEW14_ARB: + case GL_MODELVIEW15_ARB: + case GL_MODELVIEW16_ARB: + case GL_MODELVIEW17_ARB: + case GL_MODELVIEW18_ARB: + case GL_MODELVIEW19_ARB: + case GL_MODELVIEW20_ARB: + case GL_MODELVIEW21_ARB: + case GL_MODELVIEW22_ARB: + case GL_MODELVIEW23_ARB: + case GL_MODELVIEW24_ARB: + case GL_MODELVIEW25_ARB: + case GL_MODELVIEW26_ARB: + case GL_MODELVIEW27_ARB: + case GL_MODELVIEW28_ARB: + case GL_MODELVIEW29_ARB: + case GL_MODELVIEW30_ARB: + case GL_MODELVIEW31_ARB: + + /* GL_EXT_vertex_weighting */ + /* case GL_MODELVIEW0_MATRIX_EXT: */ /* alias */ + case GL_MODELVIEW1_MATRIX_EXT: + return 32; + + /* GL_ARB_texture_comrpession / GL 1.3 */ + case GL_COMPRESSED_TEXTURE_FORMATS: { + GLint temp; + + glGetIntegerv( GL_NUM_COMPRESSED_TEXTURE_FORMATS, & temp ); + return temp; + } + default: return -1; } @@ -885,7 +1129,15 @@ GLint __glGetTexLevelParameterfv_size(GLenum pname) case GL_TEXTURE_ALPHA_SIZE: case GL_TEXTURE_LUMINANCE_SIZE: case GL_TEXTURE_INTENSITY_SIZE: + + /* GL_ARB_texture_compression / GL 1.3 */ + case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: + case GL_TEXTURE_COMPRESSED: + + /* GL_ARB_depth_texture / GL 1.4 */ + case GL_TEXTURE_DEPTH_SIZE: return 1; + default: return -1; } -- cgit v1.2.3