summaryrefslogtreecommitdiff
path: root/indra/llrender/llrender.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llrender.cpp')
-rw-r--r--indra/llrender/llrender.cpp41
1 files changed, 34 insertions, 7 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 49e10c4790..1d82dda30f 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -30,6 +30,7 @@
#include "llvertexbuffer.h"
#include "llcubemap.h"
+#include "llglslshader.h"
#include "llimagegl.h"
#include "llrendertarget.h"
#include "lltexture.h"
@@ -46,14 +47,15 @@ S32 gGLViewport[4];
U32 LLRender::sUICalls = 0;
U32 LLRender::sUIVerts = 0;
-static const U32 LL_NUM_TEXTURE_LAYERS = 16;
+static const U32 LL_NUM_TEXTURE_LAYERS = 32;
static const U32 LL_NUM_LIGHT_UNITS = 8;
static GLenum sGLTextureType[] =
{
GL_TEXTURE_2D,
GL_TEXTURE_RECTANGLE_ARB,
- GL_TEXTURE_CUBE_MAP_ARB
+ GL_TEXTURE_CUBE_MAP_ARB,
+ GL_TEXTURE_2D_MULTISAMPLE
};
static GLint sGLAddressMode[] =
@@ -119,14 +121,29 @@ void LLTexUnit::refreshState(void)
gGL.flush();
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
+
+ //
+ // Per apple spec, don't call glEnable/glDisable when index exceeds max texture units
+ // http://www.mailinglistarchive.com/html/mac-opengl@lists.apple.com/2008-07/msg00653.html
+ //
+ bool enableDisable = (mIndex < gGLManager.mNumTextureUnits) && mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE;
+
if (mCurrTexType != TT_NONE)
{
- glEnable(sGLTextureType[mCurrTexType]);
+ if (enableDisable)
+ {
+ glEnable(sGLTextureType[mCurrTexType]);
+ }
+
glBindTexture(sGLTextureType[mCurrTexType], mCurrTexture);
}
else
{
- glDisable(GL_TEXTURE_2D);
+ if (enableDisable)
+ {
+ glDisable(GL_TEXTURE_2D);
+ }
+
glBindTexture(GL_TEXTURE_2D, 0);
}
@@ -167,7 +184,11 @@ void LLTexUnit::enable(eTextureType type)
mCurrTexType = type;
gGL.flush();
- glEnable(sGLTextureType[type]);
+ if (type != LLTexUnit::TT_MULTISAMPLE_TEXTURE &&
+ mIndex < gGLManager.mNumTextureUnits)
+ {
+ glEnable(sGLTextureType[type]);
+ }
}
}
@@ -180,7 +201,12 @@ void LLTexUnit::disable(void)
activate();
unbind(mCurrTexType);
gGL.flush();
- glDisable(sGLTextureType[mCurrTexType]);
+ if (mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE &&
+ mIndex < gGLManager.mNumTextureUnits)
+ {
+ glDisable(sGLTextureType[mCurrTexType]);
+ }
+
mCurrTexType = TT_NONE;
}
}
@@ -378,6 +404,7 @@ void LLTexUnit::unbind(eTextureType type)
activate();
mCurrTexture = 0;
glBindTexture(sGLTextureType[type], 0);
+ stop_glerror();
}
}
@@ -399,7 +426,7 @@ void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode)
void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option)
{
- if (mIndex < 0 || mCurrTexture == 0) return;
+ if (mIndex < 0 || mCurrTexture == 0 || mCurrTexType == LLTexUnit::TT_MULTISAMPLE_TEXTURE) return;
gGL.flush();