GraphicsDeviceTestBase.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #pragma once
  2. #include "gmock/gmock.h"
  3. #include "gtest/gtest.h"
  4. #include "IUnityGraphics.h"
  5. #include "IUnityRenderingExtensions.h"
  6. namespace unity
  7. {
  8. namespace webrtc
  9. {
  10. using std::tuple;
  11. using testing::Values;
  12. class IGraphicsDevice;
  13. class GraphicsDeviceContainer;
  14. class GraphicsDeviceTestBase
  15. : public testing::TestWithParam<tuple<UnityGfxRenderer, UnityRenderingExtTextureFormat>>
  16. {
  17. public:
  18. explicit GraphicsDeviceTestBase();
  19. virtual ~GraphicsDeviceTestBase();
  20. IGraphicsDevice* device();
  21. UnityRenderingExtTextureFormat format();
  22. private:
  23. UnityGfxRenderer m_unityGfxRenderer;
  24. UnityRenderingExtTextureFormat m_textureFormat;
  25. std::unique_ptr<GraphicsDeviceContainer> container_;
  26. IGraphicsDevice* device_;
  27. };
  28. static tuple<UnityGfxRenderer, UnityRenderingExtTextureFormat> VALUES_TEST_ENV[] = {
  29. #if SUPPORT_D3D11
  30. { kUnityGfxRendererD3D11, kUnityRenderingExtFormatB8G8R8A8_SRGB },
  31. { kUnityGfxRendererD3D11, kUnityRenderingExtFormatB8G8R8A8_UNorm },
  32. #endif // SUPPORT_D3D11
  33. #if SUPPORT_D3D12
  34. { kUnityGfxRendererD3D12, kUnityRenderingExtFormatB8G8R8A8_SRGB },
  35. { kUnityGfxRendererD3D12, kUnityRenderingExtFormatB8G8R8A8_UNorm },
  36. #endif // SUPPORT_D3D12
  37. #if SUPPORT_METAL
  38. { kUnityGfxRendererMetal, kUnityRenderingExtFormatB8G8R8A8_SRGB },
  39. { kUnityGfxRendererMetal, kUnityRenderingExtFormatB8G8R8A8_UNorm }
  40. #endif // SUPPORT_METAL
  41. // todo::(kazuki) windows support
  42. #if SUPPORT_OPENGL_UNIFIED & UNITY_LINUX
  43. { kUnityGfxRendererOpenGLCore, kUnityRenderingExtFormatB8G8R8A8_SRGB },
  44. { kUnityGfxRendererOpenGLCore, kUnityRenderingExtFormatB8G8R8A8_UNorm },
  45. #endif // SUPPORT_OPENGL_UNIFIED
  46. #if SUPPORT_OPENGL_ES
  47. { kUnityGfxRendererOpenGLES30, kUnityRenderingExtFormatB8G8R8A8_SRGB },
  48. { kUnityGfxRendererOpenGLES30, kUnityRenderingExtFormatB8G8R8A8_UNorm },
  49. #endif // SUPPORT_OPENGL_ES
  50. #if SUPPORT_VULKAN
  51. { kUnityGfxRendererVulkan, kUnityRenderingExtFormatB8G8R8A8_SRGB },
  52. { kUnityGfxRendererVulkan, kUnityRenderingExtFormatB8G8R8A8_UNorm },
  53. #endif // SUPPORT_VULKAN
  54. };
  55. } // end namespace webrtc
  56. } // end namespace unity