Skip to content
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

Godot crashes upon opening this project #10758

Closed
ghost opened this issue Aug 29, 2017 · 7 comments · Fixed by #10776
Closed

Godot crashes upon opening this project #10758

ghost opened this issue Aug 29, 2017 · 7 comments · Fixed by #10776

Comments

@ghost
Copy link

ghost commented Aug 29, 2017

Operating system or device, Godot version
Linux Mint 18.2 Cinnamon x64 - Godot master 28c8592

Issue description:
A project of mine will just crash Godot upon opening it. Attempts to debug with gdc did not pan out as I'm an idiot who is bad at computer

The issue was introduced in 28c8592, but it can be replicated even in the latest commit as of this point (e8b05ca)

Steps to reproduce:

  1. Import the project linked below
  2. Attempt to open it

Link to minimal example project:
3D platformer.zip

@hpvb
Copy link
Member

hpvb commented Aug 29, 2017

This seems to be an assertion in etc2comp while encoding 5CA0DDAE_c.png

godot.x11.opt.tools.64: thirdparty/etc2comp/EtcBlock4x4Encoding_ETC1.cpp:792: void Etc::Block4x4Encoding_ETC1::TryDifferentialHalf(Etc::DifferentialTrys::Half*): Assertion `ptry->m_fError < FLT_MAX' failed.

Full backtrace:

godot.x11.opt.tools.64: thirdparty/etc2comp/EtcBlock4x4Encoding_ETC1.cpp:792: void Etc::Block4x4Encoding_ETC1::TryDifferentialHalf(Etc::DifferentialTrys::Half*): Assertion `ptry->m_fError < FLT_MAX' failed.

Thread 1 "godot.x11.opt.t" received signal SIGABRT, Aborted.
0x00007ffff533366b in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install alsa-lib-1.1.4.1-1.fc26.x86_64 bzip2-libs-1.0.6-22.fc26.x86_64 dbus-libs-1.11.16-1.fc26.x86_64 expat-2.2.3-1.fc26.x86_64 flac-libs-1.3.2-2.fc26.x86_64 freetype-2.7.1-9.fc26.x86_64 gsm-1.0.17-1.fc26.x86_64 libICE-1.0.9-9.fc26.x86_64 libSM-1.2.2-5.fc26.x86_64 libX11-1.6.5-2.fc26.x86_64 libXau-1.0.8-7.fc26.x86_64 libXcursor-1.1.14-8.fc26.x86_64 libXext-1.3.3-5.fc26.x86_64 libXfixes-5.0.3-2.fc26.x86_64 libXi-1.7.9-2.fc26.x86_64 libXinerama-1.1.3-7.fc26.x86_64 libXrandr-1.5.1-2.fc26.x86_64 libXrender-0.9.10-2.fc26.x86_64 libXtst-1.2.3-2.fc26.x86_64 libasyncns-0.8-11.fc26.x86_64 libcap-2.25-5.fc26.x86_64 libgcc-7.1.1-3.fc26.x86_64 libgcrypt-1.7.8-1.fc26.x86_64 libglvnd-0.2.999-19.20170620gitd850cdd.fc26.x86_64 libglvnd-glx-0.2.999-19.20170620gitd850cdd.fc26.x86_64 libgpg-error-1.25-2.fc26.x86_64 libogg-1.3.2-6.fc26.x86_64 libpng-1.6.28-2.fc26.x86_64 libselinux-2.6-7.fc26.x86_64 libsndfile-1.0.28-3.fc26.x86_64 libstdc++-7.1.1-3.fc26.x86_64 libuuid-2.30.1-1.fc26.x86_64 libvorbis-1.3.5-2.fc26.x86_64 libxcb-1.12-3.fc26.x86_64 lz4-libs-1.7.5-4.fc26.x86_64 mesa-dri-drivers-17.1.5-1.fc26.x86_64 mesa-libGL-17.1.5-1.fc26.x86_64 mesa-libglapi-17.1.5-1.fc26.x86_64 pcre-8.41-1.fc26.x86_64 pulseaudio-libs-10.0-4.fc26.x86_64 systemd-libs-233-6.fc26.x86_64 tcp_wrappers-libs-7.6-85.fc26.x86_64 xz-libs-5.2.3-2.fc26.x86_64 zlib-1.2.11-2.fc26.x86_64
(gdb) bt
#0  0x00007ffff533366b in raise () from /lib64/libc.so.6
#1  0x00007ffff5335470 in abort () from /lib64/libc.so.6
#2  0x00007ffff532bd2a in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff532bda2 in __assert_fail () from /lib64/libc.so.6
#4  0x00000000007854a9 in Etc::Block4x4Encoding_ETC1::TryDifferentialHalf (this=this@entry=0x7fffffff93d0, a_phalf=a_phalf@entry=0x7fffffff9610) at thirdparty/etc2comp/EtcBlock4x4Encoding_ETC1.cpp:792
#5  0x000000000078574a in Etc::Block4x4Encoding_ETC1::TryDifferential (this=this@entry=0x88d6650, a_boolFlip=<optimized out>, a_uiRadius=a_uiRadius@entry=0, a_iGrayOffset1=a_iGrayOffset1@entry=0, 
    a_iGrayOffset2=a_iGrayOffset2@entry=0) at thirdparty/etc2comp/EtcBlock4x4Encoding_ETC1.cpp:577
