Author Topic: Strange Fatal Error  (Read 1762 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Strange Fatal Error
« Reply #15 on: October 11, 2016, 12:23:29 am »
Really strange. Maybe I was just lucky. I started the test case maybe 25 times in total and never got the error. One more thing to try: After setting up all of your objects and before rendering the first frame, call World.compileAllObjects() and see if that changes anything.

Offline AeroShark333

  • long
  • ***
  • Posts: 149
    • View Profile
Re: Strange Fatal Error
« Reply #16 on: October 11, 2016, 12:43:47 am »
'Force' closing and then retrying it seems to help as well for me to reproduce this error after launching it again. (in the newer Android versions this is usually quite easier to do by opening recently used apps list and then swiping the app away)

I'm already calling World.compileAllObjects() before rendering the first frame... well partially, if you meant rendering the first frame of the world because I already do blit a loading screen before that. (I think it's the same in the testcase)
Basically how I do this:
-> Load objects and much info in the Renderer's constructor
-> Initialize framebuffer in onSurfaceChanged
-> Before leaving the onSurfaceChanged method, I start a new Thread to load textures
-> The app will already start onDrawFrame methods (it will just use the framebuffer to blit a loading screen here), but due to checking if the above mentioned Thread.isAlive() it won't start rendering the world and drawing the world.
-> When textures are loaded, the objects are first added to the world (in the Thread).
-> Then I call World.buildAllObjects() (in the Thread).
-> Then I call World.compileAllObjects() (still in the Thread), and the Thread dies after this.
-> So basically the onDrawFrame can now continue with the World rendering and drawing, but it just crashes instead (or crashes after a while).

I also tried to NOT make the thing Thread'ed. So it would just basically do the things that would now happen in the Thread in onSurfaceChanged, but it doesn't give a difference except that the onDrawFrame is now being blocked... And it will still crash.

