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

Editor preview generation causes several minutes of editor stuttering. #44585

Open
ghost opened this issue Dec 22, 2020 · 2 comments
Open

Editor preview generation causes several minutes of editor stuttering. #44585

ghost opened this issue Dec 22, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Dec 22, 2020

Godot version:

9c3293b

OS/device including version:

Win 10

Issue description:

It appears that when we import textures that are broken into resource atlas regions, there is a lot of stuttering in the editor for sometimes several minutes. I inspected the usage, and it looks like the spikes in CPU are traced to preview generation.

I don't know if this a regression or old issue, I don't do texture importing very often to notice. The team's artist will periodically report that editor is sometimes laggy for a long time when she sometimes starts it up. I've captured it once last week on her machine, and now I encountered it on my machine when merging new character work into my development branch.

Even if it were something heavy, it's supposed to be working in a thread in the background, so not sure why it would seize up and cause such hiccups.

Here are the code paths and their measures.

devenv_KsLrWfEfDk

devenv_hGQbFWWk2d

Steps to reproduce:
Has something to do with thumbnail generation. Might be due to a large texture and with small atlas regions in TRES files. First speculation is that maybe it's reloading the large source texture over and over again to generate dozens of these small atlas thumbnails.

Using the MRP below should give the results. May have to clear thumbnails from app data and restart to reproduce it more than once.

Minimal reproduction project:

This works on my machines, hopefully when starting this project, noticeable stuttering is reproduced.
Stuttering.zip

@ghost
Copy link
Author

ghost commented Dec 22, 2020

Does appear to be related to thumbnail generation. MRP now attached.

@ghost
Copy link
Author

ghost commented Jan 22, 2021

Encountered it again today after pulling asset updates to a project branch.

Seems like a lot of time is spend here:

for (; y > 0; --y)
{
png_read_row(png_ptr, row, NULL);
row += row_bytes;
}
}

But inspecting the assets that are causing the stutters, and it seems to confirm that they're atlas textures. I imagine the problem is that the preview generator doesn't cache the source texture, and keeps dropping and reloading it.

Just a guess, but if right, it would mean that if there were 100 atlas pieces pointing to one large texture, it probably loads and unloads the large texture a 100 times to generate the previews.

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

1 participant