mirror of
https://github.com/mehah/otclient
synced 2026-08-15 16:29:06 -04:00
fix: call draw preLoad before rendering foreground (#1763)
Bug Fixes: - Improved rendering sequencing so preload work runs before any foreground interface draw tasks, reducing timing-related inconsistencies. - Refined foreground UI rendering logic: it now renders immediately only when appropriate for offline play, and otherwise enqueues foreground UI updates when map rendering is available—removing the prior fallback that could render at the wrong time.
This commit is contained in:
parent
225ce4d5b5
commit
350e506aa7
1 changed files with 15 additions and 15 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include "clock.h"
|
||||
#include "eventdispatcher.h"
|
||||
#include "garbagecollection.h"
|
||||
#include "client/game.h"
|
||||
#include "framework/graphics/drawpoolmanager.h"
|
||||
#include "framework/graphics/graphics.h"
|
||||
#include "framework/graphics/image.h"
|
||||
|
|
@ -210,20 +211,22 @@ void GraphicalApplication::run()
|
|||
continue;
|
||||
}
|
||||
|
||||
const bool canDrawForeground = !g_drawPool.isDrawing(DrawPoolType::FOREGROUND) && m_drawEvents->canDraw(DrawPoolType::FOREGROUND);
|
||||
{
|
||||
AutoStat s(STATS_RENDER, "DrawPreload");
|
||||
m_drawEvents->preLoad();
|
||||
}
|
||||
|
||||
if (canDrawMap()) {
|
||||
if (canDrawForeground) {
|
||||
tasks.emplace_back(g_asyncDispatcher->submit_task([] {
|
||||
AutoStat s(STATS_RENDER, "DrawForegroundUI");
|
||||
g_ui.render(DrawPoolType::FOREGROUND);
|
||||
}));
|
||||
}
|
||||
bool canDrawForeground = !g_drawPool.isDrawing(DrawPoolType::FOREGROUND) && m_drawEvents->canDraw(DrawPoolType::FOREGROUND);
|
||||
|
||||
if (!g_game.isOnline() && canDrawForeground) {
|
||||
AutoStat s(STATS_RENDER, "DrawForegroundUI");
|
||||
g_ui.render(DrawPoolType::FOREGROUND);
|
||||
} else if (canDrawMap() && canDrawForeground) {
|
||||
tasks.emplace_back(g_asyncDispatcher->submit_task([] {
|
||||
AutoStat s(STATS_RENDER, "DrawForegroundUI");
|
||||
g_ui.render(DrawPoolType::FOREGROUND);
|
||||
}));
|
||||
|
||||
{
|
||||
AutoStat s(STATS_RENDER, "DrawPreload");
|
||||
m_drawEvents->preLoad();
|
||||
}
|
||||
static constexpr std::array<DrawPoolType, 2> types{ DrawPoolType::LIGHT, DrawPoolType::FOREGROUND_MAP };
|
||||
for (const auto type : types) {
|
||||
if (m_drawEvents->canDraw(type)) {
|
||||
|
|
@ -241,9 +244,6 @@ void GraphicalApplication::run()
|
|||
|
||||
tasks.wait();
|
||||
tasks.clear();
|
||||
} else if (canDrawForeground) {
|
||||
AutoStat s(STATS_RENDER, "DrawForegroundUI");
|
||||
g_ui.render(DrawPoolType::FOREGROUND);
|
||||
}
|
||||
|
||||
m_mapProcessFrameCounter.update();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue