Bug 444919 - Big size brush become more stutter on Direct3d 11 via ANGLE
Summary: Big size brush become more stutter on Direct3d 11 via ANGLE
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: OpenGL Canvas (show other bugs)
Version: 5.0.0-beta2
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-11-04 05:27 UTC by Protoniv
Modified: 2022-06-08 08:16 UTC (History)
2 users (show)

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


Attachments
Beta1 and Beta2 comparison Direct3D via ANGLE (1.23 MB, video/mp4)
2021-11-04 05:27 UTC, Protoniv
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Protoniv 2021-11-04 05:27:15 UTC
Created attachment 143188 [details]
Beta1 and Beta2 comparison Direct3D via ANGLE

SUMMARY
When performing fast brush stroke using Big brush, especially with brush tips, will cause the brush outline and stroke being more stutter than in Beta1 when Canva Acceleration is set to Direct3d 11 via ANGLE.
OpenGL performs quite well.

STEPS TO REPRODUCE
1. Set Canva Acceleration to Direct3d 11 via ANGLE
2. Create new file A4 300dpi, select a brush which need some calculation, g)Dry Bristles for example, or some low spacing round brush like b)Basic-3 Flow.
3. Set brush size to around 500px or higher
4. Without canva zoomed in, perform fast zig-zag stroke to paint over canva.

OBSERVED RESULT
Brush outline and brush stroke get massive frame skip when brush stroke cannot keep up with the cursor.

EXPECTED RESULT
Should not get that much frame skip.

SOFTWARE/OS VERSIONS
Windows: windows 10 20H2

ADDITIONAL INFORMATION
Small heavy calculation brush like RGBA-smudge brush don't have this issue.
Tested on Pentium 3825U with intelHD, maybe it need bigger brush size to distinguish frame skip on decent machine.
Comment 1 Protoniv 2021-11-04 05:38:39 UTC
(In reply to Protoniv from comment #0)
> SUMMARY
> When performing fast brush stroke using Big brush, especially with brush tips


I'm sorry just forgot to edit the summary, it's not "especially with brush tips" but more like brush spacing.
Comment 2 Protoniv 2021-12-07 01:57:32 UTC
When testing the brush pattern, some default watercolor huge brush e.g.
j) WaterC Spread-Pattern (632.40px)
j) WaterC Spread (576.00px)
Brush Outline and stroke appearing on canvas stutter massively and can barely use, can't even zoom when the stroke is not finished. Switch to OpenGL can solve them.
Not sure if it should set as release_blocker.
Comment 3 Halla Rempt 2021-12-07 08:30:03 UTC
No, performance problems with "huge" brushes are not a release blocker, especially when there is a simple workaround, like selecting a different option for canvas acceleration.
Comment 4 Dmitry Kazakov 2022-06-03 10:50:03 UTC
I can reproduce this issue on Core i7. One needs to select "b) Basic-3 Flow" and set its size to 1000px. The issue happens only in combination of Angle **and** "Use texture buffer" option. Angle without this option and openGL with any value of the textures option work perfectly.
Comment 5 Dmitry Kazakov 2022-06-08 08:00:53 UTC
Git commit 809d5701974f1d22615f4439fa6e06d7d6d0e823 by Dmitry Kazakov.
Committed on 08/06/2022 at 07:58.
Pushed by dkazakov into branch 'master'.

Remove explicit setting of the channel flags on every canvas update

Channel flags change in a blocking operation guarded by mutex, so
it is very expensive to execute. The switch should be handled by a
separate method KisOpenGLCanvasRenderer::channelSelectionChanged().

M  +1    -1    libs/ui/canvas/kis_abstract_canvas_widget.h
M  +1    -1    libs/ui/canvas/kis_canvas2.cpp
M  +1    -3    libs/ui/canvas/kis_qpainter_canvas.cpp
M  +1    -1    libs/ui/canvas/kis_qpainter_canvas.h
M  +1    -2    libs/ui/opengl/KisOpenGLCanvasRenderer.cpp
M  +1    -1    libs/ui/opengl/KisOpenGLCanvasRenderer.h
M  +2    -2    libs/ui/opengl/kis_opengl_canvas2.cpp
M  +1    -1    libs/ui/opengl/kis_opengl_canvas2.h

https://invent.kde.org/graphics/krita/commit/809d5701974f1d22615f4439fa6e06d7d6d0e823
Comment 6 Dmitry Kazakov 2022-06-08 08:01:01 UTC
Git commit a9b46a6d156a63484f48c365e3894f8d385259d5 by Dmitry Kazakov.
Committed on 08/06/2022 at 07:58.
Pushed by dkazakov into branch 'master'.

Explicitly disable texture buffers on ANGLE renderer

Angle has suboptimal implementation of texture buffers. It does a
long chain of copy operations just to upload the buffer into a
texture:

source user data -> ram buffer -> staging buffer -> native buffer -> texture

It makes painting with huge brushes really slow.

M  +42   -0    libs/ui/opengl/kis_opengl.cpp
M  +3    -0    libs/ui/opengl/kis_opengl.h
M  +4    -3    libs/ui/opengl/kis_opengl_image_textures.cpp

https://invent.kde.org/graphics/krita/commit/a9b46a6d156a63484f48c365e3894f8d385259d5
Comment 7 Dmitry Kazakov 2022-06-08 08:15:41 UTC
Git commit fa31e27fb1e7579e64f84e4b32a47308a67eef21 by Dmitry Kazakov.
Committed on 08/06/2022 at 08:03.
Pushed by dkazakov into branch 'krita/5.1'.

Remove explicit setting of the channel flags on every canvas update

Channel flags change in a blocking operation guarded by mutex, so
it is very expensive to execute. The switch should be handled by a
separate method KisOpenGLCanvasRenderer::channelSelectionChanged().

M  +1    -1    libs/ui/canvas/kis_abstract_canvas_widget.h
M  +1    -1    libs/ui/canvas/kis_canvas2.cpp
M  +1    -3    libs/ui/canvas/kis_qpainter_canvas.cpp
M  +1    -1    libs/ui/canvas/kis_qpainter_canvas.h
M  +1    -2    libs/ui/opengl/KisOpenGLCanvasRenderer.cpp
M  +1    -1    libs/ui/opengl/KisOpenGLCanvasRenderer.h
M  +2    -2    libs/ui/opengl/kis_opengl_canvas2.cpp
M  +1    -1    libs/ui/opengl/kis_opengl_canvas2.h

https://invent.kde.org/graphics/krita/commit/fa31e27fb1e7579e64f84e4b32a47308a67eef21
Comment 8 Dmitry Kazakov 2022-06-08 08:16:22 UTC
Git commit 0ea1676c0d786e2da71b080e9a5e3efe04086962 by Dmitry Kazakov.
Committed on 08/06/2022 at 08:03.
Pushed by dkazakov into branch 'krita/5.1'.

Explicitly disable texture buffers on ANGLE renderer

Angle has suboptimal implementation of texture buffers. It does a
long chain of copy operations just to upload the buffer into a
texture:

source user data -> ram buffer -> staging buffer -> native buffer -> texture

It makes painting with huge brushes really slow.

M  +42   -0    libs/ui/opengl/kis_opengl.cpp
M  +3    -0    libs/ui/opengl/kis_opengl.h
M  +4    -3    libs/ui/opengl/kis_opengl_image_textures.cpp

https://invent.kde.org/graphics/krita/commit/0ea1676c0d786e2da71b080e9a5e3efe04086962