From c36895a109b37df558ba3a14cf054a2b30008bec Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 11 Apr 2020 12:46:05 -1000 Subject: [PATCH] Update fmtlib --- include/boo/System.hpp | 1 - lib/audiodev/AQS.cpp | 44 ++++++++++----------- lib/audiodev/AudioVoice.cpp | 6 +-- lib/audiodev/LinuxMidi.hpp | 6 +-- lib/audiodev/PulseAudio.cpp | 18 ++++----- lib/audiodev/WASAPI.cpp | 36 ++++++++--------- lib/graphicsdev/D3D11.cpp | 22 +++++------ lib/graphicsdev/GL.cpp | 50 +++++++++++------------ lib/graphicsdev/GLX.cpp | 4 +- lib/graphicsdev/Metal.mm | 18 ++++----- lib/graphicsdev/Vulkan.cpp | 66 +++++++++++++++---------------- lib/graphicsdev/nx/NX.cpp | 56 +++++++++++++------------- lib/inputdev/DeviceFinder.cpp | 2 +- lib/inputdev/HIDDeviceIOKit.cpp | 24 +++++------ lib/inputdev/HIDDeviceUdev.cpp | 10 ++--- lib/inputdev/HIDDeviceWinUSB.cpp | 16 ++++---- lib/inputdev/HIDListenerIOKit.cpp | 16 ++++---- lib/inputdev/HIDListenerUdev.cpp | 4 +- lib/mac/ApplicationCocoa.mm | 4 +- lib/mac/WindowCocoa.mm | 12 +++--- lib/nx/ApplicationNX.cpp | 2 +- lib/win/ApplicationUWP.cpp | 22 +++++------ lib/win/ApplicationWin32.cpp | 26 ++++++------ lib/win/WindowUWP.cpp | 8 ++-- lib/win/WindowWin32.cpp | 54 ++++++++++++------------- lib/x11/ApplicationUnix.cpp | 12 +++--- lib/x11/ApplicationXlib.hpp | 16 ++++---- lib/x11/WindowXlib.cpp | 44 ++++++++++----------- logvisor | 2 +- 29 files changed, 300 insertions(+), 301 deletions(-) diff --git a/include/boo/System.hpp b/include/boo/System.hpp index 7e03e10..91d5289 100644 --- a/include/boo/System.hpp +++ b/include/boo/System.hpp @@ -24,7 +24,6 @@ static inline ComPtr* ReferenceComPtr(ComPtr& ptr) { #define FMT_STRING_ALIAS 1 #define FMT_ENFORCE_COMPILE_STRING 1 -#define FMT_USE_GRISU 0 #include #ifndef ENABLE_BITWISE_ENUM diff --git a/lib/audiodev/AQS.cpp b/lib/audiodev/AQS.cpp index c187cd4..8e535a6 100644 --- a/lib/audiodev/AQS.cpp +++ b/lib/audiodev/AQS.cpp @@ -73,7 +73,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { argSize = sizeof(devId); if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, sizeof(devName), &devName, &argSize, &devId) != noErr) { - Log.report(logvisor::Error, fmt("unable to resolve audio device UID {}, using default"), + Log.report(logvisor::Error, FMT_STRING("unable to resolve audio device UID {}, using default"), CFStringGetCStringPtr(devName, kCFStringEncodingUTF8)); argSize = sizeof(devId); propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice; @@ -83,7 +83,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { deviceAddress.mSelector = kAudioDevicePropertyDeviceUID; AudioObjectGetPropertyData(devId, &deviceAddress, 0, nullptr, &argSize, &m_devName); } else { - Log.report(logvisor::Fatal, fmt("unable determine default audio device")); + Log.report(logvisor::Fatal, FMT_STRING("unable determine default audio device")); return {AudioChannelSet::Unknown, 48000.0}; } } @@ -249,7 +249,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { if (!(nameCstr = CFStringGetCStringPtr(namestr.get(), kCFStringEncodingUTF8))) continue; - ret.push_back(std::make_pair(fmt::format(fmt("{:08X}"), idNum), std::string(nameCstr))); + ret.push_back(std::make_pair(fmt::format(FMT_STRING("{:08X}"), idNum), std::string(nameCstr))); } return ret; @@ -268,7 +268,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { if (MIDIObjectGetIntegerProperty(dev, kMIDIPropertyUniqueID, &idNum)) continue; - if (fmt::format(fmt("{:08X}"), idNum) != name) + if (fmt::format(FMT_STRING("{:08X}"), idNum) != name) continue; return dev; @@ -462,9 +462,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { std::string name; auto appName = APP->getFriendlyName(); if (!m_midiInCounter) - name = fmt::format(fmt("{} MIDI-In"), appName); + name = fmt::format(FMT_STRING("{} MIDI-In"), appName); else - name = fmt::format(fmt("{} MIDI-In {}"), appName, m_midiInCounter); + name = fmt::format(FMT_STRING("{} MIDI-In {}"), appName, m_midiInCounter); m_midiInCounter++; CFPointer midiName = CFPointer::adopt( CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); @@ -487,9 +487,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { std::string name; auto appName = APP->getFriendlyName(); if (!m_midiOutCounter) - name = fmt::format(fmt("{} MIDI-Out"), appName); + name = fmt::format(FMT_STRING("{} MIDI-Out"), appName); else - name = fmt::format(fmt("{} MIDI-Out {}"), appName, m_midiOutCounter); + name = fmt::format(FMT_STRING("{} MIDI-Out {}"), appName, m_midiOutCounter); m_midiOutCounter++; CFPointer midiName = CFPointer::adopt( CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); @@ -510,9 +510,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { std::string name; auto appName = APP->getFriendlyName(); if (!m_midiInCounter) - name = fmt::format(fmt("{} MIDI-In"), appName); + name = fmt::format(FMT_STRING("{} MIDI-In"), appName); else - name = fmt::format(fmt("{} MIDI-In {}"), appName, m_midiInCounter); + name = fmt::format(FMT_STRING("{} MIDI-In {}"), appName, m_midiInCounter); m_midiInCounter++; CFPointer midiName = CFPointer::adopt( CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); @@ -524,9 +524,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { return {}; if (!m_midiOutCounter) - name = fmt::format(fmt("{} MIDI-Out"), appName); + name = fmt::format(FMT_STRING("{} MIDI-Out"), appName); else - name = fmt::format(fmt("{} MIDI-Out {}"), appName, m_midiOutCounter); + name = fmt::format(FMT_STRING("{} MIDI-Out {}"), appName, m_midiOutCounter); m_midiOutCounter++; midiName = CFPointer::adopt( CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); @@ -548,7 +548,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { if (!ret) return {}; - std::string mname = fmt::format(fmt("Boo MIDI Real In {}"), m_midiInCounter++); + std::string mname = fmt::format(FMT_STRING("Boo MIDI Real In {}"), m_midiInCounter++); CFPointer midiName = CFPointer::adopt( CFStringCreateWithCStringNoCopy(nullptr, mname.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); if (MIDIInputPortCreate(m_midiClient, midiName.get(), MIDIReadProc(MIDIReceiveProc), @@ -572,7 +572,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { if (!ret) return {}; - std::string mname = fmt::format(fmt("Boo MIDI Real Out {}"), m_midiOutCounter++); + std::string mname = fmt::format(FMT_STRING("Boo MIDI Real Out {}"), m_midiOutCounter++); CFPointer midiName = CFPointer::adopt( CFStringCreateWithCStringNoCopy(nullptr, mname.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); if (MIDIOutputPortCreate(m_midiClient, midiName.get(), &static_cast(*ret).m_midiPort)) @@ -599,7 +599,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { if (!ret) return {}; - std::string mname = fmt::format(fmt("Boo MIDI Real In {}"), m_midiInCounter++); + std::string mname = fmt::format(FMT_STRING("Boo MIDI Real In {}"), m_midiInCounter++); CFPointer midiName = CFPointer::adopt( CFStringCreateWithCStringNoCopy(nullptr, mname.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); if (MIDIInputPortCreate(m_midiClient, midiName.get(), MIDIReadProc(MIDIReceiveProc), @@ -611,7 +611,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { if (!ret) return {}; - mname = fmt::format(fmt("Boo MIDI Real Out {}"), m_midiOutCounter++); + mname = fmt::format(FMT_STRING("Boo MIDI Real Out {}"), m_midiOutCounter++); midiName = CFPointer::adopt( CFStringCreateWithCStringNoCopy(nullptr, mname.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); if (MIDIOutputPortCreate(m_midiClient, midiName.get(), &static_cast(*ret).m_midiPortOut)) @@ -653,13 +653,13 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { OSStatus err; if ((err = AudioQueueNewOutput(&desc, AudioQueueOutputCallback(Callback), this, CFRunLoopGetCurrent(), m_runLoopMode.get(), 0, &m_queue))) { - Log.report(logvisor::Fatal, fmt("unable to create output audio queue")); + Log.report(logvisor::Fatal, FMT_STRING("unable to create output audio queue")); return; } CFStringRef devName = m_devName.get(); if ((err = AudioQueueSetProperty(m_queue, kAudioQueueProperty_CurrentDevice, &devName, sizeof(devName)))) { - Log.report(logvisor::Fatal, fmt("unable to set current device into audio queue")); + Log.report(logvisor::Fatal, FMT_STRING("unable to set current device into audio queue")); return; } @@ -677,7 +677,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { AudioChannelLayout layout; UInt32 layoutSz = sizeof(layout); if (AudioQueueGetProperty(m_queue, kAudioQueueProperty_ChannelLayout, &layout, &layoutSz)) { - Log.report(logvisor::Warning, fmt("unable to get channel layout from audio queue; using count's default")); + Log.report(logvisor::Warning, FMT_STRING("unable to get channel layout from audio queue; using count's default")); switch (m_mixInfo.m_channels) { case AudioChannelSet::Stereo: default: @@ -758,7 +758,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { chMapOut.m_channels[4] = AudioChannel::FrontCenter; break; default: - Log.report(logvisor::Warning, fmt("unknown channel layout {}; using stereo"), layout.mChannelLayoutTag); + Log.report(logvisor::Warning, FMT_STRING("unknown channel layout {}; using stereo"), layout.mChannelLayoutTag); chMapOut.m_channelCount = 2; chMapOut.m_channels[0] = AudioChannel::FrontLeft; chMapOut.m_channels[1] = AudioChannel::FrontRight; @@ -776,7 +776,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { m_mixInfo.m_periodFrames = m_5msFrames; for (int i = 0; i < AQS_NUM_BUFFERS; ++i) if (AudioQueueAllocateBuffer(m_queue, m_mixInfo.m_periodFrames * chCount * 4, &m_buffers[i])) { - Log.report(logvisor::Fatal, fmt("unable to create audio queue buffer")); + Log.report(logvisor::Fatal, FMT_STRING("unable to create audio queue buffer")); AudioQueueDispose(m_queue, false); m_queue = nullptr; return; @@ -826,7 +826,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine { deviceAddress.mSelector = kAudioDevicePropertyDeviceUID; AudioObjectGetPropertyData(defaultDeviceId, &deviceAddress, 0, nullptr, &argSize, &m_devName); } else { - Log.report(logvisor::Fatal, fmt("unable determine default audio device")); + Log.report(logvisor::Fatal, FMT_STRING("unable determine default audio device")); return; } diff --git a/lib/audiodev/AudioVoice.cpp b/lib/audiodev/AudioVoice.cpp index d9c6eef..d1a43ab 100644 --- a/lib/audiodev/AudioVoice.cpp +++ b/lib/audiodev/AudioVoice.cpp @@ -24,7 +24,7 @@ void AudioVoice::_setPitchRatio(double ratio, bool slew) { m_sampleRatio = ratio * m_sampleRateIn / m_sampleRateOut; soxr_error_t err = soxr_set_io_ratio(m_src, m_sampleRatio, slew ? m_head->m_5msFrames : 0); if (err) { - Log.report(logvisor::Fatal, fmt("unable to set resampler rate: {}"), soxr_strerror(err)); + Log.report(logvisor::Fatal, FMT_STRING("unable to set resampler rate: {}"), soxr_strerror(err)); m_setPitchRatio = false; return; } @@ -71,7 +71,7 @@ void AudioVoiceMono::_resetSampleRate(double sampleRate) { m_src = soxr_create(sampleRate, rateOut, 1, &err, &ioSpec, &qSpec, nullptr); if (err) { - Log.report(logvisor::Fatal, fmt("unable to create soxr resampler: {}"), soxr_strerror(err)); + Log.report(logvisor::Fatal, FMT_STRING("unable to create soxr resampler: {}"), soxr_strerror(err)); m_resetSampleRate = false; return; } @@ -192,7 +192,7 @@ void AudioVoiceStereo::_resetSampleRate(double sampleRate) { m_src = soxr_create(sampleRate, rateOut, 2, &err, &ioSpec, &qSpec, nullptr); if (!m_src) { - Log.report(logvisor::Fatal, fmt("unable to create soxr resampler: {}"), soxr_strerror(err)); + Log.report(logvisor::Fatal, FMT_STRING("unable to create soxr resampler: {}"), soxr_strerror(err)); m_resetSampleRate = false; return; } diff --git a/lib/audiodev/LinuxMidi.hpp b/lib/audiodev/LinuxMidi.hpp index 15332b4..d949686 100644 --- a/lib/audiodev/LinuxMidi.hpp +++ b/lib/audiodev/LinuxMidi.hpp @@ -49,7 +49,7 @@ struct LinuxMidi : BaseAudioVoiceEngine { snd_ctl_t* ctl; int device = -1; int status; - std::string name = fmt::format(fmt("hw:{}"), card); + std::string name = fmt::format(FMT_STRING("hw:{}"), card); if ((status = snd_ctl_open(&ctl, name.c_str(), 0)) < 0) continue; @@ -58,7 +58,7 @@ struct LinuxMidi : BaseAudioVoiceEngine { if (status < 0) break; if (device >= 0) { - name += fmt::format(fmt(",{}"), device); + name += fmt::format(FMT_STRING(",{}"), device); auto search = m_openHandles.find(name); if (search != m_openHandles.cend()) { ret.push_back(std::make_pair(name, search->second->description())); @@ -103,7 +103,7 @@ struct LinuxMidi : BaseAudioVoiceEngine { int rdBytes = snd_rawmidi_read(midi, buf, 512); if (rdBytes < 0) { if (rdBytes != -EINTR) { - ALSALog.report(logvisor::Error, fmt("MIDI connection lost")); + ALSALog.report(logvisor::Error, FMT_STRING("MIDI connection lost")); break; } continue; diff --git a/lib/audiodev/PulseAudio.cpp b/lib/audiodev/PulseAudio.cpp index 4033f5e..1be55f4 100644 --- a/lib/audiodev/PulseAudio.cpp +++ b/lib/audiodev/PulseAudio.cpp @@ -69,7 +69,7 @@ struct PulseAudioVoiceEngine : LinuxMidi { pa_operation_unref(op); if (m_sampleSpec.format == PA_SAMPLE_INVALID) { - Log.report(logvisor::Error, fmt("Unable to setup audio stream")); + Log.report(logvisor::Error, FMT_STRING("Unable to setup audio stream")); goto err; } @@ -80,7 +80,7 @@ struct PulseAudioVoiceEngine : LinuxMidi { m_mixInfo.m_bitsPerSample = 32; m_mixInfo.m_periodFrames = m_5msFrames; if (!(m_stream = pa_stream_new(m_ctx, "master", &m_sampleSpec, &m_chanMap))) { - Log.report(logvisor::Error, fmt("Unable to pa_stream_new(): {}"), pa_strerror(pa_context_errno(m_ctx))); + Log.report(logvisor::Error, FMT_STRING("Unable to pa_stream_new(): {}"), pa_strerror(pa_context_errno(m_ctx))); goto err; } @@ -94,7 +94,7 @@ struct PulseAudioVoiceEngine : LinuxMidi { if (pa_stream_connect_playback(m_stream, m_sinkName.c_str(), &bufAttr, pa_stream_flags_t(PA_STREAM_START_UNMUTED | PA_STREAM_EARLY_REQUESTS), nullptr, nullptr)) { - Log.report(logvisor::Error, fmt("Unable to pa_stream_connect_playback()")); + Log.report(logvisor::Error, FMT_STRING("Unable to pa_stream_connect_playback()")); goto err; } @@ -115,16 +115,16 @@ struct PulseAudioVoiceEngine : LinuxMidi { PulseAudioVoiceEngine() { if (!(m_mainloop = pa_mainloop_new())) { - Log.report(logvisor::Error, fmt("Unable to pa_mainloop_new()")); + Log.report(logvisor::Error, FMT_STRING("Unable to pa_mainloop_new()")); return; } pa_mainloop_api* mlApi = pa_mainloop_get_api(m_mainloop); pa_proplist* propList = pa_proplist_new(); pa_proplist_sets(propList, PA_PROP_APPLICATION_ICON_NAME, APP->getUniqueName().data()); - pa_proplist_sets(propList, PA_PROP_APPLICATION_PROCESS_ID, fmt::format(fmt("{}"), int(getpid())).c_str()); + pa_proplist_sets(propList, PA_PROP_APPLICATION_PROCESS_ID, fmt::format(FMT_STRING("{}"), int(getpid())).c_str()); if (!(m_ctx = pa_context_new_with_proplist(mlApi, APP->getFriendlyName().data(), propList))) { - Log.report(logvisor::Error, fmt("Unable to pa_context_new_with_proplist()")); + Log.report(logvisor::Error, FMT_STRING("Unable to pa_context_new_with_proplist()")); pa_mainloop_free(m_mainloop); m_mainloop = nullptr; return; @@ -133,7 +133,7 @@ struct PulseAudioVoiceEngine : LinuxMidi { pa_operation* op; if (pa_context_connect(m_ctx, nullptr, PA_CONTEXT_NOFLAGS, nullptr)) { - Log.report(logvisor::Error, fmt("Unable to pa_context_connect()")); + Log.report(logvisor::Error, FMT_STRING("Unable to pa_context_connect()")); goto err; } @@ -340,7 +340,7 @@ struct PulseAudioVoiceEngine : LinuxMidi { size_t nbytes = writablePeriods * periodSz; if (pa_stream_begin_write(m_stream, &data, &nbytes)) { pa_stream_state_t st = pa_stream_get_state(m_stream); - Log.report(logvisor::Error, fmt("Unable to pa_stream_begin_write(): {} {}"), pa_strerror(pa_context_errno(m_ctx)), st); + Log.report(logvisor::Error, FMT_STRING("Unable to pa_stream_begin_write(): {} {}"), pa_strerror(pa_context_errno(m_ctx)), st); _doIterate(); return; } @@ -349,7 +349,7 @@ struct PulseAudioVoiceEngine : LinuxMidi { _pumpAndMixVoices(m_mixInfo.m_periodFrames * writablePeriods, reinterpret_cast(data)); if (pa_stream_write(m_stream, data, nbytes, nullptr, 0, PA_SEEK_RELATIVE)) - Log.report(logvisor::Error, fmt("Unable to pa_stream_write()")); + Log.report(logvisor::Error, FMT_STRING("Unable to pa_stream_write()")); _doIterate(); } diff --git a/lib/audiodev/WASAPI.cpp b/lib/audiodev/WASAPI.cpp index 6468b28..2af5f15 100644 --- a/lib/audiodev/WASAPI.cpp +++ b/lib/audiodev/WASAPI.cpp @@ -121,14 +121,14 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { #if !WINDOWS_STORE if (!m_device) { if (FAILED(m_enumerator->GetDevice(MBSTWCS(m_sinkName.c_str()).c_str(), &m_device))) { - Log.report(logvisor::Error, fmt("unable to obtain audio device {}"), m_sinkName); + Log.report(logvisor::Error, FMT_STRING("unable to obtain audio device {}"), m_sinkName); m_device.Reset(); return; } } if (FAILED(m_device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, &m_audClient))) { - Log.report(logvisor::Error, fmt(L"unable to create audio client from device")); + Log.report(logvisor::Error, FMT_STRING(L"unable to create audio client from device")); m_device.Reset(); return; } @@ -136,7 +136,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { WAVEFORMATEXTENSIBLE* pwfx; if (FAILED(m_audClient->GetMixFormat((WAVEFORMATEX**)&pwfx))) { - Log.report(logvisor::Error, fmt(L"unable to obtain audio mix format from device")); + Log.report(logvisor::Error, FMT_STRING(L"unable to obtain audio mix format from device")); #if !WINDOWS_STORE m_device.Reset(); #endif @@ -204,7 +204,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { chMapOut.m_channels[7] = AudioChannel::SideRight; break; default: - Log.report(logvisor::Warning, fmt("unknown channel layout {}; using stereo"), pwfx->Format.nChannels); + Log.report(logvisor::Warning, FMT_STRING("unknown channel layout {}; using stereo"), pwfx->Format.nChannels); chMapOut.m_channelCount = 2; chMapOut.m_channels[0] = AudioChannel::FrontLeft; chMapOut.m_channels[1] = AudioChannel::FrontRight; @@ -214,7 +214,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { /* Initialize audio client */ if (FAILED(m_audClient->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, 450000, /* 45ms */ 0, (WAVEFORMATEX*)pwfx, nullptr))) { - Log.report(logvisor::Error, fmt(L"unable to initialize audio client")); + Log.report(logvisor::Error, FMT_STRING(L"unable to initialize audio client")); #if !WINDOWS_STORE m_device.Reset(); #endif @@ -235,7 +235,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { m_mixInfo.m_sampleFormat = SOXR_INT32_I; m_mixInfo.m_bitsPerSample = 32; } else { - Log.report(logvisor::Fatal, fmt(L"unsupported bits-per-sample {}"), pwfx->Format.wBitsPerSample); + Log.report(logvisor::Fatal, FMT_STRING(L"unsupported bits-per-sample {}"), pwfx->Format.wBitsPerSample); #if !WINDOWS_STORE m_device.Reset(); #endif @@ -248,7 +248,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { m_mixInfo.m_sampleFormat = SOXR_FLOAT32_I; m_mixInfo.m_bitsPerSample = 32; } else { - Log.report(logvisor::Error, fmt(L"unsupported floating-point bits-per-sample {}"), pwfx->Format.wBitsPerSample); + Log.report(logvisor::Error, FMT_STRING(L"unsupported floating-point bits-per-sample {}"), pwfx->Format.wBitsPerSample); #if !WINDOWS_STORE m_device.Reset(); #endif @@ -260,7 +260,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { UINT32 bufferFrameCount; if (FAILED(m_audClient->GetBufferSize(&bufferFrameCount))) { - Log.report(logvisor::Error, fmt(L"unable to get audio buffer frame count")); + Log.report(logvisor::Error, FMT_STRING(L"unable to get audio buffer frame count")); #if !WINDOWS_STORE m_device.Reset(); #endif @@ -269,7 +269,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { m_mixInfo.m_periodFrames = bufferFrameCount; if (FAILED(m_audClient->GetService(IID_IAudioRenderClient, &m_renderClient))) { - Log.report(logvisor::Error, fmt(L"unable to create audio render client")); + Log.report(logvisor::Error, FMT_STRING(L"unable to create audio render client")); #if !WINDOWS_STORE m_device.Reset(); #endif @@ -346,18 +346,18 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { /* Enumerate default audio device */ if (FAILED( CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, &m_enumerator))) { - Log.report(logvisor::Error, fmt(L"unable to create MMDeviceEnumerator instance")); + Log.report(logvisor::Error, FMT_STRING(L"unable to create MMDeviceEnumerator instance")); return; } if (FAILED(m_enumerator->RegisterEndpointNotificationCallback(&m_notificationClient))) { - Log.report(logvisor::Error, fmt(L"unable to register multimedia event callback")); + Log.report(logvisor::Error, FMT_STRING(L"unable to register multimedia event callback")); m_device.Reset(); return; } if (FAILED(m_enumerator->GetDefaultAudioEndpoint(eRender, eConsole, &m_device))) { - Log.report(logvisor::Error, fmt(L"unable to obtain default audio device")); + Log.report(logvisor::Error, FMT_STRING(L"unable to obtain default audio device")); m_device.Reset(); return; } @@ -385,7 +385,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { m_started = false; if (m_mixInfo.m_sampleFormat != oldFmt) - Log.report(logvisor::Fatal, fmt(L"audio device sample format changed, boo doesn't support this!!")); + Log.report(logvisor::Fatal, FMT_STRING(L"audio device sample format changed, boo doesn't support this!!")); _resetSampleRate(); } @@ -402,7 +402,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { int attempt = 0; while (true) { if (attempt >= 10) - Log.report(logvisor::Fatal, fmt(L"unable to setup AudioRenderClient")); + Log.report(logvisor::Fatal, FMT_STRING(L"unable to setup AudioRenderClient")); if (m_rebuild) { m_device.Reset(); @@ -472,7 +472,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { bool setCurrentAudioOutput(const char* name) override { ComPtr newDevice; if (FAILED(m_enumerator->GetDevice(MBSTWCS(name).c_str(), &newDevice))) { - Log.report(logvisor::Error, fmt("unable to obtain audio device {}"), name); + Log.report(logvisor::Error, FMT_STRING("unable to obtain audio device {}"), name); return false; } m_device = newDevice; @@ -486,7 +486,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { ComPtr collection; if (FAILED(m_enumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &collection))) { - Log.report(logvisor::Error, fmt(L"unable to enumerate audio outputs")); + Log.report(logvisor::Error, FMT_STRING(L"unable to enumerate audio outputs")); return ret; } @@ -518,7 +518,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { ret.reserve(numInDevices); for (UINT i = 0; i < numInDevices; ++i) { - std::string name = fmt::format(fmt("in{}"), i); + std::string name = fmt::format(FMT_STRING("in{}"), i); MIDIINCAPS caps; if (FAILED(midiInGetDevCaps(i, &caps, sizeof(caps)))) @@ -534,7 +534,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine { #if 0 for (UINT i=0 ; i { pxTilePitch = 4; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } const CD3D11_TEXTURE2D_DESC desc(pfmt, width, height, 1, mips, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_IMMUTABLE); @@ -250,7 +250,7 @@ class D3D11TextureSA : public GraphicsDataNode { pixelFmt = DXGI_FORMAT_R16_UNORM; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } CD3D11_TEXTURE2D_DESC desc(pixelFmt, width, height, layers, mips, D3D11_BIND_SHADER_RESOURCE, @@ -312,7 +312,7 @@ class D3D11TextureD : public GraphicsDataNode { m_pxPitch = 2; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } m_cpuSz = width * height * m_pxPitch; @@ -400,10 +400,10 @@ class D3D11TextureR : public GraphicsDataNode { , m_colorBindCount(colorBindCount) , m_depthBindCount(depthBindCount) { if (colorBindCount > m_colorBindTex.size()) { - Log.report(logvisor::Fatal, fmt("too many color bindings for render texture")); + Log.report(logvisor::Fatal, FMT_STRING("too many color bindings for render texture")); } if (depthBindCount > m_depthBindTex.size()) { - Log.report(logvisor::Fatal, fmt("too many depth bindings for render texture")); + Log.report(logvisor::Fatal, FMT_STRING("too many depth bindings for render texture")); } if (samples == 0) { @@ -790,7 +790,7 @@ struct D3D11ShaderDataBinding : public GraphicsDataNode { for (size_t i = 0; i < ubufCount; ++i) { #ifndef NDEBUG if (ubufOffs[i] % 256) { - Log.report(logvisor::Fatal, fmt("non-256-byte-aligned uniform-offset {} provided to newShaderDataBinding"), + Log.report(logvisor::Fatal, FMT_STRING("non-256-byte-aligned uniform-offset {} provided to newShaderDataBinding"), i); } #endif @@ -801,7 +801,7 @@ struct D3D11ShaderDataBinding : public GraphicsDataNode { for (size_t i = 0; i < ubufCount; ++i) { #ifndef NDEBUG if (!ubufs[i]) { - Log.report(logvisor::Fatal, fmt("null uniform-buffer {} provided to newShaderDataBinding"), i); + Log.report(logvisor::Fatal, FMT_STRING("null uniform-buffer {} provided to newShaderDataBinding"), i); } #endif m_ubufs.push_back(ubufs[i]); @@ -1535,7 +1535,7 @@ void D3D11CommandQueue::RenderingWorker(D3D11CommandQueue* self) { if (D3D11TextureR* csource = CmdList.workDoPresent.cast()) { #ifndef NDEBUG if (!csource->m_colorBindCount) - Log.report(logvisor::Fatal, fmt("texture provided to resolveDisplay() must have at least 1 color binding")); + Log.report(logvisor::Fatal, FMT_STRING("texture provided to resolveDisplay() must have at least 1 color binding")); #endif if (dataFactory->m_gamma != 1.f) { @@ -1654,8 +1654,8 @@ std::vector D3D11DataFactory::CompileHLSL(const char* source, PipelineS ComPtr blobOut; if (FAILED(D3DCompilePROC(source, strlen(source), "Boo HLSL Source", nullptr, nullptr, "main", D3DShaderTypes[int(stage)], BOO_D3DCOMPILE_FLAG, 0, &blobOut, &errBlob))) { - fmt::print(fmt("{}\n"), source); - Log.report(logvisor::Fatal, fmt("error compiling shader: {}"), errBlob->GetBufferPointer()); + fmt::print(FMT_STRING("{}\n"), source); + Log.report(logvisor::Fatal, FMT_STRING("error compiling shader: {}"), errBlob->GetBufferPointer()); return {}; } std::vector ret(blobOut->GetBufferSize()); diff --git a/lib/graphicsdev/GL.cpp b/lib/graphicsdev/GL.cpp index 3d1d1b8..31cbf6a 100644 --- a/lib/graphicsdev/GL.cpp +++ b/lib/graphicsdev/GL.cpp @@ -79,7 +79,7 @@ class GLDataFactoryImpl final : public GLDataFactory, public GraphicsDataFactory void SetupGammaResources() { /* Good enough place for this */ if (!glslang::InitializeProcess()) - Log.report(logvisor::Error, fmt("unable to initialize glslang")); + Log.report(logvisor::Error, FMT_STRING("unable to initialize glslang")); if (GLEW_ARB_tessellation_shader) { m_hasTessellation = true; @@ -346,7 +346,7 @@ class GLTextureS : public GraphicsDataNode { pxPitch = 1; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } if (compressed) { @@ -430,7 +430,7 @@ class GLTextureSA : public GraphicsDataNode { pxPitch = 2; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } GLenum compType = intFormat == GL_R16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE; @@ -493,7 +493,7 @@ class GLTextureD : public GraphicsDataNode { pxPitch = 2; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } m_cpuSz = width * height * pxPitch; m_cpuBuf.reset(new uint8_t[m_cpuSz]); @@ -752,15 +752,15 @@ class GLShaderStage : public GraphicsDataNode { glslang::TShader shader(lang); shader.setStrings(&source, 1); if (!shader.parse(&glslang::DefaultTBuiltInResource, 110, false, messages)) { - fmt::print(fmt("{}\n"), source); - Log.report(logvisor::Fatal, fmt("unable to compile shader\n{}"), shader.getInfoLog()); + fmt::print(FMT_STRING("{}\n"), source); + Log.report(logvisor::Fatal, FMT_STRING("unable to compile shader\n{}"), shader.getInfoLog()); } glslang::TProgram prog; prog.addShader(&shader); if (!prog.link(messages)) { - fmt::print(fmt("{}\n"), source); - Log.report(logvisor::Fatal, fmt("unable to link shader program\n{}"), prog.getInfoLog()); + fmt::print(FMT_STRING("{}\n"), source); + Log.report(logvisor::Fatal, FMT_STRING("unable to link shader program\n{}"), prog.getInfoLog()); } prog.buildReflection(); @@ -771,7 +771,7 @@ class GLShaderStage : public GraphicsDataNode { continue; const auto& qual = tp->getQualifier(); if (!qual.hasBinding()) - Log.report(logvisor::Fatal, fmt("shader uniform {} does not have layout binding"), prog.getUniformName(i)); + Log.report(logvisor::Fatal, FMT_STRING("shader uniform {} does not have layout binding"), prog.getUniformName(i)); m_texNames.emplace_back(std::make_pair(prog.getUniformName(i), qual.layoutBinding - BOO_GLSL_MAX_UNIFORM_COUNT)); } count = prog.getNumLiveUniformBlocks(); @@ -780,7 +780,7 @@ class GLShaderStage : public GraphicsDataNode { const glslang::TType* tp = prog.getUniformBlockTType(i); const auto& qual = tp->getQualifier(); if (!qual.hasBinding()) - Log.report(logvisor::Fatal, fmt("shader uniform {} does not have layout binding"), prog.getUniformBlockName(i)); + Log.report(logvisor::Fatal, FMT_STRING("shader uniform {} does not have layout binding"), prog.getUniformBlockName(i)); m_blockNames.emplace_back(std::make_pair(prog.getUniformBlockName(i), qual.layoutBinding)); } } @@ -791,7 +791,7 @@ class GLShaderStage : public GraphicsDataNode { m_shad = glCreateShader(SHADER_STAGE_TABLE[int(stage)]); if (!m_shad) { - Log.report(logvisor::Fatal, fmt("unable to create shader")); + Log.report(logvisor::Fatal, FMT_STRING("unable to create shader")); return; } @@ -804,7 +804,7 @@ class GLShaderStage : public GraphicsDataNode { glGetShaderiv(m_shad, GL_INFO_LOG_LENGTH, &logLen); std::unique_ptr log(new char[logLen]); glGetShaderInfoLog(m_shad, logLen, nullptr, log.get()); - Log.report(logvisor::Fatal, fmt("unable to compile source\n{}\n{}\n"), log.get(), source); + Log.report(logvisor::Fatal, FMT_STRING("unable to compile source\n{}\n{}\n"), log.get(), source); return; } } @@ -895,7 +895,7 @@ public: if (!m_prog) { m_prog = glCreateProgram(); if (!m_prog) { - Log.report(logvisor::Error, fmt("unable to create shader program")); + Log.report(logvisor::Error, FMT_STRING("unable to create shader program")); return 0; } @@ -930,7 +930,7 @@ public: glGetProgramiv(m_prog, GL_INFO_LOG_LENGTH, &logLen); std::unique_ptr log(new char[logLen]); glGetProgramInfoLog(m_prog, logLen, nullptr, log.get()); - Log.report(logvisor::Fatal, fmt("unable to link shader program\n{}\n"), log.get()); + Log.report(logvisor::Fatal, FMT_STRING("unable to link shader program\n{}\n"), log.get()); return 0; } @@ -941,14 +941,14 @@ public: for (const auto& name : stage->getBlockNames()) { GLint uniLoc = glGetUniformBlockIndex(m_prog, name.first.c_str()); // if (uniLoc < 0) { - // Log.report(logvisor::Warning, fmt("unable to find uniform block '{}'"), uniformBlockNames[i]); + // Log.report(logvisor::Warning, FMT_STRING("unable to find uniform block '{}'"), uniformBlockNames[i]); // } m_uniLocs[name.second] = uniLoc; } for (const auto& name : stage->getTexNames()) { GLint texLoc = glGetUniformLocation(m_prog, name.first.c_str()); if (texLoc < 0) { - // Log.report(logvisor::Warning, fmt("unable to find sampler variable '{}'"), texNames[i]); + // Log.report(logvisor::Warning, FMT_STRING("unable to find sampler variable '{}'"), texNames[i]); } else { glUniform1i(texLoc, name.second); } @@ -1020,7 +1020,7 @@ ObjToken GLDataFactory::Context::newShaderStage(const uint8_t* dat if (stage == PipelineStage::Control || stage == PipelineStage::Evaluation) { if (!factory.m_hasTessellation) - Log.report(logvisor::Fatal, fmt("Device does not support tessellation shaders")); + Log.report(logvisor::Fatal, FMT_STRING("Device does not support tessellation shaders")); } BOO_MSAN_NO_INTERCEPT @@ -1035,9 +1035,9 @@ ObjToken GLDataFactory::Context::newShaderPipeline( if (control || evaluation) { if (!factory.m_hasTessellation) - Log.report(logvisor::Fatal, fmt("Device does not support tessellation shaders")); + Log.report(logvisor::Fatal, FMT_STRING("Device does not support tessellation shaders")); if (additionalInfo.patchSize > factory.m_maxPatchSize) - Log.report(logvisor::Fatal, fmt("Device supports {} patch vertices, {} requested"), int(factory.m_maxPatchSize), + Log.report(logvisor::Fatal, FMT_STRING("Device supports {} patch vertices, {} requested"), int(factory.m_maxPatchSize), int(additionalInfo.patchSize)); } @@ -1367,7 +1367,7 @@ struct GLCommandQueue final : IGraphicsCommandQueue { std::unique_lock lk(self->m_initmt); self->m_parent->makeCurrent(); const GLubyte* version = glGetString(GL_VERSION); - Log.report(logvisor::Info, fmt("OpenGL Version: {}"), version); + Log.report(logvisor::Info, FMT_STRING("OpenGL Version: {}"), version); self->m_parent->postInit(); glClearColor(0.f, 0.f, 0.f, 0.f); if (GLEW_EXT_texture_filter_anisotropic) { @@ -1561,7 +1561,7 @@ struct GLCommandQueue final : IGraphicsCommandQueue { if (const GLTextureR* tex = cmd.source.cast()) { #ifndef NDEBUG if (!tex->m_colorBindCount) - Log.report(logvisor::Fatal, fmt("texture provided to resolveDisplay() must have at least 1 color binding")); + Log.report(logvisor::Fatal, FMT_STRING("texture provided to resolveDisplay() must have at least 1 color binding")); #endif if (dataFactory->m_gamma != 1.f) { glBindFramebuffer(GL_READ_FRAMEBUFFER, tex->m_fbo); @@ -1897,13 +1897,13 @@ GLTextureR::GLTextureR(const ObjToken& parent, GLCommandQueue* glGenTextures(GLsizei(m_texs.size()), m_texs.data()); if (colorBindingCount) { if (colorBindingCount > MAX_BIND_TEXS) { - Log.report(logvisor::Fatal, fmt("too many color bindings for render texture")); + Log.report(logvisor::Fatal, FMT_STRING("too many color bindings for render texture")); } glGenTextures(colorBindingCount, m_bindTexs[0].data()); } if (depthBindingCount) { if (depthBindingCount > MAX_BIND_TEXS) { - Log.report(logvisor::Fatal, fmt("too many depth bindings for render texture")); + Log.report(logvisor::Fatal, FMT_STRING("too many depth bindings for render texture")); } glGenTextures(depthBindingCount, m_bindTexs[1].data()); } @@ -2018,7 +2018,7 @@ GLShaderDataBinding(const ObjToken& d, const ObjToken& d, const ObjToken { m_pxPitch = 2; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); return; } @@ -430,9 +430,9 @@ class MetalTextureR : public GraphicsDataNode { void Setup(MetalContext* ctx) { if (m_colorBindCount > MAX_BIND_TEXS) - Log.report(logvisor::Fatal, fmt("too many color bindings for render texture")); + Log.report(logvisor::Fatal, FMT_STRING("too many color bindings for render texture")); if (m_depthBindCount > MAX_BIND_TEXS) - Log.report(logvisor::Fatal, fmt("too many depth bindings for render texture")); + Log.report(logvisor::Fatal, FMT_STRING("too many depth bindings for render texture")); @autoreleasepool { MTLTextureDescriptor* desc = @@ -862,11 +862,11 @@ class MetalShaderStage : public GraphicsDataNode { options:compOpts error:&err]; if (!shaderLib) { - fmt::print(fmt("{}\n"), data + 1); + fmt::print(FMT_STRING("{}\n"), data + 1); } } if (!shaderLib) { - Log.report(logvisor::Fatal, fmt("error creating library: {}"), [[err localizedDescription] UTF8String]); + Log.report(logvisor::Fatal, FMT_STRING("error creating library: {}"), [[err localizedDescription] UTF8String]); } NSString* funcName; @@ -985,7 +985,7 @@ protected: NSError* err = nullptr; m_state = [ctx->m_dev newRenderPipelineStateWithDescriptor:desc error:&err]; if (err) { - Log.report(logvisor::Fatal, fmt("error making shader pipeline: {}"), + Log.report(logvisor::Fatal, FMT_STRING("error making shader pipeline: {}"), [[err localizedDescription] UTF8String]); } @@ -1060,7 +1060,7 @@ class MetalTessellationShaderPipeline : public MetalShaderPipeline { m_computeState = [ctx->m_dev newComputePipelineStateWithDescriptor:compDesc options:MTLPipelineOptionNone reflection:nil error:&err]; if (err) { - Log.report(logvisor::Fatal, fmt("error making compute pipeline: {}"), + Log.report(logvisor::Fatal, FMT_STRING("error making compute pipeline: {}"), [[err localizedDescription] UTF8String]); } } @@ -1165,7 +1165,7 @@ struct MetalShaderDataBinding : GraphicsDataNode { for (size_t i = 0; i < ubufCount; ++i) { #ifndef NDEBUG if (ubufOffs[i] % 256) { - Log.report(logvisor::Fatal, fmt("non-256-byte-aligned uniform-offset {} provided to newShaderDataBinding"), + Log.report(logvisor::Fatal, FMT_STRING("non-256-byte-aligned uniform-offset {} provided to newShaderDataBinding"), i); } #endif @@ -1176,7 +1176,7 @@ struct MetalShaderDataBinding : GraphicsDataNode { for (size_t i = 0; i < ubufCount; ++i) { #ifndef NDEBUG if (!ubufs[i]) { - Log.report(logvisor::Fatal, fmt("null uniform-buffer {} provided to newShaderDataBinding"), i); + Log.report(logvisor::Fatal, FMT_STRING("null uniform-buffer {} provided to newShaderDataBinding"), i); } #endif m_ubufs.push_back(ubufs[i]); diff --git a/lib/graphicsdev/Vulkan.cpp b/lib/graphicsdev/Vulkan.cpp index 73d0d3a..a43a30b 100644 --- a/lib/graphicsdev/Vulkan.cpp +++ b/lib/graphicsdev/Vulkan.cpp @@ -158,22 +158,22 @@ public: static void ThrowIfFailed(VkResult res) { if (res != VK_SUCCESS) - Log.report(logvisor::Fatal, fmt("{}\n"), res); + Log.report(logvisor::Fatal, FMT_STRING("{}\n"), res); } static VKAPI_ATTR VkBool32 VKAPI_CALL dbgFunc(VkDebugReportFlagsEXT msgFlags, VkDebugReportObjectTypeEXT objType, uint64_t srcObject, size_t location, int32_t msgCode, const char* pLayerPrefix, const char* pMsg, void* pUserData) { if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) { - Log.report(logvisor::Error, fmt("[{}] Code {} : {}"), pLayerPrefix, msgCode, pMsg); + Log.report(logvisor::Error, FMT_STRING("[{}] Code {} : {}"), pLayerPrefix, msgCode, pMsg); } else if (msgFlags & VK_DEBUG_REPORT_WARNING_BIT_EXT) { - Log.report(logvisor::Warning, fmt("[{}] Code {} : {}"), pLayerPrefix, msgCode, pMsg); + Log.report(logvisor::Warning, FMT_STRING("[{}] Code {} : {}"), pLayerPrefix, msgCode, pMsg); } else if (msgFlags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) { - Log.report(logvisor::Warning, fmt("[{}] Code {} : {}"), pLayerPrefix, msgCode, pMsg); + Log.report(logvisor::Warning, FMT_STRING("[{}] Code {} : {}"), pLayerPrefix, msgCode, pMsg); } else if (msgFlags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) { - Log.report(logvisor::Info, fmt("[{}] Code {} : {}"), pLayerPrefix, msgCode, pMsg); + Log.report(logvisor::Info, FMT_STRING("[{}] Code {} : {}"), pLayerPrefix, msgCode, pMsg); } else if (msgFlags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) { - Log.report(logvisor::Info, fmt("[{}] Code {} : {}"), pLayerPrefix, msgCode, pMsg); + Log.report(logvisor::Info, FMT_STRING("[{}] Code {} : {}"), pLayerPrefix, msgCode, pMsg); } /* @@ -308,7 +308,7 @@ static void demo_check_layers(const std::vector& } } if (!found) { - Log.report(logvisor::Fatal, fmt("Cannot find layer: {}"), layerNames[i]); + Log.report(logvisor::Fatal, FMT_STRING("Cannot find layer: {}"), layerNames[i]); } } } @@ -317,7 +317,7 @@ bool VulkanContext::initVulkan(std::string_view appName, PFN_vkGetInstanceProcAd vk::init_dispatch_table_top(getVkProc); if (!glslang::InitializeProcess()) { - Log.report(logvisor::Error, fmt("unable to initialize glslang")); + Log.report(logvisor::Error, FMT_STRING("unable to initialize glslang")); return false; } @@ -418,7 +418,7 @@ bool VulkanContext::initVulkan(std::string_view appName, PFN_vkGetInstanceProcAd VkResult instRes = vk::CreateInstance(&instInfo, nullptr, &m_instance); if (instRes != VK_SUCCESS) { Log.report(logvisor::Error, - fmt("The Vulkan runtime is installed, but there are no supported " + FMT_STRING("The Vulkan runtime is installed, but there are no supported " "hardware vendor interfaces present")); return false; } @@ -427,12 +427,12 @@ bool VulkanContext::initVulkan(std::string_view appName, PFN_vkGetInstanceProcAd PFN_vkCreateDebugReportCallbackEXT createDebugReportCallback = (PFN_vkCreateDebugReportCallbackEXT)vk::GetInstanceProcAddr(m_instance, "vkCreateDebugReportCallbackEXT"); if (!createDebugReportCallback) - Log.report(logvisor::Fatal, fmt("GetInstanceProcAddr: Unable to find vkCreateDebugReportCallbackEXT function.")); + Log.report(logvisor::Fatal, FMT_STRING("GetInstanceProcAddr: Unable to find vkCreateDebugReportCallbackEXT function.")); m_destroyDebugReportCallback = (PFN_vkDestroyDebugReportCallbackEXT)vk::GetInstanceProcAddr(m_instance, "vkDestroyDebugReportCallbackEXT"); if (!m_destroyDebugReportCallback) - Log.report(logvisor::Fatal, fmt("GetInstanceProcAddr: Unable to find vkDestroyDebugReportCallbackEXT function.")); + Log.report(logvisor::Fatal, FMT_STRING("GetInstanceProcAddr: Unable to find vkDestroyDebugReportCallbackEXT function.")); VkDebugReportCallbackCreateInfoEXT debugCreateInfo = {}; debugCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT; @@ -477,7 +477,7 @@ bool VulkanContext::enumerateDevices() { void VulkanContext::initDevice() { if (m_graphicsQueueFamilyIndex == UINT32_MAX) - Log.report(logvisor::Fatal, fmt("VulkanContext::m_graphicsQueueFamilyIndex hasn't been initialized")); + Log.report(logvisor::Fatal, FMT_STRING("VulkanContext::m_graphicsQueueFamilyIndex hasn't been initialized")); /* create the device and queues */ VkDeviceQueueCreateInfo queueInfo = {}; @@ -493,7 +493,7 @@ void VulkanContext::initDevice() { if (m_features.samplerAnisotropy) features.samplerAnisotropy = VK_TRUE; if (!m_features.textureCompressionBC) - Log.report(logvisor::Fatal, fmt("Vulkan device does not support DXT-format textures")); + Log.report(logvisor::Fatal, FMT_STRING("Vulkan device does not support DXT-format textures")); features.textureCompressionBC = VK_TRUE; VkShaderStageFlagBits tessellationDescriptorBit = VkShaderStageFlagBits(0); if (m_features.tessellationShader) { @@ -501,7 +501,7 @@ void VulkanContext::initDevice() { features.tessellationShader = VK_TRUE; } if (!m_features.dualSrcBlend) - Log.report(logvisor::Fatal, fmt("Vulkan device does not support dual-source blending")); + Log.report(logvisor::Fatal, FMT_STRING("Vulkan device does not support dual-source blending")); features.dualSrcBlend = VK_TRUE; uint32_t extCount = 0; @@ -524,7 +524,7 @@ void VulkanContext::initDevice() { } if (!hasSwapchain) - Log.report(logvisor::Fatal, fmt("Vulkan device does not support swapchains")); + Log.report(logvisor::Fatal, FMT_STRING("Vulkan device does not support swapchains")); /* need swapchain device extension */ m_deviceExtensionNames.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME); @@ -654,10 +654,10 @@ void VulkanContext::initDevice() { ThrowIfFailed(vk::CreatePipelineLayout(m_dev, &pipelineLayout, nullptr, &m_pipelinelayout)); std::string gpuName = m_gpuProps.deviceName; - Log.report(logvisor::Info, fmt("Initialized {}"), gpuName); - Log.report(logvisor::Info, fmt("Vulkan version {}.{}.{}"), m_gpuProps.apiVersion >> 22, + Log.report(logvisor::Info, FMT_STRING("Initialized {}"), gpuName); + Log.report(logvisor::Info, FMT_STRING("Vulkan version {}.{}.{}"), m_gpuProps.apiVersion >> 22, (m_gpuProps.apiVersion >> 12) & 0b1111111111, m_gpuProps.apiVersion & 0b111111111111); - Log.report(logvisor::Info, fmt("Driver version {}.{}.{}"), m_gpuProps.driverVersion >> 22, + Log.report(logvisor::Info, FMT_STRING("Driver version {}.{}.{}"), m_gpuProps.driverVersion >> 22, (m_gpuProps.driverVersion >> 12) & 0b1111111111, m_gpuProps.driverVersion & 0b111111111111); } @@ -1394,7 +1394,7 @@ class VulkanTextureS : public GraphicsDataNode { m_pixelPitchDenom = 1; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } m_vkFmt = pfmt; @@ -1553,7 +1553,7 @@ class VulkanTextureSA : public GraphicsDataNode { m_pixelPitchNum = 2; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } m_vkFmt = pfmt; @@ -1707,7 +1707,7 @@ class VulkanTextureD : public GraphicsDataNode { m_cpuSz = width * height * 2; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } m_vkFmt = pfmt; m_stagingBuf.reset(new uint8_t[m_cpuSz]); @@ -2679,7 +2679,7 @@ struct VulkanShaderDataBinding : GraphicsDataNode { for (size_t i = 0; i < ubufCount; ++i) { #ifndef NDEBUG if (ubufOffs[i] % 256) { - Log.report(logvisor::Fatal, fmt("non-256-byte-aligned uniform-offset {} provided to newShaderDataBinding"), + Log.report(logvisor::Fatal, FMT_STRING("non-256-byte-aligned uniform-offset {} provided to newShaderDataBinding"), i); } #endif @@ -2692,7 +2692,7 @@ struct VulkanShaderDataBinding : GraphicsDataNode { for (size_t i = 0; i < ubufCount; ++i) { #ifndef NDEBUG if (!ubufs[i]) { - Log.report(logvisor::Fatal, fmt("null uniform-buffer {} provided to newShaderDataBinding"), i); + Log.report(logvisor::Fatal, FMT_STRING("null uniform-buffer {} provided to newShaderDataBinding"), i); } #endif m_ubufs.push_back(ubufs[i]); @@ -2794,7 +2794,7 @@ struct VulkanShaderDataBinding : GraphicsDataNode { void bind(VkCommandBuffer cmdBuf, int b, VkRenderPass rPass = 0) { #ifndef NDEBUG if (!m_committed) - Log.report(logvisor::Fatal, fmt("attempted to use uncommitted VulkanShaderDataBinding")); + Log.report(logvisor::Fatal, FMT_STRING("attempted to use uncommitted VulkanShaderDataBinding")); #endif /* Ensure resized texture bindings are re-bound */ @@ -3178,7 +3178,7 @@ struct VulkanCommandQueue final : IGraphicsCommandQueue { VulkanTextureR* csource = m_resolveDispSource.cast(); #ifndef NDEBUG if (!csource->m_colorBindCount) - Log.report(logvisor::Fatal, fmt("texture provided to resolveDisplay() must have at least 1 color binding")); + Log.report(logvisor::Fatal, FMT_STRING("texture provided to resolveDisplay() must have at least 1 color binding")); #endif ThrowIfFailed( @@ -3493,9 +3493,9 @@ VulkanTextureR::VulkanTextureR(const boo::ObjToken& parent, Vu , m_colorBindCount(colorBindCount) , m_depthBindCount(depthBindCount) { if (colorBindCount > MAX_BIND_TEXS) - Log.report(logvisor::Fatal, fmt("too many color bindings for render texture")); + Log.report(logvisor::Fatal, FMT_STRING("too many color bindings for render texture")); if (depthBindCount > MAX_BIND_TEXS) - Log.report(logvisor::Fatal, fmt("too many depth bindings for render texture")); + Log.report(logvisor::Fatal, FMT_STRING("too many depth bindings for render texture")); if (m_samplesColor == 0) m_samplesColor = 1; @@ -3724,7 +3724,7 @@ ObjToken VulkanDataFactory::Context::newShaderStage(const uint8_t* if (stage == PipelineStage::Control || stage == PipelineStage::Evaluation) { if (!factory.m_ctx->m_features.tessellationShader) - Log.report(logvisor::Fatal, fmt("Device does not support tessellation shaders")); + Log.report(logvisor::Fatal, FMT_STRING("Device does not support tessellation shaders")); } return {new VulkanShaderStage(m_data, factory.m_ctx, data, size, stage)}; @@ -3738,9 +3738,9 @@ ObjToken VulkanDataFactory::Context::newShaderPipeline( if (control || evaluation) { if (!factory.m_ctx->m_features.tessellationShader) - Log.report(logvisor::Fatal, fmt("Device does not support tessellation shaders")); + Log.report(logvisor::Fatal, FMT_STRING("Device does not support tessellation shaders")); if (additionalInfo.patchSize > factory.m_ctx->m_gpuProps.limits.maxTessellationPatchSize) - Log.report(logvisor::Fatal, fmt("Device supports {} patch vertices, {} requested"), + Log.report(logvisor::Fatal, FMT_STRING("Device supports {} patch vertices, {} requested"), int(factory.m_ctx->m_gpuProps.limits.maxTessellationPatchSize), int(additionalInfo.patchSize)); } @@ -4104,14 +4104,14 @@ std::vector VulkanDataFactory::CompileGLSL(const char* source, Pipeline glslang::TShader shader(lang); shader.setStrings(&source, 1); if (!shader.parse(&glslang::DefaultTBuiltInResource, 110, false, messages)) { - fmt::print(fmt("{}\n"), source); - Log.report(logvisor::Fatal, fmt("unable to compile shader\n{}"), shader.getInfoLog()); + fmt::print(FMT_STRING("{}\n"), source); + Log.report(logvisor::Fatal, FMT_STRING("unable to compile shader\n{}"), shader.getInfoLog()); } glslang::TProgram prog; prog.addShader(&shader); if (!prog.link(messages)) { - Log.report(logvisor::Fatal, fmt("unable to link shader program\n{}"), prog.getInfoLog()); + Log.report(logvisor::Fatal, FMT_STRING("unable to link shader program\n{}"), prog.getInfoLog()); } std::vector out; diff --git a/lib/graphicsdev/nx/NX.cpp b/lib/graphicsdev/nx/NX.cpp index 3ca049d..fcdf067 100644 --- a/lib/graphicsdev/nx/NX.cpp +++ b/lib/graphicsdev/nx/NX.cpp @@ -319,7 +319,7 @@ class NXTextureS : public GraphicsDataNode { m_pixelPitchDenom = 2; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } m_nxFmt = pfmt; @@ -334,7 +334,7 @@ class NXTextureS : public GraphicsDataNode { texTempl.bind = PIPE_BIND_SAMPLER_VIEW; m_gpuTex = ctx->m_screen->resource_create(ctx->m_screen, &texTempl); if (!m_gpuTex) { - Log.report(logvisor::Fatal, fmt("Failed to create texture")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create texture")); return; } @@ -421,7 +421,7 @@ class NXTextureSA : public GraphicsDataNode { m_pixelPitchNum = 2; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } m_nxFmt = pfmt; @@ -436,7 +436,7 @@ class NXTextureSA : public GraphicsDataNode { texTempl.bind = PIPE_BIND_SAMPLER_VIEW; m_gpuTex = ctx->m_screen->resource_create(ctx->m_screen, &texTempl); if (!m_gpuTex) { - Log.report(logvisor::Fatal, fmt("Failed to create texture")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create texture")); return; } @@ -559,7 +559,7 @@ class NXTextureR : public GraphicsDataNode { texTempl.bind = PIPE_BIND_RENDER_TARGET; m_colorTex = ctx->m_screen->resource_create(ctx->m_screen, &texTempl); if (!m_colorTex) { - Log.report(logvisor::Fatal, fmt("Failed to create color target texture")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create color target texture")); return; } @@ -569,7 +569,7 @@ class NXTextureR : public GraphicsDataNode { texTempl.bind = PIPE_BIND_DEPTH_STENCIL; m_depthTex = ctx->m_screen->resource_create(ctx->m_screen, &texTempl); if (!m_depthTex) { - Log.report(logvisor::Fatal, fmt("Failed to create depth target texture")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create depth target texture")); return; } @@ -580,7 +580,7 @@ class NXTextureR : public GraphicsDataNode { texTempl.bind = PIPE_BIND_SAMPLER_VIEW; m_colorBindTex[i] = ctx->m_screen->resource_create(ctx->m_screen, &texTempl); if (!m_colorBindTex[i]) { - Log.report(logvisor::Fatal, fmt("Failed to create color bind texture")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create color bind texture")); return; } } @@ -590,7 +590,7 @@ class NXTextureR : public GraphicsDataNode { texTempl.bind = PIPE_BIND_SAMPLER_VIEW; m_depthBindTex[i] = ctx->m_screen->resource_create(ctx->m_screen, &texTempl); if (!m_depthBindTex[i]) { - Log.report(logvisor::Fatal, fmt("Failed to create depth bind texture")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create depth bind texture")); return; } } @@ -605,7 +605,7 @@ class NXTextureR : public GraphicsDataNode { svTempl.texture = m_colorTex; m_colorView = ctx->m_pctx->create_sampler_view(ctx->m_pctx, m_colorTex, &svTempl); if (!m_colorView) { - Log.report(logvisor::Fatal, fmt("Failed to create color sampler view")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create color sampler view")); return; } @@ -613,7 +613,7 @@ class NXTextureR : public GraphicsDataNode { svTempl.texture = m_depthTex; m_depthView = ctx->m_pctx->create_sampler_view(ctx->m_pctx, m_depthTex, &svTempl); if (!m_depthView) { - Log.report(logvisor::Fatal, fmt("Failed to create depth sampler view")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create depth sampler view")); return; } @@ -622,7 +622,7 @@ class NXTextureR : public GraphicsDataNode { svTempl.texture = m_colorBindTex[i]; m_colorBindView[i] = ctx->m_pctx->create_sampler_view(ctx->m_pctx, m_colorBindTex[i], &svTempl); if (!m_colorBindView[i]) { - Log.report(logvisor::Fatal, fmt("Failed to create color bind sampler view")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create color bind sampler view")); return; } } @@ -632,7 +632,7 @@ class NXTextureR : public GraphicsDataNode { svTempl.texture = m_depthBindTex[i]; m_depthBindView[i] = ctx->m_pctx->create_sampler_view(ctx->m_pctx, m_depthBindTex[i], &svTempl); if (!m_depthBindView[i]) { - Log.report(logvisor::Fatal, fmt("Failed to create depth bind sampler view")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create depth bind sampler view")); return; } } @@ -642,14 +642,14 @@ class NXTextureR : public GraphicsDataNode { surfTempl.format = ColorFormat; m_colorSurface = ctx->m_pctx->create_surface(ctx->m_pctx, m_colorTex, &surfTempl); if (!m_colorSurface) { - Log.report(logvisor::Fatal, fmt("Failed to create color surface")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create color surface")); return; } surfTempl.format = DepthFormat; m_depthSurface = ctx->m_pctx->create_surface(ctx->m_pctx, m_depthTex, &surfTempl); if (!m_depthSurface) { - Log.report(logvisor::Fatal, fmt("Failed to create depth surface")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create depth surface")); return; } @@ -665,9 +665,9 @@ class NXTextureR : public GraphicsDataNode { TextureClampMode clampMode, size_t colorBindCount, size_t depthBindCount) : GraphicsDataNode(parent), m_ctx(ctx) { if (colorBindCount > MAX_BIND_TEXS) - Log.report(logvisor::Fatal, fmt("too many color bindings for render texture")); + Log.report(logvisor::Fatal, FMT_STRING("too many color bindings for render texture")); if (depthBindCount > MAX_BIND_TEXS) - Log.report(logvisor::Fatal, fmt("too many depth bindings for render texture")); + Log.report(logvisor::Fatal, FMT_STRING("too many depth bindings for render texture")); if (m_samplesColor == 0) m_samplesColor = 1; @@ -795,7 +795,7 @@ class NXShaderStage : public GraphicsDataNode { PipelineStage stage) : GraphicsDataNode(parent), m_obj(ctx->m_compiler.compile(SHADER_TYPE_TABLE[int(stage)], (char*)data)) { if (!m_obj) - Log.report(logvisor::Fatal, fmt("Shader compile fail:\n%s\n"), m_obj.info_log()); + Log.report(logvisor::Fatal, FMT_STRING("Shader compile fail:\n%s\n"), m_obj.info_log()); } public: @@ -960,7 +960,7 @@ protected: std::string infoLog; m_shader = ctx->m_compiler.link(numStages, stages, &infoLog); if (!m_shader) - Log.report(logvisor::Fatal, fmt("Unable to link shader:\n%s\n"), infoLog.c_str()); + Log.report(logvisor::Fatal, FMT_STRING("Unable to link shader:\n%s\n"), infoLog.c_str()); } public: @@ -1083,7 +1083,7 @@ struct NXShaderDataBinding : GraphicsDataNode { for (size_t i = 0; i < ubufCount; ++i) { #ifndef NDEBUG if (!ubufs[i]) - Log.report(logvisor::Fatal, fmt("null uniform-buffer %d provided to newShaderDataBinding"), int(i)); + Log.report(logvisor::Fatal, FMT_STRING("null uniform-buffer %d provided to newShaderDataBinding"), int(i)); #endif m_ubufs.push_back(ubufs[i]); if (ubufOffs && ubufSizes) @@ -1141,7 +1141,7 @@ struct NXShaderDataBinding : GraphicsDataNode { void bind(int b) { #ifndef NDEBUG if (!m_committed) - Log.report(logvisor::Fatal, fmt("attempted to use uncommitted NXShaderDataBinding")); + Log.report(logvisor::Fatal, FMT_STRING("attempted to use uncommitted NXShaderDataBinding")); #endif struct pipe_context* pctx = m_ctx->m_pctx; @@ -1362,7 +1362,7 @@ struct NXCommandQueue : IGraphicsCommandQueue { NXTextureR* csource = m_resolveDispSource.cast(); #ifndef NDEBUG if (!csource->m_colorBindCount) - Log.report(logvisor::Fatal, fmt("texture provided to resolveDisplay() must have at least 1 color binding")); + Log.report(logvisor::Fatal, FMT_STRING("texture provided to resolveDisplay() must have at least 1 color binding")); #endif struct pipe_surface* backBuf = m_ctx->m_windowSurfaces[ST_ATTACHMENT_BACK_LEFT]; @@ -1538,7 +1538,7 @@ NXTextureD::NXTextureD(const boo::ObjToken& parent, NXCommandQ m_cpuSz = width * height * 2; break; default: - Log.report(logvisor::Fatal, fmt("unsupported tex format")); + Log.report(logvisor::Fatal, FMT_STRING("unsupported tex format")); } m_nxFmt = pfmt; m_stagingBuf.reset(new uint8_t[m_cpuSz]); @@ -1554,7 +1554,7 @@ NXTextureD::NXTextureD(const boo::ObjToken& parent, NXCommandQ for (int i = 0; i < 2; ++i) { m_gpuTex[i] = ctx->m_screen->resource_create(ctx->m_screen, &texTempl); if (!m_gpuTex[i]) { - Log.report(logvisor::Fatal, fmt("Failed to create texture")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create texture")); return; } } @@ -1812,7 +1812,7 @@ bool NXContext::initialize() { printf("Activated console\n\n"); m_screen = nouveau_switch_screen_create(); if (!m_screen) { - Log.report(logvisor::Fatal, fmt("Failed to create nouveau screen")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create nouveau screen")); return false; } printf("nouveau_switch_screen_create done\n"); @@ -1820,7 +1820,7 @@ bool NXContext::initialize() { m_pctx = m_screen->context_create(m_screen, nullptr, 0); if (!m_pctx) { - Log.report(logvisor::Fatal, fmt("Failed to create pipe context")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create pipe context")); m_screen->destroy(m_screen); return false; } @@ -1829,7 +1829,7 @@ bool NXContext::initialize() { st_config_options opts = {}; m_st = st_create_context(API_OPENGL_CORE, m_pctx, nullptr, nullptr, &opts, false); if (!m_st) { - Log.report(logvisor::Fatal, fmt("Failed to create st context")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create st context")); m_screen->destroy(m_screen); return false; } @@ -1856,7 +1856,7 @@ bool NXContext::initialize() { whandle.stride = gfxGetFramebufferPitch(); struct pipe_resource* tex = m_screen->resource_from_handle(m_screen, &texTempl, &whandle, 0); if (!tex) { - Log.report(logvisor::Fatal, fmt("Failed to create color target texture")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create color target texture")); return false; } @@ -1865,7 +1865,7 @@ bool NXContext::initialize() { surfTempl.format = ColorFormat; m_windowSurfaces[i] = m_pctx->create_surface(m_pctx, tex, &surfTempl); if (!m_windowSurfaces[i]) { - Log.report(logvisor::Fatal, fmt("Failed to create color surface")); + Log.report(logvisor::Fatal, FMT_STRING("Failed to create color surface")); return false; } diff --git a/lib/inputdev/DeviceFinder.cpp b/lib/inputdev/DeviceFinder.cpp index dfd30da..76685d1 100644 --- a/lib/inputdev/DeviceFinder.cpp +++ b/lib/inputdev/DeviceFinder.cpp @@ -15,7 +15,7 @@ DeviceFinder* DeviceFinder::skDevFinder = nullptr; DeviceFinder::DeviceFinder(std::unordered_set types) { if (skDevFinder) { - fmt::print(stderr, fmt("only one instance of CDeviceFinder may be constructed")); + fmt::print(stderr, FMT_STRING("only one instance of CDeviceFinder may be constructed")); std::abort(); } skDevFinder = this; diff --git a/lib/inputdev/HIDDeviceIOKit.cpp b/lib/inputdev/HIDDeviceIOKit.cpp index 3f10b16..4c96a29 100644 --- a/lib/inputdev/HIDDeviceIOKit.cpp +++ b/lib/inputdev/HIDDeviceIOKit.cpp @@ -79,7 +79,7 @@ class HIDDeviceIOKit : public IHIDDevice { } static void _threadProcUSBLL(std::shared_ptr device) { - pthread_setname_np(fmt::format(fmt("{} Transfer Thread"), device->m_token.getProductName()).c_str()); + pthread_setname_np(fmt::format(FMT_STRING("{} Transfer Thread"), device->m_token.getProductName()).c_str()); std::unique_lock lk(device->m_initMutex); /* Get the HID element's parent (USB interrupt transfer-interface) */ @@ -95,7 +95,7 @@ class HIDDeviceIOKit : public IHIDDevice { } } if (!interfaceEntry) { - device->m_devImp->deviceError(fmt("Unable to find interface for {}@{}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to find interface for {}@{}\n"), device->m_token.getProductName(), device->m_devPath); lk.unlock(); device->m_initCond.notify_one(); @@ -109,7 +109,7 @@ class HIDDeviceIOKit : public IHIDDevice { err = IOCreatePlugInInterfaceForService(interfaceEntry.get(), kIOUSBInterfaceUserClientTypeID, kIOCFPlugInInterfaceID, &iodev, &score); if (err) { - device->m_devImp->deviceError(fmt("Unable to open {}@{}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}\n"), device->m_token.getProductName(), device->m_devPath); lk.unlock(); device->m_initCond.notify_one(); @@ -120,7 +120,7 @@ class HIDDeviceIOKit : public IHIDDevice { IUnknownPointer intf; err = iodev.As(&intf, kIOUSBInterfaceInterfaceID); if (err) { - device->m_devImp->deviceError(fmt("Unable to open {}@{}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}\n"), device->m_token.getProductName(), device->m_devPath); lk.unlock(); device->m_initCond.notify_one(); @@ -132,10 +132,10 @@ class HIDDeviceIOKit : public IHIDDevice { err = intf->USBInterfaceOpen(intf.storage()); if (err != kIOReturnSuccess) { if (err == kIOReturnExclusiveAccess) { - device->m_devImp->deviceError(fmt("Unable to open {}@{}: someone else using it\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}: someone else using it\n"), device->m_token.getProductName(), device->m_devPath); } else { - device->m_devImp->deviceError(fmt("Unable to open {}@{}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}\n"), device->m_token.getProductName(), device->m_devPath); } lk.unlock(); @@ -199,14 +199,14 @@ class HIDDeviceIOKit : public IHIDDevice { } static void _threadProcHID(std::shared_ptr device) { - pthread_setname_np(fmt::format(fmt("{} Transfer Thread"), device->m_token.getProductName()).c_str()); + pthread_setname_np(fmt::format(FMT_STRING("{} Transfer Thread"), device->m_token.getProductName()).c_str()); std::unique_lock lk(device->m_initMutex); /* Get the HID element's object (HID device interface) */ IOObjectPointer interfaceEntry = IORegistryEntryFromPath(kIOMasterPortDefault, device->m_devPath.data()); if (!IOObjectConformsTo(interfaceEntry.get(), "IOHIDDevice")) { - device->m_devImp->deviceError(fmt("Unable to find interface for {}@{}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to find interface for {}@{}\n"), device->m_token.getProductName(), device->m_devPath); lk.unlock(); device->m_initCond.notify_one(); @@ -215,7 +215,7 @@ class HIDDeviceIOKit : public IHIDDevice { device->m_hidIntf = IOHIDDeviceCreate(nullptr, interfaceEntry.get()); if (!device->m_hidIntf) { - device->m_devImp->deviceError(fmt("Unable to open {}@{}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}\n"), device->m_token.getProductName(), device->m_devPath); lk.unlock(); device->m_initCond.notify_one(); @@ -226,10 +226,10 @@ class HIDDeviceIOKit : public IHIDDevice { IOReturn err = IOHIDDeviceOpen(device->m_hidIntf.get(), kIOHIDOptionsTypeNone); if (err != kIOReturnSuccess) { if (err == kIOReturnExclusiveAccess) { - device->m_devImp->deviceError(fmt("Unable to open {}@{}: someone else using it\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}: someone else using it\n"), device->m_token.getProductName(), device->m_devPath); } else { - device->m_devImp->deviceError(fmt("Unable to open {}@{}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}\n"), device->m_token.getProductName(), device->m_devPath); } lk.unlock(); @@ -292,7 +292,7 @@ public: else if (dType == DeviceType::HID) m_thread = std::thread(_threadProcHID, std::static_pointer_cast(shared_from_this())); else { - fmt::print(stderr, fmt("invalid token supplied to device constructor\n")); + fmt::print(stderr, FMT_STRING("invalid token supplied to device constructor\n")); return; } m_initCond.wait(lk); diff --git a/lib/inputdev/HIDDeviceUdev.cpp b/lib/inputdev/HIDDeviceUdev.cpp index 3402761..d987296 100644 --- a/lib/inputdev/HIDDeviceUdev.cpp +++ b/lib/inputdev/HIDDeviceUdev.cpp @@ -69,7 +69,7 @@ class HIDDeviceUdev final : public IHIDDevice { const char* dp = udev_device_get_devnode(udevDev); int fd = open(dp, O_RDWR); if (fd < 0) { - device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}: {}\n"), device->m_token.getProductName(), dp, strerror(errno)); lk.unlock(); device->m_initCond.notify_one(); @@ -149,7 +149,7 @@ class HIDDeviceUdev final : public IHIDDevice { const char* dp = udev_device_get_devnode(udevDev); int fd = open(dp, O_RDWR | O_NONBLOCK); if (fd < 0) { - device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}: {}\n"), device->m_token.getProductName(), dp, strerror(errno)); lk.unlock(); device->m_initCond.notify_one(); @@ -166,7 +166,7 @@ class HIDDeviceUdev final : public IHIDDevice { /* Report descriptor size */ int reportDescSize; if (ioctl(fd, HIDIOCGRDESCSIZE, &reportDescSize) == -1) { - device->m_devImp->deviceError(fmt("Unable to ioctl(HIDIOCGRDESCSIZE) {}@{}: {}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to ioctl(HIDIOCGRDESCSIZE) {}@{}: {}\n"), device->m_token.getProductName(), dp, strerror(errno)); close(fd); return; @@ -176,7 +176,7 @@ class HIDDeviceUdev final : public IHIDDevice { hidraw_report_descriptor reportDesc; reportDesc.size = reportDescSize; if (ioctl(fd, HIDIOCGRDESC, &reportDesc) == -1) { - device->m_devImp->deviceError(fmt("Unable to ioctl(HIDIOCGRDESC) {}@{}: {}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to ioctl(HIDIOCGRDESC) {}@{}: {}\n"), device->m_token.getProductName(), dp, strerror(errno)); close(fd); return; @@ -272,7 +272,7 @@ public: else if (dType == DeviceType::HID) m_thread = std::thread(_threadProcHID, std::static_pointer_cast(shared_from_this())); else { - fmt::print(stderr, fmt("invalid token supplied to device constructor")); + fmt::print(stderr, FMT_STRING("invalid token supplied to device constructor")); abort(); } m_initCond.wait(lk); diff --git a/lib/inputdev/HIDDeviceWinUSB.cpp b/lib/inputdev/HIDDeviceWinUSB.cpp index b23dcbf..0d7d6ed 100644 --- a/lib/inputdev/HIDDeviceWinUSB.cpp +++ b/lib/inputdev/HIDDeviceWinUSB.cpp @@ -72,7 +72,7 @@ class HIDDeviceWinUSB final : public IHIDDevice { CreateFileA(device->m_devPath.data(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, nullptr); if (INVALID_HANDLE_VALUE == device->m_devHandle) { - device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}: {}\n"), device->m_token.getProductName(), device->m_devPath, GetLastError()); lk.unlock(); device->m_initCond.notify_one(); @@ -80,7 +80,7 @@ class HIDDeviceWinUSB final : public IHIDDevice { } if (!WinUsb_Initialize(device->m_devHandle, &device->m_usbHandle)) { - device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}: {}\n"), device->m_token.getProductName(), device->m_devPath, GetLastError()); lk.unlock(); device->m_initCond.notify_one(); @@ -91,7 +91,7 @@ class HIDDeviceWinUSB final : public IHIDDevice { /* Enumerate device pipes */ USB_INTERFACE_DESCRIPTOR ifDesc = {0}; if (!WinUsb_QueryInterfaceSettings(device->m_usbHandle, 0, &ifDesc)) { - device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}: {}\n"), device->m_token.getProductName(), device->m_devPath, GetLastError()); lk.unlock(); device->m_initCond.notify_one(); @@ -156,7 +156,7 @@ class HIDDeviceWinUSB final : public IHIDDevice { CreateFileA(device->m_devPath.data(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, nullptr); if (INVALID_HANDLE_VALUE == device->m_hidHandle) { - device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable to open {}@{}: {}\n"), device->m_token.getProductName(), device->m_devPath, GetLastError()); lk.unlock(); device->m_initCond.notify_one(); @@ -164,7 +164,7 @@ class HIDDeviceWinUSB final : public IHIDDevice { } if (!HidD_GetPreparsedData(device->m_hidHandle, &device->m_preparsedData)) { - device->m_devImp->deviceError(fmt("Unable get preparsed data of {}@{}: {}\n"), + device->m_devImp->deviceError(FMT_STRING("Unable get preparsed data of {}@{}: {}\n"), device->m_token.getProductName(), device->m_devPath, GetLastError()); lk.unlock(); device->m_initCond.notify_one(); @@ -233,14 +233,14 @@ class HIDDeviceWinUSB final : public IHIDDevice { } if (Error != ERROR_IO_PENDING) { - fmt::print(stderr, fmt("Write Failed {:08X}\n"), int(Error)); + fmt::print(stderr, FMT_STRING("Write Failed {:08X}\n"), int(Error)); return false; } } if (!GetOverlappedResult(m_hidHandle, &Overlapped, &BytesWritten, TRUE)) { DWORD Error = GetLastError(); - fmt::print(stderr, fmt("Write Failed {:08X}\n"), int(Error)); + fmt::print(stderr, FMT_STRING("Write Failed {:08X}\n"), int(Error)); return false; } } else if (tp == HIDReportType::Feature) { @@ -309,7 +309,7 @@ public: m_runningTransferLoop = false; return; } else if (Error != ERROR_IO_PENDING) { - fmt::print(stderr, fmt("Read Failed: {:08X}\n"), int(Error)); + fmt::print(stderr, FMT_STRING("Read Failed: {:08X}\n"), int(Error)); return; } else if (!GetOverlappedResultEx(m_hidHandle, &m_overlapped, &BytesRead, 10, TRUE)) { return; diff --git a/lib/inputdev/HIDListenerIOKit.cpp b/lib/inputdev/HIDListenerIOKit.cpp index a9ee475..70dccbc 100644 --- a/lib/inputdev/HIDListenerIOKit.cpp +++ b/lib/inputdev/HIDListenerIOKit.cpp @@ -84,14 +84,14 @@ class HIDListenerIOKit : public IHIDListener { err = IOCreatePlugInInterfaceForService(obj.get(), kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &devServ, &score); if (err != kIOReturnSuccess) { - fmt::print(stderr, fmt("unable to open IOKit plugin interface\n")); + fmt::print(stderr, FMT_STRING("unable to open IOKit plugin interface\n")); continue; } IUnknownPointer dev; err = devServ.As(&dev, kIOUSBDeviceInterfaceID182); if (err != kIOReturnSuccess) { - fmt::print(stderr, fmt("unable to open IOKit device interface\n")); + fmt::print(stderr, FMT_STRING("unable to open IOKit device interface\n")); continue; } @@ -108,7 +108,7 @@ class HIDListenerIOKit : public IHIDListener { listener->m_finder._insertToken(std::make_unique(DeviceType::USB, vid, pid, vstr, pstr, devPath)); - // fmt::print(fmt("ADDED {:08X} {}\n"), obj.get(), devPath); + // fmt::print(FMT_STRING("ADDED {:08X} {}\n"), obj.get(), devPath); } } @@ -124,7 +124,7 @@ class HIDListenerIOKit : public IHIDListener { if (IORegistryEntryGetPath(obj.get(), kIOServicePlane, devPath) != 0) continue; listener->m_finder._removeToken(devPath); - // fmt::print(fmt("REMOVED {:08X} {}\n"), obj.get(), devPath); + // fmt::print(FMT_STRING("REMOVED {:08X} {}\n"), obj.get(), devPath); } } @@ -147,14 +147,14 @@ class HIDListenerIOKit : public IHIDListener { err = IOCreatePlugInInterfaceForService(obj.get(), kIOHIDDeviceTypeID, kIOCFPlugInInterfaceID, &devServ, &score); if (err != kIOReturnSuccess) { - fmt::print(stderr, fmt("unable to open IOKit plugin interface\n")); + fmt::print(stderr, FMT_STRING("unable to open IOKit plugin interface\n")); continue; } IUnknownPointer dev; err = devServ.As(&dev, kIOHIDDeviceDeviceInterfaceID); if (err != kIOReturnSuccess) { - fmt::print(stderr, fmt("unable to open IOKit device interface\n")); + fmt::print(stderr, FMT_STRING("unable to open IOKit device interface\n")); continue; } @@ -191,7 +191,7 @@ class HIDListenerIOKit : public IHIDListener { listener->m_finder._insertToken(std::make_unique(DeviceType::HID, vidv, pidv, vstr, pstr, devPath)); - // fmt::print(fmt("ADDED {:08X} {}\n"), obj, devPath); + // fmt::print(FMT_STRING("ADDED {:08X} {}\n"), obj, devPath); } } @@ -207,7 +207,7 @@ class HIDListenerIOKit : public IHIDListener { if (IORegistryEntryGetPath(obj.get(), kIOServicePlane, devPath) != 0) continue; listener->m_finder._removeToken(devPath); - // fmt::print(fmt("REMOVED {:08X} {}\n"), obj, devPath); + // fmt::print(FMT_STRING("REMOVED {:08X} {}\n"), obj, devPath); } } diff --git a/lib/inputdev/HIDListenerUdev.cpp b/lib/inputdev/HIDListenerUdev.cpp index 020b272..d94ee55 100644 --- a/lib/inputdev/HIDListenerUdev.cpp +++ b/lib/inputdev/HIDListenerUdev.cpp @@ -123,7 +123,7 @@ class HIDListenerUdev final : public IHIDListener { { const char* name = udev_list_entry_get_name(att); const char* val = udev_list_entry_get_value(att); - fmt::print(stderr, fmt("{} {}\n"), name, val); + fmt::print(stderr, FMT_STRING("{} {}\n"), name, val); } std::fputs("\n\n", stderr); #endif @@ -170,7 +170,7 @@ public: /* Setup hotplug events */ m_udevMon = udev_monitor_new_from_netlink(GetUdev(), "udev"); if (!m_udevMon) { - fmt::print(stderr, fmt("unable to init udev_monitor")); + fmt::print(stderr, FMT_STRING("unable to init udev_monitor")); abort(); } udev_monitor_filter_add_match_subsystem_devtype(m_udevMon, "usb", "usb_device"); diff --git a/lib/mac/ApplicationCocoa.mm b/lib/mac/ApplicationCocoa.mm index 8914d2d..00b1c09 100644 --- a/lib/mac/ApplicationCocoa.mm +++ b/lib/mac/ApplicationCocoa.mm @@ -104,11 +104,11 @@ public: m_metalCtx.m_dev = MTLCreateSystemDefaultDevice(); if (!m_metalCtx.m_dev) - Log.report(logvisor::Fatal, fmt("Unable to create metal device")); + Log.report(logvisor::Fatal, FMT_STRING("Unable to create metal device")); m_metalCtx.m_q = [m_metalCtx.m_dev newCommandQueue]; while (![m_metalCtx.m_dev supportsTextureSampleCount:m_metalCtx.m_sampleCount]) m_metalCtx.m_sampleCount = flp2(m_metalCtx.m_sampleCount - 1); - Log.report(logvisor::Info, fmt("using Metal renderer")); + Log.report(logvisor::Info, FMT_STRING("using Metal renderer")); } EPlatformType getPlatformType() const override { diff --git a/lib/mac/WindowCocoa.mm b/lib/mac/WindowCocoa.mm index 68ff13b..78d0953 100644 --- a/lib/mac/WindowCocoa.mm +++ b/lib/mac/WindowCocoa.mm @@ -233,7 +233,7 @@ public: ~GraphicsContextCocoaGL() override { m_commandQueue->stopRenderer(); - fmt::print(fmt("CONTEXT DESTROYED\n")); + fmt::print(FMT_STRING("CONTEXT DESTROYED\n")); } void _setCallback(IWindowCallback* cb) override @@ -263,7 +263,7 @@ public: { m_nsContext = [[GraphicsContextCocoaGLInternal alloc] initWithBooContext:this]; if (!m_nsContext) - Log.report(logvisor::Fatal, fmt("unable to make new NSOpenGLView")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make new NSOpenGLView")); [(__bridge NSWindow*)(void*)m_parentWindow->getPlatformHandle() setContentView:m_nsContext]; CVDisplayLinkCreateWithActiveCGDisplays(&m_dispLink); CVDisplayLinkSetOutputCallback(m_dispLink, (CVDisplayLinkOutputCallback)DLCallback, this); @@ -299,7 +299,7 @@ public: NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_TABLE[int(m_pf)]]; m_mainCtx = [[NSOpenGLContext alloc] initWithFormat:nspf shareContext:[m_nsContext openGLContext]]; if (!m_mainCtx) - Log.report(logvisor::Fatal, fmt("unable to make main NSOpenGLContext")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make main NSOpenGLContext")); } [m_mainCtx makeCurrentContext]; return m_dataFactory.get(); @@ -312,7 +312,7 @@ public: NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_TABLE[int(m_pf)]]; m_loadCtx = [[NSOpenGLContext alloc] initWithFormat:nspf shareContext:[m_nsContext openGLContext]]; if (!m_loadCtx) - Log.report(logvisor::Fatal, fmt("unable to make load NSOpenGLContext")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make load NSOpenGLContext")); } [m_loadCtx makeCurrentContext]; return m_dataFactory.get(); @@ -356,7 +356,7 @@ IGraphicsContext* _GraphicsContextCocoaGLNew(IGraphicsContext::EGraphicsAPI api, minor = glVersion[2] - '0'; } if (glewInit() != GLEW_OK) - Log.report(logvisor::Fatal, fmt("glewInit failed")); + Log.report(logvisor::Fatal, FMT_STRING("glewInit failed")); [NSOpenGLContext clearCurrentContext]; if (!glVersion) return nullptr; @@ -419,7 +419,7 @@ public: MetalContext::Window& w = m_metalCtx->m_windows[m_parentWindow]; m_nsContext = [[GraphicsContextCocoaMetalInternal alloc] initWithBooContext:this]; if (!m_nsContext) - Log.report(logvisor::Fatal, fmt("unable to make new NSView for Metal")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make new NSView for Metal")); w.m_metalLayer = (CAMetalLayer*) m_nsContext.layer; [(__bridge NSWindow*) (void*) m_parentWindow->getPlatformHandle() setContentView:m_nsContext]; CVDisplayLinkCreateWithActiveCGDisplays(&m_dispLink); diff --git a/lib/nx/ApplicationNX.cpp b/lib/nx/ApplicationNX.cpp index f569c76..70f8b5e 100644 --- a/lib/nx/ApplicationNX.cpp +++ b/lib/nx/ApplicationNX.cpp @@ -78,7 +78,7 @@ public: std::shared_ptr m_window; std::shared_ptr newWindow(std::string_view title) override { if (m_window) - Log.report(logvisor::Fatal, fmt("Only 1 window allowed on NX")); + Log.report(logvisor::Fatal, FMT_STRING("Only 1 window allowed on NX")); m_window = _WindowNXNew(title, &m_nxCtx); return m_window; } diff --git a/lib/win/ApplicationUWP.cpp b/lib/win/ApplicationUWP.cpp index d0bd8e8..e43950c 100644 --- a/lib/win/ApplicationUWP.cpp +++ b/lib/win/ApplicationUWP.cpp @@ -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 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 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 device; if (FAILED(tempDev.As(&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; } diff --git a/lib/win/ApplicationWin32.cpp b/lib/win/ApplicationWin32.cpp index 6f6cd21..400269f 100644 --- a/lib/win/ApplicationWin32.cpp +++ b/lib/win/ApplicationWin32.cpp @@ -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 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 device; if (FAILED(tempDev.As(&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 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 ret = std::move(m_mwret); m_mwret.reset(); diff --git a/lib/win/WindowUWP.cpp b/lib/win/WindowUWP.cpp index 714e6bf..e35a4cf 100644 --- a/lib/win/WindowUWP.cpp +++ b/lib/win/WindowUWP.cpp @@ -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(&w.m_swapChain); ComPtr 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")); } } diff --git a/lib/win/WindowWin32.cpp b/lib/win/WindowWin32.cpp index 2959b0d..3d46da7 100644 --- a/lib/win/WindowWin32.cpp +++ b/lib/win/WindowWin32.cpp @@ -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(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); diff --git a/lib/x11/ApplicationUnix.cpp b/lib/x11/ApplicationUnix.cpp index c0bec1b..441eb7a 100644 --- a/lib/x11/ApplicationUnix.cpp +++ b/lib/x11/ApplicationUnix.cpp @@ -32,13 +32,13 @@ class ScreenSaverInhibitor { DBusError err = DBUS_ERROR_INIT; if ((msg = dbus_pending_call_steal_reply(m_pending)) && dbus_message_get_args(msg, &err, DBUS_TYPE_UINT32, &m_cookie, DBUS_TYPE_INVALID)) { - Log.report(logvisor::Info, fmt("Screen saver inhibited")); + Log.report(logvisor::Info, FMT_STRING("Screen saver inhibited")); } else { /* Fallback to xdg-screensaver */ dbus_error_free(&err); - Log.report(logvisor::Info, fmt("Falling back to xdg-screensaver inhibit")); + Log.report(logvisor::Info, FMT_STRING("Falling back to xdg-screensaver inhibit")); if (!fork()) { - execlp("xdg-screensaver", "xdg-screensaver", "suspend", fmt::format(fmt("0x{:X}"), m_wid).c_str(), nullptr); + execlp("xdg-screensaver", "xdg-screensaver", "suspend", fmt::format(FMT_STRING("0x{:X}"), m_wid).c_str(), nullptr); exit(1); } } @@ -99,17 +99,17 @@ DBusConnection* RegisterDBus(const char* appName, bool& isFirst) { /* connect to the bus and check for errors */ DBusConnection* conn = dbus_bus_get(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { - fmt::print(stderr, fmt("DBus Connection Error ({})\n"), err.message); + fmt::print(stderr, FMT_STRING("DBus Connection Error ({})\n"), err.message); dbus_error_free(&err); } if (conn == nullptr) return nullptr; /* request our name on the bus and check for errors */ - int ret = dbus_bus_request_name(conn, fmt::format(fmt("boo.{}.unique"), appName).c_str(), + int ret = dbus_bus_request_name(conn, fmt::format(FMT_STRING("boo.{}.unique"), appName).c_str(), DBUS_NAME_FLAG_DO_NOT_QUEUE, &err); if (dbus_error_is_set(&err)) { - fmt::print(stderr, fmt("DBus Name Error ({})\n"), err.message); + fmt::print(stderr, FMT_STRING("DBus Name Error ({})\n"), err.message); dbus_error_free(&err); dbus_connection_close(conn); return nullptr; diff --git a/lib/x11/ApplicationXlib.hpp b/lib/x11/ApplicationXlib.hpp index 423c83a..e55ec39 100644 --- a/lib/x11/ApplicationXlib.hpp +++ b/lib/x11/ApplicationXlib.hpp @@ -237,10 +237,10 @@ public: loadVk(); if (m_getVkProc) - Log.report(logvisor::Info, fmt("using Vulkan renderer")); + Log.report(logvisor::Info, FMT_STRING("using Vulkan renderer")); else #endif - Log.report(logvisor::Info, fmt("using OpenGL renderer")); + Log.report(logvisor::Info, FMT_STRING("using OpenGL renderer")); #ifndef BOO_MSAN /* DBus single instance registration */ @@ -280,7 +280,7 @@ public: #endif if (!XInitThreads()) { - Log.report(logvisor::Fatal, fmt("X doesn't support multithreading")); + Log.report(logvisor::Fatal, FMT_STRING("X doesn't support multithreading")); return; } @@ -290,7 +290,7 @@ public: /* Open Xlib Display */ m_xDisp = XOpenDisplay(0); if (!m_xDisp) { - Log.report(logvisor::Fatal, fmt("Can't open X display")); + Log.report(logvisor::Fatal, FMT_STRING("Can't open X display")); return; } @@ -298,18 +298,18 @@ public: /* Cast Display to XCB connection for vulkan */ m_xcbConn = XGetXCBConnection(m_xDisp); if (!m_xcbConn) { - Log.report(logvisor::Fatal, fmt("Can't cast Display to XCB connection for Vulkan")); + Log.report(logvisor::Fatal, FMT_STRING("Can't cast Display to XCB connection for Vulkan")); return; } #endif /* Configure locale */ if (!XSupportsLocale()) { - Log.report(logvisor::Fatal, fmt("X does not support locale {}."), setlocale(LC_ALL, nullptr)); + Log.report(logvisor::Fatal, FMT_STRING("X does not support locale {}."), setlocale(LC_ALL, nullptr)); return; } if (XSetLocaleModifiers("") == nullptr) - Log.report(logvisor::Warning, fmt("Cannot set locale modifiers.")); + Log.report(logvisor::Warning, FMT_STRING("Cannot set locale modifiers.")); if ((m_xIM = XOpenIM(m_xDisp, nullptr, nullptr, nullptr))) { char** missing_charsets; @@ -338,7 +338,7 @@ public: } /* if we couldn't support any of them, print an error and exit */ if (m_bestStyle == 0) { - Log.report(logvisor::Fatal, fmt("interaction style not supported.")); + Log.report(logvisor::Fatal, FMT_STRING("interaction style not supported.")); return; } XFree(im_supported_styles); diff --git a/lib/x11/WindowXlib.cpp b/lib/x11/WindowXlib.cpp index 301fdb7..c4163ec 100644 --- a/lib/x11/WindowXlib.cpp +++ b/lib/x11/WindowXlib.cpp @@ -305,7 +305,7 @@ public: int numFBConfigs = 0; fbConfigs = glXGetFBConfigs(display, defaultScreen, &numFBConfigs); if (!fbConfigs || numFBConfigs == 0) { - Log.report(logvisor::Fatal, fmt("glXGetFBConfigs failed")); + Log.report(logvisor::Fatal, FMT_STRING("glXGetFBConfigs failed")); return; } @@ -351,7 +351,7 @@ public: XFree(fbConfigs); if (!m_fbconfig) { - Log.report(logvisor::Fatal, fmt("unable to find suitable pixel format")); + Log.report(logvisor::Fatal, FMT_STRING("unable to find suitable pixel format")); return; } @@ -394,7 +394,7 @@ public: glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)glXGetProcAddressARB((const GLubyte*)"glXCreateContextAttribsARB"); if (!glXCreateContextAttribsARB) - Log.report(logvisor::Fatal, fmt("unable to resolve glXCreateContextAttribsARB")); + Log.report(logvisor::Fatal, FMT_STRING("unable to resolve glXCreateContextAttribsARB")); } s_glxError = false; @@ -406,16 +406,16 @@ public: } XSetErrorHandler(oldHandler); if (!m_glxCtx) - Log.report(logvisor::Fatal, fmt("unable to make new GLX context")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make new GLX context")); m_glxWindow = glXCreateWindow(m_xDisp, m_fbconfig, m_parentWindow->getPlatformHandle(), nullptr); if (!m_glxWindow) - Log.report(logvisor::Fatal, fmt("unable to make new GLX window")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make new GLX window")); _XlibUpdateLastGlxCtx(m_glxCtx); if (!glXMakeCurrent(m_xDisp, DefaultRootWindow(m_xDisp), m_glxCtx)) - Log.report(logvisor::Fatal, fmt("unable to make GLX context current")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make GLX context current")); if (glewInit() != GLEW_OK) - Log.report(logvisor::Fatal, fmt("glewInit failed")); + Log.report(logvisor::Fatal, FMT_STRING("glewInit failed")); glXMakeCurrent(m_xDisp, 0, 0); XUnlockDisplay(m_xDisp); @@ -429,7 +429,7 @@ public: void makeCurrent() override { XLockDisplay(m_xDisp); if (!glXMakeContextCurrent(m_xDisp, m_glxWindow, m_glxWindow, m_glxCtx)) - Log.report(logvisor::Fatal, fmt("unable to make GLX context current")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make GLX context current")); XUnlockDisplay(m_xDisp); } @@ -452,10 +452,10 @@ public: m_mainCtx = glXCreateContextAttribsARB(m_xDisp, m_fbconfig, m_glxCtx, true, ContextAttribList[m_attribIdx]); XSetErrorHandler(oldHandler); if (!m_mainCtx) - Log.report(logvisor::Fatal, fmt("unable to make main GLX context")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make main GLX context")); } if (!glXMakeContextCurrent(m_xDisp, m_glxWindow, m_glxWindow, m_mainCtx)) - Log.report(logvisor::Fatal, fmt("unable to make main GLX context current")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make main GLX context current")); XUnlockDisplay(m_xDisp); return getDataFactory(); } @@ -468,10 +468,10 @@ public: m_loadCtx = glXCreateContextAttribsARB(m_xDisp, m_fbconfig, m_glxCtx, true, ContextAttribList[m_attribIdx]); XSetErrorHandler(oldHandler); if (!m_loadCtx) - Log.report(logvisor::Fatal, fmt("unable to make load GLX context")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make load GLX context")); } if (!glXMakeContextCurrent(m_xDisp, m_glxWindow, m_glxWindow, m_loadCtx)) - Log.report(logvisor::Fatal, fmt("unable to make load GLX context current")); + Log.report(logvisor::Fatal, FMT_STRING("unable to make load GLX context current")); XUnlockDisplay(m_xDisp); return getDataFactory(); } @@ -495,7 +495,7 @@ struct GraphicsContextXlibVulkan : GraphicsContextXlib { static void ThrowIfFailed(VkResult res) { if (res != VK_SUCCESS) - Log.report(logvisor::Fatal, fmt("{}\n"), res); + Log.report(logvisor::Fatal, FMT_STRING("{}\n"), res); } public: @@ -579,19 +579,19 @@ 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::GetPhysicalDeviceXcbPresentationSupportKHR(m_ctx->m_gpus[0], m_ctx->m_graphicsQueueFamilyIndex, m_xcbConn, m_visualid)) { - Log.report(logvisor::Fatal, fmt("XCB visual doesn't support vulkan present")); + Log.report(logvisor::Fatal, FMT_STRING("XCB visual doesn't support vulkan present")); return false; } @@ -625,10 +625,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); @@ -734,7 +734,7 @@ public: m_gfxCtx.reset(new GraphicsContextXlibGLX(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this, display, defaultScreen, lastCtx, m_visualId, glCtx)); m_openGL = true; - Log.report(logvisor::Warning, fmt("OPENGL HAS BEEN DEPRECATED, IT IS HIGHLY RECOMMENDED TO BUILD AND USE VULKAN INSTEAD")); + Log.report(logvisor::Warning, FMT_STRING("OPENGL HAS BEEN DEPRECATED, IT IS HIGHLY RECOMMENDED TO BUILD AND USE VULKAN INSTEAD")); } XVisualInfo visTemplate; @@ -1182,13 +1182,13 @@ public: if (XGetWindowProperty(m_xDisp, m_windowId, S_ATOMS->m_clipdata, 0, 32, false, AnyPropertyType, &type, &format, &nitems, &rem, &data)) { - Log.report(logvisor::Fatal, fmt("Clipboard allocation failed")); + Log.report(logvisor::Fatal, FMT_STRING("Clipboard allocation failed")); XUnlockDisplay(m_xDisp); return {}; } if (rem != 0) { - Log.report(logvisor::Fatal, fmt("partial clipboard read")); + Log.report(logvisor::Fatal, FMT_STRING("partial clipboard read")); XUnlockDisplay(m_xDisp); return {}; } @@ -1606,7 +1606,7 @@ public: getWindowFrame(m_wrect.location[0], m_wrect.location[1], m_wrect.size[0], m_wrect.size[1]); switch (event->xgeneric.evtype) { case XI_Motion: { - fmt::print(stderr, fmt("motion\n")); + fmt::print(stderr, FMT_STRING("motion\n")); XIDeviceEvent* ev = (XIDeviceEvent*)event; if (m_lastInputID != ev->deviceid) diff --git a/logvisor b/logvisor index 27814c5..d62b4ce 160000 --- a/logvisor +++ b/logvisor @@ -1 +1 @@ -Subproject commit 27814c527622538d384336c4d43cf5b4b6869859 +Subproject commit d62b4ce26e4eb7f70126173a10a58bc858fecc02