_________________________
EDIT:
I tried Object3D.shareCompiledData(obj) in the hope it would fix something using (this will happen before World.buildAllObjects() is called in the Thread but this will happen in the Thread):
Code: [Select]
//final Enumeration<Object3D> objs = world.getObjects();
//while (objs.hasMoreElements()) {
// final Object3D beep = objs.nextElement();
// if (beep != earth) {
// beep.shareCompiledData(earth);
// }
//}
Buuut nope...
I just reverted that (commented it out) because the scaling seems messed up when I use that and it didn't fix anything anyway...
(scaling is probably my fault... but it didn't fix anything... so yeah, just reverted it)

Logs nonetheless:
Code: [Select]
10-11 01:20:36.491: I/jPCT-AE(28612): Loading Texture...
10-11 01:20:36.491: I/jPCT-AE(28612): Texture loaded...524288 bytes/512*256 pixels!
10-11 01:20:37.314: I/jPCT-AE(28612): Loading Texture...
10-11 01:20:37.315: I/jPCT-AE(28612): Texture loaded...524288 bytes/512*256 pixels!
10-11 01:20:37.397: I/jPCT-AE(28612): Loading Texture...
10-11 01:20:37.398: I/jPCT-AE(28612): Texture loaded...32768 bytes/128*64 pixels!
10-11 01:20:37.503: I/jPCT-AE(28612): Loading Texture...
10-11 01:20:37.504: I/jPCT-AE(28612): Texture loaded...32768 bytes/128*64 pixels!
10-11 01:20:37.556: I/jPCT-AE(28612): Tangent vectors calculated in 33ms!
10-11 01:20:37.574: I/jPCT-AE(28612): Compiling object object5/com.threed.jpct.Object3D@69b02d9!
10-11 01:20:37.575: I/jPCT-AE(28612): Compiling source object...
10-11 01:20:37.696: I/jPCT-AE(28612): Subobject of object 2/object0 compiled to indexed fixed point data using 23997/4186 vertices in 112ms!
10-11 01:20:37.711: I/jPCT-AE(28612): Subobject of object 2/object0 compiled to indexed fixed point data using 3075/662 vertices in 14ms!
10-11 01:20:37.712: I/jPCT-AE(28612): Object 2/object0 compiled to 2 subobjects in 137ms!
10-11 01:20:37.712: I/jPCT-AE(28612): Object 3/object5 precompiled!
10-11 01:20:37.712: I/jPCT-AE(28612): Compiling object object9/com.threed.jpct.Object3D@a58a09b!
10-11 01:20:37.712: I/jPCT-AE(28612): Object 7/object9 precompiled!
10-11 01:20:37.712: I/jPCT-AE(28612): Compiling object object0/com.threed.jpct.Object3D@b8dcc38!
10-11 01:20:37.712: I/jPCT-AE(28612): Compiling object object8/com.threed.jpct.Object3D@ae93411!
10-11 01:20:37.712: I/jPCT-AE(28612): Object 6/object8 precompiled!
10-11 01:20:37.712: I/jPCT-AE(28612): Compiling object object6/com.threed.jpct.Object3D@94e8976!
10-11 01:20:37.712: I/jPCT-AE(28612): Object 4/object6 precompiled!
10-11 01:20:37.712: I/jPCT-AE(28612): Compiling object object7/com.threed.jpct.Object3D@b96ab77!
10-11 01:20:37.712: I/jPCT-AE(28612): Object 5/object7 precompiled!
10-11 01:20:37.739: W/jPCT-AE(28612): [ 1476141637739 ] - WARNING: Texture's size is 1024/512, but textures should be square for OpenGL ES2.0! This may result in a black texture!
10-11 01:20:37.882: I/jPCT-AE(28612): Compiling shader program!
10-11 01:20:37.883: I/jPCT-AE(28612): Handles of 9: 1/0/-1
10-11 01:20:37.884: I/jPCT-AE(28612): Creating buffers...
10-11 01:20:37.886: I/jPCT-AE(28612): VBO created for object 'object0'
10-11 01:20:37.887: I/jPCT-AE(28612): Object 'object5' shares VBOs (2/1) with object 'object0'
10-11 01:20:37.887: I/jPCT-AE(28612): Creating buffers...
10-11 01:20:37.887: I/jPCT-AE(28612): VBO created for object 'object0'
10-11 01:20:37.887: I/jPCT-AE(28612): Object 'object5' shares VBOs (7/6) with object 'object0'
10-11 01:20:37.888: I/jPCT-AE(28612): Object 'object5' shares compiled data with object 'object0'
10-11 01:20:37.888: W/jPCT-AE(28612): [ 1476141637888 ] - WARNING: Texture's size is 512/256, but textures should be square for OpenGL ES2.0! This may result in a black texture!
10-11 01:20:37.917: I/jPCT-AE(28612): Compiling shader program!
10-11 01:20:37.919: I/jPCT-AE(28612): Handles of 12: 5/1/4
10-11 01:20:37.921: W/jPCT-AE(28612): [ 1476141637921 ] - WARNING: Texture's size is 512/256, but textures should be square for OpenGL ES2.0! This may result in a black texture!
10-11 01:20:37.950: I/jPCT-AE(28612): Compiling shader program!
10-11 01:20:37.952: I/jPCT-AE(28612): Handles of 15: 4/1/5
10-11 01:20:37.953: I/jPCT-AE(28612): Object 'object8' shares VBOs (2/1) with object 'object0'
10-11 01:20:37.953: I/jPCT-AE(28612): Object 'object8' shares VBOs (7/6) with object 'object0'
10-11 01:20:37.953: I/jPCT-AE(28612): Object 'object8' shares compiled data with object 'object0'
10-11 01:20:38.030: W/google-breakpad(28612): ### ### ### ### ### ### ### ### ### ### ### ### ###
10-11 01:20:38.030: W/google-breakpad(28612): Chrome build fingerprint:
10-11 01:20:38.030: W/google-breakpad(28612): 3.8
10-11 01:20:38.030: W/google-breakpad(28612): 16
10-11 01:20:38.030: W/google-breakpad(28612): ### ### ### ### ### ### ### ### ### ### ### ### ###
10-11 01:20:38.030: A/libc(28612): Fatal signal 11 (SIGSEGV), code 2, fault addr 0x7498a000 in tid 28721 (GLThread 17228)
10-11 01:20:39.797: W/System(28734): ClassLoader referenced unknown path: /data/app/com.aeroshark333.earthify3d-2/lib/arm64
10-11 01:20:39.831: D/SensorManager(28734): com.aeroshark333.earthify3d --- call SystemSensorManager
10-11 01:20:39.832: W/SensorManager(28734): xym---android_hardware_SensorManager.cpp  nativeClassInit
« Last Edit: October 11, 2016, 01:28:13 am by AeroShark333 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Strange Fatal Error
« Reply #17 on: October 11, 2016, 08:07:53 am »
Your test APK seems to work fine for me on a Nexus 5X. I've never set it as a wallpaper though and just used the test-button in the GUI, but I guess that should be fine!? I opened it maybe 2 dozen times, I always swiped it into oblivion before doing so, I rotated the device while it was rendering, I swiped around on the screen and didn't crash once.

I also looked into the reported crashs of my game in Google Play and I got one report similar to yours, also with an Adreno GPU and on Android 4.4. Not sure, what this should tell us though.

Do you have something fancy running in the background on your device like some GL debugging hook app or some magic memory cleaner or virus scanner or anything like that?

Offline AeroShark333

  • long
  • ***
  • Posts: 149
    • View Profile
Re: Strange Fatal Error
« Reply #18 on: October 11, 2016, 03:38:11 pm »
Hmmm... Did you try to set the "Model Geometry Quality" to "High"? (for me this settings seems to make the crash more likely to happen)

I looked into the crashreports of my other app (the Skin Viewer 3D app) and it got reports of fatal signals as well... However, never this code=2 one.

Do I have something running in the background?
GL debugging hook app: Nope. (I did enable to log GL traces in Developers Options for the logs, but it's off now)
Some magic memory cleaner: Nope. My stock OS will tell me when some background app/process is using a lot of battery... but it won't close the app, just notify only.
Virus scanner: Nope.

________

In meanwhile, I've been trying to scrap things from the testcaserenderer to see where the crash does appear and where it does not.
And I got something that might be interesting to you.

This is part of the code I used in the first test in onDrawFrame:
Code: [Select]
// 2D background
//if (settings.background_3D_enabled) {
// BG must have been loaded by now
// Blit background texture
final Texture bg = textureManager.getTexture("bg");
frameBuffer.blit(bg, 0, 0, 0, 0, bg.getWidth(),
bg.getHeight(), frameBuffer.getWidth(),
frameBuffer.getHeight(), -1, false);
//}

// World renderer
world.renderScene(frameBuffer);
world.draw(frameBuffer);

// Framebuffer updater
frameBuffer.display();
Runs: 10 times
Crashes: 9 times

Now test 2 with the following code:
Code: [Select]
// 2D background
//if (settings.background_3D_enabled) {
// BG must have been loaded by now
// Blit background texture
final Texture bg = textureManager.getTexture("bg");
//frameBuffer.blit(bg, 0,
bg.getHeight();
//, 0, 0,
bg.getWidth();
//,
bg.getHeight();//,
frameBuffer.getWidth();
//,
frameBuffer.getHeight();
//, -1, false);
//}

// World renderer
world.renderScene(frameBuffer);
world.draw(frameBuffer);

// Framebuffer updater
frameBuffer.display();
Runs: 10 times
Crashes: 0 times

Is there something wrong with blitting? Because this does make me think there is something wrong...

And while Google'ing around, I found this: http://stackoverflow.com/questions/10183861/android-why-im-getting-fatal-signal
Could this be any interesting to you?

________________

I guess blitting might not be the issue after all... but it seems to affect World.draw I think:
Code: [Select]
System.out.println("ERROR_1");

// 2D background
// if (settings.background_3D_enabled) {
// BG must have been loaded by now
// Blit background texture
final Texture bg = textureManager.getTexture("bg");
frameBuffer.blit(bg, 0, 0, 0, 0, bg.getWidth(), bg.getHeight(),
frameBuffer.getWidth(), frameBuffer.getHeight(), -1, false);
// }

System.out.println("ERROR_2");

// World renderer
world.renderScene(frameBuffer);

System.out.println("ERROR_3");

world.draw(frameBuffer);

System.out.println("ERROR_4");
// Framebuffer updater
frameBuffer.display();

System.out.println("ERROR_5");

Log:
Code: [Select]
10-11 16:42:55.681: I/System.out(16822): ERROR_1
10-11 16:42:55.683: W/jPCT-AE(16822): [ 1476196975683 ] - WARNING: Texture's size is 512/256, but textures should be square for OpenGL ES2.0! This may result in a black texture!
10-11 16:42:55.747: I/System.out(16822): ERROR_2
10-11 16:42:55.752: I/System.out(16822): ERROR_3
10-11 16:42:55.752: I/jPCT-AE(16822): Compiling shader program!
10-11 16:42:55.787: I/jPCT-AE(16822): Handles of 9: 4/1/5
10-11 16:42:55.788: I/jPCT-AE(16822): Creating buffers...
10-11 16:42:55.788: I/jPCT-AE(16822): VBO created for object 'object0'
10-11 16:42:55.853: W/google-breakpad(16822): ### ### ### ### ### ### ### ### ### ### ### ### ###
10-11 16:42:55.853: W/google-breakpad(16822): Chrome build fingerprint:
10-11 16:42:55.854: W/google-breakpad(16822): 3.8
10-11 16:42:55.854: W/google-breakpad(16822): 16
10-11 16:42:55.854: W/google-breakpad(16822): ### ### ### ### ### ### ### ### ### ### ### ### ###
10-11 16:42:55.856: A/libc(16822): Fatal signal 11 (SIGSEGV), code 2, fault addr 0x74981000 in tid 16921 (GLThread 21625)
As you can see, the app stops at World.draw and doesn't print 'ERROR_4'
« Last Edit: October 11, 2016, 04:45:30 pm by AeroShark333 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Strange Fatal Error
« Reply #19 on: October 11, 2016, 07:25:19 pm »
Blitting affects the memory layout in the GPU's memory, as does every change like using another texture or another model size (no "luck" in reproducing the crash with high detail models either BTW), so I guess every hint into the "this might cause it"-direction so far might be a red herring. The thread doesn't apply. You can be 100% sure that all these buffer sizes in the engine are correct. I've already checked them multiple times in the past because of other problems and it always turned out that they are fine and not the cause of any problems. I even modified them on purpose to see how the engine behaves and it behaved exactly as one would expect: Either crash (if 1 too large) or fail to render stuff (if 1 too short).
In addition, if this happens, it seems to happen on Adreno only. Granted, Adreno is the most popular GPU for Android devices (because it's part of Snapdragon), but if it would affect others, there should be at least some reports of that coming in...but there are none.

Anyway...looking at the stacktrace from the last thread (from your old device), it looks like as if it *might* be related to blitting though, because the native calls include cache_vertex_arrays, which actually makes no sense for geometry rendered from VBOs (or at least that's what I'm guessing, but who am I to know how a driver programmer thinks...).

Can you still confirm that it goes away when not blitting anything at all (that includes lens flares)?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Strange Fatal Error
« Reply #20 on: October 11, 2016, 08:40:39 pm »
Here's a version that adds some options to modify the blitting process to see if that changes something: http://jpct.de/download/beta/jpct_ae.jar

To enable them, set Config.blittingMode=xxx right at the beginning of your app.

xxx can be 1, 2, 4, 8 or combinations of them. Some make sense, some don't. Reasonable values are:

1, 2, 5, 6 and 8. (1, 2, 5 and 6 can be combined with 8 as well, but I doubt that this will change anything if nothing else has).

Please test this version and let me know the results.

Offline AeroShark333

  • long
  • ***
  • Posts: 149
    • View Profile
Re: Strange Fatal Error
« Reply #21 on: October 11, 2016, 09:42:11 pm »
"Can you still confirm that it goes away when not blitting anything at all (that includes lens flares)?"
For the TestCaseRenderer I tried to launch the renderer 25 times with all blitting commented (the testcaserenderer didn't have a lens flare): 0 crashes.

For the LiveWallpaperRenderer (which I use in my app) I tried commenting out blitting and lensflare calls: still crashes.
The only thing that seems to make crashes muuuch less common in the LiveWallpaperRenderer is to disable clouds and moon (I don't know why particularly these Object3D's...) or using Low/Ultra/Extreme polygon model seems to make crashes less likely to happen.

I actually doubt blitting is the real cause because the problem persists on the LiveWallpaperRenderer with all blitting disabled...

I tried to use the Config.blittingMode for 1, 2, 5, 6 and 8 in the TestCaseRenderer. Nothing helped, they all crashed...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Strange Fatal Error
« Reply #22 on: October 11, 2016, 09:58:08 pm »
Would have been too easy, I guess...can you please post the log output before the crash with these settings:

Code: [Select]
Logger.setLogLevel(Logger.LL_DEBUG);
Config.glDebugLevel=1;


Offline AeroShark333

  • long
  • ***
  • Posts: 149
    • View Profile
Re: Strange Fatal Error
« Reply #23 on: October 11, 2016, 10:48:38 pm »
Uhhh... probably not the crashlog you're looking for... App crashed pretty much immediately this time
Code: [Select]
10-11 22:16:52.804: E/jPCT-AE(9459): [ 1476217012804 ] - ERROR: java.lang.NullPointerException: Attempt to get length of null array
10-11 22:16:52.804: E/jPCT-AE(9459): at com.threed.jpct.GLDebug.invoke(GLDebug.java:35)
10-11 22:16:52.804: E/jPCT-AE(9459): at java.lang.reflect.Proxy.invoke(Proxy.java:393)
10-11 22:16:52.804: E/jPCT-AE(9459): at com.threed.jpct.$Proxy1.glFinish(Unknown Source)
10-11 22:16:52.804: E/jPCT-AE(9459): at com.threed.jpct.GLRenderer.init(GLRenderer.java:428)
10-11 22:16:52.804: E/jPCT-AE(9459): at com.threed.jpct.GLRenderer.init(GLRenderer.java:389)
10-11 22:16:52.804: E/jPCT-AE(9459): at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:97)
10-11 22:16:52.804: E/jPCT-AE(9459): at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:122)
10-11 22:16:52.804: E/jPCT-AE(9459): at com.aeroshark333.earthify3d.lw.TestCaseRenderer.onSurfaceChanged(TestCaseRenderer.java:384)
10-11 22:16:52.804: E/jPCT-AE(9459): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
10-11 22:16:52.804: E/jPCT-AE(9459): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
10-11 22:16:52.819: E/AndroidRuntime(9459): FATAL EXCEPTION: GLThread 23593
10-11 22:16:52.819: E/AndroidRuntime(9459): Process: com.aeroshark333.earthify3d, PID: 9459
10-11 22:16:52.819: E/AndroidRuntime(9459): java.lang.RuntimeException: [ 1476217012804 ] - ERROR: java.lang.NullPointerException: Attempt to get length of null array
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.threed.jpct.GLDebug.invoke(GLDebug.java:35)
10-11 22:16:52.819: E/AndroidRuntime(9459): at java.lang.reflect.Proxy.invoke(Proxy.java:393)
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.threed.jpct.$Proxy1.glFinish(Unknown Source)
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.threed.jpct.GLRenderer.init(GLRenderer.java:428)
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.threed.jpct.GLRenderer.init(GLRenderer.java:389)
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:97)
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:122)
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.aeroshark333.earthify3d.lw.TestCaseRenderer.onSurfaceChanged(TestCaseRenderer.java:384)
10-11 22:16:52.819: E/AndroidRuntime(9459): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
10-11 22:16:52.819: E/AndroidRuntime(9459): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.threed.jpct.Logger.log(Logger.java:206)
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.threed.jpct.Logger.log(Logger.java:150)
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:99)
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.threed.jpct.FrameBuffer.<init>(FrameBuffer.java:122)
10-11 22:16:52.819: E/AndroidRuntime(9459): at com.aeroshark333.earthify3d.lw.TestCaseRenderer.onSurfaceChanged(TestCaseRenderer.java:384)
10-11 22:16:52.819: E/AndroidRuntime(9459): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
10-11 22:16:52.819: E/AndroidRuntime(9459): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

But I don't know why but for some reason Config.blittingMode = 8 seems to work for both the TestRenderer and the LiveWallpaperRenderer now though... o.O
I don't really understand why it didn't earlier... Or maybe I didn't push the app to the device properly...
Though Config.blittingMode = 6 did crash on the TestRenderer once... but crashes seem less likely when the value is higher

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Strange Fatal Error
« Reply #24 on: October 11, 2016, 11:09:42 pm »
I really don't know why the GLDebug crashes here...or, I actually do know. But I don't see how it has ever been able to work (which it did), given that the class hasn't changed in the last few years. Very puzzling.

Anyway, I've uploaded a new beta version that should fix that.

About the blitting...could be another red herring, because 8 (unlike all the smaller values) will again tinker with the memory layout in the GPU's memory. Maybe that helps more or less by accident. All the values below 8 are adding addition flushing and syncing into the blitting pipeline. I somehow hoped that this would help, because the desktop version contains a similar fix for older Radeon based GPUs...and as we all know (or maybe not...) Adreno is an anagram of Radeon, because they once belonged both to ATI. But obviously, it doesn't really fix it.

Sooo...if it keeps working with 8, then so be it. If it starts failing again (which I actually expect it to), the log output of the, now hopefully working, debugger will still be helpful.

Offline AeroShark333

  • long
  • ***
  • Posts: 149
    • View Profile
Re: Strange Fatal Error
« Reply #25 on: October 12, 2016, 02:00:12 am »
So I tried to get some crashes on different settings of Config.blittingMode with the LiveWallpaperRenderer.

Setting: Untouched.
Result: Crashes without being able to see the world.
Crashlog: http://pastebin.com/NsDhHhsK
Notice: On line #2766 just before the crash, capacity > limit? Is that supposed to happen?

Setting: Config.blittingMode=1
Result: Crashes without being able to see the world.
Crashlog: http://pastebin.com/7KaLwuPr

Setting: Config.blittingMode=2
Result: Crashes without being able to see the world.
Crashlog: http://pastebin.com/qV08hctZ

Setting: Config.blittingMode=3
Result: Crashes without being able to see the world.
Crashlog: http://pastebin.com/7u1vCkWr

Setting: Config.blittingMode=4
Result: Crashes without being able to see the world.
Crashlog: http://pastebin.com/VUc3BA57

Settings: Config.blittingMode=5
Result: Crashes most of the time without being able to see the world.
When it does load, everything seems fine.
But watching in the direction of the sun/lensflare seems a bit laggy for some reason.
Crashlog: http://pastebin.com/a14ceSVb

Settings: Config.blittingMode=6
Result: Crashes without being able to see the world.
Crashlog: http://pastebin.com/NTPd3Fr1

