EXT-3784 Fix for first menu item going blank when highlighted on ATI cards.

master
Runitai 2010-01-11 11:21:52 -06:00
parent 6a1a93be1a
commit 2a00a16f57
5 changed files with 43 additions and 1 deletions

View File

@ -1919,6 +1919,16 @@ LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, G
: mPrevDepthEnabled(sDepthEnabled), mPrevDepthFunc(sDepthFunc), mPrevWriteEnabled(sWriteEnabled)
{
stop_glerror();
checkState();
if (!depth_enabled)
{ // always disable depth writes if depth testing is disabled
// GL spec defines this as a requirement, but some implementations allow depth writes with testing disabled
// The proper way to write to depth buffer with testing disabled is to enable testing and use a depth_func of GL_ALWAYS
write_enabled = FALSE;
}
if (depth_enabled != sDepthEnabled)
{
gGL.flush();
@ -1942,6 +1952,7 @@ LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, G
LLGLDepthTest::~LLGLDepthTest()
{
checkState();
if (sDepthEnabled != mPrevDepthEnabled )
{
gGL.flush();
@ -1963,6 +1974,32 @@ 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)
{
if (gDebugSession)
{
gFailLog << "Unexpected depth testing state." << std::endl;
}
else
{
LL_GL_ERRS << "Unexpected depth testing state." << LL_ENDL;
}
}
}
}
LLGLClampToFarClip::LLGLClampToFarClip(glh::matrix4f P)
{
for (U32 i = 0; i < 4; i++)

View File

@ -46,6 +46,8 @@ public:
~LLGLDepthTest();
void checkState();
GLboolean mPrevDepthEnabled;
GLenum mPrevDepthFunc;
GLboolean mPrevWriteEnabled;

View File

@ -162,6 +162,8 @@ void LLTexUnit::enable(eTextureType type)
disable(); // Force a disable of a previous texture type if it's enabled.
}
mCurrTexType = type;
gGL.flush();
glEnable(sGLTextureType[type]);
}
}

View File

@ -46,6 +46,7 @@
#include "llmenugl.h"
#include "llgl.h"
#include "llmath.h"
#include "llrender.h"
#include "llfocusmgr.h"
@ -477,6 +478,7 @@ void LLMenuItemGL::draw( void )
if (dynamic_cast<LLMenuItemCallGL*>(this))
debug_count++;
gGL.color4fv( mHighlightBackground.get().mV );
gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
}

View File

@ -2460,7 +2460,6 @@ void renderOctree(LLSpatialGroup* group)
gGL.color4fv(col.mV);
drawBox(group->mObjectBounds[0], group->mObjectBounds[1]*1.01f+LLVector3(0.001f, 0.001f, 0.001f));
glDepthMask(GL_TRUE);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
if (group->mBuilt <= 0.f)