mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Don't scan for something to decimate every frame. Actually costs perf.
This commit is contained in:
parent
76ae643335
commit
61d419b2ec
4 changed files with 24 additions and 0 deletions
|
@ -38,6 +38,9 @@
|
|||
// Not used in lowmem mode.
|
||||
#define TEXTURE_SECOND_KILL_AGE 100
|
||||
|
||||
// Try to be prime to other decimation intervals.
|
||||
#define TEXCACHE_DECIMATION_INTERVAL 13
|
||||
|
||||
extern int g_iNumVideos;
|
||||
|
||||
u32 RoundUpToPowerOf2(u32 v)
|
||||
|
@ -61,6 +64,7 @@ static inline u32 GetLevelBufw(int level, u32 texaddr) {
|
|||
|
||||
TextureCache::TextureCache() : clearCacheNextFrame_(false), lowMemoryMode_(false), clutBuf_(NULL) {
|
||||
lastBoundTexture = -1;
|
||||
decimationCounter_ = TEXCACHE_DECIMATION_INTERVAL;
|
||||
// This is 5MB of temporary storage. Might be possible to shrink it.
|
||||
tmpTexBuf32.resize(1024 * 512); // 2MB
|
||||
tmpTexBuf16.resize(1024 * 512); // 1MB
|
||||
|
@ -97,6 +101,12 @@ void TextureCache::Clear(bool delete_them) {
|
|||
|
||||
// Removes old textures.
|
||||
void TextureCache::Decimate() {
|
||||
if (--decimationCounter_ <= 0) {
|
||||
decimationCounter_ = TEXCACHE_DECIMATION_INTERVAL;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
lastBoundTexture = -1;
|
||||
int killAge = lowMemoryMode_ ? TEXTURE_KILL_AGE_LOWMEM : TEXTURE_KILL_AGE;
|
||||
|
|
|
@ -147,5 +147,7 @@ private:
|
|||
|
||||
u32 lastBoundTexture;
|
||||
float maxAnisotropyLevel;
|
||||
|
||||
int decimationCounter_;
|
||||
};
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@ enum {
|
|||
TRANSFORMED_VERTEX_BUFFER_SIZE = 65536 * sizeof(TransformedVertex)
|
||||
};
|
||||
|
||||
|
||||
#define VERTEXCACHE_DECIMATION_INTERVAL 17
|
||||
|
||||
inline float clamp(float in, float min, float max) {
|
||||
return in < min ? min : (in > max ? max : in);
|
||||
}
|
||||
|
@ -70,6 +73,7 @@ TransformDrawEngine::TransformDrawEngine()
|
|||
framebufferManager_(0),
|
||||
numDrawCalls(0),
|
||||
uvScale(0) {
|
||||
decimationCounter_ = VERTEXCACHE_DECIMATION_INTERVAL;
|
||||
// Allocate nicely aligned memory. Maybe graphics drivers will
|
||||
// appreciate it.
|
||||
// All this is a LOT of memory, need to see if we can cut down somehow.
|
||||
|
@ -1095,6 +1099,12 @@ void TransformDrawEngine::ClearTrackedVertexArrays() {
|
|||
}
|
||||
|
||||
void TransformDrawEngine::DecimateTrackedVertexArrays() {
|
||||
if (--decimationCounter_ <= 0) {
|
||||
decimationCounter_ = VERTEXCACHE_DECIMATION_INTERVAL;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
int threshold = gpuStats.numFrames - VAI_KILL_AGE;
|
||||
for (auto iter = vai_.begin(); iter != vai_.end(); ) {
|
||||
if (iter->second->lastFrame < threshold) {
|
||||
|
|
|
@ -181,6 +181,8 @@ private:
|
|||
DeferredDrawCall drawCalls[MAX_DEFERRED_DRAW_CALLS];
|
||||
int numDrawCalls;
|
||||
|
||||
int decimationCounter_;
|
||||
|
||||
UVScale *uvScale;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue