DxcPixBase.h 452 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include "dxc/Support/WinIncludes.h"
  3. namespace dxil_debug_info
  4. {
  5. template <typename T>
  6. T *Initialize(T *Obj)
  7. {
  8. if (Obj != nullptr)
  9. {
  10. Obj->AddRef();
  11. }
  12. return Obj;
  13. }
  14. template <typename T, typename O, typename... A>
  15. HRESULT NewDxcPixDxilDebugInfoObjectOrThrow(O **pOut, A... args)
  16. {
  17. if ((*pOut = Initialize(T::Alloc(args...))) == nullptr)
  18. {
  19. throw std::bad_alloc();
  20. }
  21. return S_OK;
  22. }
  23. } // namespace dxil_debug_info