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
1 changed files with 6 additions and 3 deletions

View File

@ -1,14 +1,17 @@
#include "hecl/Compilers.hpp"
#include "boo/graphicsdev/GLSLMacros.hpp"
#include "logvisor/logvisor.hpp"
#include <boo/graphicsdev/GLSLMacros.hpp>
#include <logvisor/logvisor.hpp>
#include <glslang/Public/ShaderLang.h>
#include <StandAlone/ResourceLimits.h>
#include <SPIRV/GlslangToSpv.h>
#include <SPIRV/disassemble.h>
#if _WIN32
#include <d3dcompiler.h>
extern pD3DCompile D3DCompilePROC;
#endif
#if __APPLE__
#include <unistd.h>
#include <memory>
@ -82,7 +85,7 @@ struct ShaderCompiler<PlatformType::D3D11> {
ComPtr<ID3DBlob> blobOut;
if (FAILED(D3DCompilePROC(text.data(), text.size(), "Boo HLSL Source", nullptr, nullptr, "main",
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());
return {};
}