[Fix] (DirectGLES): gate the replicate blit's stencil pass on ES 3.1

Reading the stencil half of a packed depth/stencil texture goes through
GL_DEPTH_STENCIL_TEXTURE_MODE, which is ES 3.1 state. On an older driver the pname
would raise GL_INVALID_ENUM and the shader would go on sampling depth bits as if
they were stencil, so decline the emulation instead.
This commit is contained in:
BZLZHH
2026-08-02 04:55:05 -04:00
parent 027310f993
commit 13bab780f2
@@ -2597,8 +2597,13 @@ namespace MobileGL::MG_Backend::DirectGLES {
if (!wantDepth && !wantStencil) {
return false;
}
// Reading the stencil back needs a stencil texture view, which is ES 3.1 state.
if (wantStencil && !g_GLESFuncs.glTexParameteri) {
// Sampling the stencil half of a packed texture goes through
// GL_DEPTH_STENCIL_TEXTURE_MODE, which is ES 3.1 state; on an older driver the pname
// would just raise GL_INVALID_ENUM and the shader would read depth bits as stencil.
const Bool supportsStencilTextureMode = g_GLESCapabilities.GLESVersion.Major > 3 ||
(g_GLESCapabilities.GLESVersion.Major == 3 &&
g_GLESCapabilities.GLESVersion.Minor >= 1);
if (wantStencil && !supportsStencilTextureMode) {
return false;
}