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.

107 lines
3.3 KiB

  1. //============ Copyright (c) Valve Corporation, All rights reserved. ============
  2. //
  3. // glbase.h
  4. //
  5. //===============================================================================
  6. #ifndef GLBASE_H
  7. #define GLBASE_H
  8. #ifdef DX_TO_GL_ABSTRACTION
  9. #undef HAVE_GL_ARB_SYNC
  10. #ifndef OSX
  11. #define HAVE_GL_ARB_SYNC 1
  12. #endif
  13. #ifdef USE_SDL
  14. #include "SDL_opengl.h"
  15. #endif
  16. #ifdef OSX
  17. #include <OpenGL/CGLCurrent.h>
  18. #include <ApplicationServices/ApplicationServices.h>
  19. #elif defined(DX_TO_GL_ABSTRACTION)
  20. #include <GL/gl.h>
  21. #include <GL/glext.h>
  22. #else
  23. #error
  24. #endif
  25. #ifdef DX_TO_GL_ABSTRACTION
  26. #ifndef WIN32
  27. #define Debugger DebuggerBreak
  28. #endif
  29. #undef CurrentTime
  30. #if defined( USE_SDL )
  31. #include "SDL.h"
  32. #endif
  33. #endif
  34. //===============================================================================
  35. // glue to call out to Obj-C land (these are in glmgrcocoa.mm)
  36. #ifdef OSX
  37. typedef void _PseudoNSGLContext; // aka NSOpenGLContext
  38. typedef _PseudoNSGLContext *PseudoNSGLContextPtr;
  39. #define LIBGL_SONAME "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
  40. bool NewNSGLContext( unsigned long *attribs, PseudoNSGLContextPtr nsglShareCtx, PseudoNSGLContextPtr *nsglCtxOut, CGLContextObj *cglCtxOut );
  41. CGLContextObj GetCGLContextFromNSGL( PseudoNSGLContextPtr nsglCtx );
  42. void DelNSGLContext( PseudoNSGLContextPtr nsglCtx );
  43. #elif LINUX
  44. #define LIBGL_SONAME "libGL.so.1"
  45. #elif WIN32
  46. #define LIBGL_SONAME "OpenGL32.dll"
  47. #endif
  48. // Set TOGL_SUPPORT_NULL_DEVICE to 1 to support the NULL ref device
  49. #define TOGL_SUPPORT_NULL_DEVICE 0
  50. #if TOGL_SUPPORT_NULL_DEVICE
  51. #define TOGL_NULL_DEVICE_CHECK if( m_params.m_deviceType == D3DDEVTYPE_NULLREF ) return S_OK;
  52. #define TOGL_NULL_DEVICE_CHECK_RET_VOID if( m_params.m_deviceType == D3DDEVTYPE_NULLREF ) return;
  53. #else
  54. #define TOGL_NULL_DEVICE_CHECK
  55. #define TOGL_NULL_DEVICE_CHECK_RET_VOID
  56. #endif
  57. // GL_ENABLE_INDEX_VERIFICATION enables index range verification on all dynamic IB/VB's (obviously slow)
  58. #define GL_ENABLE_INDEX_VERIFICATION 0
  59. // 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.
  60. #define GL_ENABLE_UNLOCK_BUFFER_OVERWRITE_DETECTION 0
  61. #define GL_BATCH_TELEMETRY_ZONES 0
  62. // GL_BATCH_PERF_ANALYSIS - Enables gl_batch_vis, and various per-batch telemetry statistics messages.
  63. #define GL_BATCH_PERF_ANALYSIS 0
  64. #define GL_BATCH_PERF_ANALYSIS_WRITE_PNGS 0
  65. // GL_TELEMETRY_ZONES - Causes every single OpenGL call to generate a telemetry event
  66. #define GL_TELEMETRY_ZONES 0
  67. // GL_DUMP_ALL_API_CALLS - Causes a debug message to be printed for every API call if s_bDumpCalls bool is set to 1
  68. #define GL_DUMP_ALL_API_CALLS 0
  69. // Must also enable PIX_ENABLE to use GL_TELEMETRY_GPU_ZONES.
  70. #define GL_TELEMETRY_GPU_ZONES 0
  71. // Records global # of OpenGL calls/total cycles spent inside GL
  72. #define GL_TRACK_API_TIME GL_BATCH_PERF_ANALYSIS
  73. #define GL_USE_EXECUTE_HELPER_FOR_ALL_API_CALLS ( GL_TELEMETRY_ZONES || GL_TRACK_API_TIME || GL_DUMP_ALL_API_CALLS )
  74. #if GL_BATCH_PERF_ANALYSIS
  75. #define GL_BATCH_PERF(...) __VA_ARGS__
  76. #else
  77. #define GL_BATCH_PERF(...)
  78. #endif
  79. #define kGLMUserClipPlanes 2
  80. #define kGLMScratchFBOCount 4
  81. #endif // DX_TO_GL_ABSTRACTION
  82. #endif // GLBASE_H