diff options
author | alanh <alanh> | 2003-08-27 09:07:13 +0000 |
---|---|---|
committer | alanh <alanh> | 2003-08-27 09:07:13 +0000 |
commit | f5d60adda9a22cd2063f346edb9338ab0b221e3a (patch) | |
tree | b8ad943f711ab9ae85dd036edf6968b39de1f8a8 | |
parent | 9ba8f9b5df3408efc828cce350ae41bc3a8b400f (diff) |
merge in the a pre-Mesa 5.0.2 snapshot
-rw-r--r-- | xc/extras/Mesa/docs/RELNOTES-4.0.2 | 4 | ||||
-rw-r--r-- | xc/extras/Mesa/docs/VERSIONS | 13 | ||||
-rw-r--r-- | xc/extras/Mesa/include/GL/glxext.h | 29 | ||||
-rw-r--r-- | xc/extras/Mesa/src/X/fakeglx.c | 5 | ||||
-rw-r--r-- | xc/extras/Mesa/src/array_cache/ac_import.c | 14 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_trans_tmp.h | 52 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_translate.c | 59 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_translate.h | 8 | ||||
-rw-r--r-- | xc/extras/Mesa/src/rastpos.c | 3 | ||||
-rw-r--r-- | xc/extras/Mesa/src/swrast/s_drawpix.c | 22 | ||||
-rw-r--r-- | xc/extras/Mesa/src/swrast/s_zoom.c | 84 | ||||
-rw-r--r-- | xc/extras/Mesa/src/swrast/s_zoom.h | 9 | ||||
-rw-r--r-- | xc/extras/Mesa/src/texobj.c | 19 | ||||
-rw-r--r-- | xc/extras/Mesa/src/texstate.c | 37 | ||||
-rw-r--r-- | xc/extras/Mesa/src/tnl/t_imm_elt.c | 340 | ||||
-rw-r--r-- | xc/extras/Mesa/src/tnl/t_vb_light.c | 14 | ||||
-rw-r--r-- | xc/extras/Mesa/src/tnl_dd/t_dd_dmatmp2.h | 558 |
17 files changed, 718 insertions, 552 deletions
diff --git a/xc/extras/Mesa/docs/RELNOTES-4.0.2 b/xc/extras/Mesa/docs/RELNOTES-4.0.2 index 6f878f474..d87a199b2 100644 --- a/xc/extras/Mesa/docs/RELNOTES-4.0.2 +++ b/xc/extras/Mesa/docs/RELNOTES-4.0.2 @@ -1,7 +1,7 @@ Mesa 4.0.2 release notes - April 2, 2002 + March 25, 2002 PLEASE READ!!!! @@ -47,4 +47,4 @@ D3D needs updating ---------------------------------------------------------------------- -$Id: RELNOTES-4.0.2,v 1.3 2002/10/22 23:38:06 alanh Exp $ +$Id: RELNOTES-4.0.2,v 1.4 2003/08/27 09:07:13 alanh Exp $ diff --git a/xc/extras/Mesa/docs/VERSIONS b/xc/extras/Mesa/docs/VERSIONS index 8ab9c9a2f..1ade499e7 100644 --- a/xc/extras/Mesa/docs/VERSIONS +++ b/xc/extras/Mesa/docs/VERSIONS @@ -1128,5 +1128,18 @@ Mesa Version History - GL_FOG_COORDINATE_SOURCE_EXT query wasn't supported - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT query returned wrong value - blended, wide lines didn't always work correctly (bug 711595) + - glVertexAttrib4svNV w component was always 1 + - fixed bug in GL_IBM_rasterpos_clip (missing return) + - GL_DEPTH_TEXTURE_MODE = GL_ALPHA didn't work correctly + - a few Solaris compilation fixes + - fixed glClear() problem for DRI drivers (non-existant stencil, etc) + - fixed int/REAL mixup in GLU NURBS curve evaluator (Eric Cazeaux) + - fixed delete [] bug in SI GLU (bug 721765) (Diego Santa Cruz) + - glFog() didn't clamp fog colors + - fixed bad float/int conversion for GL_TEXTURE_PRIORITY in the + gl[Get]TexParameteri[v] functions + - fixed invalid memory references in glTexGen functions (bug 781602) + - integer-valued color arrays weren't handled correctly + - glDrawPixels(GL_DEPTH_COMPONENT) with glPixelZoom didn't work Changes: diff --git a/xc/extras/Mesa/include/GL/glxext.h b/xc/extras/Mesa/include/GL/glxext.h index a99c7e33a..aa899546a 100644 --- a/xc/extras/Mesa/include/GL/glxext.h +++ b/xc/extras/Mesa/include/GL/glxext.h @@ -579,16 +579,6 @@ extern GLuint glXGetAGPOffsetMESA (const GLvoid *); typedef GLuint ( * PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *); #endif -#ifndef GLX_MESA_swap_control -#define GLX_MESA_swap_control 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern GLint glXSwapIntervalMESA(unsigned interval); -extern GLint glXGetSwapIntervalMESA( void ); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef GLint ( * PFNGLXSWAPINTERVALMESAPROC) (unsigned interval); -typedef GLint ( * PFNGLXGETSWAPINTERVALMESAPROC) ( void ); -#endif - #ifndef GLX_SGIX_visual_select_group #define GLX_SGIX_visual_select_group 1 #endif @@ -597,8 +587,8 @@ typedef GLint ( * PFNGLXGETSWAPINTERVALMESAPROC) ( void ); #define GLX_OML_swap_method 1 #endif -#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ - defined(_STDINT_H) || defined(_SYS_INTTYPES_H_) || defined(_INTTYPES_H_) +#if defined(__STDC_VERSION__) +#if __STDC_VERSION__ >= 199901L /* Include ISO C99 integer types for OML_sync_control; need a better test */ #include <inttypes.h> @@ -618,21 +608,8 @@ typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, i typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); #endif -#ifndef GLX_MESA_swap_frame_usage -#define GLX_MESA_swap_frame_usage 1 -#ifdef GLX_GLXEXT_PROTOTYPES -extern GLint glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable); -extern GLint glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable); -extern GLint glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, GLfloat *usage); -extern GLint glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, int64_t *sbc, int64_t *missedFrames, GLfloat *lastMissedUsage); -#endif /* GLX_GLXEXT_PROTOTYPES */ -typedef GLint ( * PFNGLXBEGINFRAMETRACKINGMESAPROC) (Display *dpy, GLXDrawable drawable); -typedef GLint ( * PFNGLXENDFRAMETRACKINGMESAPROC) (Display *dpy, GLXDrawable drawable); -typedef GLint ( * PFNGLXGETFRAMEUSAGEMESAPROC) (Display *dpy, GLXDrawable drawable, GLfloat *usage); -typedef GLint ( * PFNGLXQUERYFRAMETRACKINGMESAPROC) (Display *dpy, GLXDrawable drawable, int64_t *sbc, int64_t *missedFrames, GLfloat *lastMissedUsage); -#endif - #endif /* C99 version test */ +#endif /* STDC test */ #ifdef __cplusplus } diff --git a/xc/extras/Mesa/src/X/fakeglx.c b/xc/extras/Mesa/src/X/fakeglx.c index 78907bff5..719c9f694 100644 --- a/xc/extras/Mesa/src/X/fakeglx.c +++ b/xc/extras/Mesa/src/X/fakeglx.c @@ -1,7 +1,6 @@ - /* * Mesa 3-D graphics library - * Version: 5.0.1 + * Version: 5.0.2 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * @@ -65,7 +64,7 @@ #define SERVER_MINOR_VERSION 4 /* This is appended onto the glXGetClient/ServerString version strings. */ -#define MESA_GLX_VERSION "Mesa 5.0.1" +#define MESA_GLX_VERSION "Mesa 5.0.2" /* Who implemented this GLX? */ #define VENDOR "Brian Paul" diff --git a/xc/extras/Mesa/src/array_cache/ac_import.c b/xc/extras/Mesa/src/array_cache/ac_import.c index d68de5b03..7aea1e061 100644 --- a/xc/extras/Mesa/src/array_cache/ac_import.c +++ b/xc/extras/Mesa/src/array_cache/ac_import.c @@ -259,13 +259,13 @@ static void import( GLcontext *ctx, switch (type) { case GL_FLOAT: - _math_trans_4f( (GLfloat (*)[4]) to->Ptr, - from->Ptr, - from->StrideB, - from->Type, - from->Size, - 0, - ac->count - ac->start); + _math_trans_4fc( (GLfloat (*)[4]) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + from->Size, + 0, + ac->count - ac->start); to->StrideB = 4 * sizeof(GLfloat); to->Type = GL_FLOAT; diff --git a/xc/extras/Mesa/src/math/m_trans_tmp.h b/xc/extras/Mesa/src/math/m_trans_tmp.h index 25e03c986..a5ef28430 100644 --- a/xc/extras/Mesa/src/math/m_trans_tmp.h +++ b/xc/extras/Mesa/src/math/m_trans_tmp.h @@ -59,6 +59,32 @@ static void DEST_4F( GLfloat (*t)[4], #endif + +#ifdef DEST_4FC +static void DEST_4FC( GLfloat (*t)[4], + CONST void *ptr, + GLuint stride, + ARGS ) +{ + const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; + const GLubyte *first = f; + GLuint i; + + (void) first; + (void) start; + for (i = DST_START ; i < n ; i++, NEXT_F) { + CHECK { + NEXT_F2; + if (SZ >= 1) t[i][0] = TRX_4FC(f, 0); + if (SZ >= 2) t[i][1] = TRX_4FC(f, 1); + if (SZ >= 3) t[i][2] = TRX_4FC(f, 2); + if (SZ == 4) t[i][3] = TRX_4FC(f, 3); else t[i][3] = 1.0; + } + } +} +#endif + + #ifdef DEST_3F static void DEST_3F( GLfloat (*t)[3], CONST void *ptr, @@ -219,17 +245,43 @@ static void INIT(void) #ifdef DEST_4F TAB(_4f)[SZ][SRC_IDX] = DEST_4F; #endif +#ifdef DEST_4FC + TAB(_4fc)[SZ][SRC_IDX] = DEST_4FC; +#endif } +#ifdef INIT #undef INIT +#endif +#ifdef DEST_1UI #undef DEST_1UI +#endif +#ifdef DEST_1UB #undef DEST_1UB +#endif +#ifdef DEST_4UB #undef DEST_4UB +#endif +#ifdef DEST_4US #undef DEST_4US +#endif +#ifdef DEST_3F #undef DEST_3F +#endif +#ifdef DEST_4F #undef DEST_4F +#endif +#ifdef DEST_4FC +#undef DEST_4FC +#endif +#ifdef DEST_1F #undef DEST_1F +#endif +#ifdef SZ #undef SZ +#endif +#ifdef TAG #undef TAG +#endif diff --git a/xc/extras/Mesa/src/math/m_translate.c b/xc/extras/Mesa/src/math/m_translate.c index 9cf0c39a3..2a5a049a1 100644 --- a/xc/extras/Mesa/src/math/m_translate.c +++ b/xc/extras/Mesa/src/math/m_translate.c @@ -97,6 +97,7 @@ static trans_3f_func _math_trans_3f_tab[MAX_TYPES]; static trans_4ub_func _math_trans_4ub_tab[5][MAX_TYPES]; static trans_4us_func _math_trans_4us_tab[5][MAX_TYPES]; static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; +static trans_4f_func _math_trans_4fc_tab[5][MAX_TYPES]; #define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt]) @@ -120,6 +121,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SRC_IDX TYPE_IDX(GL_BYTE) #define TRX_3F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = BYTE_TO_UBYTE( PTR_ELT(f,n) ) #define TRX_US(ch, f,n) ch = BYTE_TO_USHORT( PTR_ELT(f,n) ) #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) @@ -128,6 +130,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 4 #define INIT init_trans_4_GLbyte_raw #define DEST_4F trans_4_GLbyte_4f_raw +#define DEST_4FC trans_4_GLbyte_4fc_raw #define DEST_4UB trans_4_GLbyte_4ub_raw #define DEST_4US trans_4_GLbyte_4us_raw #include "m_trans_tmp.h" @@ -135,6 +138,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 3 #define INIT init_trans_3_GLbyte_raw #define DEST_4F trans_3_GLbyte_4f_raw +#define DEST_4FC trans_3_GLbyte_4fc_raw #define DEST_4UB trans_3_GLbyte_4ub_raw #define DEST_4US trans_3_GLbyte_4us_raw #define DEST_3F trans_3_GLbyte_3f_raw @@ -143,11 +147,13 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 2 #define INIT init_trans_2_GLbyte_raw #define DEST_4F trans_2_GLbyte_4f_raw +#define DEST_4FC trans_2_GLbyte_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLbyte_raw #define DEST_4F trans_1_GLbyte_4f_raw +#define DEST_4FC trans_1_GLbyte_4fc_raw #define DEST_1UB trans_1_GLbyte_1ub_raw #define DEST_1UI trans_1_GLbyte_1ui_raw #include "m_trans_tmp.h" @@ -155,6 +161,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #undef SRC #undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI @@ -167,6 +174,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE) #define TRX_3F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) #define TRX_4F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) +#define TRX_4FC(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) #define TRX_UB(ub, f,n) ub = PTR_ELT(f,n) #define TRX_US(us, f,n) us = UBYTE_TO_USHORT(PTR_ELT(f,n)) #define TRX_UI(f,n) (GLuint)PTR_ELT(f,n) @@ -176,6 +184,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 4 #define INIT init_trans_4_GLubyte_raw #define DEST_4F trans_4_GLubyte_4f_raw +#define DEST_4FC trans_4_GLubyte_4fc_raw #define DEST_4US trans_4_GLubyte_4us_raw #include "m_trans_tmp.h" @@ -186,6 +195,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define DEST_4US trans_3_GLubyte_4us_raw #define DEST_3F trans_3_GLubyte_3f_raw #define DEST_4F trans_3_GLubyte_4f_raw +#define DEST_4FC trans_3_GLubyte_4fc_raw #include "m_trans_tmp.h" @@ -199,6 +209,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #undef SRC_IDX #undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI @@ -210,6 +221,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SRC_IDX TYPE_IDX(GL_SHORT) #define TRX_3F(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = SHORT_TO_UBYTE(PTR_ELT(f,n)) #define TRX_US(us, f,n) us = SHORT_TO_USHORT(PTR_ELT(f,n)) #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) @@ -218,6 +230,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 4 #define INIT init_trans_4_GLshort_raw #define DEST_4F trans_4_GLshort_4f_raw +#define DEST_4FC trans_4_GLshort_4fc_raw #define DEST_4UB trans_4_GLshort_4ub_raw #define DEST_4US trans_4_GLshort_4us_raw #include "m_trans_tmp.h" @@ -225,6 +238,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 3 #define INIT init_trans_3_GLshort_raw #define DEST_4F trans_3_GLshort_4f_raw +#define DEST_4FC trans_3_GLshort_4fc_raw #define DEST_4UB trans_3_GLshort_4ub_raw #define DEST_4US trans_3_GLshort_4us_raw #define DEST_3F trans_3_GLshort_3f_raw @@ -233,11 +247,13 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 2 #define INIT init_trans_2_GLshort_raw #define DEST_4F trans_2_GLshort_4f_raw +#define DEST_4FC trans_2_GLshort_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLshort_raw #define DEST_4F trans_1_GLshort_4f_raw +#define DEST_4FC trans_1_GLshort_4fc_raw #define DEST_1UB trans_1_GLshort_1ub_raw #define DEST_1UI trans_1_GLshort_1ui_raw #include "m_trans_tmp.h" @@ -247,6 +263,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #undef SRC_IDX #undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI @@ -258,6 +275,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT) #define TRX_3F(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_UB(ub,f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 8) #define TRX_US(us,f,n) us = (GLushort) (PTR_ELT(f,n) >> 8) #define TRX_UI(f,n) (GLuint) PTR_ELT(f,n) @@ -266,6 +284,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 4 #define INIT init_trans_4_GLushort_raw #define DEST_4F trans_4_GLushort_4f_raw +#define DEST_4FC trans_4_GLushort_4fc_raw #define DEST_4UB trans_4_GLushort_4ub_raw #define DEST_4US trans_4_GLushort_4us_raw #include "m_trans_tmp.h" @@ -273,6 +292,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 3 #define INIT init_trans_3_GLushort_raw #define DEST_4F trans_3_GLushort_4f_raw +#define DEST_4FC trans_3_GLushort_4fc_raw #define DEST_4UB trans_3_GLushort_4ub_raw #define DEST_4US trans_3_GLushort_4us_raw #define DEST_3F trans_3_GLushort_3f_raw @@ -281,11 +301,13 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 2 #define INIT init_trans_2_GLushort_raw #define DEST_4F trans_2_GLushort_4f_raw +#define DEST_4FC trans_2_GLushort_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLushort_raw #define DEST_4F trans_1_GLushort_4f_raw +#define DEST_4FC trans_1_GLushort_4fc_raw #define DEST_1UB trans_1_GLushort_1ub_raw #define DEST_1UI trans_1_GLushort_1ui_raw #include "m_trans_tmp.h" @@ -294,6 +316,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #undef SRC_IDX #undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI @@ -305,6 +328,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SRC_IDX TYPE_IDX(GL_INT) #define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = INT_TO_UBYTE(PTR_ELT(f,n)) #define TRX_US(us, f,n) us = INT_TO_USHORT(PTR_ELT(f,n)) #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) @@ -313,6 +337,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 4 #define INIT init_trans_4_GLint_raw #define DEST_4F trans_4_GLint_4f_raw +#define DEST_4FC trans_4_GLint_4fc_raw #define DEST_4UB trans_4_GLint_4ub_raw #define DEST_4US trans_4_GLint_4us_raw #include "m_trans_tmp.h" @@ -320,6 +345,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 3 #define INIT init_trans_3_GLint_raw #define DEST_4F trans_3_GLint_4f_raw +#define DEST_4FC trans_3_GLint_4fc_raw #define DEST_4UB trans_3_GLint_4ub_raw #define DEST_4US trans_3_GLint_4us_raw #define DEST_3F trans_3_GLint_3f_raw @@ -328,11 +354,13 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 2 #define INIT init_trans_2_GLint_raw #define DEST_4F trans_2_GLint_4f_raw +#define DEST_4FC trans_2_GLint_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLint_raw #define DEST_4F trans_1_GLint_4f_raw +#define DEST_4FC trans_1_GLint_4fc_raw #define DEST_1UB trans_1_GLint_1ub_raw #define DEST_1UI trans_1_GLint_1ui_raw #include "m_trans_tmp.h" @@ -342,6 +370,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #undef SRC_IDX #undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI @@ -353,6 +382,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT) #define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 24) #define TRX_US(us, f,n) us = (GLshort) (PTR_ELT(f,n) >> 16) #define TRX_UI(f,n) PTR_ELT(f,n) @@ -361,6 +391,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 4 #define INIT init_trans_4_GLuint_raw #define DEST_4F trans_4_GLuint_4f_raw +#define DEST_4FC trans_4_GLuint_4fc_raw #define DEST_4UB trans_4_GLuint_4ub_raw #define DEST_4US trans_4_GLuint_4us_raw #include "m_trans_tmp.h" @@ -368,6 +399,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 3 #define INIT init_trans_3_GLuint_raw #define DEST_4F trans_3_GLuint_4f_raw +#define DEST_4FC trans_3_GLuint_4fc_raw #define DEST_4UB trans_3_GLuint_4ub_raw #define DEST_4US trans_3_GLuint_4us_raw #define DEST_3F trans_3_GLuint_3f_raw @@ -376,11 +408,13 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 2 #define INIT init_trans_2_GLuint_raw #define DEST_4F trans_2_GLuint_4f_raw +#define DEST_4FC trans_2_GLuint_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLuint_raw #define DEST_4F trans_1_GLuint_4f_raw +#define DEST_4FC trans_1_GLuint_4fc_raw #define DEST_1UB trans_1_GLuint_1ub_raw #define DEST_1UI trans_1_GLuint_1ui_raw #include "m_trans_tmp.h" @@ -389,6 +423,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #undef SRC_IDX #undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI @@ -400,6 +435,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SRC_IDX TYPE_IDX(GL_DOUBLE) #define TRX_3F(f,n) (GLfloat) PTR_ELT(f,n) #define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n) +#define TRX_4FC(f,n) (GLfloat) PTR_ELT(f,n) #define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n)) #define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n)) #define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) @@ -409,6 +445,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 4 #define INIT init_trans_4_GLdouble_raw #define DEST_4F trans_4_GLdouble_4f_raw +#define DEST_4FC trans_4_GLdouble_4fc_raw #define DEST_4UB trans_4_GLdouble_4ub_raw #define DEST_4US trans_4_GLdouble_4us_raw #include "m_trans_tmp.h" @@ -416,6 +453,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 3 #define INIT init_trans_3_GLdouble_raw #define DEST_4F trans_3_GLdouble_4f_raw +#define DEST_4FC trans_3_GLdouble_4fc_raw #define DEST_4UB trans_3_GLdouble_4ub_raw #define DEST_4US trans_3_GLdouble_4us_raw #define DEST_3F trans_3_GLdouble_3f_raw @@ -424,11 +462,13 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 2 #define INIT init_trans_2_GLdouble_raw #define DEST_4F trans_2_GLdouble_4f_raw +#define DEST_4FC trans_2_GLdouble_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLdouble_raw #define DEST_4F trans_1_GLdouble_4f_raw +#define DEST_4FC trans_1_GLdouble_4fc_raw #define DEST_1UB trans_1_GLdouble_1ub_raw #define DEST_1UI trans_1_GLdouble_1ui_raw #define DEST_1F trans_1_GLdouble_1f_raw @@ -446,11 +486,13 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define DEST_4UB trans_4_GLfloat_4ub_raw #define DEST_4US trans_4_GLfloat_4us_raw #define DEST_4F trans_4_GLfloat_4f_raw +#define DEST_4FC trans_4_GLfloat_4fc_raw #include "m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLfloat_raw #define DEST_4F trans_3_GLfloat_4f_raw +#define DEST_4FC trans_3_GLfloat_4fc_raw #define DEST_4UB trans_3_GLfloat_4ub_raw #define DEST_4US trans_3_GLfloat_4us_raw #define DEST_3F trans_3_GLfloat_3f_raw @@ -459,11 +501,13 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #define SZ 2 #define INIT init_trans_2_GLfloat_raw #define DEST_4F trans_2_GLfloat_4f_raw +#define DEST_4FC trans_2_GLfloat_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLfloat_raw #define DEST_4F trans_1_GLfloat_4f_raw +#define DEST_4FC trans_1_GLfloat_4fc_raw #define DEST_1UB trans_1_GLfloat_1ub_raw #define DEST_1UI trans_1_GLfloat_1ui_raw #define DEST_1F trans_1_GLfloat_1f_raw @@ -474,6 +518,7 @@ static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; #undef SRC_IDX #undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI @@ -512,6 +557,7 @@ static void init_translate_raw(void) MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) ); MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) ); MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) ); + MEMSET( TAB(_4fc), 0, sizeof(TAB(_4fc)) ); init_trans_4_GLbyte_raw(); init_trans_3_GLbyte_raw(); @@ -624,7 +670,7 @@ void _math_trans_4chan( GLchan (*to)[4], #elif CHAN_TYPE == GL_UNSIGNED_SHORT _math_trans_4us( to, ptr, stride, type, size, start, n ); #elif CHAN_TYPE == GL_FLOAT - _math_trans_4f( to, ptr, stride, type, size, start, n ); + _math_trans_4fc( to, ptr, stride, type, size, start, n ); #endif } @@ -650,6 +696,17 @@ void _math_trans_4f(GLfloat (*to)[4], _math_trans_4f_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); } +void _math_trans_4fc(GLfloat (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ) +{ + _math_trans_4fc_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); +} + void _math_trans_3f(GLfloat (*to)[3], CONST void *ptr, GLuint stride, diff --git a/xc/extras/Mesa/src/math/m_translate.h b/xc/extras/Mesa/src/math/m_translate.h index c473f83d6..527c7063d 100644 --- a/xc/extras/Mesa/src/math/m_translate.h +++ b/xc/extras/Mesa/src/math/m_translate.h @@ -85,6 +85,14 @@ extern void _math_trans_4f(GLfloat (*to)[4], GLuint start, GLuint n ); +extern void _math_trans_4fc(GLfloat (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ); + extern void _math_trans_3f(GLfloat (*to)[3], CONST void *ptr, GLuint stride, diff --git a/xc/extras/Mesa/src/rastpos.c b/xc/extras/Mesa/src/rastpos.c index 47c9f105b..7590c9b17 100644 --- a/xc/extras/Mesa/src/rastpos.c +++ b/xc/extras/Mesa/src/rastpos.c @@ -346,8 +346,7 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) } /* ndc = clip / W */ - ASSERT( clip[3]!=0.0 ); - d = 1.0F / clip[3]; + d = (clip[3] == 0.0) ? 1.0 : 1.0F / clip[3]; ndc[0] = clip[0] * d; ndc[1] = clip[1] * d; ndc[2] = clip[2] * d; diff --git a/xc/extras/Mesa/src/swrast/s_drawpix.c b/xc/extras/Mesa/src/swrast/s_drawpix.c index 3bcee0fc6..976c8ad8b 100644 --- a/xc/extras/Mesa/src/swrast/s_drawpix.c +++ b/xc/extras/Mesa/src/swrast/s_drawpix.c @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 5.0 + * Version: 5.0.2 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -685,19 +684,14 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, span.array->z[i] = (GLdepth) (fspan[i] * zs + 0.5F); } } - if (ctx->Visual.rgbMode) { - if (zoom) { - _mesa_write_zoomed_rgba_span(ctx, &span, - (const GLchan (*)[4]) span.array->rgba, desty); - } - else - _mesa_write_rgba_span(ctx, &span); + if (zoom) { + _mesa_write_zoomed_depth_span(ctx, &span, desty); + } + else if (ctx->Visual.rgbMode) { + _mesa_write_rgba_span(ctx, &span); } else { - if (zoom) - _mesa_write_zoomed_index_span(ctx, &span, desty); - else - _mesa_write_index_span(ctx, &span); + _mesa_write_index_span(ctx, &span); } } } diff --git a/xc/extras/Mesa/src/swrast/s_zoom.c b/xc/extras/Mesa/src/swrast/s_zoom.c index a8c1a939e..319f2d9e4 100644 --- a/xc/extras/Mesa/src/swrast/s_zoom.c +++ b/xc/extras/Mesa/src/swrast/s_zoom.c @@ -1,7 +1,6 @@ - /* * Mesa 3-D graphics library - * Version: 5.0.1 + * Version: 5.0.2 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * @@ -45,37 +44,52 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, GLint c0, c1, skipCol; GLint i, j; const GLuint maxWidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); - GLchan rgbaSave[MAX_WIDTH][4]; - GLuint indexSave[MAX_WIDTH]; - const GLchan (*rgba)[4] = (const GLchan (*)[4]) src; - const GLchan (*rgb)[3] = (const GLchan (*)[3]) src; - const GLuint *indexes = (const GLuint *) src; struct sw_span zoomed; struct span_arrays zoomed_arrays; /* this is big! */ - /* no pixel arrays! */ + /* no pixel arrays! must be horizontal spans. */ ASSERT((span->arrayMask & SPAN_XY) == 0); ASSERT(span->primitive == GL_BITMAP); INIT_SPAN(zoomed, GL_BITMAP, 0, 0, 0); zoomed.array = &zoomed_arrays; + /* copy fog interp info */ + zoomed.fog = span->fog; + zoomed.fogStep = span->fogStep; + /* XXX copy texcoord info? */ + if (format == GL_RGBA || format == GL_RGB) { + /* copy Z info */ zoomed.z = span->z; - zoomed.zStep = span->zStep; /* span->zStep == 0 */ - zoomed.fog = span->fog; - zoomed.fogStep = span->fogStep; + zoomed.zStep = span->zStep; + /* we'll generate an array of colorss */ zoomed.interpMask = span->interpMask & ~SPAN_RGBA; zoomed.arrayMask |= SPAN_RGBA; } else if (format == GL_COLOR_INDEX) { + /* copy Z info */ zoomed.z = span->z; zoomed.zStep = span->zStep; - zoomed.fog = span->fog; - zoomed.fogStep = span->fogStep; + /* we'll generate an array of color indexes */ zoomed.interpMask = span->interpMask & ~SPAN_INDEX; zoomed.arrayMask |= SPAN_INDEX; } + else { + assert(format == GL_DEPTH_COMPONENT); + /* Copy color info */ + zoomed.red = span->red; + zoomed.green = span->green; + zoomed.blue = span->blue; + zoomed.alpha = span->alpha; + zoomed.redStep = span->redStep; + zoomed.greenStep = span->greenStep; + zoomed.blueStep = span->blueStep; + zoomed.alphaStep = span->alphaStep; + /* we'll generate an array of depth values */ + zoomed.interpMask = span->interpMask & ~SPAN_Z; + zoomed.arrayMask |= SPAN_Z; + } /* * Compute which columns to draw: [c0, c1) @@ -139,6 +153,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, /* zoom the span horizontally */ if (format == GL_RGBA) { + const GLchan (*rgba)[4] = (const GLchan (*)[4]) src; if (ctx->Pixel.ZoomX == -1.0F) { /* common case */ for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { @@ -158,6 +173,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, } } else if (format == GL_RGB) { + const GLchan (*rgb)[3] = (const GLchan (*)[3]) src; if (ctx->Pixel.ZoomX == -1.0F) { /* common case */ for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { @@ -183,6 +199,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, } } else if (format == GL_COLOR_INDEX) { + const GLuint *indexes = (const GLuint *) src; if (ctx->Pixel.ZoomX == -1.0F) { /* common case */ for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { @@ -201,6 +218,37 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, } } } + else { + const GLdepth *zValues = (const GLuint *) src; + assert(format == GL_DEPTH_COMPONENT); + if (ctx->Pixel.ZoomX == -1.0F) { + /* common case */ + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = span->end - (j + skipCol) - 1; + zoomed.array->z[j] = zValues[i]; + } + } + else { + /* general solution */ + const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = (GLint) ((j + skipCol) * xscale); + if (ctx->Pixel.ZoomX < 0.0) { + ASSERT(i <= 0); + i = span->end + i - 1; + } + ASSERT(i >= 0); + ASSERT(i < (GLint) span->end); + zoomed.array->z[j] = zValues[i]; + } + } + /* Now, fall into either the RGB or COLOR_INDEX path below */ + if (ctx->Visual.rgbMode) + format = GL_RGBA; + else + format = GL_COLOR_INDEX; + } + /* write the span in rows [r0, r1) */ if (format == GL_RGBA || format == GL_RGB) { @@ -208,6 +256,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, * going to call _mesa_write_zoomed_span() more than once. * Also, clipping may change the span end value, so store it as well. */ + GLchan rgbaSave[MAX_WIDTH][4]; const GLint end = zoomed.end; /* save */ if (r1 - r0 > 1) { MEMCPY(rgbaSave, zoomed.array->rgba, zoomed.end * 4 * sizeof(GLchan)); @@ -222,6 +271,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span, } } else if (format == GL_COLOR_INDEX) { + GLuint indexSave[MAX_WIDTH]; const GLint end = zoomed.end; /* save */ if (r1 - r0 > 1) { MEMCPY(indexSave, zoomed.array->index, zoomed.end * sizeof(GLuint)); @@ -262,6 +312,14 @@ _mesa_write_zoomed_index_span( GLcontext *ctx, const struct sw_span *span, } +void +_mesa_write_zoomed_depth_span( GLcontext *ctx, const struct sw_span *span, + GLint y0 ) +{ + zoom_span(ctx, span, (const GLvoid *) span->array->z, y0, GL_DEPTH_COMPONENT); +} + + /* * As above, but write stencil values. */ diff --git a/xc/extras/Mesa/src/swrast/s_zoom.h b/xc/extras/Mesa/src/swrast/s_zoom.h index bdc7013e0..d882c2635 100644 --- a/xc/extras/Mesa/src/swrast/s_zoom.h +++ b/xc/extras/Mesa/src/swrast/s_zoom.h @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 4.1 + * Version: 5.0.2 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -42,6 +41,10 @@ _mesa_write_zoomed_index_span( GLcontext *ctx, const struct sw_span *span, GLint y0 ); extern void +_mesa_write_zoomed_depth_span( GLcontext *ctx, const struct sw_span *span, + GLint y0 ); + +extern void _mesa_write_zoomed_stencil_span( GLcontext *ctx, GLuint n, GLint x, GLint y, const GLstencil stencil[], GLint y0 ); diff --git a/xc/extras/Mesa/src/texobj.c b/xc/extras/Mesa/src/texobj.c index 22042579e..abaa41d6b 100644 --- a/xc/extras/Mesa/src/texobj.c +++ b/xc/extras/Mesa/src/texobj.c @@ -36,8 +36,8 @@ /* - * Allocate a new texture object and add it to the linked list of texture - * objects. If name>0 then also insert the new texture object into the hash + * Allocate a new texture object and put it into the hash table. + * If name>0 then also insert the new texture object into the hash * table. * Input: shared - the shared GL state structure to contain the texture object * name - integer name for the texture object @@ -523,16 +523,17 @@ _mesa_GenTextures( GLsizei n, GLuint *texName ) first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n); - /* Return the texture names */ - for (i=0;i<n;i++) { - texName[i] = first + i; - } - - /* Allocate new, empty texture objects */ + /* Allocate new, empty texture objects and return the IDs */ for (i=0;i<n;i++) { GLuint name = first + i; GLenum target = 0; - (void) _mesa_alloc_texture_object( ctx->Shared, name, target); + struct gl_texture_object *texObj; + texObj = _mesa_alloc_texture_object( ctx->Shared, name, target); + if (!texObj) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTextures"); + break; + } + texName[i] = name; } _glthread_UNLOCK_MUTEX(GenTexturesLock); diff --git a/xc/extras/Mesa/src/texstate.c b/xc/extras/Mesa/src/texstate.c index 87024cc07..586d1c425 100644 --- a/xc/extras/Mesa/src/texstate.c +++ b/xc/extras/Mesa/src/texstate.c @@ -1,7 +1,6 @@ - /* * Mesa 3-D graphics library - * Version: 5.0.1 + * Version: 5.0.2 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * @@ -1369,7 +1368,10 @@ void _mesa_TexParameteri( GLenum target, GLenum pname, GLint param ) { GLfloat fparam[4]; - fparam[0] = (GLfloat) param; + if (pname == GL_TEXTURE_PRIORITY) + fparam[0] = INT_TO_FLOAT(param); + else + fparam[0] = (GLfloat) param; fparam[1] = fparam[2] = fparam[3] = 0.0; _mesa_TexParameterfv(target, pname, fparam); } @@ -1386,7 +1388,10 @@ _mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) fparam[3] = INT_TO_FLOAT(params[3]); } else { - fparam[0] = (GLfloat) params[0]; + if (pname == GL_TEXTURE_PRIORITY) + fparam[0] = INT_TO_FLOAT(params[0]); + else + fparam[0] = (GLfloat) params[0]; fparam[1] = fparam[2] = fparam[3] = 0.0F; } _mesa_TexParameterfv(target, pname, fparam); @@ -1782,7 +1787,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) } return; case GL_TEXTURE_PRIORITY: - *params = (GLint) obj->Priority; + *params = FLOAT_TO_INT(obj->Priority); return; case GL_TEXTURE_MIN_LOD: *params = (GLint) obj->MinLod; @@ -2103,9 +2108,14 @@ _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) { GLfloat p[4]; p[0] = (GLfloat) params[0]; - p[1] = (GLfloat) params[1]; - p[2] = (GLfloat) params[2]; - p[3] = (GLfloat) params[3]; + if (pname == GL_TEXTURE_GEN_MODE) { + p[1] = p[2] = p[3] = 0.0F; + } + else { + p[1] = (GLfloat) params[1]; + p[2] = (GLfloat) params[2]; + p[3] = (GLfloat) params[3]; + } _mesa_TexGenfv(coord, pname, p); } @@ -2123,9 +2133,14 @@ _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) { GLfloat p[4]; p[0] = (GLfloat) params[0]; - p[1] = (GLfloat) params[1]; - p[2] = (GLfloat) params[2]; - p[3] = (GLfloat) params[3]; + if (pname == GL_TEXTURE_GEN_MODE) { + p[1] = p[2] = p[3] = 0.0F; + } + else { + p[1] = (GLfloat) params[1]; + p[2] = (GLfloat) params[2]; + p[3] = (GLfloat) params[3]; + } _mesa_TexGenfv( coord, pname, p ); } diff --git a/xc/extras/Mesa/src/tnl/t_imm_elt.c b/xc/extras/Mesa/src/tnl/t_imm_elt.c index 254b78d7f..4349343be 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_elt.c +++ b/xc/extras/Mesa/src/tnl/t_imm_elt.c @@ -39,21 +39,11 @@ #include "t_imm_elt.h" - -typedef void (*trans_elt_1f_func)(GLfloat *to, - CONST void *ptr, - GLuint stride, - GLuint *flags, - GLuint *elts, - GLuint match, - GLuint start, - GLuint n ); - typedef void (*trans_elt_1ui_func)(GLuint *to, CONST void *ptr, GLuint stride, - GLuint *flags, - GLuint *elts, + const GLuint *flags, + const GLuint *elts, GLuint match, GLuint start, GLuint n ); @@ -61,66 +51,31 @@ typedef void (*trans_elt_1ui_func)(GLuint *to, typedef void (*trans_elt_1ub_func)(GLubyte *to, CONST void *ptr, GLuint stride, - GLuint *flags, - GLuint *elts, + const GLuint *flags, + const GLuint *elts, GLuint match, GLuint start, GLuint n ); -typedef void (*trans_elt_4ub_func)(GLubyte (*to)[4], - CONST void *ptr, - GLuint stride, - GLuint *flags, - GLuint *elts, - GLuint match, - GLuint start, - GLuint n ); - -typedef void (*trans_elt_4us_func)(GLushort (*to)[4], - CONST void *ptr, - GLuint stride, - GLuint *flags, - GLuint *elts, - GLuint match, - GLuint start, - GLuint n ); - typedef void (*trans_elt_4f_func)(GLfloat (*to)[4], CONST void *ptr, GLuint stride, - GLuint *flags, - GLuint *elts, + const GLuint *flags, + const GLuint *elts, GLuint match, GLuint start, GLuint n ); -typedef void (*trans_elt_3f_func)(GLfloat (*to)[3], - CONST void *ptr, - GLuint stride, - GLuint *flags, - GLuint *elts, - GLuint match, - GLuint start, - GLuint n ); - - - - -static trans_elt_1f_func _tnl_trans_elt_1f_tab[MAX_TYPES]; static trans_elt_1ui_func _tnl_trans_elt_1ui_tab[MAX_TYPES]; static trans_elt_1ub_func _tnl_trans_elt_1ub_tab[MAX_TYPES]; -static trans_elt_3f_func _tnl_trans_elt_3f_tab[MAX_TYPES]; -static trans_elt_4ub_func _tnl_trans_elt_4ub_tab[5][MAX_TYPES]; -static trans_elt_4us_func _tnl_trans_elt_4us_tab[5][MAX_TYPES]; static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; +static trans_elt_4f_func _tnl_trans_elt_4fc_tab[5][MAX_TYPES]; #define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt]) - - /* Code specific to array element implementation. There is a small * subtlety in the bits CHECK() tests, and the way bits are set in * glArrayElement which ensures that if, eg, in the case that the @@ -134,7 +89,7 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; * That the correct value for normal is used. */ #define TAB(x) _tnl_trans_elt##x##_tab -#define ARGS GLuint *flags, GLuint *elts, GLuint match, \ +#define ARGS const GLuint *flags, const GLuint *elts, GLuint match, \ GLuint start, GLuint n #define SRC_START 0 #define DST_START start @@ -147,45 +102,42 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; */ #define SRC GLbyte #define SRC_IDX TYPE_IDX(GL_BYTE) -#define TRX_3F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = BYTE_TO_UBYTE( PTR_ELT(f,n) ) -#define TRX_US(us, f,n) us = BYTE_TO_USHORT( PTR_ELT(f,n) ) #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) #define SZ 4 #define INIT init_trans_4_GLbyte_elt #define DEST_4F trans_4_GLbyte_4f_elt -#define DEST_4UB trans_4_GLbyte_4ub_elt -#define DEST_4US trans_4_GLbyte_4us_elt +#define DEST_4FC trans_4_GLbyte_4fc_elt #include "math/m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLbyte_elt #define DEST_4F trans_3_GLbyte_4f_elt -#define DEST_4UB trans_3_GLbyte_4ub_elt -#define DEST_4US trans_3_GLbyte_4us_elt -#define DEST_3F trans_3_GLbyte_3f_elt +#define DEST_4FC trans_3_GLbyte_4fc_elt #include "math/m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLbyte_elt #define DEST_4F trans_2_GLbyte_4f_elt +#define DEST_4FC trans_2_GLbyte_4fc_elt #include "math/m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLbyte_elt #define DEST_4F trans_1_GLbyte_4f_elt +#define DEST_4FC trans_1_GLbyte_4fc_elt #define DEST_1UB trans_1_GLbyte_1ub_elt #define DEST_1UI trans_1_GLbyte_1ui_elt #include "math/m_trans_tmp.h" #undef SRC -#undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB -#undef TRX_US #undef TRX_UI #undef SRC_IDX @@ -193,10 +145,9 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; */ #define SRC GLubyte #define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE) -#define TRX_3F(f,n) UBYTE_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) UBYTE_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) UBYTE_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = PTR_ELT(f,n) -#define TRX_US(us, f,n) us = PTR_ELT(f,n) #define TRX_UI(f,n) (GLuint)PTR_ELT(f,n) /* 4ub->4ub handled in special case below. @@ -204,30 +155,29 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; #define SZ 4 #define INIT init_trans_4_GLubyte_elt #define DEST_4F trans_4_GLubyte_4f_elt -#define DEST_4US trans_4_GLubyte_4us_elt +#define DEST_4FC trans_4_GLubyte_4fc_elt #include "math/m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLubyte_elt #define DEST_4F trans_3_GLubyte_4f_elt -#define DEST_3F trans_3_GLubyte_3f_elt -#define DEST_4UB trans_3_GLubyte_4ub_elt -#define DEST_4US trans_3_GLubyte_4us_elt +#define DEST_4FC trans_3_GLubyte_4fc_elt #include "math/m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLubyte_elt -#define DEST_1UI trans_1_GLubyte_1ui_elt +#define DEST_4F trans_1_GLubyte_4f_elt +#define DEST_4FC trans_1_GLubyte_4fc_elt #define DEST_1UB trans_1_GLubyte_1ub_elt +#define DEST_1UI trans_1_GLubyte_1ui_elt #include "math/m_trans_tmp.h" #undef SRC #undef SRC_IDX -#undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB -#undef TRX_US #undef TRX_UI @@ -235,36 +185,34 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; */ #define SRC GLshort #define SRC_IDX TYPE_IDX(GL_SHORT) -#define TRX_3F(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = SHORT_TO_UBYTE(PTR_ELT(f,n)) -#define TRX_US(us, f,n) us = SHORT_TO_USHORT(PTR_ELT(f,n)) #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) #define SZ 4 #define INIT init_trans_4_GLshort_elt #define DEST_4F trans_4_GLshort_4f_elt -#define DEST_4UB trans_4_GLshort_4ub_elt -#define DEST_4US trans_4_GLshort_4us_elt +#define DEST_4FC trans_4_GLshort_4fc_elt #include "math/m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLshort_elt #define DEST_4F trans_3_GLshort_4f_elt -#define DEST_4UB trans_3_GLshort_4ub_elt -#define DEST_4US trans_3_GLshort_4us_elt -#define DEST_3F trans_3_GLshort_3f_elt +#define DEST_4FC trans_3_GLshort_4fc_elt #include "math/m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLshort_elt #define DEST_4F trans_2_GLshort_4f_elt +#define DEST_4FC trans_2_GLshort_4fc_elt #include "math/m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLshort_elt #define DEST_4F trans_1_GLshort_4f_elt +#define DEST_4FC trans_1_GLshort_4fc_elt #define DEST_1UB trans_1_GLshort_1ub_elt #define DEST_1UI trans_1_GLshort_1ui_elt #include "math/m_trans_tmp.h" @@ -272,10 +220,9 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; #undef SRC #undef SRC_IDX -#undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB -#undef TRX_US #undef TRX_UI @@ -283,46 +230,43 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; */ #define SRC GLushort #define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT) -#define TRX_3F(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_UB(ub,f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 8) -#define TRX_US(us,f,n) us = PTR_ELT(f,n) #define TRX_UI(f,n) (GLuint) PTR_ELT(f,n) #define SZ 4 #define INIT init_trans_4_GLushort_elt #define DEST_4F trans_4_GLushort_4f_elt -#define DEST_4UB trans_4_GLushort_4ub_elt -#define DEST_4US trans_4_GLushort_4us_elt +#define DEST_4FC trans_4_GLushort_4fc_elt #include "math/m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLushort_elt #define DEST_4F trans_3_GLushort_4f_elt -#define DEST_4UB trans_3_GLushort_4ub_elt -#define DEST_4US trans_3_GLushort_4us_elt -#define DEST_3F trans_3_GLushort_3f_elt +#define DEST_4FC trans_3_GLushort_4fc_elt #include "math/m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLushort_elt #define DEST_4F trans_2_GLushort_4f_elt +#define DEST_4FC trans_2_GLushort_4fc_elt #include "math/m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLushort_elt #define DEST_4F trans_1_GLushort_4f_elt +#define DEST_4FC trans_1_GLushort_4fc_elt #define DEST_1UB trans_1_GLushort_1ub_elt #define DEST_1UI trans_1_GLushort_1ui_elt #include "math/m_trans_tmp.h" #undef SRC #undef SRC_IDX -#undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB -#undef TRX_US #undef TRX_UI @@ -330,36 +274,34 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; */ #define SRC GLint #define SRC_IDX TYPE_IDX(GL_INT) -#define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = INT_TO_UBYTE(PTR_ELT(f,n)) -#define TRX_US(us, f,n) us = INT_TO_USHORT(PTR_ELT(f,n)) #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) #define SZ 4 #define INIT init_trans_4_GLint_elt #define DEST_4F trans_4_GLint_4f_elt -#define DEST_4UB trans_4_GLint_4ub_elt -#define DEST_4US trans_4_GLint_4us_elt +#define DEST_4FC trans_4_GLint_4fc_elt #include "math/m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLint_elt #define DEST_4F trans_3_GLint_4f_elt -#define DEST_4UB trans_3_GLint_4ub_elt -#define DEST_4US trans_3_GLint_4us_elt -#define DEST_3F trans_3_GLint_3f_elt +#define DEST_4FC trans_3_GLint_4fc_elt #include "math/m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLint_elt #define DEST_4F trans_2_GLint_4f_elt +#define DEST_4FC trans_2_GLint_4fc_elt #include "math/m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLint_elt #define DEST_4F trans_1_GLint_4f_elt +#define DEST_4FC trans_1_GLint_4fc_elt #define DEST_1UB trans_1_GLint_1ub_elt #define DEST_1UI trans_1_GLint_1ui_elt #include "math/m_trans_tmp.h" @@ -367,10 +309,9 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; #undef SRC #undef SRC_IDX -#undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB -#undef TRX_US #undef TRX_UI @@ -378,46 +319,43 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; */ #define SRC GLuint #define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT) -#define TRX_3F(f,n) UINT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_4FC(f,n) UINT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 24) -#define TRX_US(us, f,n) us = (GLushort) (PTR_ELT(f,n) >> 16) #define TRX_UI(f,n) PTR_ELT(f,n) #define SZ 4 #define INIT init_trans_4_GLuint_elt #define DEST_4F trans_4_GLuint_4f_elt -#define DEST_4UB trans_4_GLuint_4ub_elt -#define DEST_4US trans_4_GLuint_4us_elt +#define DEST_4FC trans_4_GLuint_4fc_elt #include "math/m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLuint_elt #define DEST_4F trans_3_GLuint_4f_elt -#define DEST_4UB trans_3_GLuint_4ub_elt -#define DEST_4US trans_3_GLuint_4us_elt -#define DEST_3F trans_3_GLuint_3f_elt +#define DEST_4FC trans_3_GLuint_4fc_elt #include "math/m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLuint_elt #define DEST_4F trans_2_GLuint_4f_elt +#define DEST_4FC trans_2_GLuint_4fc_elt #include "math/m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLuint_elt #define DEST_4F trans_1_GLuint_4f_elt +#define DEST_4FC trans_1_GLuint_4fc_elt #define DEST_1UB trans_1_GLuint_1ub_elt #define DEST_1UI trans_1_GLuint_1ui_elt #include "math/m_trans_tmp.h" #undef SRC #undef SRC_IDX -#undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB -#undef TRX_US #undef TRX_UI @@ -425,10 +363,9 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; */ #define SRC GLdouble #define SRC_IDX TYPE_IDX(GL_DOUBLE) -#define TRX_3F(f,n) (GLfloat) PTR_ELT(f,n) #define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n) +#define TRX_4FC(f,n) (GLfloat) PTR_ELT(f,n) #define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n)) -#define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n)) #define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) #define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n) @@ -436,117 +373,89 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; #define SZ 4 #define INIT init_trans_4_GLdouble_elt #define DEST_4F trans_4_GLdouble_4f_elt -#define DEST_4UB trans_4_GLdouble_4ub_elt -#define DEST_4US trans_4_GLdouble_4us_elt +#define DEST_4FC trans_4_GLdouble_4fc_elt #include "math/m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLdouble_elt #define DEST_4F trans_3_GLdouble_4f_elt -#define DEST_4UB trans_3_GLdouble_4ub_elt -#define DEST_4US trans_3_GLdouble_4us_elt -#define DEST_3F trans_3_GLdouble_3f_elt +#define DEST_4FC trans_3_GLdouble_4fc_elt #include "math/m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLdouble_elt #define DEST_4F trans_2_GLdouble_4f_elt +#define DEST_4FC trans_2_GLdouble_4fc_elt #include "math/m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLdouble_elt #define DEST_4F trans_1_GLdouble_4f_elt +#define DEST_4FC trans_1_GLdouble_4fc_elt #define DEST_1UB trans_1_GLdouble_1ub_elt #define DEST_1UI trans_1_GLdouble_1ui_elt -#define DEST_1F trans_1_GLdouble_1f_elt #include "math/m_trans_tmp.h" #undef SRC #undef SRC_IDX +#undef TRX_4F +#undef TRX_4FC +#undef TRX_UB +#undef TRX_UI /* GL_FLOAT */ #define SRC GLfloat #define SRC_IDX TYPE_IDX(GL_FLOAT) +#define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n) +#define TRX_4FC(f,n) (GLfloat) PTR_ELT(f,n) +#define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n)) +#define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) +#define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n) + + #define SZ 4 #define INIT init_trans_4_GLfloat_elt -#define DEST_4UB trans_4_GLfloat_4ub_elt -#define DEST_4US trans_4_GLfloat_4us_elt #define DEST_4F trans_4_GLfloat_4f_elt +#define DEST_4FC trans_4_GLfloat_4fc_elt #include "math/m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLfloat_elt #define DEST_4F trans_3_GLfloat_4f_elt -#define DEST_4UB trans_3_GLfloat_4ub_elt -#define DEST_4US trans_3_GLfloat_4us_elt -#define DEST_3F trans_3_GLfloat_3f_elt +#define DEST_4FC trans_3_GLfloat_4fc_elt #include "math/m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLfloat_elt #define DEST_4F trans_2_GLfloat_4f_elt +#define DEST_4FC trans_2_GLfloat_4fc_elt #include "math/m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLfloat_elt -#define DEST_4F trans_1_GLfloat_3f_elt +#define DEST_4F trans_1_GLfloat_4f_elt +#define DEST_4FC trans_1_GLfloat_4fc_elt #define DEST_1UB trans_1_GLfloat_1ub_elt #define DEST_1UI trans_1_GLfloat_1ui_elt -#define DEST_1F trans_1_GLfloat_1f_elt #include "math/m_trans_tmp.h" #undef SRC #undef SRC_IDX -#undef TRX_3F #undef TRX_4F +#undef TRX_4FC #undef TRX_UB -#undef TRX_US #undef TRX_UI -static void trans_4_GLubyte_4ub(GLubyte (*t)[4], - CONST void *Ptr, - GLuint stride, - ARGS ) -{ - const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride; - const GLubyte *first = f; - GLuint i; - (void) start; - if (((((long) f | (long) stride)) & 3L) == 0L) { - /* Aligned. - */ - for (i = DST_START ; i < n ; i++, NEXT_F) { - CHECK { - NEXT_F2; - COPY_4UBV( t[i], f ); - } - } - } else { - for (i = DST_START ; i < n ; i++, NEXT_F) { - CHECK { - NEXT_F2; - t[i][0] = f[0]; - t[i][1] = f[1]; - t[i][2] = f[2]; - t[i][3] = f[3]; - } - } - } -} static void init_translate_elt(void) { MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) ); MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) ); - MEMSET( TAB(_3f), 0, sizeof(TAB(_3f)) ); - MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) ); - MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) ); MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) ); - - TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub; + MEMSET( TAB(_4fc), 0, sizeof(TAB(_4fc)) ); init_trans_4_GLbyte_elt(); init_trans_3_GLbyte_elt(); @@ -590,38 +499,16 @@ static void init_translate_elt(void) - void _tnl_imm_elt_init( void ) { init_translate_elt(); } -#if 00 -static void _tnl_trans_elt_1f(GLfloat *to, - const struct gl_client_array *from, - GLuint *flags, - GLuint *elts, - GLuint match, - GLuint start, - GLuint n ) -{ - _tnl_trans_elt_1f_tab[TYPE_IDX(from->Type)]( to, - from->Ptr, - from->StrideB, - flags, - elts, - match, - start, - n ); - -} -#endif - static void _tnl_trans_elt_1ui(GLuint *to, const struct gl_client_array *from, - GLuint *flags, - GLuint *elts, + const GLuint *flags, + const GLuint *elts, GLuint match, GLuint start, GLuint n ) @@ -640,8 +527,8 @@ static void _tnl_trans_elt_1ui(GLuint *to, static void _tnl_trans_elt_1ub(GLubyte *to, const struct gl_client_array *from, - GLuint *flags, - GLuint *elts, + const GLuint *flags, + const GLuint *elts, GLuint match, GLuint start, GLuint n ) @@ -658,52 +545,10 @@ static void _tnl_trans_elt_1ub(GLubyte *to, } -#if 0 -static void _tnl_trans_elt_4ub(GLubyte (*to)[4], - const struct gl_client_array *from, - GLuint *flags, - GLuint *elts, - GLuint match, - GLuint start, - GLuint n ) -{ - _tnl_trans_elt_4ub_tab[from->Size][TYPE_IDX(from->Type)]( to, - from->Ptr, - from->StrideB, - flags, - elts, - match, - start, - n ); - -} -#endif - -#if 0 -static void _tnl_trans_elt_4us(GLushort (*to)[4], - const struct gl_client_array *from, - GLuint *flags, - GLuint *elts, - GLuint match, - GLuint start, - GLuint n ) -{ - _tnl_trans_elt_4us_tab[from->Size][TYPE_IDX(from->Type)]( to, - from->Ptr, - from->StrideB, - flags, - elts, - match, - start, - n ); - -} -#endif - static void _tnl_trans_elt_4f(GLfloat (*to)[4], const struct gl_client_array *from, - GLuint *flags, - GLuint *elts, + const GLuint *flags, + const GLuint *elts, GLuint match, GLuint start, GLuint n ) @@ -721,16 +566,15 @@ static void _tnl_trans_elt_4f(GLfloat (*to)[4], -#if 0 -static void _tnl_trans_elt_3f(GLfloat (*to)[3], - const struct gl_client_array *from, - GLuint *flags, - GLuint *elts, - GLuint match, - GLuint start, - GLuint n ) +static void _tnl_trans_elt_4fc(GLfloat (*to)[4], + const struct gl_client_array *from, + const GLuint *flags, + const GLuint *elts, + GLuint match, + GLuint start, + GLuint n ) { - _tnl_trans_elt_3f_tab[TYPE_IDX(from->Type)]( to, + _tnl_trans_elt_4fc_tab[from->Size][TYPE_IDX(from->Type)]( to, from->Ptr, from->StrideB, flags, @@ -738,8 +582,8 @@ static void _tnl_trans_elt_3f(GLfloat (*to)[3], match, start, n ); + } -#endif @@ -753,7 +597,7 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, GLuint start, GLuint count ) { GLuint *flags = IM->Flag; - GLuint *elts = IM->Elt; + const GLuint *elts = IM->Elt; GLuint translate = ctx->Array._Enabled; GLuint i; @@ -786,17 +630,17 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, start, count); if (translate & VERT_BIT_COLOR0) { - _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR0], - &ctx->Array.Color, - flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR0), - start, count); + _tnl_trans_elt_4fc( IM->Attrib[VERT_ATTRIB_COLOR0], + &ctx->Array.Color, + flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR0), + start, count); } if (translate & VERT_BIT_COLOR1) { - _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR1], - &ctx->Array.SecondaryColor, - flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR1), - start, count); + _tnl_trans_elt_4fc( IM->Attrib[VERT_ATTRIB_COLOR1], + &ctx->Array.SecondaryColor, + flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR1), + start, count); } if (translate & VERT_BIT_FOG) diff --git a/xc/extras/Mesa/src/tnl/t_vb_light.c b/xc/extras/Mesa/src/tnl/t_vb_light.c index a75dacf54..05caae9a9 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_light.c +++ b/xc/extras/Mesa/src/tnl/t_vb_light.c @@ -83,13 +83,13 @@ static void import_color_material( GLcontext *ctx, else to->StrideB = 4 * sizeof(GLfloat); - _math_trans_4f( (GLfloat (*)[4]) to->Ptr, - from->Ptr, - from->StrideB, - from->Type, - from->Size, - 0, - count); + _math_trans_4fc( (GLfloat (*)[4]) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + from->Size, + 0, + count); VB->ColorPtr[0] = to; } diff --git a/xc/extras/Mesa/src/tnl_dd/t_dd_dmatmp2.h b/xc/extras/Mesa/src/tnl_dd/t_dd_dmatmp2.h index 3f58d24c9..1d2614fbc 100644 --- a/xc/extras/Mesa/src/tnl_dd/t_dd_dmatmp2.h +++ b/xc/extras/Mesa/src/tnl_dd/t_dd_dmatmp2.h @@ -56,10 +56,10 @@ #ifndef EMIT_TWO_ELTS -#define EMIT_TWO_ELTS( dest, offset, elt0, elt1 ) \ +#define EMIT_TWO_ELTS( offset, elt0, elt1 ) \ do { \ - (dest)[offset] = (elt0); \ - (dest)[offset+1] = (elt1); \ + EMIT_ELT( offset, elt0 ); \ + EMIT_ELT( offset+1, elt1 ); \ } while (0) #endif @@ -69,42 +69,36 @@ do { \ /**********************************************************************/ -static ELT_TYPE *TAG(emit_elts)( GLcontext *ctx, - ELT_TYPE *dest, - GLuint *elts, GLuint nr ) +static void TAG(emit_elts)( GLcontext *ctx, GLuint *elts, GLuint nr ) { GLint i; LOCAL_VARS; + ELTS_VARS; - for ( i = 0 ; i+1 < nr ; i+=2, elts += 2 ) { - EMIT_TWO_ELTS( dest, 0, elts[0], elts[1] ); - dest += 2; - } - if (i < nr) { - EMIT_ELT( dest, 0, elts[0] ); - dest += 1; + ALLOC_ELTS( nr ); + + for ( i = 0 ; i < nr ; i+=2, elts += 2 ) { + EMIT_TWO_ELTS( 0, elts[0], elts[1] ); + INCR_ELTS( 2 ); } - - return dest; } -static ELT_TYPE *TAG(emit_consecutive_elts)( GLcontext *ctx, - ELT_TYPE *dest, - GLuint start, GLuint nr ) +static void TAG(emit_consecutive_elts)( GLcontext *ctx, GLuint start, GLuint nr ) { GLint i; LOCAL_VARS; + ELTS_VARS; + + ALLOC_ELTS( nr ); for ( i = 0 ; i+1 < nr ; i+=2, start += 2 ) { - EMIT_TWO_ELTS( dest, 0, start, start+1 ); - dest += 2; + EMIT_TWO_ELTS( 0, start, start+1 ); + INCR_ELTS( 2 ); } if (i < nr) { - EMIT_ELT( dest, 0, start ); - dest += 1; + EMIT_ELT( 0, start ); + INCR_ELTS( 1 ); } - - return dest; } /*********************************************************************** @@ -166,7 +160,8 @@ static void TAG(render_line_strip_verts)( GLcontext *ctx, if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_LINES )) { - int dmasz = GET_MAX_HW_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; GLuint j, nr; ELT_INIT( GL_LINES, HW_LINES ); @@ -174,21 +169,30 @@ static void TAG(render_line_strip_verts)( GLcontext *ctx, /* Emit whole number of lines in each full buffer. */ dmasz = dmasz/2; + currentsz = GET_CURRENT_VB_MAX_ELTS(); + currentsz = currentsz/2; + if (currentsz < 4) { + NEW_BUFFER(); + currentsz = dmasz; + } for (j = start; j + 1 < count; j += nr - 1 ) { - ELT_TYPE *dest; GLint i; - - nr = MIN2( dmasz, count - j ); - dest = ALLOC_ELTS( (nr-1)*2 ); + ELTS_VARS; + nr = MIN2( currentsz, count - j ); + + ALLOC_ELTS( (nr-1)*2 ); for ( i = j ; i+1 < j+nr ; i+=1 ) { - EMIT_TWO_ELTS( dest, 0, (i+0), (i+1) ); - dest += 2; + EMIT_TWO_ELTS( 0, (i+0), (i+1) ); + INCR_ELTS( 2 ); } - CLOSE_ELTS(); + if (nr == currentsz) { + NEW_BUFFER(); + currentsz = dmasz; + } } } else @@ -219,61 +223,96 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx, return; if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_LINES )) { - int dmasz = GET_MAX_HW_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; ELT_INIT( GL_LINES, HW_LINES ); /* Emit whole number of lines in each full buffer. */ dmasz = dmasz/2; + currentsz = GET_CURRENT_VB_MAX_ELTS(); + currentsz = currentsz/2; + + if (currentsz < 4) { + NEW_BUFFER(); + currentsz = dmasz; + } /* Ensure last vertex doesn't wrap: */ + currentsz--; dmasz--; for (; j + 1 < count; ) { GLint i; - ELT_TYPE *dest; - - nr = MIN2( dmasz, count - j ); - dest = ALLOC_ELTS( nr*2 ); /* allocs room for 1 more line */ - - for ( i = 0 ; i < nr - 1 ; i+=1 ) { - EMIT_TWO_ELTS( dest, 0, (j+i), (j+i+1) ); - dest += 2; + ELTS_VARS; + nr = MIN2( currentsz, count - j ); + + ALLOC_ELTS( (nr-1)*2 ); + for ( i = j ; i+1 < j+nr ; i+=1 ) { + EMIT_TWO_ELTS( 0, (i+0), (i+1) ); + INCR_ELTS( 2 ); } j += nr - 1; - - /* Emit 1 more line into space alloced above */ - if (j + 1 >= count) { - EMIT_TWO_ELTS( dest, 0, (j), (start) ); - dest += 2; - } - - CLOSE_ELTS(); + if (j + 1 < count) { + NEW_BUFFER(); + currentsz = dmasz; + } + else { + ALLOC_ELTS( 2 ); + EMIT_TWO_ELTS( 0, (j), (start) ); + INCR_ELTS( 2 ); + } } } else { - int dmasz = GET_MAX_HW_ELTS() - 1; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; ELT_INIT( GL_LINE_STRIP, HW_LINE_STRIP ); + currentsz = GET_CURRENT_VB_MAX_ELTS(); + + if (currentsz < 8) { + NEW_BUFFER(); + currentsz = dmasz; + } + + /* Ensure last vertex doesn't wrap: + */ + currentsz--; + dmasz--; + for ( ; j + 1 < count; ) { - nr = MIN2( dmasz, count - j ); + nr = MIN2( currentsz, count - j ); if (j + nr < count) { - ELT_TYPE *dest = ALLOC_ELTS( nr ); - dest = TAG(emit_consecutive_elts)( ctx, dest, j, nr ); + TAG(emit_consecutive_elts)( ctx, j, nr ); + currentsz = dmasz; j += nr - 1; - CLOSE_ELTS(); + NEW_BUFFER(); } else if (nr) { - ELT_TYPE *dest = ALLOC_ELTS( nr + 1 ); - dest = TAG(emit_consecutive_elts)( ctx, dest, j, nr ); - dest = TAG(emit_consecutive_elts)( ctx, dest, start, 1 ); - j += nr; - CLOSE_ELTS(); + ELTS_VARS; + int i; + + ALLOC_ELTS( nr + 1 ); + for ( i = 0 ; i+1 < nr ; i+=2, j += 2 ) { + EMIT_TWO_ELTS( 0, j, j+1 ); + INCR_ELTS( 2 ); + } + if (i < nr) { + EMIT_ELT( 0, j ); j++; + INCR_ELTS( 1 ); + } + EMIT_ELT( 0, start ); + INCR_ELTS( 1 ); + NEW_BUFFER(); + } + else { + fprintf(stderr, "warining nr==0\n"); } } } @@ -317,7 +356,8 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx, if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_TRIANGLES )) { - int dmasz = GET_MAX_HW_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; int parity = 0; GLuint j, nr; @@ -330,22 +370,33 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx, */ dmasz = dmasz/3; dmasz -= dmasz & 1; + currentsz = GET_CURRENT_VB_MAX_ELTS(); + currentsz = currentsz/3; + currentsz -= currentsz & 1; + + if (currentsz < 4) { + NEW_BUFFER(); + currentsz = dmasz; + } for (j = start; j + 2 < count; j += nr - 2 ) { - ELT_TYPE *dest; GLint i; - - nr = MIN2( dmasz, count - j ); - dest = ALLOC_ELTS( (nr-2)*3 ); + ELTS_VARS; + nr = MIN2( currentsz, count - j ); + + ALLOC_ELTS( (nr-2)*3 ); for ( i = j ; i+2 < j+nr ; i++, parity^=1 ) { - EMIT_ELT( dest, 0, (i+0+parity) ); - EMIT_ELT( dest, 1, (i+1-parity) ); - EMIT_ELT( dest, 2, (i+2) ); - dest += 3; + EMIT_ELT( 0, (i+0+parity) ); + EMIT_ELT( 1, (i+1-parity) ); + EMIT_ELT( 2, (i+2) ); + INCR_ELTS( 3 ); } - CLOSE_ELTS(); + if (nr == currentsz) { + NEW_BUFFER(); + currentsz = dmasz; + } } } else if ((flags & PRIM_PARITY) == 0) @@ -356,15 +407,14 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx, /* Emit the first triangle with elts, then the rest as a regular strip. * TODO: Make this unlikely in t_imm_api.c */ - ELT_TYPE *dest; - + ELTS_VARS; ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); - dest = ALLOC_ELTS( 3 ); - EMIT_ELT( dest, 0, (start+1) ); - EMIT_ELT( dest, 1, (start+0) ); - EMIT_ELT( dest, 2, (start+2) ); - dest += 3; - CLOSE_ELTS(); + ALLOC_ELTS( 3 ); + EMIT_ELT( 0, (start+1) ); + EMIT_ELT( 1, (start+0) ); + EMIT_ELT( 2, (start+2) ); + INCR_ELTS( 3 ); + NEW_PRIMITIVE(); start++; if (start + 2 >= count) @@ -388,28 +438,39 @@ static void TAG(render_tri_fan_verts)( GLcontext *ctx, if (PREFER_DISCRETE_ELT_PRIM( count-start, HW_TRIANGLES )) { - int dmasz = GET_MAX_HW_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; GLuint j, nr; ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); dmasz = dmasz/3; + currentsz = GET_CURRENT_VB_MAX_ELTS(); + currentsz = currentsz/3; + + if (currentsz < 4) { + NEW_BUFFER(); + currentsz = dmasz; + } for (j = start + 1; j + 1 < count; j += nr - 1 ) { - ELT_TYPE *dest; GLint i; - - nr = MIN2( dmasz, count - j ); - dest = ALLOC_ELTS( (nr-1)*3 ); + ELTS_VARS; + nr = MIN2( currentsz, count - j ); + + ALLOC_ELTS( (nr-1)*3 ); for ( i = j ; i+1 < j+nr ; i++ ) { - EMIT_ELT( dest, 0, (start) ); - EMIT_ELT( dest, 1, (i) ); - EMIT_ELT( dest, 2, (i+1) ); - dest += 3; + EMIT_ELT( 0, (start) ); + EMIT_ELT( 1, (i) ); + EMIT_ELT( 2, (i+1) ); + INCR_ELTS( 3 ); + } + + if (nr == currentsz) { + NEW_BUFFER(); + currentsz = dmasz; } - - CLOSE_ELTS(); } } else { @@ -450,31 +511,44 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx, } else if (ctx->_TriangleCaps & DD_FLATSHADE) { LOCAL_VARS; - int dmasz = GET_MAX_HW_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; GLuint j, nr; ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + currentsz = GET_CURRENT_VB_MAX_ELTS(); + /* Emit whole number of quads in total, and in each buffer. */ + currentsz = (currentsz/6)*2; dmasz = (dmasz/6)*2; + if (currentsz < 4) { + NEW_BUFFER(); + currentsz = dmasz; + } + for (j = start; j + 3 < count; j += nr - 2 ) { - ELT_TYPE *dest; + ELTS_VARS; GLint quads, i; - nr = MIN2( dmasz, count - j ); + nr = MIN2( currentsz, count - j ); quads = (nr/2)-1; - dest = ALLOC_ELTS( quads*6 ); + + ALLOC_ELTS( quads*6 ); for ( i = j ; i < j+quads*2 ; i+=2 ) { - EMIT_TWO_ELTS( dest, 0, (i+0), (i+1) ); - EMIT_TWO_ELTS( dest, 2, (i+2), (i+1) ); - EMIT_TWO_ELTS( dest, 4, (i+3), (i+2) ); - dest += 6; + EMIT_TWO_ELTS( 0, (i+0), (i+1) ); + EMIT_TWO_ELTS( 2, (i+2), (i+1) ); + EMIT_TWO_ELTS( 4, (i+3), (i+2) ); + INCR_ELTS( 6 ); } - CLOSE_ELTS(); + if (nr == currentsz) { + NEW_BUFFER(); + currentsz = dmasz; + } } } else { @@ -503,31 +577,42 @@ static void TAG(render_quads_verts)( GLcontext *ctx, * using indexed vertices and the triangle primitive: */ LOCAL_VARS; - int dmasz = GET_MAX_HW_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; GLuint j, nr; ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + currentsz = GET_CURRENT_VB_MAX_ELTS(); /* Adjust for rendering as triangles: */ + currentsz = (currentsz/6)*4; dmasz = (dmasz/6)*4; + if (currentsz < 8) { + NEW_BUFFER(); + currentsz = dmasz; + } + for (j = start; j < count; j += nr ) { - ELT_TYPE *dest; + ELTS_VARS; GLint quads, i; - - nr = MIN2( dmasz, count - j ); + nr = MIN2( currentsz, count - j ); quads = nr/4; - dest = ALLOC_ELTS( quads*6 ); + + ALLOC_ELTS( quads*6 ); for ( i = j ; i < j+quads*4 ; i+=4 ) { - EMIT_TWO_ELTS( dest, 0, (i+0), (i+1) ); - EMIT_TWO_ELTS( dest, 2, (i+3), (i+1) ); - EMIT_TWO_ELTS( dest, 4, (i+2), (i+3) ); - dest += 6; + EMIT_TWO_ELTS( 0, (i+0), (i+1) ); + EMIT_TWO_ELTS( 2, (i+3), (i+1) ); + EMIT_TWO_ELTS( 4, (i+2), (i+3) ); + INCR_ELTS( 6 ); } - CLOSE_ELTS(); + if (nr == currentsz) { + NEW_BUFFER(); + currentsz = dmasz; + } } } } @@ -568,18 +653,22 @@ static void TAG(render_points_elts)( GLcontext *ctx, GLuint flags ) { LOCAL_VARS; - int dmasz = GET_MAX_HW_ELTS(); - GLuint *elts = GET_MESA_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint *elts = GET_ELTS(); GLuint j, nr; - ELT_TYPE *dest; ELT_INIT( GL_POINTS, HW_POINTS ); + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) + currentsz = dmasz; + for (j = start; j < count; j += nr ) { - nr = MIN2( dmasz, count - j ); - dest = ALLOC_ELTS( nr ); - dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); - CLOSE_ELTS(); + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr ); + NEW_PRIMITIVE(); + currentsz = dmasz; } } @@ -591,10 +680,10 @@ static void TAG(render_lines_elts)( GLcontext *ctx, GLuint flags ) { LOCAL_VARS; - int dmasz = GET_MAX_HW_ELTS(); - GLuint *elts = GET_MESA_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint *elts = GET_ELTS(); GLuint j, nr; - ELT_TYPE *dest; if (start+1 >= count) return; @@ -609,13 +698,18 @@ static void TAG(render_lines_elts)( GLcontext *ctx, /* Emit whole number of lines in total and in each buffer: */ count -= (count-start) & 1; + currentsz -= currentsz & 1; dmasz -= dmasz & 1; + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) + currentsz = dmasz; + for (j = start; j < count; j += nr ) { - nr = MIN2( dmasz, count - j ); - dest = ALLOC_ELTS( nr ); - dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); - CLOSE_ELTS(); + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr ); + NEW_PRIMITIVE(); + currentsz = dmasz; } if ((flags & PRIM_END) && ctx->Line.StippleFlag) @@ -629,10 +723,10 @@ static void TAG(render_line_strip_elts)( GLcontext *ctx, GLuint flags ) { LOCAL_VARS; - int dmasz = GET_MAX_HW_ELTS(); - GLuint *elts = GET_MESA_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint *elts = GET_ELTS(); GLuint j, nr; - ELT_TYPE *dest; if (start+1 >= count) return; @@ -642,11 +736,15 @@ static void TAG(render_line_strip_elts)( GLcontext *ctx, if ((flags & PRIM_BEGIN) && ctx->Line.StippleFlag) RESET_STIPPLE(); + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) + currentsz = dmasz; + for (j = start; j + 1 < count; j += nr - 1 ) { - nr = MIN2( dmasz, count - j ); - dest = ALLOC_ELTS( nr ); - dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); - CLOSE_ELTS(); + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr ); + NEW_PRIMITIVE(); + currentsz = dmasz; } } @@ -657,10 +755,10 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx, GLuint flags ) { LOCAL_VARS; - int dmasz = GET_MAX_HW_ELTS(); - GLuint *elts = GET_MESA_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; + GLuint *elts = GET_ELTS(); GLuint j, nr; - ELT_TYPE *dest; if (0) fprintf(stderr, "%s\n", __FUNCTION__); @@ -685,20 +783,27 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx, RESET_STIPPLE(); + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) { + NEW_BUFFER(); + currentsz = dmasz; + } + /* Ensure last vertex doesn't wrap: */ + currentsz--; dmasz--; - for ( ; j + 1 < count; ) { - nr = MIN2( dmasz, count - j ); - dest = ALLOC_ELTS( nr+1 ); /* Reserve possible space for last elt */ - dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); - j += nr - 1; - if (j + 1 >= count && (flags & PRIM_END)) { - dest = TAG(emit_elts)( ctx, dest, elts+start, 1 ); - } - CLOSE_ELTS(); + for ( ; j + 1 < count; j += nr - 1 ) { + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr ); + currentsz = dmasz; } + + if (flags & PRIM_END) + TAG(emit_elts)( ctx, elts+start, 1 ); + + NEW_PRIMITIVE(); } @@ -708,27 +813,32 @@ static void TAG(render_triangles_elts)( GLcontext *ctx, GLuint flags ) { LOCAL_VARS; - GLuint *elts = GET_MESA_ELTS(); - int dmasz = GET_MAX_HW_ELTS()/3*3; + GLuint *elts = GET_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS()/3*3; + int currentsz; GLuint j, nr; - ELT_TYPE *dest; if (start+2 >= count) return; +/* NEW_PRIMITIVE(); */ ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + currentsz = GET_CURRENT_VB_MAX_ELTS(); /* Emit whole number of tris in total. dmasz is already a multiple * of 3. */ count -= (count-start)%3; + currentsz -= currentsz%3; + if (currentsz < 8) + currentsz = dmasz; for (j = start; j < count; j += nr) { - nr = MIN2( dmasz, count - j ); - dest = ALLOC_ELTS( nr ); - dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); - CLOSE_ELTS(); + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr ); + NEW_PRIMITIVE(); + currentsz = dmasz; } } @@ -741,34 +851,36 @@ static void TAG(render_tri_strip_elts)( GLcontext *ctx, { LOCAL_VARS; GLuint j, nr; - GLuint *elts = GET_MESA_ELTS(); - int dmasz = GET_MAX_HW_ELTS(); - ELT_TYPE *dest; + GLuint *elts = GET_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; if (start+2 >= count) return; ELT_INIT( GL_TRIANGLE_STRIP, HW_TRIANGLE_STRIP_0 ); + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) { + NEW_BUFFER(); + currentsz = dmasz; + } + + if ((flags & PRIM_PARITY) && count - start > 2) { + TAG(emit_elts)( ctx, elts+start, 1 ); + currentsz--; + } + /* Keep the same winding over multiple buffers: */ dmasz -= (dmasz & 1); + currentsz -= (currentsz & 1); for (j = start ; j + 2 < count; j += nr - 2 ) { - nr = MIN2( dmasz, count - j ); - - if (flags & PRIM_PARITY) { - dest = ALLOC_ELTS( nr ); - dest = TAG(emit_elts)( ctx, dest, elts+j, 1 ); - dest = TAG(emit_elts)( ctx, dest, elts+j, nr-1 ); - nr--; flags &= ~PRIM_PARITY; - CLOSE_ELTS(); - } - else { - dest = ALLOC_ELTS( nr ); - dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); - CLOSE_ELTS(); - } + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr ); + NEW_PRIMITIVE(); + currentsz = dmasz; } } @@ -778,22 +890,28 @@ static void TAG(render_tri_fan_elts)( GLcontext *ctx, GLuint flags ) { LOCAL_VARS; - GLuint *elts = GET_MESA_ELTS(); + GLuint *elts = GET_ELTS(); GLuint j, nr; - int dmasz = GET_MAX_HW_ELTS(); - ELT_TYPE *dest; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; if (start+2 >= count) return; ELT_INIT( GL_TRIANGLE_FAN, HW_TRIANGLE_FAN ); + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) { + NEW_BUFFER(); + currentsz = dmasz; + } + for (j = start + 1 ; j + 1 < count; j += nr - 1 ) { - nr = MIN2( dmasz, count - j + 1 ); - dest = ALLOC_ELTS( nr ); - dest = TAG(emit_elts)( ctx, dest, elts+start, 1 ); - dest = TAG(emit_elts)( ctx, dest, elts+j, nr - 1 ); - CLOSE_ELTS(); + nr = MIN2( currentsz, count - j + 1 ); + TAG(emit_elts)( ctx, elts+start, 1 ); + TAG(emit_elts)( ctx, elts+j, nr - 1 ); + NEW_PRIMITIVE(); + currentsz = dmasz; } } @@ -804,22 +922,28 @@ static void TAG(render_poly_elts)( GLcontext *ctx, GLuint flags ) { LOCAL_VARS; - GLuint *elts = GET_MESA_ELTS(); + GLuint *elts = GET_ELTS(); GLuint j, nr; - int dmasz = GET_MAX_HW_ELTS(); - ELT_TYPE *dest; + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; if (start+2 >= count) return; ELT_INIT( GL_POLYGON, HW_POLYGON ); + currentsz = GET_CURRENT_VB_MAX_ELTS(); + if (currentsz < 8) { + NEW_BUFFER(); + currentsz = dmasz; + } + for (j = start + 1 ; j + 1 < count ; j += nr - 1 ) { - nr = MIN2( dmasz, count - j + 1 ); - dest = ALLOC_ELTS( nr ); - dest = TAG(emit_elts)( ctx, dest, elts+start, 1 ); - dest = TAG(emit_elts)( ctx, dest, elts+j, nr - 1 ); - CLOSE_ELTS(); + nr = MIN2( currentsz, count - j + 1 ); + TAG(emit_elts)( ctx, elts+start, 1 ); + TAG(emit_elts)( ctx, elts+j, nr - 1 ); + NEW_PRIMITIVE(); + currentsz = dmasz; } } @@ -835,49 +959,61 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx, } else { LOCAL_VARS; - GLuint *elts = GET_MESA_ELTS(); - int dmasz = GET_MAX_HW_ELTS(); + GLuint *elts = GET_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; GLuint j, nr; - ELT_TYPE *dest; + + NEW_PRIMITIVE(); + currentsz = GET_CURRENT_VB_MAX_ELTS(); /* Emit whole number of quads in total, and in each buffer. */ dmasz -= dmasz & 1; count -= (count-start) & 1; + currentsz -= currentsz & 1; + + if (currentsz < 12) + currentsz = dmasz; if (ctx->_TriangleCaps & DD_FLATSHADE) { ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + currentsz = currentsz/6*2; dmasz = dmasz/6*2; for (j = start; j + 3 < count; j += nr - 2 ) { - nr = MIN2( dmasz, count - j ); + nr = MIN2( currentsz, count - j ); if (nr >= 4) { - GLint quads = (nr/2)-1; - ELT_TYPE *dest = ALLOC_ELTS( quads*6 ); GLint i; + GLint quads = (nr/2)-1; + ELTS_VARS; + + ALLOC_ELTS( quads*6 ); for ( i = j-start ; i < j-start+quads ; i++, elts += 2 ) { - EMIT_TWO_ELTS( dest, 0, elts[0], elts[1] ); - EMIT_TWO_ELTS( dest, 2, elts[2], elts[1] ); - EMIT_TWO_ELTS( dest, 4, elts[3], elts[2] ); - dest += 6; + EMIT_TWO_ELTS( 0, elts[0], elts[1] ); + EMIT_TWO_ELTS( 2, elts[2], elts[1] ); + EMIT_TWO_ELTS( 4, elts[3], elts[2] ); + INCR_ELTS( 6 ); } - CLOSE_ELTS(); + NEW_PRIMITIVE(); } + + currentsz = dmasz; } } else { ELT_INIT( GL_TRIANGLE_STRIP, HW_TRIANGLE_STRIP_0 ); for (j = start; j + 3 < count; j += nr - 2 ) { - nr = MIN2( dmasz, count - j ); - dest = ALLOC_ELTS( nr ); - dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); - CLOSE_ELTS(); + nr = MIN2( currentsz, count - j ); + TAG(emit_elts)( ctx, elts+j, nr ); + NEW_PRIMITIVE(); + currentsz = dmasz; } } } @@ -895,38 +1031,48 @@ static void TAG(render_quads_elts)( GLcontext *ctx, if (HAVE_QUADS && 0) { } else { LOCAL_VARS; - GLuint *elts = GET_MESA_ELTS(); - int dmasz = GET_MAX_HW_ELTS(); + GLuint *elts = GET_ELTS(); + int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); + int currentsz; GLuint j, nr; ELT_INIT( GL_TRIANGLES, HW_TRIANGLES ); + currentsz = GET_CURRENT_VB_MAX_ELTS(); /* Emit whole number of quads in total, and in each buffer. */ dmasz -= dmasz & 3; count -= (count-start) & 3; + currentsz -= currentsz & 3; /* Adjust for rendering as triangles: */ + currentsz = currentsz/6*4; dmasz = dmasz/6*4; - for (j = start; j + 3 < count; j += nr ) { - nr = MIN2( dmasz, count - j ); + if (currentsz < 8) + currentsz = dmasz; + for (j = start; j + 3 < count; j += nr - 2 ) { + nr = MIN2( currentsz, count - j ); + + if (nr >= 4) { GLint quads = nr/4; - ELT_TYPE *dest = ALLOC_ELTS( quads * 6 ); GLint i; + ELTS_VARS; + ALLOC_ELTS( quads * 6 ); for ( i = j-start ; i < j-start+quads ; i++, elts += 4 ) { - EMIT_TWO_ELTS( dest, 0, elts[0], elts[1] ); - EMIT_TWO_ELTS( dest, 2, elts[3], elts[1] ); - EMIT_TWO_ELTS( dest, 4, elts[2], elts[3] ); - dest += 6; + EMIT_TWO_ELTS( 0, elts[0], elts[1] ); + EMIT_TWO_ELTS( 2, elts[3], elts[1] ); + EMIT_TWO_ELTS( 4, elts[2], elts[3] ); + INCR_ELTS( 6 ); } - - CLOSE_ELTS(); } + + NEW_PRIMITIVE(); + currentsz = dmasz; } } } |