Team Fortress 2 Source Code as on 22/4/2020
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.

157 lines
5.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. // TOGL CODE LICENSE
  3. //
  4. // Copyright 2011-2014 Valve Corporation
  5. // All Rights Reserved.
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining a copy
  8. // of this software and associated documentation files (the "Software"), to deal
  9. // in the Software without restriction, including without limitation the rights
  10. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. // copies of the Software, and to permit persons to whom the Software is
  12. // furnished to do so, subject to the following conditions:
  13. //
  14. // The above copyright notice and this permission notice shall be included in
  15. // all copies or substantial portions of the Software.
  16. //
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. // THE SOFTWARE.
  24. #ifndef GLMDISPLAYDB_H
  25. #define GLMDISPLAYDB_H
  26. #include "tier1/utlvector.h"
  27. //===============================================================================
  28. // modes, displays, and renderers
  29. //===============================================================================
  30. // GLMDisplayModeInfoFields is in glmdisplay.h
  31. class GLMDisplayMode
  32. {
  33. public:
  34. GLMDisplayModeInfoFields m_info;
  35. GLMDisplayMode( uint width, uint height, uint refreshHz );
  36. GLMDisplayMode() { };
  37. ~GLMDisplayMode( void );
  38. void Init( uint width, uint height, uint refreshHz );
  39. void Dump( int which );
  40. };
  41. //===============================================================================
  42. // GLMDisplayInfoFields is in glmdisplay.h
  43. class GLMDisplayInfo
  44. {
  45. public:
  46. GLMDisplayInfoFields m_info;
  47. CUtlVector< GLMDisplayMode* > *m_modes; // starts out NULL, set by PopulateModes
  48. GLMDisplayMode m_DesktopMode;
  49. #ifdef OSX
  50. GLMDisplayInfo( CGDirectDisplayID displayID, CGOpenGLDisplayMask displayMask );
  51. #else
  52. GLMDisplayInfo( void );
  53. #endif
  54. ~GLMDisplayInfo( void );
  55. void PopulateModes( void );
  56. void Dump( int which );
  57. #ifdef OSX
  58. private:
  59. int m_display;
  60. #endif
  61. };
  62. //===============================================================================
  63. // GLMRendererInfoFields is in glmdisplay.h
  64. class GLMRendererInfo
  65. {
  66. public:
  67. GLMRendererInfoFields m_info;
  68. #ifdef OSX
  69. CUtlVector< GLMDisplayInfo* > *m_displays; // starts out NULL, set by PopulateDisplays
  70. #else
  71. GLMDisplayInfo *m_display;
  72. #endif
  73. #ifdef OSX
  74. GLMRendererInfo ( GLMRendererInfoFields *info );
  75. #else
  76. GLMRendererInfo ();
  77. #endif
  78. ~GLMRendererInfo ( void );
  79. #ifndef OSX
  80. void Init( GLMRendererInfoFields *info );
  81. #endif
  82. void PopulateDisplays();
  83. void Dump( int which );
  84. };
  85. //===============================================================================
  86. #ifdef OSX
  87. // this is just a tuple describing fake adapters which are really renderer/display pairings.
  88. // dxabstract bridges the gap between the d3d adapter-centric world and the GL renderer+display world.
  89. // this makes it straightforward to handle cases like two video cards with two displays on one, and one on the other -
  90. // you get three fake adapters which represent each useful screen.
  91. // the constraint that dxa will have to follow though, is that if the user wants to change their
  92. // display selection for full screen, they would only be able to pick on that has the same underlying renderer.
  93. // can't change fakeAdapter from one to another with different GL renderer under it. Screen hop but no card hop.
  94. struct GLMFakeAdapter
  95. {
  96. int m_rendererIndex;
  97. int m_displayIndex;
  98. };
  99. #endif
  100. class GLMDisplayDB
  101. {
  102. public:
  103. #ifdef OSX
  104. CUtlVector< GLMRendererInfo* > *m_renderers; // starts out NULL, set by PopulateRenderers
  105. CUtlVector< GLMFakeAdapter > m_fakeAdapters;
  106. #else
  107. GLMRendererInfo m_renderer;
  108. #endif
  109. GLMDisplayDB ( void );
  110. ~GLMDisplayDB ( void );
  111. virtual void PopulateRenderers( void );
  112. virtual void PopulateFakeAdapters( uint realRendererIndex ); // fake adapters = one real adapter times however many displays are on it
  113. virtual void Populate( void );
  114. // The info-get functions return false on success.
  115. virtual int GetFakeAdapterCount( void );
  116. virtual bool GetFakeAdapterInfo( int fakeAdapterIndex, int *rendererOut, int *displayOut, GLMRendererInfoFields *rendererInfoOut, GLMDisplayInfoFields *displayInfoOut );
  117. virtual int GetRendererCount( void );
  118. virtual bool GetRendererInfo( int rendererIndex, GLMRendererInfoFields *infoOut );
  119. virtual int GetDisplayCount( int rendererIndex );
  120. virtual bool GetDisplayInfo( int rendererIndex, int displayIndex, GLMDisplayInfoFields *infoOut );
  121. virtual int GetModeCount( int rendererIndex, int displayIndex );
  122. virtual bool GetModeInfo( int rendererIndex, int displayIndex, int modeIndex, GLMDisplayModeInfoFields *infoOut );
  123. virtual void Dump( void );
  124. };
  125. #endif // GLMDISPLAYDB_H