From 0b5491e0a2f1a9a4023e2c4eb171287bede41388 Mon Sep 17 00:00:00 2001 From: Marc Sunet Date: Fri, 21 Nov 2025 09:41:06 -0800 Subject: Switch to plain C --- dxg/dxcommon.ixx | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 dxg/dxcommon.ixx (limited to 'dxg/dxcommon.ixx') 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 @@ -module; - -#include -#include - -export module dxcommon; - -using Microsoft::WRL::ComPtr; - -namespace dx { - -export { - -class exception : public std::exception -{ -public: - exception() noexcept = default; - - exception(HRESULT result, const char* file, int line) noexcept - { - sprintf_s(m_error, sizeof(m_error), "%s:%d Failed with HRESULT = %08X", - file, line, static_cast(result)); - } - - exception(const char* error, const char* file, int line) noexcept - { - sprintf_s(m_error, sizeof(m_error), "%s:%d %s", file, line, error); - } - - [[nodiscard]] const char* what() const noexcept final - { - return m_error; - } - -private: - static thread_local char m_error[1024]; -}; - -template -void SafeRelease(ComPtr& ptr) -{ - if (ptr) - { - ptr->Release(); - ptr = nullptr; - } -} - -} // export - -thread_local char exception::m_error[1024]; - -} // dx -- cgit v1.2.3