Blank project with a single texture crashes on Amazon Fire v1.2.180 (SOLVED)

Build this as an apk and run through Android Studio debug on an Amazon Fire device (tested 5th generation), it will crash.

KindleCrashTester.zip (3.0 KB)

2 Likes

What device model is this more precisely?

Since the error is a SIGBUS illegal alignment, I took the relevant struct types in that funciton added an align(4) to them. (I don’t have a device).

You can try this build here to see if it works better:
http://d.defold.com/archive/dev/831ca3d70c101ef02907fc7874797be9a63d3a68/bob/bob.jar

2 Likes

Tested on the blank project above and it does appear to work now on the Kindle Fire 5th Gen!

1 Like

The Device Model is listed as “Fire (5th Generation)”

The blank project with a single image is working but the main large project is still crashing at launch though I am still looking into it so may be a different issue. Will post once I get info.

1 Like

@Mathias_Westerdahl

2021-03-16%2005_28_14-About

I can test more whenever. I don’t have a newer Kindle Fire than 5th generation.

basist::unpack_uastc(basist::uastc_block const&, basist::unpacked_uastc_block&, bool, bool) 0x00000000a383a6d8
basist::unpack_uastc(basist::uastc_block const&, basist::color32*, bool) 0x00000000a383671c
basist::basisu_lowlevel_uastc_transcoder::transcode_slice(void*, unsigned int, unsigned int, unsigned char const*, unsigned int, basist::block_format, unsigned int, bool, bool, unsigned int, unsigned int, unsigned int, basist::basisu_transcoder_state*, unsigned int, int, int, unsigned int) 0x00000000a3832694
basist::basisu_lowlevel_uastc_transcoder::transcode_image(basist::transcoder_texture_format, void*, unsigned int, unsigned char const*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, bool, bool, unsigned int, basist::basisu_transcoder_state*, unsigned int, int, int) 0x00000000a3836b30
basist::basisu_transcoder::transcode_image_level(void const*, unsigned int, unsigned int, unsigned int, void*, unsigned int, basist::transcoder_texture_format, unsigned int, unsigned int, basist::basisu_transcoder_state*, unsigned int) const 0x00000000a3838150
dmGraphics::Transcode(char const*, dmGraphics::TextureImage::Image*, dmGraphics::TextureFormat, unsigned char**, unsigned int*, unsigned int*) 0x00000000a382d818
dmGameSystem::AcquireResources(char const*, dmResource::SResourceDescriptor*, dmGraphics::Context*, dmGameSystem::ImageDesc*, dmGraphics::Texture*, dmGraphics::Texture**) 0x00000000a380f4e4
dmGameSystem::ResTextureCreate(dmResource::ResourceCreateParams const&) 0x00000000a380fb58
dmResource::DoGet(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d476c
dmResource::Get(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d45d0
dmGameSystem::AcquireResources(dmPhysics::Context2D*, dmResource::SResourceFactory*, dmGameSystemDDF::TextureSet*, dmGameSystem::TextureSetResource*, char const*, bool) 0x00000000a380fcf4
dmGameSystem::ResTextureSetCreate(dmResource::ResourceCreateParams const&) 0x00000000a381038c
dmResource::DoGet(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d476c
dmResource::Get(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d45d0
dmGameSystem::AcquireResources(dmResource::SResourceFactory*, void const*, unsigned int, dmParticle::Prototype*, char const*) 0x00000000a380d724
dmGameSystem::ResParticleFXCreate(dmResource::ResourceCreateParams const&) 0x00000000a380d934
dmResource::DoGet(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d476c
dmResource::Get(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d45d0
dmGameSystem::AcquireResources(dmResource::SResourceFactory*, dmGui::Context*, dmGuiDDF::SceneDesc*, dmGameSystem::GuiSceneResource*, char const*) 0x00000000a3809c60
dmGameSystem::ResCreateSceneDesc(dmResource::ResourceCreateParams const&) 0x00000000a380a3b0
dmResource::DoGet(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d476c
dmResource::Get(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d45d0
dmGameObject::AcquireResources(dmResource::SResourceFactory*, dmGameObject::Register*, dmGameObjectDDF::PrototypeDesc*, dmGameObject::Prototype*, char const*) 0x00000000a37c7d08
dmGameObject::ResGameObjectCreate(dmResource::ResourceCreateParams const&) 0x00000000a37c7998
dmResource::DoGet(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d476c
dmResource::Get(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d45d0
dmGameObject::AcquireResources(char const*, dmResource::SResourceFactory*, dmGameObject::Register*, dmGameObjectDDF::CollectionDesc*, char const*, dmGameObject::CollectionHandle**) 0x00000000a37c7038
dmGameObject::ResCollectionCreate(dmResource::ResourceCreateParams const&) 0x00000000a37c6c0c
dmResource::DoGet(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d476c
dmResource::Get(dmResource::SResourceFactory*, char const*, void**) 0x00000000a37d45d0
dmEngine::Init(dmEngine::Engine*, int, char**) 0x00000000a37a1494
dmEngineCreate(int, char**) 0x00000000a37a35a0
dmEngine::RunLoop(dmEngine::RunLoopParams const*) 0x00000000a379ecd0
EngineMain(int, char**) 0x00000000a379ec3c
EngineMainThread(void*) 0x00000000a379ebdc
dmThread::ThreadStartProxy(void*) 0x00000000a3940fe8
__pthread_start(void*) 0x00000000b6d9d758
__start_thread 0x00000000b6d9b608

Ok, so it seems it worked by luck on your previous attempt.

With the project listed in the first post maybe. I don’t know what would really be different, I used the same texture profile settings for example. Source images are different such as a mix of JPEGS and PNGs with transparency but I don’t know if that would matter.

In C/C++, Unless structs are explicitly told to be aligned to a certain address, variables might end up at an address that a function might not like.
E.g. on some architectures it’s not ok if an int is stored on an address that is not a multiple of 4, and on some it is.
And during one run, the memory layout might be different from another run, so that address might be ok one time, but not ok the next time.

3 Likes

Hi- I’ve just checked in (hopefully) a fix for this crash:

By default, the UASTC unpacker uses unaligned 64-bit reads unless it’s a WASM build. I’ve configured the transcoder to only do this on x86/x64.

4 Likes

Also, you can set the macro BASISD_USE_UNALIGNED_WORD_READS to 0 at compile time without changing the code, and see if that works.

3 Likes

Thank you @richgel999 !
I’ll try it out today!

3 Likes

I have now a PR ready for review, and soon a build you can test with too.
The fix worked on my Amazon Fire device.

2 Likes

@pkeod There’s a new build here:
http://d.defold.com/archive/dev/8df4f685d623f88684d008f6b333bcd16b071d5f/bob/bob.jar

2 Likes

Tested that version and works perfectly now on Kindle Fire 5th Gen with the large project! :sparkles:

3 Likes