faster texture cache loading in low fps modes
This commit is contained in:
parent
7d0e5c80bd
commit
139db5b03b
2
external/solanaceae_contact
vendored
2
external/solanaceae_contact
vendored
@ -1 +1 @@
|
||||
Subproject commit 2d73c7272c3c254086fa067ccfdfb4072c20f7c9
|
||||
Subproject commit 9ca6adee4f6f01d83fd1f5ece5c4b84396079ccc
|
2
external/solanaceae_message3
vendored
2
external/solanaceae_message3
vendored
@ -1 +1 @@
|
||||
Subproject commit 20af7dd705fe1be68f7678292125620d48aa278b
|
||||
Subproject commit a1f5add8d347da2eb8acb812cd6dbcb36a46778d
|
2
external/solanaceae_util
vendored
2
external/solanaceae_util
vendored
@ -1 +1 @@
|
||||
Subproject commit 390b123fb7380e5da30954d1b0a337208407f40d
|
||||
Subproject commit d304d719e9b7c3c40d32fc45993f0ccfd34c556e
|
@ -136,7 +136,7 @@ ChatGui4::~ChatGui4(void) {
|
||||
//}
|
||||
}
|
||||
|
||||
void ChatGui4::render(float time_delta) {
|
||||
float ChatGui4::render(float time_delta) {
|
||||
if (!_cr.storage<Contact::Components::TagAvatarInvalidate>().empty()) { // handle force-reloads for avatars
|
||||
std::vector<Contact3> to_purge;
|
||||
_cr.view<Contact::Components::TagAvatarInvalidate>().each([&to_purge](const Contact3 c) {
|
||||
@ -627,8 +627,14 @@ void ChatGui4::render(float time_delta) {
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
_contact_tc.workLoadQueue();
|
||||
_msg_tc.workLoadQueue();
|
||||
bool unfinished_work_queue = _contact_tc.workLoadQueue();
|
||||
unfinished_work_queue = unfinished_work_queue || _msg_tc.workLoadQueue();
|
||||
|
||||
if (unfinished_work_queue) {
|
||||
return 0.1f; // so we can get images loaded faster
|
||||
} else {
|
||||
return 1.f; // TODO: higher min fps?
|
||||
}
|
||||
}
|
||||
|
||||
void ChatGui4::sendFilePath(const char* file_path) {
|
||||
|
@ -57,7 +57,7 @@ class ChatGui4 {
|
||||
~ChatGui4(void);
|
||||
|
||||
public:
|
||||
void render(float time_delta);
|
||||
float render(float time_delta);
|
||||
|
||||
public:
|
||||
bool any_unread {false};
|
||||
|
@ -168,7 +168,7 @@ Screen* MainScreen::render(float time_delta, bool&) {
|
||||
|
||||
const float pm_interval = pm.render(time_delta); // render
|
||||
|
||||
cg.render(time_delta); // render
|
||||
const float cg_interval = cg.render(time_delta); // render
|
||||
sw.render(); // render
|
||||
tuiu.render(); // render
|
||||
tdch.render(); // render
|
||||
@ -217,6 +217,8 @@ Screen* MainScreen::render(float time_delta, bool&) {
|
||||
ImGui::ShowDemoWindow();
|
||||
}
|
||||
|
||||
_render_interval = std::min<float>(pm_interval, cg_interval);
|
||||
|
||||
if (
|
||||
_fps_perf_mode > 1 // TODO: magic
|
||||
) {
|
||||
@ -228,9 +230,9 @@ Screen* MainScreen::render(float time_delta, bool&) {
|
||||
_window_hidden
|
||||
)
|
||||
) {
|
||||
_render_interval = std::min<float>(1.f/1.f, pm_interval);
|
||||
_render_interval = std::min<float>(1.f/1.f, _render_interval);
|
||||
} else {
|
||||
_render_interval = std::min<float>(1.f/60.f, pm_interval);
|
||||
_render_interval = std::min<float>(1.f/60.f, _render_interval);
|
||||
}
|
||||
|
||||
_time_since_event += time_delta;
|
||||
|
@ -162,8 +162,10 @@ struct TextureCache {
|
||||
}
|
||||
}
|
||||
|
||||
void workLoadQueue(void) {
|
||||
for (auto it = _to_load.begin(); it != _to_load.end(); it++) {
|
||||
// returns true if there is still work queued up
|
||||
bool workLoadQueue(void) {
|
||||
auto it = _to_load.begin();
|
||||
for (; it != _to_load.end(); it++) {
|
||||
auto new_entry_opt = _l.load(_tu, *it);
|
||||
if (new_entry_opt.has_value()) {
|
||||
_cache.emplace(*it, new_entry_opt.value());
|
||||
@ -172,6 +174,10 @@ struct TextureCache {
|
||||
break; // end load from queue/onlyload 1 per update
|
||||
}
|
||||
}
|
||||
|
||||
it++;
|
||||
|
||||
return it != _to_load.end();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user