#6  0x0000000000786ac6 in Etc::Block4x4Encoding_ETC1::PerformFirstIteration (this=0x88d6650) at thirdparty/etc2comp/EtcBlock4x4Encoding_ETC1.cpp:317
#7  0x0000000000794225 in Etc::Block4x4Encoding_RGB8::PerformIteration (this=0x88d6650, a_fEffort=<optimized out>) at thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp:236
#8  0x0000000000704cb8 in Etc::Block4x4::PerformEncodingIteration (this=<optimized out>, a_fEffort=<optimized out>) at thirdparty/etc2comp/EtcBlock4x4.h:67
#9  Etc::Image::RunFirstPass (this=0x7fffffffcae0, a_uiMultithreadingOffset=<optimized out>, a_uiMultithreadingStride=1) at thirdparty/etc2comp/EtcImage.cpp:598
#10 0x0000000000705b20 in Etc::Image::Encode (this=this@entry=0x7fffffffcae0, a_format=a_format@entry=Etc::Image::Format::RGB8, a_errormetric=a_errormetric@entry=Etc::RGBX, a_fEffort=a_fEffort@entry=0, 
    a_uiJobs=<optimized out>, a_uiJobs@entry=4, a_uiMaxJobs=a_uiMaxJobs@entry=4) at thirdparty/etc2comp/EtcImage.cpp:271
#11 0x00000000007036a6 in Etc::Encode (a_pafSourceRGBA=a_pafSourceRGBA@entry=0x74ccb00, a_uiSourceWidth=<optimized out>, a_uiSourceHeight=<optimized out>, a_format=a_format@entry=Etc::Image::Format::RGB8, 
    a_eErrMetric=a_eErrMetric@entry=Etc::RGBX, a_fEffort=a_fEffort@entry=0, a_uiJobs=a_uiJobs@entry=4, a_uiMaxJobs=4, a_ppaucEncodingBits=0x7fffffffcc68, a_puiEncodingBitsBytes=0x7fffffffcc48, 
    a_puiExtendedWidth=0x7fffffffcc4c, a_puiExtendedHeight=0x7fffffffcc60, a_piEncodingTime_ms=0x7fffffffcc34, a_bVerboseOutput=false) at thirdparty/etc2comp/Etc.cpp:47
#12 0x00000000006381cd in _compress_etc (p_img=0x88d1730, p_lossy_quality=<optimized out>, force_etc1_format=<optimized out>, p_source=<optimized out>) at modules/etc/image_etc.cpp:175
#13 0x000000000175302b in Image::compress (this=<optimized out>, p_mode=p_mode@entry=Image::COMPRESS_ETC2, p_source=p_source@entry=Image::COMPRESS_SOURCE_SRGB, p_lossy_quality=p_lossy_quality@entry=0.699999988)
    at core/image.cpp:1527
#14 0x0000000000a6f163 in ResourceImporterTexture::_save_stex (this=this@entry=0x40058f0, p_image=..., p_to_path=..., p_compress_mode=p_compress_mode@entry=2, p_lossy_quality=p_lossy_quality@entry=0.699999988, 
    p_vram_compression=p_vram_compression@entry=Image::COMPRESS_ETC2, p_mipmaps=p_mipmaps@entry=true, p_texture_flags=23, p_streamable=false, p_detect_3d=false, p_detect_srgb=false, p_force_rgbe=false, 
    p_detect_normal=true, p_force_normal=false) at editor/import/resource_importer_texture.cpp:308
