Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: NVidia GPU affinity example?

  1. #1
    Junior Member Regular Contributor
    Join Date
    Mar 2009
    Seattle, WA

    NVidia GPU affinity example?

    I'm trying to find an example that detects an Intel integrated graphics chip and chooses the NVidia card, in laptops that have both. I can only find a lot of people talking *about* the extension, but no actual examples of it in use.

    I am trying this code to show the GPU names but I get an "unhandled exception" error on the call to wglEnumGpusNV(). This is on a GEForce 480 with the latest driver:
    Code :
            //NVidia GPU affinity
            #define MAX_GPU 4
            int pf=0;
            int gpuIndex = 0;
            HGPUNV hGPU[MAX_GPU];
            HGPUNV GpuMask[MAX_GPU];
            HDC affDC;
            HGLRC affRC;
            PGPU_DEVICE lpGpuDevice = new GPU_DEVICE;
            while ((gpuIndex < MAX_GPU) && wglEnumGpusNV(gpuIndex, &hGPU[gpuIndex]))
                int iDeviceIndex=0;
                while (wglEnumGpuDevicesNV(hGPU[gpuIndex],iDeviceIndex,lpGpuDevice))

    Last edited by JoshKlint; 07-02-2013 at 01:37 PM.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Sorry if this is obvious, but neither your code snippet nor your post mention it, so: Have you checked if the extension if available on your context (using wglGetExtensionsString) and have you obtained the extension function pointer (using wglGetProcAddress)?

  3. #3
    Junior Member Newbie Timinator's Avatar
    Join Date
    Mar 2001
    GPU Affinity is only supported on Quadro cards.

  4. #4

  5. #5
    Junior Member Newbie
    Join Date
    Jul 2013
    Don't know if you have already seen this article in geeks3d:

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    For forcing NVIDIA Optimus laptops to always use the NVIDIA card for your program, see the following PDF:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts