OGRECave / ogre-pagedgeometry

Paged Geometry is a component for rendering of dense vegetation
https://ogrecave.github.io/ogre-pagedgeometry/
21 stars 7 forks source link

Huge long delays when moving. #12

Closed cryham closed 3 years ago

cryham commented 3 years ago

I've build pagedgeometry from sources (with latest Ogre 1.12.10), and tested its examples. Example1 to 5 and 7 run smooth. Example6 starts showing some jitter, very short delays frequently when moving. Example8 to 11 all have my problem. So after it's loaded you can rotate smoothly, and probably move slowly a small distance. But moving generally makes those long (about 1sec) delays. The faster I move the bigger delays, in Example11 I can move but with shift it gets long delays down to like 1 Fps or less. And the more meshes the bigger delays too. Example10 needs few sec at start until I can rotate smooth, but moving anywhere almost freezes, until I release arrow key, then I even land opposite to where I was moving.

This is not generating impostors that takes time causing long delays. It is something that depends on how many vertices are in page. It gets longer the faster I move camera and longer with more meshes / models visible. IDK feels like e.g. creating pages in GPU form CPU was taking way too much time or something.

Device Name: Radeon RX 570 Series (POLARIS10, DRM 3.27.0, 4.19.0-12-amd64, LLVM 7.0.1) Driver Version: 4.5.0.0 Debian 10,

paroj commented 3 years ago

the strange thing, however, is that there are no delays if the Impostor textures (Impostor.*.png) were already generated. Do you observe the same?

I ran perf on Example8 with cold cache (rm Impostor.*.png) and got 50% of runtime spent inside (tself) here:

diff --git a/source/WindBatchedGeometry.cpp b/source/WindBatchedGeometry.cpp
index 9691a6a..c3be02b 100644
--- a/source/WindBatchedGeometry.cpp
+++ b/source/WindBatchedGeometry.cpp
@@ -201,7 +201,7 @@ void WindBatchedGeometry::WindSubBatch::build()
    }

-
+#if 0
    //For each queued mesh...
    size_t indexOffset = 0;
    for (size_t iMesh = 0, meshCnt = m_queueMesh.size(); iMesh < meshCnt; ++iMesh)
@@ -430,6 +430,7 @@ void WindBatchedGeometry::WindSubBatch::build()
            }
        }
    }
+#endif

    //Unlock buffers
    m_pIndexData->indexBuffer->unlock();

does applying this patch resolve the performance issues for you as well? (obviously no geometry is drawn)

with warm caches, this part merely takes 3% (tself)

paroj commented 3 years ago

seems this was introduced by https://github.com/OGRECave/ogre/commit/e6b6153dc0cc92ce8485aeb6ec9a8d30c7f5f393

should be fixed by https://github.com/OGRECave/ogre-pagedgeometry/commit/7c9295f771e8c7973efc04d53283978ccd44fc9b

feel free to re-open if this is not fixed for you.

cryham commented 3 years ago

Yes it is fixed now.