[Feat] using unordered_dense somewhere...

This commit is contained in:
2025-05-08 10:00:44 +08:00
parent 3edb48d5fc
commit d33fb15ada
3 changed files with 10 additions and 6 deletions
+4 -2
View File
@@ -9,6 +9,8 @@
#include "../../../Includes.h" #include "../../../Includes.h"
class CommonState { class CommonState {
template <typename K, typename V>
using unordered_map = ankerl::unordered_dense::map<K, V>;
public: public:
// Viewport // Viewport
GLint viewport[4] = {0, 0, 0, 0}; GLint viewport[4] = {0, 0, 0, 0};
@@ -17,7 +19,7 @@ public:
GLboolean colorMask[4] = {GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE}; GLboolean colorMask[4] = {GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE};
// Pixel storage parameters // Pixel storage parameters
std::unordered_map<GLenum, GLint> pixelStoreParams; unordered_map<GLenum, GLint> pixelStoreParams;
// Blend state // Blend state
GLenum blendSrcRGB = GL_ONE; GLenum blendSrcRGB = GL_ONE;
@@ -35,7 +37,7 @@ public:
GLboolean depthMask = GL_TRUE; GLboolean depthMask = GL_TRUE;
// Capability enables // Capability enables
std::unordered_map<GLenum, bool> capabilities; unordered_map<GLenum, bool> capabilities;
CommonState(); CommonState();
+1 -1
View File
@@ -630,7 +630,7 @@ GLenum TextureState::QueryLevelPropertyIntVector(GLenum target, GLint level, GLe
return GL_NO_ERROR; return GL_NO_ERROR;
} }
std::unordered_map<GLuint, TextureObject>::iterator texIt; unordered_map<GLuint, TextureObject>::iterator texIt;
if (!isProxyTexture) { if (!isProxyTexture) {
texIt = textures.find(boundTexture); texIt = textures.find(boundTexture);
+5 -3
View File
@@ -54,13 +54,15 @@ public:
}; };
class TextureState { class TextureState {
template <typename K, typename V>
using unordered_map = ankerl::unordered_dense::map<K, V>;
private: private:
GLuint activeTextureUnit_ = 0; GLuint activeTextureUnit_ = 0;
GLuint lastUsedID_ = 0; GLuint lastUsedID_ = 0;
std::set<GLuint> freeIDs_; std::unordered_set<GLuint> freeIDs_;
std::unordered_map<GLenum, TextureObject> proxyTextures_; unordered_map<GLenum, TextureObject> proxyTextures_;
static GLint GetUnpackParam_(GLenum pname); static GLint GetUnpackParam_(GLenum pname);
public: public:
@@ -68,7 +70,7 @@ public:
bool IsTextureGenerated(GLuint texture); bool IsTextureGenerated(GLuint texture);
bool IsTexture(GLuint texture); bool IsTexture(GLuint texture);
std::unordered_map<GLuint, TextureObject> textures; unordered_map<GLuint, TextureObject> textures;
// Return: the validity of the operation, according to OpenGL 3 standard // Return: the validity of the operation, according to OpenGL 3 standard
GLenum BindUnit(GLenum textureUnit); GLenum BindUnit(GLenum textureUnit);