-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Texture atlas GL error 1285 OUT_OF_MEMORY #404
Comments
cc @Longri |
Which devices? |
Tested on some available devices Samsung I9100 Galaxy S II and Samsung Galaxy Tab 4 7.0 LTE, both with Mali-400 GPU. |
Already check that, the OOM seem to be much less even with BTW forgot to mention that the issue appears mostly in dense areas around zoom 15 where symbols start appearing. |
I'm trying to reactivate my old S2, which I found deep in my closet. |
@Longri have you tested again texture atlas? |
I'm sorry, I totally forgot. I wrote a library that queries the maximum size of an OpenGLxture and then, based on this size, creates an atlas. The positions in the atlas are calculated using Native. I wanted to test this library thoroughly before creating a PR. And then I just forgot. The library I wrote is based on LibGdx. I will rewrite them now and remove all LibGdx dependencies to create a PR. The advantage of this library is that the maximum size is used. And the pack algorithm is very effective here and comes from : https://github.com/TeamHypersomnia/rectpack2D |
Indeed that seems the safest approach! |
Who compiled the native sources last time? I tried to repair the JNI module and made the necessary changes in the JinGen.
So it's missing:
For Mips I will try to install the Mips-NDK. But are Linux32 and Win32 really necessary? I would also leave out Mac32. |
I did all native builds in #14 when forked VTM. (If there is need I'll do that again)
Since there are users still using 32bit OS, we need to provide support for all. But first must understand:
Why and what needs to be changed? |
The'build-ios.xml.template' contains an incorrect path to the iOS SDK!
I don't think anyone else uses 32Bit, but I will do my best to compile the missing platforms as well. |
I didn't build iOS - you maintain it. |
Hmm and with each needed update of the library we'd need to rebuild the binary natives? |
Why do we have to update? |
Which compiler did you use, on Linux? |
That was some years ago on another machine, need to remember or rebuild.. 🙂 |
On some Android devices there was the OOM issue. |
Ok, mips/mips64 and armeabi are done, they are no longer supported by the NDK.
|
Did you test the changes with regular architecture so see first if fixes the issue? |
Not quite so fast, please. Now I have a point where the old native sources are compiled. Now it's time for the new changes. I want to pack the whole thing neatly into a PR that doesn't contain hundreds of commits. So that you can understand the changes! |
What I mean (and save your time!) is start with 1 simplest Android architecture, e.g. |
That's right, but I also wanted an easy way to compile the natives. Maybe I'll do my own PR. We could also introduce a native version number, which is checked when loading. This ensures that the correct Native version is loaded. |
The natives are not provided or used separately to need custom version. They're tied to the whole library and are provided conveniently as regular versioned jars, following library publish schedule. |
Hi Emux, is there a function runOnMainThread()? |
|
Yes, i have seen. |
Can ask that in EDIT: this is for being able to quickly test it, then we can improve the implementation. |
I think that would be best! I'm trying to find a good solution. So be patient a little longer. |
Okay, I've found a solution. But I still have an OOM, which will always be possible. If a theme has a lot of images/icons, these are completely loaded into memory to create the atlas. |
What's the implementation to discuss? Because many things were mentioned above. Are there eventually any new native libs involved or we better continue with regular Java for texture atlas (by far the best solution) ?
Why exactly need all that?
So improve |
The native code I introduced calculates only the rectangles of the items in the atlas. Everything else happens in Java.
The CreateLayers() method is currently called in onCreate. The Theme will loaded at this time and on this point is the GL_SerfaceView not created. I have changed the MapActivity to:
All Activities derived from MapActivity can then overwrite createLayers() and load the Theme at the right time. |
Why would need native code for that? How it works right now in Java?
I introduced the |
BTW such change should only be applied to the specific Sample which demonstrates the texture atlas, that is |
Ok, then I will take these changes back and put them only on AtlasThemeActivity. Now the question remains whether we should log a WARNING if a user tries to use the atlas before the GL_SurfaceView was created and fall back to a minimal value (e.g. 512) or throwing a RuntimeException.
Because the calculation is time consuming. Similar to the tessellate calculation, which is also used Native. The C-library, which I found, also has the advantage to do the calculations in such a way, that an atlas really only has the size it needs. All other packers based on Java specify a size and use it. For the C-library, only the maximum size is specified. |
Need to see first if it can fix this issue, then can discuss further the implementation. |
PR #542 will fix this |
Testing texture atlas on Android via AtlasThemeActivity at some devices we have out of memory errors, making the map unusable:
The text was updated successfully, but these errors were encountered: