diff options
| author | Marc Sunet <marc.sunet@amd.com> | 2025-11-19 19:42:04 -0800 |
|---|---|---|
| committer | Marc Sunet <marc.sunet@amd.com> | 2025-11-19 19:42:04 -0800 |
| commit | b5697421bbc73ed17ef3a8bc003571d1b6351b5c (patch) | |
| tree | 655dd8d239e582c6d37609cea95e76a4e6ce24f2 /dxcommon/dxcommon.ixx | |
| parent | 0cca9d39108e0305d1e278feafa1ca737f436bc9 (diff) | |
Rename dxcommon -> dxg
Diffstat (limited to 'dxcommon/dxcommon.ixx')
| -rw-r--r-- | dxcommon/dxcommon.ixx | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/dxcommon/dxcommon.ixx b/dxcommon/dxcommon.ixx deleted file mode 100644 index b06ae95..0000000 --- a/dxcommon/dxcommon.ixx +++ /dev/null | |||
| @@ -1,53 +0,0 @@ | |||
| 1 | module; | ||
| 2 | |||
| 3 | #include <wrl.h> | ||
| 4 | #include <stdexcept> | ||
| 5 | |||
| 6 | export module dxcommon; | ||
| 7 | |||
| 8 | using Microsoft::WRL::ComPtr; | ||
| 9 | |||
| 10 | namespace dx { | ||
| 11 | |||
| 12 | export { | ||
| 13 | |||
| 14 | class exception : public std::exception | ||
| 15 | { | ||
| 16 | public: | ||
| 17 | exception() noexcept = default; | ||
| 18 | |||
| 19 | exception(HRESULT result, const char* file, int line) noexcept | ||
| 20 | { | ||
| 21 | sprintf_s(m_error, sizeof(m_error), "%s:%d Failed with HRESULT = %08X", | ||
| 22 | file, line, static_cast<unsigned int>(result)); | ||
| 23 | } | ||
| 24 | |||
| 25 | exception(const char* error, const char* file, int line) noexcept | ||
| 26 | { | ||
| 27 | sprintf_s(m_error, sizeof(m_error), "%s:%d %s", file, line, error); | ||
| 28 | } | ||
| 29 | |||
| 30 | [[nodiscard]] const char* what() const noexcept final | ||
| 31 | { | ||
| 32 | return m_error; | ||
| 33 | } | ||
| 34 | |||
| 35 | private: | ||
| 36 | static thread_local char m_error[1024]; | ||
| 37 | }; | ||
| 38 | |||
| 39 | template <typename T> | ||
| 40 | void SafeRelease(ComPtr<T>& ptr) | ||
| 41 | { | ||
| 42 | if (ptr) | ||
| 43 | { | ||
| 44 | ptr->Release(); | ||
| 45 | ptr = nullptr; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | } // export | ||
| 50 | |||
| 51 | thread_local char exception::m_error[1024]; | ||
| 52 | |||
| 53 | } // dx | ||
