[Fix] (MG_Impl/GLImpl, MG_State/GLState): fix frag data location queries [skip ci]

This commit is contained in:
2026-07-02 16:20:43 +08:00
parent 76f5a23b7f
commit b9de562491
5 changed files with 46 additions and 2 deletions
@@ -286,10 +286,15 @@ namespace {
if (stage == MobileGL::ShaderStage::Fragment) {
ReplaceIdentifier(source, "varying", "in");
const bool usesFragColor = source.find("gl_FragColor") != MobileGL::String::npos;
const bool usesFragData = source.find("gl_FragData") != MobileGL::String::npos;
if (usesFragColor) {
ReplaceIdentifier(source, "gl_FragColor", "mg_FragColor");
source.insert(FindAfterVersionDirective(source), "out vec4 mg_FragColor;\n");
}
if (usesFragData) {
ReplaceIdentifier(source, "gl_FragData", "mg_FragData");
source.insert(FindAfterVersionDirective(source), "layout(location = 0) out vec4 mg_FragData[8];\n");
}
}
}