mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 13:48:30 +09:00
[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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user