Closed hedin-hiervard closed 3 years ago
Update: deleting the texture or all of the using .tres files helps.
The problem exists in all 3.1 alphas, but less noticeable on release builds (gives about 72% of CPU load), while a custom (debug) build renders it impossible to work with.
I see that there are mentions of osx on the logs but there is no specification of that on the OP, is this MacOSX related or you see the problem on many OS?
I see that there are mentions of osx on the logs but there is no specification of that on the OP, is this MacOSX related or you see the problem on many OS?
Yes, this is an editor problem and I only tested in on macOS. The game itself seems to work fine (no high CPU usage) on Windows and macOS.
It seems to execute some sort of sync
operation very frequently. There is a heap of defines
which prevents me from understanding of what's going on really. Each operation calls texture_get_data
which in turns allocates the whole memory required for the texture.
I don't really know if this is an intended behavior or a bug.
Probably related to #24478
See https://github.com/godotengine/godot/issues/24478#issuecomment-448860054
Probably related to #24478
See #24478 (comment)
Turning on/off the VSync and Scene Sync doesn't change the situation.
Here is the minimal repro project: https://github.com/hedin-hiervard/godot-cpu-bug
Opening it with 3.1 alpha 4 gives 56% CPU load, opening with a custom debug build gives 100% CPU load and clutchy UI.
I have more info on this problem.
I noticed the problem appears and disappears randomly with the same dataset. My workflow includes rebuilding the texture and the corresponding .tres files while Godot editor is open. Usually after I switch back to the IDE it hangs for a second with "(Re-)importing" message and everything is reloaded and works just smooth. So I tried to remove the problematic texture.png file, its .corresponding texture.png.import and the whole root .import directory. The Godot was switched off while removing the files. After I restarted Godot I saw everything intact including all the sprites. Obviously the texture was cached somewhere else (I searched the entire project dir and found nothing). After some trial and Godot reloads the texture sprites disappeared at last. After that I regenerated the texture again, it got re-imported and voila, no CPU load. So, my every 5 or so texture regens causes the texture to be "bad".
In case you blame macOS reading files from Trash, I used rm -Rf
to delete files.
The problem here is that you use a huge atlas, which needs to be loaded/freed every time a single bit of an atlas texture generates a preview in a thread. As OpenGL does not allow you to load/save texture data asynchronously in there, it has to transfer back and forth this huge texture every time by blocking the main thread.
This will be improved in Vulkan, which allows more control over asynchronously uploading data and creating resources, so for now there is no fix possible. Just wait patiently until all the previews are generated and then it will work.
Is this issue still relevant with the addition of built-in atlas support back in April 2019?
@hedin-hiervard Can you reproduce this in Godot 3.2.1 or 3.2.2beta2?
@hedin-hiervard Can you reproduce this in Godot 3.2.1 or 3.2.2beta2?
I don't use atlases anymore. I found they don't add to the performance and the current implementation of Atlases in 3.1 is cumbersome to work with, so I switched to plain sprites.
Knowing this, should we just close this issue ? It doesn't seem to impact anyone else either
Closing per the above comments.
Godot version:
Any Godot 3.1 alpha
OS/device including version:
Issue description:
I'm using Godot in a project where a lot of sprites are packed into a spritesheet and many .tres files generated and then used for creating TextureAtlases. All went well until today I noticed the IDE became highly unresponsive. Activity Monitor shows 100% CPU usage. I investigated a bit and found out most time it's doing this:
So, basically it reallocates the memory for the large texture (6MB) all the time, thus the CPU usage:
Deleting the texture from the project helps. I'm not sure what is causing this.
Steps to reproduce:
Minimal reproduction project: