mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Sps fixed in all the games tested, code cleanup and reordering
implemented buffer format fall back to allow hardware that don't support lockable formats to run the games with Z peeking disabled, applied as well the patch suggested in issue 1494 please give heavy test to this commit git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4365 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -26,130 +26,25 @@ QUAD simulator
|
||||
021231 243453
|
||||
*/
|
||||
|
||||
void IndexGenerator::Start(unsigned short *startptr)
|
||||
{
|
||||
ptr = startptr;
|
||||
index = 0;
|
||||
numPrims = 0;
|
||||
adds = 0;
|
||||
indexLen = 0;
|
||||
onlyLists = true;
|
||||
}
|
||||
//Init
|
||||
u16 *IndexGenerator::Tptr = 0;
|
||||
u16 *IndexGenerator::Lptr = 0;
|
||||
u16 *IndexGenerator::Pptr = 0;
|
||||
int IndexGenerator::numT = 0;
|
||||
int IndexGenerator::numL = 0;
|
||||
int IndexGenerator::numP = 0;
|
||||
int IndexGenerator::index = 0;
|
||||
int IndexGenerator::Tadds = 0;
|
||||
int IndexGenerator::Ladds = 0;
|
||||
int IndexGenerator::Padds = 0;
|
||||
int IndexGenerator::TindexLen = 0;
|
||||
int IndexGenerator::LindexLen = 0;
|
||||
int IndexGenerator::PindexLen = 0;
|
||||
IndexGenerator::IndexPrimitiveType IndexGenerator::LastTPrimitive = Prim_None;
|
||||
IndexGenerator::IndexPrimitiveType IndexGenerator::LastLPrimitive = Prim_None;
|
||||
bool IndexGenerator::used = false;
|
||||
|
||||
void IndexGenerator::AddList(int numVerts)
|
||||
{
|
||||
int numTris = numVerts / 3;
|
||||
if (numTris <= 0) return;
|
||||
for (int i = 0; i < numTris; i++)
|
||||
{
|
||||
*ptr++ = index+i*3;
|
||||
*ptr++ = index+i*3+1;
|
||||
*ptr++ = index+i*3+2;
|
||||
}
|
||||
indexLen += numVerts;
|
||||
index += numVerts;
|
||||
numPrims += numTris;
|
||||
adds++;
|
||||
}
|
||||
|
||||
void IndexGenerator::AddStrip(int numVerts)
|
||||
{
|
||||
int numTris = numVerts - 2;
|
||||
if (numTris <= 0) return;
|
||||
bool wind = false;
|
||||
for (int i = 0; i < numTris; i++)
|
||||
{
|
||||
*ptr++ = index+i;
|
||||
*ptr++ = index+i+(wind?2:1);
|
||||
*ptr++ = index+i+(wind?1:2);
|
||||
wind = !wind;
|
||||
}
|
||||
indexLen += numTris * 3;
|
||||
index += numVerts;
|
||||
numPrims += numTris;
|
||||
adds++;
|
||||
onlyLists = false;
|
||||
}
|
||||
|
||||
void IndexGenerator::AddLineList(int numVerts)
|
||||
{
|
||||
int numLines= numVerts / 2;
|
||||
if (numLines <= 0) return;
|
||||
for (int i = 0; i < numLines; i++)
|
||||
{
|
||||
*ptr++ = index+i*2;
|
||||
*ptr++ = index+i*2+1;
|
||||
}
|
||||
indexLen += numVerts;
|
||||
index += numVerts;
|
||||
numPrims += numLines;
|
||||
adds++;
|
||||
}
|
||||
|
||||
void IndexGenerator::AddLineStrip(int numVerts)
|
||||
{
|
||||
int numLines = numVerts - 1;
|
||||
if (numLines <= 0) return;
|
||||
for (int i = 0; i < numLines; i++)
|
||||
{
|
||||
*ptr++ = index+i;
|
||||
*ptr++ = index+i+1;
|
||||
}
|
||||
indexLen += numLines * 2;
|
||||
index += numVerts;
|
||||
numPrims += numLines;
|
||||
adds++;
|
||||
onlyLists = false;
|
||||
}
|
||||
|
||||
void IndexGenerator::AddFan(int numVerts)
|
||||
{
|
||||
int numTris = numVerts - 2;
|
||||
if (numTris <= 0) return;
|
||||
for (int i = 0; i < numTris; i++)
|
||||
{
|
||||
*ptr++ = index;
|
||||
*ptr++ = index+i+1;
|
||||
*ptr++ = index+i+2;
|
||||
}
|
||||
indexLen += numTris * 3;
|
||||
index += numVerts;
|
||||
numPrims += numTris;
|
||||
adds++;
|
||||
onlyLists = false;
|
||||
}
|
||||
|
||||
void IndexGenerator::AddQuads(int numVerts)
|
||||
{
|
||||
int numTris = (numVerts/4)*2;
|
||||
if (numTris <= 0) return;
|
||||
for (int i = 0; i < numTris / 2; i++)
|
||||
{
|
||||
*ptr++ = index+i*4;
|
||||
*ptr++ = index+i*4+1;
|
||||
*ptr++ = index+i*4+3;
|
||||
*ptr++ = index+i*4+1;
|
||||
*ptr++ = index+i*4+2;
|
||||
*ptr++ = index+i*4+3;
|
||||
}
|
||||
indexLen += numTris * 3;
|
||||
index += numVerts;
|
||||
numPrims += numTris;
|
||||
adds++;
|
||||
onlyLists = false;
|
||||
}
|
||||
|
||||
void IndexGenerator::AddPoints(int numVerts)
|
||||
{
|
||||
index += numVerts;
|
||||
numPrims += numVerts;
|
||||
adds++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Init
|
||||
void IndexGenerator2::Start(unsigned short *Triangleptr,unsigned short *Lineptr,unsigned short *Pointptr)
|
||||
void IndexGenerator::Start(u16 *Triangleptr,u16 *Lineptr,u16 *Pointptr)
|
||||
{
|
||||
Tptr = Triangleptr;
|
||||
Lptr = Lineptr;
|
||||
@ -168,7 +63,7 @@ void IndexGenerator2::Start(unsigned short *Triangleptr,unsigned short *Lineptr,
|
||||
LastLPrimitive = Prim_None;
|
||||
}
|
||||
// Triangles
|
||||
void IndexGenerator2::AddList(int numVerts)
|
||||
void IndexGenerator::AddList(int numVerts)
|
||||
{
|
||||
int numTris = numVerts / 3;
|
||||
if (numTris <= 0) return;
|
||||
@ -185,7 +80,7 @@ void IndexGenerator2::AddList(int numVerts)
|
||||
LastTPrimitive = Prim_List;
|
||||
}
|
||||
|
||||
void IndexGenerator2::AddStrip(int numVerts)
|
||||
void IndexGenerator::AddStrip(int numVerts)
|
||||
{
|
||||
int numTris = numVerts - 2;
|
||||
if (numTris <= 0) return;
|
||||
@ -203,7 +98,7 @@ void IndexGenerator2::AddStrip(int numVerts)
|
||||
Tadds++;
|
||||
LastTPrimitive = Prim_Strip;
|
||||
}
|
||||
void IndexGenerator2::AddFan(int numVerts)
|
||||
void IndexGenerator::AddFan(int numVerts)
|
||||
{
|
||||
int numTris = numVerts - 2;
|
||||
if (numTris <= 0) return;
|
||||
@ -220,7 +115,7 @@ void IndexGenerator2::AddFan(int numVerts)
|
||||
LastTPrimitive = Prim_Fan;
|
||||
}
|
||||
|
||||
void IndexGenerator2::AddQuads(int numVerts)
|
||||
void IndexGenerator::AddQuads(int numVerts)
|
||||
{
|
||||
int numTris = (numVerts/4)*2;
|
||||
if (numTris <= 0) return;
|
||||
@ -242,7 +137,7 @@ void IndexGenerator2::AddQuads(int numVerts)
|
||||
|
||||
|
||||
//Lines
|
||||
void IndexGenerator2::AddLineList(int numVerts)
|
||||
void IndexGenerator::AddLineList(int numVerts)
|
||||
{
|
||||
int numLines= numVerts / 2;
|
||||
if (numLines <= 0) return;
|
||||
@ -258,7 +153,7 @@ void IndexGenerator2::AddLineList(int numVerts)
|
||||
LastLPrimitive = Prim_List;
|
||||
}
|
||||
|
||||
void IndexGenerator2::AddLineStrip(int numVerts)
|
||||
void IndexGenerator::AddLineStrip(int numVerts)
|
||||
{
|
||||
int numLines = numVerts - 1;
|
||||
if (numLines <= 0) return;
|
||||
@ -277,7 +172,7 @@ void IndexGenerator2::AddLineStrip(int numVerts)
|
||||
|
||||
|
||||
//Points
|
||||
void IndexGenerator2::AddPoints(int numVerts)
|
||||
void IndexGenerator::AddPoints(int numVerts)
|
||||
{
|
||||
for (int i = 0; i < numVerts; i++)
|
||||
{
|
||||
|
@ -20,58 +20,32 @@
|
||||
|
||||
#ifndef _INDEXGENERATOR_H
|
||||
#define _INDEXGENERATOR_H
|
||||
|
||||
|
||||
#include "CommonTypes.h"
|
||||
|
||||
class IndexGenerator
|
||||
{
|
||||
public:
|
||||
void Start(unsigned short *startptr);
|
||||
void AddList(int numVerts);
|
||||
void AddStrip(int numVerts);
|
||||
void AddLineList(int numVerts);
|
||||
void AddLineStrip(int numVerts);
|
||||
void AddFan(int numVerts);
|
||||
void AddQuads(int numVerts);
|
||||
void AddPoints(int numVerts);
|
||||
int GetNumPrims() {return numPrims;} //returns numprimitives
|
||||
int GetNumVerts() {return index;} //returns numprimitives
|
||||
int GetNumAdds() {return adds;}
|
||||
int GetindexLen() {return indexLen;}
|
||||
bool GetOnlyLists() {return onlyLists;}
|
||||
private:
|
||||
unsigned short *ptr;
|
||||
int numPrims;
|
||||
int index;
|
||||
int adds;
|
||||
int indexLen;
|
||||
bool onlyLists;
|
||||
};
|
||||
|
||||
class IndexGenerator2
|
||||
{
|
||||
public:
|
||||
//Init
|
||||
void Start(unsigned short *Triangleptr,unsigned short *Lineptr,unsigned short *Pointptr);
|
||||
static void Start(u16 *Triangleptr,u16 *Lineptr,u16 *Pointptr);
|
||||
//Triangles
|
||||
void AddList(int numVerts);
|
||||
void AddStrip(int numVerts);
|
||||
void AddFan(int numVerts);
|
||||
void AddQuads(int numVerts);
|
||||
static void AddList(int numVerts);
|
||||
static void AddStrip(int numVerts);
|
||||
static void AddFan(int numVerts);
|
||||
static void AddQuads(int numVerts);
|
||||
//Lines
|
||||
void AddLineList(int numVerts);
|
||||
void AddLineStrip(int numVerts);
|
||||
static void AddLineList(int numVerts);
|
||||
static void AddLineStrip(int numVerts);
|
||||
//Points
|
||||
void AddPoints(int numVerts);
|
||||
static void AddPoints(int numVerts);
|
||||
//Interface
|
||||
int GetNumTriangles() {return numT;}
|
||||
int GetNumLines() {return numL;}
|
||||
int GetNumPoints() {return numP;}
|
||||
int GetNumVerts() {return index;} //returns numprimitives
|
||||
int GetNumAdds() {return Tadds + Ladds + Padds;}
|
||||
int GetTriangleindexLen() {return TindexLen;}
|
||||
int GetLineindexLen() {return LindexLen;}
|
||||
int GetPointindexLen() {return PindexLen;}
|
||||
static int GetNumTriangles() {used = true; return numT;}
|
||||
static int GetNumLines() {used = true;return numL;}
|
||||
static int GetNumPoints() {used = true;return numP;}
|
||||
static int GetNumVerts() {return index;} //returns numprimitives
|
||||
static int GetNumAdds() {return Tadds + Ladds + Padds;}
|
||||
static int GetTriangleindexLen() {return TindexLen;}
|
||||
static int GetLineindexLen() {return LindexLen;}
|
||||
static int GetPointindexLen() {return PindexLen;}
|
||||
|
||||
enum IndexPrimitiveType
|
||||
{
|
||||
@ -81,21 +55,22 @@ public:
|
||||
Prim_Fan
|
||||
} ;
|
||||
private:
|
||||
unsigned short *Tptr;
|
||||
unsigned short *Lptr;
|
||||
unsigned short *Pptr;
|
||||
int numT;
|
||||
int numL;
|
||||
int numP;
|
||||
int index;
|
||||
int Tadds;
|
||||
int Ladds;
|
||||
int Padds;
|
||||
int TindexLen;
|
||||
int LindexLen;
|
||||
int PindexLen;
|
||||
IndexPrimitiveType LastTPrimitive;
|
||||
IndexPrimitiveType LastLPrimitive;
|
||||
static u16 *Tptr;
|
||||
static u16 *Lptr;
|
||||
static u16 *Pptr;
|
||||
static int numT;
|
||||
static int numL;
|
||||
static int numP;
|
||||
static int index;
|
||||
static int Tadds;
|
||||
static int Ladds;
|
||||
static int Padds;
|
||||
static int TindexLen;
|
||||
static int LindexLen;
|
||||
static int PindexLen;
|
||||
static IndexPrimitiveType LastTPrimitive;
|
||||
static IndexPrimitiveType LastLPrimitive;
|
||||
static bool used;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user