Crash (native)

Started by AeroShark333, July 10, 2017, 07:29:06 PM

Previous topic - Next topic

EgonOlsen

Quote from: AeroShark333 on March 07, 2018, 07:53:49 PM
Though, there's one problem... How can I set textures to my Object3D's after building and compiling them?
If I remember correctly it'd have a delay or something before the textures get visibly applied or something if you do it this way.
...I'm not sure what you mean by that...???

AeroShark333

Oh... Ehm, nevermind maybe it was scaling..? Ah nevermind this.

However, is it safe to apply textures after having having the Object3D's built and compiled?
It seemed to work just fine? Though, not sure about performance...
However, a multi-textured TextureInfo would give an ArrayOutOfBoundsException when I apply the TextureInfo after having built and compiled.

I also wondered if 16k and 32k textures could be enabled, devices these days can handle quite a lot hehe :)

EgonOlsen

Yes, it's save and it's cheap. However, compiling the object fixes the texture stage count for it. That's why you are getting that exception with the TextureInfo. YOu could assign a TextureInfo with the same amount of stage but using some dummy textures, compile, assing the actual textures. That should actually work.

16k and 32k...it's absurd IMHO to use those. A 16k texture with 32bit and no compression but mipmaps would require ~2GB auf GPU memory and almost the same in VM memory. Still not very feasible IMHO.

AeroShark333

Quote from: EgonOlsen on March 09, 2018, 08:18:03 AM
Yes, it's save and it's cheap. However, compiling the object fixes the texture stage count for it. That's why you are getting that exception with the TextureInfo. YOu could assign a TextureInfo with the same amount of stage but using some dummy textures, compile, assing the actual textures. That should actually work.
Alright, thanks for the help! :)

Quote from: EgonOlsen on March 09, 2018, 08:18:03 AM16k and 32k...it's absurd IMHO to use those. A 16k texture with 32bit and no compression but mipmaps would require ~2GB auf GPU memory and almost the same in VM memory. Still not very feasible IMHO.
Hmmm yeah, I understand... Though that would be true for squared textures but for me just one dimension would be okay. I can already kind of use 16384x4096 textures on my phone using NPOTTexture (which I guess is kind of a hack-ish way to surpass the 8192 limit restricted by jPCT. So well yeah...

EgonOlsen

Try this jar: http://jpct.de/download/beta/jpct_ae.jar

It should support textures up to 16384 in size.

AeroShark333

#35
Quote from: EgonOlsen on March 09, 2018, 08:18:03 AM
Yes, it's save and it's cheap. However, compiling the object fixes the texture stage count for it. That's why you are getting that exception with the TextureInfo. YOu could assign a TextureInfo with the same amount of stage but using some dummy textures, compile, assing the actual textures. That should actually work.
So I tried this with two TextureInfo's (one 3-layered with dummy textureID and one 3-layered with the actual textureID's) but I am still getting the Exception.


final int dummyID = textureManager.getTextureID(textureManager.getNameByTexture(textureManager.getDummyTexture()));
final TextureInfo ti = new TextureInfo(dummyID);
ti.add(dummyID, TextureInfo.MODE_ADD);
ti.add(dummyID, TextureInfo.MODE_ADD);

obj.setTexture(ti);
obj.build();
obj.compile();
obj.strip();

world.addObject(obj);
world.renderScene(frameBuffer);
world.draw(frameBuffer);


This is how I first load the Object3D with 3 (not even sure if it actually gives 3...) texturelayers.

But when I apply the real TextureInfo (after loading Textures and getting their ID's) it will crash:
03-18 11:35:18.768: E/AndroidRuntime(4487): java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
03-18 11:35:18.768: E/AndroidRuntime(4487): at com.threed.jpct.Object3D.setTexture(Object3D.java:3660)

When the real TextureInfo only holds one texture(layer) it won't crash... So it doesn't really seem to set 3 layers using the dummy textures or something..?

EDIT:
I moved the obj.strip() line to after applying the real TextureInfo, which seemed to fix it...

EgonOlsen

Interesting...maybe I'm stripping dummy texture layers away...I'm not sure ATM, but if it works now... ;)

AeroShark333

#37
Okay, good and bad news I guess:

