Bug 415772 - Windows preferred renderer should be Angle not Auto, not OpenGL
Summary: Windows preferred renderer should be Angle not Auto, not OpenGL
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.2.8
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-01 17:49 UTC by mrpenc
Modified: 2020-06-09 11:12 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
First start after deleting kritarc and kritadisplayrc (32.67 KB, image/png)
2020-05-20 11:26 UTC, Tyson Tan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mrpenc 2020-01-01 17:49:08 UTC
SUMMARY
OpenGL renderer is broken on all Windows versions including Windows 7, Direct3D 11 via ANGLE should be the default option in Windows 7 if the GPU supports it.

STEPS TO REPRODUCE
1. Open Krita on Windows 7.
2. Under "Settings" menu click "Configure Krita" and select "Display".
3. Observe the "Auto (OpenGL)" option in "Preferred Renderer" drop-down list.

OBSERVED RESULT
Auto (OpenGL)

EXPECTED RESULT
Auto (Direct3D 11 via ANGLE)

SOFTWARE/OS VERSIONS
Windows: 7 SP1 x64
Comment 1 Halla Rempt 2020-01-02 09:17:26 UTC
No, opengl is not broken on all windows versions. It depends on the hardware and the driver. On all my windows systems, for instance, with nvidia or intel gpu's, opengl just works...
Comment 2 mrpenc 2020-01-05 05:49:46 UTC
You're right a gpu driver update from 388.84 to 399.24 fixed the OpenGL stuttering. I will now just use Auto (OpenGL).

Also I did some further testing of several older Krita versions on geforce driver 388.84 that may be of interest:
On krita-3.0-x64 there was no stuttering at all, but on krita-3.0.1-x64 (and presumably all versions after) it had the stuttering. Which means starting in krita-3.0.1-x64 it made use of some OpenGL feature(s) or something that geforce driver v388.84 did not like.
Comment 3 Tyson Tan 2020-05-18 14:30:17 UTC
I recently received many complains from nvidia GPU users that Krita slows down on their machines. One of those was using an RTX 2080 Ti GPU so the hardware shouldn't be a problem.

Most users have no idea what GPU driver is and will never update their GPU drivers and it is too technical to explain. Most of the affected users will just drop Krita after doing a few dabs.

OpenGL related slowdowns under Windows becomes such a problem that the Chinese branch of Clip Studio Paint is using this as ammunition on their website to scare people away from even trying Krita.

Unless there is anything dangerous about ANGLE, I think it is advisable to just default to ANGLE on Windows.
Comment 4 Halla Rempt 2020-05-18 15:04:45 UTC
Gosh, they actually are so afraid they do that? That feels so weird. In any case I thought I had already made Angle the default on Windows. From main.cc:

#ifdef Q_OS_WIN
        const QString preferredRendererString = kritarc.value("OpenGLRenderer", "angle").toString();
#else
        const QString preferredRendererString = kritarc.value("OpenGLRenderer", "auto").toString();
#endif


I have to admit, I haven't checked recently whether that isn't overridden later on.
Comment 5 Tyson Tan 2020-05-18 15:19:00 UTC
395861(In reply to Boudewijn Rempt from comment #4)
> Gosh, they actually are so afraid they do that? That feels so weird. In any
> case I thought I had already made Angle the default on Windows. From main.cc:
> 
> #ifdef Q_OS_WIN
>         const QString preferredRendererString =
> kritarc.value("OpenGLRenderer", "angle").toString();
> #else
>         const QString preferredRendererString =
> kritarc.value("OpenGLRenderer", "auto").toString();
> #endif
> 
> 
> I have to admit, I haven't checked recently whether that isn't overridden
> later on.

Hi Boud,
Actually, after diagnosing with that RTX 2080 Ti user, he wasn't able to reproduce the slowdown after resetting Krita's configuration. The same driver now runs OpenGL pretty well. Maybe it has something to do with kritarc too?

On my machine (AMD RX 590), Krita also defaults to Auto (OpenGL).

Weirdly, the first time I started Krita under Windows after deleting kritarc, the "Current Renderer" is ANGLE, but the "Preferred renderer" is Auto (OpenGL). After restarting Krita, it will start using OpenGL for real.

BTW the CSP Chinese branch has the reputation of dodgy marketing. Maybe don't mix their image with their Japanese headquarter.
Comment 6 Tyson Tan 2020-05-18 15:24:56 UTC
Now he said "ANGLE" is still more responsive than "OpenGL" on his machine.
Comment 7 Halla Rempt 2020-05-20 09:08:01 UTC
I did just check, and at least on my laptop, where opengl is, according to the Qt whitelists preferred, with a clean config, Angle is selected, so I guess I was succesful in making that a default.
Comment 8 Tyson Tan 2020-05-20 11:24:36 UTC
I just did some through check on my desktop:

# After Menu --> Setings --> Reset Krita Configuration:
Current: OpenGL
Preferred: Auto (OpenGL)

# After deleting kritarc:
Current: OpenGL
Preferred: Auto (OpenGL)

# After deleting kritadisplayrc
Current: Direct3D 11 via ANGLE
Preferred: Auto (OpenGL)
Current: OpenGL (After a restart)
Comment 9 Tyson Tan 2020-05-20 11:26:56 UTC
Created attachment 128632 [details]
First start after deleting kritarc and kritadisplayrc

This this the screenshot of the first time starting Krita and check its display settings. Notice that how the Current Renderer and Preferred renderer is different. Since the Preferred renderer is Auto (OpenGL), after a restart the Current Renderer also becomes OpenGL.
Comment 10 Tyson Tan 2020-05-20 11:30:45 UTC
# Krita Log:
================================================================================
SESSION: 20 May 2020 19:27:15 +0800. Executing C:\Program Files\Krita (x64)\bin\krita.exe

Krita Version: 4.3.0-beta1 (git 1c85214), Qt version compiled: 5.12.8, loaded: 5.12.8. Process ID: 5656
-- -- -- -- -- -- -- --
Comment 11 Tyson Tan 2020-05-20 11:31:11 UTC
# System Information (1st start):
Krita

 Version: 4.3.0-beta1 (git 1c85214)
 Languages: zh_CN, zh, en_US, en
 Hidpi: true

Qt

  Version (compiled): 5.12.8
  Version (loaded): 5.12.8

OS Information

  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.18363
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10

OpenGL Info
 
  Vendor:  "Google Inc." 
  Renderer:  "ANGLE (Radeon RX 590 Series Direct3D11 vs_5_0 ps_5_0)" 
  Version:  "OpenGL ES 3.0 (ANGLE 2.1.0.57ea533f79a7)" 
  Shading language:  "OpenGL ES GLSL ES 3.00 (ANGLE 2.1.0.57ea533f79a7)" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:    QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) 
     Version: 3.0
     Supports deprecated functions false 
     is OpenGL ES: true 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsAngleD3D11: true 
  isQtPreferAngle: false 

Hardware Information

  GPU Acceleration: auto
  Memory: 65487 Mb
  Number of Cores: 16
  Swap Location: C:/Users/Tyson Tan/AppData/Local/Temp

Current Settings

  Current Swap Location: C:/Users/Tyson Tan/AppData/Local/Temp
  Current Swap Location writable: true
  Undo Enabled: true
  Undo Stack Limit: 30
  Use OpenGL: true
  Use OpenGL Texture Buffer: true
  Use AMD Vectorization Workaround: false
  Canvas State: OPENGL_NOT_TRIED
  Autosave Interval: 900
  Use Backup Files: true
  Number of Backups Kept: 1
  Backup File Suffix: ~
  Backup Location: Same Folder as the File
  Backup Location writable: false
  Use Win8 Pointer Input: false
  Use RightMiddleTabletButton Workaround: false
  Levels of Detail Enabled: false
  Use Zip64: false


Display Information
Number of screens: 1
	Screen: 0
		Name: \\.\DISPLAY1
		Depth: 32
		Scale: 1
		Resolution in pixels: 3840x2160
		Manufacturer: 
		Model: 
		Refresh Rate: 59
Comment 12 Tyson Tan 2020-05-20 11:31:23 UTC
# System Information (2nd start)
Krita

 Version: 4.3.0-beta1 (git 1c85214)
 Languages: zh_CN, zh, en_US, en
 Hidpi: true

Qt

  Version (compiled): 5.12.8
  Version (loaded): 5.12.8

OS Information

  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.18363
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10

OpenGL Info
 
  Vendor:  "ATI Technologies Inc." 
  Renderer:  "Radeon RX 590 Series" 
  Version:  "3.0.13587 Compatibility Profile Context 20.4.2 26.20.15029.27016" 
  Shading language:  "4.60" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:    QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::sRGBColorSpace, profile  QSurfaceFormat::NoProfile) 
     Version: 3.0
     Supports deprecated functions true 
     is OpenGL ES: false 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsAngleD3D11: true 
  isQtPreferAngle: false 

Hardware Information

  GPU Acceleration: auto
  Memory: 65487 Mb
  Number of Cores: 16
  Swap Location: C:/Users/Tyson Tan/AppData/Local/Temp

Current Settings

  Current Swap Location: C:/Users/Tyson Tan/AppData/Local/Temp
  Current Swap Location writable: true
  Undo Enabled: true
  Undo Stack Limit: 30
  Use OpenGL: true
  Use OpenGL Texture Buffer: true
  Use AMD Vectorization Workaround: false
  Canvas State: OPENGL_SUCCESS
  Autosave Interval: 900
  Use Backup Files: true
  Number of Backups Kept: 1
  Backup File Suffix: ~
  Backup Location: Same Folder as the File
  Backup Location writable: false
  Use Win8 Pointer Input: false
  Use RightMiddleTabletButton Workaround: false
  Levels of Detail Enabled: false
  Use Zip64: false


Display Information
Number of screens: 1
	Screen: 0
		Name: \\.\DISPLAY1
		Depth: 32
		Scale: 1
		Resolution in pixels: 3840x2160
		Manufacturer: 
		Model: 
		Refresh Rate: 59
Comment 13 Tyson Tan 2020-05-20 11:35:52 UTC
Please note that a "2nd time starting" does not always make it OpenGL. It seems that as soon as either of kritarc/kritadisplayrc changed regardless what settings, it immediately becomes OpenGL. It's really confusing and random, since I never click "OK" during all these tests. There might be some configuration file compatibility issues somewhere.
Comment 14 Tyson Tan 2020-05-20 11:42:28 UTC
System Information:
Windows 10 1909 X64, fully updated.
AMD RX590 (Driver: Adrenalin 2020 Edition 20.4.2 Optional, 2020-04-23, latest)
Comment 15 Halla Rempt 2020-05-20 12:46:00 UTC
We should've made a new bug for this... In any case, I've got a windows build that basically disables the auto option completely. If you've got some time, please test it -- but there's no hurry!

https://www.dropbox.com/s/dyb6u5fjj7seitu/krita-4.3.0-beta2-angle-preferred.zip?dl=0
Comment 16 Tyson Tan 2020-05-21 06:20:19 UTC
Hi Boud,

I tried the package you provided yesterday. Now it defaults to ANGLE. Thanks! Although I think it's better if Qt can prefer ANGLE so we can have Auto (ANGLE), but I guess we don't have a say on that.

BTW, do you think we should clear both kritarc and kritadisplayrc when using Menu --> Settings --> Reset Krita Configurations? Right now it only clears kritarc, but in many cases kritadisplayrc also needs to be cleared to fix those weird issues.
Comment 18 Dmitry Kazakov 2020-05-27 20:50:23 UTC
Hi, Tyson and mrpenc!

Could you please check this package if it selects "Auto (Direct3D 11 via ANGLE)" for you?

1) Download this package: https://yadi.sk/d/_GIYf0l_Z5XoIA
2) Remove your kritadisplayrc (C:\Users\<username>\AppData\Local\kritadisplayrc)
3) Start Krita
4) Check if "Auto (Direct3D 11 via ANGLE)" option is selected and "Direct3D 11 via ANGLE" renderer is active
Comment 19 Tyson Tan 2020-05-28 04:43:05 UTC
Yes, it does. :)
Thank you Dmitry!
Comment 20 Emmet O'Neill 2020-06-02 21:36:41 UTC
Git commit 6c9a7a8d88ea374cf724ac44502c035c76faf9eb by Emmet O'Neill.
Committed on 02/06/2020 at 21:36.
Pushed by emmetoneill into branch 'master'.

Created a shader for drawing brush tool outline.

Made a new GLSL shader for drawing the brush tool's preview outline.
To do so, an adjustment to Krita's render pipeline was made:
On platforms where render to texture (FBO) is supported, the canvas is
now rendered to an intermediate texture which is used as a uniform input
in the outline shader (and possibly other overlays in the future).
Coded with Eoin O'Neill.

A  +10   -0    krita/data/shaders/overlay_inverted.frag
M  +1    -0    krita/data/shaders/shaders.qrc
M  +2    -2    libs/global/kis_algebra_2d.cpp
M  +1    -0    libs/ui/opengl/KisOpenGLModeProber.cpp
M  +5    -0    libs/ui/opengl/KisOpenGLModeProber.h
M  +6    -0    libs/ui/opengl/kis_opengl.cpp
M  +9    -0    libs/ui/opengl/kis_opengl.h
M  +98   -41   libs/ui/opengl/kis_opengl_canvas2.cpp
M  +1    -0    libs/ui/opengl/kis_opengl_canvas2.h
M  +18   -0    libs/ui/opengl/kis_opengl_shader_loader.cpp
M  +1    -0    libs/ui/opengl/kis_opengl_shader_loader.h

https://invent.kde.org/graphics/krita/commit/6c9a7a8d88ea374cf724ac44502c035c76faf9eb
Comment 21 Tyson Tan 2020-06-03 03:16:24 UTC
Thank you Emmet, this is also an improvement much needed. Is it related to this bug?
Comment 22 Tyson Tan 2020-06-03 13:16:07 UTC
Although the current patches worked for me (AMD GPU),
Nvidia GPU users still report it being Auto(OpenGL).

On top of that, in some cases, for example during the first session after changing "Use Frame Buffer" and restart:

Current Renderer: OpenGL
Preferred Renderer: Auto (OpenGL)

But it will revert to D3D after a restart on my machine.

Tested on 4.3.0 beta 2/Windows 10 2004.
Comment 23 Tyson Tan 2020-06-03 14:12:28 UTC
In Comment 22 I reported some Nvidia GPU users still have issues with Auto to OpenGL. Apparently it was a misunderstanding induced by Bug 4224129. 

However, the other issue stays true.
Comment 24 Dmitry Kazakov 2020-06-03 14:23:01 UTC
Hi, Tyson!

The Auto patch is still not merged. The outline fix was necessary for it.
Comment 25 Tyson Tan 2020-06-03 14:37:30 UTC
(In reply to Dmitry Kazakov from comment #24)
> Hi, Tyson!
> 
> The Auto patch is still not merged. The outline fix was necessary for it.

OK I'll wait. But 4.3.0 beta 2 is actually steadily Auto(D3D). I don't know why.
Comment 26 Emmet O'Neill 2020-06-04 20:57:17 UTC
Git commit e1b2bd037a408d90c7e505c4dc15514fc3d4151b by Emmet O'Neill.
Committed on 04/06/2020 at 20:52.
Pushed by emmetoneill into branch 'krita/4.3'.

Created a shader for drawing brush tool outline.

Made a new GLSL shader for drawing the brush tool's preview outline.
To do so, an adjustment to Krita's render pipeline was made:
On platforms where render to texture (FBO) is supported, the canvas is
now rendered to an intermediate texture which is used as a uniform input
in the outline shader (and possibly other overlays in the future).
Coded with Eoin O'Neill.

A  +10   -0    krita/data/shaders/overlay_inverted.frag
M  +1    -0    krita/data/shaders/shaders.qrc
M  +2    -2    libs/global/kis_algebra_2d.cpp
M  +1    -0    libs/ui/opengl/KisOpenGLModeProber.cpp
M  +5    -0    libs/ui/opengl/KisOpenGLModeProber.h
M  +6    -0    libs/ui/opengl/kis_opengl.cpp
M  +9    -0    libs/ui/opengl/kis_opengl.h
M  +98   -41   libs/ui/opengl/kis_opengl_canvas2.cpp
M  +1    -0    libs/ui/opengl/kis_opengl_canvas2.h
M  +18   -0    libs/ui/opengl/kis_opengl_shader_loader.cpp
M  +1    -0    libs/ui/opengl/kis_opengl_shader_loader.h

https://invent.kde.org/graphics/krita/commit/e1b2bd037a408d90c7e505c4dc15514fc3d4151b
Comment 27 Dmitry Kazakov 2020-06-09 08:46:16 UTC
Git commit 00fb1483ef4211b9ccce22d586124497962c32e1 by Dmitry Kazakov.
Committed on 09/06/2020 at 08:29.
Pushed by dkazakov into branch 'master'.

Make Angle preferred renderer on Windows

This patch bascially overrides Qt's choice of preferred renderer

M  +11   -2    libs/ui/opengl/kis_opengl.cpp

https://invent.kde.org/graphics/krita/commit/00fb1483ef4211b9ccce22d586124497962c32e1
Comment 28 Dmitry Kazakov 2020-06-09 08:52:55 UTC
Okay, Angle is now default on Windows. And thanks to Emmet's patch there is no outline problem with it anymore :)

The bug can be closed :)
Comment 29 Dmitry Kazakov 2020-06-09 09:06:27 UTC
Git commit 3db45943202b7bb5a6dff92f18b77cb417733700 by Dmitry Kazakov.
Committed on 09/06/2020 at 08:47.
Pushed by dkazakov into branch 'krita/4.3'.

Make Angle preferred renderer on Windows

This patch bascially overrides Qt's choice of preferred renderer

M  +11   -2    libs/ui/opengl/kis_opengl.cpp

https://invent.kde.org/graphics/krita/commit/3db45943202b7bb5a6dff92f18b77cb417733700
Comment 30 Tyson Tan 2020-06-09 11:12:52 UTC
Yay! Thank you Emmet and Dmitry! :D