Revert "use unordered_dense to mitigate __next_prime overflow error"

This reverts commit b082e2e06b.
This commit is contained in:
BZLZHH
2025-05-17 11:13:19 +08:00
parent c848255b43
commit 9297542dcf
9 changed files with 34 additions and 2142 deletions
+11 -14
View File
@@ -13,21 +13,25 @@ VertexArrayState::VertexArrayState() {
GLenum VertexArrayState::Create(GLuint* array) {
if (array == nullptr) return GL_INVALID_VALUE;
GLuint id = freeId_.empty() ? lastId_++ : freeId_.back();
if (!freeId_.empty()) {
freeId_.pop_back();
GLuint id = freeIds_.empty() ? ++lastId_ : *freeIds_.begin();
if (!freeIds_.empty()) {
freeIds_.erase(freeIds_.begin());
}
*array = id;
vaos_[id] = { .generated = false };
// vaos_[id].generated = true;
return GL_NO_ERROR;
}
GLenum VertexArrayState::CreateN(GLsizei n, GLuint* arrays) {
if (n <= 0 || arrays == nullptr) {
if (n < 0) {
return GL_INVALID_VALUE;
}
if (n > 0 && arrays == nullptr) {
return GL_INVALID_VALUE;
}
for (GLsizei i = 0; i < n; ++i) {
if (GLenum error = Create(&arrays[i]); error != GL_NO_ERROR) {
return error;
@@ -37,9 +41,7 @@ GLenum VertexArrayState::CreateN(GLsizei n, GLuint* arrays) {
}
GLenum VertexArrayState::Bind(GLuint array) {
if (array != 0 && vaos_.find(array) == vaos_.end())
return GL_INVALID_OPERATION;
if (array != 0 && vaos_.find(array) == vaos_.end()) return GL_INVALID_OPERATION;
currentVao_ = array;
GetCurrentVAO()->generated = true;
return GL_NO_ERROR;
@@ -90,10 +92,5 @@ GLuint VertexArrayState::GetBoundElementBuffer() {
VertexArrayObject* VertexArrayState::GetCurrentVAO() {
auto it = vaos_.find(currentVao_);
if (it != vaos_.end())
return &it->second;
else {
MG_Util::Debug::LogD("%s: VAO not found, currentVao_ = %u !", __func__, currentVao_);
return nullptr;
}
return (it != vaos_.end()) ? &it->second : &vaos_.at(0);
}