Update fmtlib

This commit is contained in:
Jack Andersen
2020-04-11 12:46:05 -10:00
parent de85119690
commit c36895a109
29 changed files with 300 additions and 301 deletions

View File

@@ -74,7 +74,7 @@ public:
#if _WIN32_WINNT_WIN10
if (!no12) {
if (!FindBestD3DCompile())
Log.report(logvisor::Fatal, fmt("unable to find D3DCompile_[43-47].dll"));
Log.report(logvisor::Fatal, FMT_STRING("unable to find D3DCompile_[43-47].dll"));
D3D12SerializeRootSignaturePROC = D3D12SerializeRootSignature;
@@ -84,7 +84,7 @@ public:
/* Obtain DXGI Factory */
HRESULT hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory2), &m_3dCtx.m_ctx12.m_dxFactory);
if (FAILED(hr))
Log.report(logvisor::Fatal, fmt("unable to create DXGI factory"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create DXGI factory"));
/* Adapter */
ComPtr<IDXGIAdapter1> ppAdapter;
@@ -109,26 +109,26 @@ public:
/* Establish loader objects */
if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateCommandAllocator(
D3D12_COMMAND_LIST_TYPE_DIRECT, __uuidof(ID3D12CommandAllocator), &m_3dCtx.m_ctx12.m_loadqalloc)))
Log.report(logvisor::Fatal, fmt("unable to create loader allocator"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create loader allocator"));
D3D12_COMMAND_QUEUE_DESC desc = {D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_NORMAL,
D3D12_COMMAND_QUEUE_FLAG_NONE};
if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateCommandQueue(&desc, __uuidof(ID3D12CommandQueue),
&m_3dCtx.m_ctx12.m_loadq)))
Log.report(logvisor::Fatal, fmt("unable to create loader queue"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create loader queue"));
if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, __uuidof(ID3D12Fence),
&m_3dCtx.m_ctx12.m_loadfence)))
Log.report(logvisor::Fatal, fmt("unable to create loader fence"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create loader fence"));
m_3dCtx.m_ctx12.m_loadfencehandle = CreateEvent(nullptr, FALSE, FALSE, nullptr);
if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateCommandList(
0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_3dCtx.m_ctx12.m_loadqalloc.Get(), nullptr,
__uuidof(ID3D12GraphicsCommandList), &m_3dCtx.m_ctx12.m_loadlist)))
Log.report(logvisor::Fatal, fmt("unable to create loader list"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create loader list"));
Log.report(logvisor::Info, fmt("initialized D3D12 renderer"));
Log.report(logvisor::Info, FMT_STRING("initialized D3D12 renderer"));
return;
} else {
/* Some Win10 client HW doesn't support D3D12 (despite being supposedly HW-agnostic) */
@@ -139,7 +139,7 @@ public:
#endif
{
if (!FindBestD3DCompile())
Log.report(logvisor::Fatal, fmt("unable to find D3DCompile_[43-47].dll"));
Log.report(logvisor::Fatal, FMT_STRING("unable to find D3DCompile_[43-47].dll"));
/* Create device proc */
PFN_D3D11_CREATE_DEVICE MyD3D11CreateDevice = D3D11CreateDevice;
@@ -150,7 +150,7 @@ public:
ComPtr<ID3D11DeviceContext> tempCtx;
if (FAILED(MyD3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, D3D11_CREATE_DEVICE_FLAGS, &level, 1,
D3D11_SDK_VERSION, &tempDev, nullptr, &tempCtx)))
Log.report(logvisor::Fatal, fmt("unable to create D3D11 device"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create D3D11 device"));
ComPtr<IDXGIDevice2> device;
if (FAILED(tempDev.As<ID3D11Device1>(&m_3dCtx.m_ctx11.m_dev)) || !m_3dCtx.m_ctx11.m_dev ||
@@ -176,11 +176,11 @@ public:
sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_BORDER;
m_3dCtx.m_ctx11.m_dev->CreateSamplerState(&sampDesc, &m_3dCtx.m_ctx11.m_ss[1]);
Log.report(logvisor::Info, fmt("initialized D3D11 renderer"));
Log.report(logvisor::Info, FMT_STRING("initialized D3D11 renderer"));
return;
}
Log.report(logvisor::Fatal, fmt("system doesn't support D3D11 or D3D12"));
Log.report(logvisor::Fatal, FMT_STRING("system doesn't support D3D11 or D3D12"));
}
EPlatformType getPlatformType() const override { return EPlatformType::UWP; }

View File

@@ -114,12 +114,12 @@ public:
HMODULE dxgilib = LoadLibraryW(L"dxgi.dll");
if (!dxgilib)
Log.report(logvisor::Fatal, fmt("unable to load dxgi.dll"));
Log.report(logvisor::Fatal, FMT_STRING("unable to load dxgi.dll"));
using CreateDXGIFactory1PROC = HRESULT(WINAPI*)(REFIID riid, _COM_Outptr_ void** ppFactory);
auto MyCreateDXGIFactory1 = (CreateDXGIFactory1PROC)GetProcAddress(dxgilib, "CreateDXGIFactory1");
if (!MyCreateDXGIFactory1)
Log.report(logvisor::Fatal, fmt("unable to find CreateDXGIFactory1 in DXGI.dll\n"));
Log.report(logvisor::Fatal, FMT_STRING("unable to find CreateDXGIFactory1 in DXGI.dll\n"));
bool noD3d = false;
#if BOO_HAS_VULKAN
@@ -167,15 +167,15 @@ public:
d3d11lib = LoadLibraryW(L"D3D11.dll");
if (d3d11lib) {
if (!FindBestD3DCompile())
Log.report(logvisor::Fatal, fmt("unable to find D3DCompile_[43-47].dll"));
Log.report(logvisor::Fatal, FMT_STRING("unable to find D3DCompile_[43-47].dll"));
if (!FindD3DPERF())
Log.report(logvisor::Fatal, fmt("unable to find d3d9.dll"));
Log.report(logvisor::Fatal, FMT_STRING("unable to find d3d9.dll"));
/* Create device proc */
PFN_D3D11_CREATE_DEVICE MyD3D11CreateDevice =
(PFN_D3D11_CREATE_DEVICE)GetProcAddress(d3d11lib, "D3D11CreateDevice");
if (!MyD3D11CreateDevice)
Log.report(logvisor::Fatal, fmt("unable to find D3D11CreateDevice in D3D11.dll"));
Log.report(logvisor::Fatal, FMT_STRING("unable to find D3D11CreateDevice in D3D11.dll"));
/* Create device */
D3D_FEATURE_LEVEL level = D3D_FEATURE_LEVEL_11_0;
@@ -183,7 +183,7 @@ public:
ComPtr<ID3D11DeviceContext> tempCtx;
if (FAILED(MyD3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, D3D11_CREATE_DEVICE_FLAGS, &level, 1,
D3D11_SDK_VERSION, &tempDev, nullptr, &tempCtx)))
Log.report(logvisor::Fatal, fmt("unable to create D3D11 device"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create D3D11 device"));
ComPtr<IDXGIDevice2> device;
if (FAILED(tempDev.As<ID3D11Device1>(&m_3dCtx.m_ctx11.m_dev)) || !m_3dCtx.m_ctx11.m_dev ||
@@ -234,7 +234,7 @@ public:
sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
m_3dCtx.m_ctx11.m_dev->CreateSamplerState(&sampDesc, &m_3dCtx.m_ctx11.m_ss[4]);
Log.report(logvisor::Info, fmt("initialized D3D11 renderer"));
Log.report(logvisor::Info, FMT_STRING("initialized D3D11 renderer"));
return;
}
@@ -252,9 +252,9 @@ public:
/* Obtain DXGI Factory */
HRESULT hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory1), &m_3dCtx.m_vulkanDxFactory);
if (FAILED(hr))
Log.report(logvisor::Fatal, fmt("unable to create DXGI factory"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create DXGI factory"));
Log.report(logvisor::Info, fmt("initialized Vulkan renderer"));
Log.report(logvisor::Info, FMT_STRING("initialized Vulkan renderer"));
return;
}
}
@@ -269,13 +269,13 @@ public:
/* Obtain DXGI Factory */
HRESULT hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory1), &m_3dCtx.m_ctxOgl.m_dxFactory);
if (FAILED(hr))
Log.report(logvisor::Fatal, fmt("unable to create DXGI factory"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create DXGI factory"));
Log.report(logvisor::Info, fmt("initialized OpenGL renderer"));
Log.report(logvisor::Info, FMT_STRING("initialized OpenGL renderer"));
return;
}
Log.report(logvisor::Fatal, fmt("system doesn't support Vulkan, D3D11, or OpenGL"));
Log.report(logvisor::Fatal, FMT_STRING("system doesn't support Vulkan, D3D11, or OpenGL"));
}
EPlatformType getPlatformType() const override { return EPlatformType::Win32; }
@@ -450,7 +450,7 @@ public:
if (GetCurrentThreadId() != g_mainThreadId) {
std::unique_lock<std::mutex> lk(g_nwmt);
if (!PostThreadMessageW(g_mainThreadId, WM_USER, WPARAM(&title), 0))
Log.report(logvisor::Fatal, fmt("PostThreadMessage error"));
Log.report(logvisor::Fatal, FMT_STRING("PostThreadMessage error"));
g_nwcv.wait(lk);
std::shared_ptr<IWindow> ret = std::move(m_mwret);
m_mwret.reset();

View File

@@ -81,7 +81,7 @@ public:
HRESULT hr =
b3dCtx.m_ctx12.m_dxFactory->CreateSwapChainForCoreWindow(cmdQueue, cw, &scDesc, nullptr, &m_swapChain);
if (FAILED(hr))
Log.report(logvisor::Fatal, fmt("unable to create swap chain"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create swap chain"));
m_swapChain.As<IDXGISwapChain3>(&w.m_swapChain);
ComPtr<ID3D12Resource> fb;
@@ -92,13 +92,13 @@ public:
w.height = resDesc.Height;
if (FAILED(m_swapChain->GetContainingOutput(&m_output)))
Log.report(logvisor::Fatal, fmt("unable to get DXGI output"));
Log.report(logvisor::Fatal, FMT_STRING("unable to get DXGI output"));
} else
#endif
{
if (FAILED(b3dCtx.m_ctx11.m_dxFactory->CreateSwapChainForCoreWindow(b3dCtx.m_ctx11.m_dev.Get(), cw, &scDesc,
nullptr, &m_swapChain)))
Log.report(logvisor::Fatal, fmt("unable to create swap chain"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create swap chain"));
auto insIt = b3dCtx.m_ctx11.m_windows.emplace(std::make_pair(parentWindow, D3D11Context::Window()));
D3D11Context::Window& w = insIt.first->second;
@@ -114,7 +114,7 @@ public:
m_commandQueue = _NewD3D11CommandQueue(&b3dCtx.m_ctx11, &insIt.first->second, this);
if (FAILED(m_swapChain->GetContainingOutput(&m_output)))
Log.report(logvisor::Fatal, fmt("unable to get DXGI output"));
Log.report(logvisor::Fatal, FMT_STRING("unable to get DXGI output"));
}
}

View File

@@ -76,7 +76,7 @@ public:
scDesc.Format = b3dCtx.m_ctx11.m_fbFormat;
if (FAILED(b3dCtx.m_ctx11.m_dxFactory->CreateSwapChainForHwnd(b3dCtx.m_ctx11.m_dev.Get(), hwnd, &scDesc, nullptr,
nullptr, &m_swapChain)))
Log.report(logvisor::Fatal, fmt("unable to create swap chain"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create swap chain"));
b3dCtx.m_ctx11.m_dxFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER);
auto insIt = b3dCtx.m_ctx11.m_windows.emplace(std::make_pair(parentWindow, D3D11Context::Window()));
@@ -88,7 +88,7 @@ public:
m_commandQueue->startRenderer();
if (FAILED(m_swapChain->GetContainingOutput(&m_output)))
Log.report(logvisor::Fatal, fmt("unable to get DXGI output"));
Log.report(logvisor::Fatal, FMT_STRING("unable to get DXGI output"));
}
~GraphicsContextWin32D3D() override { m_3dCtx.m_ctx11.m_windows.erase(m_parentWindow); }
@@ -154,14 +154,14 @@ public:
}
if (!m_output)
Log.report(logvisor::Fatal, fmt("unable to find window's IDXGIOutput"));
Log.report(logvisor::Fatal, FMT_STRING("unable to find window's IDXGIOutput"));
auto insIt = b3dCtx.m_ctxOgl.m_windows.emplace(std::make_pair(parentWindow, OGLContext::Window()));
OGLContext::Window& w = insIt.first->second;
w.m_hwnd = hwnd;
w.m_deviceContext = GetDC(hwnd);
if (!w.m_deviceContext)
Log.report(logvisor::Fatal, fmt("unable to create window's device context"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create window's device context"));
if (!m_3dCtx.m_ctxOgl.m_lastContext) {
PIXELFORMATDESCRIPTOR pfd = {sizeof(PIXELFORMATDESCRIPTOR),
@@ -198,7 +198,7 @@ public:
HGLRC tmpCtx = wglCreateContext(w.m_deviceContext);
wglMakeCurrent(w.m_deviceContext, tmpCtx);
if (glewInit() != GLEW_OK)
Log.report(logvisor::Fatal, fmt("glewInit failed"));
Log.report(logvisor::Fatal, FMT_STRING("glewInit failed"));
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
wglMakeCurrent(w.m_deviceContext, nullptr);
@@ -241,10 +241,10 @@ public:
// w.m_mainContext = wglCreateContext(w.m_deviceContext);
w.m_mainContext = wglCreateContextAttribsARB(w.m_deviceContext, 0, ContextAttribs);
if (!w.m_mainContext)
Log.report(logvisor::Fatal, fmt("unable to create window's main context"));
Log.report(logvisor::Fatal, FMT_STRING("unable to create window's main context"));
if (m_3dCtx.m_ctxOgl.m_lastContext)
if (!wglShareLists(w.m_mainContext, m_3dCtx.m_ctxOgl.m_lastContext))
Log.report(logvisor::Fatal, fmt("unable to share contexts"));
Log.report(logvisor::Fatal, FMT_STRING("unable to share contexts"));
m_3dCtx.m_ctxOgl.m_lastContext = w.m_mainContext;
m_dataFactory = _NewGLDataFactory(this, &b3dCtx.m_ctxOgl.m_glCtx);
@@ -271,13 +271,13 @@ public:
void makeCurrent() override {
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
// if (!wglMakeCurrent(w.m_deviceContext, w.m_mainContext))
// Log.report(logvisor::Fatal, fmt("unable to make WGL context current"));
// Log.report(logvisor::Fatal, FMT_STRING("unable to make WGL context current"));
w.m_renderContext = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
if (!w.m_renderContext)
Log.report(logvisor::Fatal, fmt("unable to make new WGL context"));
Log.report(logvisor::Fatal, FMT_STRING("unable to make new WGL context"));
if (!wglMakeCurrent(w.m_deviceContext, w.m_renderContext))
Log.report(logvisor::Fatal, fmt("unable to make WGL context current"));
Log.report(logvisor::Fatal, FMT_STRING("unable to make WGL context current"));
}
void postInit() override {
@@ -287,12 +287,12 @@ public:
// wglGetProcAddress("wglCreateContextAttribsARB");
// w.m_renderContext = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
// if (!w.m_renderContext)
// Log.report(logvisor::Fatal, fmt("unable to make new WGL context"));
// Log.report(logvisor::Fatal, FMT_STRING("unable to make new WGL context"));
// if (!wglMakeCurrent(w.m_deviceContext, w.m_renderContext))
// Log.report(logvisor::Fatal, fmt("unable to make WGL context current"));
// Log.report(logvisor::Fatal, FMT_STRING("unable to make WGL context current"));
if (!WGLEW_EXT_swap_control)
Log.report(logvisor::Fatal, fmt("WGL_EXT_swap_control not available"));
Log.report(logvisor::Fatal, FMT_STRING("WGL_EXT_swap_control not available"));
wglSwapIntervalEXT(1);
}
@@ -312,10 +312,10 @@ public:
if (!m_mainCtx) {
m_mainCtx = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
if (!m_mainCtx)
Log.report(logvisor::Fatal, fmt("unable to make main WGL context"));
Log.report(logvisor::Fatal, FMT_STRING("unable to make main WGL context"));
}
if (!wglMakeCurrent(w.m_deviceContext, m_mainCtx))
Log.report(logvisor::Fatal, fmt("unable to make main WGL context current"));
Log.report(logvisor::Fatal, FMT_STRING("unable to make main WGL context current"));
return m_dataFactory.get();
}
@@ -326,10 +326,10 @@ public:
if (!m_loadCtx) {
m_loadCtx = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
if (!m_loadCtx)
Log.report(logvisor::Fatal, fmt("unable to make load WGL context"));
Log.report(logvisor::Fatal, FMT_STRING("unable to make load WGL context"));
}
if (!wglMakeCurrent(w.m_deviceContext, m_loadCtx))
Log.report(logvisor::Fatal, fmt("unable to make load WGL context current"));
Log.report(logvisor::Fatal, FMT_STRING("unable to make load WGL context current"));
return m_dataFactory.get();
}
};
@@ -354,7 +354,7 @@ struct GraphicsContextWin32Vulkan : GraphicsContextWin32 {
return;
}
Log.report(logvisor::Fatal, fmt("{}\n"), res);
Log.report(logvisor::Fatal, FMT_STRING("{}\n"), res);
}
public:
@@ -388,7 +388,7 @@ public:
}
if (!m_output)
Log.report(logvisor::Fatal, fmt("unable to find window's IDXGIOutput"));
Log.report(logvisor::Fatal, FMT_STRING("unable to find window's IDXGIOutput"));
}
void destroy() {
@@ -458,18 +458,18 @@ public:
/* Generate error if could not find a queue that supports both a graphics
* and present */
if (m_ctx->m_graphicsQueueFamilyIndex == UINT32_MAX)
Log.report(logvisor::Fatal, fmt("Could not find a queue that supports both graphics and present"));
Log.report(logvisor::Fatal, FMT_STRING("Could not find a queue that supports both graphics and present"));
m_ctx->initDevice();
} else {
/* Subsequent window, verify present */
if (supportsPresent[m_ctx->m_graphicsQueueFamilyIndex] == VK_FALSE)
Log.report(logvisor::Fatal, fmt("subsequent surface doesn't support present"));
Log.report(logvisor::Fatal, FMT_STRING("subsequent surface doesn't support present"));
}
free(supportsPresent);
if (!vk::GetPhysicalDeviceWin32PresentationSupportKHR(m_ctx->m_gpus[0], m_ctx->m_graphicsQueueFamilyIndex)) {
Log.report(logvisor::Fatal, fmt("Win32 doesn't support vulkan present"));
Log.report(logvisor::Fatal, FMT_STRING("Win32 doesn't support vulkan present"));
return false;
}
@@ -502,10 +502,10 @@ public:
}
}
} else
Log.report(logvisor::Fatal, fmt("no surface formats available for Vulkan swapchain"));
Log.report(logvisor::Fatal, FMT_STRING("no surface formats available for Vulkan swapchain"));
if (m_format == VK_FORMAT_UNDEFINED)
Log.report(logvisor::Fatal, fmt("no UNORM formats available for Vulkan swapchain"));
Log.report(logvisor::Fatal, FMT_STRING("no UNORM formats available for Vulkan swapchain"));
m_ctx->initSwapChain(*m_windowCtx, m_surface, m_format, m_colorspace);
@@ -730,7 +730,7 @@ static HGLOBAL MakeUnicodeCRLF(const char* data, size_t sz) {
int32_t ch;
int chSz = utf8proc_iterate(reinterpret_cast<const uint8_t*>(data + i), -1, &ch);
if (chSz < 0)
Log.report(logvisor::Fatal, fmt("invalid UTF-8 char"));
Log.report(logvisor::Fatal, FMT_STRING("invalid UTF-8 char"));
if (ch <= 0xffff) {
if (ch == '\n' && lastCh != '\r')
retSz += 4;
@@ -989,7 +989,7 @@ public:
void _immSetOpenStatus(bool open) {
if (GetCurrentThreadId() != g_mainThreadId) {
if (!PostThreadMessageW(g_mainThreadId, WM_USER + 3, WPARAM(m_imc), LPARAM(open)))
Log.report(logvisor::Fatal, fmt("PostThreadMessage error"));
Log.report(logvisor::Fatal, FMT_STRING("PostThreadMessage error"));
return;
}
ImmSetOpenStatus(m_imc, open);
@@ -1004,7 +1004,7 @@ public:
if (GetCurrentThreadId() != g_mainThreadId) {
if (!PostThreadMessageW(g_mainThreadId, WM_USER + 4, WPARAM(m_imc), LPARAM(&m_cForm)))
Log.report(logvisor::Fatal, fmt("PostThreadMessage error"));
Log.report(logvisor::Fatal, FMT_STRING("PostThreadMessage error"));
return;
}
ImmSetCompositionWindow(m_imc, &m_cForm);