[Interest] QtQuick on desktop cannot select from available GPUs.

Nuno Santos nuno.santos at imaginando.pt
Fri May 6 13:34:32 CEST 2022


Hi,

I don’t think you will ever be able to do it from Qt. I might be wrong though….

On Windows, you need to use Windows to set that preference: https://www.itechtics.com/use-specific-gpu/ <https://www.itechtics.com/use-specific-gpu/>

There is another possible way which is setting a piece of code which will do the trick:

#ifdef Q_OS_WIN
extern "C"
{
    __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; // for NVIDIA
}

extern "C"
{
    __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; // for AMD
}
#endif

Since you have an AMD and a NVIDIA, I don’t know how it will behave in that case… :/

Best regards,

Nuno

> On 6 May 2022, at 04:33, 乔燊 <1500013714 at pku.edu.cn> wrote:
> 
> It seems that there are no appropriate functions that can set the GPU used by QQuickWindow/QQuickView.
> 
> 
> 
> I'm using qt6.3 on windows11. I have two graphics card on my laptop:
> 
> 
> Device name: AMD Radeon(TM) Graphics
> Device type: integrated
> Device name: NVIDIA GeForce RTX 3060 Laptop GPU
> Device type: discrete
> I tried to use vulkan by calling QQuickView::setGraphicsApi, but found nowhere to set GPU to use. Meanwhile the widget class QVulkanWindow gives us a convenient function QVulkanWindow::setPhysicalDeviceIndex for doing this. 
> 
> 
> 
> Perhaps the setting up with class QQuickRenderControl is possible, but there is too much stuff to take care of for merely selecting a GPU device. I thought it would be a common demand for all desktop developer, not only those using Vulkan.
> 
> 
> 
> Is there any plan on adding related function to select from GPUs? Or maybe there is another already-exist solution for that?
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220506/dc59cd60/attachment.htm>


More information about the Interest mailing list