-
Notifications
You must be signed in to change notification settings - Fork 93
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
svg loading segfaults on nexus 5x #234
Comments
What I discovered, is that in this line: https://github.com/kivy/kivent/blob/master/modules/core/kivent_core/rendering/batching.pyx#L215 - indices.data_size is ~182000 on Nexus, while 96 on other phones and on linux. I have no idea where such strange indices.data_size comes from |
Ok a little bit of data dump to help solve this, not certain on the exact cause yet The maximum number of indices that can be uploaded in ES2 is 65,535. The size of a batch should be set so that it is not greater than 65535 * the size of the vertex format. This is the most important number to set when it comes to rendering, otherwsie batching could try to make a too large of batch. This issue also reminds me of: kivy/kivy#3693 |
oh man, I have no idea how to access to indices memory ;) But I noticed that on linux I have also indices.data_size=1828864 , but ony first time, and apparently it doesn't make any problem for OpenGL, next calls have data_size=96 |
I wonder if we have something that is not initialized properly on the first call. |
I think so, set_index_count_for_frame is called with index_count=48 , BUT draw_frame is called BEFORE set_index_count_for_frame..... |
ooo that is not supposed to happen! Will need to make sure things happen in the right order. |
At first I thought that that first draw_frame tries to draw junk before something is initialized. So I make draw_frame just skip until set_index_count_for_frame is called. And still segfaults. I would try to dump memory in vertices and indices, but ... I have no idea how should I do it. Any hint? Or better - code to copy&paste? :) |
ok, I know how to dump, and I will dump soon. And I know now, that it's not matter of not initialized batch, and it's NOT matter of SVG. I tried example with polydraw (no svg involved) and result is the same. I will post memdump soon I hope. |
So, It dumped buffer bound by indices.bind() and vertices.bind() - log is in https://transfer.sh/ryjYP/TestObject_Log_LG_Nexus_5X_real_06-06-2017_10-34-31.txt Log is about creating simple triangle on the screen - it generates creating buffer with 262 thousands of zeroes. |
it's definitively not matter of not initialized data_size of index_vbo. When I set it to 0 at the start, first call to glDrawElements passes and next fails. While that next looks legit:
I'm not an expert of float representation of vertices, but I don't see anything wrong with data in logs. |
and one thought - maybe there is something wrong with shader? |
I don't think the issue is with the way the vertex data is formatted. The traceback seems to point to possibly a bug in the gl implementation. I'm seeing a lot of similar issues on SO with the adreno drivers. There is probably a work around we can do if we can discover what it is. One thing that might help, if you set debug = True before compiling you should get debug logs for all our GL calls which might help us track down an error. |
I didn't find any effect of setting gameworld.debug to True |
I also get blank screen when I set KIVY_GL_DEBUG=1 in linux I think my queue of ideas drained out. I read somewhere that OpenGL ES is ansynchronous. Is it possible that glDrawElements is executed before glSetBuffer takes effect? Or sth like that? |
You get no additional logs when you set gameworld.debug to True and recompile? |
I don't see anything more than I added. Below is the log, and code which is run (kivent both with app) is in https://github.com/mahomahomaho/kivent/tree/testcase-segfault-logging (app is examples/12-....)
|
I have idea that I could write testcase of bug in adreno drivers in pure opengl. To be able to report to them or (more likely) search for workaround. Could someone show me simple example of android app (python for android or just java android) like "draw triangle in opengl"? |
also it segfaults on some quite new Xiaomi.
adb log:
Full log in https://pastebin.com/A0kt1pq2
Code which segfaults: https://github.com/mahomahomaho/kivent-segfault-issue (it's a bit modified example no 11). I have commented out
because they caused memory error before app started on that android. And decreased isze of gameworld and indexes. Maybe it's the reason? What should be proper values?
Anyway - it doesn't crash on all androids, only on Nexus 5x, some Xiaomi (I don't know exact data) so far.
Steps to reproduce:
The text was updated successfully, but these errors were encountered: