aboutsummaryrefslogtreecommitdiff
path: root/dxg/dxcommon.ixx
diff options
context:
space:
mode:
authorMarc Sunet <marc.sunet@amd.com>2025-11-21 09:41:06 -0800
committerMarc Sunet <marc.sunet@amd.com>2025-11-21 09:41:06 -0800
commit0b5491e0a2f1a9a4023e2c4eb171287bede41388 (patch)
treee82e93313f1fcfcc5622bae706aea9335dbc43ef /dxg/dxcommon.ixx
parentb5697421bbc73ed17ef3a8bc003571d1b6351b5c (diff)
Switch to plain C
Diffstat (limited to 'dxg/dxcommon.ixx')
-rw-r--r--dxg/dxcommon.ixx53
1 files changed, 0 insertions, 53 deletions
diff --git a/dxg/dxcommon.ixx b/dxg/dxcommon.ixx
deleted file mode 100644
index b06ae95..0000000
--- a/dxg/dxcommon.ixx
+++ /dev/null
@@ -1,53 +0,0 @@
1module;
2
3#include <wrl.h>
4#include <stdexcept>
5
6export module dxcommon;
7
8using Microsoft::WRL::ComPtr;
9
10namespace dx {
11
12export {
13
14class exception : public std::exception
15{
16public:
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
35private:
36 static thread_local char m_error[1024];
37};
38
39template <typename T>
40void SafeRelease(ComPtr<T>& ptr)
41{
42 if (ptr)
43 {
44 ptr->Release();
45 ptr = nullptr;
46 }
47}
48
49} // export
50
51thread_local char exception::m_error[1024];
52
53} // dx