#15 0x0000000000a6fd78 in ResourceImporterTexture::import (this=0x40058f0, p_source_file=..., p_save_path=..., p_options=..., r_platform_variants=0x7fffffffcec0, r_gen_files=<optimized out>)
    at editor/import/resource_importer_texture.cpp:422
#16 0x0000000000895755 in EditorFileSystem::_reimport_file (this=this@entry=0x4846110, p_file=...) at editor/editor_file_system.cpp:1388
#17 0x00000000008975a5 in EditorFileSystem::reimport_files (this=this@entry=0x4846110, p_files=...) at editor/editor_file_system.cpp:1481
#18 0x00000000008979e4 in EditorFileSystem::_update_scan_actions (this=this@entry=0x4846110) at editor/editor_file_system.cpp:385
#19 0x000000000089c1ff in EditorFileSystem::_notification (this=0x4846110, p_what=<optimized out>) at editor/editor_file_system.cpp:1004
#20 0x000000000183301b in Object::notification (this=0x4846110, p_notification=17, p_reversed=<optimized out>) at core/object.cpp:792
#21 0x0000000000e258e9 in SceneTree::_notify_group_pause (this=this@entry=0x36d0860, p_group=..., p_notification=p_notification@entry=17) at scene/main/scene_tree.cpp:908
#22 0x0000000000e26936 in SceneTree::idle (this=0x36d0860, p_time=0.13333334) at scene/main/scene_tree.cpp:488
#23 0x0000000000426b62 in Main::iteration () at main/main.cpp:1572
#24 0x0000000000412f39 in OS_X11::run (this=this@entry=0x7fffffffd470) at platform/x11/os_x11.cpp:2109
#25 0x000000000040c869 in main (argc=2, argv=0x7fffffffd988) at platform/x11/godot_x11.cpp:54

@hpvb
Copy link
Member

hpvb commented Aug 29, 2017

Importing that same image into a different project does not cause the assert to be triggered. Looks like it must be something else.

@RandomShaper
Copy link
Member

At least, it doesn't crash on MSVC/Windows x64.

GCC version?

@hpvb
Copy link
Member

hpvb commented Aug 29, 2017

GCC 7 in both cases I imagine.

I've removed that image from the project and it does not crash, I've imported that single image into another project and it also doesn't crash.

The previous GCC issues we had were due to the UB in Object::cast_to(), I have no idea what this is. I've also build etc2comp separately and tried to reproduce the crash with the cli tool it comes with. Same compiler, no crash. This will require a lot more digging.

@hpvb
Copy link
Member

hpvb commented Aug 30, 2017

It appears that building etc2comp with -ffast-math doesn't work correctly on this compiler. Building without fixes the issue for me.

@Rubonnek
Copy link
Member

Rubonnek commented Aug 30, 2017

This is very similar to #10070 and #10776 fixed the issue for me too.

@TeddyDD, could you test @hpvb's pull request (#10776) with your normal map? Seems like disabling -ffast-math will fix your issue too.

hpvb added a commit to hpvb/godot that referenced this issue Aug 30, 2017
Apparently -ffast-math generates incorrect code with recent versions of
GCC and Clang. The manual page for GCC warns about this possibility.

In my tests it doesn't actually appear to be measurably slower in this
case, and this is used in a batch process so it seems safe to disable
this.

This fixes godotengine#10758 and fixes godotengine#10070
@ghost
Copy link
Author

ghost commented Aug 30, 2017

#10776 didn't fix this. #10786 does, however.

@akien-mga akien-mga added this to the 3.0 milestone Oct 25, 2017
hpvb added a commit to hpvb/godot that referenced this issue Jan 9, 2019
Godot supports many different compilers and for production releases we
have to support 3 currently: GCC8, Clang6, and MSVC2017. These compilers
all do slightly different things with -ffast-math and it is causing
issues now. See godotengine#24841, godotengine#24540, godotengine#10758, godotengine#10070. And probably other
complaints about physics differences between release and release_debug
builds.

I've done some performance comparisons on Linux x86_64. All tests are
ran 20 times.

Bunnymark: (higher is better)
(bunnies)    min    max  stdev average
fast-math   7332   7597    71     7432
this pr     7379   7779   108     7621 (102%)

