mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-13 04:53:23 +09:00
[MG_Backend, MG_Test] (P12 review): the ended server session's texture and sampler unit shadows are emptied with its twins, so the next session's binds are not skipped against freed twins
Major. DropEveryTwinForEndedServerSession drops every twin with InProcessTeardown() answering true, which is exactly the case in which a texture / sampler twin's destructor does NOT scrub itself out of TextureImpl::g_boundTexturesCache / SamplerImpl::g_boundSamplersCache. The shadows kept raw pointers to freed twins; the next in-process session's twin allocated at a recycled address read "already bound" and skipped its glBindTexture / glBindSampler on a context where nothing was bound, so its uploads went to texture 0 and it rendered black. The drop now empties both shadows and puts the active-unit shadow back to 0 (the new context's GL_TEXTURE0). SanityTest EsprytServerSession.TheServerBackendsDestructionEmptiesTheTextureAndSamplerUnitShadows (split build only; the pull build is unchanged, G1).
This commit is contained in:
@@ -421,6 +421,16 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
TextureImpl::g_backendTextureObjects = {};
|
||||
RenderbufferImpl::g_backendRenderbufferObjects = {};
|
||||
BufferImpl::g_backendBufferResources = {};
|
||||
// P12 review fix (major): AND THE UNIT SHADOWS THAT POINT AT THEM. A texture or sampler twin
|
||||
// scrubs itself out of g_boundTexturesCache / g_boundSamplersCache in its destructor - but
|
||||
// not under InProcessTeardown(), which answered true for every twin just dropped. Left
|
||||
// behind, those raw pointers name freed twins; the next session's twin allocated at the same
|
||||
// address then reads "already bound" and skips its glBindTexture / glBindSampler on a
|
||||
// context where nothing is bound, so its uploads land on texture 0 and it samples black.
|
||||
// The new context's active unit is GL_TEXTURE0, so the active-unit shadow goes back to 0 too.
|
||||
TextureImpl::g_boundTexturesCache = {};
|
||||
TextureImpl::g_activeTextureUnit = 0;
|
||||
SamplerImpl::g_boundSamplersCache = {};
|
||||
g_serverSessionTwinTeardown = false;
|
||||
MGLOG_I("DirectGLES: the ended server session's twins are dropped (every kind, no driver call); the next "
|
||||
"session in this process starts from empty twin tables");
|
||||
|
||||
Reference in New Issue
Block a user