IncludeVK.h 891 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2025 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Jolt/Core/StringTools.h>
  6. #ifdef JPH_USE_VK
  7. JPH_SUPPRESS_WARNINGS_STD_BEGIN
  8. JPH_CLANG_SUPPRESS_WARNING("-Wc++98-compat-pedantic")
  9. #include <vulkan/vulkan.h>
  10. JPH_SUPPRESS_WARNINGS_STD_END
  11. JPH_NAMESPACE_BEGIN
  12. inline bool VKFailed(VkResult inResult)
  13. {
  14. if (inResult == VK_SUCCESS)
  15. return false;
  16. Trace("Vulkan call failed with error code: %d", (int)inResult);
  17. JPH_ASSERT(false);
  18. return true;
  19. }
  20. template <class Result>
  21. inline bool VKFailed(VkResult inResult, Result &outResult)
  22. {
  23. if (inResult == VK_SUCCESS)
  24. return false;
  25. String error = StringFormat("Vulkan call failed with error code: %d", (int)inResult);
  26. outResult.SetError(error);
  27. JPH_ASSERT(false);
  28. return true;
  29. }
  30. JPH_NAMESPACE_END
  31. #endif // JPH_USE_VK