Merge with develop
This commit is contained in:
parent
d3d28c4756
commit
898ae96533
7 changed files with 1070 additions and 60 deletions
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2014 The Khronos Group Inc.
|
||||
** Copyright (c) 2013-2015 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
|
@ -33,10 +33,10 @@ extern "C" {
|
|||
** used to make the header, and the header can be found at
|
||||
** http://www.opengl.org/registry/
|
||||
**
|
||||
** Khronos $Revision: 26290 $ on $Date: 2014-04-16 05:35:38 -0700 (Wed, 16 Apr 2014) $
|
||||
** Khronos $Revision: 31597 $ on $Date: 2015-06-25 16:32:35 -0400 (Thu, 25 Jun 2015) $
|
||||
*/
|
||||
|
||||
#define GLX_GLXEXT_VERSION 20140416
|
||||
#define GLX_GLXEXT_VERSION 20150623
|
||||
|
||||
/* Generated C header for:
|
||||
* API: glx
|
||||
|
@ -158,6 +158,13 @@ __GLXextFuncPtr glXGetProcAddress (const GLubyte *procName);
|
|||
#endif
|
||||
#endif /* GLX_VERSION_1_4 */
|
||||
|
||||
#ifndef GLX_ARB_context_flush_control
|
||||
#define GLX_ARB_context_flush_control 1
|
||||
#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
|
||||
#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
|
||||
#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
|
||||
#endif /* GLX_ARB_context_flush_control */
|
||||
|
||||
#ifndef GLX_ARB_create_context
|
||||
#define GLX_ARB_create_context 1
|
||||
#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
|
@ -243,6 +250,26 @@ __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
|
|||
#define GLX_GPU_NUM_SIMD_AMD 0x21A6
|
||||
#define GLX_GPU_NUM_RB_AMD 0x21A7
|
||||
#define GLX_GPU_NUM_SPI_AMD 0x21A8
|
||||
typedef unsigned int ( *PFNGLXGETGPUIDSAMDPROC) (unsigned int maxCount, unsigned int *ids);
|
||||
typedef int ( *PFNGLXGETGPUINFOAMDPROC) (unsigned int id, int property, GLenum dataType, unsigned int size, void *data);
|
||||
typedef unsigned int ( *PFNGLXGETCONTEXTGPUIDAMDPROC) (GLXContext ctx);
|
||||
typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC) (unsigned int id, GLXContext share_list);
|
||||
typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (unsigned int id, GLXContext share_context, const int *attribList);
|
||||
typedef Bool ( *PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC) (GLXContext ctx);
|
||||
typedef Bool ( *PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx);
|
||||
typedef GLXContext ( *PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
|
||||
typedef void ( *PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC) (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
unsigned int glXGetGPUIDsAMD (unsigned int maxCount, unsigned int *ids);
|
||||
int glXGetGPUInfoAMD (unsigned int id, int property, GLenum dataType, unsigned int size, void *data);
|
||||
unsigned int glXGetContextGPUIDAMD (GLXContext ctx);
|
||||
GLXContext glXCreateAssociatedContextAMD (unsigned int id, GLXContext share_list);
|
||||
GLXContext glXCreateAssociatedContextAttribsAMD (unsigned int id, GLXContext share_context, const int *attribList);
|
||||
Bool glXDeleteAssociatedContextAMD (GLXContext ctx);
|
||||
Bool glXMakeAssociatedContextCurrentAMD (GLXContext ctx);
|
||||
GLXContext glXGetCurrentAssociatedContextAMD (void);
|
||||
void glXBlitContextFramebufferAMD (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
#endif /* GLX_AMD_gpu_association */
|
||||
|
||||
#ifndef GLX_EXT_buffer_age
|
||||
|
@ -468,6 +495,16 @@ Bool glXSet3DfxModeMESA (int mode);
|
|||
#endif
|
||||
#endif /* GLX_MESA_set_3dfx_mode */
|
||||
|
||||
#ifndef GLX_NV_copy_buffer
|
||||
#define GLX_NV_copy_buffer 1
|
||||
typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
||||
typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
void glXCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
||||
void glXNamedCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
||||
#endif
|
||||
#endif /* GLX_NV_copy_buffer */
|
||||
|
||||
#ifndef GLX_NV_copy_image
|
||||
#define GLX_NV_copy_image 1
|
||||
typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
|
@ -544,8 +581,8 @@ void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV devic
|
|||
#endif
|
||||
#endif /* GLX_NV_video_capture */
|
||||
|
||||
#ifndef GLX_NV_video_output
|
||||
#define GLX_NV_video_output 1
|
||||
#ifndef GLX_NV_video_out
|
||||
#define GLX_NV_video_out 1
|
||||
typedef unsigned int GLXVideoDeviceNV;
|
||||
#define GLX_VIDEO_OUT_COLOR_NV 0x20C3
|
||||
#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4
|
||||
|
@ -571,7 +608,7 @@ int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf);
|
|||
int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
|
||||
int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif
|
||||
#endif /* GLX_NV_video_output */
|
||||
#endif /* GLX_NV_video_out */
|
||||
|
||||
#ifndef GLX_OML_swap_method
|
||||
#define GLX_OML_swap_method 1
|
||||
|
|
|
@ -6,7 +6,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2014 The Khronos Group Inc.
|
||||
** Copyright (c) 2013-2015 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
|
@ -33,7 +33,7 @@ extern "C" {
|
|||
** used to make the header, and the header can be found at
|
||||
** http://www.opengl.org/registry/
|
||||
**
|
||||
** Khronos $Revision: 26290 $ on $Date: 2014-04-16 05:35:38 -0700 (Wed, 16 Apr 2014) $
|
||||
** Khronos $Revision: 31597 $ on $Date: 2015-06-25 16:32:35 -0400 (Thu, 25 Jun 2015) $
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
|
@ -41,7 +41,7 @@ extern "C" {
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define WGL_WGLEXT_VERSION 20140416
|
||||
#define WGL_WGLEXT_VERSION 20150623
|
||||
|
||||
/* Generated C header for:
|
||||
* API: wgl
|
||||
|
@ -70,6 +70,13 @@ BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width,
|
|||
#endif
|
||||
#endif /* WGL_ARB_buffer_region */
|
||||
|
||||
#ifndef WGL_ARB_context_flush_control
|
||||
#define WGL_ARB_context_flush_control 1
|
||||
#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
|
||||
#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
|
||||
#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
|
||||
#endif /* WGL_ARB_context_flush_control */
|
||||
|
||||
#ifndef WGL_ARB_create_context
|
||||
#define WGL_ARB_create_context 1
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
|
|
|
@ -519,6 +519,14 @@ PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC nwglMakeAssociatedContextCurrentAMD;
|
|||
PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD;
|
||||
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_UNIX)
|
||||
|
||||
|
@ -1553,12 +1561,20 @@ static bool setupATIMeminfo(const char *glext)
|
|||
void registerGlExtensions(CGlExtensions &ext)
|
||||
{
|
||||
H_AUTO_OGL(registerGlExtensions);
|
||||
|
||||
// OpenGL 1.2 ??
|
||||
const char *nglVersion= (const char *)glGetString (GL_VERSION);
|
||||
sint a=0, b=0;
|
||||
|
||||
// 1.2*** ???
|
||||
sscanf(nglVersion, "%d.%d", &a, &b);
|
||||
ext.Version1_2= (a==1 && b>=2) || (a>=2);
|
||||
ext.Version1_2 = (a==1 && b>=2) || (a>=2);
|
||||
|
||||
const char *vendor = (const char *) glGetString (GL_VENDOR);
|
||||
const char *renderer = (const char *) glGetString (GL_RENDERER);
|
||||
|
||||
// Log GPU details
|
||||
nlinfo("3D: OpenGL %s / %s / %s", nglVersion, vendor, renderer);
|
||||
|
||||
// Extensions.
|
||||
const char *glext= (const char*)glGetString(GL_EXTENSIONS);
|
||||
|
@ -1846,7 +1862,23 @@ static bool setupWGLAMDGPUAssociation(const char *glext)
|
|||
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)
|
||||
{
|
||||
H_AUTO_OGL(setupGLXEXTSwapControl);
|
||||
|
@ -1972,6 +2004,31 @@ bool registerWGlExtensions(CGlExtensions &ext, HDC hDC)
|
|||
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;
|
||||
}
|
||||
#elif defined(NL_OS_MAC)
|
||||
|
|
|
@ -123,6 +123,9 @@ struct CGlExtensions
|
|||
// WGL_AMD_gpu_association
|
||||
bool WGLAMDGPUAssociation;
|
||||
|
||||
// WGL_NV_gpu_affinity
|
||||
bool WGLNVGPUAffinity;
|
||||
|
||||
public:
|
||||
|
||||
/// \name Disable Hardware feature. False by default. setuped by IDriver
|
||||
|
@ -793,6 +796,13 @@ extern PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC nwglMakeAssociatedContextCurren
|
|||
extern PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD;
|
||||
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_UNIX)
|
||||
|
|
|
@ -105,5 +105,6 @@
|
|||
#define NL_MAC_VERSION_10_6_UP
|
||||
#else
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -121,6 +121,12 @@ static void sigHandler(int Sig)
|
|||
//---------------------------------------------------
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
// enable optimus for NVIDIA cards
|
||||
extern "C"
|
||||
{
|
||||
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
}
|
||||
|
||||
void pump ()
|
||||
{
|
||||
// Display the window
|
||||
|
|
Loading…
Reference in a new issue