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.

117 lines
4.0 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. //
  25. // glbase.h
  26. //
  27. //===============================================================================
  28. #ifndef GLBASE_H
  29. #define GLBASE_H
  30. #ifdef DX_TO_GL_ABSTRACTION
  31. #undef HAVE_GL_ARB_SYNC
  32. #ifndef OSX
  33. #define HAVE_GL_ARB_SYNC 1
  34. #endif
  35. #ifdef USE_SDL
  36. #include "SDL_opengl.h"
  37. #endif
  38. #ifdef OSX
  39. #include <OpenGL/CGLCurrent.h>
  40. #include <ApplicationServices/ApplicationServices.h>
  41. #endif
  42. #ifdef DX_TO_GL_ABSTRACTION
  43. #ifndef WIN32
  44. #define Debugger DebuggerBreak
  45. #endif
  46. #undef CurrentTime
  47. #if defined( USE_SDL )
  48. #include "SDL.h"
  49. #endif
  50. #endif
  51. //===============================================================================
  52. // glue to call out to Obj-C land (these are in glmgrcocoa.mm)
  53. #ifdef OSX
  54. typedef void _PseudoNSGLContext; // aka NSOpenGLContext
  55. typedef _PseudoNSGLContext *PseudoNSGLContextPtr;
  56. CGLContextObj GetCGLContextFromNSGL( PseudoNSGLContextPtr nsglCtx );
  57. #endif
  58. // Set TOGL_SUPPORT_NULL_DEVICE to 1 to support the NULL ref device
  59. #define TOGL_SUPPORT_NULL_DEVICE 0
  60. #if TOGL_SUPPORT_NULL_DEVICE
  61. #define TOGL_NULL_DEVICE_CHECK if( m_params.m_deviceType == D3DDEVTYPE_NULLREF ) return S_OK;
  62. #define TOGL_NULL_DEVICE_CHECK_RET_VOID if( m_params.m_deviceType == D3DDEVTYPE_NULLREF ) return;
  63. #else
  64. #define TOGL_NULL_DEVICE_CHECK
  65. #define TOGL_NULL_DEVICE_CHECK_RET_VOID
  66. #endif
  67. // GL_ENABLE_INDEX_VERIFICATION enables index range verification on all dynamic IB/VB's (obviously slow)
  68. #define GL_ENABLE_INDEX_VERIFICATION 0
  69. // GL_ENABLE_UNLOCK_BUFFER_OVERWRITE_DETECTION (currently win32 only) - If 1, VirtualAlloc/VirtualProtect is used to detect cases where the app locks a buffer, copies the ptr away, unlocks, then tries to later write to the buffer.
  70. #define GL_ENABLE_UNLOCK_BUFFER_OVERWRITE_DETECTION 0
  71. #define GL_BATCH_TELEMETRY_ZONES 0
  72. // GL_BATCH_PERF_ANALYSIS - Enables gl_batch_vis, and various per-batch telemetry statistics messages.
  73. #define GL_BATCH_PERF_ANALYSIS 0
  74. #define GL_BATCH_PERF_ANALYSIS_WRITE_PNGS 0
  75. // GL_TELEMETRY_ZONES - Causes every single OpenGL call to generate a telemetry event
  76. #define GL_TELEMETRY_ZONES 0
  77. // GL_DUMP_ALL_API_CALLS - Causes a debug message to be printed for every API call if s_bDumpCalls bool is set to 1
  78. #define GL_DUMP_ALL_API_CALLS 0
  79. // Must also enable PIX_ENABLE to use GL_TELEMETRY_GPU_ZONES.
  80. #define GL_TELEMETRY_GPU_ZONES 0
  81. // Records global # of OpenGL calls/total cycles spent inside GL
  82. #define GL_TRACK_API_TIME GL_BATCH_PERF_ANALYSIS
  83. #define GL_USE_EXECUTE_HELPER_FOR_ALL_API_CALLS ( GL_TELEMETRY_ZONES || GL_TRACK_API_TIME || GL_DUMP_ALL_API_CALLS )
  84. #if GL_BATCH_PERF_ANALYSIS
  85. #define GL_BATCH_PERF(...) __VA_ARGS__
  86. #else
  87. #define GL_BATCH_PERF(...)
  88. #endif
  89. #define kGLMUserClipPlanes 2
  90. #define kGLMScratchFBOCount 4
  91. #endif // DX_TO_GL_ABSTRACTION
  92. #endif // GLBASE_H