pch.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #pragma once
  2. #pragma region std headers
  3. #include <array>
  4. #include <memory>
  5. #include <mutex>
  6. #pragma endregion
  7. #pragma region webrtc headers
  8. #include "rtc_base/logging.h"
  9. #ifdef _WIN32
  10. #include "rtc_base/win32.h"
  11. #include "rtc_base/win32_socket_init.h"
  12. #include "rtc_base/win32_socket_server.h"
  13. #endif
  14. #pragma endregion
  15. #pragma region Unity headers
  16. #include <IUnityGraphics.h>
  17. #include <IUnityProfiler.h>
  18. #include <IUnityRenderingExtensions.h>
  19. #pragma endregion
  20. #include "PlatformBase.h"
  21. #pragma region Platform headers
  22. #if UNITY_LINUX || UNITY_ANDROID
  23. #include <dlfcn.h>
  24. #endif
  25. #if UNITY_WIN
  26. #include <Windows.h>
  27. #endif
  28. #if CUDA_PLATFORM
  29. #include <cuda.h>
  30. #endif
  31. #if SUPPORT_D3D11 && SUPPORT_D3D12
  32. #include <comdef.h>
  33. #include <d3d11.h>
  34. #include <d3d11_4.h>
  35. #include <d3d12.h>
  36. #include <wrl/client.h>
  37. #include <cudaD3D11.h>
  38. #include <IUnityGraphicsD3D11.h>
  39. #include <IUnityGraphicsD3D12.h>
  40. #endif
  41. #if SUPPORT_OPENGL_CORE
  42. #include <X11/Xlib.h>
  43. #include <glad/gl.h>
  44. #include <glad/glx.h>
  45. #undef CurrentTime // Defined by X11/X.h
  46. #undef Status // Defined by X11/Xutil.h
  47. #endif
  48. // Android platform
  49. #if SUPPORT_OPENGL_ES
  50. #include <GLES/gl.h>
  51. #include <GLES/glext.h>
  52. #include <GLES3/gl32.h>
  53. #include <GLES3/gl3ext.h>
  54. #endif
  55. #if SUPPORT_METAL
  56. #import <Metal/Metal.h>
  57. #include <IUnityGraphicsMetal.h>
  58. #endif
  59. #if SUPPORT_VULKAN
  60. #include <vulkan/vulkan.h>
  61. #include <IUnityGraphicsVulkan.h>
  62. #include "GraphicsDevice/Vulkan/LoadVulkanFunctions.h"
  63. #if _WIN32
  64. #include <vulkan/vulkan_win32.h>
  65. #endif
  66. #endif
  67. #pragma endregion
  68. // #pragma clang diagnostic push
  69. // #pragma clang diagnostic ignored "-Wkeyword-macro"
  70. // #if _WIN32 && _DEBUG
  71. // #define _CRTDBG_MAP_ALLOC
  72. // #include <crtdbg.h>
  73. // #define new new (_NORMAL_BLOCK, __FILE__, __LINE__)
  74. // #endif
  75. // #pragma clang diagnostic pop
  76. // audio codec isac
  77. #define WEBRTC_USE_BUILTIN_ISAC_FLOAT 1
  78. namespace unity
  79. {
  80. namespace webrtc
  81. {
  82. void LogPrint(const char* fmt, ...);
  83. void LogPrint(const wchar_t* fmt, ...);
  84. void checkf(bool result, const char* msg);
  85. #define DebugLog(...) LogPrint("webrtc Log: " __VA_ARGS__)
  86. #define DebugWarning(...) LogPrint("webrtc Warning: " __VA_ARGS__)
  87. #define DebugError(...) LogPrint("webrtc Error: " __VA_ARGS__)
  88. #define DebugLogW(...) LogPrint(L"webrtc Log: " __VA_ARGS__)
  89. #define DebugWarningW(...) LogPrint(L"webrtc Warning: " __VA_ARGS__)
  90. #define DebugErrorW(...) LogPrint(L"webrtc Error: " __VA_ARGS__)
  91. #define NV_RESULT(NvFunction) NvFunction == NV_ENC_SUCCESS
  92. #if !UNITY_WIN
  93. #define CoTaskMemAlloc(p) malloc(p)
  94. #define CoTaskMemFree(p) free(p)
  95. #endif
  96. using byte = unsigned char;
  97. using uint8 = unsigned char;
  98. using uint16 = unsigned short int;
  99. using uint32 = unsigned int;
  100. using uint64 = unsigned long long;
  101. using int8 = signed char;
  102. using int16 = signed short int;
  103. using int32 = signed int;
  104. using int64 = signed long long;
  105. const uint32 bufferedFrameNum = 3;
  106. } // end namespace webrtc
  107. } // end namespace unity