From d256408218c350de3faa1a9574584e84887a561b Mon Sep 17 00:00:00 2001 From: Sam <3194321+SamHellawell@users.noreply.github.com> Date: Fri, 23 Dec 2022 00:28:42 +0000 Subject: [PATCH] Update shaderc.cpp --- tools/shaderc/shaderc.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index a8c284c14a..052cbd3c30 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -76,6 +76,7 @@ namespace bgfx // 4.2 420 11.0 vhdgf+c 5.0 // 4.3 430 vhdgf+c // 4.4 440 + // 4.6 460 // // SPIR-V profile naming convention: // spirv- @@ -119,6 +120,7 @@ namespace bgfx { ShadingLang::GLSL, 420, "420" }, { ShadingLang::GLSL, 430, "430" }, { ShadingLang::GLSL, 440, "440" }, + { ShadingLang::GLSL, 460, "460" }, }; static const char* s_ARB_shader_texture_lod[] = @@ -1704,7 +1706,9 @@ namespace bgfx { bx::StringView shader(input); bx::StringView entry = bx::strFind(shader, "void main()"); - if (entry.isEmpty() ) + bx::StringView entryCustom = bx::strFind(shader, "void main("); + const bool useCustomMain = entry.isEmpty() && !entryCustom.isEmpty(); + if (entry.isEmpty() && !useCustomMain) { bx::printf("Shader entry point 'void main()' is not found.\n"); } @@ -1833,7 +1837,7 @@ namespace bgfx *const_cast(entry.getPtr() + 4) = '_'; - if ('f' == _options.shaderType) + if ('f' == _options.shaderType && !useCustomMain) { bx::StringView insert = bx::strFind(bx::StringView(entry.getPtr(), shader.getTerm() ), "{"); if (!insert.isEmpty() )