From 3e5bfb81b662d5a48de0025eb5fa39995ce7ac45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 30 Sep 2023 16:53:30 -0700 Subject: [PATCH] shaderc: Must have profile specified. --- tools/shaderc/shaderc.cpp | 46 ++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index 9da606082..4d49d396c 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -90,8 +90,8 @@ namespace bgfx struct Profile { ShadingLang::Enum lang; - uint32_t id; - const char* name; + uint32_t id; + const bx::StringLiteral name; }; static const Profile s_profiles[] = @@ -1075,41 +1075,37 @@ namespace bgfx return word; } - bool compileShader(const char* _varying, const char* _comment, char* _shader, uint32_t _shaderLen, Options& _options, bx::WriterI* _shaderWriter, bx::WriterI* _messageWriter) + bool compileShader(const char* _varying, const char* _comment, char* _shader, uint32_t _shaderLen, const Options& _options, bx::WriterI* _shaderWriter, bx::WriterI* _messageWriter) { bx::ErrorAssert messageErr; - uint32_t profile_id = 0; + uint32_t profileId = 0; - const char* profile_opt = _options.profile.c_str(); - if ('\0' != profile_opt[0]) + const bx::StringView profileOpt(_options.profile.c_str() ); + if (!profileOpt.isEmpty() ) { const uint32_t count = BX_COUNTOF(s_profiles); - for (profile_id=0; profile_idlang == ShadingLang::ESSL, _messageWriter); @@ -1152,17 +1148,17 @@ namespace bgfx || profile->lang == ShadingLang::ESSL) { bx::snprintf(glslDefine, BX_COUNTOF(glslDefine) - , "BGFX_SHADER_LANGUAGE_GLSL=%d" - , profile->id - ); + , "BGFX_SHADER_LANGUAGE_GLSL=%d" + , profile->id + ); } char hlslDefine[128]; if (profile->lang == ShadingLang::HLSL) { bx::snprintf(hlslDefine, BX_COUNTOF(hlslDefine) - , "BGFX_SHADER_LANGUAGE_HLSL=%d" - , profile->id); + , "BGFX_SHADER_LANGUAGE_HLSL=%d" + , profile->id); } const char* platform = _options.platform.c_str();