[Android: v1.9.0, v1.10.8, v1.10.x(master)] Very strange! Low FPS when built for Android using Visual Studio.

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
nuke
Halfling
Posts: 72
Joined: Wed Oct 01, 2014 1:16 am
Location: Crimea
x 5

[Android: v1.9.0, v1.10.8, v1.10.x(master)] Very strange! Low FPS when built for Android using Visual Studio.

Post by nuke »

Hello!
I got a very strange situation! Need help! :?

FORWORD:
I decided to use the Visual Studio 2017 to build OGRE for Android (RenderSystem - GLES2),
because this is more convenient and faster than creating and editing a Android.mk and Application.mk files in some notepad (I use notepad++).
I do not use the CMake to build OGRE, I just add the source files of the OGRE (of course, except GL,GL3+,Direct3d9/11 files and others not related to the OGRE for Android) to the project - in the jni/Application.mk and jni/Android.mk when build using ndk-build.cmd or add OGRE source files to the Visual Studio 2017 Android Project when build using VS2017.

ANDROID NDK (NDK-BUILD.CMD):
When I build OGRE using Android ndk-build.cmd then Samples work as expected, without loss of FPS.
(Before that, I created files Android.mk and Application.mk for a week or two :?.
The file size of Android.mk is about 106 kilobytes of text written by hand! This is a terrible thing... :? )


VISUAL STUDIO 2017 ANDROID PROJECT:
When I build OGRE in the VS2017, then here comes a very interesting crap! :D :(
The project compiles fine, it also starts great! But some samples give a....... low FPS!!! :(
It is very strange! The source code is identical, the same! The compiler options are almost identical too !
And this applies to all three different versions that I compiled and tested: v1.9, v1.10.8 and v1.10.x(master,current from GitHub)

HERE IS THE FPS COMPARISON:
Options of my builds: -O3, Release, ARMv7a, Android API-9, NDK r10e, stlport_static
Device: LG-X145 (Mali-400 MP). On other devices, the situation is the same. It does not depend on the device.
  • v1.10.8 - downloaded from F-DROID.ORG vs. my VS2017 build

    Code: Select all

    ------------------------------------------------------------------------
    SAMPLE                  | v1.10.8 (F-DROID) | v1.10.8 (my VS2017 bld.) |
    ------------------------|-------------------|--------------------------|
    CameraTracking          |      60 fps       |          60 fps          |
    CelShading              |      60 fps       |          60 fps          |
    Character               |      60 fps       |          34 fps  !!!     |
    Cube Mapping            |      60 fps       |          60 fps          |
    Dynamic Texturing       |      60 fps       |          42 fps  !!!     |
    Fresnel                 |      32 fps       |          17 fps  !!!     |
    Grass                   |      22 fps       |          22 fps          |
    Ocean                   |      52 fps       |          52 fps          |
    Shadows(tex+modul+unif) |      34 fps       |          32 fps          |
    Skeletal Animation      |      44 fps       |          16 fps  !!!     |
    Smoke                   |      60 fps       |          60 fps          |
    Sphere Mapping          |      60 fps       |          60 fps          |
    Water                   |      60 fps       |          41 fps  !!!     |
    ------------------------------------------------------------------------
  • v1.9.0 - NDK-BUILD.CMD vs. my VS2017 build
    NOTE (offtopic!): (+1...N) means - in comparison with v1.10.8 from F-DROID.ORG

    Code: Select all

    ----------------------------------------------------------------
    SAMPLE                  | v1.9.0 ndk-build  |  v1.9.0 VS2017   |
    ------------------------|-------------------|------------------|
    CameraTracking          |      60 fps       |     60 fps       |
    CelShading              |      60 fps       |     60 fps       |
    Character               |      60 fps       |     35 fps !!!   |
    Cube Mapping            |      60 fps       |     60 fps       |
    Dynamic Texturing       |      60 fps       |     42 fps !!!   |
    Fresnel                 |      34 fps (+1)  |     14 fps !!!   |
    Grass                   |      23 fps (+1)  |     23 fps       |
    Ocean                   |      54 fps (+2)  |     54 fps       |
    Shadows(tex+modul+unif) |         -         |       -          |
    Skeletal Animation      |      48 fps (+4)  |     17 fps !!!   |
    Smoke                   |      60 fps       |     60 fps       |
    Sphere Mapping          |      60 fps       |     60 fps       |
    Water                   |      60 fps       |     39 fps !!!   |
    ----------------------------------------------------------------
  • v1.10.x (GitHub master) - my VS2017 build[/u]

    Code: Select all

    -----------------------------------------------------------
    SAMPLE                  | v1.10.x (GitHub master), VS2017 |
    ------------------------|---------------------------------|
    CameraTracking          |              60 fps             | 
    CelShading              |              60 fps             |
    Character               |              33 fps !!!         |
    Cube Mapping            |              58 fps             |
    Dynamic Texturing       |              42 fps !!!         |
    Fresnel                 |              17 fps !!!         |
    Grass                   |              22 fps             |
    Ocean                   |              52 fps             |
    Shadows(tex+modul+unif) |              16 fps !!!         |
    Skeletal Animation      |              17 fps !!!         |
    Smoke                   |              60 fps             |
    Sphere Mapping          |              60 fps             |
    Water                   |              42 fps !!!         |
    -----------------------------------------------------------
SOME SCREENSHOTS:
For example I screenshoted the Character Sample of 5 different OGRE builds/versions.
  • v1.10.8 from F-DROID.ORG, 59 FPS:
    Image
  • v1.10.8, my VS2017 build, 34 FPS:
    Image
  • v1.9.0, my NDK-BUILD.CMD build, 59 FPS:
    Image
  • v1.9.0, my VS2017 build, 34 FPS:
    Image
  • v1.10.x (GitHub master), my VS2017 build, 32 FPS:
    Image
PROFILING:
I profiled some problematic samples.
Here are the comparisons:
NOTE:I drew the green and red dots.
Image

ACTIONS THAT DID NOT HELP:
  • changing compiler options like -fPIC, -Os/-O3
  • switching from FreeImage to STBI
  • switching Android NDK: r10e and r15c
  • switching Android Target API Level: API-9 , API-14 , API-16, API-19
  • I tried to compile all the source codes of OGRE in one large monolithic project including all the dependencies of OGRE (OIS, freetype, zziplib etc.). No effect too. :(
In order to exclude the influence of the AndroidManifest.xml file and the nuances of the process of creating the APK (Ant), I replaced the applicattion main library file libBrowser.so of NDK-build and VS-build with places.
The FPS was higher in the application in which I put the *.so-library builded using NDK.
Thus, I excluded the influence of the AndroidManifest.xml and the process of creating the APK (Ant).
That is, the problem is only inside of the libBrowser.so library (more precisely in how it is compiled and linked)


It's really very strange.... Where should I dig / look?
What to try?
I do not want to go back to the notepad++ and to the *.mk makefiles :(
Help!
paroj
OGRE Team Member
OGRE Team Member
Posts: 1995
Joined: Sun Mar 30, 2014 2:51 pm
x 1075
Contact:

Re: [Android: v1.9.0, v1.10.8, v1.10.x(master)] Very strange! Low FPS when built for Android using Visual Studio.

Post by paroj »

nuke wrote: Sun Oct 29, 2017 12:50 am The compiler options are almost identical too
this might be the issue. The F-Droid build uses NEON which you seem not to enable.

Also why do you want to use VS instead of Android Studio?

Also why do you need to work on the Ogre internals? Usually it should be enough to just build the .so using CMake and then use it in your project. Which might be developen in VS, nodepad++ or Java.
Post Reply