From 12c037dbff3d5a812e31624645d577413cd54122 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 20 Aug 2003 07:21:41 +0000 Subject: Use correct conversions when translating array colors. --- src/mesa/array_cache/ac_import.c | 14 +- src/mesa/math/m_trans_tmp.h | 32 ++++ src/mesa/math/m_translate.c | 59 +++++++- src/mesa/math/m_translate.h | 8 + src/mesa/tnl/t_imm_elt.c | 311 ++++++++++----------------------------- src/mesa/tnl/t_vb_light.c | 14 +- 6 files changed, 191 insertions(+), 247 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/array_cache/ac_import.c b/src/mesa/array_cache/ac_import.c index 5d5c24f526..ee15a6d749 100644 --- a/src/mesa/array_cache/ac_import.c +++ b/src/mesa/array_cache/ac_import.c @@ -209,13 +209,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/src/mesa/math/m_trans_tmp.h b/src/mesa/math/m_trans_tmp.h index 2ade71e4b6..c1f0f76743 100644 --- a/src/mesa/math/m_trans_tmp.h +++ b/src/mesa/math/m_trans_tmp.h @@ -58,6 +58,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, @@ -218,6 +244,9 @@ 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 } @@ -243,6 +272,9 @@ static void INIT(void) #ifdef DEST_4F #undef DEST_4F #endif +#ifdef DEST_4FC +#undef DEST_4FC +#endif #ifdef DEST_1F #undef DEST_1F #endif diff --git a/src/mesa/math/m_translate.c b/src/mesa/math/m_translate.c index def657e1c8..14beabb978 100644 --- a/src/mesa/math/m_translate.c +++ b/src/mesa/math/m_translate.c @@ -95,6 +95,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]) @@ -118,6 +119,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)) @@ -126,6 +128,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" @@ -133,6 +136,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 @@ -141,11 +145,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" @@ -153,6 +159,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 @@ -165,6 +172,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) @@ -174,6 +182,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" @@ -184,6 +193,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" @@ -197,6 +207,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 @@ -208,6 +219,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)) @@ -216,6 +228,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" @@ -223,6 +236,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 @@ -231,11 +245,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" @@ -245,6 +261,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 @@ -256,6 +273,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) @@ -264,6 +282,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" @@ -271,6 +290,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 @@ -279,11 +299,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" @@ -292,6 +314,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 @@ -303,6 +326,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)) @@ -311,6 +335,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" @@ -318,6 +343,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 @@ -326,11 +352,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" @@ -340,6 +368,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 @@ -351,6 +380,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) @@ -359,6 +389,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" @@ -366,6 +397,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 @@ -374,11 +406,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" @@ -387,6 +421,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 @@ -398,6 +433,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) @@ -407,6 +443,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" @@ -414,6 +451,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 @@ -422,11 +460,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 @@ -444,11 +484,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 @@ -457,11 +499,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 @@ -472,6 +516,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 @@ -510,6 +555,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/src/mesa/math/m_translate.h b/src/mesa/math/m_translate.h index c473f83d6f..527c7063d6 100644 --- a/src/mesa/math/m_translate.h +++ b/src/mesa/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/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c index f9a3069a17..44c2a32c85 100644 --- a/src/mesa/tnl/t_imm_elt.c +++ b/src/mesa/tnl/t_imm_elt.c @@ -38,15 +38,6 @@ -typedef void (*trans_elt_1f_func)(GLfloat *to, - CONST void *ptr, - GLuint stride, - const GLuint *flags, - const GLuint *elts, - GLuint match, - GLuint start, - GLuint n ); - typedef void (*trans_elt_1ui_func)(GLuint *to, CONST void *ptr, GLuint stride, @@ -65,24 +56,6 @@ typedef void (*trans_elt_1ub_func)(GLubyte *to, GLuint start, GLuint n ); -typedef void (*trans_elt_4ub_func)(GLubyte (*to)[4], - CONST void *ptr, - GLuint stride, - const GLuint *flags, - const GLuint *elts, - GLuint match, - GLuint start, - GLuint n ); - -typedef void (*trans_elt_4us_func)(GLushort (*to)[4], - CONST void *ptr, - GLuint stride, - const GLuint *flags, - const GLuint *elts, - GLuint match, - GLuint start, - GLuint n ); - typedef void (*trans_elt_4f_func)(GLfloat (*to)[4], CONST void *ptr, GLuint stride, @@ -92,33 +65,18 @@ typedef void (*trans_elt_4f_func)(GLfloat (*to)[4], GLuint start, GLuint n ); -typedef void (*trans_elt_3f_func)(GLfloat (*to)[3], - CONST void *ptr, - GLuint stride, - const GLuint *flags, - const 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 @@ -145,45 +103,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 @@ -191,10 +146,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. @@ -202,30 +156,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 @@ -233,36 +186,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" @@ -270,10 +221,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 @@ -281,46 +231,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 @@ -328,36 +275,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" @@ -365,10 +310,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 @@ -376,46 +320,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 @@ -423,10 +364,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) @@ -434,117 +374,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(); @@ -596,27 +508,6 @@ void _tnl_imm_elt_init( void ) } -#if 00 -static void _tnl_trans_elt_1f(GLfloat *to, - const struct gl_client_array *from, - const GLuint *flags, - const 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, const GLuint *flags, @@ -656,49 +547,6 @@ 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, - const GLuint *flags, - const 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, - const GLuint *flags, - const 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, const GLuint *flags, @@ -719,17 +567,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, - const GLuint *flags, - const 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, @@ -737,8 +583,9 @@ static void _tnl_trans_elt_3f(GLfloat (*to)[3], match, start, n ); + } -#endif + @@ -834,17 +681,17 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, } if (translateConventional & 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 (translateConventional & 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 (translateConventional & VERT_BIT_FOG) { diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index aedbad4254..154c3d2961 100644 --- a/src/mesa/tnl/t_vb_light.c +++ b/src/mesa/tnl/t_vb_light.c @@ -82,13 +82,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; } -- cgit v1.2.3