From 22df26ab70acb3f36018796fbe952751fa91a9f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Wed, 15 Jul 2020 10:42:23 -0700 Subject: [PATCH] Cleanup. --- tools/shaderc/shaderc.h | 12 ++++++------ tools/shaderc/shaderc_glsl.cpp | 4 ++-- tools/shaderc/shaderc_hlsl.cpp | 20 ++++++++++---------- tools/shaderc/shaderc_pssl.cpp | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tools/shaderc/shaderc.h b/tools/shaderc/shaderc.h index 626e6cd76..3ed7bff24 100644 --- a/tools/shaderc/shaderc.h +++ b/tools/shaderc/shaderc.h @@ -11,12 +11,12 @@ namespace bgfx extern bool g_verbose; } -#define _BX_TRACE(_format, ...) \ - BX_MACRO_BLOCK_BEGIN \ - if (bgfx::g_verbose) \ - { \ - fprintf(stdout, BX_FILE_LINE_LITERAL "" _format "\n", ##__VA_ARGS__); \ - } \ +#define _BX_TRACE(_format, ...) \ + BX_MACRO_BLOCK_BEGIN \ + if (bgfx::g_verbose) \ + { \ + bx::printf(BX_FILE_LINE_LITERAL "" _format "\n", ##__VA_ARGS__); \ + } \ BX_MACRO_BLOCK_END #define _BX_WARN(_condition, _format, ...) \ diff --git a/tools/shaderc/shaderc_glsl.cpp b/tools/shaderc/shaderc_glsl.cpp index 987924d33..c2c06b527 100644 --- a/tools/shaderc/shaderc_glsl.cpp +++ b/tools/shaderc/shaderc_glsl.cpp @@ -61,7 +61,7 @@ namespace bgfx { namespace glsl } printCode(_code.c_str(), line, start, end, column); - fprintf(stderr, "Error: %s\n", log); + bx::printf("Error: %s\n", log); glslopt_shader_delete(shader); glslopt_cleanup(ctx); return false; @@ -302,7 +302,7 @@ namespace bgfx { namespace glsl } } char uniformName[256]; - bx::strCopy(uniformName, parse.getLength() + 1, parse); + bx::strCopy(uniformName, parse.getLength() + 1, parse); un.name = uniformName; const char* regIndexBeg = textureName.getPtr() + textureNameMark.getLength(); bx::StringView regIndex = bx::strFind(regIndexBeg, ")"); diff --git a/tools/shaderc/shaderc_hlsl.cpp b/tools/shaderc/shaderc_hlsl.cpp index d24871cd4..57986d189 100644 --- a/tools/shaderc/shaderc_hlsl.cpp +++ b/tools/shaderc/shaderc_hlsl.cpp @@ -115,7 +115,7 @@ namespace bgfx { namespace hlsl return compiler; } - fprintf(stderr, "Error: Unable to open D3DCompiler_*.dll shader compiler.\n"); + bx::printf("Error: Unable to open D3DCompiler_*.dll shader compiler.\n"); return NULL; } @@ -311,7 +311,7 @@ namespace bgfx { namespace hlsl uint32_t tableSize = (commentSize - 1) * 4; if (tableSize < sizeof(CTHeader) || header->Size != sizeof(CTHeader) ) { - fprintf(stderr, "Error: Invalid constant table data\n"); + bx::printf("Error: Invalid constant table data\n"); return false; } break; @@ -323,7 +323,7 @@ namespace bgfx { namespace hlsl if (!header) { - fprintf(stderr, "Error: Could not find constant table data\n"); + bx::printf("Error: Could not find constant table data\n"); return false; } @@ -390,7 +390,7 @@ namespace bgfx { namespace hlsl ); if (FAILED(hr) ) { - fprintf(stderr, "Error: D3DReflect failed 0x%08x\n", (uint32_t)hr); + bx::printf("Error: D3DReflect failed 0x%08x\n", (uint32_t)hr); return false; } @@ -398,7 +398,7 @@ namespace bgfx { namespace hlsl hr = reflect->GetDesc(&desc); if (FAILED(hr) ) { - fprintf(stderr, "Error: ID3D11ShaderReflection::GetDesc failed 0x%08x\n", (uint32_t)hr); + bx::printf("Error: ID3D11ShaderReflection::GetDesc failed 0x%08x\n", (uint32_t)hr); return false; } @@ -551,7 +551,7 @@ namespace bgfx { namespace hlsl if (profile[0] == '\0') { - fprintf(stderr, "Error: Shader profile must be specified.\n"); + bx::printf("Error: Shader profile must be specified.\n"); return false; } @@ -646,7 +646,7 @@ namespace bgfx { namespace hlsl } printCode(_code.c_str(), line, start, end, column); - fprintf(stderr, "Error: D3DCompile failed 0x%08x %s\n", (uint32_t)hr, log); + bx::printf("Error: D3DCompile failed 0x%08x %s\n", (uint32_t)hr, log); errorMsg->Release(); return false; } @@ -660,7 +660,7 @@ namespace bgfx { namespace hlsl { if (!getReflectionDataD3D9(code, uniforms) ) { - fprintf(stderr, "Error: Unable to get D3D9 reflection data.\n"); + bx::printf("Error: Unable to get D3D9 reflection data.\n"); goto error; } } @@ -669,7 +669,7 @@ namespace bgfx { namespace hlsl UniformNameList unusedUniforms; if (!getReflectionDataD3D11(code, profile[0] == 'v', uniforms, numAttrs, attrs, size, unusedUniforms) ) { - fprintf(stderr, "Error: Unable to get D3D11 reflection data.\n"); + bx::printf("Error: Unable to get D3D11 reflection data.\n"); goto error; } @@ -833,7 +833,7 @@ namespace bgfx bool compileHLSLShader(const Options& _options, uint32_t _version, const std::string& _code, bx::WriterI* _writer) { BX_UNUSED(_options, _version, _code, _writer); - fprintf(stderr, "HLSL compiler is not supported on this platform.\n"); + bx::printf("HLSL compiler is not supported on this platform.\n"); return false; } diff --git a/tools/shaderc/shaderc_pssl.cpp b/tools/shaderc/shaderc_pssl.cpp index b6aa62637..d9382d65b 100644 --- a/tools/shaderc/shaderc_pssl.cpp +++ b/tools/shaderc/shaderc_pssl.cpp @@ -10,7 +10,7 @@ namespace bgfx bool compilePSSLShader(const Options& _options, uint32_t _version, const std::string& _code, bx::WriterI* _writer) { BX_UNUSED(_options, _version, _code, _writer); - fprintf(stderr, "PSSL compiler is not supported.\n"); + bx::printf("PSSL compiler is not supported.\n"); return false; }