[Fix] (MG_Backend/DirectGLES): Bind sampler object in backend.

This commit is contained in:
BZLZHH
2025-11-29 20:02:08 +08:00
parent 49e80ae4cf
commit d1c58904f4
@@ -353,6 +353,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
const auto& textureObject = bindingSlot.GetBoundObject();
if (!textureObject) continue;
// Bind texture object
auto target = textureObject->GetTarget();
if (target == TextureTarget::TextureBuffer || target == TextureTarget::Texture1D ||
target == TextureTarget::TextureRectangle || target == TextureTarget::Texture2DMultisampleArray ||
@@ -368,6 +369,17 @@ namespace MobileGL::MG_Backend::DirectGLES {
GLenum targetGL = MG_Util::ConvertTextureTargetToGLEnum(target);
backendTextureIt->second->Bind(targetGL);
}
// Bind sampler object
const auto& samplerObject = textureUnit.GetSamplerObject();
if (samplerObject) {
const auto& backendSamplerIt = SamplerImpl::g_backendSamplerObjects.find(samplerObject);
if (backendSamplerIt != SamplerImpl::g_backendSamplerObjects.end()) {
backendSamplerIt->second->Bind(unit);
}
} else {
MG_External::GLES::glBindSampler(unit, 0);
}
}
const auto& currentProgram = MG_State::pGLContext->GetCurrentProgram();