FPBench (gdscript port http://fpbench.org/) (lower is better)
(ms)
fast-math  15441  16127   192    15764
this pr    15671  16855   326    16001  (99%)

Float_add (adding floats in a tight loop) (lower is better)
(sec)
fast-math   5.49   5.78  0.07     5.65
this pr     5.65   5.90  0.06     5.76  (98%)

Float_div (dividing floats in a tight loop) (lower is better)
(sec)
fast-math  11.70  12.36  0.18    11.99
this pr    11.92  12.32  0.12    12.12  (99%)

Float_mul (multiplying floats in a tight loop) (lower is better)
(sec)
fast-math  11.72  12.17  0.12    11.93
this pr    12.01  12.62  0.17    12.26  (97%)

I have also looked at FPS numbers for tps-demo, 3d platformer, 2d
platformer, and sponza and could not find any measurable difference.

I believe that given the issues and oft-reported (physics) glitches on
release builds I believe that the couple of percent of tight-loop
floating point performance regression is well worth it.

This fixes godotengine#24540 and fixes godotengine#24841
hpvb added a commit to hpvb/godot that referenced this issue Jan 9, 2019
Godot supports many different compilers and for production releases we
have to support 3 currently: GCC8, Clang6, and MSVC2017. These compilers
all do slightly different things with -ffast-math and it is causing
issues now. See godotengine#24841, godotengine#24540, godotengine#10758, godotengine#10070. And probably other
complaints about physics differences between release and release_debug
builds.

I've done some performance comparisons on Linux x86_64. All tests are
ran 20 times.

Bunnymark: (higher is better)
(bunnies)    min    max  stdev average
fast-math   7332   7597    71     7432
this pr     7379   7779   108     7779 (109%)

FPBench (gdscript port http://fpbench.org/) (lower is better)
(ms)
fast-math  15441  16127   192    15764
this pr    15671  16855   326    16855  (99%)

Float_add (adding floats in a tight loop) (lower is better)
(sec)
fast-math   5.49   5.78  0.07     5.65
this pr     5.65   5.90  0.06     5.76  (98%)

Float_div (dividing floats in a tight loop) (lower is better)
(sec)
fast-math  11.70  12.36  0.18    11.99
this pr    11.92  12.32  0.12    12.12  (99%)

Float_mul (multiplying floats in a tight loop) (lower is better)
(sec)
fast-math  11.72  12.17  0.12    11.93
this pr    12.01  12.62  0.17    12.26  (97%)

I have also looked at FPS numbers for tps-demo, 3d platformer, 2d
platformer, and sponza and could not find any measurable difference.

I believe that given the issues and oft-reported (physics) glitches on
release builds I believe that the couple of percent of tight-loop
floating point performance regression is well worth it.

This fixes godotengine#24540 and fixes godotengine#24841
akien-mga pushed a commit to akien-mga/godot that referenced this issue Jul 3, 2019
Godot supports many different compilers and for production releases we
have to support 3 currently: GCC8, Clang6, and MSVC2017. These compilers
all do slightly different things with -ffast-math and it is causing
issues now. See godotengine#24841, godotengine#24540, godotengine#10758, godotengine#10070. And probably other
complaints about physics differences between release and release_debug
builds.

I've done some performance comparisons on Linux x86_64. All tests are
ran 20 times.

Bunnymark: (higher is better)
(bunnies)    min    max  stdev average
fast-math   7332   7597    71     7432
this pr     7379   7779   108     7621 (102%)

FPBench (gdscript port http://fpbench.org/) (lower is better)
(ms)
fast-math  15441  16127   192    15764
this pr    15671  16855   326    16001  (99%)

Float_add (adding floats in a tight loop) (lower is better)
(sec)
fast-math   5.49   5.78  0.07     5.65
this pr     5.65   5.90  0.06     5.76  (98%)

Float_div (dividing floats in a tight loop) (lower is better)
(sec)
fast-math  11.70  12.36  0.18    11.99
this pr    11.92  12.32  0.12    12.12  (99%)

Float_mul (multiplying floats in a tight loop) (lower is better)
(sec)
fast-math  11.72  12.17  0.12    11.93
this pr    12.01  12.62  0.17    12.26  (97%)

I have also looked at FPS numbers for tps-demo, 3d platformer, 2d
platformer, and sponza and could not find any measurable difference.

I believe that given the issues and oft-reported (physics) glitches on
release builds I believe that the couple of percent of tight-loop
floating point performance regression is well worth it.

This fixes godotengine#24540 and fixes godotengine#24841

(cherry picked from commit e5b335d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants