Closed chubinou closed 2 years ago
@chubinou
Hello.
How do you enable Direct3D in the test application.
Application always uses OpenGL on my machine even if I try to enforce using Direct3D with QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11);
just changing the QQuickWindow::setGraphicsApi works for me
I start QuickVLC-Example using this script (nothing fancy just fixing path)
set PATH=%PATH%;C:\Users\Intel-VCSE-9\Downloads\nighly\vlc-4.0.0-dev
set PATH=%PATH%;C:\Users\Intel-VCSE-9\Downloads\mediagun\install\bin
set QML2_IMPORT_PATH=C:\Users\Intel-VCSE-9\Downloads\mediagun\install\qml
QuickVlcExample.exe %*
in the console I can see
qt.scenegraph.general: Using QRhi with backend D3D11
when using D3D backend, and
qt.scenegraph.general: Using QRhi with backend OpenGL
when starting with OpenGL
I used Qt version 6.3.1, downloaded using Qt installer
Strange. I tried the code in our application:
#ifdef Q_OS_WIN
QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11);
#else
// this important so we can call makeCurrent from our rendering thread
QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
#endif
And it uses OpenGL anyway...
By default Qt6 on windows uses the D3D11 backend, so I guess you are setting something that force the OpenGL. maybe the QSG_RHI_BACKEND environment variable
Note: The call to the function must happen before constructing the first QQuickWindow in the application. The graphics API cannot be changed afterwards.
are you making the call early enough?
also are you using a QQuickWindow/QQuickView or are you rendering the scene using alternative methods (QQuickWidget, QQuickRenderControl)
Sure. We are using QQuickWindow.
And QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11);
is the first line in the main()
function.
Need to have some debugging session on Windows.
hum, OK, how do you know it's not using D3D11. Do you have logs? what did you trace?
what version of Qt do you use?
I can't really guess more without more information.
Sorry. I was not working on project for a couple of time. Qt version 6.3.2 I'll have deeper debug session soon. After that I'll be back with some logs.
Little update. Will hard work after 11/21
Hi, here is a first implementation of D3D support.
You will notice that I had to do quite some changes in your architecture to be able to support 2 backends.
Notably, I remove the use of a custom shader to directly use QSGSimpleTexture along with QSG native texture wrapper provided in Qt6. I didn't really see the need of a custom shader but maybe I missed something.
there are still some rough edges to polish but this first version should work for most cases.
in order to test my patch I use the following modifications in QuickVLC-exemples
feedbacks are welcomed
fix #6