Good news:
The SIGSEGV reports seemed to have stopped (on Android 7.1.2 and below at least..).
So the solution to have all vertices/Object3D's loaded to the GPU before any blit/texture data upload seemed to have worked..?

Bad news:
However, I've been getting a new SIGSEGV error now (which only seems to happen on Android 8.0..?):
Crashreport:
On OnePlus 5T and Huawei P20 Lite
backtrace:
  #00  pc 000000000030b868  /system/lib64/libskia.so (_ZN15SkScalerContext10getMetricsEP7SkGlyph+40)
  #01  pc 0000000000283b0c  /system/lib64/libskia.so (_ZN12SkGlyphCache16allocateNewGlyphE15SkPackedGlyphIDNS_11MetricsTypeE+360)
  #02  pc 000000000028396c  /system/lib64/libskia.so (_ZN12SkGlyphCache17getGlyphIDMetricsEt+16)
  #03  pc 0000000000278b20  /system/lib64/libskia.so (_ZN19SkFindAndPlaceGlyph26GlyphFindAndPlaceFullPixelIR12DrawOneGlyphLN7SkPaint5AlignE0ELNS_13SelectKerningE0EE20findAndPositionGlyphEPPKc7SkPointS2_+40)
  #04  pc 0000000000276040  /system/lib64/libskia.so (_ZN19SkFindAndPlaceGlyph14ProcessPosTextIR12DrawOneGlyphEEvN7SkPaint12TextEncodingEPKcm7SkPointRK8SkMatrixPKfiNS3_5AlignEP12SkGlyphCacheOT_+972)
  #05  pc 0000000000275bb8  /system/lib64/libskia.so (_ZNK6SkDraw11drawPosTextEPKcmPKfiRK7SkPointRK7SkPaintPK14SkSurfaceProps+400)
  #06  pc 00000000001f41d4  /system/lib64/libskia.so (_ZN14SkBitmapDevice11drawPosTextEPKvmPKfiRK7SkPointRK7SkPaint+112)
  #07  pc 000000000026ee40  /system/lib64/libskia.so (_ZN12SkBaseDevice12drawTextBlobEPK10SkTextBlobffRK7SkPaintP12SkDrawFilter+432)
  #08  pc 0000000000215068  /system/lib64/libskia.so (_ZN8SkCanvas14onDrawTextBlobEPK10SkTextBlobffRK7SkPaint+500)
  #09  pc 0000000000215a20  /system/lib64/libskia.so (_ZN8SkCanvas12drawTextBlobEPK10SkTextBlobffRK7SkPaint+236)
  #10  pc 00000000002600b4  /system/lib64/libskia.so (_ZN23SkColorSpaceXformCanvas14onDrawTextBlobEPK10SkTextBlobffRK7SkPaint+84)
  #11  pc 0000000000215a20  /system/lib64/libskia.so (_ZN8SkCanvas12drawTextBlobEPK10SkTextBlobffRK7SkPaint+236)
  #12  pc 0000000000095f78  /system/lib64/libhwui.so (_ZN7android10SkiaCanvas10drawGlyphsEPKtPKfiRK7SkPaintfffffff+300)
  #13  pc 0000000000037684  /system/lib64/libhwui.so (_ZN7android15DrawTextFunctorclEmm+368)
  #14  pc 0000000000037194  /system/lib64/libhwui.so (_ZN7android12MinikinUtils10forFontRunINS_15DrawTextFunctorEEEvRKN7minikin6LayoutEPNS_5PaintERT_+276)
  #15  pc 0000000000036f98  /system/lib64/libhwui.so (_ZN7android6Canvas8drawTextEPKtiiiffiRKNS_5PaintEPNS_8TypefaceE+356)
  #16  pc 0000000000130b18  /system/lib64/libandroid_runtime.so (_ZN7android9CanvasJNIL14drawTextStringEP7_JNIEnvP8_jobjectlP8_jstringiiffill+136)
  #17  pc 0000000000b5f6b4  /system/framework/arm64/boot-framework.oat (android.graphics.BaseCanvas.nDrawText [DEDUPED]+244)
  #18  pc 0000000000b62cd8  /system/framework/arm64/boot-framework.oat (android.graphics.BaseCanvas.drawText+216)
  #19  pc 0000000000b74924  /system/framework/arm64/boot-framework.oat (android.graphics.Canvas.drawText+52)
  #20  pc 000000000128b2e8  /system/framework/arm64/boot-framework.oat (android.text.BoringLayout.draw+136)
  #21  pc 0000000001540fb4  /system/framework/arm64/boot-framework.oat (android.widget.TextView.onDraw+3316)
  #22  pc 00000000010f6b90  /system/framework/arm64/boot-framework.oat (android.view.View.draw+256)
  #23  pc 00000000010f8360  /system/framework/arm64/boot-framework.oat (android.view.View.draw+3616)
  #24  pc 00000000013c64d4  /system/framework/arm64/boot-framework.oat (android.view.ViewGroup.drawChild+68)
  #25  pc 00000000013c1248  /system/framework/arm64/boot-framework.oat (android.view.ViewGroup.dispatchDraw+1464)
  #26  pc 00000000010f6ba8  /system/framework/arm64/boot-framework.oat (android.view.View.draw+280)
  #27  pc 0000000000509384  /system/lib64/libart.so (art_quick_invoke_stub+580)
  #28  pc 00000000000d8078  /system/lib64/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+200)
  #29  pc 00000000002821dc  /system/lib64/libart.so (_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS_6ThreadEPNS_9ArtMethodEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+352)
  #30  pc 000000000027c8a4  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+672)
  #31  pc 00000000004f3d30  /system/lib64/libart.so (MterpInvokeVirtualQuick+680)
  #32  pc 00000000004fea94  /system/lib64/libart.so (ExecuteMterpImpl+29972)
  #33  pc 000000000025d620  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444)
  #34  pc 0000000000263d20  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #35  pc 000000000027c884  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640)
  #36  pc 00000000004f1e78  /system/lib64/libart.so (MterpInvokeDirect+504)
  #37  pc 00000000004fae14  /system/lib64/libart.so (ExecuteMterpImpl+14484)
  #38  pc 000000000025d620  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444)
  #39  pc 0000000000263d20  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #40  pc 000000000027c884  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640)
  #41  pc 00000000004f1e78  /system/lib64/libart.so (MterpInvokeDirect+504)
  #42  pc 00000000004fae14  /system/lib64/libart.so (ExecuteMterpImpl+14484)
  #43  pc 000000000025d620  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444)
  #44  pc 0000000000263d20  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #45  pc 000000000027c884  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640)
  #46  pc 00000000004f3d30  /system/lib64/libart.so (MterpInvokeVirtualQuick+680)
  #47  pc 00000000004fea94  /system/lib64/libart.so (ExecuteMterpImpl+29972)
  #48  pc 000000000025d620  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444)
  #49  pc 0000000000263d20  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #50  pc 000000000027d6f4  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb1ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+584)
  #51  pc 00000000004f3754  /system/lib64/libart.so (MterpInvokeDirectRange+424)
  #52  pc 00000000004fb114  /system/lib64/libart.so (ExecuteMterpImpl+15252)
  #53  pc 000000000025d620  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444)
  #54  pc 0000000000263d20  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #55  pc 000000000027c884  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640)
  #56  pc 00000000004f1e78  /system/lib64/libart.so (MterpInvokeDirect+504)
  #57  pc 00000000004fae14  /system/lib64/libart.so (ExecuteMterpImpl+14484)
  #58  pc 000000000025d620  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444)
  #59  pc 0000000000263d20  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #60  pc 000000000027c884  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640)
  #61  pc 00000000004f1e78  /system/lib64/libart.so (MterpInvokeDirect+504)
  #62  pc 00000000004fae14  /system/lib64/libart.so (ExecuteMterpImpl+14484)
  #63  pc 000000000025d620  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+444)


