]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix some clipping plane bugs and FinishBGRA8 bug introduced in r11015
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 4 Apr 2011 19:51:25 +0000 (19:51 +0000)
committereihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 4 Apr 2011 19:51:25 +0000 (19:51 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11020 d7cf8633-e32d-0410-b094-e92efae38249

dpsoftrast.c
gl_rmain.c

index 42f08e31a3a2ab8d0a209e4dabcf17f7335615c3..ece8be2fee632366980ad90806352fb035ce73c5 100644 (file)
@@ -2098,10 +2098,16 @@ void DPSOFTRAST_Draw_Span_FinishBGRA8(DPSOFTRAST_State_Thread *thread, const DPS
                        if (x + 8 < endx)
                        {
                                // the 4-item search must be aligned or else it stalls badly
-                               if ((x & 3) && !pixelmask[x]) x++;
-                               if ((x & 3) && !pixelmask[x]) x++;
-                               if ((x & 3) && !pixelmask[x]) x++;
-                               while (*((unsigned int *)pixelmask + x) == 0x00000000)
+                               if ((x & 3) && !pixelmask[x]) 
+                               {
+                                       x++;
+                                       if ((x & 3) && !pixelmask[x]) 
+                                       {
+                                               x++;
+                                               if ((x & 3) && !pixelmask[x]) x++;
+                                       }
+                               }
+                               while (*(unsigned int *)&pixelmask[x] == 0x00000000)
                                        x += 4;
                        }
 #endif
@@ -2116,10 +2122,16 @@ void DPSOFTRAST_Draw_Span_FinishBGRA8(DPSOFTRAST_State_Thread *thread, const DPS
 #if 1
                if (x + 8 < endx)
                {
-                       if ((subx & 3) && pixelmask[subx]) subx++;
-                       if ((subx & 3) && pixelmask[subx]) subx++;
-                       if ((subx & 3) && pixelmask[subx]) subx++;
-                       while (*((unsigned int *)pixelmask + subx) == 0x01010101)
+                       if ((subx & 3) && pixelmask[subx]) 
+                       {
+                               subx++;
+                               if ((subx & 3) && pixelmask[subx]) 
+                               {
+                                       subx++;
+                                       if ((subx & 3) && pixelmask[subx]) subx++;
+                               }
+                       }
+                       while (*(unsigned int *)&pixelmask[subx] == 0x01010101)
                                subx += 4;
                }
 #endif
@@ -5034,14 +5046,10 @@ static void DPSOFTRAST_Interpret_Draw(DPSOFTRAST_State_Thread *thread, DPSOFTRAS
                        clip0 = clip0origin + (y+0.5f)*clip0slope + 0.5f;
                        for(; y <= nexty; y++, xcoords = _mm_add_ps(xcoords, xslope), clip0 += clip0slope)
                        {
-                               int startx, endx, clipx = minx, offset;
+                               int startx, endx, offset;
                                startx = _mm_cvtss_si32(xcoords);
                                endx = _mm_cvtss_si32(_mm_movehl_ps(xcoords, xcoords));
-                               if (startx < minx) 
-                               {
-                                       if (startx < 0) startx = 0;
-                                       startx += (minx-startx)&~(DPSOFTRAST_DRAW_MAXSPANLENGTH-1);
-                               }
+                               if (startx < minx) startx = minx;
                                if (endx > maxx) endx = maxx;
                                if (startx >= endx) continue;
 
@@ -5052,8 +5060,7 @@ static void DPSOFTRAST_Interpret_Draw(DPSOFTRAST_State_Thread *thread, DPSOFTRAS
                                                if (startx < clip0) 
                                                {
                                                        if(endx <= clip0) continue;
-                                                       clipx = max((int)clip0, minx);
-                                                       startx += (clipx-startx)&~(DPSOFTRAST_DRAW_MAXSPANLENGTH-1); 
+                                                       startx = (int)clip0;
                                                }
                                        }
                                        else if (endx > clip0) 
@@ -5069,7 +5076,7 @@ static void DPSOFTRAST_Interpret_Draw(DPSOFTRAST_State_Thread *thread, DPSOFTRAS
                                        span->triangle = thread->numtriangles;
                                        span->x = offset;
                                        span->y = y;
-                                       span->startx = max(clipx - offset, 0);
+                                       span->startx = 0;
                                        span->endx = min(endx - offset, DPSOFTRAST_DRAW_MAXSPANLENGTH);
                                        if (span->startx >= span->endx)
                                                continue;
@@ -5402,6 +5409,7 @@ int DPSOFTRAST_Init(int width, int height, int numthreads, int interlace, unsign
                DPSOFTRAST_State_Thread *thread = &dpsoftrast.threads[i];
                thread->index = i;
                thread->cullface = GL_BACK;
+               thread->colormask[0] = 1; 
                thread->colormask[1] = 1;
                thread->colormask[2] = 1;
                thread->colormask[3] = 1;
index 7f998d21a7db8d087192f88cf27bf53144a91d7e..0fbb9ad729a7da8cf483b9b230d73f65461cadae 100644 (file)
@@ -5675,7 +5675,7 @@ static void R_Water_ProcessPlanes(void)
                }
 
        }
-       DPSOFTRAST_ClipPlane(0, 0, 0, 1);
+       if(vid.renderpath==RENDERPATH_SOFT) DPSOFTRAST_ClipPlane(0, 0, 0, 1);
        r_waterstate.renderingscene = false;
        r_refdef.view = originalview;
        R_ResetViewRendering3D();