Author Topic: How to improve the jpct lib load speed?  (Read 905 times)

Offline gamenewer

  • long
  • ***
  • Posts: 171
    • View Profile
How to improve the jpct lib load speed?
« on: September 25, 2014, 12:31:57 pm »
Hello,   I  do a test  for load jpct lib speed,  only I do is  init framebuffer  and show  red color , it will take about  8 ~ 10 second , I noticed that the log print  jpct load the default shader  .  If  this is the reason cause the load time long ?  and How to improve the jpct lib load speed ?

Thanks very much ! :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: How to improve the jpct lib load speed?
« Reply #1 on: September 25, 2014, 08:42:33 pm »
The complete log output may help. Compiling the default shaders has to be done at startup, there's no real way around this. On my Nexus 4, this takes 1.2 sec. I don't see how this can take 10 sec on any device unless the driver sends the files to some foreign country to let them compile by hand... ;)

Offline gamenewer

  • long
  • ***
  • Posts: 171
    • View Profile
Re: How to improve the jpct lib load speed?
« Reply #2 on: September 26, 2014, 11:20:54 am »
Here is the log,  Loading default shaders  take long time

09-26 17:17:16.046: D/libEGL(15801): loaded /system/lib/egl/libGLES_android.so
09-26 17:17:16.066: D/libEGL(15801): loaded /system/lib/egl/libEGL_adreno200.so
09-26 17:17:16.076: D/libEGL(15801): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
09-26 17:17:16.106: D/libEGL(15801): loaded /system/lib/egl/libGLESv2_adreno200.so
09-26 17:17:16.206: D/dalvikvm(15801): GC_EXTERNAL_ALLOC freed 64K, 48% free 2813K/5379K, external 0K/0K, paused 40ms
09-26 17:17:16.236: I/jPCT-AE(15801): GL context is 1079226696
09-26 17:17:16.236: I/jPCT-AE(15801): Initializing GL20 render pipeline...
09-26 17:17:16.236: I/jPCT-AE(15801): Accessing shaders via JAR!
09-26 17:17:16.236: I/jPCT-AE(15801): Loading default shaders !
09-26 17:17:16.236: I/jPCT-AE(15801): 0 shaders in replacement map!
09-26 17:17:16.236: I/jPCT-AE(15801): Default fragment shader is: /defaultFragmentShader.src
09-26 17:17:16.386: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:16.396: I/jPCT-AE(15801): Text file from InputStream loaded...2416 bytes
09-26 17:17:16.396: I/jPCT-AE(15801): Default vertex shader is: /defaultVertexShader.src
09-26 17:17:16.396: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:16.446: D/dalvikvm(15801): GC_CONCURRENT freed 169K, 46% free 3076K/5639K, external 0K/512K, paused 2ms+17ms
09-26 17:17:16.446: I/jPCT-AE(15801): Text file from InputStream loaded...4496 bytes
09-26 17:17:16.446: I/jPCT-AE(15801): Compiling shader program!
09-26 17:17:18.858: I/jPCT-AE(15801): Handles of 3: 2/36/1
09-26 17:17:18.858: I/jPCT-AE(15801): Loading default shaders (Tex0Amb)!
09-26 17:17:18.858: I/jPCT-AE(15801): 0 shaders in replacement map!
09-26 17:17:18.858: I/jPCT-AE(15801): Default fragment shader is: /defaultFragmentShader.src
09-26 17:17:18.868: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:18.868: I/jPCT-AE(15801): Text file from InputStream loaded...199 bytes
09-26 17:17:18.868: I/jPCT-AE(15801): Default vertex shader is: /defaultVertexShader.src
09-26 17:17:18.868: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:18.868: I/jPCT-AE(15801): Text file from InputStream loaded...757 bytes
09-26 17:17:18.868: I/jPCT-AE(15801): Compiling shader program!
09-26 17:17:18.898: I/jPCT-AE(15801): Handles of 6: 2/3/1
09-26 17:17:18.898: I/jPCT-AE(15801): Loading default shaders (Tex0)!
09-26 17:17:18.898: I/jPCT-AE(15801): 0 shaders in replacement map!
09-26 17:17:18.898: I/jPCT-AE(15801): Default fragment shader is: /defaultFragmentShader.src
09-26 17:17:18.908: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:18.908: I/jPCT-AE(15801): Text file from InputStream loaded...201 bytes
09-26 17:17:18.908: I/jPCT-AE(15801): Default vertex shader is: /defaultVertexShader.src
09-26 17:17:18.908: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:18.908: I/jPCT-AE(15801): Text file from InputStream loaded...4020 bytes
09-26 17:17:18.908: I/jPCT-AE(15801): Compiling shader program!
09-26 17:17:21.181: I/jPCT-AE(15801): Handles of 9: 2/29/1
09-26 17:17:21.181: I/jPCT-AE(15801): Loading default shaders (Tex1)!
09-26 17:17:21.191: I/jPCT-AE(15801): 0 shaders in replacement map!
09-26 17:17:21.191: I/jPCT-AE(15801): Default fragment shader is: /defaultFragmentShader.src
09-26 17:17:21.191: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:21.191: I/jPCT-AE(15801): Text file from InputStream loaded...997 bytes
09-26 17:17:21.191: I/jPCT-AE(15801): Default vertex shader is: /defaultVertexShader.src
09-26 17:17:21.191: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:21.191: I/jPCT-AE(15801): Text file from InputStream loaded...4390 bytes
09-26 17:17:21.191: I/jPCT-AE(15801): Compiling shader program!
09-26 17:17:23.313: I/jPCT-AE(15801): Handles of 12: 2/34/1
09-26 17:17:23.313: I/jPCT-AE(15801): Loading default shaders (Tex0Light0)!
09-26 17:17:23.313: I/jPCT-AE(15801): 0 shaders in replacement map!
09-26 17:17:23.313: I/jPCT-AE(15801): Default fragment shader is: /defaultFragmentShader.src
09-26 17:17:23.313: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:23.313: I/jPCT-AE(15801): Text file from InputStream loaded...201 bytes
09-26 17:17:23.313: I/jPCT-AE(15801): Default vertex shader is: /defaultVertexShader.src
09-26 17:17:23.313: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:23.313: I/jPCT-AE(15801): Text file from InputStream loaded...1293 bytes
09-26 17:17:23.313: I/jPCT-AE(15801): Compiling shader program!
09-26 17:17:23.363: I/jPCT-AE(15801): Handles of 15: 2/7/1
09-26 17:17:23.363: I/jPCT-AE(15801): Loading default shaders (Fog)!
09-26 17:17:23.363: I/jPCT-AE(15801): 0 shaders in replacement map!
09-26 17:17:23.363: I/jPCT-AE(15801): Default fragment shader is: /defaultFragmentShader.src
09-26 17:17:23.363: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:23.363: I/jPCT-AE(15801): Text file from InputStream loaded...328 bytes
09-26 17:17:23.363: I/jPCT-AE(15801): Default vertex shader is: /defaultVertexShader.src
09-26 17:17:23.373: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:23.373: I/jPCT-AE(15801): Text file from InputStream loaded...4267 bytes
09-26 17:17:23.373: I/jPCT-AE(15801): Compiling shader program!
09-26 17:17:25.455: I/jPCT-AE(15801): Handles of 18: 2/32/1
09-26 17:17:25.455: I/jPCT-AE(15801): Loading default shaders (FogLight0)!
09-26 17:17:25.455: I/jPCT-AE(15801): 0 shaders in replacement map!
09-26 17:17:25.455: I/jPCT-AE(15801): Default fragment shader is: /defaultFragmentShader.src
09-26 17:17:25.455: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:25.455: I/jPCT-AE(15801): Text file from InputStream loaded...328 bytes
09-26 17:17:25.455: I/jPCT-AE(15801): Default vertex shader is: /defaultVertexShader.src
09-26 17:17:25.465: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:25.465: I/jPCT-AE(15801): Text file from InputStream loaded...1608 bytes
09-26 17:17:25.465: I/jPCT-AE(15801): Compiling shader program!
09-26 17:17:25.515: I/jPCT-AE(15801): Handles of 21: 2/10/1
09-26 17:17:25.515: I/jPCT-AE(15801): Loading default shaders (Depth)!
09-26 17:17:25.515: I/jPCT-AE(15801): 0 shaders in replacement map!
09-26 17:17:25.515: I/jPCT-AE(15801): Default fragment shader is: /defaultFragmentShader.src
09-26 17:17:25.515: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:25.515: I/jPCT-AE(15801): Text file from InputStream loaded...745 bytes
09-26 17:17:25.515: I/jPCT-AE(15801): Default vertex shader is: /defaultVertexShader.src
09-26 17:17:25.515: I/jPCT-AE(15801): Loading file from InputStream
09-26 17:17:25.515: I/jPCT-AE(15801): Text file from InputStream loaded...248 bytes
09-26 17:17:25.515: I/jPCT-AE(15801): Compiling shader program!
09-26 17:17:25.545: I/jPCT-AE(15801): Handles of 24: 0/0/-1
09-26 17:17:25.545: I/jPCT-AE(15801): GL20 render pipeline initialized!
09-26 17:17:25.555: I/jPCT-AE(15801): OpenGL vendor:     Qualcomm
09-26 17:17:25.555: I/jPCT-AE(15801): OpenGL renderer:   Adreno 200
09-26 17:17:25.555: I/jPCT-AE(15801): OpenGL version:    OpenGL ES 2.0 1044053
09-26 17:17:25.555: I/jPCT-AE(15801): OpenGL renderer initialized (using 2/4 texture stages)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: How to improve the jpct lib load speed?
« Reply #3 on: September 26, 2014, 12:24:56 pm »
Well, in that case, there's not much that you can do about it. The Adreno 200 GPU that your device uses is ancient and so is most likely the whole device. Adreno 200 has been used, for example, in the Nexus One, which is 4.5 years old now. You only have two options: Don't use OpenGL ES 2.0 or, if you are doing your own shaders anyway, set http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Config.html#skipDefaultShaders to true. However, if you do this and don't use your own shaders, performance will most likely suffer (especially on an old chip like the Adreno 200).