Settings: Config.blittingMode=7
Result: Crashes most of the time without being able to see the world.
When it does load, everything seems fine.
But watching in the direction of the sun/lensflare seems extremely laggy.
When the sun is hidden behind the Earth (so the lens flare is hidden), the lag is gone.
When not watching in the direction of the sun/lens flare, the lag is gone as well.
So basically, the extreme lag is only there when the lens flare is being blitted.
Crashlog: http://pastebin.com/QfZtQpdS

Settings: Config.blittingMode=8
Result: No crash, no lag.
Crashlog: None (couldn't get the live wallpaper to crash, I tried loads of different combinations)
Log: http://pastebin.com/zd1LxDTM (works normally here)

I would say my problem is solved when using Config.blittingMode=8 :D
I wonder what your opinion is on this, because you seem sceptical...
Thanks a lot so far!

Three another small things, it seems that a lot of textures are being loaded. (I guess most are 2x2 textures...)
It's probably because my loading screen blits letters onto the framebuffer using 'new Texture(2,2, new RGBColor(col,col,col))' (with col ranging from 0 to 254)
Wouldn't it be possible to just be able to bllt colors instead?
I suppose that would be more lightweight than having to load textures and unload them in the end.
Or is this nothing to worry about?

I also wonder if Object3D.shareCompiledData(obj); would be wise to use for me... since basically all objects use the same Mesh and have the same model.
Main differences between some of the objects are: transparency, inverted culling and texture.

And the last thing I wondered about is that jPCT supports and uses 32-bit colored textures by default. But isn't it true that most devices these days only have a screen that is capable of displaying 16-bit colors? So why aren't the textures loaded as 16-bit textures? Wouldn't it be better to save my texture files (compressed) as 16-bit or 24-bit textures to reduce the APK file size? Or should I keep it 32-bit for future devices? I'm a bit puzzled about all of this...
« Last Edit: October 12, 2016, 02:20:04 am by AeroShark333 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Strange Fatal Error
« Reply #26 on: October 12, 2016, 09:58:45 am »
First to your new questions: It would be better to put all the colors into one texture instead of several tiny ones. shareCompiledData() will save some memory and might improve performance slightly, so I suggest to use it if possible.
Todays screens might not be able to display full 24bit colors, but they certainly support more than 16bit. You can do a simple test: Create a texture with some color gradients, load it twice and call enable4bpp(true) on one of them. Then render both and you'll see the difference.

About the crashes: Judging from the log output, it seems to stop when binding the index buffer (but for the second time). This isn't related to blitting. However, the size values of that buffer are all fine. In fact, the buffer is twice as large as it has to be but I fail to see a problem with that (I'll try to fiux that anyway though).

