You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is problematic state management of _cachedBlendMode and curBlendMode in RendererGL. This was introduced by an optimization to RendererGL._applyBlendMode that tries to avoid unnecessary GL calls by caching the last applied blend mode. The problem is that erase() and noErase() also change _cachedBlendMode.
_cachedBlendMode is being used here to do two conceptually different things.
only do a call to gl.blendFunc() when the new GL blend mode is different than the applied blend mode. This makes it so that if someone calls blendMode() every frame, it won't do unnecessary GL calls.
It is used to store the blend mode before calls to erase() so that the previous blend mode can be applied after noErase().
To further complicate things, these two uses mutate _cachedBlendMode() asynchronously from one another because _applyBlendMode is only called upon rendering.
Another property that is something likepreEraseBlend could be added to RendererGL but then the _cachedBlendMode use between Renderer2D and RendererGL would diverge because Renderer2D only uses _cachedBlendMode to track pre/post eraser blends since it doesn't need the GL optimizations.
This is all to say that the blend state management in RendererGL is very tricky currently and probably should be restructured.
The text was updated successfully, but these errors were encountered:
There is problematic state management of
_cachedBlendMode
andcurBlendMode
in RendererGL. This was introduced by an optimization toRendererGL._applyBlendMode
that tries to avoid unnecessary GL calls by caching the last applied blend mode. The problem is thaterase()
andnoErase()
also change_cachedBlendMode
._cachedBlendMode
is being used here to do two conceptually different things.gl.blendFunc()
when the new GL blend mode is different than the applied blend mode. This makes it so that if someone callsblendMode()
every frame, it won't do unnecessary GL calls.erase()
so that the previous blend mode can be applied afternoErase()
.To further complicate things, these two uses mutate
_cachedBlendMode()
asynchronously from one another because_applyBlendMode
is only called upon rendering.Another property that is something like
preEraseBlend
could be added to RendererGL but then the_cachedBlendMode
use between Renderer2D and RendererGL would diverge because Renderer2D only uses_cachedBlendMode
to track pre/post eraser blends since it doesn't need the GL optimizations.This is all to say that the blend state management in RendererGL is very tricky currently and probably should be restructured.
The text was updated successfully, but these errors were encountered: