Bug 459135 - Limit Cache Frame Size Set to Ridiculously Small Setting Raises Assert on Cache Generation
Summary: Limit Cache Frame Size Set to Ridiculously Small Setting Raises Assert on Cac...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: OpenGL Canvas (show other bugs)
Version: 5.1.0
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-15 04:34 UTC by Eoin O'Neill
Modified: 2023-06-23 13:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eoin O'Neill 2022-09-15 04:34:18 UTC
SUMMARY
Setting the cache size to a stupidly low setting (e.g. 10px) will cause Krita to crash when generating cache.

STEPS TO REPRODUCE
1. Open animated KRA file.
2. Set `limit cache frame size` to a really low value, like 10 px
3. Press the play button.

OBSERVED RESULT
It will hit an assert with the following line:

```
ASSERT (krita): "extraWeight == 1" in file /home/appimage/workspace/Krita_Release_Appimage_Build/krita/libs/image/kis_paint_device.cc, line 763
```

EXPECTED RESULT

At the very least, it won't crash.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro KDE
Running from stable appimage. 

ADDITIONAL INFORMATION

Some questions to keep in mind regarding how we should be handling this scenario.

Q1: Stupidly low settings like 10 pixels are basically unusable, so we should reconsider what the lowest value someone should use here. Notably, it wouldn't be very nice looking to be using a 10px frame cache size, so is it really worth it? Personally, I find 128px to be the lowest possible texture size to be still usable.

Q2: Stupidly low settings could be resolved by changing our mindset and instead use a percentage of the user's display as a basis for what size to render. Ultimately, this would make this setting easier to use as you could easily reuse settings between different machines with very different resolutions. With this in mind, probably something like 5% of the users current display resolution should be a reasonable value (10% perhaps, which would be a resolution of 108px on a 1080p display.)
Comment 1 Dmitry Kazakov 2023-06-23 13:32:42 UTC
Git commit 959f473a912b1eef1f2649f0a624cde2cd72ba44 by Dmitry Kazakov.
Committed on 23/06/2023 at 13:32.
Pushed by dkazakov into branch 'master'.

Fix a crash when Animation Cache Size limit is too low

We don't need to generate a separate weights array anymore,
since we have a proper method for uniform mixing these days.

M  +1    -14   libs/image/kis_paint_device.cc

https://invent.kde.org/graphics/krita/-/commit/959f473a912b1eef1f2649f0a624cde2cd72ba44
Comment 2 Dmitry Kazakov 2023-06-23 13:32:50 UTC
Git commit 48d35725645e1ddd2c4c0f9ac80fd11a00d1b124 by Dmitry Kazakov.
Committed on 23/06/2023 at 13:32.
Pushed by dkazakov into branch 'master'.

Increase the lower value of the cached frame size limit

There is no sane reason to have the cache of 1px size

M  +1    -1    libs/ui/dialogs/kis_dlg_preferences.cc

https://invent.kde.org/graphics/krita/-/commit/48d35725645e1ddd2c4c0f9ac80fd11a00d1b124