diff options
| author | Brian Paul <brian.paul@tungstengraphics.com> | 2002-04-02 23:36:50 +0000 | 
|---|---|---|
| committer | Brian Paul <brian.paul@tungstengraphics.com> | 2002-04-02 23:36:50 +0000 | 
| commit | b63e8556fa9655bdfcc69fa04663e854f7fb2fbd (patch) | |
| tree | 0bdc09e4aa4695d3d29fdcf590b7651cb353f5cb /src | |
| parent | 31fe0ade35a4d09087c575e99ecbbe6505b6e4de (diff) | |
more blending updates from Jose
Diffstat (limited to 'src')
| -rw-r--r-- | src/mesa/swrast/s_blend.c | 28 | ||||
| -rw-r--r-- | src/mesa/x86/mmx_blend.S | 41 | 
2 files changed, 31 insertions, 38 deletions
| diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c index f37a44015f..5fa76322dc 100644 --- a/src/mesa/swrast/s_blend.c +++ b/src/mesa/swrast/s_blend.c @@ -1,4 +1,4 @@ -/* $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 @@ -138,33 +138,23 @@ blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[],  	    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); diff --git a/src/mesa/x86/mmx_blend.S b/src/mesa/x86/mmx_blend.S index 88908bd345..c2be6812ec 100644 --- a/src/mesa/x86/mmx_blend.S +++ b/src/mesa/x86/mmx_blend.S @@ -35,7 +35,7 @@ GLNAME( _mesa_mmx_blend_transparency ):      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 ) @@ -126,13 +126,15 @@ GLNAME( _mesa_mmx_blend_transparency ):      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 ) @@ -140,19 +142,20 @@ LLBL(GMBT_main_loop):      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 ) @@ -160,7 +163,7 @@ LLBL(GMBT_nojump):      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 ) @@ -205,17 +208,16 @@ LLBL(GMBT_nojump):      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 ) @@ -349,7 +351,8 @@ LLBL(GMBT_runout):      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 ) | 
