mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-07 19:58:32 +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;
|
||||
}
|
||||
|
||||
void UnbindTexture(Uint unit, GLenum target) { // Active unit will be modified
|
||||
if (unit != g_activeTextureUnit) {
|
||||
ActivateTextureUnit(unit);
|
||||
}
|
||||
|
||||
void UnbindTexture(Uint unit, GLenum target) { // Activates `unit` when an unbind is issued
|
||||
auto targetN = static_cast<SizeT>(MG_Util::ConvertGLEnumToTextureTarget(target));
|
||||
if (g_boundTexturesCache[unit][targetN] == nullptr) return;
|
||||
|
||||
ActivateTextureUnit(unit);
|
||||
g_GLESFuncs.glBindTexture(target, 0);
|
||||
g_boundTexturesCache[unit][targetN] = nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user