Galaxy S8 And Galaxy S8+
backtrace:
  #00  pc 00400e60f947a908  <unknown>
  #01  pc 0000000000330400  /system/lib64/libskia.so (_ZN15SkScalerContext10getMetricsEP7SkGlyph+48)
  #02  pc 000000000029f404  /system/lib64/libskia.so (_ZN12SkGlyphCache16allocateNewGlyphE15SkPackedGlyphIDNS_11MetricsTypeE+372)
  #03  pc 000000000029f250  /system/lib64/libskia.so (_ZN12SkGlyphCache17getGlyphIDMetricsEt+16)
  #04  pc 0000000000293b38  /system/lib64/libskia.so (_ZN19SkFindAndPlaceGlyph26GlyphFindAndPlaceFullPixelIR12DrawOneGlyphLN7SkPaint5AlignE0ELNS_13SelectKerningE0EE20findAndPositionGlyphEPPKc7SkPointS2_+40)
  #05  pc 0000000000290ecc  /system/lib64/libskia.so (_ZN19SkFindAndPlaceGlyph14ProcessPosTextIR12DrawOneGlyphEEvN7SkPaint12TextEncodingEPKcm7SkPointRK8SkMatrixPKfiNS3_5AlignEP12SkGlyphCacheOT_+940)
  #06  pc 0000000000290a60  /system/lib64/libskia.so (_ZNK6SkDraw11drawPosTextEPKcmPKfiRK7SkPointRK7SkPaintPK14SkSurfaceProps+400)
  #07  pc 000000000020ad00  /system/lib64/libskia.so (_ZN14SkBitmapDevice11drawPosTextEPKvmPKfiRK7SkPointRK7SkPaint+112)
  #08  pc 00000000002897e4  /system/lib64/libskia.so (_ZN12SkBaseDevice12drawTextBlobEPK10SkTextBlobffRK7SkPaintP12SkDrawFilter+436)
  #09  pc 000000000022e1cc  /system/lib64/libskia.so (_ZN8SkCanvas14onDrawTextBlobEPK10SkTextBlobffRK7SkPaint+524)
  #10  pc 000000000022ebbc  /system/lib64/libskia.so (_ZN8SkCanvas12drawTextBlobEPK10SkTextBlobffRK7SkPaint+236)
  #11  pc 0000000000279fc4  /system/lib64/libskia.so (_ZN23SkColorSpaceXformCanvas14onDrawTextBlobEPK10SkTextBlobffRK7SkPaint+84)
  #12  pc 000000000022ebbc  /system/lib64/libskia.so (_ZN8SkCanvas12drawTextBlobEPK10SkTextBlobffRK7SkPaint+236)
  #13  pc 000000000009d92c  /system/lib64/libhwui.so (_ZN7android10SkiaCanvas10drawGlyphsEPKtPKfiRK7SkPaintfffffff+300)
  #14  pc 0000000000039380  /system/lib64/libhwui.so (_ZN7android15DrawTextFunctorclEmm+368)
  #15  pc 0000000000038e84  /system/lib64/libhwui.so (_ZN7android12MinikinUtils10forFontRunINS_15DrawTextFunctorEEEvRKN7minikin6LayoutEPNS_5PaintERT_+276)
  #16  pc 0000000000038c84  /system/lib64/libhwui.so (_ZN7android6Canvas8drawTextEPKtiiiffiRKNS_5PaintEPNS_8TypefaceE+356)
  #17  pc 0000000000177448  /system/lib64/libandroid_runtime.so (_ZN7android9CanvasJNIL14drawTextStringEP7_JNIEnvP8_jobjectlP8_jstringiiffill+136)
  #18  pc 0000000000bb5f34  /system/framework/arm64/boot-framework.oat (android.graphics.BaseCanvas.nDrawText [DEDUPED]+244)
  #19  pc 0000000000bb95d4  /system/framework/arm64/boot-framework.oat (android.graphics.BaseCanvas.drawText+244)
  #20  pc 0000000000bcaad4  /system/framework/arm64/boot-framework.oat (android.graphics.Canvas.drawText+52)
  #21  pc 00000000013ab328  /system/framework/arm64/boot-framework.oat (android.text.BoringLayout.draw+136)
  #22  pc 000000000167c3bc  /system/framework/arm64/boot-framework.oat (android.widget.TextView.onDraw+3980)
  #23  pc 0000000001158814  /system/framework/arm64/boot-framework.oat (android.view.View.draw+308)
  #24  pc 000000000115a0f0  /system/framework/arm64/boot-framework.oat (android.view.View.draw+3616)
  #25  pc 00000000011934e0  /system/framework/arm64/boot-framework.oat (android.view.ViewGroup.drawChild+64)
  #26  pc 000000000118dd1c  /system/framework/arm64/boot-framework.oat (android.view.ViewGroup.dispatchDraw+1468)
  #27  pc 000000000115882c  /system/framework/arm64/boot-framework.oat (android.view.View.draw+332)
  #28  pc 000000000052df84  /system/lib64/libart.so (art_quick_invoke_stub+580)
  #29  pc 00000000000d86a8  /system/lib64/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+200)
  #30  pc 0000000000291720  /system/lib64/libart.so (_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS_6ThreadEPNS_9ArtMethodEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+352)
  #31  pc 000000000028bd30  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+672)
  #32  pc 0000000000518898  /system/lib64/libart.so (MterpInvokeVirtualQuick+680)
  #33  pc 0000000000523714  /system/lib64/libart.so (ExecuteMterpImpl+29972)
  #34  pc 000000000026bed0  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+448)
  #35  pc 0000000000272794  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #36  pc 000000000028bd10  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640)
  #37  pc 00000000005169b8  /system/lib64/libart.so (MterpInvokeDirect+504)
  #38  pc 000000000051fa94  /system/lib64/libart.so (ExecuteMterpImpl+14484)
  #39  pc 000000000026bed0  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+448)
  #40  pc 0000000000272794  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #41  pc 000000000028bd10  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640)
  #42  pc 00000000005169b8  /system/lib64/libart.so (MterpInvokeDirect+504)
  #43  pc 000000000051fa94  /system/lib64/libart.so (ExecuteMterpImpl+14484)
  #44  pc 000000000026bed0  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+448)
  #45  pc 0000000000272794  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #46  pc 000000000028bd10  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640)
  #47  pc 0000000000518898  /system/lib64/libart.so (MterpInvokeVirtualQuick+680)
  #48  pc 0000000000523714  /system/lib64/libart.so (ExecuteMterpImpl+29972)
  #49  pc 000000000026bed0  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+448)
  #50  pc 0000000000272794  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #51  pc 000000000028cbec  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb1ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+684)
  #52  pc 00000000005182b8  /system/lib64/libart.so (MterpInvokeDirectRange+424)
  #53  pc 000000000051fd94  /system/lib64/libart.so (ExecuteMterpImpl+15252)
  #54  pc 000000000026bed0  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+448)
  #55  pc 0000000000272794  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #56  pc 000000000028bd10  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640)
  #57  pc 00000000005169b8  /system/lib64/libart.so (MterpInvokeDirect+504)
  #58  pc 000000000051fa94  /system/lib64/libart.so (ExecuteMterpImpl+14484)
  #59  pc 000000000026bed0  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+448)
  #60  pc 0000000000272794  /system/lib64/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+212)
  #61  pc 000000000028bd10  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+640)
  #62  pc 00000000005169b8  /system/lib64/libart.so (MterpInvokeDirect+504)
  #63  pc 000000000051fa94  /system/lib64/libart.so (ExecuteMterpImpl+14484)


