summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llrender.cpp20
-rw-r--r--indra/llrender/llrender.h2
-rw-r--r--indra/llrender/llshadermgr.cpp2
-rw-r--r--indra/llrender/llshadermgr.h2
4 files changed, 25 insertions, 1 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 173444f708..dc9affb596 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -895,6 +895,15 @@ void LLLightState::setDiffuse(const LLColor4& diffuse)
}
}
+void LLLightState::setDiffuseB(const LLColor4& diffuse)
+{
+ if (mDiffuseB != diffuse)
+ {
+ ++gGL.mLightHash;
+ mDiffuseB = diffuse;
+ }
+}
+
void LLLightState::setAmbient(const LLColor4& ambient)
{
if (mAmbient != ambient)
@@ -1153,6 +1162,7 @@ void LLRender::syncLightState()
LLVector3 direction[8];
LLVector4 attenuation[8];
LLVector3 diffuse[8];
+ LLVector3 diffuseB[8];
for (U32 i = 0; i < 8; i++)
{
@@ -1162,6 +1172,7 @@ void LLRender::syncLightState()
direction[i] = light->mSpotDirection;
attenuation[i].set(light->mLinearAtten, light->mQuadraticAtten, light->mSpecular.mV[2], light->mSpecular.mV[3]);
diffuse[i].set(light->mDiffuse.mV);
+ diffuseB[i].set(light->mDiffuseB.mV);
}
shader->uniform4fv(LLShaderMgr::LIGHT_POSITION, 8, position[0].mV);
@@ -1169,8 +1180,8 @@ void LLRender::syncLightState()
shader->uniform4fv(LLShaderMgr::LIGHT_ATTENUATION, 8, attenuation[0].mV);
shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, 8, diffuse[0].mV);
shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV);
- //HACK -- duplicate sunlight color for compatibility with drivers that can't deal with multiple shader objects referencing the same uniform
shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, diffuse[0].mV);
+ shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, diffuseB[0].mV);
}
}
@@ -1477,6 +1488,13 @@ void LLRender::matrixMode(U32 mode)
{
if (mode == MM_TEXTURE)
{
+ U32 tex_index = gGL.getCurrentTexUnitIndex();
+ // the shaders don't actually reference anything beyond texture_matrix0/1
+ if (tex_index > 3)
+ {
+ LL_WARNS_ONCE("render") << "Cannot use texture matrix with texture unit " << tex_index << " forcing texture matrix 3!" << LL_ENDL;
+ tex_index = 3;
+ }
mode = MM_TEXTURE0 + gGL.getCurrentTexUnitIndex();
}
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index a79db80ebe..012a8da4ce 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -229,6 +229,7 @@ public:
void enable();
void disable();
void setDiffuse(const LLColor4& diffuse);
+ void setDiffuseB(const LLColor4& diffuse);
void setAmbient(const LLColor4& ambient);
void setSpecular(const LLColor4& specular);
void setPosition(const LLVector4& position);
@@ -245,6 +246,7 @@ protected:
S32 mIndex;
bool mEnabled;
LLColor4 mDiffuse;
+ LLColor4 mDiffuseB;
LLColor4 mAmbient;
LLColor4 mSpecular;
LLVector4 mPosition;
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 3989c1e2e4..11e84d8785 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -1352,6 +1352,8 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("sun_moon_glow_factor");
mReservedUniforms.push_back("water_edge");
+ mReservedUniforms.push_back("sun_up_factor");
+ mReservedUniforms.push_back("moonlight_color");
llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index ef6f33f2e5..497c3eb231 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -250,6 +250,8 @@ public:
SUN_MOON_GLOW_FACTOR,
WATER_EDGE_FACTOR,
+ SUN_UP_FACTOR,
+ MOONLIGHT_COLOR,
END_RESERVED_UNIFORMS
} eGLSLReservedUniforms;