2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 05:47:42 +00:00

hecl/Compilers: Convert printf call over to fmt::print

Same behavior, but properly handles the case where the given string_view
may not be null terminated.
This commit is contained in:
Lioncash
2019-08-23 11:49:53 -04:00
parent 3b60cee576
commit 73cf8df409

View File

@@ -1,14 +1,17 @@
#include "hecl/Compilers.hpp" #include "hecl/Compilers.hpp"
#include "boo/graphicsdev/GLSLMacros.hpp" #include <boo/graphicsdev/GLSLMacros.hpp>
#include "logvisor/logvisor.hpp" #include <logvisor/logvisor.hpp>
#include <glslang/Public/ShaderLang.h> #include <glslang/Public/ShaderLang.h>
#include <StandAlone/ResourceLimits.h> #include <StandAlone/ResourceLimits.h>
#include <SPIRV/GlslangToSpv.h> #include <SPIRV/GlslangToSpv.h>
#include <SPIRV/disassemble.h> #include <SPIRV/disassemble.h>
#if _WIN32 #if _WIN32
#include <d3dcompiler.h> #include <d3dcompiler.h>
extern pD3DCompile D3DCompilePROC; extern pD3DCompile D3DCompilePROC;
#endif #endif
#if __APPLE__ #if __APPLE__
#include <unistd.h> #include <unistd.h>
#include <memory> #include <memory>
@@ -82,7 +85,7 @@ struct ShaderCompiler<PlatformType::D3D11> {
ComPtr<ID3DBlob> blobOut; ComPtr<ID3DBlob> blobOut;
if (FAILED(D3DCompilePROC(text.data(), text.size(), "Boo HLSL Source", nullptr, nullptr, "main", if (FAILED(D3DCompilePROC(text.data(), text.size(), "Boo HLSL Source", nullptr, nullptr, "main",
D3DShaderTypes[int(S::Enum)], BOO_D3DCOMPILE_FLAG, 0, &blobOut, &errBlob))) { D3DShaderTypes[int(S::Enum)], BOO_D3DCOMPILE_FLAG, 0, &blobOut, &errBlob))) {
printf("%s\n", text.data()); fmt::print(fmt("{}\n"), text);
Log.report(logvisor::Fatal, fmt("error compiling shader: {}"), (char*)errBlob->GetBufferPointer()); Log.report(logvisor::Fatal, fmt("error compiling shader: {}"), (char*)errBlob->GetBufferPointer());
return {}; return {};
} }