From 287893971240210c40fcb6353addb072f8fbc4b7 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Thu, 13 Nov 2025 12:20:07 +0800 Subject: [PATCH] [Fix]: (MG_Util/ShaderTranspiler): add `explicitFragmentOutLocations` to program link attribs --- MobileGL/MG_Util/ShaderTranspiler/ShaderCompiler.cpp | 6 ++++-- MobileGL/MG_Util/ShaderTranspiler/Types.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/MobileGL/MG_Util/ShaderTranspiler/ShaderCompiler.cpp b/MobileGL/MG_Util/ShaderTranspiler/ShaderCompiler.cpp index a8e5e722..13834e7b 100644 --- a/MobileGL/MG_Util/ShaderTranspiler/ShaderCompiler.cpp +++ b/MobileGL/MG_Util/ShaderTranspiler/ShaderCompiler.cpp @@ -174,7 +174,7 @@ namespace MobileGL { return std::unexpected(r); } - for (auto [name, loc]: attrib.explicitAttribLocations) { + for (auto [name, loc]: attrib.explicitVertexInLocations) { MGLOG_D("%s: got explicitly set - layout(location = %d) %s;", __func__, loc, name.c_str()); } @@ -183,7 +183,9 @@ namespace MobileGL { for (unsigned stage = 0; stage < EShLangCount; stage++) { if (program->getIntermediate((EShLanguage)stage) == nullptr) continue; - resolver = MakeUnique(*program, (EShLanguage)stage, attrib.explicitAttribLocations); + resolver = MakeUnique(*program, (EShLanguage)stage, + attrib.explicitVertexInLocations, + attrib.explicitFragmentOutLocations); break; } auto ioMapper = UniquePtr(glslang::GetGlslIoMapper()); diff --git a/MobileGL/MG_Util/ShaderTranspiler/Types.h b/MobileGL/MG_Util/ShaderTranspiler/Types.h index 30ad27bd..409e93fc 100644 --- a/MobileGL/MG_Util/ShaderTranspiler/Types.h +++ b/MobileGL/MG_Util/ShaderTranspiler/Types.h @@ -21,7 +21,8 @@ namespace MobileGL { struct ProgramAttrib { Vector> shaders; - UnorderedMap explicitAttribLocations; + UnorderedMap explicitVertexInLocations; + UnorderedMap explicitFragmentOutLocations; }; struct ProgramBinaryAttrib {