mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 22:28:32 +09:00
[Fix] (MG_State, MG_Backend/DirectVulkan): bump the texture bind generation when a context default texture crosses the undefined<->defined boundary so cached sampled sets re-resolve, and collect the fallback texture into the sampled set so its first use transitions outside the render pass
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
// End of Source File Header
|
||||
|
||||
#include "TextureObject.h"
|
||||
#include "MG_State/GLState/Core.h"
|
||||
#include "MG_Util/Types.h"
|
||||
#include <MG_Util/Metrics/TextureMetrics.h>
|
||||
|
||||
@@ -52,6 +53,20 @@ namespace MobileGL {
|
||||
void TextureObjectBase::SetInternalFormat(TextureInternalFormat format) {
|
||||
if (format == m_internalFormat) return;
|
||||
|
||||
// A default texture (name 0) changes IsUndefinedDefaultTexture on the
|
||||
// Unknown<->defined transition, which changes per-draw sampled-set membership
|
||||
// without any bind happening; bump the bind generation so cached sampled sets
|
||||
// re-resolve instead of replaying the stale membership. The identity check
|
||||
// excludes the other externalIndex-0 objects (proxy textures, default-FBO
|
||||
// attachments) whose definedness never feeds sampled-set membership, so e.g.
|
||||
// proxy probes cannot churn the cache.
|
||||
if (m_externalIndex == 0 && pGLContext &&
|
||||
(m_internalFormat == TextureInternalFormat::Unknown) !=
|
||||
(format == TextureInternalFormat::Unknown) &&
|
||||
pGLContext->GetDefaultTextureObject(GetTarget()).get() == this) {
|
||||
pGLContext->BumpTextureBindGeneration();
|
||||
}
|
||||
|
||||
m_internalFormat = format;
|
||||
++m_textureParamsVersion;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user