2#include <Core/Common/NuiWin.h>
3#include <Core/Common/Types.h>
4#include <Core/Utils/Exceptions.h>
5#include <Core/Math/Math.h>
8#include <d3d11sdklayers.h>
13#include <d3dcompiler.h>
14#include <d3d11shader.h>
15#include <DirectXColors.h>
19#pragma comment(lib, "d3d11.lib")
20#pragma comment(lib, "d3d9.lib")
21#pragma comment(lib, "dxgi.lib")
22#pragma comment(lib, "dxguid.lib")
23#pragma comment(lib, "D3DCompiler.lib")
26namespace Nui::Graphics
29 using ComPtr = Microsoft::WRL::ComPtr<T>;
35 com_exception(HRESULT hr, StringView expression, StringView file, U32 line)
41 const char* what()
const noexcept override
43 static char s_str[512] = {};
44 sprintf_s(s_str,
"DXCall caught an exception\nMessage: %s\nExpression: %s\nFile: %s(%u)",
45 GetWin32ErrorString(m_result).c_str(), m_expression.c_str(), m_file.c_str(), m_line);
57 inline void ThrowIfFailed(HRESULT hr, StringView expression, StringView file, U32 line)
66 void SafeReleaseCOM(T** ptr)
76 HRESULT SetDebugName(T deviceChild,
const String& debugName)
79 return deviceChild->SetPrivateData(WKPDID_D3DDebugObjectName, (U32)debugName.size(), debugName.data());
86#define DXCall(expr) ThrowIfFailed(expr, #expr, __FILE__, __LINE__)
88#define Float4Align __declspec(align(16))