summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llglslshader.cpp26
-rw-r--r--indra/llrender/llglslshader.h1
-rw-r--r--indra/llrender/llrender.cpp8
-rw-r--r--indra/llrender/llrender.h1
-rw-r--r--indra/llrender/llshadermgr.cpp3
-rw-r--r--indra/llrender/llshadermgr.h3
6 files changed, 38 insertions, 4 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index b30bc1aed6..2554ccdbe4 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -349,8 +349,8 @@ void LLGLSLShader::unloadInternal()
for (GLsizei i = 0; i < count; i++)
{
glDetachObjectARB(mProgramObject, obj[i]);
- glDeleteObjectARB(obj[i]);
- }
+ glDeleteObjectARB(obj[i]);
+ }
glDeleteObjectARB(mProgramObject);
@@ -1274,6 +1274,28 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c
}
}
+void LLGLSLShader::uniform1b(U32 index, GLboolean x)
+{
+ if (mProgramObject > 0)
+ {
+ if (mUniform.size() <= index)
+ {
+ UNIFORM_ERRS << "Uniform index out of bounds." << LL_ENDL;
+ return;
+ }
+
+ if (mUniform[index] >= 0)
+ {
+ std::map<GLint, LLVector4>::iterator iter = mValue.find(mUniform[index]);
+ if (iter == mValue.end() || iter->second.mV[0] != x)
+ {
+ glUniform1iARB(mUniform[index], x);
+ mValue[mUniform[index]] = LLVector4(x, 0.f, 0.f, 0.f);
+ }
+ }
+ }
+}
+
GLint LLGLSLShader::getUniformLocation(const LLStaticHashedString& uniform)
{
GLint ret = -1;
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index 0746e8760a..8663a5a5ff 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -125,6 +125,7 @@ public:
void uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
void uniform4fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
void uniformMatrix4fv(const LLStaticHashedString& uniform, U32 count, GLboolean transpose, const GLfloat *v);
+ void uniform1b(U32 index, GLboolean b);
void setMinimumAlpha(F32 minimum);
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 69420dd0bb..b5ed67f66a 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1466,6 +1466,14 @@ U32 LLRender::getMatrixMode()
return mMatrixMode;
}
+void LLRender::setInverseTexCoordByY(bool v)
+{
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ if (shader)
+ {
+ shader->uniform1b(LLShaderMgr::INVERSE_TEX_Y, v);
+ }
+}
void LLRender::loadIdentity()
{
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index a67fb8da52..4c3547f8e4 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -355,6 +355,7 @@ public:
void multMatrix(const GLfloat* m);
void matrixMode(U32 mode);
U32 getMatrixMode();
+ void setInverseTexCoordByY(bool v);
const glh::matrix4f& getModelviewMatrix();
const glh::matrix4f& getProjectionMatrix();
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index b297223c2e..7d857c6930 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -520,7 +520,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string&
if (!filename.empty())
{
LL_CONT << "From " << filename << ":\n";
- }
+ }
LL_CONT << log << LL_ENDL;
}
}
@@ -1190,6 +1190,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("origin");
mReservedUniforms.push_back("display_gamma");
+ mReservedUniforms.push_back("invert_tex_y");
llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
std::set<std::string> dupe_check;
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index 394b38f832..50b7c8b9d9 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -215,7 +215,8 @@ public:
TERRAIN_ALPHARAMP,
SHINY_ORIGIN,
-DISPLAY_GAMMA,
+ DISPLAY_GAMMA,
+ INVERSE_TEX_Y,
END_RESERVED_UNIFORMS
} eGLSLReservedUniforms;