Could you try this: Set the Config.blittingMode back to 0 and build all objects by calling build(false);. That should implicitly disable geometry indices. If that helps, we have at least a clue of what could cause it. If it doesn't help, I would like to see the debug log of the result.

Offline AeroShark333

  • long
  • ***
  • Posts: 149
    • View Profile
Re: Strange Fatal Error
« Reply #27 on: October 12, 2016, 12:38:39 pm »
Ah, okay, I guess I'll make a 16x16 texture with all colors I need then :)

Thanks for answering my questions.

This:
Code: [Select]
Config.blittingMode = 0;

Logger.setLogLevel(Logger.LL_DEBUG);
Config.glDebugLevel=1;
Combined with:
Code: [Select]
final Enumeration<Object3D> objs = world.getObjects();
while (objs.hasMoreElements()) {
objs.nextElement().build(false);
}

//world.buildAllObjects();
world.compileAllObjects();
Gives this log:
http://pastebin.com/AKCeMcHg

EDIT:
And another thing, I've been interested in using a shader for the FrameBuffer... but it only works for blitting apparently...
Is there some way to make the shader work for everything that will be displayed on screen (in 2D)? (so including world renders)
« Last Edit: October 12, 2016, 01:47:37 pm by AeroShark333 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Strange Fatal Error
« Reply #28 on: October 12, 2016, 02:00:32 pm »
Great. Now it crashes on assigning an empty buffer, which makes no sense at all. So it's not the index either. Everything else in the log output looks fine. I'm out of ideas for now. I'll read the log again later today...

