Use UTF-8 exclusively internally; update logvisor

This commit is contained in:
2021-06-22 17:21:21 -04:00
parent 542191fd70
commit 4265e9d801
28 changed files with 238 additions and 240 deletions

View File

@@ -16,6 +16,7 @@
#include <comdef.h>
#include <logvisor/logvisor.hpp>
#include <nowide/convert.hpp>
#undef min
#undef max
@@ -76,8 +77,8 @@ static inline void ThrowIfFailed(HRESULT hr) {
#else
_com_error err(hr, L"D3D11 fail");
#endif
LPCTSTR errMsg = err.ErrorMessage();
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{}")), errMsg);
std::string errMsg = nowide::narrow(err.ErrorMessage());
Log.report(logvisor::Fatal, FMT_STRING("{}"), errMsg);
}
}
@@ -972,7 +973,7 @@ struct D3D11ShaderDataBinding : public GraphicsDataNode<IShaderDataBinding> {
struct D3D11CommandQueue final : IGraphicsCommandQueue {
Platform platform() const override { return IGraphicsDataFactory::Platform::D3D11; }
const SystemChar* platformName() const override { return _SYS_STR("D3D11"); }
const char* platformName() const override { return "D3D11"; }
D3D11Context* m_ctx;
D3D11Context::Window* m_windowCtx;
IGraphicsContext* m_parent;
@@ -1228,7 +1229,7 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
#ifdef BOO_GRAPHICS_DEBUG_GROUPS
void pushDebugGroup(const char* name, const std::array<float, 4>& color) override {
if (m_deferredAnnot)
m_deferredAnnot->BeginEvent(MBSTWCS(name).c_str());
m_deferredAnnot->BeginEvent(nowide::widen(name).c_str());
}
void popDebugGroup() override {

View File

@@ -130,7 +130,7 @@ public:
GLDataFactoryImpl(IGraphicsContext* parent, GLContext* glCtx) : m_parent(parent), m_glCtx(glCtx) {}
Platform platform() const override { return Platform::OpenGL; }
const SystemChar* platformName() const override { return _SYS_STR("OpenGL"); }
const char* platformName() const override { return "OpenGL"; }
void commitTransaction(const FactoryCommitFunc& trans __BooTraceArgs) override;
ObjToken<IGraphicsBufferD> newPoolBuffer(BufferUse use, size_t stride, size_t count __BooTraceArgs) override;
@@ -1166,7 +1166,7 @@ constexpr std::array<GLenum, 11> SEMANTIC_TYPE_TABLE{
struct GLCommandQueue final : IGraphicsCommandQueue {
Platform platform() const override { return IGraphicsDataFactory::Platform::OpenGL; }
const SystemChar* platformName() const override { return _SYS_STR("OpenGL"); }
const char* platformName() const override { return "OpenGL"; }
IGraphicsContext* m_parent = nullptr;
GLContext* m_glCtx = nullptr;
@@ -1357,11 +1357,7 @@ struct GLCommandQueue final : IGraphicsCommandQueue {
static void RenderingWorker(GLCommandQueue* self) {
BOO_MSAN_NO_INTERCEPT
#if _WIN32
std::string thrName = WCSTMBS(APP->getFriendlyName().data()) + " Render";
#else
std::string thrName = std::string(APP->getFriendlyName()) + " Render";
#endif
logvisor::RegisterThreadName(thrName.c_str());
GLDataFactoryImpl* dataFactory = static_cast<GLDataFactoryImpl*>(self->m_parent->getDataFactory());
{
@@ -1497,7 +1493,7 @@ struct GLCommandQueue final : IGraphicsCommandQueue {
case Command::Op::DrawIndexed:
if (cmd.baseVertex > 0) {
Log.report(logvisor::Fatal,
FMT_STRING(_SYS_STR("Attempted to render with baseVertex > 0 (currently unsupported in GL)")));
FMT_STRING("Attempted to render with baseVertex > 0 (currently unsupported in GL)"));
}
glDrawElements(currentPrim, cmd.count, GL_UNSIGNED_INT, reinterpret_cast<void*>(cmd.start * 4));
break;

View File

@@ -127,7 +127,7 @@ public:
~VulkanDataFactoryImpl() { assert(m_descPoolHead == nullptr && "Dangling descriptor pools detected"); }
Platform platform() const { return Platform::Vulkan; }
const SystemChar* platformName() const { return _SYS_STR("Vulkan"); }
const char* platformName() const { return "Vulkan"; }
boo::ObjToken<VulkanDescriptorPool> allocateDescriptorSets(VkDescriptorSet* out);
@@ -2860,7 +2860,7 @@ struct VulkanShaderDataBinding : GraphicsDataNode<IShaderDataBinding> {
struct VulkanCommandQueue final : IGraphicsCommandQueue {
Platform platform() const { return IGraphicsDataFactory::Platform::Vulkan; }
const SystemChar* platformName() const { return _SYS_STR("Vulkan"); }
const char* platformName() const { return "Vulkan"; }
VulkanContext* m_ctx;
VulkanContext::Window* m_windowCtx;
IGraphicsContext* m_parent;