[Feat] (MG_State/ProgramObject, MG_Backend/DirectGLES): bind texture to uniform in backend

This commit is contained in:
2025-10-27 15:45:36 +08:00
parent 460b7a6eb3
commit 56c6d73185
4 changed files with 13 additions and 5 deletions
@@ -302,6 +302,17 @@ namespace MobileGL::MG_Backend::DirectGLES {
MG_External::GLES::glBindBufferBase(GL_UNIFORM_BUFFER, bindingPoint,
backendProgramIt->second->GetBackendGlobalUBOId());
// Sampler unit binding
auto maxUniformLoc = currentProgram->GetMaxUniformLocation();
for (int loc = 0; loc < maxUniformLoc; ++loc) {
auto unit = currentProgram->GetUniformSamplerOrImageUnitIndex(loc);
if (unit == -1)
continue;
auto& name = currentProgram->GetUniformName(loc);
auto locAtBackend = MG_External::GLES::glGetUniformLocation(backendProgramIt->second->GetBackendProgramId(), name.c_str());
MG_External::GLES::glUniform1i(locAtBackend, unit);
}
} else {
MG_External::GLES::glUseProgram(0);
}
@@ -530,9 +530,6 @@ namespace MobileGL::MG_Backend::DirectGLES {
GL_STREAM_DRAW);
MG_External::GLES::glBindBuffer(GL_UNIFORM_BUFFER, 0);
// Bind samplers
m_isInitialized = true;
MGLOG_D("Program sync completed. Backend ID: %u", m_backendProgramId);
}