Bug 477753 - Cursor and stroke delay on transparent (empty) canvas at the end of each stroke
Summary: Cursor and stroke delay on transparent (empty) canvas at the end of each stroke
Status: CONFIRMED
Alias: None
Product: krita
Classification: Applications
Component: * Unknown (show other bugs)
Version: 5.2.6
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-30 06:44 UTC by Dorijan Salak
Modified: 2025-02-02 10:55 UTC (History)
3 users (show)

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


Attachments
Screen recording of steps to reproduce bug (3.14 MB, application/x-zip-compressed)
2023-11-30 07:08 UTC, Dorijan Salak
Details
Screen recording showing the confirmed issue (82 bytes, text/plain)
2024-11-17 17:41 UTC, Wolfgang Baer
Details
screen recording (70 bytes, text/plain)
2024-11-17 17:47 UTC, Wolfgang Baer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dorijan Salak 2023-11-30 06:44:08 UTC
SUMMARY
Delays and painting performance drops when painting on empty (transparent) canvas with 2 or more layers in stack.

STEPS TO REPRODUCE
1. Create new document (larger, something demanding) with 2 layers and Image Background opacity set to 0%
2. Attempt to draw multiple fast strokes
3. Observe cursor/stroke delay
4. Delete one layer so only 1 layer is in stack, or add 1-100% fill underneath, or increase image bg opacity to 0,05-100%
5. Repeat from step 2. to observe normal behavior

OBSERVED RESULT
Delay in cursor movement and stroke rendering at the end of each stroke when drawing on an empty canvas with 2 or more empty/hidden layers in stack and Image background opacity set to 0%.
Painting on a single empty layer in stack and 0% Image BG opacity will not cause issue.
Setting Image BG opacity to 0,05-100% or having filled paint layer or Fill Layer underneath with at least 1% opacity will also result in normal stroke performance.

EXPECTED RESULT
No performance issues when drawing on an empty canvas with 2 or more layers in stack.

SOFTWARE/OS VERSIONS
Windows: Windows 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 5.15.7 

ADDITIONAL INFORMATION
Tested on all three Canvas Graphics Acceleration options and without (CPU rendering) all with same results, so it doesn't seem to be an issue with OpenGL renderer. No difference in CPU and RAM usage between normal and abnormal performance.
Important to note: Attempting to reproduce this bug on very small canvas will not show any significant performance drop and bug won't be apparent.
Comment 1 Dorijan Salak 2023-11-30 07:08:02 UTC
Created attachment 163638 [details]
Screen recording of steps to reproduce bug

Uploaded screen recording to attachments. Also noticed that there is a delay in selecting layers as well, on top of stroke/cursor delays  shorty after emptying canvas background (can be seen around the the 1:30 mark of the recording). The origin of the bug could be somewhere within the Layer stack.
Comment 2 Wolfgang Baer 2024-11-17 17:33:48 UTC
A tricky one - confirmed in Krita 5.2.6

It happens only if:
Settings -> Configure Krita -> Display -> Preferred Renderer = Direct3D 11 via Angle

It does not happen if:
Preferred Renderer = OpenGL

Furthermore:
It happens if both layers are empty and then the strokes are added one after the other, either going from top to bottom or bottom to top.
As soon as the whole canvas has some strokes on it, the lag disappears.

Please see attached video as it is difficult to explain.

Document tested with was:
12,000 px x 10,000 px | 16 bit sRGB
Brush was:
Default Airbrush linear noisy at 500 px | flow, opacity = 100%
Comment 3 Wolfgang Baer 2024-11-17 17:41:15 UTC
Created attachment 175882 [details]
Screen recording showing the confirmed issue
Comment 4 Wolfgang Baer 2024-11-17 17:43:16 UTC
Comment on attachment 175882 [details]
Screen recording showing the confirmed issue

https://drive.google.com/file/d/1-XZ_RQsJB8hxRyXi2ddUoOwuIdPwZIQ8/view
Comment 5 Wolfgang Baer 2024-11-17 17:44:19 UTC
Comment on attachment 175882 [details]
Screen recording showing the confirmed issue

https://drive.google.com/file/d/1-XZ_RQsJB8hxRyXi2ddUoOwuIdPwZIQ8/view
Comment 6 Wolfgang Baer 2024-11-17 17:45:24 UTC
Comment on attachment 175882 [details]
Screen recording showing the confirmed issue

Seems to not work for viewing.
Comment 7 Wolfgang Baer 2024-11-17 17:47:49 UTC
Created attachment 175883 [details]
screen recording
Comment 8 Wolfgang Baer 2024-11-17 18:02:07 UTC
(In reply to Wolfgang Baer from comment #2)
> A tricky one - confirmed in Krita 5.2.6
> 
> It happens only if:
> Settings -> Configure Krita -> Display -> Preferred Renderer = Direct3D 11
> via Angle
> 
> It does not happen if:
> Preferred Renderer = OpenGL
> 
> Furthermore:
> It happens if both layers are empty and then the strokes are added one after
> the other, either going from top to bottom or bottom to top.
> As soon as the whole canvas has some strokes on it, the lag disappears.
> 
> Please see attached video as it is difficult to explain.
> 
> Document tested with was:
> 12,000 px x 10,000 px | 16 bit sRGB
> Brush was:
> Default Airbrush linear noisy at 500 px | flow, opacity = 100%

Forgot to mention:
Tested on Windows 11, Intel core i7 13700K, Nvidia RTX 4070
Comment 9 YRH 2024-11-17 20:40:21 UTC
I can also confirm the bug on another hardware configuration: Windows 11 24H2, Ryzen 9950X, Radeon 6900 XT.
However, in my case I can observe the bug on both ANGLE and OpenGL.

Another observation, the canvas needs to be larger than 8192 x 8192 pixels.

I could simply reproduce it like this:
1. Create a new document with large size.
2. Hide the background flayer (click the eye icon)
3. Draw multiple strokes on the top paint layer.
Comment 10 Dorijan Salak 2024-11-20 01:07:29 UTC
Hmm, another weird thing I just found.

If I create a New small sized document (eg. 500x500) then resize canvas to anything larger (tried up to 10000x10000) the bug won't happen, while if I create a New document that's larger (eg. A4 300 ppi) it will happen BUT if then I resize it to small (500x500) it'll stop, even if I resize it back to original or larger size.
Comment 11 Wolfgang Baer 2025-02-02 10:55:58 UTC
I just tested it on Windows 11, Intel, Nvidia RTX.

krita-x64-5.3.0-prealpha-f043c4f9.zip

Issue happens in this version as well.