aboutsummaryrefslogtreecommitdiff
path: root/dxcommon
diff options
context:
space:
mode:
Diffstat (limited to 'dxcommon')
-rw-r--r--dxcommon/CMakeLists.txt20
-rw-r--r--dxcommon/dxcommon.h17
-rw-r--r--dxcommon/dxcommon.ixx53
3 files changed, 0 insertions, 90 deletions
diff --git a/dxcommon/CMakeLists.txt b/dxcommon/CMakeLists.txt
deleted file mode 100644
index dfb52bf..0000000
--- a/dxcommon/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
1cmake_minimum_required(VERSION 3.25)
2
3project(dxcommon)
4
5add_library(dxcommon)
6
7target_sources(dxcommon PUBLIC
8 dxcommon.h)
9
10target_sources(dxcommon PUBLIC
11 FILE_SET cxx_modules TYPE CXX_MODULES FILES
12 dxcommon.ixx)
13
14target_include_directories(dxcommon PUBLIC
15 .)
16
17target_link_libraries(dxcommon PUBLIC
18 DirectX-Headers
19 D3D12.lib
20 DXGI.lib)
diff --git a/dxcommon/dxcommon.h b/dxcommon/dxcommon.h
deleted file mode 100644
index addb8c3..0000000
--- a/dxcommon/dxcommon.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#pragma once
2
3#include <d3d12.h>
4#include <dxgi1_4.h>
5#include <directx/d3dx12.h>
6
7#define THROW(error) throw exception(error, __FILE__, __LINE__)
8
9#define ThrowIfFailed(result) \
10{\
11 if (result != S_OK) \
12 {\
13 THROW(result);\
14 }\
15}
16
17//#define IID_PPV_ARGS(ppType) __uuidof(**(ppType)), static_cast<void**>(ppType)
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 @@
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