mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-28 08:43:38 +01:00
IndexGenerator microoptimization
This commit is contained in:
1 parent
182d87cc15
commit
efa8cfc736
2 files changed
+24
-25
No files matched your search
@@ -20,7 +20,7 @@
|
||||
#include "Common/Common.h"
|
||||
|
||||
// Points don't need indexing...
|
||||
static const u8 indexedPrimitiveType[7] = {
|
||||
const u8 IndexGenerator::indexedPrimitiveType[7] = {
|
||||
GE_PRIM_POINTS,
|
||||
GE_PRIM_LINES,
|
||||
GE_PRIM_LINES,
|
||||
@@ -30,27 +30,6 @@ static const u8 indexedPrimitiveType[7] = {
|
||||
GE_PRIM_RECTANGLES,
|
||||
};
|
||||
|
||||
void IndexGenerator::Reset() {
|
||||
prim_ = GE_PRIM_INVALID;
|
||||
count_ = 0;
|
||||
index_ = 0;
|
||||
seenPrims_ = 0;
|
||||
pureCount_ = 0;
|
||||
this->inds_ = indsBase_;
|
||||
}
|
||||
|
||||
bool IndexGenerator::PrimCompatible(int prim1, int prim2) {
|
||||
if (prim1 == GE_PRIM_INVALID || prim2 == GE_PRIM_KEEP_PREVIOUS)
|
||||
return true;
|
||||
return indexedPrimitiveType[prim1] == indexedPrimitiveType[prim2];
|
||||
}
|
||||
|
||||
bool IndexGenerator::PrimCompatible(int prim) const {
|
||||
if (prim_ == GE_PRIM_INVALID || prim == GE_PRIM_KEEP_PREVIOUS)
|
||||
return true;
|
||||
return indexedPrimitiveType[prim] == prim_;
|
||||
}
|
||||
|
||||
void IndexGenerator::Setup(u16 *inds) {
|
||||
this->indsBase_ = inds;
|
||||
Reset();
|
||||
|
||||
@@ -26,9 +26,27 @@
|
||||
class IndexGenerator {
|
||||
public:
|
||||
void Setup(u16 *indexptr);
|
||||
void Reset();
|
||||
static bool PrimCompatible(int prim1, int prim2);
|
||||
bool PrimCompatible(int prim) const;
|
||||
void Reset() {
|
||||
prim_ = GE_PRIM_INVALID;
|
||||
count_ = 0;
|
||||
index_ = 0;
|
||||
seenPrims_ = 0;
|
||||
pureCount_ = 0;
|
||||
this->inds_ = indsBase_;
|
||||
}
|
||||
|
||||
bool PrimCompatible(int prim1, int prim2) {
|
||||
if (prim1 == GE_PRIM_INVALID || prim2 == GE_PRIM_KEEP_PREVIOUS)
|
||||
return true;
|
||||
return indexedPrimitiveType[prim1] == indexedPrimitiveType[prim2];
|
||||
}
|
||||
|
||||
bool PrimCompatible(int prim) const {
|
||||
if (prim_ == GE_PRIM_INVALID || prim == GE_PRIM_KEEP_PREVIOUS)
|
||||
return true;
|
||||
return indexedPrimitiveType[prim] == prim_;
|
||||
}
|
||||
|
||||
GEPrimitiveType Prim() const { return prim_; }
|
||||
|
||||
void AddPrim(int prim, int vertexCount);
|
||||
@@ -97,5 +115,7 @@ private:
|
||||
int pureCount_;
|
||||
GEPrimitiveType prim_;
|
||||
int seenPrims_;
|
||||
|
||||
static const u8 indexedPrimitiveType[7];
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user