Seems to be a similar crash on all 4 devices (just different code-lines on the Samsung devices)

EDIT: I'm actually not sure if this SIGSEGV is related to jPCT... :|

EgonOlsen

Looks like something related to font rendering to me. I don't think that this relates to jPCT...

AeroShark333

Unfortunately I am still getting the SIGSEGV errors...

However, I came across this:
https://stackoverflow.com/questions/18531835/java-android-fatal-signal-11-sigsegv
"The answer was that the buffer wasn't big enough. Then the openGL API (in my case) accessed an invalid offset (in low-level) and caused a segmentation fault, just like one would get for accessing invalid memory in C. This happens outside of java because bytebuffers are managed by the kernel to allow hardware and low-level code work with your memory."
Is it possible to check the buffers are initialized properly or something? (like see if everything (begin and end) in the buffer is accessible)
I don't know which buffer the problem is (I suppose jPCT has multiple buffers for different things)

Workflow:
Load the Object3D's (by world.renderScene + world.draw) individually which works fine (this should upload their meshes to the GPU I suppose)
Load textures and blit textures (so the VM memory is cleared)
Give all Object3D's their new scaling + position
Add all Object3D's to the world
@first draw world call => SIGSEGV crash (does not always crash)

Note: lower poly models reduce the crash rates

