[Feat] (MG_Backend/DirectGLES): Set divisor for VAO attrib.

This commit is contained in:
BZLZHH
2025-12-07 11:07:58 +08:00
parent 4089a42d3b
commit 56f45499e1
3 changed files with 9 additions and 6 deletions
@@ -137,7 +137,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
} // namespace BufferImpl } // namespace BufferImpl
namespace VertexArrayImpl { namespace VertexArrayImpl {
void SyncCurrentVAO() { void SyncCurrentVAO(Bool needDivisor) {
auto currentVAOObject = MG_State::pGLContext->GetBoundVertexArray(); auto currentVAOObject = MG_State::pGLContext->GetBoundVertexArray();
if (!currentVAOObject) { if (!currentVAOObject) {
MGLOG_E("No VAO is currently bound, cannot sync current VAO."); MGLOG_E("No VAO is currently bound, cannot sync current VAO.");
@@ -152,7 +152,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
} else { } else {
backendVAOObject = backendVAOIt->second; backendVAOObject = backendVAOIt->second;
} }
backendVAOObject->SyncToBackend(currentVAOObject); backendVAOObject->SyncToBackend(currentVAOObject, needDivisor);
} }
} // namespace VertexArrayImpl } // namespace VertexArrayImpl
@@ -356,7 +356,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
void PrepareForDraw(DrawSyncBit syncBit) { void PrepareForDraw(DrawSyncBit syncBit) {
BufferImpl::SyncNeccessaryBuffers(syncBit & DrawSyncBit::IndexBuffer, syncBit & DrawSyncBit::IndirectBuffer); BufferImpl::SyncNeccessaryBuffers(syncBit & DrawSyncBit::IndexBuffer, syncBit & DrawSyncBit::IndirectBuffer);
VertexArrayImpl::SyncCurrentVAO(); // TODO: instancing VertexArrayImpl::SyncCurrentVAO(syncBit & DrawSyncBit::Instancing);
TextureImpl::SyncNeccessaryTextures(); TextureImpl::SyncNeccessaryTextures();
FramebufferImpl::SyncCurrentFBO(); FramebufferImpl::SyncCurrentFBO();
PrgramImpl::SyncCurrentProgram(); PrgramImpl::SyncCurrentProgram();
+5 -2
View File
@@ -156,7 +156,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
MG_External::GLES::glBindVertexArray(m_backendVAOId); MG_External::GLES::glBindVertexArray(m_backendVAOId);
} }
void BackendVertexArrayObject::SyncToBackend(SharedPtr<MG_State::GLState::VertexArrayObject>& stateVAOObject) { void BackendVertexArrayObject::SyncToBackend(SharedPtr<MG_State::GLState::VertexArrayObject>& stateVAOObject,
Bool needDivisor) {
if (!stateVAOObject) { if (!stateVAOObject) {
MGLOG_E("State VAO object is null, cannot sync to backend."); MGLOG_E("State VAO object is null, cannot sync to backend.");
return; return;
@@ -205,7 +206,9 @@ namespace MobileGL::MG_Backend::DirectGLES {
attrib.Stride, (const void*)attrib.Offset); attrib.Stride, (const void*)attrib.Offset);
} }
// TODO: divisor if (needDivisor) {
MG_External::GLES::glVertexAttribDivisor(attribIndex, attrib.Divisor);
}
} }
const auto& indexBufferBinding = stateVAOObject->GetIndexBufferBindingSlot().GetBoundObject(); const auto& indexBufferBinding = stateVAOObject->GetIndexBufferBindingSlot().GetBoundObject();
+1 -1
View File
@@ -34,7 +34,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
class BackendVertexArrayObject { class BackendVertexArrayObject {
public: public:
BackendVertexArrayObject(); BackendVertexArrayObject();
void SyncToBackend(SharedPtr<MG_State::GLState::VertexArrayObject>& stateVAOObject); void SyncToBackend(SharedPtr<MG_State::GLState::VertexArrayObject>& stateVAOObject, Bool needDivisor);
Uint GetBackendVertexArrayId() { return m_backendVAOId; } Uint GetBackendVertexArrayId() { return m_backendVAOId; }
void Bind(); void Bind();