-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Cache shaders #588
Comments
Good idea. |
On Android we can save this to the cache dir, or on API 21+ we can use the code cache dir. |
Will have a go at this on Linux tomorrow: https://github.com/mapbox/mapbox-gl-native/tree/cache-shaders |
I have added shader binary saving and loading to Shader It runs on my machine, but unfortunately my GL driver (Intel Haswell) uses Mesa which does not support program binaries yet. It always returns 0 binary length. So can someone with a Linux machine and either an ATI or NVIDIA driver test this branch? @incanus can you check my branch works on iOS and OSX. You will need to load the program binary extensions in your iOS code, same place as vertex array objects are loaded. |
Once this gets merged into master I then need to add the extension loading to android-mason. |
@kkaefer I just remembered that you are supposed to render some stuff before you retrieve the program binary so the compiler actually compiles all variants of the shader that are needed. Is it possible to save the binary to disk during the Shader's destructor? That way we know we have done rendering with it. |
Yeah, we could do the save on destruct method, so it's completely transparent to the application. |
I had a problem when I experimented with save on destruct, is that it hanged on Linux for some reason. Haven't got to the bottom of the hang yet. Plus have the problem that on Android where GL context is deleted before Map gets destroyed, so wouldn't be able to call the GL methods to save the shader. |
OK, just got a NVIDIA GPU, will be able to test Linux now. |
Seems to work fine on my NVIDIA GPU, except for the crash from #659 |
Do we have someone with an ATI GPU with support for GL_ARB_get_program_binary to test? Also can someone implement needed code for iOS and OSX so this can be merged into master? |
I am just going to merge instead of waiting. Can someone hook up OSX and iOS please. |
@incanus did you manage to hook up iOS? |
Moving to cutting-room-floor/mapbox-gl-cocoa#76 |
We decided to remove this due to many issues with it. #778 |
We should use GL_ARB_get_program_binary and GL_OES_get_program_binary if available to cache the compiled shaders so a subsequent launch is a lot faster.
The text was updated successfully, but these errors were encountered: