WebGL between Clickable Templates
-
Skipable preamble: I'm back to trying to port some flutter apps, everything is working fine and I'm ready to publish them, except for one thing: WebGL. My apps are running really slow (yes they are all just local webapps), but if I try them on the morph browser, its suddenly smooth. Well clearly this is the reason:
To test, I've created 3 simple clickable applications using; (from left to right) CPP template, (second is just regular morph browser), GO template and QML Only template.
I added 'import QtWebEngine 1.10', and pointed them all to the same website with WebEngineView: https://webglreport.com/
Result: Only the 'QML Only' template has WebGL.
What can I do to give my C++ apps WebGL? How does Morph do it?
Appreciate any help. Thank you
p.s. I've tried adding 'settings.webGLEnabled: true', doesnt help.
p.p.s I'm running UT 20.04 OTA-2 on a Pixel 3a
-
I'm really just guessing here but do you happen to modify the value of
QTWEBENGINE_CHROMIUM_FLAGS
? And if yes, did you override it or appended new flags? -
@kugiigi Appreciate the help, looks like you were right, sort of...
Changing the URL to "chrome://gpu" shows the command line used to open chromium which contains "--disable-gpu" at the end.Like you said, I am able to add arguments to the command line by adding this line to the main.cpp (proved to be working in "chrome://gpu"):
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--ignore-gpu-blacklist");
(btw the ignore flag does nothing)
But I can't seem to remove the existing arguments...I've tried doing a
grep -r "disable-gpu"
to no avail, and tried printing all environment variables and have found nothing.How do I remove the flag!? Where does it come from? Is there anyway to override a flag with another?
Thank you.
-
@ari I don't really know where the default flags are set. For example, some flags are different for some devices like for example to disable webgl in some. Ideally, you should just append your flags like this
https://gitlab.com/kugiigi1/sapot-browser/-/blob/ubports/xenial/src/app/webbrowser/morph-browser.cpp?ref_type=heads#L176 -
Unfortunately, what I need is not to append flags, but to remove the existing ones which I can't find any way to do.
I can do the following in my main.cpp file:
qDebug() << qgetenv("QTWEBENGINE_CHROMIUM_FLAGS"); qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--anything-i-want");
But the output from the getenv is just "", so I'm not sure where its getting the flags from.
The addition of the chromium flag is indeed working, but the final command line shown by chrome://gpu is this: (which includes the --disable-gpu at the end)
webglcpptest --anything-i-want --browser-subprocess-path=/usr/lib/x86_64-linux-gnu/qt5/libexec/QtWebEngineProcess --application-name=webglcpptest.red --no-sandbox --enable-threaded-compositing --disable-speech-api --enable-features=AllowContentInitiatedDataUrlNavigations,NetworkServiceInProcess,TracingServiceInProcess --disable-features=MojoVideoCapture,FontSrcLocalMatching,UseSkiaRenderer,DnsOverHttpsUpgrade,ConsolidatedMovementXY,InstalledApp,BackgroundFetch,SmsReceiver,WebPayments,WebUSB,PictureInPicture --disable-gpu
It doesn't seem possible to override the existing flag with another, I've tried things like --disable-gpu=false and so on, I've tried finding a way to comment out the rest of the flags, even tried a buffer overflow to get rid of the last flag...
So I have to find where the flags are coming from and remove them.
-