About the shaders: Yes, you can do that. It might help to look at Thomas' sources here: http://www.jpct.net/wiki/index.php?title=Open_sourced_projects_from_Thomas

Offline AeroShark333

  • long
  • ***
  • Posts: 149
    • View Profile
Re: Strange Fatal Error
« Reply #29 on: October 14, 2016, 04:07:35 pm »
Got it, thanks a lot for the help :D
I've been using my live wallpaper for a few days now and it hasn't crashed so far :)

There is something I'm wondering though...
So I upload textures, build the world objects and compile the world objects in a separate Thread. While doing so, the FrameBuffer will keep blitting a loadingscreen (untill the Thread dies). Then World.renderScene and World.draw will be called... But the first time when that is called, the (last blitted loading) screen seems to hang for a few seconds... As if either World.renderScene or World.draw is doing heavy blocking operations on its first call... Is it possible to move the (heavy) operations that happen in the first World.renderScene/World.draw call in the separate loading Thread I talked about earlier?

EDIT:
Coincidentally just got a user report on the Google Play Store with the following crash report:

_________________________________________________

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Xiaomi/land/land:6.0.1/MMB29M/V7.5.9.0.MALMIDE:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 18979, tid: 18993, name: GLThread 9008  >>> com.aeroshark333.earthify3d <<<
signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x75245000
    x0   00000007fe9ac5f0  x1   0000000075244fd0  x2   0000000000008f38  x3   0000000000000000
    x4   0000000000000000  x5   0000005579243b94  x6   00000007fe9afa60  x7   0000000000000000
    x8   0000000000000000  x9   0000000000000000  x10  0000000000000000  x11  0000000000000000
    x12  0000000000000000  x13  0000000000000000  x14  0000000000000000  x15  0000000000000001
    x16  0000007f9a7915e8  x17  0000007fa82f3c08  x18  000000000000000c  x19  0000000000000000
    x20  000000000000c438  x21  00000055791fa45c  x22  00000055791fa3fc  x23  00000007fe9ac5f0
    x24  0000000000000000  x25  0000000000000000  x26  000000557921ac18  x27  000000557918f040
    x28  0000000000000000  x29  0000007fa3d454f0  x30  0000007f9a278044
    sp   0000007fa3d454f0  pc   0000007fa82f3d68  pstate 0000000020000000

