From 556cf073d61875368fe8511b75f5cb7db04ccb52 Mon Sep 17 00:00:00 2001 From: Marc Sunet Date: Wed, 19 Nov 2025 11:24:21 -0800 Subject: Use C++ modules --- dxcommon/include/dxcommon.h | 58 --------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 dxcommon/include/dxcommon.h (limited to 'dxcommon/include') diff --git a/dxcommon/include/dxcommon.h b/dxcommon/include/dxcommon.h deleted file mode 100644 index 35ec0e2..0000000 --- a/dxcommon/include/dxcommon.h +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#include - -#include - -//#define IID_PPV_ARGS(ppType) __uuidof(**(ppType)), static_cast(ppType) - -namespace dx { - -using Microsoft::WRL::ComPtr; - -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]; -}; - -#define THROW(error) throw exception(error, __FILE__, __LINE__) - -#define ThrowIfFailed(result) \ -{\ - if (result != S_OK) \ - {\ - THROW(result);\ - }\ -} - -template -void SafeRelease(ComPtr& ptr) -{ - if (ptr) - { - ptr->Release(); - ptr = nullptr; - } -} - -} // dx -- cgit v1.2.3