use unordered_dense to mitigate __next_prime overflow error

This commit is contained in:
2025-05-07 10:57:26 +08:00
parent 96774ef3da
commit b082e2e06b
9 changed files with 2142 additions and 34 deletions
+8 -9
View File
@@ -280,8 +280,8 @@ namespace MG_RHI::GLES {
SyncAllBuffersToGLES(bufferState);
// VAO
GLuint mgVAO = vaState->currentVao_;
VertexArrayObject* vao = &vaState->vaos_[vaState->currentVao_];
GLuint mgVAOId = vaState->currentVao_;
VertexArrayObject* vao = &vaState->vaos_[mgVAOId];
for (auto& [mgVAOId, mgVAO] : vaState->vaos_) {
MG_Util::Debug::LogD("Uploading VAO: %d", mgVAOId);
if (!mgVAO.generated) continue;
@@ -290,6 +290,7 @@ namespace MG_RHI::GLES {
GLuint glVAO;
if (vaoMap_.find(mgVAOId) == vaoMap_.end()) {
MGL_TRY(::GLES::glGenVertexArrays(1, &glVAO);)
MG_Util::Debug::LogD("Saving VAO: %d -> %d", mgVAOId, glVAO);
vaoMap_[mgVAOId] = glVAO;
} else {
glVAO = vaoMap_[mgVAOId];
@@ -301,7 +302,7 @@ namespace MG_RHI::GLES {
}
for (auto& [index, attrib] : mgVAO.attribs) {
MG_Util::Debug::LogD("attrib #%s, type = %s, size = %d, stride = %d, pointer = %p",
MG_Util::Debug::LogD("attrib #%d, type = %s, size = %d, stride = %d, pointer = %p",
index, MG_Util::Debug::GLEnumToString(attrib.type), attrib.size, attrib.stride, attrib.pointer);
if (attrib.buffer != 0 && bufferMap_.count(attrib.buffer)) {
MGL_TRY(::GLES::glBindBuffer(GL_ARRAY_BUFFER, bufferMap_[attrib.buffer]);)
@@ -329,11 +330,11 @@ namespace MG_RHI::GLES {
MGL_TRY(::GLES::glBindVertexArray(0);)
//}
}
GLuint currentMgVAO = vaState->currentVao_;
if (vaoMap_.count(currentMgVAO)) {
MGL_TRY(::GLES::glBindVertexArray(vaoMap_[currentMgVAO]);)
// GLuint currentMgVAO = vaState->currentVao_;
if (vaoMap_.find(mgVAOId) != vaoMap_.end()) {
MGL_TRY(::GLES::glBindVertexArray(vaoMap_[mgVAOId]);)
VertexArrayObject& currentVAO = vaState->vaos_[currentMgVAO];
VertexArrayObject& currentVAO = vaState->vaos_[mgVAOId];
for (auto& [index, attrib] : currentVAO.attribs) {
if (attrib.enabled) {
MGL_TRY(::GLES::glEnableVertexAttribArray(index);)
@@ -623,8 +624,6 @@ namespace MG_RHI::GLES {
lastBoundFBO = currentFBO;
}
}
}
}