EgonOlsen

The buffer sizes are fine. I've checked that multiple times in the past, because I had similar problems on some devices and on the desktop as well. If they wouldn't be, the engine couldn't even store the data in the first place, because it would crash with a buffer overflow kind of exception. You can do such things in C, but not in Java (unless you are assigning the wrong buffer, but that's not the case either).

AeroShark333

#41
Hmmm, alright...
I found something interesting maybe:
I have 3 polygon models (model0 = low polygon count, model1 = medium polygon count, model2 = high polygon count)

When using model2:
09-26 00:54:36.307 12287-12307/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb70fce0
    Out of bounds vertex attribute info: clientArray? 0 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 33784
    a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb70fce0
    Out of bounds vertex attribute info: clientArray? 0 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 33280
09-26 00:54:36.308 12287-12307/com.aeroshark333.artofearthify I/ArtOfEarthify: Done loading models
09-26 00:54:36.310 12287-12307/com.aeroshark333.artofearthify I/3.artofearthif: Waiting for a blocking GC Explicit
09-26 00:54:36.363 12287-12298/com.aeroshark333.artofearthify I/3.artofearthif: Background concurrent copying GC freed 1087(1323KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 256MB/262MB, paused 447us total 235.483ms
09-26 00:54:36.363 12287-12307/com.aeroshark333.artofearthify I/3.artofearthif: WaitForGcToComplete blocked Explicit on ProfileSaver for 52.895ms
09-26 00:54:36.472 12287-12307/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 4147(769KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 256MB/262MB, paused 463us total 109.121ms
09-26 00:54:36.598 12287-12307/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 5(32KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 256MB/262MB, paused 459us total 124.721ms
09-26 00:54:36.764 12287-12307/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb70fce0
    Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 3168
09-26 00:54:36.765 12287-12307/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb70fce0
    Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 2208
09-26 00:54:36.884 12287-12307/com.aeroshark333.artofearthify I/ArtOfEarthify: Loaded textures: 2
09-26 00:54:36.889 12287-12307/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb70fce0
    Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 3168
09-26 00:54:36.891 12287-12307/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb70fce0
    Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 2272
09-26 00:54:37.052 12287-12307/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 573(59KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 256MB/262MB, paused 590us total 103.887ms
09-26 00:54:37.178 12287-12307/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 12(32KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 256MB/262MB, paused 446us total 125.404ms
09-26 00:54:37.331 12287-12307/com.aeroshark333.artofearthify W/jPCT-AE: [ 1537923277331 ] - WARNING: Texture's size is 2/1, but textures should be square for OpenGL ES2.0! This may result in a black texture!


When using model1:
09-26 01:03:21.295 12390-12594/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xd5376560
    Out of bounds vertex attribute info: clientArray? 0 attribute 3 vbo 11 allocedBufferSize 5296 bufferDataSpecified? 1 wantedStart 0 wantedEnd 33488
09-26 01:03:21.295 12390-12594/com.aeroshark333.artofearthify I/ArtOfEarthify: Done loading models
09-26 01:03:21.295 12390-12594/com.aeroshark333.artofearthify I/3.artofearthif: Waiting for a blocking GC Explicit
09-26 01:03:21.322 12390-12401/com.aeroshark333.artofearthify I/3.artofearthif: Background concurrent copying GC freed 902(1075KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 264MB/270MB, paused 2.438ms total 206.115ms
09-26 01:03:21.322 12390-12594/com.aeroshark333.artofearthify I/3.artofearthif: WaitForGcToComplete blocked Explicit on HeapTrim for 26.936ms
09-26 01:03:21.464 12390-12594/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 4930(1148KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 263MB/269MB, paused 1.051ms total 141.794ms
09-26 01:03:21.594 12390-12594/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 5(32KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 263MB/269MB, paused 442us total 127.988ms
09-26 01:03:21.858 12390-12594/com.aeroshark333.artofearthify I/ArtOfEarthify: Loaded textures: 2
09-26 01:03:22.048 12390-12594/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 572(59KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 263MB/269MB, paused 481us total 139.200ms
09-26 01:03:22.174 12390-12594/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 12(32KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 263MB/269MB, paused 446us total 124.181ms
09-26 01:03:22.324 12390-12594/com.aeroshark333.artofearthify W/jPCT-AE: [ 1537923802324 ] - WARNING: Texture's size is 2/1, but textures should be square for OpenGL ES2.0! This may result in a black texture!


When using model0:
09-26 01:05:03.534 12390-12401/com.aeroshark333.artofearthify I/3.artofearthif: Background concurrent copying GC freed 60908(7MB) AllocSpace objects, 615(16MB) LOS objects, 29% free, 14MB/20MB, paused 855us total 130.193ms
09-26 01:05:03.636 12390-12623/com.aeroshark333.artofearthify I/ArtOfEarthify: Loading background object!
09-26 01:05:03.712 12390-12623/com.aeroshark333.artofearthify I/ArtOfEarthify: Loading sun object!
09-26 01:05:03.780 12390-12623/com.aeroshark333.artofearthify I/ArtOfEarthify: Loading moon object!
09-26 01:05:03.801 12390-12623/com.aeroshark333.artofearthify I/ArtOfEarthify: Done moon object!
09-26 01:05:03.837 12390-12623/com.aeroshark333.artofearthify I/System.out: 2b
09-26 01:05:03.837 12390-12623/com.aeroshark333.artofearthify I/ArtOfEarthify: 3
09-26 01:05:04.019 12390-12401/com.aeroshark333.artofearthify I/3.artofearthif: Background concurrent copying GC freed 3522(952KB) AllocSpace objects, 0(0B) LOS objects, 3% free, 146MB/152MB, paused 608us total 132.321ms
09-26 01:05:04.213 12390-12623/com.aeroshark333.artofearthify I/ArtOfEarthify: Done loading models
09-26 01:05:04.213 12390-12623/com.aeroshark333.artofearthify I/3.artofearthif: Waiting for a blocking GC Explicit
09-26 01:05:04.236 12390-12401/com.aeroshark333.artofearthify I/3.artofearthif: Background concurrent copying GC freed 1140(1393KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 260MB/266MB, paused 4.783ms total 200.504ms
09-26 01:05:04.236 12390-12623/com.aeroshark333.artofearthify I/3.artofearthif: WaitForGcToComplete blocked Explicit on ProfileSaver for 23.046ms
09-26 01:05:04.345 12390-12623/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 3486(1970KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 258MB/264MB, paused 457us total 109.524ms
09-26 01:05:04.472 12390-12623/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 5(32KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 258MB/264MB, paused 481us total 124.901ms
09-26 01:05:04.799 12390-12623/com.aeroshark333.artofearthify I/ArtOfEarthify: Loaded textures: 2
09-26 01:05:04.950 12390-12623/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 577(75KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 258MB/264MB, paused 464us total 118.729ms
09-26 01:05:05.083 12390-12623/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 12(32KB) AllocSpace objects, 0(0B) LOS objects, 2% free, 258MB/264MB, paused 456us total 131.184ms
09-26 01:05:05.234 12390-12623/com.aeroshark333.artofearthify W/jPCT-AE: [ 1537923905234 ] - WARNING: Texture's size is 2/1, but textures should be square for OpenGL ES2.0! This may result in a black texture!


I have not loaded any textures before loading these Object3D's (except dummytextures?) that but this memory usage is too high...?
^So that's because I draw the world a lot before loading the textures to make sure the object3d's are properly loaded (but I believe this is pointless so I removed that)
The memory usage is around 20MB now, but it'd still crash with the low-poly model (model0)

The application can SIGSEGV crash with with all three models...
Any idea why?

EgonOlsen

This looks very strange:


09-26 00:54:36.764 12287-12307/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb70fce0
    Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 3168
09-26 00:54:36.765 12287-12307/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb70fce0
    Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 2208
09-26 00:54:36.884 12287-12307/com.aeroshark333.artofearthify I/ArtOfEarthify: Loaded textures: 2
09-26 00:54:36.889 12287-12307/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb70fce0
    Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 3168
09-26 00:54:36.891 12287-12307/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xeb70fce0
    Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 2272

It's obviously the same buffer instance, which the driver tries to fill with different sized input data...which never fits. I've no idea why that is.
Could you try to set Config.byteBufferLimit to 0 (or some other small value) to see if that changes anything?

AeroShark333

#43
When Config.byteBufferLimit = 0:
09-26 12:02:52.714 5293-5313/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xd5a0f240
    Out of bounds vertex attribute info: clientArray? 0 attribute 2 vbo 56 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 33280
    a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xebe0fe90
    Out of bounds vertex attribute info: clientArray? 0 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 33280
    a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xebe0fe90
    Out of bounds vertex attribute info: clientArray? 0 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 33784
    a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xebe0fe90
    Out of bounds vertex attribute info: clientArray? 0 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 33280
09-26 12:02:52.715 5293-5313/com.aeroshark333.artofearthify I/System.out: 2b
09-26 12:02:52.715 5293-5313/com.aeroshark333.artofearthify I/ArtOfEarthify: 3
09-26 12:02:52.741 5293-5313/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 49894(2042KB) AllocSpace objects, 38(3MB) LOS objects, 23% free, 20MB/26MB, paused 862us total 24.748ms
09-26 12:02:52.765 5293-5313/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 139(36KB) AllocSpace objects, 0(0B) LOS objects, 23% free, 20MB/26MB, paused 720us total 22.994ms
09-26 12:02:52.917 5293-5313/com.aeroshark333.artofearthify I/ArtOfEarthify: Done loading models
09-26 12:02:52.946 5293-5313/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 27(31KB) AllocSpace objects, 0(0B) LOS objects, 23% free, 20MB/26MB, paused 579us total 28.449ms
09-26 12:02:52.980 5293-5313/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 5(32KB) AllocSpace objects, 0(0B) LOS objects, 23% free, 20MB/26MB, paused 576us total 30.571ms
09-26 12:02:53.155 5293-5313/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xebe0fe90
    Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 3168
09-26 12:02:53.164 5293-5313/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xebe0fe90
09-26 12:02:53.165 5293-5313/com.aeroshark333.artofearthify E/emuglGLESv2_enc: Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 2208
09-26 12:02:53.330 5293-5313/com.aeroshark333.artofearthify I/ArtOfEarthify: Loaded textures: 2
09-26 12:02:53.333 5293-5313/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xebe0fe90
    Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 3168
09-26 12:02:53.335 5293-5313/com.aeroshark333.artofearthify E/emuglGLESv2_enc: a vertex attribute index out of boundary is detected. Skipping corresponding vertex attribute. buf=0xebe0fe90
    Out of bounds vertex attribute info: clientArray? 1 attribute 3 vbo 18 allocedBufferSize 2064 bufferDataSpecified? 1 wantedStart 0 wantedEnd 2272
09-26 12:02:53.402 5293-5313/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 575(75KB) AllocSpace objects, 0(0B) LOS objects, 22% free, 20MB/26MB, paused 579us total 30.227ms
09-26 12:02:53.437 5293-5313/com.aeroshark333.artofearthify I/3.artofearthif: Explicit concurrent copying GC freed 12(32KB) AllocSpace objects, 0(0B) LOS objects, 22% free, 20MB/26MB, paused 590us total 32.737ms
09-26 12:02:53.592 5293-5313/com.aeroshark333.artofearthify W/jPCT-AE: [ 1537963373592 ] - WARNING: Texture's size is 2/1, but textures should be square for OpenGL ES2.0! This may result in a black texture!


It will print a similar stacktrace for
Config.byteBufferLimit = 16;
Config.byteBufferLimit *= 64;

But maybe it's just an issue with the emulator..?
Since even when these 'out of boundary' messages get spammed, the application might still work (randomly...)
The crashing error does happen on real physical devices though (the SIGSEGV's)

I wondered, is it bad practice to pre-load the Object3D's by calling world.renderScene() and world.draw() often after each other when the camera is looking at all the Object3D's?
Because I currently do this but I have a feeling that a lot of draw calls at once isn't good for memory or something..?

Also, when using Config.useVBO = false the application would already crash before any texture loading happens (so when the geometry's are drawn with dummy textures)
It seems to be able to make some world draws but it crashes after a few, while Config.useVBO = true has no issues to load geometries here

EgonOlsen

I'm really not sure about this emulator thing. I would say, it's a emulator issue, because it doesn't make any sense what it's printing out there. I don't reserve these 2064 byte large buffers for sure.
I'm not sure how your loading and rendering mix...maybe it's a threading issue of some kind? Maybe it tries to render objects that aren't fully processed?