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

Custom builds with disabled webp module crash #49633

Open
smix8 opened this issue Jun 15, 2021 · 6 comments
Open

Custom builds with disabled webp module crash #49633

smix8 opened this issue Jun 15, 2021 · 6 comments

Comments

@smix8
Copy link
Contributor

smix8 commented Jun 15, 2021

Godot version

de04394

System information

Win10 64x

Issue description

Custom builds with disabled webp module crash in both editor and exported game (in Godot 4.x as well).

I tried to disable the newer webp feature for a custom Godot build cause I have no use for webp at all in a project but it is "hardcoded" instead of being a true module so the module_webp_enabled=no Scons parameter is basically a deathtrap.

Steps to reproduce

Compile Godot from source with module_webp_enabled=no setting.

Editor or game crashes with an error from \scene\resources\texture.cpp around line 560 in Godot3.x and line 365 in Godot4.x immediately when a texture is loaded.

Minimal reproduction project

see steps

@akien-mga
Copy link
Member

The webp module should be made a mandatory dependency following #47835, as your images will be converted to WebP, unless you select "Force PNG" in the import settings.

@boruok
Copy link
Contributor

boruok commented Nov 18, 2021

crash is valid for 3.4.stable too. As @akien-mga said workaround is:

  1. check flag under ProjectSettings -> Rendering -> Misc -> LosslessCompression -> Force Png
  2. click reimport under all of your textures (enables setting)

@akien-mga
Copy link
Member

I guess that if you have already imported files as WebP, then disable the module, and then try to reload the same project, you might indeed get an issue when loading the already imported files.

Deleting res://.import to force a reimport with the WebP-less version of the editor should work however, it should fall back to PNG automatically (even if you don't enable "Force PNG").

BTW, any specific reason why you want to disable webp? If it's to save on binary size, this is likely counterproductive as webp actually gives you better compressed and thus smaller lossless textures, which would make the total game size smaller than using PNG.

@akien-mga
Copy link
Member

I can't reproduce a crash in 3.x, could you provide more details on what you're doing to get a crash with 3.4-stable or later?

I just tested this assumption:

I guess that if you have already imported files as WebP, then disable the module, and then try to reload the same project, you might indeed get an issue when loading the already imported files.

And it actually works as expected, it throws errors about not being able to load the imported WebP files, but doesn't crash:

ERROR: Condition "img.is_null() || img->empty()" is true. Returned: ERR_FILE_CORRUPT
   at: _load_data (scene/resources/texture.cpp:566)
ERROR: Failed loading resource: res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Failed loading resource: res://icon.png. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Condition "!res.is_valid()" is true. Returned: ERR_CANT_OPEN
   at: load_resource (editor/editor_node.cpp:977)

@boruok
Copy link
Contributor

boruok commented Nov 19, 2021

@akien-mga disabling modules for experiments, how far you can reduce template size. For example, default debug arm7 apk size is 13.2mb, reduced is 8.7mb.

# used flags
tools=no optimize=size deprecated=no minizip=no disable_3d=yes disable_advanced_gui=yes module_arkit_enabled=no module_bmp_enabled=no module_bullet_enabled=no module_camera_enabled=no module_csg_enabled=no module_cvtt_enabled=no module_dds_enabled=no module_denoise_enabled=no module_enet_enabled=no module_etc_enabled=no module_fbx_enabled=no module_gdnative_enabled=no module_gltf_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_jpg_enabled=no module_jsonrpc_enabled=no module_lightmapper_cpu_enabled=no module_mbedtls_enabled=no module_minimp3_enabled=no module_mobile_vr_enabled=no module_opensimplex_enabled=no module_pvr_enabled=no module_raycast_enabled=no module_recast_enabled=no module_regex_enabled=no module_squish_enabled=no module_svg_enabled=no module_tga_enabled=no module_thekla_unwrap_enabled=no module_theora_enabled=no module_tinyexr_enabled=no module_upnp_enabled=no module_vhacd_enabled=no module_visual_script_enabled=no module_webrtc_enabled=no module_websocket_enabled=no module_webxr_enabled=no module_xatlas_unwrap_enabled=no module_ogg_enabled=no module_opus_enabled=no module_stb_vorbis_enabled=no module_vorbis_enabled=no module_webm_enabled=no module_webp_enabled=no
# log
ERROR: Condition "img.is_null() || img->empty()" is true. Returned: ERR_FILE_CORRUPT
   at: _load_data (scene/resources/texture.cpp:566)
ERROR: Failed loading resource: res://.import/atlas.png-c03e693e99a11d1bff9a0482eefe1aa9.stex. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Failed loading resource: res://textures/atlas.png. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Can't load dependency: res://textures/atlas.png.
   at: poll (core/io/resource_format_binary.cpp:611)
ERROR: Failed to load resource 'res://.import/deposit_silver.png-188d6f077d08c24c05b4d48c189cd05d.res'.
   at: load (core/io/resource_loader.cpp:206)
ERROR: Failed loading resource: res://.import/deposit_silver.png-188d6f077d08c24c05b4d48c189cd05d.res. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Failed loading resource: res://scenes/tilemaps/textures/resources/deposit_silver.png. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: res://scenes/tilemaps/resources.tscn:5 - Parse Error: [ext_resource] referenced nonexistent resource at: res://scenes/tilemaps/textures/resources/deposit_silver.png
   at: poll (scene/resources/resource_format_text.cpp:412)
ERROR: Failed to load resource 'res://scenes/tilemaps/resources.tscn'.
   at: load (core/io/resource_loader.cpp:206)
ERROR: Failed loading resource: res://scenes/tilemaps/resources.tscn. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: res://screens/FantasyLife.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://scenes/tilemaps/resources.tscn
   at: poll (scene/resources/resource_format_text.cpp:412)
ERROR: Failed to load resource 'res://screens/FantasyLife.tscn'.
   at: load (core/io/resource_loader.cpp:206)
ERROR: Failed loading resource: res://screens/FantasyLife.tscn. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Failed loading scene: res://screens/FantasyLife.tscn
   at: start (main/main.cpp:1998)
ERROR: Condition "_first != nullptr" is true.
   at: ~List (./core/self_list.h:108)
ERROR: Condition "_first != nullptr" is true.
   at: ~List (./core/self_list.h:108)
ERROR: Condition "_first != nullptr" is true.
   at: ~List (./core/self_list.h:108)
ERROR: Condition "_first != nullptr" is true.
   at: ~List (./core/self_list.h:108)
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
     at: cleanup (core/object.cpp:2064)
ERROR: Resources still in use at exit (run with --verbose for details).
   at: clear (core/resource.cpp:417)

This is confusing, afaik webp is other file format than png, and here is no webp file usage in project

@fire
Copy link
Member

fire commented Jun 5, 2022

Webp is used for the lossless image format internally. It was swapped from png previously. There can be no webp usage and still be internally using webp lossless.

See #47835

@lyuma lyuma modified the milestones: 4.0, 4.1 Feb 22, 2023
@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 23, 2023
@YuriSizov YuriSizov modified the milestones: 4.2, 4.3 Nov 14, 2023
@KoBeWi KoBeWi modified the milestones: 4.3, 4.x Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants