multi threading functionality ?

This topic contains 6 replies, has 4 voices, and was last updated by  Arron 5 years, 6 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #30881

    mkandula
    Member

    Hi,

    Usually on phones the load times can be a kill.
    The best solution is to split the running and rendering thread.
    Does PVR has any lib for creating threads ? What problems and tips to following when seperating out the rendering thread ?
    Also, please excuse me but is there a way (pseudo code is appreciated) to specify the loading thread to run for a set time and then yield back to continue later ?
    Thanks,
    Madan
    #35861

    Joe Davis
    Member

    Hi Madan,

    Unfortunately, we don’t provide a library for threading.

    If you want to add threading to your applications, it’s best for performance to have a single thread for your rendering that calls all of your GL functions, including functions for loading textures, shaders etc.

    Thanks,
    Joe

    #35862

    mkandula
    Member

    Thanks for the reply Joe !!

    For a fact, would you know if pthread would work the same for iOS and android devices ? 
    My intention is to make a responsive UI and am exploring alternatives.
    #35863

    BobGardner
    Member

    Hi Madan,

    It should be noted that this is from personal experience, but yes, pthreads are supported on iOS and Android.  The bank end implementation may differ, but the specification is quite clear on how pthread functionality should work, so it should work the same on both.
    You may want to double check a few things however, to my understanding, neither OS is entirely POSIX compliant, and thus its not guaranteed that all of the pthread functionality exists.  For example, Bionic, the name for Android native C library support, does not include pthread_rwlock.
    So yes, you can use pthread, but I would double check on the specifics of what is and isn’t available on the relevant OSs website.
    On iOS, have you looked at Grand Central Dispatch?
    Thanks,
    Bob
    #35864

    Joe Davis
    Member

    I’m not sure if threading behaves the same way on the two OSs. It would be best to refer to the iOS and Android documentation for this information.

    Unless your rendering thread is being blocked by other CPU work (e.g. handling network connections) or CPU workload is the bottleneck, then using multiple threads is unlikely to improve the responsiveness of your UI. Have you tried running PVRTune on your target Android device/s?

    #35865

    BobGardner
    Member

    …and yes, Joe is entirely correct.  Threading does not automatically mean a performance boost, sometimes the overhead of all the locking and unlocking etc, never mind the debugging time. can cost more than you gain, so before you do that, try running Tune on your device to see if you need it at all.  

    #35866

    Arron
    Member

    You should also be aware that GL contexts are entirely thread-specific. You can use functionality such as share groups to share GL objects across threads, however. This is quite API specific: on iOS EAGLContext contains functionality for retrieving and setting share group properties and on Android I believe the various EGL functions such as eglCreateContext are used to do the same.

Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic.