godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.72k stars 20.12k forks source link

GLTF files can prevent PNG/SVG files from being imported on Arm systems #76691

Open aaronfranke opened 1 year ago

aaronfranke commented 1 year ago

Godot version

Latest master 2a0aef5f0912b60f85c9e150cc0bfbeab7de6e40 but different behavior on master

System information

macOS 13.3 arm64 (also happens on Ubuntu Linux arm64)

We have narrowed down the bug in the comments, it seems to only happen on ARM, not x86.

Issue description

Some hard-to-isolate situations can cause other files like PNG files to be permanently unimported. In some cases this can be fixed by deleting the .import files, but in some cases Godot gets stuck and it refuses to even regenerate the .import files let alone perform the import.

One of these situations can be triggered by the GLTF files in the attached minimal reproduction project. Part of this issue is a regression since 4.0-stable, part of it also exists in 4.0-stable.

Steps to reproduce

  Failed loading resource: res://torch/text/baseColor_1.png. Make sure resources have been imported by opening the project in the editor at least once.
  editor/editor_node.cpp:1263 - Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN
  Failed loading resource: res://torch/text/emissive_1.png. Make sure resources have been imported by opening the project in the editor at least once.
  editor/editor_node.cpp:1263 - Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN
  Failed loading resource: res://torch/minecraft_torch_minecraft_torch.png. Make sure resources have been imported by opening the project in the editor at least once.
  editor/editor_node.cpp:1263 - Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN
  Failed loading resource: res://torch/minecraft_torch_minecraft_torch_emissive.png. Make sure resources have been imported by opening the project in the editor at least once.
  editor/editor_node.cpp:1263 - Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN


Another problem that you can test in the same minimal reproduction project, this has regressions since 4.0-stable:

  Failed loading resource: res://torch/minecraft_torch_minecraft_torch_emissive.png. Make sure resources have been imported by opening the project in the editor at least once.
  modules/gltf/gltf_document.cpp:3282 - glTF: Image index '0' couldn't be loaded with the name: minecraft_torch_emissive. Skipping it.
  Failed loading resource: res://torch/minecraft_torch_minecraft_torch.png. Make sure resources have been imported by opening the project in the editor at least once.
  modules/gltf/gltf_document.cpp:3282 - glTF: Image index '1' couldn't be loaded with the name: minecraft_torch. Skipping it.


The first issue is also present in 4.0-stable, I have written some text about that collapsed:

* Open the minimal reproduction project with Godot 4.0-stable. * Double-clicking on any of the PNG files gives an error that the resource can't be opened.
``` Failed loading resource: res://torch/text/baseColor_1.png. Make sure resources have been imported by opening the project in the editor at least once. editor/editor_node.cpp:1209 - Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN Failed loading resource: res://torch/text/emissive_1.png. Make sure resources have been imported by opening the project in the editor at least once. editor/editor_node.cpp:1209 - Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN Failed loading resource: res://torch/minecraft_torch_minecraft_torch.png. Make sure resources have been imported by opening the project in the editor at least once. editor/editor_node.cpp:1209 - Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN Failed loading resource: res://torch/minecraft_torch_minecraft_torch_emissive.png. Make sure resources have been imported by opening the project in the editor at least once. editor/editor_node.cpp:1209 - Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN ```
* Try deleting the `.glb` and `.gltf` files. Double-click on a PNG file. Same errors. * Try restarting Godot after deleting the `.glb` and `.gltf` files. Double-click on a PNG file. Same errors. * Try deleting the `.png.import` files. The PNG files will now import and load fine.

Minimal reproduction project

wherearemyimports.zip

lyuma commented 1 year ago

Unable to reproduce on 4.0.2 stable on windows. Is this possible macOS specific?

aaronfranke commented 1 year ago

@lyuma Thanks for testing. I re-tested with 6980b2bf1761b9b980920dc5a4d32f240d88e211 on several different platforms that I have access to. I can still reproduce the issue on macOS arm64 and I can also reproduce the issue on my Linux arm64 VM on my Mac but it works fine on Windows x86_64 and Linux x86_64. EDIT: My brother tested on his x86_64 Mac mini and he doesn't experience it. So this seems like it might be an ARM-specific issue, or possibly an issue specific to the Mac hardware (I have an M1 Pro). Either way this is strange, and it would be helpful to get more testing.

nathanfranke commented 1 year ago

^ can load the pngs on macOS Monterey 12.6.1 (x86_64 Mac mini late 2014)

Godot Engine v4.0.2.stable.official.7a0977ce2 - https://godotengine.org
OpenGL API 4.1 INTEL-18.8.5 - Compatibility - Using Device: Intel Inc. - Intel HD Graphics 5000 OpenGL Engine

WARNING: Blend file import is enabled in the project settings, but no Blender path is configured in the editor settings. Blend files will not be imported.
     at: _editor_init (modules/gltf/register_types.cpp:70)
res://torch/text/baseColor_1.png: Texture detected as used in 3D. Enabling mipmap generation and setting the texture compression mode to VRAM Compressed (S3TC/ETC/BPTC).
res://torch/text/emissive_1.png: Texture detected as used in 3D. Enabling mipmap generation and setting the texture compression mode to VRAM Compressed (S3TC/ETC/BPTC).
res://torch/minecraft_torch_minecraft_torch.png: Texture detected as used in 3D. Enabling mipmap generation and setting the texture compression mode to VRAM Compressed (S3TC/ETC/BPTC).
res://torch/minecraft_torch_minecraft_torch_emissive.png: Texture detected as used in 3D. Enabling mipmap generation and setting the texture compression mode to VRAM Compressed (S3TC/ETC/BPTC).