GraphicsUtility.cpp 768 B

12345678910111213141516171819202122232425262728293031
  1. #include "pch.h"
  2. #include "GraphicsUtility.h"
  3. #if SUPPORT_VULKAN
  4. #include "Vulkan/VulkanGraphicsDevice.h"
  5. #endif
  6. namespace unity
  7. {
  8. namespace webrtc
  9. {
  10. namespace webrtc = ::webrtc;
  11. void* GraphicsUtility::TextureHandleToNativeGraphicsPtr(
  12. void* textureHandle, IGraphicsDevice* device, UnityGfxRenderer renderer)
  13. {
  14. #if SUPPORT_VULKAN
  15. if (renderer == kUnityGfxRendererVulkan)
  16. {
  17. VulkanGraphicsDevice* vulkanDevice = static_cast<VulkanGraphicsDevice*>(device);
  18. std::unique_ptr<UnityVulkanImage> unityVulkanImage = vulkanDevice->AccessTexture(textureHandle);
  19. return unityVulkanImage.release();
  20. }
  21. #endif
  22. return textureHandle;
  23. }
  24. } // end namespace webrtc
  25. } // end namespace unity