Update fmtlib

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

View File

@@ -77,7 +77,7 @@ static inline void ThrowIfFailed(HRESULT hr) {
_com_error err(hr, L"D3D11 fail");
#endif
LPCTSTR errMsg = err.ErrorMessage();
Log.report(logvisor::Fatal, fmt(_SYS_STR("{}")), errMsg);
Log.report(logvisor::Fatal, FMT_STRING(_SYS_STR("{}")), errMsg);
}
}
@@ -194,7 +194,7 @@ class D3D11TextureS : public GraphicsDataNode<ITextureS> {
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<ITextureSA> {
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<ITextureD> {
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<ITextureR> {
, 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<IShaderDataBinding> {
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<IShaderDataBinding> {
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<D3D11TextureR>()) {
#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<uint8_t> D3D11DataFactory::CompileHLSL(const char* source, PipelineS
ComPtr<ID3DBlob> 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<uint8_t> ret(blobOut->GetBufferSize());

View File

@@ -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<ITextureS> {
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<ITextureSA> {
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<ITextureD> {
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<IShaderStage> {
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<IShaderStage> {
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<IShaderStage> {
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<IShaderStage> {
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<IShaderStage> {
glGetShaderiv(m_shad, GL_INFO_LOG_LENGTH, &logLen);
std::unique_ptr<char[]> 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<char[]> 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<IShaderStage> 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<IShaderPipeline> 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<std::mutex> 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<GLTextureR>()) {
#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<BaseGraphicsData>& 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<BaseGraphicsData>& d, const ObjToken<IShaderP
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"), i);
Log.report(logvisor::Fatal, FMT_STRING("non-256-byte-aligned uniform-offset {} provided to newShaderDataBinding"), i);
}
#endif
m_ubufOffs.emplace_back(ubufOffs[i], (ubufSizes[i] + 255) & ~255);
@@ -2028,7 +2028,7 @@ GLShaderDataBinding(const ObjToken<BaseGraphicsData>& d, const ObjToken<IShaderP
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]);

View File

@@ -6,9 +6,9 @@ static logvisor::Module Log("boo::GLX");
void GLXExtensionCheck() {
if (!GLXEW_SGI_video_sync)
Log.report(logvisor::Fatal, fmt("GLX_SGI_video_sync not available"));
Log.report(logvisor::Fatal, FMT_STRING("GLX_SGI_video_sync not available"));
if (!GLXEW_EXT_swap_control && !GLXEW_MESA_swap_control && !GLXEW_SGI_swap_control)
Log.report(logvisor::Fatal, fmt("swap_control not available"));
Log.report(logvisor::Fatal, FMT_STRING("swap_control not available"));
}
void GLXEnableVSync(Display* disp, GLXWindow drawable) {

View File

@@ -366,7 +366,7 @@ class MetalTextureD : public GraphicsDataNode<ITextureD> {
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<ITextureR> {
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<IShaderStage> {
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<IShaderDataBinding> {
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<IShaderDataBinding> {
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]);

View File

@@ -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<VulkanContext::LayerProperties>&
}
}
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<ITextureS> {
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<ITextureSA> {
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<ITextureD> {
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<IShaderDataBinding> {
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<IShaderDataBinding> {
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<IShaderDataBinding> {
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<VulkanTextureR>();
#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<BaseGraphicsData>& 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<IShaderStage> 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<IShaderPipeline> 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<uint8_t> 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<unsigned int> out;

View File

@@ -319,7 +319,7 @@ class NXTextureS : public GraphicsDataNode<ITextureS> {
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<ITextureS> {
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<ITextureSA> {
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<ITextureSA> {
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<ITextureR> {
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<ITextureR> {
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<ITextureR> {
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<ITextureR> {
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<ITextureR> {
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<ITextureR> {
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<ITextureR> {
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<ITextureR> {
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<ITextureR> {
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<ITextureR> {
TextureClampMode clampMode, size_t colorBindCount, size_t depthBindCount)
: GraphicsDataNode<ITextureR>(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<IShaderStage> {
PipelineStage stage)
: GraphicsDataNode<IShaderStage>(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<IShaderDataBinding> {
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<IShaderDataBinding> {
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<NXTextureR>();
#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<BaseGraphicsData>& 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<BaseGraphicsData>& 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;
}