Changed: Support for WGL_NV_gpu_affinity extension

This commit is contained in:
kervala 2015-11-09 10:00:05 +01:00
parent 7c2f8d8704
commit 8da853f508
2 changed files with 60 additions and 1 deletions

View file

@ -519,6 +519,14 @@ PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC nwglMakeAssociatedContextCurrentAMD;
PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD; PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD;
PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD; PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD;
// WGL_NV_gpu_affinity
//====================
PFNWGLENUMGPUSNVPROC nwglEnumGpusNV;
PFNWGLENUMGPUDEVICESNVPROC nwglEnumGpuDevicesNV;
PFNWGLCREATEAFFINITYDCNVPROC nwglCreateAffinityDCNV;
PFNWGLENUMGPUSFROMAFFINITYDCNVPROC nwglEnumGpusFromAffinityDCNV;
PFNWGLDELETEDCNVPROC nwglDeleteDCNV;
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
#elif defined(NL_OS_UNIX) #elif defined(NL_OS_UNIX)
@ -1846,7 +1854,23 @@ static bool setupWGLAMDGPUAssociation(const char *glext)
return true; return true;
} }
// ********************************* // ***************************************************************************
static bool setupWGLNVGPUAssociation(const char *glext)
{
H_AUTO_OGL(setupWGLNVGPUAssociation);
CHECK_EXT("WGL_NV_gpu_affinity");
#if !defined(USE_OPENGLES) && defined(NL_OS_WINDOWS)
CHECK_ADDRESS(PFNWGLENUMGPUSNVPROC, wglEnumGpusNV);
CHECK_ADDRESS(PFNWGLENUMGPUDEVICESNVPROC, wglEnumGpuDevicesNV);
CHECK_ADDRESS(PFNWGLCREATEAFFINITYDCNVPROC, wglCreateAffinityDCNV);
CHECK_ADDRESS(PFNWGLENUMGPUSFROMAFFINITYDCNVPROC, wglEnumGpusFromAffinityDCNV);
CHECK_ADDRESS(PFNWGLDELETEDCNVPROC, wglDeleteDCNV);
#endif
return true;
}
static bool setupGLXEXTSwapControl(const char *glext) static bool setupGLXEXTSwapControl(const char *glext)
{ {
H_AUTO_OGL(setupGLXEXTSwapControl); H_AUTO_OGL(setupGLXEXTSwapControl);
@ -1972,6 +1996,31 @@ bool registerWGlExtensions(CGlExtensions &ext, HDC hDC)
delete [] uGPUIDs; delete [] uGPUIDs;
} }
ext.WGLNVGPUAffinity = setupWGLNVGPUAssociation(glext);
if (ext.WGLNVGPUAffinity)
{
uint i = 0;
HGPUNV hGPU;
while(nwglEnumGpusNV(i, &hGPU))
{
uint j = 0;
PGPU_DEVICE lpGpuDevice = NULL;
while(nwglEnumGpuDevicesNV(hGPU, j, lpGpuDevice))
{
nlinfo("Device: %s - %s - flags: %u", lpGpuDevice->DeviceName, lpGpuDevice->DeviceString, lpGpuDevice->Flags);
++j;
}
++i;
}
}
return true; return true;
} }
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)

View file

@ -123,6 +123,9 @@ struct CGlExtensions
// WGL_AMD_gpu_association // WGL_AMD_gpu_association
bool WGLAMDGPUAssociation; bool WGLAMDGPUAssociation;
// WGL_NV_gpu_affinity
bool WGLNVGPUAffinity;
public: public:
/// \name Disable Hardware feature. False by default. setuped by IDriver /// \name Disable Hardware feature. False by default. setuped by IDriver
@ -793,6 +796,13 @@ extern PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC nwglMakeAssociatedContextCurren
extern PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD; extern PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD;
extern PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD; extern PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD;
// WGL_NV_gpu_affinity
//====================
extern PFNWGLENUMGPUSNVPROC nwglEnumGpusNV;
extern PFNWGLENUMGPUDEVICESNVPROC nwglEnumGpuDevicesNV;
extern PFNWGLCREATEAFFINITYDCNVPROC nwglCreateAffinityDCNV;
extern PFNWGLENUMGPUSFROMAFFINITYDCNVPROC nwglEnumGpusFromAffinityDCNV;
extern PFNWGLDELETEDCNVPROC nwglDeleteDCNV;
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
#elif defined(NL_OS_UNIX) #elif defined(NL_OS_UNIX)