diff options
author | Dave Parks <davep@lindenlab.com> | 2013-06-19 11:31:44 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2013-06-19 11:31:44 -0500 |
commit | 6c061ae4fd3c5de9a73035855180df2b26dae3dd (patch) | |
tree | 4d46d86d34e4abd2f3f57481fda67dcec335ba66 /indra/llrender/llglslshader.cpp | |
parent | 2655c7a17ae38a073dcf8f05b0127b68edc34c95 (diff) | |
parent | b49594662573959e0d7ccc08a2b266b3abc8130e (diff) |
Automated merge with https://bitbucket.org/lindenlab/viewer-development-materials
Diffstat (limited to 'indra/llrender/llglslshader.cpp')
-rwxr-xr-x | indra/llrender/llglslshader.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 62191b4c1a..ac16e30796 100755 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -149,6 +149,9 @@ void LLGLSLShader::clearStats() mTimeElapsed = 0; mSamplesDrawn = 0; mDrawCalls = 0; + mTextureStateFetched = false; + mTextureMagFilter.clear(); + mTextureMinFilter.clear(); } void LLGLSLShader::dumpStats() @@ -161,6 +164,16 @@ void LLGLSLShader::dumpStats() { llinfos << mShaderFiles[i].first << llendl; } + for (U32 i = 0; i < mTexture.size(); ++i) + { + GLint idx = mTexture[i]; + + if (idx >= 0) + { + GLint uniform_idx = getUniformLocation(i); + llinfos << mUniformNameMap[uniform_idx] << " - " << std::hex << mTextureMagFilter[i] << "/" << mTextureMinFilter[i] << std::dec << llendl; + } + } llinfos << "=============================================" << llendl; F32 ms = mTimeElapsed/1000000.f; @@ -211,6 +224,39 @@ void LLGLSLShader::placeProfileQuery() glGenQueriesARB(1, &mTimerQuery); } + if (!mTextureStateFetched) + { + mTextureStateFetched = true; + mTextureMagFilter.resize(mTexture.size()); + mTextureMinFilter.resize(mTexture.size()); + + U32 cur_active = gGL.getCurrentTexUnitIndex(); + + for (U32 i = 0; i < mTexture.size(); ++i) + { + GLint idx = mTexture[i]; + + if (idx >= 0) + { + gGL.getTexUnit(idx)->activate(); + + U32 mag = 0xFFFFFFFF; + U32 min = 0xFFFFFFFF; + + U32 type = LLTexUnit::getInternalType(gGL.getTexUnit(idx)->getCurrType()); + + glGetTexParameteriv(type, GL_TEXTURE_MAG_FILTER, (GLint*) &mag); + glGetTexParameteriv(type, GL_TEXTURE_MIN_FILTER, (GLint*) &min); + + mTextureMagFilter[i] = mag; + mTextureMinFilter[i] = min; + } + } + + gGL.getTexUnit(cur_active)->activate(); + } + + glBeginQueryARB(GL_SAMPLES_PASSED, 1); glBeginQueryARB(GL_TIME_ELAPSED, mTimerQuery); #endif @@ -573,6 +619,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms) } mUniformMap[name] = location; + mUniformNameMap[location] = name; LL_DEBUGS("ShaderLoading") << "Uniform " << name << " is at location " << location << LL_ENDL; //find the index of this uniform @@ -635,6 +682,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<string> * uniforms) mActiveTextureChannels = 0; mUniform.clear(); mUniformMap.clear(); + mUniformNameMap.clear(); mTexture.clear(); mValue.clear(); //initialize arrays @@ -1152,6 +1200,23 @@ void LLGLSLShader::uniform1i(const string& uniform, GLint v) } } +void LLGLSLShader::uniform2i(const string& uniform, GLint i, GLint j) +{ + GLint location = getUniformLocation(uniform); + + if (location >= 0) + { + std::map<GLint, LLVector4>::iterator iter = mValue.find(location); + LLVector4 vec(i,j,0.f,0.f); + if (iter == mValue.end() || shouldChange(iter->second,vec)) + { + glUniform2iARB(location, i, j); + mValue[location] = vec; + } + } +} + + void LLGLSLShader::uniform1f(const string& uniform, GLfloat v) { GLint location = getUniformLocation(uniform); |