]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
use short indices when available instead of int (fixes xonotic console weirdness)
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 4 Feb 2011 22:22:31 +0000 (22:22 +0000)
committereihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 4 Feb 2011 22:22:31 +0000 (22:22 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10801 d7cf8633-e32d-0410-b094-e92efae38249

dpsoftrast.c

index d756c8ee41b7fb072b6177cf1ffd8db12020881e..aff3befeb399e0075ed15a031d815810d4742baf 100644 (file)
@@ -4289,18 +4289,18 @@ static void DPSOFTRAST_Interpret_Draw(DPSOFTRAST_State_Thread *thread, DPSOFTRAS
 
                // generate the 3 edges of this triangle
                // generate spans for the triangle - switch based on left split or right split classification of triangle
-               if (element3i)
-               {
-                       e[0] = element3i[i*3+0] - firstvertex;
-                       e[1] = element3i[i*3+1] - firstvertex;
-                       e[2] = element3i[i*3+2] - firstvertex;
-               }
-               else if (element3s)
+               if (element3s)
                {
                        e[0] = element3s[i*3+0] - firstvertex;
                        e[1] = element3s[i*3+1] - firstvertex;
                        e[2] = element3s[i*3+2] - firstvertex;
                }
+               else if (element3i)
+               {
+                       e[0] = element3i[i*3+0] - firstvertex;
+                       e[1] = element3i[i*3+1] - firstvertex;
+                       e[2] = element3i[i*3+2] - firstvertex;
+               }
                else
                {
                        e[0] = i*3+0;
@@ -4652,10 +4652,10 @@ static DPSOFTRAST_Command_Draw *DPSOFTRAST_Draw_AllocateDrawCommand(int firstver
                        break;
                datasize += numvertices*sizeof(float[4]);
        }
-       if (element3i)
-               datasize += numtriangles*sizeof(int[3]);
-       else if (element3s)
+       if (element3s)
                datasize += numtriangles*sizeof(unsigned short[3]);
+       else if (element3i)
+               datasize += numtriangles*sizeof(int[3]);
        datasize = DPSOFTRAST_ALIGNCOMMAND(datasize);
        if (commandsize + datasize > DPSOFTRAST_DRAW_MAXCOMMANDSIZE)
        {
@@ -4688,16 +4688,16 @@ static DPSOFTRAST_Command_Draw *DPSOFTRAST_Draw_AllocateDrawCommand(int firstver
        }
        command->element3i = NULL;
        command->element3s = NULL;
-       if (element3i)
-       {
-               command->element3i = (int *)data;
-               memcpy(command->element3i, element3i, numtriangles*sizeof(int[3]));
-       }
-       else if (element3s)
+       if (element3s)
        {
                command->element3s = (unsigned short *)data;
                memcpy(command->element3s, element3s, numtriangles*sizeof(unsigned short[3]));
        }
+       else if (element3i)
+       {
+               command->element3i = (int *)data;
+               memcpy(command->element3i, element3i, numtriangles*sizeof(int[3]));
+       }
        return command;
 }