30 #import "../../idlib/precompiled.h"
32 #import "../../renderer/tr_local.h"
40 #import <AppKit/AppKit.h>
41 #import <Foundation/Foundation.h>
43 #import <mach-o/dyld.h>
45 #import <mach/mach_error.h>
51 static void GLW_InitExtensions(
void );
53 static unsigned long Sys_QueryVideoMemory();
57 static bool isHidden =
false;
66 return _contextAuxiliary;
79 if ( err != GL_NO_ERROR ) {
84 #if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS)
86 unsigned int QGLBeginStarted = 0;
88 void QGLErrorBreak(
void) { }
90 void QGLCheckError(
const char *message ) {
92 static unsigned int errorCount = 0;
94 error = _glGetError();
95 if (error != GL_NO_ERROR) {
96 if (errorCount == 100) {
97 common->
Printf(
"100 GL errors printed ... disabling further error reporting.\n");
98 }
else if (errorCount < 100) {
99 if (errorCount == 0) {
100 common->
Warning(
"BREAK ON QGLErrorBreak to stop at the GL errors\n");
102 common->
Warning(
"OpenGL Error(%s): 0x%04x -- %s\n", message, (
int)error, gluErrorString(error));
115 if ( !CreateGameWindow( parms ) ) {
116 common->
Printf(
"GLimp_SetMode: window could not be created!\n" );
146 #define ADD_ATTR(x) \
148 if (attributeIndex >= attributeSize) { \
149 attributeSize *= 2; \
150 pixelAttributes = (NSOpenGLPixelFormatAttribute *)NSZoneRealloc(NULL, pixelAttributes, sizeof(*pixelAttributes) * attributeSize); \
152 pixelAttributes[attributeIndex] = (NSOpenGLPixelFormatAttribute)x; \
155 common->Printf( "Adding pixel attribute: %d (%s)\n", x, #x); \
159 static NSOpenGLPixelFormatAttribute *GetPixelAttributes(
unsigned int multisamples ) {
160 NSOpenGLPixelFormatAttribute *pixelAttributes;
161 unsigned int attributeIndex = 0;
162 unsigned int attributeSize = 128;
164 unsigned int colorDepth;
165 unsigned int desktopColorDepth;
166 unsigned int depthBits;
167 unsigned int stencilBits;
172 pixelAttributes = (NSOpenGLPixelFormatAttribute *)NSZoneMalloc(
NULL,
sizeof(*pixelAttributes) * attributeSize);
175 ADD_ATTR( NSOpenGLPFAMinimumPolicy );
195 desktopColorDepth = [[glw_state.desktopMode objectForKey: (id)kCGDisplayBitsPerPixel] intValue];
196 if ( desktopColorDepth != 32 ) {
197 common->
Warning(
"Desktop display colors should be 32 bits for window rendering" );
216 if ( multisamples ) {
218 ADD_ATTR( NSOpenGLPFASampleBuffers );
227 return pixelAttributes;
231 NSRect windowRect, screenRect;
252 static void ReleaseAllDisplays() {
253 CGDisplayCount displayIndex;
256 for (displayIndex = 0; displayIndex < glw_state.
displayCount; displayIndex++) {
267 const char *windowed[] = {
"Windowed",
"Fullscreen" };
268 NSOpenGLPixelFormatAttribute *pixelAttributes;
269 NSOpenGLPixelFormat *pixelFormat;
271 unsigned int multisamples;
272 const long swap_limit =
false;
273 int nsOpenGLCPSwapLimit = 203;
278 common->
Error(
"Could not get current graphics mode for display 0x%08x\n", glw_state.
display );
290 common->
Printf(
"Unable to find requested display mode.\n");
298 if ( err != CGDisplayNoErr ) {
299 CGDisplayRestoreColorSyncSettings();
300 common->
Printf(
" Unable to capture displays err = %d\n", err );
304 err = CGDisplaySwitchToMode(glw_state.
display, (CFDictionaryRef)glw_state.
gameMode);
305 if ( err != CGDisplayNoErr ) {
306 CGDisplayRestoreColorSyncSettings();
307 ReleaseAllDisplays();
308 common->
Printf(
" Unable to set display mode, err = %d\n", err );
318 while ( !pixelFormat ) {
319 pixelAttributes = GetPixelAttributes( multisamples );
320 pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes: pixelAttributes] autorelease];
321 NSZoneFree(
NULL, pixelAttributes);
322 if ( pixelFormat || multisamples == 0 )
329 CGDisplayRestoreColorSyncSettings();
331 ReleaseAllDisplays();
337 OSX_SetGLContext([[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: nil]);
339 CGDisplayRestoreColorSyncSettings();
341 ReleaseAllDisplays();
342 common->
Printf(
"... +[NSOpenGLContext createWithFormat:share:] failed.\n" );
346 long system_version = 0;
347 Gestalt( gestaltSystemVersion, &system_version );
348 if ( parms.
width <= 1024 && parms.
height <= 768 && system_version <= 0x1045 ) {
349 [ OSX_GetNSGLContext() setValues: &swap_limit forParameter: (NSOpenGLContextParameter)nsOpenGLCPSwapLimit ];
360 displayCount = [[NSScreen screens] count];
361 if ( displayIndex < 0 || displayIndex >= displayCount ) {
362 screen = [NSScreen mainScreen];
364 screen = [[NSScreen screens] objectAtIndex:displayIndex];
367 NSRect
r = [screen frame];
368 windowRect.origin.x = ((short)r.size.width - parms.
width) / 2;
369 windowRect.origin.y = ((short)r.size.height - parms.
height) / 2;
370 windowRect.size.width = parms.
width;
371 windowRect.size.height = parms.
height;
373 glw_state.
window = [NSWindow alloc];
374 [glw_state.window initWithContentRect:windowRect styleMask:NSTitledWindowMask backing:NSBackingStoreRetained defer:NO screen:screen];
376 [glw_state.window setTitle: @GAME_NAME];
378 [glw_state.window orderFront: nil];
382 [glw_state.window setAcceptsMouseMovedEvents: YES];
385 [OSX_GetNSGLContext() setView: [glw_state.window contentView]];
396 CGDisplayRestoreColorSyncSettings();
398 ReleaseAllDisplays();
399 common->
Printf(
"CGLSetFullScreen -> %d (%s)\n", err, CGLErrorString(err));
406 #ifndef USE_CGLMACROS
412 [pixelFormat getValues: (long *) &glConfig.colorBits forAttribute: NSOpenGLPFAColorSize forVirtualScreen: 0];
413 [pixelFormat getValues: (long *) &glConfig.depthBits forAttribute: NSOpenGLPFADepthSize forVirtualScreen: 0];
414 [pixelFormat getValues: (long *) &glConfig.stencilBits forAttribute: NSOpenGLPFAStencilSize forVirtualScreen: 0];
430 [OSX_GetNSGLContext() clearDrawable];
441 [OSX_GetNSGLContext() setView: [glw_state.window contentView]];
447 common->
Printf(
"CGLSetFullScreen -> %d (%s)\n", err, CGLErrorString(err));
462 static void GLImp_Dump_Stamp_List_f(
void) {
463 OTStampListDumpToFile(glThreadStampList,
"/tmp/gl_stamps");
475 if ( !Sys_QueryVideoMemory() ) {
476 common->
Error(
"Could not initialize OpenGL. There does not appear to be an OpenGL-supported video card in your system.\n" );
501 GLW_InitExtensions();
525 #if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS)
526 QGLCheckError(
"GLimp_EndFrame");
531 [OSX_GetNSGLContext() flushBuffer];
558 static void _GLimp_RestoreOriginalVideoSettings() {
565 err = CGDisplaySwitchToMode(glw_state.
display, (CFDictionaryRef)glw_state.
desktopMode);
566 if ( err != CGDisplayNoErr )
569 ReleaseAllDisplays();
574 CGDisplayCount displayIndex;
581 #ifndef USE_CGLMACROS
586 [OSX_GetNSGLContext() clearDrawable];
588 [OSX_GetNSGLContext() release];
592 _GLimp_RestoreOriginalVideoSettings();
603 [glw_state.window release];
612 for (displayIndex = 0; displayIndex < glw_state.
displayCount; displayIndex++) {
631 memset(&glw_state, 0,
sizeof(glw_state));
649 unsigned short green[256],
650 unsigned short blue[256]) {
651 CGGammaValue redGamma[256], greenGamma[256], blueGamma[256];
655 for (i = 0; i < 256; i++) {
656 redGamma[i] = red[i] / 65535.0;
657 greenGamma[i] = green[i] / 65535.0;
658 blueGamma[i] = blue[i] / 65535.0;
661 err = CGSetDisplayTransferByTable(glw_state.
display, 256, redGamma, greenGamma, blueGamma);
662 if (err != CGDisplayNoErr) {
663 common->
Printf(
"GLimp_SetGamma: CGSetDisplayTransferByByteTable returned %d.\n", err);
674 #pragma mark ¥ ATI_fragment_shader
676 static GLuint sGeneratingProgram = 0;
677 static int sCurrentPass;
678 static char sConstString[4096];
679 static char sPassString[2][4096];
681 static int sConstUsed;
682 static int sConst[8];
683 static GLfloat sConstVal[8][4];
685 static void _endPass (
void) {
686 if (!sOpUsed)
return;
708 for (i = 0; i < 8; i ++)
712 sPassString[0][0] = 0;
713 sPassString[1][0] = 0;
716 sGeneratingProgram = 1;
722 char fragString[4096];
724 sGeneratingProgram = 0;
727 strcpy(fragString,
"!!ATIfs1.0\n");
730 if (sConstString[0] || sConstUsed) {
731 strcat (fragString,
"StartConstants;\n");
733 for (i = 0; i < 8; i ++) {
734 if (sConst[i] == 1) {
736 sprintf (str,
" CONSTANT c%d = program.env[%d];\n", i, i);
737 strcat (fragString, str);
741 if (sConstString[0]) {
742 strcat (fragString, sConstString);
744 strcat (fragString,
"EndConstants;\n\n");
747 if (sCurrentPass == 0) {
748 strcat(fragString,
"StartOutputPass;\n");
749 strcat(fragString, sPassString[0]);
750 strcat(fragString,
"EndPass;\n");
752 strcat(fragString,
"StartPrelimPass;\n");
753 strcat(fragString, sPassString[0]);
754 strcat(fragString,
"EndPass;\n\n");
756 strcat(fragString,
"StartOutputPass;\n");
757 strcat(fragString, sPassString[1]);
758 strcat(fragString,
"EndPass;\n");
765 common->
Warning(
"WARNING: glError at %d:%s when compiling atiFragmentShader %s", errPos, errString, fragString);
772 if (sGeneratingProgram) {
774 sprintf (str,
" CONSTANT c%d = { %f, %f, %f, %f };\n", constNum, val[0], val[1], val[2], val[3]);
775 strcat (sConstString, str);
776 sConst[constNum] = 2;
784 if (memcmp (val, sConstVal[constNum],
sizeof(GLfloat)*8*4) != 0)
787 memcpy (sConstVal[constNum], val,
sizeof(GLfloat)*8*4);
795 static char str[128];
804 sConst[arg - GL_CON_0_ATI] = 1;
810 strcpy(str,
"color0");
812 strcpy(str,
"color1");
813 }
else if (arg == GL_ZERO) {
815 }
else if (arg == GL_ONE) {
824 char str[128] =
"\0";
844 strcat(sPassString[sCurrentPass], str);
848 char str[128] =
"\0";
868 strcat(sPassString[sCurrentPass], str);
874 static char str[128];
883 strcpy(str,
".rgba");
917 static char str[128];
921 if( mod == GL_NONE) {
942 strcat(str,
".half");
946 strcat(str,
".quarter");
950 strcat(str,
".eighth");
959 static char str[128];
963 if( mod == GL_NONE) {
976 strcat(str,
".bias");
980 strcat(str,
".comp");
987 char str[128] =
"\0";
1000 if(dstMask != GL_NONE) {
1004 strcat(str,
".rgb" );
1007 if(dstMod != GL_NONE) {
1013 if(arg1Rep != GL_NONE) {
1016 if(arg1Mod != GL_NONE) {
1021 strcat(sPassString[sCurrentPass], str);
1025 char str[128] =
"\0";
1057 if(dstMask != GL_NONE) {
1061 strcat(str,
".rgb" );
1063 if(dstMod != GL_NONE) {
1071 if(arg1Mod != GL_NONE) {
1079 if(arg2Mod != GL_NONE) {
1084 strcat(sPassString[sCurrentPass], str);
1087 void glColorFragmentOp3ATI (
GLenum op,
GLuint dst,
GLuint dstMask,
GLuint dstMod,
GLuint arg1,
GLuint arg1Rep,
GLuint arg1Mod,
GLuint arg2,
GLuint arg2Rep,
GLuint arg2Mod,
GLuint arg3,
GLuint arg3Rep,
GLuint arg3Mod) {
1088 char str[128] =
"\0";
1128 if(dstMask != GL_NONE) {
1132 strcat(str,
".rgb" );
1134 if(dstMod != GL_NONE) {
1140 if(arg1Rep != GL_NONE) {
1143 if(arg1Mod != GL_NONE) {
1149 if(arg2Rep != GL_NONE) {
1152 if(arg2Mod != GL_NONE) {
1158 if(arg3Rep != GL_NONE) {
1161 if(arg3Mod != GL_NONE) {
1166 strcat(sPassString[sCurrentPass], str);
1177 void glAlphaFragmentOp3ATI (
GLenum op,
GLuint dst,
GLuint dstMod,
GLuint arg1,
GLuint arg1Rep,
GLuint arg1Mod,
GLuint arg2,
GLuint arg2Rep,
GLuint arg2Mod,
GLuint arg3,
GLuint arg3Rep,
GLuint arg3Mod) {
1178 glColorFragmentOp3ATI ( op, dst, GL_ALPHA, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod);
1187 if (!
strcmp(name,
"glGenFragmentShadersATI")) {
1190 if (!
strcmp(name,
"glBindFragmentShaderATI")) {
1193 if (!
strcmp(name,
"glDeleteFragmentShaderATI")) {
1196 if (!
strcmp(name,
"glBeginFragmentShaderATI")) {
1199 if (!
strcmp(name,
"glEndFragmentShaderATI")) {
1202 if (!
strcmp(name,
"glPassTexCoordATI")) {
1205 if (!
strcmp(name,
"glSampleMapATI")) {
1208 if (!
strcmp(name,
"glColorFragmentOp1ATI")) {
1211 if (!
strcmp(name,
"glColorFragmentOp2ATI")) {
1214 if (!
strcmp(name,
"glColorFragmentOp3ATI")) {
1217 if (!
strcmp(name,
"glAlphaFragmentOp1ATI")) {
1220 if (!
strcmp(name,
"glAlphaFragmentOp2ATI")) {
1223 if (!
strcmp(name,
"glAlphaFragmentOp3ATI")) {
1226 if (!
strcmp(name,
"glSetFragmentShaderConstantATI")) {
1231 symbolName = (
char *)alloca(strlen(name) + 2);
1232 strcpy(symbolName + 1, name);
1233 symbolName[0] =
'_';
1235 if ( !NSIsSymbolNameDefined( symbolName ) ) {
1239 symbol = NSLookupAndBindSymbol(symbolName);
1256 void GLW_InitExtensions(
void ) { }
1258 #define MAX_RENDERER_INFO_COUNT 128
1261 unsigned long Sys_QueryVideoMemory() {
1263 CGLRendererInfoObj rendererInfo, rendererInfos[MAX_RENDERER_INFO_COUNT];
1265 long rendererIndex, rendererCount;
1266 long maxVRAM = 0, vram = 0;
1269 long totalRenderers = 0;
1271 err = CGLQueryRendererInfo(CGDisplayIDToOpenGLDisplayMask(
Sys_DisplayToUse()), rendererInfos, &rendererInfoCount);
1278 for (rendererInfoIndex = 0; rendererInfoIndex < rendererInfoCount && totalRenderers < rendererInfoCount; rendererInfoIndex++) {
1279 rendererInfo = rendererInfos[rendererInfoIndex];
1283 err = CGLDescribeRenderer(rendererInfo, 0, kCGLRPRendererCount, &rendererCount);
1285 common->
Printf(
"CGLDescribeRenderer(kCGLRPRendererID) -> %d\n", err);
1290 for (rendererIndex = 0; rendererIndex < rendererCount; rendererIndex++) {
1294 rendererID = 0xffffffff;
1295 err = CGLDescribeRenderer(rendererInfo, rendererIndex, kCGLRPRendererID, &rendererID);
1297 common->
Printf(
"CGLDescribeRenderer(kCGLRPRendererID) -> %d\n", err);
1303 err = CGLDescribeRenderer(rendererInfo, rendererIndex, kCGLRPAccelerated, &accelerated);
1305 common->
Printf(
"CGLDescribeRenderer(kCGLRPAccelerated) -> %d\n", err);
1313 err = CGLDescribeRenderer(rendererInfo, rendererIndex, kCGLRPVideoMemory, &vram);
1326 err = CGLDestroyRendererInfo(rendererInfo);
1358 [OSX_GetNSGLContext() clearDrawable];
1361 _GLimp_RestoreOriginalVideoSettings();
1369 ReleaseAllDisplays();
1384 CGDisplayCount displayIndex;
1385 for (displayIndex = 0; displayIndex < glw_state.
displayCount; displayIndex++) {
1388 err = CGDisplayCapture(table->
display);
1389 if (err != CGDisplayNoErr)
1392 return CGDisplayNoErr;
1408 if (err != CGDisplayNoErr) {
1410 common->
Printf(
"Unhide failed -- cannot capture the display again.\n" );
1415 err = CGDisplaySwitchToMode(glw_state.
display, (CFDictionaryRef)glw_state.
gameMode);
1416 if ( err != CGDisplayNoErr ) {
1417 ReleaseAllDisplays();
1419 common->
Printf(
"Unhide failed -- Unable to set display mode\n" );
1426 ReleaseAllDisplays();
1428 common->
Printf(
"Unhide failed: CGLSetFullScreen -> %d (%s)\n", err, CGLErrorString(glErr));
1433 [OSX_GetNSGLContext() makeCurrentContext];
1466 [NSOpenGLContext clearCurrentContext];
1470 [OSX_GetNSGLContext() makeCurrentContext];
1476 NSArray *displayModes;
1478 unsigned int modeIndex, modeCount, bestModeIndex;
1481 int minFreq, maxFreq;
1482 unsigned int colorDepth;
1490 if ( minFreq > maxFreq ) {
1491 common->
Error(
"r_minDisplayRefresh must be less than or equal to r_maxDisplayRefresh" );
1494 displayModes = (NSArray *)CGDisplayAvailableModes(glw_state.
display);
1495 if (!displayModes) {
1496 common->
Error(
"CGDisplayAvailableModes returned NULL -- 0x%0x is an invalid display", glw_state.
display);
1499 modeCount = [displayModes count];
1502 common->
Printf(
"Current mode is %s\n", [[(
id)CGDisplayCurrentMode(glw_state.
display) description] cString]);
1506 bestModeIndex = 0xFFFFFFFF;
1508 for ( modeIndex = 0; modeIndex < modeCount; ++modeIndex ) {
1512 mode = [displayModes objectAtIndex: modeIndex];
1514 common->
Printf(
" mode %d -- %s\n", modeIndex, [[mode description] cString]);
1518 if ([[mode objectForKey: (
id)kCGDisplayWidth] intValue] != parms.
width ||
1519 [[mode objectForKey: (
id)kCGDisplayHeight] intValue] != parms.
height) {
1526 refresh = [[mode objectForKey: (id)kCGDisplayRefreshRate] intValue];
1527 if (minFreq && refresh < minFreq) {
1533 if (maxFreq && refresh > maxFreq) {
1539 if ([[mode objectForKey: (
id)kCGDisplayBitsPerPixel] intValue] != colorDepth) {
1545 object = [mode objectForKey: (id)kCGDisplayModeIsStretched];
1556 common->
Printf(
" -- stretch requested, stretch property not available\n");
1561 bestModeIndex = modeIndex;
1567 common->
Printf(
" bestModeIndex = %d\n", bestModeIndex);
1569 if (bestModeIndex == 0xFFFFFFFF) {
1570 common->
Printf(
"No suitable display mode available.\n");
1574 return [displayModes objectAtIndex: bestModeIndex];
1578 #define MAX_DISPLAYS 128
1581 CGTableCount tableSize = 512;
1587 table->
red = (
float *)malloc(tableSize *
sizeof(*table->
red));
1590 table->
green = (
float *)malloc(tableSize *
sizeof(*table->
green));
1593 table->
blue = (
float *)malloc(tableSize *
sizeof(*table->
blue));
1596 err = CGGetDisplayTransferByTable(table->
display, tableSize, table->
red, table->
green, table->
blue,
1598 if (err != CGDisplayNoErr) {
1599 common->
Printf(
"GLimp_Init: CGGetDisplayTransferByTable returned %d.\n", err);
1608 CGDirectDisplayID displays[MAX_DISPLAYS];
1609 CGDisplayCount displayIndex;
1613 if (err != CGDisplayNoErr)
1614 Sys_Error(
"Cannot get display list -- CGGetActiveDisplayList returned %d.\n", err);
1617 for (displayIndex = 0; displayIndex < glw_state.
displayCount; displayIndex++) {
1621 table->
display = displays[displayIndex];
1629 CGTableCount tableSize;
1631 CGTableCount gammaIndex;
1647 red = (
float *)realloc(red,
sizeof(*red) * tableSize);
1648 green = (
float *)realloc(green,
sizeof(*green) * tableSize);
1649 blue = (
float *)realloc(blue,
sizeof(*blue) * tableSize);
1655 for (gammaIndex = 0; gammaIndex < table->
tableSize; gammaIndex++) {
1656 red[gammaIndex] = table->
red[gammaIndex] * fraction;
1657 blue[gammaIndex] = table->
blue[gammaIndex] * fraction;
1658 green[gammaIndex] = table->
green[gammaIndex] * fraction;
1661 CGSetDisplayTransferByTable(table->
display, table->
tableSize, red, green, blue);
1666 #define FADE_DURATION 0.5
1668 CGDisplayCount displayIndex;
1671 NSTimeInterval
start, current;
1679 start = [NSDate timeIntervalSinceReferenceDate];
1682 current = [NSDate timeIntervalSinceReferenceDate];
1683 time = current -
start;
1687 for (displayIndex = 0; displayIndex < glw_state.
displayCount; displayIndex++) {
1695 CGDisplayCount displayIndex;
1708 for (displayIndex = 0; displayIndex < glw_state.
displayCount; displayIndex++) {
1710 NSTimeInterval
start, current;
1713 start = [NSDate timeIntervalSinceReferenceDate];
1718 current = [NSDate timeIntervalSinceReferenceDate];
1719 time = current -
start;
1733 CGDisplayCount displayIndex;
1736 NSTimeInterval
start, current;
1748 start = [NSDate timeIntervalSinceReferenceDate];
1751 current = [NSDate timeIntervalSinceReferenceDate];
1752 time = current -
start;
1756 for (displayIndex = 0; displayIndex < glw_state.
displayCount; displayIndex++) {
1764 CGDisplayCount displayIndex;
1779 for (i = 0; i < table->
tableSize; i++) {
1786 for (displayIndex = 0; displayIndex < glw_state.
displayCount; displayIndex++) {
1795 NSTimeInterval
start, current;
1798 start = [NSDate timeIntervalSinceReferenceDate];
1802 current = [NSDate timeIntervalSinceReferenceDate];
1803 time = current -
start;
1811 common->
Printf(
"Unable to find display to unfade it\n");
1814 #define MAX_DISPLAYS 128
1817 static bool gotDisplay = NO;
1818 static CGDirectDisplayID displayToUse;
1821 CGDirectDisplayID displays[MAX_DISPLAYS];
1822 CGDisplayCount displayCount;
1826 return displayToUse;
1830 err = CGGetActiveDisplayList(
MAX_DISPLAYS, displays, &displayCount );
1831 if ( err != CGDisplayNoErr ) {
1832 common->
Error(
"Cannot get display list -- CGGetActiveDisplayList returned %d.\n", err );
1838 if ( displayIndex < 0 || displayIndex >= displayCount ) {
1842 displayToUse = displays[ 0 ];
1844 displayToUse = displays[ displayIndex ];
1847 return displayToUse;
virtual void SetCVarInteger(const char *name, const int value, int flags=0)=0
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2Mod
void glAlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod)
idCVarSystem * cvarSystem
void GLimp_Shutdown(void)
GLuint glGenFragmentShadersATI(GLuint ID)
void GLimp_FrontEndSleep(void)
void GLimp_LogComment(char *comment)
void glBeginFragmentShaderATI(void)
CGDisplayCount displayCount
void GLimp_SwapBuffers(void)
PFNGLGENPROGRAMSARBPROC qglGenProgramsARB
idCVar r_swapInterval("r_swapInterval","0", CVAR_RENDERER|CVAR_ARCHIVE|CVAR_INTEGER,"changes wglSwapIntarval")
const GLubyte * glGetString(GLenum name)
#define OSX_GLContextSetCurrent()
void Sys_ShutdownInput(void)
GLuint GLuint GLuint dstMod
#define GL_QUARTER_BIT_ATI
virtual int GetCVarInteger(const char *name) const =0
GLenum GLsizei GLenum GLenum const GLvoid * table
void * wglGetProcAddress(const char *name)
void glColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod)
#define OSX_SetGLContext(context)
CGDirectDisplayID Sys_DisplayToUse(void)
void GLimp_WakeRenderer(void *data)
#define GL_PROGRAM_ERROR_POSITION_ARB
idCVar r_fullscreen("r_fullscreen","1", CVAR_RENDERER|CVAR_ARCHIVE|CVAR_BOOL,"0 = windowed, 1 = full screen")
void GLimp_SetGamma(unsigned short red[256], unsigned short green[256], unsigned short blue[256])
void(* GLExtension_t)(void)
#define GL_SWIZZLE_STR_ATI
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
void Sys_FadeScreen(CGDirectDisplayID display)
bool GLimp_Init(glimpParms_t parms)
void Sys_SetScreenFade(glwgamma_t *table, float fraction)
GLuint GLuint GLuint GLuint arg1
char * makeDstModStr(GLuint mod)
void glSetFragmentShaderConstantATI(GLuint num, const GLfloat *val)
#define OSX_GLContextClearCurrent()
void glAlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod)
char * makeMaskStr(GLuint mask)
#define GL_EIGHTH_BIT_ATI
CGLContextObj cglContext()
CGDirectDisplayID display
void Sys_UnfadeScreen(CGDirectDisplayID display, glwgamma_t *table)
#define OSX_GetCGLContext()
void glAlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod)
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3
CGDisplayErr Sys_CaptureActiveDisplays(void)
bool GLimp_SetMode(glimpParms_t parms)
PFNGLBINDPROGRAMARBPROC qglBindProgramARB
const char * vendor_string
GLsizei GLsizei GLenum GLenum const GLvoid * data
int GetInteger(void) const
void GLimp_ActivateContext(void)
NSDictionary * Sys_GetMatchingDisplayMode(glimpParms_t parms)
void * GLimp_BackEndSleep(void)
void Sys_SetGammaTable(glwgamma_t *table)
GLuint GLuint GLuint GLuint GLuint arg1Rep
#define GL_SATURATE_BIT_ATI
const char * extensions_string
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2Rep
GLExtension_t GLimp_ExtensionPointer(const char *name)
CGDirectDisplayID display
virtual void Printf(const char *fmt,...) id_attribute((format(printf
#define GL_PROGRAM_ERROR_STRING_ARB
char * makeArgStr(GLuint arg)
void Sys_SetMouseInputRect(CGRect newRect)
const char * renderer_string
unsigned int bufferSwapCount
#define GL_PRIMARY_COLOR_ARB
void GLimp_EnableLogging(bool stat)
void glSampleMapATI(GLuint dst, GLuint interp, GLenum swizzle)
GLdouble GLdouble GLdouble r
static WindowRef ValidModeCallbackProc inCallback OSStatus err
void Sys_GrabMouseCursor(bool grabIt)
GLuint GLuint GLuint GLuint GLuint GLuint arg1Mod
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3Mod
const char * version_string
#define OSX_GetNSGLContext()
void glBindFragmentShaderATI(GLuint ID)
NSDictionary * desktopMode
bool IsModified(void) const
void Sys_UpdateWindowMouseInputRect(void)
PFNGLPROGRAMENVPARAMETER4FVARBPROC qglProgramEnvParameter4fvARB
void GLimp_DeactivateContext(void)
#define GL_SWIZZLE_STQ_DQ_ATI
#define GL_TEXT_FRAGMENT_SHADER_ATI
unsigned int glPauseCount
virtual bool GetCVarBool(const char *name) const =0
#define GL_PROGRAM_FORMAT_ASCII_ARB
void Sys_Error(const char *error,...)
void glEndFragmentShaderATI(void)
void glColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod)
bool GLimp_SetScreenParms(glimpParms_t parms)
glwgamma_t * originalDisplayGammaTables
void Sys_StoreGammaTables()
#define GL_SWIZZLE_STQ_ATI
#define GL_SWIZZLE_STR_DR_ATI
void Sys_GetGammaTable(glwgamma_t *table)
PFNGLPROGRAMSTRINGARBPROC qglProgramStringARB
bool GLimp_SpawnRenderThread(void(*function)(void))
virtual void Error(const char *fmt,...) id_attribute((format(printf
typedef GLuint(APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC)(GLsizei range)
void glPassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle)
void glColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod)
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
#define GL_SECONDARY_INTERPOLATOR_ATI
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3Rep
#define MAX_RENDERER_INFO_COUNT
int sprintf(idStr &string, const char *fmt,...)
void * GLimp_RendererSleep(void)
void GLimp_WakeBackEnd(void *data)
void glDeleteFragmentShaderATI(GLuint ID)
#define GL_NEGATE_BIT_ATI
char * makeArgModStr(GLuint mod)