1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Reduce the use of porting::getTimeMs() when rendering frames (#12679)

* Avoid calling TimeTaker too frequently in renderMapXXX
* Calculate animation timer once per frame
* Remove code that breaks rendering frame at 2000ms

Co-authored-by: sfan5 <sfan5@live.de>

Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
x2048 2022-08-13 22:33:26 +02:00 committed by GitHub
parent 0e439b2fa3
commit d1cbb4bd8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 16 deletions

View file

@ -449,13 +449,6 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
for (auto &descriptor : draw_order) {
scene::IMeshBuffer *buf = descriptor.getBuffer();
// Check and abort if the machine is swapping a lot
if (draw.getTimerTime() > 2000) {
infostream << "ClientMap::renderMap(): Rendering took >2s, " <<
"returning." << std::endl;
return;
}
if (!descriptor.m_reuse_material) {
auto &material = buf->getMaterial();
@ -803,13 +796,6 @@ void ClientMap::renderMapShadows(video::IVideoDriver *driver,
for (auto &descriptor : draw_order) {
scene::IMeshBuffer *buf = descriptor.getBuffer();
// Check and abort if the machine is swapping a lot
if (draw.getTimerTime() > 1000) {
infostream << "ClientMap::renderMapShadows(): Rendering "
"took >1s, returning." << std::endl;
break;
}
if (!descriptor.m_reuse_material) {
// override some material properties
video::SMaterial local_material = buf->getMaterial();