diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-08-29 23:38:40 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-08-30 18:22:56 +0200 |
| commit | af6ca21ed0f2715aad0b2ae80d200589b5e31089 (patch) | |
| tree | 51a51a4f4a487d29439be597e674d6c8ac58c498 /shaders/texture-unit-cache.cpp | |
| parent | dbffcdc7db183ae3f1c938e8d84f4a0a11c6c122 (diff) | |
wip
Diffstat (limited to 'shaders/texture-unit-cache.cpp')
| -rw-r--r-- | shaders/texture-unit-cache.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/shaders/texture-unit-cache.cpp b/shaders/texture-unit-cache.cpp index 71d21a8f..2c415c80 100644 --- a/shaders/texture-unit-cache.cpp +++ b/shaders/texture-unit-cache.cpp @@ -91,7 +91,7 @@ void texture_unit_cache::unlock(size_t i, bool reuse_immediately) units[i] = { .ptr = units[i].ptr, .lru_val = reuse_immediately ? 0 : ++lru_counter }; } -void texture_unit_cache::output_stats() const +void texture_unit_cache::output_stats() { auto total = cache_hit_count + cache_miss_count; @@ -100,6 +100,11 @@ void texture_unit_cache::output_stats() const auto ratio = (double)cache_hit_count/(double)(cache_hit_count+cache_miss_count); printf("texture-binding: hit rate %.2f%% (%zu binds total)\n", ratio*100, (size_t)total); std::fflush(stdout); } + if (total > (size_t)10'000) + { + cache_hit_count /= 5; + cache_miss_count /= 5; + } } size_t texture_unit_cache::get_unit_count() @@ -108,7 +113,7 @@ size_t texture_unit_cache::get_unit_count() GLint value = 0; glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &value); fm_assert(value >= /*GL 3.3*/ 16); - //value = 16; // for performance testing + value = 1; // limit for performance testing return value; }(); return (size_t)ret; |
