LLGLState::sStateMap now using hash map (boost::unordered_map) opposed to std::map
This commit is contained in:
@@ -1056,7 +1056,7 @@ void clear_glerror()
|
|||||||
//
|
//
|
||||||
|
|
||||||
// Static members
|
// Static members
|
||||||
std::map<LLGLenum, LLGLboolean> LLGLState::sStateMap;
|
boost::unordered_map<LLGLenum, LLGLboolean> LLGLState::sStateMap;
|
||||||
|
|
||||||
GLboolean LLGLDepthTest::sDepthEnabled = GL_FALSE; // OpenGL default
|
GLboolean LLGLDepthTest::sDepthEnabled = GL_FALSE; // OpenGL default
|
||||||
GLenum LLGLDepthTest::sDepthFunc = GL_LESS; // OpenGL default
|
GLenum LLGLDepthTest::sDepthFunc = GL_LESS; // OpenGL default
|
||||||
@@ -1104,7 +1104,7 @@ void LLGLState::resetTextureStates()
|
|||||||
void LLGLState::dumpStates()
|
void LLGLState::dumpStates()
|
||||||
{
|
{
|
||||||
LL_INFOS("RenderState") << "GL States:" << LL_ENDL;
|
LL_INFOS("RenderState") << "GL States:" << LL_ENDL;
|
||||||
for (std::map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin();
|
for (boost::unordered_map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin();
|
||||||
iter != sStateMap.end(); ++iter)
|
iter != sStateMap.end(); ++iter)
|
||||||
{
|
{
|
||||||
LL_INFOS("RenderState") << llformat(" 0x%04x : %s",(S32)iter->first,iter->second?"TRUE":"FALSE") << LL_ENDL;
|
LL_INFOS("RenderState") << llformat(" 0x%04x : %s",(S32)iter->first,iter->second?"TRUE":"FALSE") << LL_ENDL;
|
||||||
@@ -1130,7 +1130,7 @@ void LLGLState::checkStates(const std::string& msg)
|
|||||||
LL_GL_ERRS << "Blend function corrupted: " << std::hex << src << " " << std::hex << dst << " " << msg << std::dec << LL_ENDL;
|
LL_GL_ERRS << "Blend function corrupted: " << std::hex << src << " " << std::hex << dst << " " << msg << std::dec << LL_ENDL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin();
|
for (boost::unordered_map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin();
|
||||||
iter != sStateMap.end(); ++iter)
|
iter != sStateMap.end(); ++iter)
|
||||||
{
|
{
|
||||||
LLGLenum state = iter->first;
|
LLGLenum state = iter->first;
|
||||||
@@ -1769,6 +1769,8 @@ LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, G
|
|||||||
: mPrevDepthEnabled(sDepthEnabled), mPrevDepthFunc(sDepthFunc), mPrevWriteEnabled(sWriteEnabled)
|
: mPrevDepthEnabled(sDepthEnabled), mPrevDepthFunc(sDepthFunc), mPrevWriteEnabled(sWriteEnabled)
|
||||||
{
|
{
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
|
checkState();
|
||||||
|
|
||||||
if (!depth_enabled)
|
if (!depth_enabled)
|
||||||
{ // always disable depth writes if depth testing is disabled
|
{ // always disable depth writes if depth testing is disabled
|
||||||
@@ -1800,6 +1802,7 @@ LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, G
|
|||||||
|
|
||||||
LLGLDepthTest::~LLGLDepthTest()
|
LLGLDepthTest::~LLGLDepthTest()
|
||||||
{
|
{
|
||||||
|
checkState();
|
||||||
if (sDepthEnabled != mPrevDepthEnabled )
|
if (sDepthEnabled != mPrevDepthEnabled )
|
||||||
{
|
{
|
||||||
gGL.flush();
|
gGL.flush();
|
||||||
@@ -1821,6 +1824,26 @@ LLGLDepthTest::~LLGLDepthTest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLGLDepthTest::checkState()
|
||||||
|
{
|
||||||
|
if (gDebugGL)
|
||||||
|
{
|
||||||
|
GLint func = 0;
|
||||||
|
GLboolean mask = FALSE;
|
||||||
|
|
||||||
|
glGetIntegerv(GL_DEPTH_FUNC, &func);
|
||||||
|
glGetBooleanv(GL_DEPTH_WRITEMASK, &mask);
|
||||||
|
|
||||||
|
if (glIsEnabled(GL_DEPTH_TEST) != sDepthEnabled ||
|
||||||
|
sWriteEnabled != mask ||
|
||||||
|
sDepthFunc != func)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
LL_GL_ERRS << "Unexpected depth testing state." << LL_ENDL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
LLGLSquashToFarClip::LLGLSquashToFarClip(glh::matrix4f P)
|
LLGLSquashToFarClip::LLGLSquashToFarClip(glh::matrix4f P)
|
||||||
{
|
{
|
||||||
for (U32 i = 0; i < 4; i++)
|
for (U32 i = 0; i < 4; i++)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
// This file contains various stuff for handling gl extensions and other gl related stuff.
|
// This file contains various stuff for handling gl extensions and other gl related stuff.
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <boost/unordered_map.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "llerror.h"
|
#include "llerror.h"
|
||||||
@@ -233,7 +234,7 @@ public:
|
|||||||
static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0x0001);
|
static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0x0001);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static std::map<LLGLenum, LLGLboolean> sStateMap;
|
static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum { CURRENT_STATE = -2 };
|
enum { CURRENT_STATE = -2 };
|
||||||
|
|||||||
Reference in New Issue
Block a user