Offline gamenewer

  • long
  • ***
  • Posts: 171
    • View Profile
Re: How to improve the jpct lib load speed?
« Reply #4 on: September 26, 2014, 02:19:21 pm »
I used  the HTC droid increadable  , it's  very old!  Thanks you for your help :)

If  load default shader not from zip file ,   maybe save time ?   and how to do this ?
« Last Edit: September 26, 2014, 05:32:59 pm by gamenewer »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: How to improve the jpct lib load speed?
« Reply #5 on: September 26, 2014, 08:31:42 pm »
Nope, that doesn't help. The default shaders have to be compiled at startup and your device is damn slow in doing so. That's a pity, but almost all devices out there should be faster than yours, so it might not be a real issue.

Offline drdla

  • byte
  • *
  • Posts: 16
    • View Profile
Re: How to improve the jpct lib load speed?
« Reply #6 on: May 23, 2017, 11:10:22 am »
Hi, I have similar problem. I have two device with similar HW, on one device loading of 3d model takes for example 30seconds, on second device 10seconds. Is thre any way to speed up loading? I have obj file converted to serializable on PC, so on android device I load selializable format of file. Or where I must call skupDefaultShaders method? Or any other advice for speed up loading (not used less quality model).

Thank you

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: How to improve the jpct lib load speed?
« Reply #7 on: May 23, 2017, 11:16:42 am »
It doesn't get any faster than by using serialized objects. Just make sure that the actual loading really is the culprit and not the initial work before the first render. Some log output might help to clearify this.