godotengine / godot

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

Some VRAM Compressed PNG and JPG images give an error when used in Sprite2D or Visual Shader editor #96847

Closed JekSun97 closed 1 month ago

JekSun97 commented 1 month ago

Tested versions

Godot 4.4 dev 2

System information

Godot v4.4.dev2 - Windows 10.0.19045 - OpenGL 3 (Compatibility) - Radeon RX 560 Series (Advanced Micro Devices, Inc.; 31.0.14001.45012) - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 Threads)

Issue description

It seems that 4.4 dev2 has some issues with images (eg png/jpg), I found two issues when using certain files in Godot:

  1. Error spam when we use a texture in Sprite2D, or select this node in the list, or when the mouse is hovering over the Sprite2D Errors in output: Expected Image data size of 1000x1063x1 (DXT1 RGB8 with 10 mipmaps) = 710152 bytes, got 710408 bytes instead. drivers/gles3/storage/texture_storage.cpp:1043 - Condition "image->is_empty()" is true. Returning: Ref<Image>()

  2. When we add a texture to a Texture2D node in the visual shader editor, an error occurs in the output: Expected Image data size of 1601x1362x1 (DXT5 RGBA8 with 10 mipmaps) = 2917456 bytes, got 2923168 bytes instead. drivers/gles3/storage/texture_storage.cpp:1043 - Condition "image->is_empty()" is true. Returning: Ref<Image>()

Steps to reproduce

  1. Drag one of the textures in the MRP project to the scene (+1 error)
  2. Hover the mouse over this texture (Sprite2D) in the scene (+ many errors)

Minimal reproduction project (MRP)

err.zip

AThousandShips commented 1 month ago

Thank you for reporting, consolidating in:

See there for more details, if you think something was missed about this and it's not the same issue, please comment here and it can be reopened

JekSun97 commented 1 month ago

Благодарим вас за сообщение, объединенное в:

Более подробную информацию смотрите там. Если вы считаете, что что-то было упущено и это не та же проблема, пожалуйста, оставьте комментарий здесь, и ее можно будет открыть снова.

I think this issue should be opened, as #96635 is an improvement. But here the problem is with PNG and JPG formats, which have full support

But since the error is similar, perhaps these two problems have the same cause.

AThousandShips commented 1 month ago

I'd say it is still an improvement as Godot requires full MIP chains, it seems for all formats, but that PR fixes it specifically for DDS

CC @BlueCube3310

akien-mga commented 1 month ago

Confirmed in 4.3.stable and 4.4.dev2.

BlueCube3310 commented 1 month ago

~At first glance this seems to be related to how the images are padded to multiples of 4 in etcpak and BasisU. This doesn't happen when compressing as BPTC, probably since the padding is implemented in the actual compressor there.~

Edit: It seems to only happen in Compatibility