Qt World Summit: Submit your Presentation

Forcing the use of a graphics card in Qt.

  • I'm currently working with a computer with 2 GPUs where one is integrated and I'm using some OpenGL functionality which the main integrated GPU doesn't like much and so I have to ensure I'm running using the appropriate GPU beforehand.

    I know that libraries such as OpenCL and Vulkan have functionality to check if the GPUs are suitable to perform some tasks.

    Vulkan, for instance, has 'vkEnumeratePhysicalDevices' for finding devices and 'vkEnumerateDeviceExtensionProperties' for finding their properties.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    AFAIK, Qt doesn't provide that kind of fine grained control.

    What platform are you on ?

  • @SGaist said in Forcing the use of a graphics card in Qt.:

    Hi and welcome to devnet,

    Thanks for the welcome

    AFAIK, Qt doesn't provide that kind of fine grained control.

    That's unfortunate.

    What platform are you on?

    Windows, building on 32bit, using Qt Creator

  • Moderators

    AFAIK vanilla OpenGL does not have this functionality. It's usually something that the driver decides, commonly by examining the monitor the window is shown on and checking which GPU is associated with it.

    There are however vendor specific extensions that let you enumerate and choose device for context creation, e.g. for Windows you have WGL_NV_gpu_affinity or WGL_AMD_gpu_association.

  • For NVidia:

    • Go to the driver icon in the tool bar (lower right near clock).
    • Click the "show hidden icons".
    • Open NVidia control panel.
    • Select Manage 3D Settings on the left menu
    • In Global settings select "preferred graphics processor". Choose the appropriate processor.
    • Use the Program Settings tab and choose the "exe" (your executable) and select the preferences there.

    I don't know of any programmatic way to do this. Maybe the vendors have something, but it will probably be specific to the hardware. Just like the above instructions. I hope AMD and other vendors have a similar selection system to choose their GPU.

    I know that NVidia has a list of programs that they put on that list to use the high performance GPUs. You may be able to at some point request your program be on that list. I believe this list is shipped with the drivers.

Log in to reply