]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
FinishBGRA8 optimization and fixes
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 4 Apr 2011 20:21:15 +0000 (20:21 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 5 Apr 2011 18:06:30 +0000 (20:06 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11021 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=8aa6d5b5a9ef304880ec5d979fbb0a77ac65c262

dpsoftrast.c

index ece8be2fee632366980ad90806352fb035ce73c5..3b0ec6e02c127a39a5e74da98b8ea70068105d36 100644 (file)
@@ -2100,11 +2100,17 @@ void DPSOFTRAST_Draw_Span_FinishBGRA8(DPSOFTRAST_State_Thread *thread, const DPS
                                // the 4-item search must be aligned or else it stalls badly
                                if ((x & 3) && !pixelmask[x]) 
                                {
+                                       if(pixelmask[x]) goto endmasked;
                                        x++;
-                                       if ((x & 3) && !pixelmask[x]) 
+                                       if (x & 3)
                                        {
+                                               if(pixelmask[x]) goto endmasked;
                                                x++;
-                                               if ((x & 3) && !pixelmask[x]) x++;
+                                               if (x & 3)
+                                               {
+                                                       if(pixelmask[x]) goto endmasked;
+                                                       x++;
+                                               }
                                        }
                                }
                                while (*(unsigned int *)&pixelmask[x] == 0x00000000)
@@ -2117,18 +2123,25 @@ void DPSOFTRAST_Draw_Span_FinishBGRA8(DPSOFTRAST_State_Thread *thread, const DPS
                        if (x >= endx)
                                break;
                }
+       endmasked:
                // find length of subspan
                subx = x + 1;
 #if 1
-               if (x + 8 < endx)
+               if (subx + 8 < endx)
                {
-                       if ((subx & 3) && pixelmask[subx]) 
+                       if (subx & 3)
                        {
+                               if(!pixelmask[subx]) goto endunmasked;
                                subx++;
-                               if ((subx & 3) && pixelmask[subx]) 
+                               if (subx & 3)
                                {
+                                       if(!pixelmask[subx]) goto endunmasked;
                                        subx++;
-                                       if ((subx & 3) && pixelmask[subx]) subx++;
+                                       if (subx & 3)
+                                       {
+                                               if(!pixelmask[subx]) goto endunmasked;
+                                               subx++;
+                                       }
                                }
                        }
                        while (*(unsigned int *)&pixelmask[subx] == 0x01010101)
@@ -2140,6 +2153,7 @@ void DPSOFTRAST_Draw_Span_FinishBGRA8(DPSOFTRAST_State_Thread *thread, const DPS
                // the checks can overshoot, so make sure to clip it...
                if (subx > endx)
                        subx = endx;
+       endunmasked:
                // now that we know the subspan length...  process!
                switch(thread->fb_blendmode)
                {