1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00

d3d12: Pretty printing of error messages.

This commit is contained in:
Vincent Lejeune 2016-02-15 22:34:20 +01:00
parent a9180ce187
commit 4b54d7ece1

View File

@ -5,11 +5,24 @@
#include <wrl/client.h>
#include "Emu/Memory/vm.h"
#include "Emu/RSX/GCM.h"
#include <locale>
#include <comdef.h>
using namespace Microsoft::WRL;
#define CHECK_HRESULT(expr) { HRESULT hr = (expr); if (FAILED(hr)) throw EXCEPTION("HRESULT = 0x%x", hr); }
inline std::string get_hresult_message(HRESULT hr)
{
_com_error error(hr);
#ifndef UNICODE
return error.ErrorMessage();
#else
using convert_type = std::codecvt<wchar_t, char, mbstate_t>;
return std::wstring_convert<convert_type>().to_bytes(error.ErrorMessage());
#endif
}
#define CHECK_HRESULT(expr) { HRESULT hr = (expr); if (FAILED(hr)) throw EXCEPTION("HRESULT = %s", get_hresult_message(hr)); }
/**
* Send data to dst pointer without polluting cache.