mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Help the compiler out a little bit in IndexGenerator::AddStrip.
The generated code wasn't good - this helps break long register dependency chains. Speed boost is measurable but small on x86, but might be bigger on simpler CPUs.
This commit is contained in:
parent
ce46adb7ac
commit
c1194dcb52
1 changed files with 12 additions and 2 deletions
|
@ -88,12 +88,22 @@ void IndexGenerator::AddStrip(int numVerts, bool clockwise) {
|
|||
const int numTris = numVerts - 2;
|
||||
u16 *outInds = inds_;
|
||||
int ibase = index_;
|
||||
for (int i = 0; i < numTris; i++) {
|
||||
size_t numPairs = numTris / 2;
|
||||
while (numPairs > 0) {
|
||||
*outInds++ = ibase;
|
||||
*outInds++ = ibase + wind;
|
||||
*outInds++ = ibase + (wind ^ 3);
|
||||
*outInds++ = ibase + 1;
|
||||
*outInds++ = ibase + 1 + (wind ^ 3);
|
||||
*outInds++ = ibase + 1 + wind;
|
||||
ibase += 2;
|
||||
numPairs--;
|
||||
}
|
||||
if (numTris & 1) {
|
||||
*outInds++ = ibase;
|
||||
*outInds++ = ibase + wind;
|
||||
wind ^= 3; // toggle between 1 and 2
|
||||
*outInds++ = ibase + wind;
|
||||
ibase++;
|
||||
}
|
||||
inds_ = outInds;
|
||||
index_ += numVerts;
|
||||
|
|
Loading…
Add table
Reference in a new issue