2
0

GrManagerImplSdl.cpp 812 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include <AnKi/Gr/Vulkan/GrManagerImpl.h>
  6. #include <AnKi/Gr/GrManager.h>
  7. #include <AnKi/Core/NativeWindow.h>
  8. #include <AnKi/Core/NativeWindowSdl.h>
  9. #include <SDL_syswm.h>
  10. #include <SDL_vulkan.h>
  11. // Because some idiot includes Windows.h
  12. #if defined(ERROR)
  13. # undef ERROR
  14. #endif
  15. namespace anki {
  16. Error GrManagerImpl::initSurface(const GrManagerInitInfo& init)
  17. {
  18. if(!SDL_Vulkan_CreateSurface(static_cast<NativeWindowSdl*>(init.m_window)->m_window, m_instance, &m_surface))
  19. {
  20. ANKI_VK_LOGE("SDL_Vulkan_CreateSurface() failed: %s", SDL_GetError());
  21. return Error::FUNCTION_FAILED;
  22. }
  23. return Error::NONE;
  24. }
  25. } // end namespace anki