diff options
| author | Rodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com> | 2009-10-06 14:24:10 +0000 |
|---|---|---|
| committer | Rodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com> | 2009-10-06 14:24:10 +0000 |
| commit | 19b8e6bc08774ecd292fddbd70b0b80eb26cae60 (patch) | |
| tree | 26361090c826491dc853dac63ec5ef4565e16eb4 /Source/Core/VideoCommon/Src/IndexGenerator.cpp | |
| parent | 58df543e6a22a2daa044bc5b28c65a001c454935 (diff) | |
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
Diffstat (limited to 'Source/Core/VideoCommon/Src/IndexGenerator.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/IndexGenerator.cpp | 157 |
1 files changed, 26 insertions, 131 deletions
diff --git a/Source/Core/VideoCommon/Src/IndexGenerator.cpp b/Source/Core/VideoCommon/Src/IndexGenerator.cpp index 39b4acc3a7..b4d2ecb112 100644 --- a/Source/Core/VideoCommon/Src/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/Src/IndexGenerator.cpp @@ -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; -} - -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) +//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::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++) { |
