Skip to content

Conversation

adrian-kong
Copy link
Contributor

after long and hard testing...
it seems...

RHI backend defaults to directx and metal for win, mac respectively, we need to assign it as opengl manually or it wont work.

this simply enables opengl functionality, tested working for mac,

cargo make run --use-opengl

does not resolve these issues in the log...

QOpenGLFramebufferObject: Framebuffer incomplete attachment.
QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.

@adrian-kong adrian-kong requested review from a team and john-michaelburke October 31, 2022 05:04
@john-michaelburke
Copy link
Collaborator

We may want to gate this on only non-windows machines because I think we hardcode this environment to get rid of some weird artifacts that were appearing in windows. That being said, this was probably the case for PySide2 i.e. Qt5. I'm not sure if this is easily reproducible though maybe @silverjam could test this out on his lower-end machine. Another idea would be to just comment out the logic and uncomment if the issue re-arises 🤷

std::env::set_var("QSG_RHI", "1");

Also interesting these are different env variables.

@john-michaelburke
Copy link
Collaborator

I found an extremely verbose unofficial? description of the various configurations:
https://flir.custhelp.com/ci/fattach/get/247964/0/filename/Extra+graphics+vars.txt

If setting QSG_RHI=1 still results in glitches, see below for alternative graphics configurations.

Note that you can set QSG_INFO=1 to see what renderer is used.  This will add a few lines to the log file

QSG_RHI may be not set to use the default or 1.
QSG_RHI_BACKEND may be not set to use the default, vulkan, metal, opengl, or d3d11.
QT_QUICK_BACKEND may be not set to use the default (OpenGL), software, or d3d12.
QT_OPENGL may be desktop, software, or angle.
QT_ANGLE_PLATFORM may be d3d11, d3d9, or warp.

Exactly what combination of settings works best for you depends on your graphics card.
Note: you can make sure an environment variable isn’t set by having the name and equal sign but no value.

To force use desktop OpenGL:
set QSG_RHI=
set QT_QUICK_BACKEND=
set QT_OPENGL=desktop

To force use OpenGL via ANGLE with the default platform (typically d3d11):
set QSG_RHI=
set QT_QUICK_BACKEND=
set QT_OPENGL=desktop
set QT_ANGLE_PLATFORM=

To force use OpenGL via ANGLE on top of d3d11:
set QSG_RHI=
set QT_QUICK_BACKEND=
set QT_OPENGL=desktop
set QT_ANGLE_PLATFORM=d3d11

To force use OpenGL via ANGLE on top of d3d9:
set QSG_RHI=
set QT_QUICK_BACKEND=
set QT_OPENGL=desktop
set QT_ANGLE_PLATFORM=d3d9

To force use OpenGL via ANGLE on top of d3d’s software renderer:
set QSG_RHI=
set QT_QUICK_BACKEND=
set QT_OPENGL=desktop
set QT_ANGLE_PLATFORM=warp

To force use software OpenGL:
set QSG_RHI=
set QT_QUICK_BACKEND=
set QT_OPENGL=software

Note that the software OpenGL backend won’t work unless you also have opengl32sw.dll which we do not distribute because it’s large and the software backend has poor performance.

To force use Qt’s software renderer:
set QSG_RHI=
set QT_QUICK_BACKEND=software

Note that software rendering is slower and has its own set of glitches.

To force use Qt’s d2d12 renderer:
set QSG_RHI=
set QT_QUICK_BACKEND=d3d12

Note that the d3d12 renderer requires a somewhat recent graphics card as d3d12 was released in 2016.  Qt also lists this renderer as experimental.

To force use Qt’s new renderer with the default API:
set QSG_RHI=1
set QSG_RHI_BACKEND=

To force use Qt’s new d3d11 renderer:
set QSG_RHI=1
set QSG_RHI_BACKEND=d3d11

To force use Qt’s new vulkan renderer:
set QSG_RHI=1
set QSG_RHI_BACKEND=vulkan

Note that this will probably not work, you’re better off using d3d11 on Windows.

To force use Qt’s new metal renderer:
set QSG_RHI=1
set QSG_RHI_BACKEND=metal

Note that this only applies to macOS.

To force use Qt’s new opengl renderer:
set QSG_RHI=1
set QSG_RHI_BACKEND=opengl

Note that this also uses the QT_OPENGL and QT_ANGLE_PLATFORM environment variables, so not all of the combinations are listed here.  Even though this uses OpenGL it is different from setting QSG_RHI= and QT_QUICK_BACKEND= because it goes through RHI instead of sitting on top of OpenGL directly.

I'm sure @keithel-qt may have some insight.

@keithel-qt
Copy link
Contributor

What is the goal here?

@adrian-kong
Copy link
Contributor Author

What is the goal here?

it seems like the --use-opengl doesn't render anything on charts without this line - (tested on mac)

Copy link
Contributor

@silverjam silverjam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adrian-kong this is good to ship

@adrian-kong adrian-kong merged commit 32cc5b9 into main Nov 2, 2022
@adrian-kong adrian-kong deleted the adrian/opengl branch November 2, 2022 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants