[Perf] (MG_Backend/DirectGLES): check the unbind cache before activating the texture unit so the bind-0 sweep stops issuing redundant glActiveTexture per draw

This commit is contained in:
2026-07-17 21:32:16 -04:00
parent 92cced9bcc
commit abfda60ff1
+2 -5
View File
@@ -2285,14 +2285,11 @@ namespace MobileGL::MG_Backend::DirectGLES {
g_activeTextureUnit = unit; g_activeTextureUnit = unit;
} }
void UnbindTexture(Uint unit, GLenum target) { // Active unit will be modified void UnbindTexture(Uint unit, GLenum target) { // Activates `unit` when an unbind is issued
if (unit != g_activeTextureUnit) {
ActivateTextureUnit(unit);
}
auto targetN = static_cast<SizeT>(MG_Util::ConvertGLEnumToTextureTarget(target)); auto targetN = static_cast<SizeT>(MG_Util::ConvertGLEnumToTextureTarget(target));
if (g_boundTexturesCache[unit][targetN] == nullptr) return; if (g_boundTexturesCache[unit][targetN] == nullptr) return;
ActivateTextureUnit(unit);
g_GLESFuncs.glBindTexture(target, 0); g_GLESFuncs.glBindTexture(target, 0);
g_boundTexturesCache[unit][targetN] = nullptr; g_boundTexturesCache[unit][targetN] = nullptr;
} }