Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

177 lines
6.0 KiB

  1. //============ Copyright (c) Valve Corporation, All rights reserved. ============
  2. //
  3. // glmdisplay.h
  4. // display related stuff - used by both GLMgr and the CocoaMgr
  5. //
  6. //===============================================================================
  7. #ifndef GLMDISPLAY_H
  8. #define GLMDISPLAY_H
  9. #pragma once
  10. #ifdef OSX
  11. #include <OpenGL/OpenGL.h>
  12. #include <OpenGL/gl.h>
  13. #include <OpenGL/glext.h>
  14. #include <OpenGL/CGLTypes.h>
  15. #include <OpenGL/CGLRenderers.h>
  16. #include <OpenGL/CGLCurrent.h>
  17. #include <ApplicationServices/ApplicationServices.h>
  18. #elif defined(DX_TO_GL_ABSTRACTION)
  19. #include <GL/gl.h>
  20. #include <GL/glext.h>
  21. #include "tier0/platform.h"
  22. #else
  23. #error
  24. #endif
  25. typedef void _PseudoNSGLContext; // aka NSOpenGLContext
  26. typedef _PseudoNSGLContext *PseudoNSGLContextPtr;
  27. struct GLMDisplayModeInfoFields
  28. {
  29. uint m_modePixelWidth;
  30. uint m_modePixelHeight;
  31. uint m_modeRefreshHz;
  32. // are we even going to talk about bit depth... not yet
  33. };
  34. struct GLMDisplayInfoFields
  35. {
  36. #ifdef OSX
  37. CGDirectDisplayID m_cgDisplayID;
  38. CGOpenGLDisplayMask m_glDisplayMask; // result of CGDisplayIDToOpenGLDisplayMask on the cg_displayID.
  39. #endif
  40. uint m_displayPixelWidth;
  41. uint m_displayPixelHeight;
  42. };
  43. struct GLMRendererInfoFields
  44. {
  45. /*properties of interest and their desired values.
  46. kCGLRPFullScreen = 54, true
  47. kCGLRPAccelerated = 73, true
  48. kCGLRPWindow = 80, true
  49. kCGLRPRendererID = 70, informational
  50. kCGLRPDisplayMask = 84, informational
  51. kCGLRPBufferModes = 100, informational
  52. kCGLRPColorModes = 103, informational
  53. kCGLRPAccumModes = 104, informational
  54. kCGLRPDepthModes = 105, informational
  55. kCGLRPStencilModes = 106, informational
  56. kCGLRPMaxAuxBuffers = 107, informational
  57. kCGLRPMaxSampleBuffers = 108, informational
  58. kCGLRPMaxSamples = 109, informational
  59. kCGLRPSampleModes = 110, informational
  60. kCGLRPSampleAlpha = 111, informational
  61. kCGLRPVideoMemory = 120, informational
  62. kCGLRPTextureMemory = 121, informational
  63. kCGLRPRendererCount = 128 number of renderers in the CGLRendererInfoObj under examination
  64. kCGLRPOffScreen = 53, D/C
  65. kCGLRPRobust = 75, FALSE or D/C - aka we're asking for no-fallback
  66. kCGLRPBackingStore = 76, D/C
  67. kCGLRPMPSafe = 78, D/C
  68. kCGLRPMultiScreen = 81, D/C
  69. kCGLRPCompliant = 83, D/C
  70. */
  71. //--------------------------- info we have from CGL renderer queries, IOKit, Gestalt
  72. //--------------------------- these are set up in the displayDB by CocoaMgr
  73. GLint m_fullscreen;
  74. GLint m_accelerated;
  75. GLint m_windowed;
  76. GLint m_rendererID;
  77. GLint m_displayMask;
  78. GLint m_bufferModes;
  79. GLint m_colorModes;
  80. GLint m_accumModes;
  81. GLint m_depthModes;
  82. GLint m_stencilModes;
  83. GLint m_maxAuxBuffers;
  84. GLint m_maxSampleBuffers;
  85. GLint m_maxSamples;
  86. GLint m_sampleModes;
  87. GLint m_sampleAlpha;
  88. GLint m_vidMemory;
  89. GLint m_texMemory;
  90. uint m_pciVendorID;
  91. uint m_pciDeviceID;
  92. char m_pciModelString[64];
  93. char m_driverInfoString[64];
  94. //--------------------------- OS version related - set up by CocoaMgr
  95. // OS version found
  96. uint m_osComboVersion; // 0x00XXYYZZ : XX major, YY minor, ZZ minor minor : 10.6.3 --> 0x000A0603. 10.5.8 --> 0x000A0508.
  97. //--------------------------- shorthands - also set up by CocoaMgr - driven by vendorid / deviceid
  98. bool m_ati;
  99. bool m_atiR5xx;
  100. bool m_atiR6xx;
  101. bool m_atiR7xx;
  102. bool m_atiR8xx;
  103. bool m_atiNewer;
  104. bool m_intel;
  105. bool m_intel95x;
  106. bool m_intel3100;
  107. bool m_intelHD4000;
  108. bool m_nv;
  109. bool m_nvG7x;
  110. bool m_nvG8x;
  111. bool m_nvNewer;
  112. //--------------------------- context query results - left blank in the display DB - but valid in a GLMContext (call ctx->Caps() to get a const ref)
  113. // booleans
  114. bool m_hasGammaWrites; // aka glGetBooleanv(GL_FRAMEBUFFER_SRGB_CAPABLE_EXT) / glEnable(GL_FRAMEBUFFER_SRGB_EXT)
  115. bool m_hasMixedAttachmentSizes; // aka ARB_fbo in 10.6.3 - test for min OS vers, then exported ext string
  116. bool m_hasBGRA; // aka GL_BGRA vertex attribs in 10.6.3 - - test for min OS vers, then exported ext string
  117. bool m_hasNewFullscreenMode; // aka 10.6.x "big window" fullscreen mode
  118. bool m_hasNativeClipVertexMode; // aka GLSL gl_ClipVertex does not fall back to SW- OS version and folklore-based
  119. bool m_hasOcclusionQuery; // occlusion query: do you speak it ?!
  120. bool m_hasFramebufferBlit; // framebuffer blit: know what I'm sayin?!
  121. bool m_hasPerfPackage1; // means new MTGL, fast OQ, fast uniform upload, NV can resolve flipped (late summer 2010 post 10.6.4 update)
  122. // counts
  123. int m_maxAniso; // aniso limit - context query
  124. // other exts
  125. bool m_hasBindableUniforms;
  126. int m_maxVertexBindableUniforms;
  127. int m_maxFragmentBindableUniforms;
  128. int m_maxBindableUniformSize;
  129. bool m_hasUniformBuffers;
  130. // runtime options that aren't negotiable once set
  131. bool m_hasDualShaders; // must supply CLI arg "-glmdualshaders" or we go GLSL only
  132. //--------------------------- " can'ts " - specific problems that need to be worked around
  133. bool m_cantBlitReliably; // Intel chipsets have problems blitting sRGB sometimes
  134. bool m_cantAttachSRGB; // NV G8x on 10.5.8 can't have srgb tex on FBO color - separate issue from hasGammaWrites
  135. bool m_cantResolveFlipped; // happens on NV in 10.6.4 and prior - console variable "gl_can_resolve_flipped" can overrule
  136. bool m_cantResolveScaled; // happens everywhere per GL spec but may be relaxed some day - console variable "gl_can_resolve_scaled" can overrule
  137. bool m_costlyGammaFlips; // this means that sRGB sampling state affects shader code gen, resulting in state-dependent code regen
  138. //--------------------------- " bads " - known bad drivers
  139. bool m_badDriver1064NV; // this is the bad NVIDIA driver on 10.6.4 - stutter, tex corruption, black screen issues
  140. bool m_badDriver108Intel; // this is the bad Intel HD4000 driver on 10.8 - intermittent crash on GLSL compilation.
  141. };
  142. #endif