mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-07 19:58:32 +09:00
[Fix] (MG_Backend/DirectGLES): re-push the texture parameters a regenerated driver texture has lost, instead of trusting caches that outlived it
This commit is contained in:
@@ -1964,6 +1964,20 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
m_isInitialized = false;
|
||||
m_backendStorageImmutable = false;
|
||||
m_prevTextureInfo = {};
|
||||
// The new ES texture starts at the ES defaults, so every parameter this object had
|
||||
// already pushed onto the old one is gone. The change-detection caches below would
|
||||
// otherwise still claim those values are in force and SyncTextureParamsToBackend
|
||||
// would skip the whole pass on the unchanged params version, leaving the driver
|
||||
// texture at defaults for the rest of its life. Latent for swizzle, LOD range and
|
||||
// border colour long before GL_DEPTH_STENCIL_TEXTURE_MODE joined them; the mode
|
||||
// makes it visible because falling back to the default silently samples the wrong
|
||||
// aspect rather than merely mis-filtering.
|
||||
m_cacheLodRange = {0, 1000};
|
||||
m_cacheBorderColor = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
m_cacheSwizzleParams = {TextureSwizzleParam::Red, TextureSwizzleParam::Green, TextureSwizzleParam::Blue,
|
||||
TextureSwizzleParam::Alpha};
|
||||
m_cacheDepthStencilTextureMode = GL_DEPTH_COMPONENT;
|
||||
m_forceTextureParamsResync = true;
|
||||
}
|
||||
|
||||
// Sets the backend GL unpack state to MobileGL's upload default for the scope,
|
||||
@@ -3216,11 +3230,12 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
}
|
||||
|
||||
Uint16 currentTextureParamsVersion = stateTextureObject->GetTextureParamsVersion();
|
||||
if (m_syncedTextureParamsVersion == currentTextureParamsVersion) {
|
||||
if (m_syncedTextureParamsVersion == currentTextureParamsVersion && !m_forceTextureParamsResync) {
|
||||
MGLOG_D("Texture parameters have not changed for texture ID: %u, skipping sync.", m_backendTextureId);
|
||||
return;
|
||||
}
|
||||
m_syncedTextureParamsVersion = currentTextureParamsVersion;
|
||||
m_forceTextureParamsResync = false;
|
||||
|
||||
MGLOG_D("Syncing texture params with backend ID %u to backend for state ID %u", m_backendTextureId,
|
||||
stateTextureObject->GetExternalIndex());
|
||||
|
||||
@@ -707,6 +707,10 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
GLenum m_cacheDepthStencilTextureMode = GL_DEPTH_COMPONENT;
|
||||
Uint16 m_syncedSamplerVersion = 0;
|
||||
Uint16 m_syncedTextureParamsVersion = 0;
|
||||
// Set when the driver texture underneath was regenerated and has therefore lost every
|
||||
// parameter already pushed onto it: the params-version early-out has to be overridden
|
||||
// once, or an unchanged version would skip the re-push forever.
|
||||
Bool m_forceTextureParamsResync = false;
|
||||
};
|
||||
|
||||
void ActivateTextureUnit(Uint unit);
|
||||
|
||||
Reference in New Issue
Block a user