-/* $Id: s_blend.c,v 1.15 2002/04/02 16:16:45 brianp Exp $ */
+/* $Id: s_blend.c,v 1.16 2002/04/02 23:36:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLint temp;
#define DIV255(X) (temp = (X), ((temp << 8) + temp + 256) >> 16)
#endif
-#if 0
- const GLint s = CHAN_MAX - t;
- const GLint r = DIV255(rgba[i][RCOMP] * t + dest[i][RCOMP] * s);
- const GLint g = DIV255(rgba[i][GCOMP] * t + dest[i][GCOMP] * s);
- const GLint b = DIV255(rgba[i][BCOMP] * t + dest[i][BCOMP] * s);
- const GLint a = DIV255(rgba[i][ACOMP] * t + dest[i][ACOMP] * s);
-#else
const GLint r = DIV255((rgba[i][RCOMP] - dest[i][RCOMP]) * t) + dest[i][RCOMP];
const GLint g = DIV255((rgba[i][GCOMP] - dest[i][GCOMP]) * t) + dest[i][GCOMP];
const GLint b = DIV255((rgba[i][BCOMP] - dest[i][BCOMP]) * t) + dest[i][BCOMP];
const GLint a = DIV255((rgba[i][ACOMP] - dest[i][ACOMP]) * t) + dest[i][ACOMP];
-#endif
#undef DIV255
#elif CHAN_BITS == 16
const GLfloat tt = (GLfloat) t / CHAN_MAXF;
- const GLfloat s = 1.0 - tt;
- const GLint r = (GLint) (rgba[i][RCOMP] * tt + dest[i][RCOMP] * s);
- const GLint g = (GLint) (rgba[i][GCOMP] * tt + dest[i][GCOMP] * s);
- const GLint b = (GLint) (rgba[i][BCOMP] * tt + dest[i][BCOMP] * s);
- const GLint a = (GLint) (rgba[i][ACOMP] * tt + dest[i][ACOMP] * s);
+ const GLint r = (GLint) ((rgba[i][RCOMP] - dest[i][RCOMP]) * tt + dest[i][RCOMP]);
+ const GLint g = (GLint) ((rgba[i][GCOMP] - dest[i][GCOMP]) * tt + dest[i][GCOMP]);
+ const GLint b = (GLint) ((rgba[i][BCOMP] - dest[i][BCOMP]) * tt + dest[i][BCOMP]);
+ const GLint a = (GLint) ((rgba[i][ACOMP] - dest[i][ACOMP]) * tt + dest[i][ACOMP]);
#else /* CHAN_BITS == 32 */
const GLfloat tt = (GLfloat) t / CHAN_MAXF;
- const GLfloat s = 1.0 - tt;
- const GLfloat r = rgba[i][RCOMP] * tt + dest[i][RCOMP] * s;
- const GLfloat g = rgba[i][GCOMP] * tt + dest[i][GCOMP] * s;
- const GLfloat b = rgba[i][BCOMP] * tt + dest[i][BCOMP] * s;
- const GLfloat a = rgba[i][ACOMP] * tt + dest[i][ACOMP] * s;
+ const GLfloat r = (rgba[i][RCOMP] - dest[i][RCOMP]) * tt + dest[i][RCOMP];
+ const GLfloat g = (rgba[i][GCOMP] - dest[i][GCOMP]) * tt + dest[i][GCOMP];
+ const GLfloat b = (rgba[i][BCOMP] - dest[i][BCOMP]) * tt + dest[i][BCOMP];
+ const GLfloat a = (rgba[i][ACOMP] - dest[i][ACOMP]) * tt + dest[i][ACOMP];
#endif
#endif
ASSERT(r <= CHAN_MAX);
MOV_L ( EDX, EAX )
AND_L ( CONST(4), EAX )
CMP_L ( CONST(8), EAX )
- JNE ( LLBL(GMBT_no_align) )
+ JNE ( LLBL(GMBT_skip_runin) )
MOV_L ( REGOFF(20, EBP), EAX )
ADD_L ( CONST(3), EAX )
XOR_L ( EDX, EDX )
ADD_L ( CONST(4), REGOFF(20, EBP) )
ADD_L ( CONST(4), REGOFF(24, EBP) )
DEC_L ( REGOFF(12, EBP) )
-LLBL(GMBT_skip_runin):
+
+LLBL (GMBT_skip_runin):
CMP_L ( CONST(0), REGOFF(12, EBP) ) /* n == 0 */
- JE ( LLBL(GMBT_zero_length) )
+ JE ( LLBL(GMBT_runout) )
MOV_L ( CONST(0), REGOFF(-28, EBP) )
+
ALIGNTEXT4
-LLBL(GMBT_main_loop):
+LLBL (GMBT_main_loop):
MOV_L ( REGOFF(12, EBP), EDX )
MOV_L ( EDX, EAX )
CMP_L ( EAX, REGOFF(-28, EBP) )
JB ( LLBL(GMBT_no_jump) )
JMP ( LLBL(GMBT_end_loop) )
+
ALIGNTEXT16
-LLBL(GMBT_nojump):
+LLBL (GMBT_no_jump):
- MOV_L ( REGOFF(-28, EBP), EAX )
- LEA_L ( REGDIS(0,EAX,2), EDX )
- MOV_L ( REGOFF(16, EBP), EAX ) /* mask */
- CMP_B ( CONST(0), REGBI(EAX,EDX) )
+ MOV_L ( REGOFF(-28, EBP), EAX ) /* eax = i */
+ LEA_L ( REGDIS(0,EAX,2), EDX ) /* edx = i*2 */
+ MOV_L ( REGOFF(16, EBP), EAX ) /* eax = mask */
+ CMP_W ( CONST(0), REGBI(EAX,EDX) ) /* ((unsigned *) mask)[i] == 0 */
JE ( LLBL(GMBT_masked) )
- MOV_L ( REGOFF(-28, EBP), EAX )
+ MOV_L ( REGOFF(-28, EBP), EAX ) /* eax = i */
MOV_L ( EAX, EDX )
- LEA_L ( REGDIS(0,EDX,8), ECX )
+ LEA_L ( REGDIS(0,EDX,8), ECX ) /* ecx = i*8 */
MOV_L ( ECX, EAX )
- ADD_L ( REGOFF(20, EBP), EAX )
+ ADD_L ( REGOFF(20, EBP), EAX )
MOV_L ( REGOFF(-28, EBP), EDX )
MOV_L ( EDX, ECX )
LEA_L ( REGDIS(0,ECX,8), EDX )
ADD_L ( REGOFF(24, EBP), ECX )
MOVQ ( REGIND(EAX), MM4 )
- PXOR ( MM5, MM5 )
+ PXOR ( MM5, MM5 ) /* mm5 = 00 00 00 00 00 00 00 00 */
MOVQ ( MM4, MM1 )
MOVQ ( REGIND(ECX), MM7 )
PUNPCKLBW ( MM5, MM1 )
POR ( MM1, MM4 )
MOVQ ( MM4, REGIND(EAX) )
-LLBL(GMBT_masked):
+LLBL (GMBT_masked):
INC_L ( REGOFF(-28, EBP) )
JMP ( LLBL(GMBT_main_loop) )
-ALIGNTEXT16
-LLBL(GMBT_end_loop):
-
+ALIGNTEXT16
+LLBL (GMBT_end_loop):
EMMS
-LLBL(GMBT_runout):
+LLBL (GMBT_runout):
MOV_L ( REGOFF(12, EBP), EAX )
AND_L ( CONST(1), EAX )
LEA_L ( REGOFF(-1, EAX), EDX )
MOV_B ( REGOFF(-32, EBP), AL )
MOV_B ( AL, REGIND(EDX) )
-LLBL(GMBT_skip_runout):
+
+LLBL (GMBT_skip_runout):
MOV_L ( REGOFF(-56, EBP), EBX )
MOV_L ( EBP, ESP )