IncludeDX12.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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/IncludeWindows.h>
  6. #include <Jolt/Core/StringTools.h>
  7. JPH_SUPPRESS_WARNINGS_STD_BEGIN
  8. JPH_MSVC_SUPPRESS_WARNING(4265) // 'X': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly
  9. JPH_MSVC_SUPPRESS_WARNING(4625) // 'X': copy constructor was implicitly defined as deleted
  10. JPH_MSVC_SUPPRESS_WARNING(4626) // 'X': assignment operator was implicitly defined as deleted
  11. JPH_MSVC_SUPPRESS_WARNING(5204) // 'X': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
  12. JPH_MSVC_SUPPRESS_WARNING(5220) // 'X': a non-static data member with a volatile qualified type no longer implies
  13. JPH_MSVC2026_PLUS_SUPPRESS_WARNING(4865) // wingdi.h(2806,1): '<unnamed-enum-DISPLAYCONFIG_OUTPUT_TECHNOLOGY_OTHER>': the underlying type will change from 'int' to '__int64' when '/Zc:enumTypes' is specified on the command line
  14. #include <d3d12.h>
  15. #include <dxgi1_6.h>
  16. #include <dxgidebug.h>
  17. #include <wrl.h>
  18. JPH_SUPPRESS_WARNINGS_STD_END
  19. JPH_NAMESPACE_BEGIN
  20. using Microsoft::WRL::ComPtr;
  21. template <class Result>
  22. inline bool HRFailed(HRESULT inHR, Result &outResult)
  23. {
  24. if (SUCCEEDED(inHR))
  25. return false;
  26. String error = StringFormat("Call failed with error code: %08X", inHR);
  27. outResult.SetError(error);
  28. JPH_ASSERT(false);
  29. return true;
  30. }
  31. inline bool HRFailed(HRESULT inHR)
  32. {
  33. if (SUCCEEDED(inHR))
  34. return false;
  35. Trace("Call failed with error code: %08X", inHR);
  36. JPH_ASSERT(false);
  37. return true;
  38. }
  39. JPH_NAMESPACE_END