backtrace:
    #00 pc 0000000000019d68  /system/lib64/libc.so (memcpy+352)
    #01 pc 000000000017d040  /system/vendor/lib64/egl/libESXGLESv2_adreno.so (_ZN20EsxVertexArrayObject18UpdateInternalVbosEPK17EsxDrawDescriptorjPK16EsxAttributeDesc+1504)
    #02 pc 0000000000271518  /system/vendor/lib64/egl/libESXGLESv2_adreno.so (_ZN20A5xVertexArrayObject11CalcVfdRegsEPK17EsxDrawDescriptorP10A5xVfdRegsi+152)
    #03 pc 0000000000279190  /system/vendor/lib64/egl/libESXGLESv2_adreno.so (_ZN10A5xContext16ValidateVfdStateEPK17EsxDrawDescriptori+48)
    #04 pc 000000000028b700  /system/vendor/lib64/egl/libESXGLESv2_adreno.so (_ZN10A5xContext13ValidateStateEPK17EsxDrawDescriptor+2528)
    #05 pc 000000000028bbd0  /system/vendor/lib64/egl/libESXGLESv2_adreno.so (_ZN10A5xContext18HwValidateGfxStateEPK17EsxDrawDescriptor+16)
    #06 pc 0000000000114e5c  /system/vendor/lib64/egl/libESXGLESv2_adreno.so (_ZN10EsxContext16ValidateGfxStateEPK17EsxDrawDescriptor+636)
    #07 pc 0000000000107618  /system/vendor/lib64/egl/libESXGLESv2_adreno.so (_ZN10EsxContext21DrawElementsInstancedE11EsxPrimTypej10EsxPixTypePKvji+440)
    #08 pc 00000000000db3c4  /system/vendor/lib64/egl/libESXGLESv2_adreno.so (glDrawElements+68)
    #09 pc 00000000000067b4  /system/vendor/lib64/egl/libGLESv2_adreno.so (glDrawElements+28)
    #10 pc 0000000072ed0088  /data/dalvik-cache/arm64/system@framework@boot.oat (offset 0x2406000)

_______________________________--
Device: Redmi 3S
Android: 6.0
« Last Edit: October 15, 2016, 01:02:33 am by AeroShark333 »