From 39dc3133470bd48e34a70a62cd8a41d3534487d6 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: Fri, 2 Jan 2026 08:16:11 -0800 Subject: [PATCH] shaderc: Pass interpolator qualifiers into all stages. --- tools/shaderc/shaderc.cpp | 25 +++++++++++-------------- tools/shaderc/shaderc_metal.cpp | 2 +- tools/shaderc/shaderc_spirv.cpp | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index 307643867..78b405403 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -367,6 +367,7 @@ namespace bgfx va_end(argList); } + Options::Options() : shaderType(' ') , disasm(false) @@ -1220,6 +1221,7 @@ namespace bgfx else if (0 == bx::strCmpI(platform, "linux") ) { preprocessor.setDefine("BX_PLATFORM_LINUX=1"); + if (profile->lang == ShadingLang::SpirV) { preprocessor.setDefine("BGFX_SHADER_LANGUAGE_SPIRV=1"); @@ -1229,17 +1231,17 @@ namespace bgfx preprocessor.setDefine(glslDefine); } } - else if ( - 0 == bx::strCmpI(platform, "ios") || - 0 == bx::strCmpI(platform, "osx") || - 0 == bx::strCmpI(platform, "visionos") - ) + else if (0 == bx::strCmpI(platform, "ios") + || 0 == bx::strCmpI(platform, "osx") + || 0 == bx::strCmpI(platform, "visionos") + ) { if (0 == bx::strCmpI(platform, "osx")) { preprocessor.setDefine("BX_PLATFORM_OSX=1"); } - else if (0 == bx::strCmpI(platform, "visionos")) { + else if (0 == bx::strCmpI(platform, "visionos")) + { preprocessor.setDefine("BX_PLATFORM_VISIONOS=1"); } else @@ -1257,7 +1259,7 @@ namespace bgfx , sizeof(temp) , "BGFX_SHADER_LANGUAGE_METAL=%d" , (profile->lang == ShadingLang::Metal) ? profile->id : 0 - ); + ); preprocessor.setDefine(temp); } else if (0 == bx::strCmpI(platform, "windows") ) @@ -1359,13 +1361,8 @@ namespace bgfx || 0 == bx::strCmp(typen, "noperspective", 13) || 0 == bx::strCmp(typen, "centroid", 8) ) { - if ('f' == _options.shaderType - || profile->lang == ShadingLang::GLSL - || profile->lang == ShadingLang::ESSL) - { - interpolation = typen; - usesInterpolationQualifiers = true; - } + interpolation = typen; + usesInterpolationQualifiers = true; typen = nextWord(parse); } diff --git a/tools/shaderc/shaderc_metal.cpp b/tools/shaderc/shaderc_metal.cpp index 70d404442..38ea79afe 100644 --- a/tools/shaderc/shaderc_metal.cpp +++ b/tools/shaderc/shaderc_metal.cpp @@ -603,8 +603,8 @@ namespace bgfx { namespace metal }; opt.SetMessageConsumer(print_msg_to_stderr); - opt.RegisterLegalizationPasses(); + opt.RegisterPerformancePasses(); spvtools::ValidatorOptions validatorOptions; validatorOptions.SetBeforeHlslLegalization(true); diff --git a/tools/shaderc/shaderc_spirv.cpp b/tools/shaderc/shaderc_spirv.cpp index c085dbcc3..bad39c2cc 100644 --- a/tools/shaderc/shaderc_spirv.cpp +++ b/tools/shaderc/shaderc_spirv.cpp @@ -732,8 +732,8 @@ namespace bgfx { namespace spirv }; opt.SetMessageConsumer(print_msg_to_stderr); - opt.RegisterLegalizationPasses(); + opt.RegisterPerformancePasses(); spvtools::ValidatorOptions validatorOptions; validatorOptions.SetBeforeHlslLegalization(true);