diff options
Diffstat (limited to 'GL/glx/g_render.c')
-rw-r--r-- | GL/glx/g_render.c | 160 |
1 files changed, 160 insertions, 0 deletions
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) + ); +} |