summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/GL/glh_extensions.h211
-rw-r--r--indra/llwindow/GL/glh_genext.h1674
-rw-r--r--indra/llwindow/llopenglview-objc.mm3
-rw-r--r--indra/llwindow/llwindow.cpp18
-rw-r--r--indra/llwindow/llwindow.h28
-rw-r--r--indra/llwindow/llwindowheadless.cpp2
-rw-r--r--indra/llwindow/llwindowheadless.h15
-rw-r--r--indra/llwindow/llwindowmacosx.cpp65
-rw-r--r--indra/llwindow/llwindowmacosx.h150
-rw-r--r--indra/llwindow/llwindowwin32.cpp3191
-rw-r--r--indra/llwindow/llwindowwin32.h44
11 files changed, 1943 insertions, 3458 deletions
diff --git a/indra/llwindow/GL/glh_extensions.h b/indra/llwindow/GL/glh_extensions.h
deleted file mode 100644
index 554cb1731f..0000000000
--- a/indra/llwindow/GL/glh_extensions.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * glh_extensions.h
- * $LicenseInfo:firstyear=2006&license=mit$ (mit used here to satisfy validity checker)
- * Copyright (C) 2006, NVIDIA
- * From nVidia Corporation, downloaded 2006-12-18 from:
- * http://developer.nvidia.com/attach/8196
- * ("NVParse Library with Source (.zip) (2390 KB)")
- *
- * License (quoted from license_info.txt in aforementioned file):
- * "The files bison.exe, bison.simple, and flex.exe are covered by
- * the GPL. All other files in this distribution can be used however
- * you want."
- * $/LicenseInfo$
-
- */
-
-#ifndef GLH_EXTENSIONS
-#define GLH_EXTENSIONS
-
-#include <string.h>
-#include <stdio.h>
-
-#ifdef _WIN32
-# include <windows.h>
-#endif
-
-#ifndef __APPLE__
-#include <GL/gl.h>
-#endif
-
-#ifdef _WIN32
-# include "GL/wglext.h"
-#endif
-
-#define CHECK_MEMORY(ptr) \
- if (NULL == ptr) { \
- printf("Error allocating memory in file %s, line %d\n", __FILE__, __LINE__); \
- exit(-1); \
- }
-
-#ifdef GLH_EXT_SINGLE_FILE
-# define GLH_EXTENSIONS_SINGLE_FILE // have to do this because glh_genext.h unsets GLH_EXT_SINGLE_FILE
-#endif
-
-#include "glh_genext.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef GLH_EXTENSIONS_SINGLE_FILE
-
-class GLHExts
-{
-public:
- GLHExts()
- {
- mSysExts = NULL;
-// mUnsupportedExts = NULL;
- }
- ~GLHExts()
- {
- if (mSysExts)
- {
- free(mSysExts);
- }
-// if (mUnsupportedExts)
-// {
-// free(mUnsupportedExts);
-// }
- }
- char *mSysExts;
-// char *mUnsupportedExts;
-};
-
-GLHExts gGLHExts;
-
-static int ExtensionExists(const char* extName, const char* sysExts)
-{
- char *padExtName = (char*)malloc(strlen(extName) + 2);
- strcat(strcpy(padExtName, extName), " ");
-
- if (0 == strcmp(extName, "GL_VERSION_1_2")) {
- const char *version = (const char*)glGetString(GL_VERSION);
- if (strstr(version, "1.0") == version || strstr(version, "1.1") == version) {
- return FALSE;
- } else {
- return TRUE;
- }
- }
- if (strstr(sysExts, padExtName)) {
- free(padExtName);
- return TRUE;
- } else {
- free(padExtName);
- return FALSE;
- }
-}
-
-static const char* EatWhiteSpace(const char *str)
-{
- for (; *str && (' ' == *str || '\t' == *str || '\n' == *str); str++);
- return str;
-}
-
-static const char* EatNonWhiteSpace(const char *str)
-{
- for (; *str && (' ' != *str && '\t' != *str && '\n' != *str); str++);
- return str;
-}
-
-
-int glh_init_extensions(const char *origReqExts)
-{
- // Length of requested extensions string
- //unsigned reqExtsLen;
- char *reqExts;
- // Ptr for individual extensions within reqExts
- char *reqExt;
- int success = TRUE;
-
- // build space-padded extension string
- if (NULL == gGLHExts.mSysExts) {
- const char *extensions = (const char*)glGetString(GL_EXTENSIONS);
- int sysExtsLen = (int)strlen(extensions);
- const char *winsys_extensions = 0;
- int winsysExtsLen = 0;
-#ifdef _WIN32
- {
- PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = 0;
- wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
- if(wglGetExtensionsStringARB)
- {
- winsys_extensions = wglGetExtensionsStringARB(wglGetCurrentDC());
- winsysExtsLen = (S32)strlen(winsys_extensions);
- }
- }
-#endif
- // Add 2 bytes, one for padding space, one for terminating NULL
- gGLHExts.mSysExts = (char*)malloc(sysExtsLen + winsysExtsLen + 3);
- CHECK_MEMORY(gGLHExts.mSysExts);
- strcpy(gGLHExts.mSysExts, extensions);
- gGLHExts.mSysExts[sysExtsLen] = ' ';
- gGLHExts.mSysExts[sysExtsLen + 1] = 0;
- if (winsysExtsLen)
- {
- strcat(gGLHExts.mSysExts, winsys_extensions);
- }
- gGLHExts.mSysExts[sysExtsLen + 1 + winsysExtsLen] = ' ';
- gGLHExts.mSysExts[sysExtsLen + 1 + winsysExtsLen + 1] = 0;
- }
-
- if (NULL == origReqExts)
- {
- return TRUE;
- }
- reqExts = strdup(origReqExts);
- /*
- reqExtsLen = (S32)strlen(reqExts);
- if (NULL == gGLHExts.mUnsupportedExts)
- {
- gGLHExts.mUnsupportedExts = (char*)malloc(reqExtsLen + 1);
- }
- else if (reqExtsLen > strlen(gGLHExts.mUnsupportedExts))
- {
- gGLHExts.mUnsupportedExts = (char*)realloc(gGLHExts.mUnsupportedExts, reqExtsLen + 1);
- }
- CHECK_MEMORY(gGLHExts.mUnsupportedExts);
- *gGLHExts.mUnsupportedExts = 0;
- */
-
- // Parse requested extension list
- for (reqExt = reqExts;
- (reqExt = (char*)EatWhiteSpace(reqExt)) && *reqExt;
- reqExt = (char*)EatNonWhiteSpace(reqExt))
- {
- char *extEnd = (char*)EatNonWhiteSpace(reqExt);
- char saveChar = *extEnd;
- *extEnd = (char)0;
-
- if (!ExtensionExists(reqExt, gGLHExts.mSysExts) ||
- !glh_init_extension(reqExt)) {
- /*
- // add reqExt to end of unsupportedExts
- strcat(gGLHExts.mUnsupportedExts, reqExt);
- strcat(gGLHExts.mUnsupportedExts, " ");
- */
- success = FALSE;
- }
- *extEnd = saveChar;
- }
- free(reqExts);
- return success;
-}
-
-const char* glh_get_unsupported_extensions()
-{
- return "";
-// return (const char*)gGLHExts.mUnsupportedExts;
-}
-
-#else
-int glh_init_extensions(const char *origReqExts);
-const char* glh_get_unsupported_extensions();
-#endif /* GLH_EXT_SINGLE_FILE */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GLH_EXTENSIONS */
diff --git a/indra/llwindow/GL/glh_genext.h b/indra/llwindow/GL/glh_genext.h
deleted file mode 100644
index cd5d1604a8..0000000000
--- a/indra/llwindow/GL/glh_genext.h
+++ /dev/null
@@ -1,1674 +0,0 @@
-/*
- * glh_genext.h
- * $LicenseInfo:firstyear=2008&license=mit$ (mit used here to satisfy validity checker)
- * Copyright (C) 2008, NVIDIA
- * From nVidia Corporation, downloaded 2006-12-18 from:
- * http://developer.nvidia.com/attach/8196
- * ("NVParse Library with Source (.zip) (2390 KB)")
- *
- * License (quoted from license_info.txt in aforementioned file):
- * "The files bison.exe, bison.simple, and flex.exe are covered by
- * the GPL. All other files in this distribution can be used however
- * you want."
- * $/LicenseInfo$
- */
-
-/* File generated by extgen.cpp -- do not modify */
-#ifndef GLH_GENEXT_H
-#define GLH_GENEXT_H
-
-// MBW -- None of this is necessary on Mac OS.
-#ifndef __APPLE__
-
-#include <GL/gl.h>
-#include <GL/glext.h>
-
-#ifdef _WIN32 /* supports windows, x -- need to generalize */
-# include <GL/wglext.h>
-# define GLH_EXT_GET_PROC_ADDRESS(p) wglGetProcAddress(p)
-#else if GLX_VERSION_1_3
-# include <GL/glxext.h>
-# define GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddressARB(p)
-#endif
-
-#ifdef GLH_EXT_SINGLE_FILE
- #define GLH_EXTERN
- #define GLH_INITIALIZER = 0
-#else
- #define GLH_EXTERN extern
- #define GLH_INITIALIZER
-#endif
-
-#define GLH__PREPROCESSOR_GYMNASTICS2(a,b) a##b
-#define GLH__PREPROCESSOR_GYMNASTICS(a,b) GLH__PREPROCESSOR_GYMNASTICS2(a,b)
-
-#ifndef GLH_EXT_PREFIX
-# define GLH_EXT_NAME(a) a
-#else
-# define GLH_EXT_NAME(a) GLH__PREPROCESSOR_GYMNASTICS(GLH_EXT_PREFIX,a)
-#endif
-
-#ifndef _WIN32
-# ifndef GLH_CORE_1_2_PREFIX
-# define GLH_CORE_1_2_PREFIX _
-# endif
-#endif
-
-#ifndef GLH_CORE_1_2_PREFIX
-# define GLH_CORE_1_2_NAME(a) a
-#else
-# define GLH_CORE_1_2_NAME(a) GLH__PREPROCESSOR_GYMNASTICS(GLH_CORE_1_2_PREFIX,a)
-#endif
-
-#ifdef GL_ARB_multitexture
- GLH_EXTERN PFNGLMULTITEXCOORD1DARBPROC GLH_EXT_NAME(glMultiTexCoord1dARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD1DVARBPROC GLH_EXT_NAME(glMultiTexCoord1dvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD1FARBPROC GLH_EXT_NAME(glMultiTexCoord1fARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD1FVARBPROC GLH_EXT_NAME(glMultiTexCoord1fvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD1IARBPROC GLH_EXT_NAME(glMultiTexCoord1iARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD1IVARBPROC GLH_EXT_NAME(glMultiTexCoord1ivARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD1SARBPROC GLH_EXT_NAME(glMultiTexCoord1sARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD1SVARBPROC GLH_EXT_NAME(glMultiTexCoord1svARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD2DARBPROC GLH_EXT_NAME(glMultiTexCoord2dARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD2DVARBPROC GLH_EXT_NAME(glMultiTexCoord2dvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD2FARBPROC GLH_EXT_NAME(glMultiTexCoord2fARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD2FVARBPROC GLH_EXT_NAME(glMultiTexCoord2fvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD2IARBPROC GLH_EXT_NAME(glMultiTexCoord2iARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD2IVARBPROC GLH_EXT_NAME(glMultiTexCoord2ivARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD2SARBPROC GLH_EXT_NAME(glMultiTexCoord2sARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD2SVARBPROC GLH_EXT_NAME(glMultiTexCoord2svARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD3DARBPROC GLH_EXT_NAME(glMultiTexCoord3dARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD3DVARBPROC GLH_EXT_NAME(glMultiTexCoord3dvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD3FARBPROC GLH_EXT_NAME(glMultiTexCoord3fARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD3FVARBPROC GLH_EXT_NAME(glMultiTexCoord3fvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD3IARBPROC GLH_EXT_NAME(glMultiTexCoord3iARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD3IVARBPROC GLH_EXT_NAME(glMultiTexCoord3ivARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD3SARBPROC GLH_EXT_NAME(glMultiTexCoord3sARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD3SVARBPROC GLH_EXT_NAME(glMultiTexCoord3svARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD4DARBPROC GLH_EXT_NAME(glMultiTexCoord4dARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD4DVARBPROC GLH_EXT_NAME(glMultiTexCoord4dvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD4FARBPROC GLH_EXT_NAME(glMultiTexCoord4fARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD4FVARBPROC GLH_EXT_NAME(glMultiTexCoord4fvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD4IARBPROC GLH_EXT_NAME(glMultiTexCoord4iARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD4IVARBPROC GLH_EXT_NAME(glMultiTexCoord4ivARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD4SARBPROC GLH_EXT_NAME(glMultiTexCoord4sARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTITEXCOORD4SVARBPROC GLH_EXT_NAME(glMultiTexCoord4svARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLACTIVETEXTUREARBPROC GLH_EXT_NAME(glActiveTextureARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCLIENTACTIVETEXTUREARBPROC GLH_EXT_NAME(glClientActiveTextureARB) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_ARB_texture_border_clamp
-#endif
-
-#ifdef GL_ARB_texture_compression
- GLH_EXTERN PFNGLCOMPRESSEDTEXIMAGE3DARBPROC GLH_EXT_NAME(glCompressedTexImage3DARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOMPRESSEDTEXIMAGE2DARBPROC GLH_EXT_NAME(glCompressedTexImage2DARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOMPRESSEDTEXIMAGE1DARBPROC GLH_EXT_NAME(glCompressedTexImage1DARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC GLH_EXT_NAME(glCompressedTexSubImage3DARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC GLH_EXT_NAME(glCompressedTexSubImage2DARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC GLH_EXT_NAME(glCompressedTexSubImage1DARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOMPRESSEDTEXIMAGEARBPROC GLH_EXT_NAME(glGetCompressedTexImageARB) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_ARB_texture_cube_map
-#endif
-
-#ifdef GL_ARB_transpose_matrix
- GLH_EXTERN PFNGLLOADTRANSPOSEMATRIXFARBPROC GLH_EXT_NAME(glLoadTransposeMatrixfARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLLOADTRANSPOSEMATRIXDARBPROC GLH_EXT_NAME(glLoadTransposeMatrixdARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTTRANSPOSEMATRIXFARBPROC GLH_EXT_NAME(glMultTransposeMatrixfARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMULTTRANSPOSEMATRIXDARBPROC GLH_EXT_NAME(glMultTransposeMatrixdARB) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_ARB_vertex_program
- GLH_EXTERN PFNGLVERTEXATTRIB1SARBPROC GLH_EXT_NAME(glVertexAttrib1sARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB1FARBPROC GLH_EXT_NAME(glVertexAttrib1fARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB1DARBPROC GLH_EXT_NAME(glVertexAttrib1dARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2SARBPROC GLH_EXT_NAME(glVertexAttrib2sARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2FARBPROC GLH_EXT_NAME(glVertexAttrib2fARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2DARBPROC GLH_EXT_NAME(glVertexAttrib2dARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3SARBPROC GLH_EXT_NAME(glVertexAttrib3sARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3FARBPROC GLH_EXT_NAME(glVertexAttrib3fARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3DARBPROC GLH_EXT_NAME(glVertexAttrib3dARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4SARBPROC GLH_EXT_NAME(glVertexAttrib4sARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4FARBPROC GLH_EXT_NAME(glVertexAttrib4fARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4DARBPROC GLH_EXT_NAME(glVertexAttrib4dARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4NUBARBPROC GLH_EXT_NAME(glVertexAttrib4NubARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB1SVARBPROC GLH_EXT_NAME(glVertexAttrib1svARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB1FVARBPROC GLH_EXT_NAME(glVertexAttrib1fvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB1DVARBPROC GLH_EXT_NAME(glVertexAttrib1dvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2SVARBPROC GLH_EXT_NAME(glVertexAttrib2svARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2FVARBPROC GLH_EXT_NAME(glVertexAttrib2fvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2DVARBPROC GLH_EXT_NAME(glVertexAttrib2dvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3SVARBPROC GLH_EXT_NAME(glVertexAttrib3svARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3FVARBPROC GLH_EXT_NAME(glVertexAttrib3fvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3DVARBPROC GLH_EXT_NAME(glVertexAttrib3dvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4BVARBPROC GLH_EXT_NAME(glVertexAttrib4bvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4SVARBPROC GLH_EXT_NAME(glVertexAttrib4svARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4IVARBPROC GLH_EXT_NAME(glVertexAttrib4ivARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4UBVARBPROC GLH_EXT_NAME(glVertexAttrib4ubvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4USVARBPROC GLH_EXT_NAME(glVertexAttrib4usvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4UIVARBPROC GLH_EXT_NAME(glVertexAttrib4uivARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4FVARBPROC GLH_EXT_NAME(glVertexAttrib4fvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4DVARBPROC GLH_EXT_NAME(glVertexAttrib4dvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4NBVARBPROC GLH_EXT_NAME(glVertexAttrib4NbvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4NSVARBPROC GLH_EXT_NAME(glVertexAttrib4NsvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4NIVARBPROC GLH_EXT_NAME(glVertexAttrib4NivARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4NUBVARBPROC GLH_EXT_NAME(glVertexAttrib4NubvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4NUSVARBPROC GLH_EXT_NAME(glVertexAttrib4NusvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4NUIVARBPROC GLH_EXT_NAME(glVertexAttrib4NuivARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBPOINTERARBPROC GLH_EXT_NAME(glVertexAttribPointerARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLENABLEVERTEXATTRIBARRAYARBPROC GLH_EXT_NAME(glEnableVertexAttribArrayARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLDISABLEVERTEXATTRIBARRAYARBPROC GLH_EXT_NAME(glDisableVertexAttribArrayARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMSTRINGARBPROC GLH_EXT_NAME(glProgramStringARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLBINDPROGRAMARBPROC GLH_EXT_NAME(glBindProgramARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLDELETEPROGRAMSARBPROC GLH_EXT_NAME(glDeleteProgramsARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGENPROGRAMSARBPROC GLH_EXT_NAME(glGenProgramsARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMENVPARAMETER4DARBPROC GLH_EXT_NAME(glProgramEnvParameter4dARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMENVPARAMETER4DVARBPROC GLH_EXT_NAME(glProgramEnvParameter4dvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMENVPARAMETER4FARBPROC GLH_EXT_NAME(glProgramEnvParameter4fARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMENVPARAMETER4FVARBPROC GLH_EXT_NAME(glProgramEnvParameter4fvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4DARBPROC GLH_EXT_NAME(glProgramLocalParameter4dARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4DVARBPROC GLH_EXT_NAME(glProgramLocalParameter4dvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4FARBPROC GLH_EXT_NAME(glProgramLocalParameter4fARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMLOCALPARAMETER4FVARBPROC GLH_EXT_NAME(glProgramLocalParameter4fvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETPROGRAMENVPARAMETERDVARBPROC GLH_EXT_NAME(glGetProgramEnvParameterdvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETPROGRAMENVPARAMETERFVARBPROC GLH_EXT_NAME(glGetProgramEnvParameterfvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC GLH_EXT_NAME(glGetProgramLocalParameterdvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC GLH_EXT_NAME(glGetProgramLocalParameterfvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETPROGRAMIVARBPROC GLH_EXT_NAME(glGetProgramivARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETPROGRAMSTRINGARBPROC GLH_EXT_NAME(glGetProgramStringARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETVERTEXATTRIBDVARBPROC GLH_EXT_NAME(glGetVertexAttribdvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETVERTEXATTRIBFVARBPROC GLH_EXT_NAME(glGetVertexAttribfvARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETVERTEXATTRIBIVARBPROC GLH_EXT_NAME(glGetVertexAttribivARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETVERTEXATTRIBPOINTERVARBPROC GLH_EXT_NAME(glGetVertexAttribPointervARB) GLH_INITIALIZER;
- GLH_EXTERN PFNGLISPROGRAMARBPROC GLH_EXT_NAME(glIsProgramARB) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_EXT_abgr
-#endif
-
-#ifdef GL_EXT_bgra
-#endif
-
-#ifdef GL_EXT_blend_color
- GLH_EXTERN PFNGLBLENDCOLOREXTPROC GLH_EXT_NAME(glBlendColorEXT) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_EXT_blend_minmax
- GLH_EXTERN PFNGLBLENDEQUATIONEXTPROC GLH_EXT_NAME(glBlendEquationEXT) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_EXT_blend_subtract
-#endif
-
-#ifdef GL_EXT_compiled_vertex_array
- GLH_EXTERN PFNGLLOCKARRAYSEXTPROC GLH_EXT_NAME(glLockArraysEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLUNLOCKARRAYSEXTPROC GLH_EXT_NAME(glUnlockArraysEXT) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_EXT_fog_coord
- GLH_EXTERN PFNGLFOGCOORDDEXTPROC GLH_EXT_NAME(glFogCoorddEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLFOGCOORDDVEXTPROC GLH_EXT_NAME(glFogCoorddvEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLFOGCOORDFEXTPROC GLH_EXT_NAME(glFogCoordfEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLFOGCOORDFVEXTPROC GLH_EXT_NAME(glFogCoordfvEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLFOGCOORDPOINTEREXTPROC GLH_EXT_NAME(glFogCoordPointerEXT) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_EXT_light_max_exponent
-#endif
-
-#ifdef GL_EXT_packed_pixels
-#endif
-
-#ifdef GL_EXT_paletted_texture
- GLH_EXTERN PFNGLCOLORSUBTABLEEXTPROC GLH_EXT_NAME(glColorSubTableEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOLORTABLEEXTPROC GLH_EXT_NAME(glColorTableEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOLORTABLEEXTPROC GLH_EXT_NAME(glGetColorTableEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERFVEXTPROC GLH_EXT_NAME(glGetColorTableParameterfvEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERIVEXTPROC GLH_EXT_NAME(glGetColorTableParameterivEXT) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_EXT_point_parameters
- GLH_EXTERN PFNGLPOINTPARAMETERFEXTPROC GLH_EXT_NAME(glPointParameterfEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPOINTPARAMETERFVEXTPROC GLH_EXT_NAME(glPointParameterfvEXT) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_EXT_rescale_normal
-#endif
-
-#ifdef GL_EXT_secondary_color
- GLH_EXTERN PFNGLSECONDARYCOLOR3BEXTPROC GLH_EXT_NAME(glSecondaryColor3bEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3BVEXTPROC GLH_EXT_NAME(glSecondaryColor3bvEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3DEXTPROC GLH_EXT_NAME(glSecondaryColor3dEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3DVEXTPROC GLH_EXT_NAME(glSecondaryColor3dvEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3FEXTPROC GLH_EXT_NAME(glSecondaryColor3fEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3FVEXTPROC GLH_EXT_NAME(glSecondaryColor3fvEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3IEXTPROC GLH_EXT_NAME(glSecondaryColor3iEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3IVEXTPROC GLH_EXT_NAME(glSecondaryColor3ivEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3SEXTPROC GLH_EXT_NAME(glSecondaryColor3sEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3SVEXTPROC GLH_EXT_NAME(glSecondaryColor3svEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3UBEXTPROC GLH_EXT_NAME(glSecondaryColor3ubEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3UBVEXTPROC GLH_EXT_NAME(glSecondaryColor3ubvEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3UIEXTPROC GLH_EXT_NAME(glSecondaryColor3uiEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3UIVEXTPROC GLH_EXT_NAME(glSecondaryColor3uivEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3USEXTPROC GLH_EXT_NAME(glSecondaryColor3usEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLOR3USVEXTPROC GLH_EXT_NAME(glSecondaryColor3usvEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSECONDARYCOLORPOINTEREXTPROC GLH_EXT_NAME(glSecondaryColorPointerEXT) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_EXT_separate_specular_color
-#endif
-
-#ifdef GL_EXT_shared_texture_palette
-#endif
-
-#ifdef GL_EXT_stencil_wrap
-#endif
-
-#ifdef GL_EXT_texture_compression_s3tc
-#endif
-
-#ifdef GL_EXT_texture_cube_map
-#endif
-
-#ifdef GL_EXT_texture_edge_clamp
-#endif
-
-#ifdef GL_EXT_texture_env_add
-#endif
-
-#ifdef GL_EXT_texture_env_combine
-#endif
-
-#ifdef GL_EXT_texture_filter_anisotropic
-#endif
-
-#ifdef GL_EXT_texture_lod_bias
-#endif
-
-#ifdef GL_EXT_texture_object
- GLH_EXTERN PFNGLARETEXTURESRESIDENTEXTPROC GLH_EXT_NAME(glAreTexturesResidentEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLBINDTEXTUREEXTPROC GLH_EXT_NAME(glBindTextureEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLDELETETEXTURESEXTPROC GLH_EXT_NAME(glDeleteTexturesEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGENTEXTURESEXTPROC GLH_EXT_NAME(glGenTexturesEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLISTEXTUREEXTPROC GLH_EXT_NAME(glIsTextureEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPRIORITIZETEXTURESEXTPROC GLH_EXT_NAME(glPrioritizeTexturesEXT) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_EXT_texture3D
- GLH_EXTERN PFNGLTEXIMAGE3DEXTPROC GLH_EXT_NAME(glTexImage3DEXT) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_EXT_vertex_array
- GLH_EXTERN PFNGLARRAYELEMENTEXTPROC GLH_EXT_NAME(glArrayElementEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOLORPOINTEREXTPROC GLH_EXT_NAME(glColorPointerEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLEDGEFLAGPOINTEREXTPROC GLH_EXT_NAME(glEdgeFlagPointerEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETPOINTERVEXTPROC GLH_EXT_NAME(glGetPointervEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLINDEXPOINTEREXTPROC GLH_EXT_NAME(glIndexPointerEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLNORMALPOINTEREXTPROC GLH_EXT_NAME(glNormalPointerEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLTEXCOORDPOINTEREXTPROC GLH_EXT_NAME(glTexCoordPointerEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXPOINTEREXTPROC GLH_EXT_NAME(glVertexPointerEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLDRAWARRAYSEXTPROC GLH_EXT_NAME(glDrawArraysEXT) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_EXT_vertex_weighting
- GLH_EXTERN PFNGLVERTEXWEIGHTFEXTPROC GLH_EXT_NAME(glVertexWeightfEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXWEIGHTFVEXTPROC GLH_EXT_NAME(glVertexWeightfvEXT) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXWEIGHTPOINTEREXTPROC GLH_EXT_NAME(glVertexWeightPointerEXT) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_NV_blend_square
-#endif
-
-#ifdef GL_NV_evaluators
- GLH_EXTERN PFNGLMAPCONTROLPOINTSNVPROC GLH_EXT_NAME(glMapControlPointsNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMAPPARAMETERIVNVPROC GLH_EXT_NAME(glMapParameterivNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLMAPPARAMETERFVNVPROC GLH_EXT_NAME(glMapParameterfvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETMAPCONTROLPOINTSNVPROC GLH_EXT_NAME(glGetMapControlPointsNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETMAPPARAMETERIVNVPROC GLH_EXT_NAME(glGetMapParameterivNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETMAPPARAMETERFVNVPROC GLH_EXT_NAME(glGetMapParameterfvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETMAPATTRIBPARAMETERIVNVPROC GLH_EXT_NAME(glGetMapAttribParameterivNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETMAPATTRIBPARAMETERFVNVPROC GLH_EXT_NAME(glGetMapAttribParameterfvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLEVALMAPSNVPROC GLH_EXT_NAME(glEvalMapsNV) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_NV_fence
- GLH_EXTERN PFNGLGENFENCESNVPROC GLH_EXT_NAME(glGenFencesNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLDELETEFENCESNVPROC GLH_EXT_NAME(glDeleteFencesNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLSETFENCENVPROC GLH_EXT_NAME(glSetFenceNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLTESTFENCENVPROC GLH_EXT_NAME(glTestFenceNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLFINISHFENCENVPROC GLH_EXT_NAME(glFinishFenceNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLISFENCENVPROC GLH_EXT_NAME(glIsFenceNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETFENCEIVNVPROC GLH_EXT_NAME(glGetFenceivNV) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_NV_fog_distance
-#endif
-
-#ifdef GL_NV_packed_depth_stencil
-#endif
-
-#ifdef GL_NV_register_combiners
- GLH_EXTERN PFNGLCOMBINERPARAMETERFVNVPROC GLH_EXT_NAME(glCombinerParameterfvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOMBINERPARAMETERFNVPROC GLH_EXT_NAME(glCombinerParameterfNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOMBINERPARAMETERIVNVPROC GLH_EXT_NAME(glCombinerParameterivNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOMBINERPARAMETERINVPROC GLH_EXT_NAME(glCombinerParameteriNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOMBINERINPUTNVPROC GLH_EXT_NAME(glCombinerInputNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOMBINEROUTPUTNVPROC GLH_EXT_NAME(glCombinerOutputNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLFINALCOMBINERINPUTNVPROC GLH_EXT_NAME(glFinalCombinerInputNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC GLH_EXT_NAME(glGetCombinerInputParameterfvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC GLH_EXT_NAME(glGetCombinerInputParameterivNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC GLH_EXT_NAME(glGetCombinerOutputParameterfvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC GLH_EXT_NAME(glGetCombinerOutputParameterivNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC GLH_EXT_NAME(glGetFinalCombinerInputParameterfvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC GLH_EXT_NAME(glGetFinalCombinerInputParameterivNV) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_NV_register_combiners2
- GLH_EXTERN PFNGLCOMBINERSTAGEPARAMETERFVNVPROC GLH_EXT_NAME(glCombinerStageParameterfvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC GLH_EXT_NAME(glGetCombinerStageParameterfvNV) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_NV_texgen_reflection
-#endif
-
-#ifdef GL_NV_texture_env_combine4
-#endif
-
-#ifdef GL_NV_texture_rectangle
-#endif
-
-#ifdef GL_NV_texture_shader
-#endif
-
-#ifdef GL_NV_vertex_array_range
- GLH_EXTERN PFNGLFLUSHVERTEXARRAYRANGENVPROC GLH_EXT_NAME(glFlushVertexArrayRangeNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXARRAYRANGENVPROC GLH_EXT_NAME(glVertexArrayRangeNV) GLH_INITIALIZER;
-# ifdef _WIN32
- GLH_EXTERN PFNWGLALLOCATEMEMORYNVPROC GLH_EXT_NAME(wglAllocateMemoryNV) GLH_INITIALIZER;
-# endif
-# ifdef GLX_VERSION_1_3
- GLH_EXTERN PFNGLXALLOCATEMEMORYNVPROC GLH_EXT_NAME(glXAllocateMemoryNV) GLH_INITIALIZER;
-# endif
-# ifdef _WIN32
- GLH_EXTERN PFNWGLFREEMEMORYNVPROC GLH_EXT_NAME(wglFreeMemoryNV) GLH_INITIALIZER;
-# endif
-# ifdef GLX_VERSION_1_3
- GLH_EXTERN PFNGLXFREEMEMORYNVPROC GLH_EXT_NAME(glXFreeMemoryNV) GLH_INITIALIZER;
-# endif
-#endif
-
-#ifdef GL_NV_vertex_program
- GLH_EXTERN PFNGLAREPROGRAMSRESIDENTNVPROC GLH_EXT_NAME(glAreProgramsResidentNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLBINDPROGRAMNVPROC GLH_EXT_NAME(glBindProgramNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLDELETEPROGRAMSNVPROC GLH_EXT_NAME(glDeleteProgramsNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLEXECUTEPROGRAMNVPROC GLH_EXT_NAME(glExecuteProgramNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGENPROGRAMSNVPROC GLH_EXT_NAME(glGenProgramsNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETPROGRAMPARAMETERDVNVPROC GLH_EXT_NAME(glGetProgramParameterdvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETPROGRAMPARAMETERFVNVPROC GLH_EXT_NAME(glGetProgramParameterfvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETPROGRAMIVNVPROC GLH_EXT_NAME(glGetProgramivNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETPROGRAMSTRINGNVPROC GLH_EXT_NAME(glGetProgramStringNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETTRACKMATRIXIVNVPROC GLH_EXT_NAME(glGetTrackMatrixivNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETVERTEXATTRIBDVNVPROC GLH_EXT_NAME(glGetVertexAttribdvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETVERTEXATTRIBFVNVPROC GLH_EXT_NAME(glGetVertexAttribfvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETVERTEXATTRIBIVNVPROC GLH_EXT_NAME(glGetVertexAttribivNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETVERTEXATTRIBPOINTERVNVPROC GLH_EXT_NAME(glGetVertexAttribPointervNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLISPROGRAMNVPROC GLH_EXT_NAME(glIsProgramNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLLOADPROGRAMNVPROC GLH_EXT_NAME(glLoadProgramNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMPARAMETER4DNVPROC GLH_EXT_NAME(glProgramParameter4dNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMPARAMETER4DVNVPROC GLH_EXT_NAME(glProgramParameter4dvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMPARAMETER4FNVPROC GLH_EXT_NAME(glProgramParameter4fNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMPARAMETER4FVNVPROC GLH_EXT_NAME(glProgramParameter4fvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMPARAMETERS4DVNVPROC GLH_EXT_NAME(glProgramParameters4dvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLPROGRAMPARAMETERS4FVNVPROC GLH_EXT_NAME(glProgramParameters4fvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLREQUESTRESIDENTPROGRAMSNVPROC GLH_EXT_NAME(glRequestResidentProgramsNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLTRACKMATRIXNVPROC GLH_EXT_NAME(glTrackMatrixNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBPOINTERNVPROC GLH_EXT_NAME(glVertexAttribPointerNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB1DNVPROC GLH_EXT_NAME(glVertexAttrib1dNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB1DVNVPROC GLH_EXT_NAME(glVertexAttrib1dvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB1FNVPROC GLH_EXT_NAME(glVertexAttrib1fNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB1FVNVPROC GLH_EXT_NAME(glVertexAttrib1fvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB1SNVPROC GLH_EXT_NAME(glVertexAttrib1sNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB1SVNVPROC GLH_EXT_NAME(glVertexAttrib1svNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2DNVPROC GLH_EXT_NAME(glVertexAttrib2dNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2DVNVPROC GLH_EXT_NAME(glVertexAttrib2dvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2FNVPROC GLH_EXT_NAME(glVertexAttrib2fNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2FVNVPROC GLH_EXT_NAME(glVertexAttrib2fvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2SNVPROC GLH_EXT_NAME(glVertexAttrib2sNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB2SVNVPROC GLH_EXT_NAME(glVertexAttrib2svNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3DNVPROC GLH_EXT_NAME(glVertexAttrib3dNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3DVNVPROC GLH_EXT_NAME(glVertexAttrib3dvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3FNVPROC GLH_EXT_NAME(glVertexAttrib3fNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3FVNVPROC GLH_EXT_NAME(glVertexAttrib3fvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3SNVPROC GLH_EXT_NAME(glVertexAttrib3sNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB3SVNVPROC GLH_EXT_NAME(glVertexAttrib3svNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4DNVPROC GLH_EXT_NAME(glVertexAttrib4dNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4DVNVPROC GLH_EXT_NAME(glVertexAttrib4dvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4FNVPROC GLH_EXT_NAME(glVertexAttrib4fNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4FVNVPROC GLH_EXT_NAME(glVertexAttrib4fvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4SNVPROC GLH_EXT_NAME(glVertexAttrib4sNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4SVNVPROC GLH_EXT_NAME(glVertexAttrib4svNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIB4UBVNVPROC GLH_EXT_NAME(glVertexAttrib4ubvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS1DVNVPROC GLH_EXT_NAME(glVertexAttribs1dvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS1FVNVPROC GLH_EXT_NAME(glVertexAttribs1fvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS1SVNVPROC GLH_EXT_NAME(glVertexAttribs1svNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS2DVNVPROC GLH_EXT_NAME(glVertexAttribs2dvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS2FVNVPROC GLH_EXT_NAME(glVertexAttribs2fvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS2SVNVPROC GLH_EXT_NAME(glVertexAttribs2svNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS3DVNVPROC GLH_EXT_NAME(glVertexAttribs3dvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS3FVNVPROC GLH_EXT_NAME(glVertexAttribs3fvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS3SVNVPROC GLH_EXT_NAME(glVertexAttribs3svNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS4DVNVPROC GLH_EXT_NAME(glVertexAttribs4dvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS4FVNVPROC GLH_EXT_NAME(glVertexAttribs4fvNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS4SVNVPROC GLH_EXT_NAME(glVertexAttribs4svNV) GLH_INITIALIZER;
- GLH_EXTERN PFNGLVERTEXATTRIBS4UBVNVPROC GLH_EXT_NAME(glVertexAttribs4ubvNV) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_SGIS_generate_mipmap
-#endif
-
-#ifdef GL_SGIS_texture_lod
-#endif
-
-#ifdef GL_SGIX_depth_texture
-#endif
-
-#ifdef GL_SGIX_shadow
-#endif
-
-#ifdef GL_VERSION_1_2
- /* These routines are prefixed by the preprocessor constant
- GLH_CORE_1_2_PREFIX to avoid colliding with the OpenGL 1.2 namespace. */
- GLH_EXTERN PFNGLBLENDCOLORPROC GLH_CORE_1_2_NAME(glBlendColor) GLH_INITIALIZER;
- GLH_EXTERN PFNGLBLENDEQUATIONPROC GLH_CORE_1_2_NAME(glBlendEquation) GLH_INITIALIZER;
- GLH_EXTERN PFNGLDRAWRANGEELEMENTSPROC GLH_CORE_1_2_NAME(glDrawRangeElements) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOLORTABLEPROC GLH_CORE_1_2_NAME(glColorTable) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOLORTABLEPARAMETERFVPROC GLH_CORE_1_2_NAME(glColorTableParameterfv) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOLORTABLEPARAMETERIVPROC GLH_CORE_1_2_NAME(glColorTableParameteriv) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOPYCOLORTABLEPROC GLH_CORE_1_2_NAME(glCopyColorTable) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOLORTABLEPROC GLH_CORE_1_2_NAME(glGetColorTable) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERFVPROC GLH_CORE_1_2_NAME(glGetColorTableParameterfv) GLH_INITIALIZER;
- GLH_EXTERN PFNGLGETCOLORTABLEPARAMETERIVPROC GLH_CORE_1_2_NAME(glGetColorTableParameteriv) GLH_INITIALIZER;
- GLH_EXTERN PFNGLTEXIMAGE3DPROC GLH_CORE_1_2_NAME(glTexImage3D) GLH_INITIALIZER;
- GLH_EXTERN PFNGLTEXSUBIMAGE3DPROC GLH_CORE_1_2_NAME(glTexSubImage3D) GLH_INITIALIZER;
- GLH_EXTERN PFNGLCOPYTEXSUBIMAGE3DPROC GLH_CORE_1_2_NAME(glCopyTexSubImage3D) GLH_INITIALIZER;
-#endif
-
-#ifdef GL_WIN_swap_hint
- GLH_EXTERN PFNGLADDSWAPHINTRECTWINPROC GLH_EXT_NAME(glAddSwapHintRectWIN) GLH_INITIALIZER;
-#endif
-
-#ifdef WGL_ARB_pbuffer
-# ifdef _WIN32
- GLH_EXTERN PFNWGLCREATEPBUFFERARBPROC GLH_EXT_NAME(wglCreatePbufferARB) GLH_INITIALIZER;
-# endif
-# ifdef _WIN32
- GLH_EXTERN PFNWGLGETPBUFFERDCARBPROC GLH_EXT_NAME(wglGetPbufferDCARB) GLH_INITIALIZER;
-# endif
-# ifdef _WIN32
- GLH_EXTERN PFNWGLRELEASEPBUFFERDCARBPROC GLH_EXT_NAME(wglReleasePbufferDCARB) GLH_INITIALIZER;
-# endif
-# ifdef _WIN32
- GLH_EXTERN PFNWGLDESTROYPBUFFERARBPROC GLH_EXT_NAME(wglDestroyPbufferARB) GLH_INITIALIZER;
-# endif
-# ifdef _WIN32
- GLH_EXTERN PFNWGLQUERYPBUFFERARBPROC GLH_EXT_NAME(wglQueryPbufferARB) GLH_INITIALIZER;
-# endif
-#endif
-
-#ifdef WGL_ARB_render_texture
-# ifdef _WIN32
- GLH_EXTERN PFNWGLBINDTEXIMAGEARBPROC GLH_EXT_NAME(wglBindTexImageARB) GLH_INITIALIZER;
-# endif
-# ifdef _WIN32
- GLH_EXTERN PFNWGLRELEASETEXIMAGEARBPROC GLH_EXT_NAME(wglReleaseTexImageARB) GLH_INITIALIZER;
-# endif
-# ifdef _WIN32
- GLH_EXTERN PFNWGLSETPBUFFERATTRIBARBPROC GLH_EXT_NAME(wglSetPbufferAttribARB) GLH_INITIALIZER;
-# endif
-#endif
-
-#ifdef WGL_ARB_pixel_format
-# ifdef _WIN32
- GLH_EXTERN PFNWGLGETPIXELFORMATATTRIBIVARBPROC GLH_EXT_NAME(wglGetPixelFormatAttribivARB) GLH_INITIALIZER;
-# endif
-# ifdef _WIN32
- GLH_EXTERN PFNWGLGETPIXELFORMATATTRIBFVARBPROC GLH_EXT_NAME(wglGetPixelFormatAttribfvARB) GLH_INITIALIZER;
-# endif
-# ifdef _WIN32
- GLH_EXTERN PFNWGLCHOOSEPIXELFORMATARBPROC GLH_EXT_NAME(wglChoosePixelFormatARB) GLH_INITIALIZER;
-# endif
-#endif
-
-
-#ifdef GLH_EXT_SINGLE_FILE
-
-int glh_init_extension(const char* extension)
-{
- if (NULL == extension) {
- return FALSE;
-#ifdef GL_ARB_multitexture
- } else if (0 == strcmp(extension, "GL_ARB_multitexture")) {
- GLH_EXT_NAME(glMultiTexCoord1dARB) = (PFNGLMULTITEXCOORD1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1dARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord1dARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord1dvARB) = (PFNGLMULTITEXCOORD1DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1dvARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord1dvARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord1fARB) = (PFNGLMULTITEXCOORD1FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1fARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord1fARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord1fvARB) = (PFNGLMULTITEXCOORD1FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1fvARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord1fvARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord1iARB) = (PFNGLMULTITEXCOORD1IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1iARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord1iARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord1ivARB) = (PFNGLMULTITEXCOORD1IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1ivARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord1ivARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord1sARB) = (PFNGLMULTITEXCOORD1SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1sARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord1sARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord1svARB) = (PFNGLMULTITEXCOORD1SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord1svARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord1svARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord2dARB) = (PFNGLMULTITEXCOORD2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2dARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord2dARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord2dvARB) = (PFNGLMULTITEXCOORD2DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2dvARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord2dvARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord2fARB) = (PFNGLMULTITEXCOORD2FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2fARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord2fARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord2fvARB) = (PFNGLMULTITEXCOORD2FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2fvARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord2fvARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord2iARB) = (PFNGLMULTITEXCOORD2IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2iARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord2iARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord2ivARB) = (PFNGLMULTITEXCOORD2IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2ivARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord2ivARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord2sARB) = (PFNGLMULTITEXCOORD2SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2sARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord2sARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord2svARB) = (PFNGLMULTITEXCOORD2SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord2svARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord2svARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord3dARB) = (PFNGLMULTITEXCOORD3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3dARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord3dARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord3dvARB) = (PFNGLMULTITEXCOORD3DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3dvARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord3dvARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord3fARB) = (PFNGLMULTITEXCOORD3FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3fARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord3fARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord3fvARB) = (PFNGLMULTITEXCOORD3FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3fvARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord3fvARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord3iARB) = (PFNGLMULTITEXCOORD3IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3iARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord3iARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord3ivARB) = (PFNGLMULTITEXCOORD3IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3ivARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord3ivARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord3sARB) = (PFNGLMULTITEXCOORD3SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3sARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord3sARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord3svARB) = (PFNGLMULTITEXCOORD3SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord3svARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord3svARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord4dARB) = (PFNGLMULTITEXCOORD4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4dARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord4dARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord4dvARB) = (PFNGLMULTITEXCOORD4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4dvARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord4dvARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord4fARB) = (PFNGLMULTITEXCOORD4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4fARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord4fARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord4fvARB) = (PFNGLMULTITEXCOORD4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4fvARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord4fvARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord4iARB) = (PFNGLMULTITEXCOORD4IARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4iARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord4iARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord4ivARB) = (PFNGLMULTITEXCOORD4IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4ivARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord4ivARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord4sARB) = (PFNGLMULTITEXCOORD4SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4sARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord4sARB))
- return FALSE;
- GLH_EXT_NAME(glMultiTexCoord4svARB) = (PFNGLMULTITEXCOORD4SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultiTexCoord4svARB");
- if (NULL == GLH_EXT_NAME(glMultiTexCoord4svARB))
- return FALSE;
- GLH_EXT_NAME(glActiveTextureARB) = (PFNGLACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glActiveTextureARB");
- if (NULL == GLH_EXT_NAME(glActiveTextureARB))
- return FALSE;
- GLH_EXT_NAME(glClientActiveTextureARB) = (PFNGLCLIENTACTIVETEXTUREARBPROC)GLH_EXT_GET_PROC_ADDRESS("glClientActiveTextureARB");
- if (NULL == GLH_EXT_NAME(glClientActiveTextureARB))
- return FALSE;
-#endif
-
-#ifdef GL_ARB_texture_border_clamp
- } else if (0 == strcmp(extension, "GL_ARB_texture_border_clamp")) {
-#endif
-
-#ifdef GL_ARB_texture_compression
- } else if (0 == strcmp(extension, "GL_ARB_texture_compression")) {
- GLH_EXT_NAME(glCompressedTexImage3DARB) = (PFNGLCOMPRESSEDTEXIMAGE3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexImage3DARB");
- if (NULL == GLH_EXT_NAME(glCompressedTexImage3DARB))
- return FALSE;
- GLH_EXT_NAME(glCompressedTexImage2DARB) = (PFNGLCOMPRESSEDTEXIMAGE2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexImage2DARB");
- if (NULL == GLH_EXT_NAME(glCompressedTexImage2DARB))
- return FALSE;
- GLH_EXT_NAME(glCompressedTexImage1DARB) = (PFNGLCOMPRESSEDTEXIMAGE1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexImage1DARB");
- if (NULL == GLH_EXT_NAME(glCompressedTexImage1DARB))
- return FALSE;
- GLH_EXT_NAME(glCompressedTexSubImage3DARB) = (PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexSubImage3DARB");
- if (NULL == GLH_EXT_NAME(glCompressedTexSubImage3DARB))
- return FALSE;
- GLH_EXT_NAME(glCompressedTexSubImage2DARB) = (PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexSubImage2DARB");
- if (NULL == GLH_EXT_NAME(glCompressedTexSubImage2DARB))
- return FALSE;
- GLH_EXT_NAME(glCompressedTexSubImage1DARB) = (PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glCompressedTexSubImage1DARB");
- if (NULL == GLH_EXT_NAME(glCompressedTexSubImage1DARB))
- return FALSE;
- GLH_EXT_NAME(glGetCompressedTexImageARB) = (PFNGLGETCOMPRESSEDTEXIMAGEARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCompressedTexImageARB");
- if (NULL == GLH_EXT_NAME(glGetCompressedTexImageARB))
- return FALSE;
-#endif
-
-#ifdef GL_ARB_texture_cube_map
- } else if (0 == strcmp(extension, "GL_ARB_texture_cube_map")) {
-#endif
-
-#ifdef GL_ARB_transpose_matrix
- } else if (0 == strcmp(extension, "GL_ARB_transpose_matrix")) {
- GLH_EXT_NAME(glLoadTransposeMatrixfARB) = (PFNGLLOADTRANSPOSEMATRIXFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glLoadTransposeMatrixfARB");
- if (NULL == GLH_EXT_NAME(glLoadTransposeMatrixfARB))
- return FALSE;
- GLH_EXT_NAME(glLoadTransposeMatrixdARB) = (PFNGLLOADTRANSPOSEMATRIXDARBPROC)GLH_EXT_GET_PROC_ADDRESS("glLoadTransposeMatrixdARB");
- if (NULL == GLH_EXT_NAME(glLoadTransposeMatrixdARB))
- return FALSE;
- GLH_EXT_NAME(glMultTransposeMatrixfARB) = (PFNGLMULTTRANSPOSEMATRIXFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultTransposeMatrixfARB");
- if (NULL == GLH_EXT_NAME(glMultTransposeMatrixfARB))
- return FALSE;
- GLH_EXT_NAME(glMultTransposeMatrixdARB) = (PFNGLMULTTRANSPOSEMATRIXDARBPROC)GLH_EXT_GET_PROC_ADDRESS("glMultTransposeMatrixdARB");
- if (NULL == GLH_EXT_NAME(glMultTransposeMatrixdARB))
- return FALSE;
-#endif
-
-#ifdef GL_ARB_vertex_program
- } else if (0 == strcmp(extension, "GL_ARB_vertex_program")) {
- GLH_EXT_NAME(glVertexAttrib1sARB) = (PFNGLVERTEXATTRIB1SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1sARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1sARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib1fARB) = (PFNGLVERTEXATTRIB1FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1fARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib1dARB) = (PFNGLVERTEXATTRIB1DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1dARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib2sARB) = (PFNGLVERTEXATTRIB2SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2sARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2sARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib2fARB) = (PFNGLVERTEXATTRIB2FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2fARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib2dARB) = (PFNGLVERTEXATTRIB2DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2dARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib3sARB) = (PFNGLVERTEXATTRIB3SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3sARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3sARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib3fARB) = (PFNGLVERTEXATTRIB3FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3fARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib3dARB) = (PFNGLVERTEXATTRIB3DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3dARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4sARB) = (PFNGLVERTEXATTRIB4SARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4sARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4sARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4fARB) = (PFNGLVERTEXATTRIB4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4fARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4dARB) = (PFNGLVERTEXATTRIB4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4dARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4NubARB) = (PFNGLVERTEXATTRIB4NUBARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NubARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4NubARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib1svARB) = (PFNGLVERTEXATTRIB1SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1svARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1svARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib1fvARB) = (PFNGLVERTEXATTRIB1FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1fvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib1dvARB) = (PFNGLVERTEXATTRIB1DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1dvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib2svARB) = (PFNGLVERTEXATTRIB2SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2svARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2svARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib2fvARB) = (PFNGLVERTEXATTRIB2FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2fvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib2dvARB) = (PFNGLVERTEXATTRIB2DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2dvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib3svARB) = (PFNGLVERTEXATTRIB3SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3svARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3svARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib3fvARB) = (PFNGLVERTEXATTRIB3FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3fvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib3dvARB) = (PFNGLVERTEXATTRIB3DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3dvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4bvARB) = (PFNGLVERTEXATTRIB4BVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4bvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4bvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4svARB) = (PFNGLVERTEXATTRIB4SVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4svARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4svARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4ivARB) = (PFNGLVERTEXATTRIB4IVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4ivARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4ivARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4ubvARB) = (PFNGLVERTEXATTRIB4UBVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4ubvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4ubvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4usvARB) = (PFNGLVERTEXATTRIB4USVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4usvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4usvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4uivARB) = (PFNGLVERTEXATTRIB4UIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4uivARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4uivARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4fvARB) = (PFNGLVERTEXATTRIB4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4fvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4dvARB) = (PFNGLVERTEXATTRIB4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4dvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4NbvARB) = (PFNGLVERTEXATTRIB4NBVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NbvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4NbvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4NsvARB) = (PFNGLVERTEXATTRIB4NSVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NsvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4NsvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4NivARB) = (PFNGLVERTEXATTRIB4NIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NivARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4NivARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4NubvARB) = (PFNGLVERTEXATTRIB4NUBVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NubvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4NubvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4NusvARB) = (PFNGLVERTEXATTRIB4NUSVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NusvARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4NusvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttrib4NuivARB) = (PFNGLVERTEXATTRIB4NUIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4NuivARB");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4NuivARB))
- return GL_FALSE;
- GLH_EXT_NAME(glVertexAttribPointerARB) = (PFNGLVERTEXATTRIBPOINTERARBPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribPointerARB");
- if (NULL == GLH_EXT_NAME(glVertexAttribPointerARB))
- return GL_FALSE;
- GLH_EXT_NAME(glEnableVertexAttribArrayARB) = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glEnableVertexAttribArrayARB");
- if (NULL == GLH_EXT_NAME(glEnableVertexAttribArrayARB))
- return GL_FALSE;
- GLH_EXT_NAME(glDisableVertexAttribArrayARB) = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDisableVertexAttribArrayARB");
- if (NULL == GLH_EXT_NAME(glDisableVertexAttribArrayARB))
- return GL_FALSE;
- GLH_EXT_NAME(glProgramStringARB) = (PFNGLPROGRAMSTRINGARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramStringARB");
- if (NULL == GLH_EXT_NAME(glProgramStringARB))
- return GL_FALSE;
- GLH_EXT_NAME(glBindProgramARB) = (PFNGLBINDPROGRAMARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBindProgramARB");
- if (NULL == GLH_EXT_NAME(glBindProgramARB))
- return GL_FALSE;
- GLH_EXT_NAME(glDeleteProgramsARB) = (PFNGLDELETEPROGRAMSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteProgramsARB");
- if (NULL == GLH_EXT_NAME(glDeleteProgramsARB))
- return GL_FALSE;
- GLH_EXT_NAME(glGenProgramsARB) = (PFNGLGENPROGRAMSARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenProgramsARB");
- if (NULL == GLH_EXT_NAME(glGenProgramsARB))
- return GL_FALSE;
- GLH_EXT_NAME(glProgramEnvParameter4dARB) = (PFNGLPROGRAMENVPARAMETER4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4dARB");
- if (NULL == GLH_EXT_NAME(glProgramEnvParameter4dARB))
- return GL_FALSE;
- GLH_EXT_NAME(glProgramEnvParameter4dvARB) = (PFNGLPROGRAMENVPARAMETER4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4dvARB");
- if (NULL == GLH_EXT_NAME(glProgramEnvParameter4dvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glProgramEnvParameter4fARB) = (PFNGLPROGRAMENVPARAMETER4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4fARB");
- if (NULL == GLH_EXT_NAME(glProgramEnvParameter4fARB))
- return GL_FALSE;
- GLH_EXT_NAME(glProgramEnvParameter4fvARB) = (PFNGLPROGRAMENVPARAMETER4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramEnvParameter4fvARB");
- if (NULL == GLH_EXT_NAME(glProgramEnvParameter4fvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glProgramLocalParameter4dARB) = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4dARB");
- if (NULL == GLH_EXT_NAME(glProgramLocalParameter4dARB))
- return GL_FALSE;
- GLH_EXT_NAME(glProgramLocalParameter4dvARB) = (PFNGLPROGRAMLOCALPARAMETER4DVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4dvARB");
- if (NULL == GLH_EXT_NAME(glProgramLocalParameter4dvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glProgramLocalParameter4fARB) = (PFNGLPROGRAMLOCALPARAMETER4FARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4fARB");
- if (NULL == GLH_EXT_NAME(glProgramLocalParameter4fARB))
- return GL_FALSE;
- GLH_EXT_NAME(glProgramLocalParameter4fvARB) = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramLocalParameter4fvARB");
- if (NULL == GLH_EXT_NAME(glProgramLocalParameter4fvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glGetProgramEnvParameterdvARB) = (PFNGLGETPROGRAMENVPARAMETERDVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramEnvParameterdvARB");
- if (NULL == GLH_EXT_NAME(glGetProgramEnvParameterdvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glGetProgramEnvParameterfvARB) = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramEnvParameterfvARB");
- if (NULL == GLH_EXT_NAME(glGetProgramEnvParameterfvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glGetProgramLocalParameterdvARB) = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramLocalParameterdvARB");
- if (NULL == GLH_EXT_NAME(glGetProgramLocalParameterdvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glGetProgramLocalParameterfvARB) = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramLocalParameterfvARB");
- if (NULL == GLH_EXT_NAME(glGetProgramLocalParameterfvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glGetProgramivARB) = (PFNGLGETPROGRAMIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramivARB");
- if (NULL == GLH_EXT_NAME(glGetProgramivARB))
- return GL_FALSE;
- GLH_EXT_NAME(glGetProgramStringARB) = (PFNGLGETPROGRAMSTRINGARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramStringARB");
- if (NULL == GLH_EXT_NAME(glGetProgramStringARB))
- return GL_FALSE;
- GLH_EXT_NAME(glGetVertexAttribdvARB) = (PFNGLGETVERTEXATTRIBDVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribdvARB");
- if (NULL == GLH_EXT_NAME(glGetVertexAttribdvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glGetVertexAttribfvARB) = (PFNGLGETVERTEXATTRIBFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribfvARB");
- if (NULL == GLH_EXT_NAME(glGetVertexAttribfvARB))
- return GL_FALSE;
- GLH_EXT_NAME(glGetVertexAttribivARB) = (PFNGLGETVERTEXATTRIBIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribivARB");
- if (NULL == GLH_EXT_NAME(glGetVertexAttribivARB))
- return GL_FALSE;
- GLH_EXT_NAME(glGetVertexAttribPointervARB) = (PFNGLGETVERTEXATTRIBPOINTERVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribPointervARB");
- if (NULL == GLH_EXT_NAME(glGetVertexAttribPointervARB))
- return GL_FALSE;
- GLH_EXT_NAME(glIsProgramARB) = (PFNGLISPROGRAMARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsProgramARB");
- if (NULL == GLH_EXT_NAME(glIsProgramARB))
- return GL_FALSE;
-#endif
-
-#ifdef GL_EXT_abgr
- } else if (0 == strcmp(extension, "GL_EXT_abgr")) {
-#endif
-
-#ifdef GL_EXT_bgra
- } else if (0 == strcmp(extension, "GL_EXT_bgra")) {
-#endif
-
-#ifdef GL_EXT_blend_color
- } else if (0 == strcmp(extension, "GL_EXT_blend_color")) {
- GLH_EXT_NAME(glBlendColorEXT) = (PFNGLBLENDCOLOREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendColorEXT");
- if (NULL == GLH_EXT_NAME(glBlendColorEXT))
- return FALSE;
-#endif
-
-#ifdef GL_EXT_blend_minmax
- } else if (0 == strcmp(extension, "GL_EXT_blend_minmax")) {
- GLH_EXT_NAME(glBlendEquationEXT) = (PFNGLBLENDEQUATIONEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendEquationEXT");
- if (NULL == GLH_EXT_NAME(glBlendEquationEXT))
- return FALSE;
-#endif
-
-#ifdef GL_EXT_blend_subtract
- } else if (0 == strcmp(extension, "GL_EXT_blend_subtract")) {
-#endif
-
-#ifdef GL_EXT_compiled_vertex_array
- } else if (0 == strcmp(extension, "GL_EXT_compiled_vertex_array")) {
- GLH_EXT_NAME(glLockArraysEXT) = (PFNGLLOCKARRAYSEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glLockArraysEXT");
- if (NULL == GLH_EXT_NAME(glLockArraysEXT))
- return FALSE;
- GLH_EXT_NAME(glUnlockArraysEXT) = (PFNGLUNLOCKARRAYSEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glUnlockArraysEXT");
- if (NULL == GLH_EXT_NAME(glUnlockArraysEXT))
- return FALSE;
-#endif
-
-#ifdef GL_EXT_fog_coord
- } else if (0 == strcmp(extension, "GL_EXT_fog_coord")) {
- GLH_EXT_NAME(glFogCoorddEXT) = (PFNGLFOGCOORDDEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoorddEXT");
- if (NULL == GLH_EXT_NAME(glFogCoorddEXT))
- return FALSE;
- GLH_EXT_NAME(glFogCoorddvEXT) = (PFNGLFOGCOORDDVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoorddvEXT");
- if (NULL == GLH_EXT_NAME(glFogCoorddvEXT))
- return FALSE;
- GLH_EXT_NAME(glFogCoordfEXT) = (PFNGLFOGCOORDFEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoordfEXT");
- if (NULL == GLH_EXT_NAME(glFogCoordfEXT))
- return FALSE;
- GLH_EXT_NAME(glFogCoordfvEXT) = (PFNGLFOGCOORDFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoordfvEXT");
- if (NULL == GLH_EXT_NAME(glFogCoordfvEXT))
- return FALSE;
- GLH_EXT_NAME(glFogCoordPointerEXT) = (PFNGLFOGCOORDPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glFogCoordPointerEXT");
- if (NULL == GLH_EXT_NAME(glFogCoordPointerEXT))
- return FALSE;
-#endif
-
-#ifdef GL_EXT_light_max_exponent
- } else if (0 == strcmp(extension, "GL_EXT_light_max_exponent")) {
-#endif
-
-#ifdef GL_EXT_packed_pixels
- } else if (0 == strcmp(extension, "GL_EXT_packed_pixels")) {
-#endif
-
-#ifdef GL_EXT_paletted_texture
- } else if (0 == strcmp(extension, "GL_EXT_paletted_texture")) {
- GLH_EXT_NAME(glColorSubTableEXT) = (PFNGLCOLORSUBTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorSubTableEXT");
- if (NULL == GLH_EXT_NAME(glColorSubTableEXT))
- return FALSE;
- GLH_EXT_NAME(glColorTableEXT) = (PFNGLCOLORTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableEXT");
- if (NULL == GLH_EXT_NAME(glColorTableEXT))
- return FALSE;
- GLH_EXT_NAME(glGetColorTableEXT) = (PFNGLGETCOLORTABLEEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableEXT");
- if (NULL == GLH_EXT_NAME(glGetColorTableEXT))
- return FALSE;
- GLH_EXT_NAME(glGetColorTableParameterfvEXT) = (PFNGLGETCOLORTABLEPARAMETERFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameterfvEXT");
- if (NULL == GLH_EXT_NAME(glGetColorTableParameterfvEXT))
- return FALSE;
- GLH_EXT_NAME(glGetColorTableParameterivEXT) = (PFNGLGETCOLORTABLEPARAMETERIVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameterivEXT");
- if (NULL == GLH_EXT_NAME(glGetColorTableParameterivEXT))
- return FALSE;
-#endif
-
-#ifdef GL_EXT_point_parameters
- } else if (0 == strcmp(extension, "GL_EXT_point_parameters")) {
- GLH_EXT_NAME(glPointParameterfEXT) = (PFNGLPOINTPARAMETERFEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfEXT");
- if (NULL == GLH_EXT_NAME(glPointParameterfEXT))
- return FALSE;
- GLH_EXT_NAME(glPointParameterfvEXT) = (PFNGLPOINTPARAMETERFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfvEXT");
- if (NULL == GLH_EXT_NAME(glPointParameterfvEXT))
- return FALSE;
-#endif
-
-#ifdef GL_EXT_rescale_normal
- } else if (0 == strcmp(extension, "GL_EXT_rescale_normal")) {
-#endif
-
-#ifdef GL_EXT_secondary_color
- } else if (0 == strcmp(extension, "GL_EXT_secondary_color")) {
- GLH_EXT_NAME(glSecondaryColor3bEXT) = (PFNGLSECONDARYCOLOR3BEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3bEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3bEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3bvEXT) = (PFNGLSECONDARYCOLOR3BVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3bvEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3bvEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3dEXT) = (PFNGLSECONDARYCOLOR3DEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3dEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3dEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3dvEXT) = (PFNGLSECONDARYCOLOR3DVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3dvEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3dvEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3fEXT) = (PFNGLSECONDARYCOLOR3FEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3fEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3fEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3fvEXT) = (PFNGLSECONDARYCOLOR3FVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3fvEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3fvEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3iEXT) = (PFNGLSECONDARYCOLOR3IEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3iEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3iEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3ivEXT) = (PFNGLSECONDARYCOLOR3IVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3ivEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3ivEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3sEXT) = (PFNGLSECONDARYCOLOR3SEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3sEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3sEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3svEXT) = (PFNGLSECONDARYCOLOR3SVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3svEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3svEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3ubEXT) = (PFNGLSECONDARYCOLOR3UBEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3ubEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3ubEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3ubvEXT) = (PFNGLSECONDARYCOLOR3UBVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3ubvEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3ubvEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3uiEXT) = (PFNGLSECONDARYCOLOR3UIEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3uiEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3uiEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3uivEXT) = (PFNGLSECONDARYCOLOR3UIVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3uivEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3uivEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3usEXT) = (PFNGLSECONDARYCOLOR3USEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3usEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3usEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColor3usvEXT) = (PFNGLSECONDARYCOLOR3USVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColor3usvEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColor3usvEXT))
- return FALSE;
- GLH_EXT_NAME(glSecondaryColorPointerEXT) = (PFNGLSECONDARYCOLORPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glSecondaryColorPointerEXT");
- if (NULL == GLH_EXT_NAME(glSecondaryColorPointerEXT))
- return FALSE;
-#endif
-
-#ifdef GL_EXT_separate_specular_color
- } else if (0 == strcmp(extension, "GL_EXT_separate_specular_color")) {
-#endif
-
-#ifdef GL_EXT_shared_texture_palette
- } else if (0 == strcmp(extension, "GL_EXT_shared_texture_palette")) {
-#endif
-
-#ifdef GL_EXT_stencil_wrap
- } else if (0 == strcmp(extension, "GL_EXT_stencil_wrap")) {
-#endif
-
-#ifdef GL_EXT_texture_compression_s3tc
- } else if (0 == strcmp(extension, "GL_EXT_texture_compression_s3tc")) {
-#endif
-
-#ifdef GL_EXT_texture_cube_map
- } else if (0 == strcmp(extension, "GL_EXT_texture_cube_map")) {
-#endif
-
-#ifdef GL_EXT_texture_edge_clamp
- } else if (0 == strcmp(extension, "GL_EXT_texture_edge_clamp")) {
-#endif
-
-#ifdef GL_EXT_texture_env_add
- } else if (0 == strcmp(extension, "GL_EXT_texture_env_add")) {
-#endif
-
-#ifdef GL_EXT_texture_env_combine
- } else if (0 == strcmp(extension, "GL_EXT_texture_env_combine")) {
-#endif
-
-#ifdef GL_EXT_texture_filter_anisotropic
- } else if (0 == strcmp(extension, "GL_EXT_texture_filter_anisotropic")) {
-#endif
-
-#ifdef GL_EXT_texture_lod_bias
- } else if (0 == strcmp(extension, "GL_EXT_texture_lod_bias")) {
-#endif
-
-#ifdef GL_EXT_texture_object
- } else if (0 == strcmp(extension, "GL_EXT_texture_object")) {
- GLH_EXT_NAME(glAreTexturesResidentEXT) = (PFNGLARETEXTURESRESIDENTEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glAreTexturesResidentEXT");
- if (NULL == GLH_EXT_NAME(glAreTexturesResidentEXT))
- return FALSE;
- GLH_EXT_NAME(glBindTextureEXT) = (PFNGLBINDTEXTUREEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glBindTextureEXT");
- if (NULL == GLH_EXT_NAME(glBindTextureEXT))
- return FALSE;
- GLH_EXT_NAME(glDeleteTexturesEXT) = (PFNGLDELETETEXTURESEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteTexturesEXT");
- if (NULL == GLH_EXT_NAME(glDeleteTexturesEXT))
- return FALSE;
- GLH_EXT_NAME(glGenTexturesEXT) = (PFNGLGENTEXTURESEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGenTexturesEXT");
- if (NULL == GLH_EXT_NAME(glGenTexturesEXT))
- return FALSE;
- GLH_EXT_NAME(glIsTextureEXT) = (PFNGLISTEXTUREEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glIsTextureEXT");
- if (NULL == GLH_EXT_NAME(glIsTextureEXT))
- return FALSE;
- GLH_EXT_NAME(glPrioritizeTexturesEXT) = (PFNGLPRIORITIZETEXTURESEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glPrioritizeTexturesEXT");
- if (NULL == GLH_EXT_NAME(glPrioritizeTexturesEXT))
- return FALSE;
-#endif
-
-#ifdef GL_EXT_texture3D
- } else if (0 == strcmp(extension, "GL_EXT_texture3D")) {
- GLH_EXT_NAME(glTexImage3DEXT) = (PFNGLTEXIMAGE3DEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glTexImage3DEXT");
- if (NULL == GLH_EXT_NAME(glTexImage3DEXT))
- return FALSE;
-#endif
-
-#ifdef GL_EXT_vertex_array
- } else if (0 == strcmp(extension, "GL_EXT_vertex_array")) {
- GLH_EXT_NAME(glArrayElementEXT) = (PFNGLARRAYELEMENTEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glArrayElementEXT");
- if (NULL == GLH_EXT_NAME(glArrayElementEXT))
- return FALSE;
- GLH_EXT_NAME(glColorPointerEXT) = (PFNGLCOLORPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glColorPointerEXT");
- if (NULL == GLH_EXT_NAME(glColorPointerEXT))
- return FALSE;
- GLH_EXT_NAME(glEdgeFlagPointerEXT) = (PFNGLEDGEFLAGPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glEdgeFlagPointerEXT");
- if (NULL == GLH_EXT_NAME(glEdgeFlagPointerEXT))
- return FALSE;
- GLH_EXT_NAME(glGetPointervEXT) = (PFNGLGETPOINTERVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glGetPointervEXT");
- if (NULL == GLH_EXT_NAME(glGetPointervEXT))
- return FALSE;
- GLH_EXT_NAME(glIndexPointerEXT) = (PFNGLINDEXPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glIndexPointerEXT");
- if (NULL == GLH_EXT_NAME(glIndexPointerEXT))
- return FALSE;
- GLH_EXT_NAME(glNormalPointerEXT) = (PFNGLNORMALPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glNormalPointerEXT");
- if (NULL == GLH_EXT_NAME(glNormalPointerEXT))
- return FALSE;
- GLH_EXT_NAME(glTexCoordPointerEXT) = (PFNGLTEXCOORDPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glTexCoordPointerEXT");
- if (NULL == GLH_EXT_NAME(glTexCoordPointerEXT))
- return FALSE;
- GLH_EXT_NAME(glVertexPointerEXT) = (PFNGLVERTEXPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexPointerEXT");
- if (NULL == GLH_EXT_NAME(glVertexPointerEXT))
- return FALSE;
- GLH_EXT_NAME(glDrawArraysEXT) = (PFNGLDRAWARRAYSEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawArraysEXT");
- if (NULL == GLH_EXT_NAME(glDrawArraysEXT))
- return FALSE;
-#endif
-
-#ifdef GL_EXT_vertex_weighting
- } else if (0 == strcmp(extension, "GL_EXT_vertex_weighting")) {
- GLH_EXT_NAME(glVertexWeightfEXT) = (PFNGLVERTEXWEIGHTFEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexWeightfEXT");
- if (NULL == GLH_EXT_NAME(glVertexWeightfEXT))
- return FALSE;
- GLH_EXT_NAME(glVertexWeightfvEXT) = (PFNGLVERTEXWEIGHTFVEXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexWeightfvEXT");
- if (NULL == GLH_EXT_NAME(glVertexWeightfvEXT))
- return FALSE;
- GLH_EXT_NAME(glVertexWeightPointerEXT) = (PFNGLVERTEXWEIGHTPOINTEREXTPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexWeightPointerEXT");
- if (NULL == GLH_EXT_NAME(glVertexWeightPointerEXT))
- return FALSE;
-#endif
-
-#ifdef GL_NV_blend_square
- } else if (0 == strcmp(extension, "GL_NV_blend_square")) {
-#endif
-
-#ifdef GL_NV_evaluators
- } else if (0 == strcmp(extension, "GL_NV_evaluators")) {
- GLH_EXT_NAME(glMapControlPointsNV) = (PFNGLMAPCONTROLPOINTSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glMapControlPointsNV");
- if (NULL == GLH_EXT_NAME(glMapControlPointsNV))
- return FALSE;
- GLH_EXT_NAME(glMapParameterivNV) = (PFNGLMAPPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glMapParameterivNV");
- if (NULL == GLH_EXT_NAME(glMapParameterivNV))
- return FALSE;
- GLH_EXT_NAME(glMapParameterfvNV) = (PFNGLMAPPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glMapParameterfvNV");
- if (NULL == GLH_EXT_NAME(glMapParameterfvNV))
- return FALSE;
- GLH_EXT_NAME(glGetMapControlPointsNV) = (PFNGLGETMAPCONTROLPOINTSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapControlPointsNV");
- if (NULL == GLH_EXT_NAME(glGetMapControlPointsNV))
- return FALSE;
- GLH_EXT_NAME(glGetMapParameterivNV) = (PFNGLGETMAPPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapParameterivNV");
- if (NULL == GLH_EXT_NAME(glGetMapParameterivNV))
- return FALSE;
- GLH_EXT_NAME(glGetMapParameterfvNV) = (PFNGLGETMAPPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapParameterfvNV");
- if (NULL == GLH_EXT_NAME(glGetMapParameterfvNV))
- return FALSE;
- GLH_EXT_NAME(glGetMapAttribParameterivNV) = (PFNGLGETMAPATTRIBPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapAttribParameterivNV");
- if (NULL == GLH_EXT_NAME(glGetMapAttribParameterivNV))
- return FALSE;
- GLH_EXT_NAME(glGetMapAttribParameterfvNV) = (PFNGLGETMAPATTRIBPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetMapAttribParameterfvNV");
- if (NULL == GLH_EXT_NAME(glGetMapAttribParameterfvNV))
- return FALSE;
- GLH_EXT_NAME(glEvalMapsNV) = (PFNGLEVALMAPSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glEvalMapsNV");
- if (NULL == GLH_EXT_NAME(glEvalMapsNV))
- return FALSE;
-#endif
-
-#ifdef GL_NV_fence
- } else if (0 == strcmp(extension, "GL_NV_fence")) {
- GLH_EXT_NAME(glGenFencesNV) = (PFNGLGENFENCESNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGenFencesNV");
- if (NULL == GLH_EXT_NAME(glGenFencesNV))
- return FALSE;
- GLH_EXT_NAME(glDeleteFencesNV) = (PFNGLDELETEFENCESNVPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteFencesNV");
- if (NULL == GLH_EXT_NAME(glDeleteFencesNV))
- return FALSE;
- GLH_EXT_NAME(glSetFenceNV) = (PFNGLSETFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glSetFenceNV");
- if (NULL == GLH_EXT_NAME(glSetFenceNV))
- return FALSE;
- GLH_EXT_NAME(glTestFenceNV) = (PFNGLTESTFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glTestFenceNV");
- if (NULL == GLH_EXT_NAME(glTestFenceNV))
- return FALSE;
- GLH_EXT_NAME(glFinishFenceNV) = (PFNGLFINISHFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glFinishFenceNV");
- if (NULL == GLH_EXT_NAME(glFinishFenceNV))
- return FALSE;
- GLH_EXT_NAME(glIsFenceNV) = (PFNGLISFENCENVPROC)GLH_EXT_GET_PROC_ADDRESS("glIsFenceNV");
- if (NULL == GLH_EXT_NAME(glIsFenceNV))
- return FALSE;
- GLH_EXT_NAME(glGetFenceivNV) = (PFNGLGETFENCEIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetFenceivNV");
- if (NULL == GLH_EXT_NAME(glGetFenceivNV))
- return FALSE;
-#endif
-
-#ifdef GL_NV_fog_distance
- } else if (0 == strcmp(extension, "GL_NV_fog_distance")) {
-#endif
-
-#ifdef GL_NV_packed_depth_stencil
- } else if (0 == strcmp(extension, "GL_NV_packed_depth_stencil")) {
-#endif
-
-#ifdef GL_NV_register_combiners
- } else if (0 == strcmp(extension, "GL_NV_register_combiners")) {
- GLH_EXT_NAME(glCombinerParameterfvNV) = (PFNGLCOMBINERPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameterfvNV");
- if (NULL == GLH_EXT_NAME(glCombinerParameterfvNV))
- return FALSE;
- GLH_EXT_NAME(glCombinerParameterfNV) = (PFNGLCOMBINERPARAMETERFNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameterfNV");
- if (NULL == GLH_EXT_NAME(glCombinerParameterfNV))
- return FALSE;
- GLH_EXT_NAME(glCombinerParameterivNV) = (PFNGLCOMBINERPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameterivNV");
- if (NULL == GLH_EXT_NAME(glCombinerParameterivNV))
- return FALSE;
- GLH_EXT_NAME(glCombinerParameteriNV) = (PFNGLCOMBINERPARAMETERINVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerParameteriNV");
- if (NULL == GLH_EXT_NAME(glCombinerParameteriNV))
- return FALSE;
- GLH_EXT_NAME(glCombinerInputNV) = (PFNGLCOMBINERINPUTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerInputNV");
- if (NULL == GLH_EXT_NAME(glCombinerInputNV))
- return FALSE;
- GLH_EXT_NAME(glCombinerOutputNV) = (PFNGLCOMBINEROUTPUTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerOutputNV");
- if (NULL == GLH_EXT_NAME(glCombinerOutputNV))
- return FALSE;
- GLH_EXT_NAME(glFinalCombinerInputNV) = (PFNGLFINALCOMBINERINPUTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glFinalCombinerInputNV");
- if (NULL == GLH_EXT_NAME(glFinalCombinerInputNV))
- return FALSE;
- GLH_EXT_NAME(glGetCombinerInputParameterfvNV) = (PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerInputParameterfvNV");
- if (NULL == GLH_EXT_NAME(glGetCombinerInputParameterfvNV))
- return FALSE;
- GLH_EXT_NAME(glGetCombinerInputParameterivNV) = (PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerInputParameterivNV");
- if (NULL == GLH_EXT_NAME(glGetCombinerInputParameterivNV))
- return FALSE;
- GLH_EXT_NAME(glGetCombinerOutputParameterfvNV) = (PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerOutputParameterfvNV");
- if (NULL == GLH_EXT_NAME(glGetCombinerOutputParameterfvNV))
- return FALSE;
- GLH_EXT_NAME(glGetCombinerOutputParameterivNV) = (PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerOutputParameterivNV");
- if (NULL == GLH_EXT_NAME(glGetCombinerOutputParameterivNV))
- return FALSE;
- GLH_EXT_NAME(glGetFinalCombinerInputParameterfvNV) = (PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetFinalCombinerInputParameterfvNV");
- if (NULL == GLH_EXT_NAME(glGetFinalCombinerInputParameterfvNV))
- return FALSE;
- GLH_EXT_NAME(glGetFinalCombinerInputParameterivNV) = (PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetFinalCombinerInputParameterivNV");
- if (NULL == GLH_EXT_NAME(glGetFinalCombinerInputParameterivNV))
- return FALSE;
-#endif
-
-#ifdef GL_NV_register_combiners2
- } else if (0 == strcmp(extension, "GL_NV_register_combiners2")) {
- GLH_EXT_NAME(glCombinerStageParameterfvNV) = (PFNGLCOMBINERSTAGEPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glCombinerStageParameterfvNV");
- if (NULL == GLH_EXT_NAME(glCombinerStageParameterfvNV))
- return FALSE;
- GLH_EXT_NAME(glGetCombinerStageParameterfvNV) = (PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetCombinerStageParameterfvNV");
- if (NULL == GLH_EXT_NAME(glGetCombinerStageParameterfvNV))
- return FALSE;
-#endif
-
-#ifdef GL_NV_texgen_reflection
- } else if (0 == strcmp(extension, "GL_NV_texgen_reflection")) {
-#endif
-
-#ifdef GL_NV_texture_env_combine4
- } else if (0 == strcmp(extension, "GL_NV_texture_env_combine4")) {
-#endif
-
-#ifdef GL_NV_texture_rectangle
- } else if (0 == strcmp(extension, "GL_NV_texture_rectangle")) {
-#endif
-
-#ifdef GL_NV_texture_shader
- } else if (0 == strcmp(extension, "GL_NV_texture_shader")) {
-#endif
-
-#ifdef GL_NV_vertex_array_range
- } else if (0 == strcmp(extension, "GL_NV_vertex_array_range")) {
- GLH_EXT_NAME(glFlushVertexArrayRangeNV) = (PFNGLFLUSHVERTEXARRAYRANGENVPROC)GLH_EXT_GET_PROC_ADDRESS("glFlushVertexArrayRangeNV");
- if (NULL == GLH_EXT_NAME(glFlushVertexArrayRangeNV))
- return FALSE;
- GLH_EXT_NAME(glVertexArrayRangeNV) = (PFNGLVERTEXARRAYRANGENVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexArrayRangeNV");
- if (NULL == GLH_EXT_NAME(glVertexArrayRangeNV))
- return FALSE;
-# ifdef _WIN32
- GLH_EXT_NAME(wglAllocateMemoryNV) = (PFNWGLALLOCATEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("wglAllocateMemoryNV");
- if (NULL == GLH_EXT_NAME(wglAllocateMemoryNV))
- return FALSE;
-# endif
-# ifdef GLX_VERSION_1_3
- GLH_EXT_NAME(glXAllocateMemoryNV) = (PFNGLXALLOCATEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("glXAllocateMemoryNV");
- if (NULL == GLH_EXT_NAME(glXAllocateMemoryNV))
- return FALSE;
-# endif
-# ifdef _WIN32
- GLH_EXT_NAME(wglFreeMemoryNV) = (PFNWGLFREEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("wglFreeMemoryNV");
- if (NULL == GLH_EXT_NAME(wglFreeMemoryNV))
- return FALSE;
-# endif
-# ifdef GLX_VERSION_1_3
- GLH_EXT_NAME(glXFreeMemoryNV) = (PFNGLXFREEMEMORYNVPROC)GLH_EXT_GET_PROC_ADDRESS("glXFreeMemoryNV");
- if (NULL == GLH_EXT_NAME(glXFreeMemoryNV))
- return FALSE;
-# endif
-#endif
-
-#ifdef GL_NV_vertex_program
- } else if (0 == strcmp(extension, "GL_NV_vertex_program")) {
- GLH_EXT_NAME(glAreProgramsResidentNV) = (PFNGLAREPROGRAMSRESIDENTNVPROC)GLH_EXT_GET_PROC_ADDRESS("glAreProgramsResidentNV");
- if (NULL == GLH_EXT_NAME(glAreProgramsResidentNV))
- return FALSE;
- GLH_EXT_NAME(glBindProgramNV) = (PFNGLBINDPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glBindProgramNV");
- if (NULL == GLH_EXT_NAME(glBindProgramNV))
- return FALSE;
- GLH_EXT_NAME(glDeleteProgramsNV) = (PFNGLDELETEPROGRAMSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteProgramsNV");
- if (NULL == GLH_EXT_NAME(glDeleteProgramsNV))
- return FALSE;
- GLH_EXT_NAME(glExecuteProgramNV) = (PFNGLEXECUTEPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glExecuteProgramNV");
- if (NULL == GLH_EXT_NAME(glExecuteProgramNV))
- return FALSE;
- GLH_EXT_NAME(glGenProgramsNV) = (PFNGLGENPROGRAMSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGenProgramsNV");
- if (NULL == GLH_EXT_NAME(glGenProgramsNV))
- return FALSE;
- GLH_EXT_NAME(glGetProgramParameterdvNV) = (PFNGLGETPROGRAMPARAMETERDVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramParameterdvNV");
- if (NULL == GLH_EXT_NAME(glGetProgramParameterdvNV))
- return FALSE;
- GLH_EXT_NAME(glGetProgramParameterfvNV) = (PFNGLGETPROGRAMPARAMETERFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramParameterfvNV");
- if (NULL == GLH_EXT_NAME(glGetProgramParameterfvNV))
- return FALSE;
- GLH_EXT_NAME(glGetProgramivNV) = (PFNGLGETPROGRAMIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramivNV");
- if (NULL == GLH_EXT_NAME(glGetProgramivNV))
- return FALSE;
- GLH_EXT_NAME(glGetProgramStringNV) = (PFNGLGETPROGRAMSTRINGNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetProgramStringNV");
- if (NULL == GLH_EXT_NAME(glGetProgramStringNV))
- return FALSE;
- GLH_EXT_NAME(glGetTrackMatrixivNV) = (PFNGLGETTRACKMATRIXIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetTrackMatrixivNV");
- if (NULL == GLH_EXT_NAME(glGetTrackMatrixivNV))
- return FALSE;
- GLH_EXT_NAME(glGetVertexAttribdvNV) = (PFNGLGETVERTEXATTRIBDVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribdvNV");
- if (NULL == GLH_EXT_NAME(glGetVertexAttribdvNV))
- return FALSE;
- GLH_EXT_NAME(glGetVertexAttribfvNV) = (PFNGLGETVERTEXATTRIBFVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribfvNV");
- if (NULL == GLH_EXT_NAME(glGetVertexAttribfvNV))
- return FALSE;
- GLH_EXT_NAME(glGetVertexAttribivNV) = (PFNGLGETVERTEXATTRIBIVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribivNV");
- if (NULL == GLH_EXT_NAME(glGetVertexAttribivNV))
- return FALSE;
- GLH_EXT_NAME(glGetVertexAttribPointervNV) = (PFNGLGETVERTEXATTRIBPOINTERVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetVertexAttribPointervNV");
- if (NULL == GLH_EXT_NAME(glGetVertexAttribPointervNV))
- return FALSE;
- GLH_EXT_NAME(glIsProgramNV) = (PFNGLISPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glIsProgramNV");
- if (NULL == GLH_EXT_NAME(glIsProgramNV))
- return FALSE;
- GLH_EXT_NAME(glLoadProgramNV) = (PFNGLLOADPROGRAMNVPROC)GLH_EXT_GET_PROC_ADDRESS("glLoadProgramNV");
- if (NULL == GLH_EXT_NAME(glLoadProgramNV))
- return FALSE;
- GLH_EXT_NAME(glProgramParameter4dNV) = (PFNGLPROGRAMPARAMETER4DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4dNV");
- if (NULL == GLH_EXT_NAME(glProgramParameter4dNV))
- return FALSE;
- GLH_EXT_NAME(glProgramParameter4dvNV) = (PFNGLPROGRAMPARAMETER4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4dvNV");
- if (NULL == GLH_EXT_NAME(glProgramParameter4dvNV))
- return FALSE;
- GLH_EXT_NAME(glProgramParameter4fNV) = (PFNGLPROGRAMPARAMETER4FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4fNV");
- if (NULL == GLH_EXT_NAME(glProgramParameter4fNV))
- return FALSE;
- GLH_EXT_NAME(glProgramParameter4fvNV) = (PFNGLPROGRAMPARAMETER4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameter4fvNV");
- if (NULL == GLH_EXT_NAME(glProgramParameter4fvNV))
- return FALSE;
- GLH_EXT_NAME(glProgramParameters4dvNV) = (PFNGLPROGRAMPARAMETERS4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameters4dvNV");
- if (NULL == GLH_EXT_NAME(glProgramParameters4dvNV))
- return FALSE;
- GLH_EXT_NAME(glProgramParameters4fvNV) = (PFNGLPROGRAMPARAMETERS4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glProgramParameters4fvNV");
- if (NULL == GLH_EXT_NAME(glProgramParameters4fvNV))
- return FALSE;
- GLH_EXT_NAME(glRequestResidentProgramsNV) = (PFNGLREQUESTRESIDENTPROGRAMSNVPROC)GLH_EXT_GET_PROC_ADDRESS("glRequestResidentProgramsNV");
- if (NULL == GLH_EXT_NAME(glRequestResidentProgramsNV))
- return FALSE;
- GLH_EXT_NAME(glTrackMatrixNV) = (PFNGLTRACKMATRIXNVPROC)GLH_EXT_GET_PROC_ADDRESS("glTrackMatrixNV");
- if (NULL == GLH_EXT_NAME(glTrackMatrixNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribPointerNV) = (PFNGLVERTEXATTRIBPOINTERNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribPointerNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribPointerNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib1dNV) = (PFNGLVERTEXATTRIB1DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1dNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib1dvNV) = (PFNGLVERTEXATTRIB1DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1dvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib1fNV) = (PFNGLVERTEXATTRIB1FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1fNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib1fvNV) = (PFNGLVERTEXATTRIB1FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1fvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1fvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib1sNV) = (PFNGLVERTEXATTRIB1SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1sNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1sNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib1svNV) = (PFNGLVERTEXATTRIB1SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1svNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib1svNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib2dNV) = (PFNGLVERTEXATTRIB2DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2dNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib2dvNV) = (PFNGLVERTEXATTRIB2DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2dvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2dvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib2fNV) = (PFNGLVERTEXATTRIB2FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2fNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib2fvNV) = (PFNGLVERTEXATTRIB2FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2fvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2fvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib2sNV) = (PFNGLVERTEXATTRIB2SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2sNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2sNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib2svNV) = (PFNGLVERTEXATTRIB2SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib2svNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib2svNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib3dNV) = (PFNGLVERTEXATTRIB3DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3dNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib3dvNV) = (PFNGLVERTEXATTRIB3DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3dvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3dvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib3fNV) = (PFNGLVERTEXATTRIB3FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3fNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib3fvNV) = (PFNGLVERTEXATTRIB3FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3fvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3fvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib3sNV) = (PFNGLVERTEXATTRIB3SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3sNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3sNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib3svNV) = (PFNGLVERTEXATTRIB3SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib3svNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib3svNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib4dNV) = (PFNGLVERTEXATTRIB4DNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4dNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib4dvNV) = (PFNGLVERTEXATTRIB4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4dvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4dvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib4fNV) = (PFNGLVERTEXATTRIB4FNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4fNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib4fvNV) = (PFNGLVERTEXATTRIB4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4fvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4fvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib4sNV) = (PFNGLVERTEXATTRIB4SNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4sNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4sNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib4svNV) = (PFNGLVERTEXATTRIB4SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4svNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4svNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttrib4ubvNV) = (PFNGLVERTEXATTRIB4UBVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib4ubvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttrib4ubvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs1dvNV) = (PFNGLVERTEXATTRIBS1DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs1dvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs1dvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs1fvNV) = (PFNGLVERTEXATTRIBS1FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs1fvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs1fvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs1svNV) = (PFNGLVERTEXATTRIBS1SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs1svNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs1svNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs2dvNV) = (PFNGLVERTEXATTRIBS2DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs2dvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs2dvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs2fvNV) = (PFNGLVERTEXATTRIBS2FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs2fvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs2fvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs2svNV) = (PFNGLVERTEXATTRIBS2SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs2svNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs2svNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs3dvNV) = (PFNGLVERTEXATTRIBS3DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs3dvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs3dvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs3fvNV) = (PFNGLVERTEXATTRIBS3FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs3fvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs3fvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs3svNV) = (PFNGLVERTEXATTRIBS3SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs3svNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs3svNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs4dvNV) = (PFNGLVERTEXATTRIBS4DVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4dvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs4dvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs4fvNV) = (PFNGLVERTEXATTRIBS4FVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4fvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs4fvNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs4svNV) = (PFNGLVERTEXATTRIBS4SVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4svNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs4svNV))
- return FALSE;
- GLH_EXT_NAME(glVertexAttribs4ubvNV) = (PFNGLVERTEXATTRIBS4UBVNVPROC)GLH_EXT_GET_PROC_ADDRESS("glVertexAttribs4ubvNV");
- if (NULL == GLH_EXT_NAME(glVertexAttribs4ubvNV))
- return FALSE;
-#endif
-
-#ifdef GL_SGIS_generate_mipmap
- } else if (0 == strcmp(extension, "GL_SGIS_generate_mipmap")) {
-#endif
-
-#ifdef GL_SGIS_texture_lod
- } else if (0 == strcmp(extension, "GL_SGIS_texture_lod")) {
-#endif
-
-#ifdef GL_SGIX_depth_texture
- } else if (0 == strcmp(extension, "GL_SGIX_depth_texture")) {
-#endif
-
-#ifdef GL_SGIX_shadow
- } else if (0 == strcmp(extension, "GL_SGIX_shadow")) {
-#endif
-
-#ifdef GL_VERSION_1_2
- } else if (0 == strcmp(extension, "GL_VERSION_1_2")) {
- GLH_CORE_1_2_NAME(glBlendColor) = (PFNGLBLENDCOLORPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendColor");
- if (NULL == GLH_CORE_1_2_NAME(glBlendColor))
- return FALSE;
- GLH_CORE_1_2_NAME(glBlendEquation) = (PFNGLBLENDEQUATIONPROC)GLH_EXT_GET_PROC_ADDRESS("glBlendEquation");
- if (NULL == GLH_CORE_1_2_NAME(glBlendEquation))
- return FALSE;
- GLH_CORE_1_2_NAME(glDrawRangeElements) = (PFNGLDRAWRANGEELEMENTSPROC)GLH_EXT_GET_PROC_ADDRESS("glDrawRangeElements");
- if (NULL == GLH_CORE_1_2_NAME(glDrawRangeElements))
- return FALSE;
- GLH_CORE_1_2_NAME(glColorTable) = (PFNGLCOLORTABLEPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTable");
- if (NULL == GLH_CORE_1_2_NAME(glColorTable))
- return FALSE;
- GLH_CORE_1_2_NAME(glColorTableParameterfv) = (PFNGLCOLORTABLEPARAMETERFVPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableParameterfv");
- if (NULL == GLH_CORE_1_2_NAME(glColorTableParameterfv))
- return FALSE;
- GLH_CORE_1_2_NAME(glColorTableParameteriv) = (PFNGLCOLORTABLEPARAMETERIVPROC)GLH_EXT_GET_PROC_ADDRESS("glColorTableParameteriv");
- if (NULL == GLH_CORE_1_2_NAME(glColorTableParameteriv))
- return FALSE;
- GLH_CORE_1_2_NAME(glCopyColorTable) = (PFNGLCOPYCOLORTABLEPROC)GLH_EXT_GET_PROC_ADDRESS("glCopyColorTable");
- if (NULL == GLH_CORE_1_2_NAME(glCopyColorTable))
- return FALSE;
- GLH_CORE_1_2_NAME(glGetColorTable) = (PFNGLGETCOLORTABLEPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTable");
- if (NULL == GLH_CORE_1_2_NAME(glGetColorTable))
- return FALSE;
- GLH_CORE_1_2_NAME(glGetColorTableParameterfv) = (PFNGLGETCOLORTABLEPARAMETERFVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameterfv");
- if (NULL == GLH_CORE_1_2_NAME(glGetColorTableParameterfv))
- return FALSE;
- GLH_CORE_1_2_NAME(glGetColorTableParameteriv) = (PFNGLGETCOLORTABLEPARAMETERIVPROC)GLH_EXT_GET_PROC_ADDRESS("glGetColorTableParameteriv");
- if (NULL == GLH_CORE_1_2_NAME(glGetColorTableParameteriv))
- return FALSE;
- GLH_CORE_1_2_NAME(glTexImage3D) = (PFNGLTEXIMAGE3DPROC)GLH_EXT_GET_PROC_ADDRESS("glTexImage3D");
- if (NULL == GLH_CORE_1_2_NAME(glTexImage3D))
- return FALSE;
- GLH_CORE_1_2_NAME(glTexSubImage3D) = (PFNGLTEXSUBIMAGE3DPROC)GLH_EXT_GET_PROC_ADDRESS("glTexSubImage3D");
- if (NULL == GLH_CORE_1_2_NAME(glTexSubImage3D))
- return FALSE;
- GLH_CORE_1_2_NAME(glCopyTexSubImage3D) = (PFNGLCOPYTEXSUBIMAGE3DPROC)GLH_EXT_GET_PROC_ADDRESS("glCopyTexSubImage3D");
- if (NULL == GLH_CORE_1_2_NAME(glCopyTexSubImage3D))
- return FALSE;
-#endif
-
-#ifdef GL_WIN_swap_hint
- } else if (0 == strcmp(extension, "GL_WIN_swap_hint")) {
- GLH_EXT_NAME(glAddSwapHintRectWIN) = (PFNGLADDSWAPHINTRECTWINPROC)GLH_EXT_GET_PROC_ADDRESS("glAddSwapHintRectWIN");
- if (NULL == GLH_EXT_NAME(glAddSwapHintRectWIN))
- return FALSE;
-#endif
-
-#ifdef WGL_ARB_pbuffer
- } else if (0 == strcmp(extension, "WGL_ARB_pbuffer")) {
-# ifdef _WIN32
- GLH_EXT_NAME(wglCreatePbufferARB) = (PFNWGLCREATEPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglCreatePbufferARB");
- if (NULL == GLH_EXT_NAME(wglCreatePbufferARB))
- return FALSE;
-# endif
-# ifdef _WIN32
- GLH_EXT_NAME(wglGetPbufferDCARB) = (PFNWGLGETPBUFFERDCARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetPbufferDCARB");
- if (NULL == GLH_EXT_NAME(wglGetPbufferDCARB))
- return FALSE;
-# endif
-# ifdef _WIN32
- GLH_EXT_NAME(wglReleasePbufferDCARB) = (PFNWGLRELEASEPBUFFERDCARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglReleasePbufferDCARB");
- if (NULL == GLH_EXT_NAME(wglReleasePbufferDCARB))
- return FALSE;
-# endif
-# ifdef _WIN32
- GLH_EXT_NAME(wglDestroyPbufferARB) = (PFNWGLDESTROYPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglDestroyPbufferARB");
- if (NULL == GLH_EXT_NAME(wglDestroyPbufferARB))
- return FALSE;
-# endif
-# ifdef _WIN32
- GLH_EXT_NAME(wglQueryPbufferARB) = (PFNWGLQUERYPBUFFERARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglQueryPbufferARB");
- if (NULL == GLH_EXT_NAME(wglQueryPbufferARB))
- return FALSE;
-# endif
-#endif
-
-#ifdef WGL_ARB_render_texture
-# ifdef _WIN32
- GLH_EXT_NAME(wglBindTexImageARB) = (PFNWGLBINDTEXIMAGEARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglBindTexImageARB");
- if (NULL == GLH_EXT_NAME(wglBindTexImageARB))
- return FALSE;
-# endif
-# ifdef _WIN32
- GLH_EXT_NAME(wglReleaseTexImageARB) = (PFNWGLRELEASETEXIMAGEARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglReleaseTexImageARB");
- if (NULL == GLH_EXT_NAME(wglReleaseTexImageARB))
- return FALSE;
-# endif
-# ifdef _WIN32
- GLH_EXT_NAME(wglSetPbufferAttribARB) = (PFNWGLSETPBUFFERATTRIBARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglSetPbufferAttribARB");
- if (NULL == GLH_EXT_NAME(wglSetPbufferAttribARB))
- return FALSE;
-# endif
-#endif
-
-#ifdef WGL_ARB_pixel_format
- } else if (0 == strcmp(extension, "WGL_ARB_pixel_format")) {
-# ifdef _WIN32
- GLH_EXT_NAME(wglGetPixelFormatAttribivARB) = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetPixelFormatAttribivARB");
- if (NULL == GLH_EXT_NAME(wglGetPixelFormatAttribivARB))
- return FALSE;
-# endif
-# ifdef _WIN32
- GLH_EXT_NAME(wglGetPixelFormatAttribfvARB) = (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetPixelFormatAttribfvARB");
- if (NULL == GLH_EXT_NAME(wglGetPixelFormatAttribfvARB))
- return FALSE;
-# endif
-# ifdef _WIN32
- GLH_EXT_NAME(wglChoosePixelFormatARB) = (PFNWGLCHOOSEPIXELFORMATARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglChoosePixelFormatARB");
- if (NULL == GLH_EXT_NAME(wglChoosePixelFormatARB))
- return FALSE;
-# endif
-#endif
-
- } else {
- return FALSE;
- }
- return TRUE;
-}
-#endif
-
-#else // defined(__APPLE__)
-
-#ifdef GLH_EXT_SINGLE_FILE
-
-int glh_init_extension(const char* extension)
-{
- // MBW -- XXX -- Should this check for extension availability?
- return TRUE;
-}
-#endif // GLH_EXT_SINGLE_FILE
-
-#endif // defined(__APPLE__)
-
-#undef GLH_EXT_SINGLE_FILE
-
-#endif /* GLH_GENEXT_H */
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index f9b387b00b..fd20f2ad15 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -288,7 +288,8 @@ attributedStringInfo getSegments(NSAttributedString *str)
if (vsync)
{
- [glContext setValues:(const GLint*)1 forParameter:NSOpenGLCPSwapInterval];
+ GLint value = 1;
+ [glContext setValues:&value forParameter:NSOpenGLCPSwapInterval];
} else {
// supress this error after move to Xcode 7:
// error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 30bc743e72..f4678a70c5 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -137,6 +137,12 @@ BOOL LLWindow::canDelete()
return TRUE;
}
+//virtual
+void LLWindow::setTitle(const std::string title)
+{
+ // the action happens in the platform specific impl
+}
+
// virtual
void LLWindow::incBusyCount()
{
@@ -397,7 +403,7 @@ LLWindow* LLWindowManager::createWindow(
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags,
BOOL fullscreen,
BOOL clearBg,
- BOOL disable_vsync,
+ BOOL enable_vsync,
BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
@@ -409,26 +415,26 @@ LLWindow* LLWindowManager::createWindow(
#if LL_MESA_HEADLESS
new_window = new LLWindowMesaHeadless(callbacks,
title, name, x, y, width, height, flags,
- fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
+ fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth);
#elif LL_SDL
new_window = new LLWindowSDL(callbacks,
title, x, y, width, height, flags,
- fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
+ fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#elif LL_WINDOWS
new_window = new LLWindowWin32(callbacks,
title, name, x, y, width, height, flags,
- fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
+ fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#elif LL_DARWIN
new_window = new LLWindowMacOSX(callbacks,
title, name, x, y, width, height, flags,
- fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
+ fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#endif
}
else
{
new_window = new LLWindowHeadless(callbacks,
title, name, x, y, width, height, flags,
- fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
+ fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth);
}
if (FALSE == new_window->isValid())
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index d4d5b76937..0edf39f6ef 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -77,15 +77,37 @@ public:
BOOL setSize(LLCoordScreen size);
BOOL setSize(LLCoordWindow size);
virtual void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true);
- virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) = 0;
- virtual BOOL setCursorPosition(LLCoordWindow position) = 0;
+ virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL) = 0;
+
+ //create a new GL context that shares a namespace with this Window's main GL context and make it current on the current thread
+ // returns a pointer to be handed back to destroySharedConext/makeContextCurrent
+ virtual void* createSharedContext() = 0;
+ //make the given context current on the current thread
+ virtual void makeContextCurrent(void* context) = 0;
+ //destroy the given context that was retrieved by createSharedContext()
+ //Must be called on the same thread that called createSharedContext()
+ virtual void destroySharedContext(void* context) = 0;
+
+ virtual void toggleVSync(bool enable_vsync) = 0;
+
+ virtual BOOL setCursorPosition(LLCoordWindow position) = 0;
virtual BOOL getCursorPosition(LLCoordWindow *position) = 0;
+#if LL_WINDOWS
+ virtual BOOL getCursorDelta(LLCoordCommon* delta) = 0;
+#endif
virtual void showCursor() = 0;
virtual void hideCursor() = 0;
virtual BOOL isCursorHidden() = 0;
virtual void showCursorFromMouseMove() = 0;
virtual void hideCursorUntilMouseMove() = 0;
+ // Provide a way to set the Viewer window title after the
+ // windows has been created. The initial use case for this
+ // is described in SL-16102 (update window title with agent
+ // name, location etc. for non-interactive viewer) but it
+ // may also be useful in other cases.
+ virtual void setTitle(const std::string title);
+
// These two functions create a way to make a busy cursor instead
// of an arrow when someone's busy doing something. Draw an
// arrow/hour if busycount > 0.
@@ -274,7 +296,7 @@ public:
U32 flags = 0,
BOOL fullscreen = FALSE,
BOOL clearBg = FALSE,
- BOOL disable_vsync = TRUE,
+ BOOL enable_vsync = FALSE,
BOOL use_gl = TRUE,
BOOL ignore_pixel_depth = FALSE,
U32 fsaa_samples = 0);
diff --git a/indra/llwindow/llwindowheadless.cpp b/indra/llwindow/llwindowheadless.cpp
index 70f473281b..c3738af6ca 100644
--- a/indra/llwindow/llwindowheadless.cpp
+++ b/indra/llwindow/llwindowheadless.cpp
@@ -35,7 +35,7 @@
//
LLWindowHeadless::LLWindowHeadless(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags, BOOL fullscreen, BOOL clear_background,
- BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
+ BOOL enable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
: LLWindow(callbacks, fullscreen, flags)
{
// Initialize a headless keyboard.
diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h
index c692666df1..410da79623 100644
--- a/indra/llwindow/llwindowheadless.h
+++ b/indra/llwindow/llwindowheadless.h
@@ -48,9 +48,16 @@ public:
/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;};
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size) {return FALSE;};
- /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
- /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
- /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
+ /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
+ void* createSharedContext() { return nullptr; }
+ void makeContextCurrent(void*) {}
+ void destroySharedContext(void*) {}
+ /*virtual*/ void toggleVSync(bool enable_vsync) { }
+ /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
+ /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
+#if LL_WINDOWS
+ /*virtual*/ BOOL getCursorDelta(LLCoordCommon* delta) { return FALSE; }
+#endif
/*virtual*/ void showCursor() {};
/*virtual*/ void hideCursor() {};
/*virtual*/ void showCursorFromMouseMove() {};
@@ -97,7 +104,7 @@ public:
S32 x, S32 y,
S32 width, S32 height,
U32 flags, BOOL fullscreen, BOOL clear_background,
- BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
+ BOOL enable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
virtual ~LLWindowHeadless();
private:
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 24ce5131d5..bc4f07941b 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -111,7 +111,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
- BOOL disable_vsync, BOOL use_gl,
+ BOOL enable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
: LLWindow(NULL, fullscreen, flags)
@@ -165,7 +165,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
// Stash an object pointer for OSMessageBox()
gWindowImplementation = this;
// Create the GL context and set it up for windowed or fullscreen, as appropriate.
- if(createContext(x, y, width, height, 32, fullscreen, disable_vsync))
+ if(createContext(x, y, width, height, 32, fullscreen, enable_vsync))
{
if(mWindow != NULL)
{
@@ -619,7 +619,7 @@ void LLWindowMacOSX::getMouseDeltas(float* delta)
delta[1] = mCursorLastEventDeltaY;
}
-BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync)
+BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL enable_vsync)
{
BOOL glNeedsInit = FALSE;
@@ -634,7 +634,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
{
// Our OpenGL view is already defined within SecondLife.xib.
// Get the view instead.
- mGLView = createOpenGLView(mWindow, mFSAASamples, !disable_vsync);
+ mGLView = createOpenGLView(mWindow, mFSAASamples, enable_vsync);
mContext = getCGLContextObj(mGLView);
// Since we just created the context, it needs to be set up.
@@ -661,17 +661,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
}
// Disable vertical sync for swap
- GLint frames_per_swap = 0;
- if (disable_vsync)
- {
- frames_per_swap = 0;
- }
- else
- {
- frames_per_swap = 1;
- }
-
- CGLSetParameter(mContext, kCGLCPSwapInterval, &frames_per_swap);
+ toggleVSync(enable_vsync);
//enable multi-threaded OpenGL
if (sUseMultGL)
@@ -698,7 +688,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
// We only support OS X 10.7's fullscreen app mode which is literally a full screen window that fills a virtual desktop.
// This makes this method obsolete.
-BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
+BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp)
{
return FALSE;
}
@@ -1920,6 +1910,49 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
allowDirectMarkedTextInput(b, mGLView); // mLanguageTextInputAllowed and mMarkedTextAllowed should be updated at once (by Pell Smit
}
+class sharedContext
+{
+public:
+ CGLContextObj mContext;
+};
+
+void* LLWindowMacOSX::createSharedContext()
+{
+ sharedContext* sc = new sharedContext();
+ CGLCreateContext(mPixelFormat, mContext, &(sc->mContext));
+
+ return (void *)sc;
+}
+
+void LLWindowMacOSX::makeContextCurrent(void* context)
+{
+ CGLSetCurrentContext(((sharedContext*)context)->mContext);
+}
+
+void LLWindowMacOSX::destroySharedContext(void* context)
+{
+ sharedContext* sc = (sharedContext*)context;
+
+ CGLDestroyContext(sc->mContext);
+
+ delete sc;
+}
+
+void LLWindowMacOSX::toggleVSync(bool enable_vsync)
+{
+ GLint frames_per_swap = 0;
+ if (!enable_vsync)
+ {
+ frames_per_swap = 0;
+ }
+ else
+ {
+ frames_per_swap = 1;
+ }
+
+ CGLSetParameter(mContext, kCGLCPSwapInterval, &frames_per_swap);
+}
+
void LLWindowMacOSX::interruptLanguageTextInput()
{
commitCurrentPreedit(mGLView);
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index bf45238c8d..b0f339e1db 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -41,85 +41,84 @@
#undef verify
#undef require
-
class LLWindowMacOSX : public LLWindow
{
public:
- /*virtual*/ void show();
- /*virtual*/ void hide();
- /*virtual*/ void close();
- /*virtual*/ BOOL getVisible();
- /*virtual*/ BOOL getMinimized();
- /*virtual*/ BOOL getMaximized();
- /*virtual*/ BOOL maximize();
- /*virtual*/ void minimize();
- /*virtual*/ void restore();
- /*virtual*/ BOOL getFullscreen();
- /*virtual*/ BOOL getPosition(LLCoordScreen *position);
- /*virtual*/ BOOL getSize(LLCoordScreen *size);
- /*virtual*/ BOOL getSize(LLCoordWindow *size);
- /*virtual*/ BOOL setPosition(LLCoordScreen position);
- /*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
- /*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
- /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
- /*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
- /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
- /*virtual*/ void showCursor();
- /*virtual*/ void hideCursor();
- /*virtual*/ void showCursorFromMouseMove();
- /*virtual*/ void hideCursorUntilMouseMove();
- /*virtual*/ BOOL isCursorHidden();
- /*virtual*/ void updateCursor();
- /*virtual*/ ECursorType getCursor() const;
- /*virtual*/ void captureMouse();
- /*virtual*/ void releaseMouse();
- /*virtual*/ void setMouseClipping( BOOL b );
- /*virtual*/ BOOL isClipboardTextAvailable();
- /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst);
- /*virtual*/ BOOL copyTextToClipboard(const LLWString & src);
- /*virtual*/ void flashIcon(F32 seconds);
- /*virtual*/ F32 getGamma();
- /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
- /*virtual*/ U32 getFSAASamples();
- /*virtual*/ void setFSAASamples(const U32 fsaa_samples);
- /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma)
- /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
- /*virtual*/ void gatherInput();
- /*virtual*/ void delayInputProcessing() {};
- /*virtual*/ void swapBuffers();
+ void show() override;
+ void hide() override;
+ void close() override;
+ BOOL getVisible() override;
+ BOOL getMinimized() override;
+ BOOL getMaximized() override;
+ BOOL maximize() override;
+ void minimize() override;
+ void restore() override;
+ BOOL getFullscreen();
+ BOOL getPosition(LLCoordScreen *position) override;
+ BOOL getSize(LLCoordScreen *size) override;
+ BOOL getSize(LLCoordWindow *size) override;
+ BOOL setPosition(LLCoordScreen position) override;
+ BOOL setSizeImpl(LLCoordScreen size) override;
+ BOOL setSizeImpl(LLCoordWindow size) override;
+ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL) override;
+ BOOL setCursorPosition(LLCoordWindow position) override;
+ BOOL getCursorPosition(LLCoordWindow *position) override;
+ void showCursor() override;
+ void hideCursor() override;
+ void showCursorFromMouseMove() override;
+ void hideCursorUntilMouseMove() override;
+ BOOL isCursorHidden() override;
+ void updateCursor() override;
+ ECursorType getCursor() const override;
+ void captureMouse() override;
+ void releaseMouse() override;
+ void setMouseClipping( BOOL b ) override;
+ BOOL isClipboardTextAvailable() override;
+ BOOL pasteTextFromClipboard(LLWString &dst) override;
+ BOOL copyTextToClipboard(const LLWString & src) override;
+ void flashIcon(F32 seconds) override;
+ F32 getGamma() override;
+ BOOL setGamma(const F32 gamma) override; // Set the gamma
+ U32 getFSAASamples() override;
+ void setFSAASamples(const U32 fsaa_samples) override;
+ BOOL restoreGamma() override; // Restore original gamma table (before updating gamma)
+ ESwapMethod getSwapMethod() override { return mSwapMethod; }
+ void gatherInput() override;
+ void delayInputProcessing() override {};
+ void swapBuffers() override;
// handy coordinate space conversion routines
- /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to);
- /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to);
- /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordGL *to);
- /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordWindow *to);
- /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordGL *to);
- /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordScreen *to);
+ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) override;
+ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) override;
+ BOOL convertCoords(LLCoordWindow from, LLCoordGL *to) override;
+ BOOL convertCoords(LLCoordGL from, LLCoordWindow *to) override;
+ BOOL convertCoords(LLCoordScreen from, LLCoordGL *to) override;
+ BOOL convertCoords(LLCoordGL from, LLCoordScreen *to) override;
- /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions);
- /*virtual*/ F32 getNativeAspectRatio();
- /*virtual*/ F32 getPixelAspectRatio();
- /*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; }
+ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) override;
+ F32 getNativeAspectRatio() override;
+ F32 getPixelAspectRatio() override;
+ void setNativeAspectRatio(F32 ratio) override { mOverrideAspectRatio = ratio; }
- /*virtual*/ void beforeDialog();
- /*virtual*/ void afterDialog();
+ void beforeDialog() override;
+ void afterDialog() override;
- /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b);
+ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b) override;
- /*virtual*/ void *getPlatformWindow();
- /*virtual*/ void bringToFront() {};
+ void *getPlatformWindow() override;
+ void bringToFront() override {};
- /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b);
- /*virtual*/ void interruptLanguageTextInput();
- /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
- /*virtual*/ F32 getSystemUISize();
+ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) override;
+ void interruptLanguageTextInput() override;
+ void spawnWebBrowser(const std::string& escaped_url, bool async) override;
+ F32 getSystemUISize() override;
static std::vector<std::string> getDisplaysResolutionList();
static std::vector<std::string> getDynamicFallbackFontList();
// Provide native key event data
- /*virtual*/ LLSD getNativeKeyData();
+ LLSD getNativeKeyData() override;
void* getWindow() { return mWindow; }
LLWindowCallbacks* getCallbacks() { return mCallbacks; }
@@ -132,16 +131,27 @@ public:
bool allowsLanguageInput() { return mLanguageTextInputAllowed; }
+ //create a new GL context that shares a namespace with this Window's main GL context and make it current on the current thread
+ // returns a pointer to be handed back to destroySharedConext/makeContextCurrent
+ void* createSharedContext() override;
+ //make the given context current on the current thread
+ void makeContextCurrent(void* context) override;
+ //destroy the given context that was retrieved by createSharedContext()
+ //Must be called on the same thread that called createSharedContext()
+ void destroySharedContext(void* context) override;
+
+ void toggleVSync(bool enable_vsync) override;
+
protected:
LLWindowMacOSX(LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
- BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
+ BOOL fullscreen, BOOL clearBg, BOOL enable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples);
~LLWindowMacOSX();
void initCursors();
- BOOL isValid();
+ BOOL isValid() override;
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
@@ -157,7 +167,7 @@ protected:
BOOL shouldPostQuit() { return mPostQuit; }
//Satisfy MAINT-3135 and MAINT-3288 with a flag.
- /*virtual */ void setOldResize(bool oldresize) {setResizeMode(oldresize, mGLView); }
+ /*virtual */ void setOldResize(bool oldresize) override {setResizeMode(oldresize, mGLView); }
private:
void restoreGLContext();
@@ -168,7 +178,7 @@ protected:
//
// create or re-create the GL context/window. Called from the constructor and switchContext().
- BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync);
+ BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL enable_vsync);
void destroyContext();
void setupFailure(const std::string& text, const std::string& caption, U32 type);
void adjustCursorDecouple(bool warpingMouse = false);
@@ -231,9 +241,9 @@ public:
LLSplashScreenMacOSX();
virtual ~LLSplashScreenMacOSX();
- /*virtual*/ void showImpl();
- /*virtual*/ void updateImpl(const std::string& mesg);
- /*virtual*/ void hideImpl();
+ void showImpl();
+ void updateImpl(const std::string& mesg);
+ void hideImpl();
private:
WindowRef mWindow;
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index a32346bfd3..1f3823509c 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -45,6 +45,8 @@
#include "lldir.h"
#include "llsdutil.h"
#include "llglslshader.h"
+#include "llthreadsafequeue.h"
+#include "stringize.h"
// System includes
#include <commdlg.h>
@@ -54,6 +56,10 @@
#include <shellapi.h>
#include <fstream>
#include <Imm.h>
+#include <iomanip>
+#include <future>
+#include <sstream>
+#include <utility> // std::pair
// Require DirectInput version 8
#define DIRECTINPUT_VERSION 0x0800
@@ -77,8 +83,24 @@ const F32 ICON_FLASH_TIME = 0.5f;
#define USER_DEFAULT_SCREEN_DPI 96 // Win7
#endif
+// Claim a couple unused GetMessage() message IDs
+const UINT WM_DUMMY_(WM_USER + 0x0017);
+const UINT WM_POST_FUNCTION_(WM_USER + 0x0018);
+
extern BOOL gDebugWindowProc;
+static std::thread::id sWindowThreadId;
+static std::thread::id sMainThreadId;
+
+#if 1 // flip to zero to enable assertions for functions being called from wrong thread
+#define ASSERT_MAIN_THREAD()
+#define ASSERT_WINDOW_THREAD()
+#else
+#define ASSERT_MAIN_THREAD() llassert(LLThread::currentID() == sMainThreadId)
+#define ASSERT_WINDOW_THREAD() llassert(LLThread::currentID() == sWindowThreadId)
+#endif
+
+
LPWSTR gIconResource = IDI_APPLICATION;
LPDIRECTINPUT8 gDirectInput8;
@@ -161,23 +183,19 @@ DWORD LLWindowWin32::sWinIMESentenceMode = IME_SMODE_AUTOMATIC;
LLCoordWindow LLWindowWin32::sWinIMEWindowPosition(-1,-1);
// The following class LLWinImm delegates Windows IMM APIs.
-// We need this because some language versions of Windows,
-// e.g., US version of Windows XP, doesn't install IMM32.DLL
-// as a default, and we can't link against imm32.lib statically.
-// I believe DLL loading of this type is best suited to do
-// in a static initialization of a class. What I'm not sure is
-// whether it follows the Linden Conding Standard...
-// See http://wiki.secondlife.com/wiki/Coding_standards#Static_Members
+// It was originally introduced to support US Windows XP, on which we needed
+// to dynamically load IMM32.DLL and use GetProcAddress to resolve its entry
+// points. Now that that's moot, we retain this wrapper only for hooks for
+// metrics.
class LLWinImm
{
public:
- static bool isAvailable() { return sTheInstance.mHImmDll != NULL; }
+ static bool isAvailable() { return true; }
public:
// Wrappers for IMM API.
static BOOL isIME(HKL hkl);
- static HWND getDefaultIMEWnd(HWND hwnd);
static HIMC getContext(HWND hwnd);
static BOOL releaseContext(HWND hwnd, HIMC himc);
static BOOL getOpenStatus(HIMC himc);
@@ -191,236 +209,96 @@ public:
static BOOL setCompositionFont(HIMC himc, LPLOGFONTW logfont);
static BOOL setCandidateWindow(HIMC himc, LPCANDIDATEFORM candidate_form);
static BOOL notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value);
-
-private:
- LLWinImm();
- ~LLWinImm();
-
-private:
- // Pointers to IMM API.
- BOOL (WINAPI *mImmIsIME)(HKL);
- HWND (WINAPI *mImmGetDefaultIMEWnd)(HWND);
- HIMC (WINAPI *mImmGetContext)(HWND);
- BOOL (WINAPI *mImmReleaseContext)(HWND, HIMC);
- BOOL (WINAPI *mImmGetOpenStatus)(HIMC);
- BOOL (WINAPI *mImmSetOpenStatus)(HIMC, BOOL);
- BOOL (WINAPI *mImmGetConversionStatus)(HIMC, LPDWORD, LPDWORD);
- BOOL (WINAPI *mImmSetConversionStatus)(HIMC, DWORD, DWORD);
- BOOL (WINAPI *mImmGetCompostitionWindow)(HIMC, LPCOMPOSITIONFORM);
- BOOL (WINAPI *mImmSetCompostitionWindow)(HIMC, LPCOMPOSITIONFORM);
- LONG (WINAPI *mImmGetCompositionString)(HIMC, DWORD, LPVOID, DWORD);
- BOOL (WINAPI *mImmSetCompositionString)(HIMC, DWORD, LPVOID, DWORD, LPVOID, DWORD);
- BOOL (WINAPI *mImmSetCompositionFont)(HIMC, LPLOGFONTW);
- BOOL (WINAPI *mImmSetCandidateWindow)(HIMC, LPCANDIDATEFORM);
- BOOL (WINAPI *mImmNotifyIME)(HIMC, DWORD, DWORD, DWORD);
-
-private:
- HMODULE mHImmDll;
- static LLWinImm sTheInstance;
};
-LLWinImm LLWinImm::sTheInstance;
-
-LLWinImm::LLWinImm() : mHImmDll(NULL)
-{
- // Check system metrics
- if ( !GetSystemMetrics( SM_IMMENABLED ) )
- return;
-
- mHImmDll = LoadLibraryA("Imm32");
- if (mHImmDll != NULL)
- {
- mImmIsIME = (BOOL (WINAPI *)(HKL)) GetProcAddress(mHImmDll, "ImmIsIME");
- mImmGetDefaultIMEWnd = (HWND (WINAPI *)(HWND)) GetProcAddress(mHImmDll, "ImmGetDefaultIMEWnd");
- mImmGetContext = (HIMC (WINAPI *)(HWND)) GetProcAddress(mHImmDll, "ImmGetContext");
- mImmReleaseContext = (BOOL (WINAPI *)(HWND, HIMC)) GetProcAddress(mHImmDll, "ImmReleaseContext");
- mImmGetOpenStatus = (BOOL (WINAPI *)(HIMC)) GetProcAddress(mHImmDll, "ImmGetOpenStatus");
- mImmSetOpenStatus = (BOOL (WINAPI *)(HIMC, BOOL)) GetProcAddress(mHImmDll, "ImmSetOpenStatus");
- mImmGetConversionStatus = (BOOL (WINAPI *)(HIMC, LPDWORD, LPDWORD)) GetProcAddress(mHImmDll, "ImmGetConversionStatus");
- mImmSetConversionStatus = (BOOL (WINAPI *)(HIMC, DWORD, DWORD)) GetProcAddress(mHImmDll, "ImmSetConversionStatus");
- mImmGetCompostitionWindow = (BOOL (WINAPI *)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(mHImmDll, "ImmGetCompositionWindow");
- mImmSetCompostitionWindow = (BOOL (WINAPI *)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(mHImmDll, "ImmSetCompositionWindow");
- mImmGetCompositionString= (LONG (WINAPI *)(HIMC, DWORD, LPVOID, DWORD)) GetProcAddress(mHImmDll, "ImmGetCompositionStringW");
- mImmSetCompositionString= (BOOL (WINAPI *)(HIMC, DWORD, LPVOID, DWORD, LPVOID, DWORD)) GetProcAddress(mHImmDll, "ImmSetCompositionStringW");
- mImmSetCompositionFont = (BOOL (WINAPI *)(HIMC, LPLOGFONTW)) GetProcAddress(mHImmDll, "ImmSetCompositionFontW");
- mImmSetCandidateWindow = (BOOL (WINAPI *)(HIMC, LPCANDIDATEFORM)) GetProcAddress(mHImmDll, "ImmSetCandidateWindow");
- mImmNotifyIME = (BOOL (WINAPI *)(HIMC, DWORD, DWORD, DWORD)) GetProcAddress(mHImmDll, "ImmNotifyIME");
-
- if (mImmIsIME == NULL ||
- mImmGetDefaultIMEWnd == NULL ||
- mImmGetContext == NULL ||
- mImmReleaseContext == NULL ||
- mImmGetOpenStatus == NULL ||
- mImmSetOpenStatus == NULL ||
- mImmGetConversionStatus == NULL ||
- mImmSetConversionStatus == NULL ||
- mImmGetCompostitionWindow == NULL ||
- mImmSetCompostitionWindow == NULL ||
- mImmGetCompositionString == NULL ||
- mImmSetCompositionString == NULL ||
- mImmSetCompositionFont == NULL ||
- mImmSetCandidateWindow == NULL ||
- mImmNotifyIME == NULL)
- {
- // If any of the above API entires are not found, we can't use IMM API.
- // So, turn off the IMM support. We should log some warning message in
- // the case, since it is very unusual; these APIs are available from
- // the beginning, and all versions of IMM32.DLL should have them all.
- // Unfortunately, this code may be executed before initialization of
- // the logging channel (LL_WARNS()), and we can't do it here... Yes, this
- // is one of disadvantages to use static constraction to DLL loading.
- FreeLibrary(mHImmDll);
- mHImmDll = NULL;
-
- // If we unload the library, make sure all the function pointers are cleared
- mImmIsIME = NULL;
- mImmGetDefaultIMEWnd = NULL;
- mImmGetContext = NULL;
- mImmReleaseContext = NULL;
- mImmGetOpenStatus = NULL;
- mImmSetOpenStatus = NULL;
- mImmGetConversionStatus = NULL;
- mImmSetConversionStatus = NULL;
- mImmGetCompostitionWindow = NULL;
- mImmSetCompostitionWindow = NULL;
- mImmGetCompositionString = NULL;
- mImmSetCompositionString = NULL;
- mImmSetCompositionFont = NULL;
- mImmSetCandidateWindow = NULL;
- mImmNotifyIME = NULL;
- }
- }
-}
-
-
// static
-BOOL LLWinImm::isIME(HKL hkl)
+BOOL LLWinImm::isIME(HKL hkl)
{
- if ( sTheInstance.mImmIsIME )
- return sTheInstance.mImmIsIME(hkl);
- return FALSE;
+ return ImmIsIME(hkl);
}
// static
HIMC LLWinImm::getContext(HWND hwnd)
{
- if ( sTheInstance.mImmGetContext )
- return sTheInstance.mImmGetContext(hwnd);
- return 0;
+ return ImmGetContext(hwnd);
}
//static
BOOL LLWinImm::releaseContext(HWND hwnd, HIMC himc)
{
- if ( sTheInstance.mImmIsIME )
- return sTheInstance.mImmReleaseContext(hwnd, himc);
- return FALSE;
+ return ImmReleaseContext(hwnd, himc);
}
// static
BOOL LLWinImm::getOpenStatus(HIMC himc)
{
- if ( sTheInstance.mImmGetOpenStatus )
- return sTheInstance.mImmGetOpenStatus(himc);
- return FALSE;
+ return ImmGetOpenStatus(himc);
}
// static
-BOOL LLWinImm::setOpenStatus(HIMC himc, BOOL status)
+BOOL LLWinImm::setOpenStatus(HIMC himc, BOOL status)
{
- if ( sTheInstance.mImmSetOpenStatus )
- return sTheInstance.mImmSetOpenStatus(himc, status);
- return FALSE;
+ return ImmSetOpenStatus(himc, status);
}
// static
BOOL LLWinImm::getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence)
{
- if ( sTheInstance.mImmGetConversionStatus )
- return sTheInstance.mImmGetConversionStatus(himc, conversion, sentence);
- return FALSE;
+ return ImmGetConversionStatus(himc, conversion, sentence);
}
// static
BOOL LLWinImm::setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence)
{
- if ( sTheInstance.mImmSetConversionStatus )
- return sTheInstance.mImmSetConversionStatus(himc, conversion, sentence);
- return FALSE;
+ return ImmSetConversionStatus(himc, conversion, sentence);
}
// static
BOOL LLWinImm::getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form)
{
- if ( sTheInstance.mImmGetCompostitionWindow )
- return sTheInstance.mImmGetCompostitionWindow(himc, form);
- return FALSE;
+ return ImmGetCompositionWindow(himc, form);
}
// static
BOOL LLWinImm::setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form)
{
- if ( sTheInstance.mImmSetCompostitionWindow )
- return sTheInstance.mImmSetCompostitionWindow(himc, form);
- return FALSE;
+ return ImmSetCompositionWindow(himc, form);
}
// static
LONG LLWinImm::getCompositionString(HIMC himc, DWORD index, LPVOID data, DWORD length)
{
- if ( sTheInstance.mImmGetCompositionString )
- return sTheInstance.mImmGetCompositionString(himc, index, data, length);
- return FALSE;
+ return ImmGetCompositionString(himc, index, data, length);
}
// static
BOOL LLWinImm::setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength)
{
- if ( sTheInstance.mImmSetCompositionString )
- return sTheInstance.mImmSetCompositionString(himc, index, pComp, compLength, pRead, readLength);
- return FALSE;
+ return ImmSetCompositionString(himc, index, pComp, compLength, pRead, readLength);
}
// static
BOOL LLWinImm::setCompositionFont(HIMC himc, LPLOGFONTW pFont)
{
- if ( sTheInstance.mImmSetCompositionFont )
- return sTheInstance.mImmSetCompositionFont(himc, pFont);
- return FALSE;
+ return ImmSetCompositionFont(himc, pFont);
}
// static
BOOL LLWinImm::setCandidateWindow(HIMC himc, LPCANDIDATEFORM form)
{
- if ( sTheInstance.mImmSetCandidateWindow )
- return sTheInstance.mImmSetCandidateWindow(himc, form);
- return FALSE;
+ return ImmSetCandidateWindow(himc, form);
}
// static
BOOL LLWinImm::notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value)
{
- if ( sTheInstance.mImmNotifyIME )
- return sTheInstance.mImmNotifyIME(himc, action, index, value);
- return FALSE;
+ return ImmNotifyIME(himc, action, index, value);
}
-
-// ----------------------------------------------------------------------------------------
-LLWinImm::~LLWinImm()
-{
- if (mHImmDll != NULL)
- {
- FreeLibrary(mHImmDll);
- mHImmDll = NULL;
- }
-}
-
-
class LLMonitorInfo
{
public:
@@ -454,16 +332,83 @@ private:
static LLMonitorInfo sMonitorInfo;
+
+// Thread that owns the Window Handle
+// This whole struct is private to LLWindowWin32, which needs to mess with its
+// members, which is why it's a struct rather than a class. In effect, we make
+// the containing class a friend.
+struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool
+{
+ static const int MAX_QUEUE_SIZE = 2048;
+
+ LLThreadSafeQueue<MSG> mMessageQueue;
+
+ LLWindowWin32Thread();
+
+ void run() override;
+
+ /// called by main thread to post work to this window thread
+ template <typename CALLABLE>
+ void post(CALLABLE&& func)
+ {
+ try
+ {
+ getQueue().post(std::forward<CALLABLE>(func));
+ }
+ catch (const LLThreadSafeQueueInterrupt&)
+ {
+ // Shutdown timing is tricky. The main thread can end up trying
+ // to post a cursor position after having closed the WorkQueue.
+ }
+ }
+
+ /**
+ * Like post(), Post() is a way of conveying a single work item to this
+ * thread. Its virtue is that it will definitely be executed "soon" rather
+ * than potentially waiting for the next frame: it uses PostMessage() to
+ * break us out of the window thread's blocked GetMessage() call. It's
+ * more expensive, though, not only from the Windows API latency of
+ * PostMessage() and GetMessage(), but also because it involves heap
+ * allocation and release.
+ *
+ * Require HWND from caller, even though we store an HWND locally.
+ * Otherwise, if our mWindowHandle was accessed from both threads, we'd
+ * have to protect it with a mutex.
+ */
+ template <typename CALLABLE>
+ void Post(HWND windowHandle, CALLABLE&& func)
+ {
+ // Move func to the heap. If we knew FuncType could fit into LPARAM,
+ // we could simply instantiate FuncType and pass it by value. But
+ // since we don't, we must put that on the heap as well as the
+ // internal heap allocation it likely requires to store func.
+ auto ptr = new FuncType(std::move(func));
+ WPARAM wparam{ 0xF1C };
+ LL_DEBUGS("Window") << "PostMessage(" << std::hex << windowHandle
+ << ", " << WM_POST_FUNCTION_
+ << ", " << wparam << std::dec << LL_ENDL;
+ PostMessage(windowHandle, WM_POST_FUNCTION_, wparam, LPARAM(ptr));
+ }
+
+ using FuncType = std::function<void()>;
+ // call GetMessage() and pull enqueue messages for later processing
+ void gatherInput();
+ HWND mWindowHandle = NULL;
+ HDC mhDC = 0;
+};
+
+
LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
- BOOL disable_vsync, BOOL use_gl,
+ BOOL enable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
: LLWindow(callbacks, fullscreen, flags)
{
-
+ sMainThreadId = LLThread::currentID();
+ mWindowThread = new LLWindowWin32Thread();
//MAINT-516 -- force a load of opengl32.dll just in case windows went sideways
LoadLibrary(L"opengl32.dll");
@@ -471,7 +416,6 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
mIconResource = gIconResource;
mOverrideAspectRatio = 0.f;
mNativeAspectRatio = 0.f;
- mMousePositionModified = FALSE;
mInputProcessingPaused = FALSE;
mPreeditor = NULL;
mKeyCharCode = 0;
@@ -483,6 +427,9 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
memset(mPrevGammaRamp, 0, sizeof(mPrevGammaRamp));
mCustomGammaSet = FALSE;
mWindowHandle = NULL;
+
+ mRect = {0, 0, 0, 0};
+ mClientRect = {0, 0, 0, 0};
if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0))
{
@@ -535,7 +482,6 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
// Make an instance of our window then define the window class
mhInstance = GetModuleHandle(NULL);
- mWndProc = NULL;
// Init Direct Input - needed for joystick / Spacemouse
@@ -784,7 +730,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
LLCoordScreen windowPos(x,y);
LLCoordScreen windowSize(window_rect.right - window_rect.left,
window_rect.bottom - window_rect.top);
- if (!switchContext(mFullscreen, windowSize, TRUE, &windowPos))
+ if (!switchContext(mFullscreen, windowSize, enable_vsync, &windowPos))
{
return;
}
@@ -793,6 +739,13 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
initCursors();
setCursor( UI_CURSOR_ARROW );
+ mRawMouse.usUsagePage = 0x01; // HID_USAGE_PAGE_GENERIC
+ mRawMouse.usUsage = 0x02; // HID_USAGE_GENERIC_MOUSE
+ mRawMouse.dwFlags = 0; // adds mouse and also ignores legacy mouse messages
+ mRawMouse.hwndTarget = 0;
+
+ RegisterRawInputDevices(&mRawMouse, 1, sizeof(mRawMouse));
+
// Initialize (boot strap) the Language text input management,
// based on the system's (or user's) default settings.
allowLanguageTextInput(NULL, FALSE);
@@ -811,6 +764,8 @@ LLWindowWin32::~LLWindowWin32()
delete [] mWindowClassName;
mWindowClassName = NULL;
+
+ delete mWindowThread;
}
void LLWindowWin32::show()
@@ -850,7 +805,7 @@ void LLWindowWin32::restore()
// I'm turning off optimizations for this part to be sure code executes as intended
// (it is a straw, but I have no idea why else __try can get overruled)
#pragma optimize("", off)
-bool destroy_window_handler(HWND &hWnd)
+bool destroy_window_handler(HWND hWnd)
{
bool res;
__try
@@ -930,26 +885,37 @@ void LLWindowWin32::close()
LL_DEBUGS("Window") << "Destroying Window" << LL_ENDL;
- if (IsWindow(mWindowHandle))
- {
- // Make sure we don't leave a blank toolbar button.
- ShowWindow(mWindowHandle, SW_HIDE);
-
- // This causes WM_DESTROY to be sent *immediately*
- if (!destroy_window_handler(mWindowHandle))
+ mWindowThread->post([=]()
{
- OSMessageBox(mCallbacks->translateString("MBDestroyWinFailed"),
- mCallbacks->translateString("MBShutdownErr"),
- OSMB_OK);
- }
- }
- else
- {
- // Something killed the window while we were busy destroying gl or handle somehow got broken
- LL_WARNS("Window") << "Failed to destroy Window, invalid handle!" << LL_ENDL;
- }
+ if (IsWindow(mWindowHandle))
+ {
+ // Make sure we don't leave a blank toolbar button.
+ ShowWindow(mWindowHandle, SW_HIDE);
+
+ // This causes WM_DESTROY to be sent *immediately*
+ if (!destroy_window_handler(mWindowHandle))
+ {
+ OSMessageBox(mCallbacks->translateString("MBDestroyWinFailed"),
+ mCallbacks->translateString("MBShutdownErr"),
+ OSMB_OK);
+ }
+ }
+ else
+ {
+ // Something killed the window while we were busy destroying gl or handle somehow got broken
+ LL_WARNS("Window") << "Failed to destroy Window, invalid handle!" << LL_ENDL;
+ }
- mWindowHandle = NULL;
+ });
+ // Window thread might be waiting for a getMessage(), give it
+ // a push to enshure it will process destroy_window_handler
+ kickWindowThread();
+
+ // Even though the above lambda might not yet have run, we've already
+ // bound mWindowHandle into it by value, which should suffice for the
+ // operations we're asking. That's the last time WE should touch it.
+ mWindowHandle = NULL;
+ mWindowThread->close();
}
BOOL LLWindowWin32::isValid()
@@ -996,49 +962,22 @@ BOOL LLWindowWin32::getFullscreen()
BOOL LLWindowWin32::getPosition(LLCoordScreen *position)
{
- RECT window_rect;
-
- if (!mWindowHandle ||
- !GetWindowRect(mWindowHandle, &window_rect) ||
- NULL == position)
- {
- return FALSE;
- }
-
- position->mX = window_rect.left;
- position->mY = window_rect.top;
+ position->mX = mRect.left;
+ position->mY = mRect.top;
return TRUE;
}
BOOL LLWindowWin32::getSize(LLCoordScreen *size)
{
- RECT window_rect;
-
- if (!mWindowHandle ||
- !GetWindowRect(mWindowHandle, &window_rect) ||
- NULL == size)
- {
- return FALSE;
- }
-
- size->mX = window_rect.right - window_rect.left;
- size->mY = window_rect.bottom - window_rect.top;
+ size->mX = mRect.right - mRect.left;
+ size->mY = mRect.bottom - mRect.top;
return TRUE;
}
BOOL LLWindowWin32::getSize(LLCoordWindow *size)
{
- RECT client_rect;
-
- if (!mWindowHandle ||
- !GetClientRect(mWindowHandle, &client_rect) ||
- NULL == size)
- {
- return FALSE;
- }
-
- size->mX = client_rect.right - client_rect.left;
- size->mY = client_rect.bottom - client_rect.top;
+ size->mX = mClientRect.right - mClientRect.left;
+ size->mY = mClientRect.bottom - mClientRect.top;
return TRUE;
}
@@ -1065,14 +1004,17 @@ BOOL LLWindowWin32::setSizeImpl(const LLCoordScreen size)
return FALSE;
}
- WINDOWPLACEMENT placement;
- placement.length = sizeof(WINDOWPLACEMENT);
-
- if (!GetWindowPlacement(mWindowHandle, &placement)) return FALSE;
-
- placement.showCmd = SW_RESTORE;
+ mWindowThread->post([=]()
+ {
+ WINDOWPLACEMENT placement;
+ placement.length = sizeof(WINDOWPLACEMENT);
- if (!SetWindowPlacement(mWindowHandle, &placement)) return FALSE;
+ if (GetWindowPlacement(mWindowHandle, &placement))
+ {
+ placement.showCmd = SW_RESTORE;
+ SetWindowPlacement(mWindowHandle, &placement);
+ }
+ });
moveWindow(position, size);
return TRUE;
@@ -1084,177 +1026,165 @@ BOOL LLWindowWin32::setSizeImpl(const LLCoordWindow size)
DWORD dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
DWORD dw_style = WS_OVERLAPPEDWINDOW;
- AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
+ AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
return setSizeImpl(LLCoordScreen(window_rect.right - window_rect.left, window_rect.bottom - window_rect.top));
}
// changing fullscreen resolution
-BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
+BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BOOL enable_vsync, const LLCoordScreen* const posp)
{
- GLuint pixel_format;
- DEVMODE dev_mode;
- ::ZeroMemory(&dev_mode, sizeof(DEVMODE));
- dev_mode.dmSize = sizeof(DEVMODE);
- DWORD current_refresh;
- DWORD dw_ex_style;
- DWORD dw_style;
- RECT window_rect = {0, 0, 0, 0};
- S32 width = size.mX;
- S32 height = size.mY;
- BOOL auto_show = FALSE;
-
- if (mhRC)
- {
- auto_show = TRUE;
- resetDisplayResolution();
- }
-
- if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode))
- {
- current_refresh = dev_mode.dmDisplayFrequency;
- }
- else
- {
- current_refresh = 60;
- }
-
- gGLManager.shutdownGL();
- //destroy gl context
- if (mhRC)
- {
- if (!wglMakeCurrent(NULL, NULL))
- {
- LL_WARNS("Window") << "Release of DC and RC failed" << LL_ENDL;
- }
+ //called from main thread
+ GLuint pixel_format;
+ DEVMODE dev_mode;
+ ::ZeroMemory(&dev_mode, sizeof(DEVMODE));
+ dev_mode.dmSize = sizeof(DEVMODE);
+ DWORD current_refresh;
+ DWORD dw_ex_style;
+ DWORD dw_style;
+ RECT window_rect = { 0, 0, 0, 0 };
+ S32 width = size.mX;
+ S32 height = size.mY;
+ BOOL auto_show = FALSE;
+
+ if (mhRC)
+ {
+ auto_show = TRUE;
+ resetDisplayResolution();
+ }
- if (!wglDeleteContext(mhRC))
- {
- LL_WARNS("Window") << "Release of rendering context failed" << LL_ENDL;
- }
+ if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode))
+ {
+ current_refresh = dev_mode.dmDisplayFrequency;
+ }
+ else
+ {
+ current_refresh = 60;
+ }
- mhRC = NULL;
- }
+ gGLManager.shutdownGL();
+ //destroy gl context
+ if (mhRC)
+ {
+ if (!wglMakeCurrent(NULL, NULL))
+ {
+ LL_WARNS("Window") << "Release of DC and RC failed" << LL_ENDL;
+ }
- if (fullscreen)
- {
- mFullscreen = TRUE;
- BOOL success = FALSE;
- DWORD closest_refresh = 0;
+ if (!wglDeleteContext(mhRC))
+ {
+ LL_WARNS("Window") << "Release of rendering context failed" << LL_ENDL;
+ }
- for (S32 mode_num = 0;; mode_num++)
- {
- if (!EnumDisplaySettings(NULL, mode_num, &dev_mode))
- {
- break;
- }
+ mhRC = NULL;
+ }
- if (dev_mode.dmPelsWidth == width &&
- dev_mode.dmPelsHeight == height &&
- dev_mode.dmBitsPerPel == BITS_PER_PIXEL)
- {
- success = TRUE;
- if ((dev_mode.dmDisplayFrequency - current_refresh)
- < (closest_refresh - current_refresh))
- {
- closest_refresh = dev_mode.dmDisplayFrequency;
- }
- }
- }
+ if (fullscreen)
+ {
+ mFullscreen = TRUE;
+ BOOL success = FALSE;
+ DWORD closest_refresh = 0;
- if (closest_refresh == 0)
- {
- LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL;
- return FALSE;
- }
+ for (S32 mode_num = 0;; mode_num++)
+ {
+ if (!EnumDisplaySettings(NULL, mode_num, &dev_mode))
+ {
+ break;
+ }
- // If we found a good resolution, use it.
- if (success)
- {
- success = setDisplayResolution(width, height, BITS_PER_PIXEL, closest_refresh);
- }
+ if (dev_mode.dmPelsWidth == width &&
+ dev_mode.dmPelsHeight == height &&
+ dev_mode.dmBitsPerPel == BITS_PER_PIXEL)
+ {
+ success = TRUE;
+ if ((dev_mode.dmDisplayFrequency - current_refresh)
+ < (closest_refresh - current_refresh))
+ {
+ closest_refresh = dev_mode.dmDisplayFrequency;
+ }
+ }
+ }
- // Keep a copy of the actual current device mode in case we minimize
- // and change the screen resolution. JC
- EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode);
+ if (closest_refresh == 0)
+ {
+ LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL;
+ return FALSE;
+ }
- if (success)
- {
- mFullscreen = TRUE;
- mFullscreenWidth = dev_mode.dmPelsWidth;
- mFullscreenHeight = dev_mode.dmPelsHeight;
- mFullscreenBits = dev_mode.dmBitsPerPel;
- mFullscreenRefresh = dev_mode.dmDisplayFrequency;
+ // If we found a good resolution, use it.
+ if (success)
+ {
+ success = setDisplayResolution(width, height, BITS_PER_PIXEL, closest_refresh);
+ }
- LL_INFOS("Window") << "Running at " << dev_mode.dmPelsWidth
- << "x" << dev_mode.dmPelsHeight
- << "x" << dev_mode.dmBitsPerPel
- << " @ " << dev_mode.dmDisplayFrequency
- << LL_ENDL;
+ // Keep a copy of the actual current device mode in case we minimize
+ // and change the screen resolution. JC
+ EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode);
- window_rect.left = (long) 0;
- window_rect.right = (long) width; // Windows GDI rects don't include rightmost pixel
- window_rect.top = (long) 0;
- window_rect.bottom = (long) height;
- dw_ex_style = WS_EX_APPWINDOW;
- dw_style = WS_POPUP;
+ if (success)
+ {
+ mFullscreen = TRUE;
+ mFullscreenWidth = dev_mode.dmPelsWidth;
+ mFullscreenHeight = dev_mode.dmPelsHeight;
+ mFullscreenBits = dev_mode.dmBitsPerPel;
+ mFullscreenRefresh = dev_mode.dmDisplayFrequency;
+
+ LL_INFOS("Window") << "Running at " << dev_mode.dmPelsWidth
+ << "x" << dev_mode.dmPelsHeight
+ << "x" << dev_mode.dmBitsPerPel
+ << " @ " << dev_mode.dmDisplayFrequency
+ << LL_ENDL;
+
+ window_rect.left = (long)0;
+ window_rect.right = (long)width; // Windows GDI rects don't include rightmost pixel
+ window_rect.top = (long)0;
+ window_rect.bottom = (long)height;
+ dw_ex_style = WS_EX_APPWINDOW;
+ dw_style = WS_POPUP;
+
+ // Move window borders out not to cover window contents.
+ // This converts client rect to window rect, i.e. expands it by the window border size.
+ AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
+ }
+ // If it failed, we don't want to run fullscreen
+ else
+ {
+ mFullscreen = FALSE;
+ mFullscreenWidth = -1;
+ mFullscreenHeight = -1;
+ mFullscreenBits = -1;
+ mFullscreenRefresh = -1;
- // Move window borders out not to cover window contents.
- // This converts client rect to window rect, i.e. expands it by the window border size.
- AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
- }
- // If it failed, we don't want to run fullscreen
- else
- {
- mFullscreen = FALSE;
- mFullscreenWidth = -1;
- mFullscreenHeight = -1;
- mFullscreenBits = -1;
- mFullscreenRefresh = -1;
+ LL_INFOS("Window") << "Unable to run fullscreen at " << width << "x" << height << LL_ENDL;
+ return FALSE;
+ }
+ }
+ else
+ {
+ mFullscreen = FALSE;
+ window_rect.left = (long)(posp ? posp->mX : 0);
+ window_rect.right = (long)width + window_rect.left; // Windows GDI rects don't include rightmost pixel
+ window_rect.top = (long)(posp ? posp->mY : 0);
+ window_rect.bottom = (long)height + window_rect.top;
+ // Window with an edge
+ dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
+ dw_style = WS_OVERLAPPEDWINDOW;
+ }
- LL_INFOS("Window") << "Unable to run fullscreen at " << width << "x" << height << LL_ENDL;
- return FALSE;
- }
- }
- else
- {
- mFullscreen = FALSE;
- window_rect.left = (long) (posp ? posp->mX : 0);
- window_rect.right = (long) width + window_rect.left; // Windows GDI rects don't include rightmost pixel
- window_rect.top = (long) (posp ? posp->mY : 0);
- window_rect.bottom = (long) height + window_rect.top;
- // Window with an edge
- dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
- dw_style = WS_OVERLAPPEDWINDOW;
- }
+ // don't post quit messages when destroying old windows
+ mPostQuit = FALSE;
- // don't post quit messages when destroying old windows
- mPostQuit = FALSE;
- // create window
+ // create window
LL_DEBUGS("Window") << "Creating window with X: " << window_rect.left
<< " Y: " << window_rect.top
<< " Width: " << (window_rect.right - window_rect.left)
<< " Height: " << (window_rect.bottom - window_rect.top)
<< " Fullscreen: " << mFullscreen
<< LL_ENDL;
- if (mWindowHandle && !destroy_window_handler(mWindowHandle))
- {
- LL_WARNS("Window") << "Failed to properly close window before recreating it!" << LL_ENDL;
- }
- mWindowHandle = CreateWindowEx(dw_ex_style,
- mWindowClassName,
- mWindowTitle,
- WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dw_style,
- window_rect.left, // x pos
- window_rect.top, // y pos
- window_rect.right - window_rect.left, // width
- window_rect.bottom - window_rect.top, // height
- NULL,
- NULL,
- mhInstance,
- NULL);
+
+ recreateWindow(window_rect, dw_ex_style, dw_style);
if (mWindowHandle)
{
@@ -1288,7 +1218,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
0, 0, 0
};
- if (!(mhDC = GetDC(mWindowHandle)))
+ if (!mhDC)
{
close();
OSMessageBox(mCallbacks->translateString("MBDevContextErr"),
@@ -1325,9 +1255,9 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),
&pfd))
{
- close();
OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"),
mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
@@ -1364,42 +1294,42 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
if (pfd.cColorBits < 32)
{
- close();
OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"),
mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
if (pfd.cAlphaBits < 8)
{
- close();
OSMessageBox(mCallbacks->translateString("MBAlpha"),
mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
if (!SetPixelFormat(mhDC, pixel_format, &pfd))
{
- close();
OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"),
mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
if (!(mhRC = SafeCreateContext(mhDC)))
{
- close();
OSMessageBox(mCallbacks->translateString("MBGLContextErr"),
mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
if (!wglMakeCurrent(mhDC, mhRC))
{
- close();
OSMessageBox(mCallbacks->translateString("MBGLContextActErr"),
mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
@@ -1582,25 +1512,17 @@ const S32 max_format = (S32)num_formats - 1;
mhDC = 0; // Zero The Device Context
}
- // Destroy The Window
- if (mWindowHandle && !destroy_window_handler(mWindowHandle))
+ recreateWindow(window_rect, dw_ex_style, dw_style);
+
+ RECT rect;
+ RECT client_rect;
+ //initialize immediately on main thread
+ if (GetWindowRect(mWindowHandle, &rect) &&
+ GetClientRect(mWindowHandle, &client_rect))
{
- LL_WARNS("Window") << "Failed to properly close window!" << LL_ENDL;
- }
-
- mWindowHandle = CreateWindowEx(dw_ex_style,
- mWindowClassName,
- mWindowTitle,
- WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dw_style,
- window_rect.left, // x pos
- window_rect.top, // y pos
- window_rect.right - window_rect.left, // width
- window_rect.bottom - window_rect.top, // height
- NULL,
- NULL,
- mhInstance,
- NULL);
-
+ mRect = rect;
+ mClientRect = client_rect;
+ };
if (mWindowHandle)
{
@@ -1612,18 +1534,18 @@ const S32 max_format = (S32)num_formats - 1;
LL_WARNS("Window") << "Window recreation failed, code: " << GetLastError() << LL_ENDL;
}
- if (!(mhDC = GetDC(mWindowHandle)))
+ if (!mhDC)
{
- close();
OSMessageBox(mCallbacks->translateString("MBDevContextErr"), mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
if (!SetPixelFormat(mhDC, pixel_format, &pfd))
{
- close();
OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"),
mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
@@ -1659,8 +1581,8 @@ const S32 max_format = (S32)num_formats - 1;
if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),
&pfd))
{
- close();
OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
@@ -1672,99 +1594,46 @@ const S32 max_format = (S32)num_formats - 1;
// make sure we have 32 bits per pixel
if (pfd.cColorBits < 32 || GetDeviceCaps(mhDC, BITSPIXEL) < 32)
{
- close();
OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"), mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
if (pfd.cAlphaBits < 8)
{
- close();
OSMessageBox(mCallbacks->translateString("MBAlpha"), mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
mhRC = 0;
if (wglCreateContextAttribsARB)
{ //attempt to create a specific versioned context
- S32 attribs[] =
- { //start at 4.2
- WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
- WGL_CONTEXT_MINOR_VERSION_ARB, 2,
- WGL_CONTEXT_PROFILE_MASK_ARB, LLRender::sGLCoreProfile ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
- WGL_CONTEXT_FLAGS_ARB, gDebugGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
- 0
- };
-
- bool done = false;
- while (!done)
- {
- mhRC = wglCreateContextAttribsARB(mhDC, mhRC, attribs);
-
- if (!mhRC)
- {
- if (attribs[3] > 0)
- { //decrement minor version
- attribs[3]--;
- }
- else if (attribs[1] > 3)
- { //decrement major version and start minor version over at 3
- attribs[1]--;
- attribs[3] = 3;
- }
- else
- { //we reached 3.0 and still failed, bail out
- done = true;
- }
- }
- else
- {
- LL_INFOS() << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) <<
- (LLRender::sGLCoreProfile ? " core" : " compatibility") << " context." << LL_ENDL;
- done = true;
-
- // force sNoFixedFunction iff we're trying to use nsight debugging which does not support many legacy API uses
-
- // nSight doesn't support use of legacy API funcs in the fixed function pipe
- if (LLRender::sGLCoreProfile || LLRender::sNsightDebugSupport)
- {
- LLGLSLShader::sNoFixedFunction = true;
- }
- }
- }
- }
-
- if (!mhRC && !(mhRC = wglCreateContext(mhDC)))
- {
- close();
- OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK);
- return FALSE;
+ mhRC = (HGLRC) createSharedContext();
+ if (!mhRC)
+ {
+ return FALSE;
+ }
}
if (!wglMakeCurrent(mhDC, mhRC))
{
- close();
OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
+ LL_PROFILER_GPU_CONTEXT
+
if (!gGLManager.initGL())
{
- close();
OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
return FALSE;
}
// Disable vertical sync for swap
- if (disable_vsync && wglSwapIntervalEXT)
- {
- LL_DEBUGS("Window") << "Disabling vertical sync" << LL_ENDL;
- wglSwapIntervalEXT(0);
- }
- else
- {
- LL_DEBUGS("Window") << "Keeping vertical sync" << LL_ENDL;
- }
+ toggleVSync(enable_vsync);
SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, (LONG_PTR)this);
@@ -1790,6 +1659,177 @@ const S32 max_format = (S32)num_formats - 1;
return TRUE;
}
+void LLWindowWin32::recreateWindow(RECT window_rect, DWORD dw_ex_style, DWORD dw_style)
+{
+ auto oldHandle = mWindowHandle;
+
+ // zero out mWindowHandle and mhDC before destroying window so window
+ // thread falls back to peekmessage
+ mWindowHandle = 0;
+ mhDC = 0;
+
+ std::promise<std::pair<HWND, HDC>> promise;
+ // What follows must be done on the window thread.
+ auto window_work =
+ [this,
+ self=mWindowThread,
+ oldHandle,
+ // bind CreateWindowEx() parameters by value instead of
+ // back-referencing LLWindowWin32 members
+ windowClassName=mWindowClassName,
+ windowTitle=mWindowTitle,
+ hInstance=mhInstance,
+ window_rect,
+ dw_ex_style,
+ dw_style,
+ &promise]
+ ()
+ {
+ LL_DEBUGS("Window") << "recreateWindow(): window_work entry" << LL_ENDL;
+ self->mWindowHandle = 0;
+ self->mhDC = 0;
+
+ // important to call DestroyWindow() from the window thread
+ if (oldHandle && !destroy_window_handler(oldHandle))
+ {
+ LL_WARNS("Window") << "Failed to properly close window before recreating it!"
+ << LL_ENDL;
+ }
+
+ auto handle = CreateWindowEx(dw_ex_style,
+ windowClassName,
+ windowTitle,
+ WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dw_style,
+ window_rect.left, // x pos
+ window_rect.top, // y pos
+ window_rect.right - window_rect.left, // width
+ window_rect.bottom - window_rect.top, // height
+ NULL,
+ NULL,
+ hInstance,
+ NULL);
+
+ if (! handle)
+ {
+ // Failed to create window: clear the variables. This
+ // assignment is valid because we're running on mWindowThread.
+ self->mWindowHandle = NULL;
+ self->mhDC = 0;
+ }
+ else
+ {
+ // Update mWindowThread's own mWindowHandle and mhDC.
+ self->mWindowHandle = handle;
+ self->mhDC = GetDC(handle);
+ }
+
+ updateWindowRect();
+
+ // It's important to wake up the future either way.
+ promise.set_value(std::make_pair(self->mWindowHandle, self->mhDC));
+ LL_DEBUGS("Window") << "recreateWindow(): window_work done" << LL_ENDL;
+ };
+ // But how we pass window_work to the window thread depends on whether we
+ // already have a window handle.
+ if (! oldHandle)
+ {
+ // Pass window_work using the WorkQueue: without an existing window
+ // handle, the window thread can't call GetMessage().
+ LL_DEBUGS("Window") << "posting window_work to WorkQueue" << LL_ENDL;
+ mWindowThread->post(window_work);
+ }
+ else
+ {
+ // Pass window_work using PostMessage(). We can still
+ // PostMessage(oldHandle) because oldHandle won't be destroyed until
+ // the window thread has retrieved and executed window_work.
+ LL_DEBUGS("Window") << "posting window_work to message queue" << LL_ENDL;
+ mWindowThread->Post(oldHandle, window_work);
+ }
+
+ auto future = promise.get_future();
+ // This blocks until mWindowThread processes CreateWindowEx() and calls
+ // promise.set_value().
+ auto pair = future.get();
+ mWindowHandle = pair.first;
+ mhDC = pair.second;
+}
+
+void* LLWindowWin32::createSharedContext()
+{
+ S32 attribs[] =
+ {
+ WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
+ WGL_CONTEXT_MINOR_VERSION_ARB, 6,
+ WGL_CONTEXT_PROFILE_MASK_ARB, LLRender::sGLCoreProfile ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
+ WGL_CONTEXT_FLAGS_ARB, gDebugGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
+ 0
+ };
+
+ HGLRC rc = 0;
+
+ bool done = false;
+ while (!done)
+ {
+ rc = wglCreateContextAttribsARB(mhDC, mhRC, attribs);
+
+ if (!rc)
+ {
+ if (attribs[3] > 0)
+ { //decrement minor version
+ attribs[3]--;
+ }
+ else if (attribs[1] > 3)
+ { //decrement major version and start minor version over at 3
+ attribs[1]--;
+ attribs[3] = 3;
+ }
+ else
+ { //we reached 3.0 and still failed, bail out
+ done = true;
+ }
+ }
+ else
+ {
+ LL_INFOS() << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) <<
+ (LLRender::sGLCoreProfile ? " core" : " compatibility") << " context." << LL_ENDL;
+ done = true;
+ }
+ }
+
+ if (!rc && !(rc = wglCreateContext(mhDC)))
+ {
+ close();
+ OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK);
+ }
+
+ return rc;
+}
+
+void LLWindowWin32::makeContextCurrent(void* contextPtr)
+{
+ wglMakeCurrent(mhDC, (HGLRC) contextPtr);
+}
+
+void LLWindowWin32::destroySharedContext(void* contextPtr)
+{
+ wglDeleteContext((HGLRC)contextPtr);
+}
+
+void LLWindowWin32::toggleVSync(bool enable_vsync)
+{
+ if (!enable_vsync && wglSwapIntervalEXT)
+ {
+ LL_INFOS("Window") << "Disabling vertical sync" << LL_ENDL;
+ wglSwapIntervalEXT(0);
+ }
+ else
+ {
+ LL_INFOS("Window") << "Enabling vertical sync" << LL_ENDL;
+ wglSwapIntervalEXT(1);
+ }
+}
+
void LLWindowWin32::moveWindow( const LLCoordScreen& position, const LLCoordScreen& size )
{
if( mIsMouseClipping )
@@ -1808,66 +1848,106 @@ void LLWindowWin32::moveWindow( const LLCoordScreen& position, const LLCoordScre
// THIS CAUSES DEV-15484 and DEV-15949
//ShowWindow(mWindowHandle, SW_RESTORE);
// NOW we can call MoveWindow
- MoveWindow(mWindowHandle, position.mX, position.mY, size.mX, size.mY, TRUE);
+ mWindowThread->post([=]()
+ {
+ MoveWindow(mWindowHandle, position.mX, position.mY, size.mX, size.mY, TRUE);
+ });
+}
+
+void LLWindowWin32::setTitle(const std::string title)
+{
+ // TODO: Do we need to use the wide string version of this call
+ // to support non-ascii usernames (and region names?)
+ mWindowThread->post([=]()
+ {
+ SetWindowTextA(mWindowHandle, title.c_str());
+ });
}
BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position)
{
- mMousePositionModified = TRUE;
- if (!mWindowHandle)
- {
- return FALSE;
- }
+ ASSERT_MAIN_THREAD();
+ if (!mWindowHandle)
+ {
+ return FALSE;
+ }
- // Inform the application of the new mouse position (needed for per-frame
- // hover/picking to function).
- mCallbacks->handleMouseMove(this, position.convert(), (MASK)0);
-
- // DEV-18951 VWR-8524 Camera moves wildly when alt-clicking.
- // Because we have preemptively notified the application of the new
- // mouse position via handleMouseMove() above, we need to clear out
- // any stale mouse move events. RN/JC
- MSG msg;
- while (PeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE))
- { }
-
- LLCoordScreen screen_pos(position.convert());
- return ::SetCursorPos(screen_pos.mX, screen_pos.mY);
+ LLCoordScreen screen_pos(position.convert());
+
+ // instantly set the cursor position from the app's point of view
+ mCursorPosition = position;
+ mLastCursorPosition = position;
+
+ // Inform the application of the new mouse position (needed for per-frame
+ // hover/picking to function).
+ mCallbacks->handleMouseMove(this, position.convert(), (MASK)0);
+
+ // actually set the cursor position on the window thread
+ mWindowThread->post([=]()
+ {
+ // actually set the OS cursor position
+ SetCursorPos(screen_pos.mX, screen_pos.mY);
+ });
+
+ return TRUE;
}
BOOL LLWindowWin32::getCursorPosition(LLCoordWindow *position)
{
- POINT cursor_point;
-
- if (!mWindowHandle
- || !GetCursorPos(&cursor_point)
- || !position)
- {
- return FALSE;
- }
+ ASSERT_MAIN_THREAD();
+ if (!position)
+ {
+ return FALSE;
+ }
- *position = LLCoordScreen(cursor_point.x, cursor_point.y).convert();
+ *position = mCursorPosition;
return TRUE;
}
+BOOL LLWindowWin32::getCursorDelta(LLCoordCommon* delta)
+{
+ if (delta == nullptr)
+ {
+ return FALSE;
+ }
+
+ *delta = mMouseFrameDelta;
+
+ return TRUE;
+}
+
void LLWindowWin32::hideCursor()
{
- while (ShowCursor(FALSE) >= 0)
- {
- // nothing, wait for cursor to push down
- }
+ ASSERT_MAIN_THREAD();
+
+ mWindowThread->post([=]()
+ {
+ while (ShowCursor(FALSE) >= 0)
+ {
+ // nothing, wait for cursor to push down
+ }
+ });
+
mCursorHidden = TRUE;
mHideCursorPermanent = TRUE;
}
void LLWindowWin32::showCursor()
{
- // makes sure the cursor shows up
- while (ShowCursor(TRUE) < 0)
- {
- // do nothing, wait for cursor to pop out
- }
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32;
+
+ ASSERT_MAIN_THREAD();
+
+ mWindowThread->post([=]()
+ {
+ // makes sure the cursor shows up
+ while (ShowCursor(TRUE) < 0)
+ {
+ // do nothing, wait for cursor to pop out
+ }
+ });
+
mCursorHidden = FALSE;
mHideCursorPermanent = FALSE;
}
@@ -1971,6 +2051,8 @@ void LLWindowWin32::initCursors()
void LLWindowWin32::updateCursor()
{
+ ASSERT_MAIN_THREAD();
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32
if (mNextCursor == UI_CURSOR_ARROW
&& mBusyCount > 0)
{
@@ -1980,7 +2062,11 @@ void LLWindowWin32::updateCursor()
if( mCurrentCursor != mNextCursor )
{
mCurrentCursor = mNextCursor;
- SetCursor( mCursor[mNextCursor] );
+ auto nextCursor = mCursor[mNextCursor];
+ mWindowThread->post([=]()
+ {
+ SetCursor(nextCursor);
+ });
}
}
@@ -1996,13 +2082,8 @@ void LLWindowWin32::captureMouse()
void LLWindowWin32::releaseMouse()
{
- // *NOTE:Mani ReleaseCapture will spawn new windows messages...
- // which will in turn call our MainWindowProc. It therefore requires
- // pausing *and more importantly resumption* of the mainlooptimeout...
- // just like DispatchMessage below.
- mCallbacks->handlePauseWatchdog(this);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32;
ReleaseCapture();
- mCallbacks->handleResumeWatchdog(this);
}
@@ -2011,1003 +2092,1010 @@ void LLWindowWin32::delayInputProcessing()
mInputProcessingPaused = TRUE;
}
+
void LLWindowWin32::gatherInput()
{
- MSG msg;
- int msg_count = 0;
+ ASSERT_MAIN_THREAD();
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32
+ MSG msg;
- while ((msg_count < MAX_MESSAGE_PER_UPDATE) && PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
- {
- mCallbacks->handlePingWatchdog(this, "Main:TranslateGatherInput");
- TranslateMessage(&msg);
+ {
+ LLMutexLock lock(&mRawMouseMutex);
+ mMouseFrameDelta = mRawMouseDelta;
- // turn watchdog off in here to not fail if windows is doing something wacky
- mCallbacks->handlePauseWatchdog(this);
- DispatchMessage(&msg);
- mCallbacks->handleResumeWatchdog(this);
- msg_count++;
+ mRawMouseDelta.mX = 0;
+ mRawMouseDelta.mY = 0;
+ }
- if ( mInputProcessingPaused )
- {
- break;
- }
- /* Attempted workaround for problem where typing fast and hitting
- return would result in only part of the text being sent. JC
- BOOL key_posted = TranslateMessage(&msg);
- DispatchMessage(&msg);
- msg_count++;
+ if (mWindowThread->getQueue().size())
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("gi - PostMessage");
+ kickWindowThread();
+ }
+
+ while (mWindowThread->mMessageQueue.tryPopBack(msg))
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("gi - message queue");
+ if (mInputProcessingPaused)
+ {
+ continue;
+ }
- // If a key was translated, a WM_CHAR might have been posted to the end
- // of the event queue. We need it immediately.
- if (key_posted && msg.message == WM_KEYDOWN)
- {
- if (PeekMessage(&msg, NULL, WM_CHAR, WM_CHAR, PM_REMOVE))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- msg_count++;
- }
- }
- */
- mCallbacks->handlePingWatchdog(this, "Main:AsyncCallbackGatherInput");
- // For async host by name support. Really hacky.
- if (gAsyncMsgCallback && (LL_WM_HOST_RESOLVED == msg.message))
- {
- gAsyncMsgCallback(msg);
- }
- }
+ // For async host by name support. Really hacky.
+ if (gAsyncMsgCallback && (LL_WM_HOST_RESOLVED == msg.message))
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("gi - callback");
+ gAsyncMsgCallback(msg);
+ }
+ }
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("gi - PeekMessage");
+ S32 msg_count = 0;
+ while ((msg_count < MAX_MESSAGE_PER_UPDATE) && PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_REMOVE))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ msg_count++;
+ }
+ }
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("gi - function queue");
+ //process any pending functions
+ std::function<void()> curFunc;
+ while (mFunctionQueue.tryPopBack(curFunc))
+ {
+ curFunc();
+ }
+ }
+
+ // send one and only one mouse move event per frame BEFORE handling mouse button presses
+ if (mLastCursorPosition != mCursorPosition)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("gi - mouse move");
+ mCallbacks->handleMouseMove(this, mCursorPosition.convert(), mMouseMask);
+ }
+
+ mLastCursorPosition = mCursorPosition;
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("gi - mouse queue");
+ // handle mouse button presses AFTER updating mouse cursor position
+ std::function<void()> curFunc;
+ while (mMouseQueue.tryPopBack(curFunc))
+ {
+ curFunc();
+ }
+ }
mInputProcessingPaused = FALSE;
updateCursor();
-
- // clear this once we've processed all mouse messages that might have occurred after
- // we slammed the mouse position
- mMousePositionModified = FALSE;
}
static LLTrace::BlockTimerStatHandle FTM_KEYHANDLER("Handle Keyboard");
static LLTrace::BlockTimerStatHandle FTM_MOUSEHANDLER("Handle Mouse");
+#define WINDOW_IMP_POST(x) window_imp->post([=]() { x; })
+
LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param)
{
- // Ignore clicks not originated in the client area, i.e. mouse-up events not preceded with a WM_LBUTTONDOWN.
- // This helps prevent avatar walking after maximizing the window by double-clicking the title bar.
- static bool sHandleLeftMouseUp = true;
-
- // Ignore the double click received right after activating app.
- // This is to avoid triggering double click teleport after returning focus (see MAINT-3786).
- static bool sHandleDoubleClick = true;
-
- LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( h_wnd, GWLP_USERDATA );
-
- bool debug_window_proc = gDebugWindowProc || debugLoggingEnabled("Window");
-
-
- if (NULL != window_imp)
- {
- window_imp->mCallbacks->handleResumeWatchdog(window_imp);
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:StartWndProc");
- // Has user provided their own window callback?
- if (NULL != window_imp->mWndProc)
- {
- if (!window_imp->mWndProc(h_wnd, u_msg, w_param, l_param))
- {
- // user has handled window message
- return 0;
- }
- }
-
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:PreSwitchWndProc");
-
- // Juggle to make sure we can get negative positions for when
- // mouse is outside window.
- LLCoordWindow window_coord((S32)(S16)LOWORD(l_param), (S32)(S16)HIWORD(l_param));
-
- // This doesn't work, as LOWORD returns unsigned short.
- //LLCoordWindow window_coord(LOWORD(l_param), HIWORD(l_param));
- LLCoordGL gl_coord;
-
- // pass along extended flag in mask
- MASK mask = (l_param>>16 & KF_EXTENDED) ? MASK_EXTENDED : 0x0;
- BOOL eat_keystroke = TRUE;
-
- switch(u_msg)
- {
- RECT update_rect;
- S32 update_width;
- S32 update_height;
-
- case WM_TIMER:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_TIMER");
- window_imp->mCallbacks->handleTimerEvent(window_imp);
- break;
-
- case WM_DEVICECHANGE:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_DEVICECHANGE");
- if (debug_window_proc)
- {
- LL_INFOS("Window") << " WM_DEVICECHANGE: wParam=" << w_param
- << "; lParam=" << l_param << LL_ENDL;
- }
- if (w_param == DBT_DEVNODES_CHANGED || w_param == DBT_DEVICEARRIVAL)
- {
- if (window_imp->mCallbacks->handleDeviceChange(window_imp))
- {
- return 0;
- }
- }
- break;
-
- case WM_PAINT:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_PAINT");
- GetUpdateRect(window_imp->mWindowHandle, &update_rect, FALSE);
- update_width = update_rect.right - update_rect.left + 1;
- update_height = update_rect.bottom - update_rect.top + 1;
- window_imp->mCallbacks->handlePaint(window_imp, update_rect.left, update_rect.top,
- update_width, update_height);
- break;
- case WM_PARENTNOTIFY:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_PARENTNOTIFY");
- u_msg = u_msg;
- break;
-
- case WM_SETCURSOR:
- // This message is sent whenever the cursor is moved in a window.
- // You need to set the appropriate cursor appearance.
-
- // Only take control of cursor over client region of window
- // This allows Windows(tm) to handle resize cursors, etc.
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SETCURSOR");
- if (LOWORD(l_param) == HTCLIENT)
- {
- SetCursor(window_imp->mCursor[ window_imp->mCurrentCursor] );
- return 0;
- }
- break;
-
- case WM_ENTERMENULOOP:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_ENTERMENULOOP");
- window_imp->mCallbacks->handleWindowBlock(window_imp);
- break;
-
- case WM_EXITMENULOOP:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_EXITMENULOOP");
- window_imp->mCallbacks->handleWindowUnblock(window_imp);
- break;
-
- case WM_ACTIVATEAPP:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_ACTIVATEAPP");
- {
- // This message should be sent whenever the app gains or loses focus.
- BOOL activating = (BOOL) w_param;
- BOOL minimized = window_imp->getMinimized();
-
- if (debug_window_proc)
- {
- LL_INFOS("Window") << "WINDOWPROC ActivateApp "
- << " activating " << S32(activating)
- << " minimized " << S32(minimized)
- << " fullscreen " << S32(window_imp->mFullscreen)
- << LL_ENDL;
- }
-
- if (window_imp->mFullscreen)
- {
- // When we run fullscreen, restoring or minimizing the app needs
- // to switch the screen resolution
- if (activating)
- {
- window_imp->setFullscreenResolution();
- window_imp->restore();
- }
- else
- {
- window_imp->minimize();
- window_imp->resetDisplayResolution();
- }
- }
-
- if (!activating)
- {
- sHandleDoubleClick = false;
- }
-
- window_imp->mCallbacks->handleActivateApp(window_imp, activating);
-
- break;
- }
-
- case WM_ACTIVATE:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_ACTIVATE");
- {
- // Can be one of WA_ACTIVE, WA_CLICKACTIVE, or WA_INACTIVE
- BOOL activating = (LOWORD(w_param) != WA_INACTIVE);
+ ASSERT_WINDOW_THREAD();
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32;
- BOOL minimized = BOOL(HIWORD(w_param));
+ LL_DEBUGS("Window") << "mainWindowProc(" << std::hex << h_wnd
+ << ", " << u_msg
+ << ", " << w_param << ")" << std::dec << LL_ENDL;
- if (!activating && LLWinImm::isAvailable() && window_imp->mPreeditor)
- {
- window_imp->interruptLanguageTextInput();
- }
+ if (u_msg == WM_POST_FUNCTION_)
+ {
+ LL_DEBUGS("Window") << "WM_POST_FUNCTION_" << LL_ENDL;
+ // from LLWindowWin32Thread::Post()
+ // Cast l_param back to the pointer to the heap FuncType
+ // allocated by Post(). Capture in unique_ptr so we'll delete
+ // once we're done with it.
+ std::unique_ptr<LLWindowWin32Thread::FuncType>
+ ptr(reinterpret_cast<LLWindowWin32Thread::FuncType*>(l_param));
+ (*ptr)();
+ return 0;
+ }
- // JC - I'm not sure why, but if we don't report that we handled the
- // WM_ACTIVATE message, the WM_ACTIVATEAPP messages don't work
- // properly when we run fullscreen.
- if (debug_window_proc)
- {
- LL_INFOS("Window") << "WINDOWPROC Activate "
- << " activating " << S32(activating)
- << " minimized " << S32(minimized)
- << LL_ENDL;
- }
+ // Ignore clicks not originated in the client area, i.e. mouse-up events not preceded with a WM_LBUTTONDOWN.
+ // This helps prevent avatar walking after maximizing the window by double-clicking the title bar.
+ static bool sHandleLeftMouseUp = true;
- // Don't handle this.
- break;
- }
+ // Ignore the double click received right after activating app.
+ // This is to avoid triggering double click teleport after returning focus (see MAINT-3786).
+ static bool sHandleDoubleClick = true;
- case WM_QUERYOPEN:
- // TODO: use this to return a nice icon
- break;
+ LLWindowWin32* window_imp = (LLWindowWin32*)GetWindowLongPtr(h_wnd, GWLP_USERDATA);
- case WM_SYSCOMMAND:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SYSCOMMAND");
- switch(w_param)
- {
- case SC_KEYMENU:
- // Disallow the ALT key from triggering the default system menu.
- return 0;
-
- case SC_SCREENSAVE:
- case SC_MONITORPOWER:
- // eat screen save messages and prevent them!
- return 0;
- }
- break;
+ bool debug_window_proc = false; // gDebugWindowProc || debugLoggingEnabled("Window");
- case WM_CLOSE:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_CLOSE");
- // Will the app allow the window to close?
- if (window_imp->mCallbacks->handleCloseRequest(window_imp))
- {
- // Get the app to initiate cleanup.
- window_imp->mCallbacks->handleQuit(window_imp);
- // The app is responsible for calling destroyWindow when done with GL
- }
- return 0;
-
- case WM_DESTROY:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_DESTROY");
- if (window_imp->shouldPostQuit())
- {
- PostQuitMessage(0); // Posts WM_QUIT with an exit code of 0
- }
- return 0;
-
- case WM_COMMAND:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_COMMAND");
- if (!HIWORD(w_param)) // this message is from a menu
- {
- window_imp->mCallbacks->handleMenuSelect(window_imp, LOWORD(w_param));
- }
- break;
-
- case WM_SYSKEYDOWN:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SYSKEYDOWN");
- // allow system keys, such as ALT-F4 to be processed by Windows
- eat_keystroke = FALSE;
- case WM_KEYDOWN:
- window_imp->mKeyCharCode = 0; // don't know until wm_char comes in next
- window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff;
- window_imp->mKeyVirtualKey = w_param;
- window_imp->mRawMsg = u_msg;
- window_imp->mRawWParam = w_param;
- window_imp->mRawLParam = l_param;
-
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYDOWN");
- {
- if (debug_window_proc)
- {
- LL_INFOS("Window") << "Debug WindowProc WM_KEYDOWN "
- << " key " << S32(w_param)
- << LL_ENDL;
- }
- if(gKeyboard->handleKeyDown(w_param, mask) && eat_keystroke)
- {
- return 0;
- }
- // pass on to windows if we didn't handle it
- break;
- }
- case WM_SYSKEYUP:
- eat_keystroke = FALSE;
- case WM_KEYUP:
- {
- window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff;
- window_imp->mKeyVirtualKey = w_param;
- window_imp->mRawMsg = u_msg;
- window_imp->mRawWParam = w_param;
- window_imp->mRawLParam = l_param;
-
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYUP");
- LL_RECORD_BLOCK_TIME(FTM_KEYHANDLER);
-
- if (debug_window_proc)
- {
- LL_INFOS("Window") << "Debug WindowProc WM_KEYUP "
- << " key " << S32(w_param)
- << LL_ENDL;
- }
- if (gKeyboard->handleKeyUp(w_param, mask) && eat_keystroke)
- {
- return 0;
- }
+ if (NULL != window_imp)
+ {
+ // Juggle to make sure we can get negative positions for when
+ // mouse is outside window.
+ LLCoordWindow window_coord((S32)(S16)LOWORD(l_param), (S32)(S16)HIWORD(l_param));
- // pass on to windows
- break;
- }
- case WM_IME_SETCONTEXT:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_SETCONTEXT");
- if (debug_window_proc)
- {
- LL_INFOS("Window") << "WM_IME_SETCONTEXT" << LL_ENDL;
- }
- if (LLWinImm::isAvailable() && window_imp->mPreeditor)
- {
- l_param &= ~ISC_SHOWUICOMPOSITIONWINDOW;
- // Invoke DefWinProc with the modified LPARAM.
- }
- break;
+ // pass along extended flag in mask
+ MASK mask = (l_param >> 16 & KF_EXTENDED) ? MASK_EXTENDED : 0x0;
+ BOOL eat_keystroke = TRUE;
- case WM_IME_STARTCOMPOSITION:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_STARTCOMPOSITION");
- if (debug_window_proc)
- {
- LL_INFOS() << "WM_IME_STARTCOMPOSITION" << LL_ENDL;
- }
- if (LLWinImm::isAvailable() && window_imp->mPreeditor)
- {
- window_imp->handleStartCompositionMessage();
- return 0;
- }
- break;
+ switch (u_msg)
+ {
+ RECT update_rect;
+ S32 update_width;
+ S32 update_height;
- case WM_IME_ENDCOMPOSITION:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_ENDCOMPOSITION");
- if (debug_window_proc)
- {
- LL_INFOS() << "WM_IME_ENDCOMPOSITION" << LL_ENDL;
- }
- if (LLWinImm::isAvailable() && window_imp->mPreeditor)
- {
- return 0;
- }
- break;
+ case WM_TIMER:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_TIMER");
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleTimerEvent(window_imp));
+ break;
+ }
- case WM_IME_COMPOSITION:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_COMPOSITION");
- if (debug_window_proc)
- {
- LL_INFOS() << "WM_IME_COMPOSITION" << LL_ENDL;
- }
- if (LLWinImm::isAvailable() && window_imp->mPreeditor)
- {
- window_imp->handleCompositionMessage(l_param);
- return 0;
- }
- break;
+ case WM_DEVICECHANGE:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_DEVICECHANGE");
+ if (debug_window_proc)
+ {
+ LL_INFOS("Window") << " WM_DEVICECHANGE: wParam=" << w_param
+ << "; lParam=" << l_param << LL_ENDL;
+ }
+ if (w_param == DBT_DEVNODES_CHANGED || w_param == DBT_DEVICEARRIVAL)
+ {
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleDeviceChange(window_imp));
+
+ return TRUE;
+ }
+ break;
+ }
- case WM_IME_REQUEST:
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_REQUEST");
- if (debug_window_proc)
- {
- LL_INFOS() << "WM_IME_REQUEST" << LL_ENDL;
- }
- if (LLWinImm::isAvailable() && window_imp->mPreeditor)
- {
- LRESULT result = 0;
- if (window_imp->handleImeRequests(w_param, l_param, &result))
- {
- return result;
- }
- }
- break;
+ case WM_PAINT:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_PAINT");
+ GetUpdateRect(window_imp->mWindowHandle, &update_rect, FALSE);
+ update_width = update_rect.right - update_rect.left + 1;
+ update_height = update_rect.bottom - update_rect.top + 1;
+
+ WINDOW_IMP_POST(window_imp->mCallbacks->handlePaint(window_imp, update_rect.left, update_rect.top,
+ update_width, update_height));
+ break;
+ }
+ case WM_PARENTNOTIFY:
+ {
+ break;
+ }
- case WM_CHAR:
- window_imp->mKeyCharCode = w_param;
- window_imp->mRawMsg = u_msg;
- window_imp->mRawWParam = w_param;
- window_imp->mRawLParam = l_param;
-
- // Should really use WM_UNICHAR eventually, but it requires a specific Windows version and I need
- // to figure out how that works. - Doug
- //
- // ... Well, I don't think so.
- // How it works is explained in Win32 API document, but WM_UNICHAR didn't work
- // as specified at least on Windows XP SP1 Japanese version. I have never used
- // it since then, and I'm not sure whether it has been fixed now, but I don't think
- // it is worth trying. The good old WM_CHAR works just fine even for supplementary
- // characters. We just need to take care of surrogate pairs sent as two WM_CHAR's
- // by ourselves. It is not that tough. -- Alissa Sabre @ SL
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_CHAR");
- if (debug_window_proc)
- {
- LL_INFOS("Window") << "Debug WindowProc WM_CHAR "
- << " key " << S32(w_param)
- << LL_ENDL;
- }
- // Even if LLWindowCallbacks::handleUnicodeChar(llwchar, BOOL) returned FALSE,
- // we *did* processed the event, so I believe we should not pass it to DefWindowProc...
- window_imp->handleUnicodeUTF16((U16)w_param, gKeyboard->currentMask(FALSE));
- return 0;
+ case WM_SETCURSOR:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_SETCURSOR");
+ // This message is sent whenever the cursor is moved in a window.
+ // You need to set the appropriate cursor appearance.
- case WM_NCLBUTTONDOWN:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_NCLBUTTONDOWN");
- // A click in a non-client area, e.g. title bar or window border.
- sHandleLeftMouseUp = false;
- sHandleDoubleClick = true;
- }
- break;
+ // Only take control of cursor over client region of window
+ // This allows Windows(tm) to handle resize cursors, etc.
+ if (LOWORD(l_param) == HTCLIENT)
+ {
+ SetCursor(window_imp->mCursor[window_imp->mCurrentCursor]);
+ return 0;
+ }
+ break;
+ }
+ case WM_ENTERMENULOOP:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_ENTERMENULOOP");
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleWindowBlock(window_imp));
+ break;
+ }
- case WM_LBUTTONDOWN:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONDOWN");
- LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
- sHandleLeftMouseUp = true;
+ case WM_EXITMENULOOP:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_EXITMENULOOP");
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleWindowUnblock(window_imp));
+ break;
+ }
- if (LLWinImm::isAvailable() && window_imp->mPreeditor)
- {
- window_imp->interruptLanguageTextInput();
- }
+ case WM_ACTIVATEAPP:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_ACTIVATEAPP");
+ window_imp->post([=]()
+ {
+ // This message should be sent whenever the app gains or loses focus.
+ BOOL activating = (BOOL)w_param;
+ BOOL minimized = window_imp->getMinimized();
+
+ if (debug_window_proc)
+ {
+ LL_INFOS("Window") << "WINDOWPROC ActivateApp "
+ << " activating " << S32(activating)
+ << " minimized " << S32(minimized)
+ << " fullscreen " << S32(window_imp->mFullscreen)
+ << LL_ENDL;
+ }
+
+ if (window_imp->mFullscreen)
+ {
+ // When we run fullscreen, restoring or minimizing the app needs
+ // to switch the screen resolution
+ if (activating)
+ {
+ window_imp->setFullscreenResolution();
+ window_imp->restore();
+ }
+ else
+ {
+ window_imp->minimize();
+ window_imp->resetDisplayResolution();
+ }
+ }
+
+ if (!activating)
+ {
+ sHandleDoubleClick = false;
+ }
+
+ window_imp->mCallbacks->handleActivateApp(window_imp, activating);
+ });
+ break;
+ }
+ case WM_ACTIVATE:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_ACTIVATE");
+ window_imp->post([=]()
+ {
+ // Can be one of WA_ACTIVE, WA_CLICKACTIVE, or WA_INACTIVE
+ BOOL activating = (LOWORD(w_param) != WA_INACTIVE);
+
+ BOOL minimized = BOOL(HIWORD(w_param));
+
+ if (!activating && LLWinImm::isAvailable() && window_imp->mPreeditor)
+ {
+ window_imp->interruptLanguageTextInput();
+ }
+
+ // JC - I'm not sure why, but if we don't report that we handled the
+ // WM_ACTIVATE message, the WM_ACTIVATEAPP messages don't work
+ // properly when we run fullscreen.
+ if (debug_window_proc)
+ {
+ LL_INFOS("Window") << "WINDOWPROC Activate "
+ << " activating " << S32(activating)
+ << " minimized " << S32(minimized)
+ << LL_ENDL;
+ }
+ });
+
+ break;
+ }
- // Because we move the cursor position in the app, we need to query
- // to find out where the cursor at the time the event is handled.
- // If we don't do this, many clicks could get buffered up, and if the
- // first click changes the cursor position, all subsequent clicks
- // will occur at the wrong location. JC
- if (window_imp->mMousePositionModified)
- {
- LLCoordWindow cursor_coord_window;
- window_imp->getCursorPosition(&cursor_coord_window);
- gl_coord = cursor_coord_window.convert();
- }
- else
- {
- gl_coord = window_coord.convert();
- }
- MASK mask = gKeyboard->currentMask(TRUE);
- // generate move event to update mouse coordinates
- window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
- if (window_imp->mCallbacks->handleMouseDown(window_imp, gl_coord, mask))
- {
- return 0;
- }
- }
- break;
+ case WM_QUERYOPEN:
+ // TODO: use this to return a nice icon
+ break;
- case WM_LBUTTONDBLCLK:
- //RN: ignore right button double clicks for now
- //case WM_RBUTTONDBLCLK:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONDBLCLK");
+ case WM_SYSCOMMAND:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_SYSCOMMAND");
+ switch (w_param)
+ {
+ case SC_KEYMENU:
+ // Disallow the ALT key from triggering the default system menu.
+ return 0;
+
+ case SC_SCREENSAVE:
+ case SC_MONITORPOWER:
+ // eat screen save messages and prevent them!
+ return 0;
+ }
+ break;
+ }
+ case WM_CLOSE:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_CLOSE");
+ window_imp->post([=]()
+ {
+ // Will the app allow the window to close?
+ if (window_imp->mCallbacks->handleCloseRequest(window_imp))
+ {
+ // Get the app to initiate cleanup.
+ window_imp->mCallbacks->handleQuit(window_imp);
+ // The app is responsible for calling destroyWindow when done with GL
+ }
+ });
+ return 0;
+ }
+ case WM_DESTROY:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_DESTROY");
+ if (window_imp->shouldPostQuit())
+ {
+ PostQuitMessage(0); // Posts WM_QUIT with an exit code of 0
+ }
+ return 0;
+ }
+ case WM_COMMAND:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_COMMAND");
+ if (!HIWORD(w_param)) // this message is from a menu
+ {
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleMenuSelect(window_imp, LOWORD(w_param)));
+ }
+ break;
+ }
+ case WM_SYSKEYDOWN:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_SYSKEYDOWN");
+ // allow system keys, such as ALT-F4 to be processed by Windows
+ eat_keystroke = FALSE;
+ // intentional fall-through here
+ }
+ case WM_KEYDOWN:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_KEYDOWN");
+ window_imp->post([=]()
+ {
+ window_imp->mKeyCharCode = 0; // don't know until wm_char comes in next
+ window_imp->mKeyScanCode = (l_param >> 16) & 0xff;
+ window_imp->mKeyVirtualKey = w_param;
+ window_imp->mRawMsg = u_msg;
+ window_imp->mRawWParam = w_param;
+ window_imp->mRawLParam = l_param;
+
+ {
+ if (debug_window_proc)
+ {
+ LL_INFOS("Window") << "Debug WindowProc WM_KEYDOWN "
+ << " key " << S32(w_param)
+ << LL_ENDL;
+ }
+
+ gKeyboard->handleKeyDown(w_param, mask);
+ }
+ });
+ if (eat_keystroke) return 0; // skip DefWindowProc() handling if we're consuming the keypress
+ break;
+ }
+ case WM_SYSKEYUP:
+ eat_keystroke = FALSE;
+ // intentional fall-through here
+ case WM_KEYUP:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_KEYUP");
+ window_imp->post([=]()
+ {
+ window_imp->mKeyScanCode = (l_param >> 16) & 0xff;
+ window_imp->mKeyVirtualKey = w_param;
+ window_imp->mRawMsg = u_msg;
+ window_imp->mRawWParam = w_param;
+ window_imp->mRawLParam = l_param;
+
+ {
+ LL_RECORD_BLOCK_TIME(FTM_KEYHANDLER);
+
+ if (debug_window_proc)
+ {
+ LL_INFOS("Window") << "Debug WindowProc WM_KEYUP "
+ << " key " << S32(w_param)
+ << LL_ENDL;
+ }
+ gKeyboard->handleKeyUp(w_param, mask);
+ }
+ });
+ if (eat_keystroke) return 0; // skip DefWindowProc() handling if we're consuming the keypress
+ break;
+ }
+ case WM_IME_SETCONTEXT:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_IME_SETCONTEXT");
+ if (debug_window_proc)
+ {
+ LL_INFOS("Window") << "WM_IME_SETCONTEXT" << LL_ENDL;
+ }
+ if (LLWinImm::isAvailable() && window_imp->mPreeditor)
+ {
+ l_param &= ~ISC_SHOWUICOMPOSITIONWINDOW;
+ // Invoke DefWinProc with the modified LPARAM.
+ }
+ break;
+ }
+ case WM_IME_STARTCOMPOSITION:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_IME_STARTCOMPOSITION");
+ if (debug_window_proc)
+ {
+ LL_INFOS() << "WM_IME_STARTCOMPOSITION" << LL_ENDL;
+ }
+ if (LLWinImm::isAvailable() && window_imp->mPreeditor)
+ {
+ WINDOW_IMP_POST(window_imp->handleStartCompositionMessage());
+ return 0;
+ }
+ break;
+ }
+ case WM_IME_ENDCOMPOSITION:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_IME_ENDCOMPOSITION");
+ if (debug_window_proc)
+ {
+ LL_INFOS() << "WM_IME_ENDCOMPOSITION" << LL_ENDL;
+ }
+ if (LLWinImm::isAvailable() && window_imp->mPreeditor)
+ {
+ return 0;
+ }
+ break;
+ }
+ case WM_IME_COMPOSITION:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_IME_COMPOSITION");
+ if (debug_window_proc)
+ {
+ LL_INFOS() << "WM_IME_COMPOSITION" << LL_ENDL;
+ }
+ if (LLWinImm::isAvailable() && window_imp->mPreeditor)
+ {
+ WINDOW_IMP_POST(window_imp->handleCompositionMessage(l_param));
+ return 0;
+ }
+ break;
+ }
+ case WM_IME_REQUEST:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_IME_REQUEST");
+ if (debug_window_proc)
+ {
+ LL_INFOS() << "WM_IME_REQUEST" << LL_ENDL;
+ }
+ if (LLWinImm::isAvailable() && window_imp->mPreeditor)
+ {
+ LRESULT result;
+ window_imp->handleImeRequests(w_param, l_param, &result);
+ return result;
+ }
+ break;
+ }
+ case WM_CHAR:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_CHAR");
+ window_imp->post([=]()
+ {
+ window_imp->mKeyCharCode = w_param;
+ window_imp->mRawMsg = u_msg;
+ window_imp->mRawWParam = w_param;
+ window_imp->mRawLParam = l_param;
+
+ // Should really use WM_UNICHAR eventually, but it requires a specific Windows version and I need
+ // to figure out how that works. - Doug
+ //
+ // ... Well, I don't think so.
+ // How it works is explained in Win32 API document, but WM_UNICHAR didn't work
+ // as specified at least on Windows XP SP1 Japanese version. I have never used
+ // it since then, and I'm not sure whether it has been fixed now, but I don't think
+ // it is worth trying. The good old WM_CHAR works just fine even for supplementary
+ // characters. We just need to take care of surrogate pairs sent as two WM_CHAR's
+ // by ourselves. It is not that tough. -- Alissa Sabre @ SL
+ if (debug_window_proc)
+ {
+ LL_INFOS("Window") << "Debug WindowProc WM_CHAR "
+ << " key " << S32(w_param)
+ << LL_ENDL;
+ }
+ // Even if LLWindowCallbacks::handleUnicodeChar(llwchar, BOOL) returned FALSE,
+ // we *did* processed the event, so I believe we should not pass it to DefWindowProc...
+ window_imp->handleUnicodeUTF16((U16)w_param, gKeyboard->currentMask(FALSE));
+ });
+ return 0;
+ }
+ case WM_NCLBUTTONDOWN:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_NCLBUTTONDOWN");
+ {
+ // A click in a non-client area, e.g. title bar or window border.
+ window_imp->post([=]()
+ {
+ sHandleLeftMouseUp = false;
+ sHandleDoubleClick = true;
+ });
+ }
+ break;
+ }
+ case WM_LBUTTONDOWN:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_LBUTTONDOWN");
+ {
+ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
+ window_imp->postMouseButtonEvent([=]()
+ {
+ sHandleLeftMouseUp = true;
+
+ if (LLWinImm::isAvailable() && window_imp->mPreeditor)
+ {
+ window_imp->interruptLanguageTextInput();
+ }
+
+ MASK mask = gKeyboard->currentMask(TRUE);
+ auto gl_coord = window_imp->mCursorPosition.convert();
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
+ window_imp->mCallbacks->handleMouseDown(window_imp, gl_coord, mask);
+ });
+
+ return 0;
+ }
+ break;
+ }
- if (!sHandleDoubleClick)
- {
- sHandleDoubleClick = true;
- break;
- }
+ case WM_LBUTTONDBLCLK:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_LBUTTONDBLCLK");
+ window_imp->postMouseButtonEvent([=]()
+ {
+ //RN: ignore right button double clicks for now
+ //case WM_RBUTTONDBLCLK:
+ if (!sHandleDoubleClick)
+ {
+ sHandleDoubleClick = true;
+ return;
+ }
+ MASK mask = gKeyboard->currentMask(TRUE);
+
+ // generate move event to update mouse coordinates
+ window_imp->mCursorPosition = window_coord;
+ window_imp->mCallbacks->handleDoubleClick(window_imp, window_imp->mCursorPosition.convert(), mask);
+ });
+
+ return 0;
+ }
+ case WM_LBUTTONUP:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_LBUTTONUP");
+ {
+ window_imp->postMouseButtonEvent([=]()
+ {
+ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
+ if (!sHandleLeftMouseUp)
+ {
+ sHandleLeftMouseUp = true;
+ return;
+ }
+ sHandleDoubleClick = true;
+
+
+ MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ window_imp->mCursorPosition = window_coord;
+ window_imp->mCallbacks->handleMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask);
+ });
+ }
+ return 0;
+ }
+ case WM_RBUTTONDBLCLK:
+ case WM_RBUTTONDOWN:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_RBUTTONDOWN");
+ {
+ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
+ window_imp->post([=]()
+ {
+ if (LLWinImm::isAvailable() && window_imp->mPreeditor)
+ {
+ WINDOW_IMP_POST(window_imp->interruptLanguageTextInput());
+ }
+
+ MASK mask = gKeyboard->currentMask(TRUE);
+ // generate move event to update mouse coordinates
+ auto gl_coord = window_imp->mCursorPosition.convert();
+ window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
+ window_imp->mCallbacks->handleRightMouseDown(window_imp, gl_coord, mask);
+ });
+ }
+ return 0;
+ }
+ break;
- // Because we move the cursor position in the app, we need to query
- // to find out where the cursor at the time the event is handled.
- // If we don't do this, many clicks could get buffered up, and if the
- // first click changes the cursor position, all subsequent clicks
- // will occur at the wrong location. JC
- if (window_imp->mMousePositionModified)
- {
- LLCoordWindow cursor_coord_window;
- window_imp->getCursorPosition(&cursor_coord_window);
- gl_coord = cursor_coord_window.convert();
- }
- else
- {
- gl_coord = window_coord.convert();
- }
- MASK mask = gKeyboard->currentMask(TRUE);
- // generate move event to update mouse coordinates
- window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
- if (window_imp->mCallbacks->handleDoubleClick(window_imp, gl_coord, mask) )
- {
- return 0;
- }
- }
- break;
+ case WM_RBUTTONUP:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_RBUTTONUP");
+ {
+ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
+ window_imp->postMouseButtonEvent([=]()
+ {
+ MASK mask = gKeyboard->currentMask(TRUE);
+ window_imp->mCallbacks->handleRightMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask);
+ });
+ }
+ }
+ break;
- case WM_LBUTTONUP:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONUP");
- LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
+ case WM_MBUTTONDOWN:
+ // case WM_MBUTTONDBLCLK:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_MBUTTONDOWN");
+ {
+ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
+ window_imp->postMouseButtonEvent([=]()
+ {
+ if (LLWinImm::isAvailable() && window_imp->mPreeditor)
+ {
+ window_imp->interruptLanguageTextInput();
+ }
+
+ MASK mask = gKeyboard->currentMask(TRUE);
+ window_imp->mCallbacks->handleMiddleMouseDown(window_imp, window_imp->mCursorPosition.convert(), mask);
+ });
+ }
+ }
+ break;
- if (!sHandleLeftMouseUp)
- {
- sHandleLeftMouseUp = true;
- break;
- }
- sHandleDoubleClick = true;
-
- //if (gDebugClicks)
- //{
- // LL_INFOS("Window") << "WndProc left button up" << LL_ENDL;
- //}
- // Because we move the cursor position in the app, we need to query
- // to find out where the cursor at the time the event is handled.
- // If we don't do this, many clicks could get buffered up, and if the
- // first click changes the cursor position, all subsequent clicks
- // will occur at the wrong location. JC
- if (window_imp->mMousePositionModified)
- {
- LLCoordWindow cursor_coord_window;
- window_imp->getCursorPosition(&cursor_coord_window);
- gl_coord = cursor_coord_window.convert();
- }
- else
- {
- gl_coord = window_coord.convert();
- }
- MASK mask = gKeyboard->currentMask(TRUE);
- // generate move event to update mouse coordinates
- window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
- if (window_imp->mCallbacks->handleMouseUp(window_imp, gl_coord, mask))
- {
- return 0;
- }
- }
- break;
+ case WM_MBUTTONUP:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_MBUTTONUP");
+ {
+ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
+ window_imp->postMouseButtonEvent([=]()
+ {
+ MASK mask = gKeyboard->currentMask(TRUE);
+ window_imp->mCallbacks->handleMiddleMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask);
+ });
+ }
+ }
+ break;
+ case WM_XBUTTONDOWN:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_XBUTTONDOWN");
+ window_imp->postMouseButtonEvent([=]()
+ {
+ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
+ S32 button = GET_XBUTTON_WPARAM(w_param);
+ if (LLWinImm::isAvailable() && window_imp->mPreeditor)
+ {
+ window_imp->interruptLanguageTextInput();
+ }
+
+ MASK mask = gKeyboard->currentMask(TRUE);
+ // Windows uses numbers 1 and 2 for buttons, remap to 4, 5
+ window_imp->mCallbacks->handleOtherMouseDown(window_imp, window_imp->mCursorPosition.convert(), mask, button + 3);
+ });
+
+ }
+ break;
- case WM_RBUTTONDBLCLK:
- case WM_RBUTTONDOWN:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_RBUTTONDOWN");
- LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
- if (LLWinImm::isAvailable() && window_imp->mPreeditor)
- {
- window_imp->interruptLanguageTextInput();
- }
+ case WM_XBUTTONUP:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_XBUTTONUP");
+ window_imp->postMouseButtonEvent([=]()
+ {
- // Because we move the cursor position in the llviewerapp, we need to query
- // to find out where the cursor at the time the event is handled.
- // If we don't do this, many clicks could get buffered up, and if the
- // first click changes the cursor position, all subsequent clicks
- // will occur at the wrong location. JC
- if (window_imp->mMousePositionModified)
- {
- LLCoordWindow cursor_coord_window;
- window_imp->getCursorPosition(&cursor_coord_window);
- gl_coord = cursor_coord_window.convert();
- }
- else
- {
- gl_coord = window_coord.convert();
- }
- MASK mask = gKeyboard->currentMask(TRUE);
- // generate move event to update mouse coordinates
- window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
- if (window_imp->mCallbacks->handleRightMouseDown(window_imp, gl_coord, mask))
- {
- return 0;
- }
- }
- break;
+ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
- case WM_RBUTTONUP:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_RBUTTONUP");
- LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
- // Because we move the cursor position in the app, we need to query
- // to find out where the cursor at the time the event is handled.
- // If we don't do this, many clicks could get buffered up, and if the
- // first click changes the cursor position, all subsequent clicks
- // will occur at the wrong location. JC
- if (window_imp->mMousePositionModified)
- {
- LLCoordWindow cursor_coord_window;
- window_imp->getCursorPosition(&cursor_coord_window);
- gl_coord = cursor_coord_window.convert();
- }
- else
- {
- gl_coord = window_coord.convert();
- }
- MASK mask = gKeyboard->currentMask(TRUE);
- // generate move event to update mouse coordinates
- window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
- if (window_imp->mCallbacks->handleRightMouseUp(window_imp, gl_coord, mask))
- {
- return 0;
- }
- }
- break;
+ S32 button = GET_XBUTTON_WPARAM(w_param);
+ MASK mask = gKeyboard->currentMask(TRUE);
+ // Windows uses numbers 1 and 2 for buttons, remap to 4, 5
+ window_imp->mCallbacks->handleOtherMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask, button + 3);
+ });
+ }
+ break;
- case WM_MBUTTONDOWN:
-// case WM_MBUTTONDBLCLK:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONDOWN");
- LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
- if (LLWinImm::isAvailable() && window_imp->mPreeditor)
- {
- window_imp->interruptLanguageTextInput();
- }
+ case WM_MOUSEWHEEL:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_MOUSEWHEEL");
+ static short z_delta = 0;
- // Because we move the cursor position in tllviewerhe app, we need to query
- // to find out where the cursor at the time the event is handled.
- // If we don't do this, many clicks could get buffered up, and if the
- // first click changes the cursor position, all subsequent clicks
- // will occur at the wrong location. JC
- if (window_imp->mMousePositionModified)
- {
- LLCoordWindow cursor_coord_window;
- window_imp->getCursorPosition(&cursor_coord_window);
- gl_coord = cursor_coord_window.convert();
- }
- else
- {
- gl_coord = window_coord.convert();
- }
- MASK mask = gKeyboard->currentMask(TRUE);
- // generate move event to update mouse coordinates
- window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
- if (window_imp->mCallbacks->handleMiddleMouseDown(window_imp, gl_coord, mask))
- {
- return 0;
- }
- }
- break;
+ RECT client_rect;
- case WM_MBUTTONUP:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONUP");
- LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
- // Because we move the cursor position in the llviewer app, we need to query
- // to find out where the cursor at the time the event is handled.
- // If we don't do this, many clicks could get buffered up, and if the
- // first click changes the cursor position, all subsequent clicks
- // will occur at the wrong location. JC
- if (window_imp->mMousePositionModified)
- {
- LLCoordWindow cursor_coord_window;
- window_imp->getCursorPosition(&cursor_coord_window);
- gl_coord = cursor_coord_window.convert();
- }
- else
- {
- gl_coord = window_coord.convert();
- }
- MASK mask = gKeyboard->currentMask(TRUE);
- // generate move event to update mouse coordinates
- window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
- if (window_imp->mCallbacks->handleMiddleMouseUp(window_imp, gl_coord, mask))
- {
- return 0;
- }
- }
- break;
- case WM_XBUTTONDOWN:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONDOWN");
- LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
- S32 button = GET_XBUTTON_WPARAM(w_param);
- if (LLWinImm::isAvailable() && window_imp->mPreeditor)
- {
- window_imp->interruptLanguageTextInput();
- }
+ // eat scroll events that occur outside our window, since we use mouse position to direct scroll
+ // instead of keyboard focus
+ // NOTE: mouse_coord is in *window* coordinates for scroll events
+ POINT mouse_coord = { (S32)(S16)LOWORD(l_param), (S32)(S16)HIWORD(l_param) };
- // Because we move the cursor position in tllviewerhe app, we need to query
- // to find out where the cursor at the time the event is handled.
- // If we don't do this, many clicks could get buffered up, and if the
- // first click changes the cursor position, all subsequent clicks
- // will occur at the wrong location. JC
- if (window_imp->mMousePositionModified)
- {
- LLCoordWindow cursor_coord_window;
- window_imp->getCursorPosition(&cursor_coord_window);
- gl_coord = cursor_coord_window.convert();
- }
- else
- {
- gl_coord = window_coord.convert();
- }
- MASK mask = gKeyboard->currentMask(TRUE);
- // generate move event to update mouse coordinates
- window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
- // Windows uses numbers 1 and 2 for buttons, remap to 4, 5
- if (window_imp->mCallbacks->handleOtherMouseDown(window_imp, gl_coord, mask, button + 3))
- {
- return 0;
- }
- }
- break;
-
- case WM_XBUTTONUP:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONUP");
- LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
- S32 button = GET_XBUTTON_WPARAM(w_param);
- // Because we move the cursor position in the llviewer app, we need to query
- // to find out where the cursor at the time the event is handled.
- // If we don't do this, many clicks could get buffered up, and if the
- // first click changes the cursor position, all subsequent clicks
- // will occur at the wrong location. JC
- if (window_imp->mMousePositionModified)
- {
- LLCoordWindow cursor_coord_window;
- window_imp->getCursorPosition(&cursor_coord_window);
- gl_coord = cursor_coord_window.convert();
- }
- else
- {
- gl_coord = window_coord.convert();
- }
- MASK mask = gKeyboard->currentMask(TRUE);
- // generate move event to update mouse coordinates
- window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
- // Windows uses numbers 1 and 2 for buttons, remap to 4, 5
- if (window_imp->mCallbacks->handleOtherMouseUp(window_imp, gl_coord, mask, button + 3))
- {
- return 0;
- }
- }
- break;
+ if (ScreenToClient(window_imp->mWindowHandle, &mouse_coord)
+ && GetClientRect(window_imp->mWindowHandle, &client_rect))
+ {
+ // we have a valid mouse point and client rect
+ if (mouse_coord.x < client_rect.left || client_rect.right < mouse_coord.x
+ || mouse_coord.y < client_rect.top || client_rect.bottom < mouse_coord.y)
+ {
+ // mouse is outside of client rect, so don't do anything
+ return 0;
+ }
+ }
- case WM_MOUSEWHEEL:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEWHEEL");
- static short z_delta = 0;
+ S16 incoming_z_delta = HIWORD(w_param);
+ z_delta += incoming_z_delta;
+ // cout << "z_delta " << z_delta << endl;
+
+ // current mouse wheels report changes in increments of zDelta (+120, -120)
+ // Future, higher resolution mouse wheels may report smaller deltas.
+ // So we sum the deltas and only act when we've exceeded WHEEL_DELTA
+ //
+ // If the user rapidly spins the wheel, we can get messages with
+ // large deltas, like 480 or so. Thus we need to scroll more quickly.
+ if (z_delta <= -WHEEL_DELTA || WHEEL_DELTA <= z_delta)
+ {
+ short clicks = -z_delta / WHEEL_DELTA;
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleScrollWheel(window_imp, clicks));
+ z_delta = 0;
+ }
+ return 0;
+ }
+ /*
+ // TODO: add this after resolving _WIN32_WINNT issue
+ case WM_MOUSELEAVE:
+ {
+ window_imp->mCallbacks->handleMouseLeave(window_imp);
+
+ // TRACKMOUSEEVENT track_mouse_event;
+ // track_mouse_event.cbSize = sizeof( TRACKMOUSEEVENT );
+ // track_mouse_event.dwFlags = TME_LEAVE;
+ // track_mouse_event.hwndTrack = h_wnd;
+ // track_mouse_event.dwHoverTime = HOVER_DEFAULT;
+ // TrackMouseEvent( &track_mouse_event );
+ return 0;
+ }
+ */
+ case WM_MOUSEHWHEEL:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_MOUSEHWHEEL");
+ static short h_delta = 0;
- RECT client_rect;
+ RECT client_rect;
- // eat scroll events that occur outside our window, since we use mouse position to direct scroll
- // instead of keyboard focus
- // NOTE: mouse_coord is in *window* coordinates for scroll events
- POINT mouse_coord = {(S32)(S16)LOWORD(l_param), (S32)(S16)HIWORD(l_param)};
+ // eat scroll events that occur outside our window, since we use mouse position to direct scroll
+ // instead of keyboard focus
+ // NOTE: mouse_coord is in *window* coordinates for scroll events
+ POINT mouse_coord = { (S32)(S16)LOWORD(l_param), (S32)(S16)HIWORD(l_param) };
- if (ScreenToClient(window_imp->mWindowHandle, &mouse_coord)
- && GetClientRect(window_imp->mWindowHandle, &client_rect))
- {
- // we have a valid mouse point and client rect
- if (mouse_coord.x < client_rect.left || client_rect.right < mouse_coord.x
- || mouse_coord.y < client_rect.top || client_rect.bottom < mouse_coord.y)
- {
- // mouse is outside of client rect, so don't do anything
- return 0;
- }
- }
+ if (ScreenToClient(window_imp->mWindowHandle, &mouse_coord)
+ && GetClientRect(window_imp->mWindowHandle, &client_rect))
+ {
+ // we have a valid mouse point and client rect
+ if (mouse_coord.x < client_rect.left || client_rect.right < mouse_coord.x
+ || mouse_coord.y < client_rect.top || client_rect.bottom < mouse_coord.y)
+ {
+ // mouse is outside of client rect, so don't do anything
+ return 0;
+ }
+ }
- S16 incoming_z_delta = HIWORD(w_param);
- z_delta += incoming_z_delta;
- // cout << "z_delta " << z_delta << endl;
-
- // current mouse wheels report changes in increments of zDelta (+120, -120)
- // Future, higher resolution mouse wheels may report smaller deltas.
- // So we sum the deltas and only act when we've exceeded WHEEL_DELTA
- //
- // If the user rapidly spins the wheel, we can get messages with
- // large deltas, like 480 or so. Thus we need to scroll more quickly.
- if (z_delta <= -WHEEL_DELTA || WHEEL_DELTA <= z_delta)
- {
- window_imp->mCallbacks->handleScrollWheel(window_imp, -z_delta / WHEEL_DELTA);
- z_delta = 0;
- }
- return 0;
- }
- /*
- // TODO: add this after resolving _WIN32_WINNT issue
- case WM_MOUSELEAVE:
- {
- window_imp->mCallbacks->handleMouseLeave(window_imp);
-
- // TRACKMOUSEEVENT track_mouse_event;
- // track_mouse_event.cbSize = sizeof( TRACKMOUSEEVENT );
- // track_mouse_event.dwFlags = TME_LEAVE;
- // track_mouse_event.hwndTrack = h_wnd;
- // track_mouse_event.dwHoverTime = HOVER_DEFAULT;
- // TrackMouseEvent( &track_mouse_event );
- return 0;
- }
- */
- case WM_MOUSEHWHEEL:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEHWHEEL");
- static short h_delta = 0;
+ S16 incoming_h_delta = HIWORD(w_param);
+ h_delta += incoming_h_delta;
- RECT client_rect;
+ // If the user rapidly spins the wheel, we can get messages with
+ // large deltas, like 480 or so. Thus we need to scroll more quickly.
+ if (h_delta <= -WHEEL_DELTA || WHEEL_DELTA <= h_delta)
+ {
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleScrollHWheel(window_imp, h_delta / WHEEL_DELTA));
+ h_delta = 0;
+ }
+ return 0;
+ }
+ // Handle mouse movement within the window
+ case WM_MOUSEMOVE:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_MOUSEMOVE");
+ // DO NOT use mouse event queue for move events to ensure cursor position is updated
+ // when button events are handled
+ WINDOW_IMP_POST(
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_MOUSEMOVE lambda");
+
+ MASK mask = gKeyboard->currentMask(TRUE);
+ window_imp->mMouseMask = mask;
+ window_imp->mCursorPosition = window_coord;
+ });
+ return 0;
+ }
- // eat scroll events that occur outside our window, since we use mouse position to direct scroll
- // instead of keyboard focus
- // NOTE: mouse_coord is in *window* coordinates for scroll events
- POINT mouse_coord = {(S32)(S16)LOWORD(l_param), (S32)(S16)HIWORD(l_param)};
+ case WM_GETMINMAXINFO:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_GETMINMAXINFO");
+ LPMINMAXINFO min_max = (LPMINMAXINFO)l_param;
+ min_max->ptMinTrackSize.x = window_imp->mMinWindowWidth;
+ min_max->ptMinTrackSize.y = window_imp->mMinWindowHeight;
+ return 0;
+ }
- if (ScreenToClient(window_imp->mWindowHandle, &mouse_coord)
- && GetClientRect(window_imp->mWindowHandle, &client_rect))
- {
- // we have a valid mouse point and client rect
- if (mouse_coord.x < client_rect.left || client_rect.right < mouse_coord.x
- || mouse_coord.y < client_rect.top || client_rect.bottom < mouse_coord.y)
- {
- // mouse is outside of client rect, so don't do anything
- return 0;
- }
- }
+ case WM_MOVE:
+ {
+ window_imp->updateWindowRect();
+ return 0;
+ }
+ case WM_SIZE:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_SIZE");
+ window_imp->updateWindowRect();
+ S32 width = S32(LOWORD(l_param));
+ S32 height = S32(HIWORD(l_param));
- S16 incoming_h_delta = HIWORD(w_param);
- h_delta += incoming_h_delta;
+
+ if (debug_window_proc)
+ {
+ BOOL maximized = (w_param == SIZE_MAXIMIZED);
+ BOOL restored = (w_param == SIZE_RESTORED);
+ BOOL minimized = (w_param == SIZE_MINIMIZED);
+
+ LL_INFOS("Window") << "WINDOWPROC Size "
+ << width << "x" << height
+ << " max " << S32(maximized)
+ << " min " << S32(minimized)
+ << " rest " << S32(restored)
+ << LL_ENDL;
+ }
- // If the user rapidly spins the wheel, we can get messages with
- // large deltas, like 480 or so. Thus we need to scroll more quickly.
- if (h_delta <= -WHEEL_DELTA || WHEEL_DELTA <= h_delta)
- {
- window_imp->mCallbacks->handleScrollHWheel(window_imp, h_delta / WHEEL_DELTA);
- h_delta = 0;
- }
- return 0;
- }
- // Handle mouse movement within the window
- case WM_MOUSEMOVE:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEMOVE");
- MASK mask = gKeyboard->currentMask(TRUE);
- window_imp->mCallbacks->handleMouseMove(window_imp, window_coord.convert(), mask);
- return 0;
- }
+ // There's an odd behavior with WM_SIZE that I would call a bug. If
+ // the window is maximized, and you call MoveWindow() with a size smaller
+ // than a maximized window, it ends up sending WM_SIZE with w_param set
+ // to SIZE_MAXIMIZED -- which isn't true. So the logic below doesn't work.
+ // (SL-44655). Fixed it by calling ShowWindow(SW_RESTORE) first (see
+ // LLWindowWin32::moveWindow in this file).
- case WM_GETMINMAXINFO:
- {
- LPMINMAXINFO min_max = (LPMINMAXINFO)l_param;
- min_max->ptMinTrackSize.x = window_imp->mMinWindowWidth;
- min_max->ptMinTrackSize.y = window_imp->mMinWindowHeight;
- return 0;
- }
+ // If we are now restored, but we weren't before, this
+ // means that the window was un-minimized.
+ if (w_param == SIZE_RESTORED && window_imp->mLastSizeWParam != SIZE_RESTORED)
+ {
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, TRUE));
+ }
- case WM_SIZE:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SIZE");
- S32 width = S32( LOWORD(l_param) );
- S32 height = S32( HIWORD(l_param) );
+ // handle case of window being maximized from fully minimized state
+ if (w_param == SIZE_MAXIMIZED && window_imp->mLastSizeWParam != SIZE_MAXIMIZED)
+ {
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, TRUE));
+ }
- if (debug_window_proc)
- {
- BOOL maximized = ( w_param == SIZE_MAXIMIZED );
- BOOL restored = ( w_param == SIZE_RESTORED );
- BOOL minimized = ( w_param == SIZE_MINIMIZED );
-
- LL_INFOS("Window") << "WINDOWPROC Size "
- << width << "x" << height
- << " max " << S32(maximized)
- << " min " << S32(minimized)
- << " rest " << S32(restored)
- << LL_ENDL;
- }
+ // Also handle the minimization case
+ if (w_param == SIZE_MINIMIZED && window_imp->mLastSizeWParam != SIZE_MINIMIZED)
+ {
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, FALSE));
+ }
- // There's an odd behavior with WM_SIZE that I would call a bug. If
- // the window is maximized, and you call MoveWindow() with a size smaller
- // than a maximized window, it ends up sending WM_SIZE with w_param set
- // to SIZE_MAXIMIZED -- which isn't true. So the logic below doesn't work.
- // (SL-44655). Fixed it by calling ShowWindow(SW_RESTORE) first (see
- // LLWindowWin32::moveWindow in this file).
+ // Actually resize all of our views
+ if (w_param != SIZE_MINIMIZED)
+ {
+ // Ignore updates for minimizing and minimized "windows"
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleResize(window_imp,
+ LOWORD(l_param),
+ HIWORD(l_param)));
+ }
- // If we are now restored, but we weren't before, this
- // means that the window was un-minimized.
- if (w_param == SIZE_RESTORED && window_imp->mLastSizeWParam != SIZE_RESTORED)
- {
- window_imp->mCallbacks->handleActivate(window_imp, TRUE);
- }
+ window_imp->mLastSizeWParam = w_param;
- // handle case of window being maximized from fully minimized state
- if (w_param == SIZE_MAXIMIZED && window_imp->mLastSizeWParam != SIZE_MAXIMIZED)
- {
- window_imp->mCallbacks->handleActivate(window_imp, TRUE);
- }
+ return 0;
+ }
- // Also handle the minimization case
- if (w_param == SIZE_MINIMIZED && window_imp->mLastSizeWParam != SIZE_MINIMIZED)
- {
- window_imp->mCallbacks->handleActivate(window_imp, FALSE);
- }
+ case WM_DPICHANGED:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_DPICHANGED");
+ LPRECT lprc_new_scale;
+ F32 new_scale = F32(LOWORD(w_param)) / F32(USER_DEFAULT_SCREEN_DPI);
+ lprc_new_scale = (LPRECT)l_param;
+ S32 new_width = lprc_new_scale->right - lprc_new_scale->left;
+ S32 new_height = lprc_new_scale->bottom - lprc_new_scale->top;
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleDPIChanged(window_imp, new_scale, new_width, new_height));
+
+ SetWindowPos(h_wnd,
+ HWND_TOP,
+ lprc_new_scale->left,
+ lprc_new_scale->top,
+ new_width,
+ new_height,
+ SWP_NOZORDER | SWP_NOACTIVATE);
+
+ return 0;
+ }
- // Actually resize all of our views
- if (w_param != SIZE_MINIMIZED)
- {
- // Ignore updates for minimizing and minimized "windows"
- window_imp->mCallbacks->handleResize( window_imp,
- LOWORD(l_param),
- HIWORD(l_param) );
- }
+ case WM_SETFOCUS:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_SETFOCUS");
+ if (debug_window_proc)
+ {
+ LL_INFOS("Window") << "WINDOWPROC SetFocus" << LL_ENDL;
+ }
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleFocus(window_imp));
+ return 0;
+ }
- window_imp->mLastSizeWParam = w_param;
+ case WM_KILLFOCUS:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_KILLFOCUS");
+ if (debug_window_proc)
+ {
+ LL_INFOS("Window") << "WINDOWPROC KillFocus" << LL_ENDL;
+ }
+ WINDOW_IMP_POST(window_imp->mCallbacks->handleFocusLost(window_imp));
+ return 0;
+ }
- return 0;
- }
+ case WM_COPYDATA:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_COPYDATA");
+ {
+ // received a URL
+ PCOPYDATASTRUCT myCDS = (PCOPYDATASTRUCT)l_param;
+ void* data = new U8[myCDS->cbData];
+ memcpy(data, myCDS->lpData, myCDS->cbData);
+ auto myType = myCDS->dwData;
+
+ window_imp->post([=]()
+ {
+ window_imp->mCallbacks->handleDataCopy(window_imp, myType, data);
+ delete[] data;
+ });
+ };
+ return 0;
+
+ break;
+ }
+ case WM_SETTINGCHANGE:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_SETTINGCHANGE");
+ if (w_param == SPI_SETMOUSEVANISH)
+ {
+ if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &window_imp->mMouseVanish, 0))
+ {
+ WINDOW_IMP_POST(window_imp->mMouseVanish = TRUE);
+ }
+ }
+ }
+ break;
- case WM_DPICHANGED:
- {
- LPRECT lprc_new_scale;
- F32 new_scale = F32(LOWORD(w_param)) / F32(USER_DEFAULT_SCREEN_DPI);
- lprc_new_scale = (LPRECT)l_param;
- S32 new_width = lprc_new_scale->right - lprc_new_scale->left;
- S32 new_height = lprc_new_scale->bottom - lprc_new_scale->top;
- if (window_imp->mCallbacks->handleDPIChanged(window_imp, new_scale, new_width, new_height))
- {
- SetWindowPos(h_wnd,
- HWND_TOP,
- lprc_new_scale->left,
- lprc_new_scale->top,
- new_width,
- new_height,
- SWP_NOZORDER | SWP_NOACTIVATE);
- }
- return 0;
- }
-
- case WM_SETFOCUS:
- if (debug_window_proc)
- {
- LL_INFOS("Window") << "WINDOWPROC SetFocus" << LL_ENDL;
- }
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_SETFOCUS");
- window_imp->mCallbacks->handleFocus(window_imp);
- return 0;
-
- case WM_KILLFOCUS:
- if (debug_window_proc)
- {
- LL_INFOS("Window") << "WINDOWPROC KillFocus" << LL_ENDL;
- }
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KILLFOCUS");
- window_imp->mCallbacks->handleFocusLost(window_imp);
- return 0;
+ case WM_INPUT:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("MWP - WM_INPUT");
+
+ UINT dwSize = 0;
+ GetRawInputData((HRAWINPUT)l_param, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));
+ llassert(dwSize < 1024);
+
+ U8 lpb[1024];
+
+ if (GetRawInputData((HRAWINPUT)l_param, RID_INPUT, (void*)lpb, &dwSize, sizeof(RAWINPUTHEADER)) == dwSize)
+ {
+ RAWINPUT* raw = (RAWINPUT*)lpb;
+
+ if (raw->header.dwType == RIM_TYPEMOUSE)
+ {
+ LLMutexLock lock(&window_imp->mRawMouseMutex);
+ window_imp->mRawMouseDelta.mX += raw->data.mouse.lLastX;
+ window_imp->mRawMouseDelta.mY -= raw->data.mouse.lLastY;
+ }
+ }
+ }
- case WM_COPYDATA:
- {
- window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_COPYDATA");
- // received a URL
- PCOPYDATASTRUCT myCDS = (PCOPYDATASTRUCT) l_param;
- window_imp->mCallbacks->handleDataCopy(window_imp, myCDS->dwData, myCDS->lpData);
- };
- return 0;
+ //list of messages we get often that we don't care to log about
+ case WM_NCHITTEST:
+ case WM_NCMOUSEMOVE:
+ case WM_NCMOUSELEAVE:
+ case WM_MOVING:
+ case WM_WINDOWPOSCHANGING:
+ case WM_WINDOWPOSCHANGED:
+ break;
- break;
-
- case WM_SETTINGCHANGE:
- {
- if (w_param == SPI_SETMOUSEVANISH)
- {
- if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &window_imp->mMouseVanish, 0))
- {
- window_imp->mMouseVanish = TRUE;
- }
- }
- }
- break;
- default:
- {
- if (debug_window_proc)
- {
- LL_INFOS("Window") << "Unhandled windows message code: " << U32(u_msg) << LL_ENDL;
- }
- }
- break;
- }
-
- window_imp->mCallbacks->handlePauseWatchdog(window_imp);
- }
+ default:
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - default");
+ if (debug_window_proc)
+ {
+ LL_INFOS("Window") << "Unhandled windows message code: 0x" << std::hex << U32(u_msg) << LL_ENDL;
+ }
+ }
+ break;
+ }
+ }
else
{
// (NULL == window_imp)
LL_DEBUGS("Window") << "No window implementation to handle message with, message code: " << U32(u_msg) << LL_ENDL;
}
- // pass unhandled messages down to Windows
- return DefWindowProc(h_wnd, u_msg, w_param, l_param);
+ // pass unhandled messages down to Windows
+ LRESULT ret;
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - DefWindowProc");
+ ret = DefWindowProc(h_wnd, u_msg, w_param, l_param);
+ }
+ return ret;
}
BOOL LLWindowWin32::convertCoords(LLCoordGL from, LLCoordWindow *to)
@@ -3186,6 +3274,8 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr)
// Constrains the mouse to the window.
void LLWindowWin32::setMouseClipping( BOOL b )
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32;
+ ASSERT_MAIN_THREAD();
if( b != mIsMouseClipping )
{
BOOL success = FALSE;
@@ -3216,43 +3306,46 @@ void LLWindowWin32::setMouseClipping( BOOL b )
BOOL LLWindowWin32::getClientRectInScreenSpace( RECT* rectp )
{
- BOOL success = FALSE;
+ BOOL success = FALSE;
- RECT client_rect;
- if( mWindowHandle && GetClientRect(mWindowHandle, &client_rect) )
- {
- POINT top_left;
- top_left.x = client_rect.left;
- top_left.y = client_rect.top;
- ClientToScreen(mWindowHandle, &top_left);
-
- POINT bottom_right;
- bottom_right.x = client_rect.right;
- bottom_right.y = client_rect.bottom;
- ClientToScreen(mWindowHandle, &bottom_right);
-
- SetRect( rectp,
- top_left.x,
- top_left.y,
- bottom_right.x,
- bottom_right.y );
-
- success = TRUE;
- }
+ RECT client_rect;
+ if (mWindowHandle && GetClientRect(mWindowHandle, &client_rect))
+ {
+ POINT top_left;
+ top_left.x = client_rect.left;
+ top_left.y = client_rect.top;
+ ClientToScreen(mWindowHandle, &top_left);
+
+ POINT bottom_right;
+ bottom_right.x = client_rect.right;
+ bottom_right.y = client_rect.bottom;
+ ClientToScreen(mWindowHandle, &bottom_right);
+
+ SetRect(rectp,
+ top_left.x,
+ top_left.y,
+ bottom_right.x,
+ bottom_right.y);
+
+ success = TRUE;
+ }
- return success;
+ return success;
}
void LLWindowWin32::flashIcon(F32 seconds)
{
- FLASHWINFO flash_info;
-
- flash_info.cbSize = sizeof(FLASHWINFO);
- flash_info.hwnd = mWindowHandle;
- flash_info.dwFlags = FLASHW_TRAY;
- flash_info.uCount = UINT(seconds / ICON_FLASH_TIME);
- flash_info.dwTimeout = DWORD(1000.f * ICON_FLASH_TIME); // milliseconds
- FlashWindowEx(&flash_info);
+ mWindowThread->post([=]()
+ {
+ FLASHWINFO flash_info;
+
+ flash_info.cbSize = sizeof(FLASHWINFO);
+ flash_info.hwnd = mWindowHandle;
+ flash_info.dwFlags = FLASHW_TRAY;
+ flash_info.uCount = UINT(seconds / ICON_FLASH_TIME);
+ flash_info.dwTimeout = DWORD(1000.f * ICON_FLASH_TIME); // milliseconds
+ FlashWindowEx(&flash_info);
+ });
}
F32 LLWindowWin32::getGamma()
@@ -3262,6 +3355,7 @@ F32 LLWindowWin32::getGamma()
BOOL LLWindowWin32::restoreGamma()
{
+ ASSERT_MAIN_THREAD();
if (mCustomGammaSet != FALSE)
{
LL_DEBUGS("Window") << "Restoring gamma" << LL_ENDL;
@@ -3273,6 +3367,7 @@ BOOL LLWindowWin32::restoreGamma()
BOOL LLWindowWin32::setGamma(const F32 gamma)
{
+ ASSERT_MAIN_THREAD();
mCurrentGamma = gamma;
//Get the previous gamma ramp to restore later.
@@ -3311,6 +3406,7 @@ BOOL LLWindowWin32::setGamma(const F32 gamma)
void LLWindowWin32::setFSAASamples(const U32 fsaa_samples)
{
+ ASSERT_MAIN_THREAD();
mFSAASamples = fsaa_samples;
}
@@ -3321,6 +3417,7 @@ U32 LLWindowWin32::getFSAASamples()
LLWindow::LLWindowResolution* LLWindowWin32::getSupportedResolutions(S32 &num_resolutions)
{
+ ASSERT_MAIN_THREAD();
if (!mSupportedResolutions)
{
mSupportedResolutions = new LLWindowResolution[MAX_NUM_RESOLUTIONS];
@@ -3475,7 +3572,12 @@ BOOL LLWindowWin32::resetDisplayResolution()
void LLWindowWin32::swapBuffers()
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32;
+ ASSERT_MAIN_THREAD();
+ glFlush(); //superstitious flush for maybe frame stall removal?
SwapBuffers(mhDC);
+
+ LL_PROFILER_GPU_COLLECT
}
@@ -3700,13 +3802,19 @@ void *LLWindowWin32::getPlatformWindow()
void LLWindowWin32::bringToFront()
{
- BringWindowToTop(mWindowHandle);
+ mWindowThread->post([=]()
+ {
+ BringWindowToTop(mWindowHandle);
+ });
}
// set (OS) window focus back to the client
void LLWindowWin32::focusClient()
{
- SetFocus ( mWindowHandle );
+ mWindowThread->post([=]()
+ {
+ SetFocus(mWindowHandle);
+ });
}
void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
@@ -3948,6 +4056,7 @@ void LLWindowWin32::updateLanguageTextInputArea()
void LLWindowWin32::interruptLanguageTextInput()
{
+ ASSERT_MAIN_THREAD();
if (mPreeditor && LLWinImm::isAvailable())
{
HIMC himc = LLWinImm::getContext(mWindowHandle);
@@ -4150,6 +4259,7 @@ static LLWString find_context(const LLWString & wtext, S32 focus, S32 focus_leng
// for files and via IDropTarget interface requests.
LLWindowCallbacks::DragNDropResult LLWindowWin32::completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url )
{
+ ASSERT_MAIN_THREAD();
return mCallbacks->handleDragNDrop( this, gl_coord, mask, action, url );
}
@@ -4198,6 +4308,7 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res
LL_WARNS("Window") << "*** IMR_QUERYCHARPOSITON called but getPreeditLocation failed." << LL_ENDL;
return FALSE;
}
+
fillCharPosition(caret_coord, preedit_bounds, text_control, char_position);
*result = 1;
@@ -4406,3 +4517,153 @@ std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList()
#endif // LL_WINDOWS
+
+inline LLWindowWin32::LLWindowWin32Thread::LLWindowWin32Thread()
+ : ThreadPool("Window Thread", 1, MAX_QUEUE_SIZE)
+{
+ ThreadPool::start();
+}
+
+/**
+ * LogChange is to log changes in status while trying to avoid spamming the
+ * log with repeated messages, especially in a tight loop. It refuses to log
+ * a continuous run of identical messages, but logs every time the message
+ * changes. (It will happily spam when messages quickly bounce back and
+ * forth.)
+ */
+class LogChange
+{
+public:
+ LogChange(const std::string& tag):
+ mTag(tag)
+ {}
+
+ template <typename... Items>
+ void always(Items&&... items)
+ {
+ // This odd construct ensures that the stringize() call is only
+ // executed if DEBUG logging is enabled for the passed tag.
+ LL_DEBUGS(mTag.c_str());
+ log(LL_CONT, stringize(std::forward<Items>(items)...));
+ LL_ENDL;
+ }
+
+ template <typename... Items>
+ void onChange(Items&&... items)
+ {
+ LL_DEBUGS(mTag.c_str());
+ auto str = stringize(std::forward<Items>(items)...);
+ if (str != mPrev)
+ {
+ log(LL_CONT, str);
+ }
+ LL_ENDL;
+ }
+
+private:
+ void log(std::ostream& out, const std::string& message)
+ {
+ mPrev = message;
+ out << message;
+ }
+ std::string mTag;
+ std::string mPrev;
+};
+
+void LLWindowWin32::LLWindowWin32Thread::run()
+{
+ sWindowThreadId = std::this_thread::get_id();
+ LogChange logger("Window");
+
+ while (! getQueue().done())
+ {
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32;
+
+ if (mWindowHandle != 0)
+ {
+ MSG msg;
+ BOOL status;
+ if (mhDC == 0)
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("w32t - PeekMessage");
+ logger.onChange("PeekMessage(", std::hex, mWindowHandle, ")");
+ status = PeekMessage(&msg, mWindowHandle, 0, 0, PM_REMOVE);
+ }
+ else
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("w32t - GetMessage");
+ logger.always("GetMessage(", std::hex, mWindowHandle, ")");
+ status = GetMessage(&msg, NULL, 0, 0);
+ }
+ if (status > 0)
+ {
+ logger.always("got MSG (", std::hex, msg.hwnd, ", ", msg.message,
+ ", ", msg.wParam, ")");
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+
+ mMessageQueue.pushFront(msg);
+ }
+ }
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("w32t - Function Queue");
+ logger.onChange("runPending()");
+ //process any pending functions
+ getQueue().runPending();
+ }
+
+#if 0
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("w32t - Sleep");
+ logger.always("sleep(1)");
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ }
+#endif
+ }
+}
+
+void LLWindowWin32::post(const std::function<void()>& func)
+{
+ mFunctionQueue.pushFront(func);
+}
+
+void LLWindowWin32::postMouseButtonEvent(const std::function<void()>& func)
+{
+ mMouseQueue.pushFront(func);
+}
+
+void LLWindowWin32::kickWindowThread(HWND windowHandle)
+{
+ if (! windowHandle)
+ windowHandle = mWindowHandle;
+ if (windowHandle)
+ {
+ // post a nonsense user message to wake up the Window Thread in
+ // case any functions are pending and no windows events came
+ // through this frame
+ WPARAM wparam{ 0xB0B0 };
+ LL_DEBUGS("Window") << "PostMessage(" << std::hex << windowHandle
+ << ", " << WM_DUMMY_
+ << ", " << wparam << ")" << std::dec << LL_ENDL;
+ PostMessage(windowHandle, WM_DUMMY_, wparam, 0x1337);
+ }
+}
+
+void LLWindowWin32::updateWindowRect()
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32;
+ //called from window thread
+ RECT rect;
+ RECT client_rect;
+
+ if (GetWindowRect(mWindowHandle, &rect) &&
+ GetClientRect(mWindowHandle, &client_rect))
+ {
+ post([=]
+ {
+ mRect = rect;
+ mClientRect = client_rect;
+ });
+ }
+}
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index e33330c1bb..b391acc12d 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -33,6 +33,10 @@
#include "llwindow.h"
#include "llwindowcallbacks.h"
#include "lldragdropwin32.h"
+#include "llthread.h"
+#include "llthreadsafequeue.h"
+#include "llmutex.h"
+#include "workqueue.h"
// Hack for async host by name
#define LL_WM_HOST_RESOLVED (WM_APP + 1)
@@ -57,9 +61,15 @@ public:
/*virtual*/ BOOL setPosition(LLCoordScreen position);
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
- /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
+ /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL);
+ /*virtual*/ void setTitle(const std::string title);
+ void* createSharedContext() override;
+ void makeContextCurrent(void* context) override;
+ void destroySharedContext(void* context) override;
+ /*virtual*/ void toggleVSync(bool enable_vsync);
/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
+ /*virtual*/ BOOL getCursorDelta(LLCoordCommon* delta);
/*virtual*/ void showCursor();
/*virtual*/ void hideCursor();
/*virtual*/ void showCursorFromMouseMove();
@@ -126,7 +136,7 @@ public:
protected:
LLWindowWin32(LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
- BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
+ BOOL fullscreen, BOOL clearBg, BOOL enable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth, U32 fsaa_samples);
~LLWindowWin32();
@@ -175,17 +185,24 @@ protected:
WCHAR *mWindowTitle;
WCHAR *mWindowClassName;
- HWND mWindowHandle; // window handle
- HGLRC mhRC; // OpenGL rendering context
- HDC mhDC; // Windows Device context handle
+ HWND mWindowHandle = 0; // window handle
+ HGLRC mhRC = 0; // OpenGL rendering context
+ HDC mhDC = 0; // Windows Device context handle
HINSTANCE mhInstance; // handle to application instance
- WNDPROC mWndProc; // user-installable window proc
RECT mOldMouseClip; // Screen rect to which the mouse cursor was globally constrained before we changed it in clipMouse()
WPARAM mLastSizeWParam;
F32 mOverrideAspectRatio;
F32 mNativeAspectRatio;
HCURSOR mCursor[ UI_CURSOR_COUNT ]; // Array of all mouse cursors
+ LLCoordWindow mCursorPosition; // mouse cursor position, should only be mutated on main thread
+ LLMutex mRawMouseMutex;
+ RAWINPUTDEVICE mRawMouse;
+ LLCoordWindow mLastCursorPosition; // mouse cursor position from previous frame
+ LLCoordCommon mRawMouseDelta; // raw mouse delta according to window thread
+ LLCoordCommon mMouseFrameDelta; // how much the mouse moved between the last two calls to gatherInput
+
+ MASK mMouseMask;
static BOOL sIsClassRegistered; // has the window class been registered?
@@ -196,7 +213,6 @@ protected:
BOOL mCustomGammaSet;
LPWSTR mIconResource;
- BOOL mMousePositionModified;
BOOL mInputProcessingPaused;
// The following variables are for Language Text Input control.
@@ -224,6 +240,20 @@ protected:
BOOL mMouseVanish;
+ // Cached values of GetWindowRect and GetClientRect to be used by app thread
+ void updateWindowRect();
+ RECT mRect;
+ RECT mClientRect;
+
+ struct LLWindowWin32Thread;
+ LLWindowWin32Thread* mWindowThread = nullptr;
+ LLThreadSafeQueue<std::function<void()>> mFunctionQueue;
+ LLThreadSafeQueue<std::function<void()>> mMouseQueue;
+ void post(const std::function<void()>& func);
+ void postMouseButtonEvent(const std::function<void()>& func);
+ void recreateWindow(RECT window_rect, DWORD dw_ex_style, DWORD dw_style);
+ void kickWindowThread(HWND windowHandle=0);
+
friend class LLWindowManager;
};