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.

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