diff options
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llglslshader.cpp | 1 | ||||
-rw-r--r-- | indra/llrender/llglslshader.h | 1 | ||||
-rw-r--r-- | indra/llrender/llpostprocess.cpp | 4 | ||||
-rw-r--r-- | indra/llrender/llrender.cpp | 21 | ||||
-rw-r--r-- | indra/llrender/llrender.h | 2 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 9 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.h | 1 |
7 files changed, 29 insertions, 10 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 27de7070ff..0a834b28e3 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -84,6 +84,7 @@ LLShaderFeatures::LLShaderFeatures() , hasSrgb(false) , encodesNormal(false) , isDeferred(false) + , hasScreenSpaceReflections(false) , hasIndirect(false) , hasShadows(false) , hasAmbientOcclusion(false) diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 3401da832e..0df0531dce 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -54,6 +54,7 @@ public: bool hasSrgb; bool encodesNormal; // include: shaders\class1\environment\encodeNormF.glsl bool isDeferred; + bool hasScreenSpaceReflections; bool hasIndirect; S32 mIndexedTextureChannels; bool disableTextureIndex; diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index 74154e5676..0d87800690 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -390,7 +390,7 @@ void LLPostProcess::doEffects(void) void LLPostProcess::copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height) { - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture); glCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 0, 0, width, height, 0); } @@ -502,7 +502,7 @@ void LLPostProcess::createTexture(LLPointer<LLImageGL>& texture, unsigned int wi texture = new LLImageGL(FALSE) ; if(texture->createGLTexture()) { - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture->getTexName()); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture->getTexName()); glTexImage2D(GL_TEXTURE_RECTANGLE, 0, 4, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 39e3a0243c..c58fbe6c8e 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1087,13 +1087,20 @@ void LLRender::syncMatrices() { //update projection matrix, normal, and MVP glh::matrix4f& mat = mMatrix[MM_PROJECTION][mMatIdx[MM_PROJECTION]]; - // it would be nice to have this automatically track the state of the proj matrix - // but certain render paths (deferred lighting) require it to be mismatched *sigh* - //if (shader->getUniformLocation(LLShaderMgr::INVERSE_PROJECTION_MATRIX)) - //{ - // glh::matrix4f inv_proj = mat.inverse(); - // shader->uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, FALSE, inv_proj.m); - //} + // GZ: This was previously disabled seemingly due to a bug involving the deferred renderer's regular pushing and popping of mats. + // We're reenabling this and cleaning up the code around that - that would've been the appropriate course initially. + // Anything beyond the standard proj and inv proj mats are special cases. Please setup special uniforms accordingly in the future. + if (shader->getUniformLocation(LLShaderMgr::INVERSE_PROJECTION_MATRIX)) + { + glh::matrix4f inv_proj = mat.inverse(); + shader->uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, FALSE, inv_proj.m); + } + + // Used by some full screen effects - such as full screen lights, glow, etc. + if (shader->getUniformLocation(LLShaderMgr::IDENTITY_MATRIX)) + { + shader->uniformMatrix4fv(LLShaderMgr::IDENTITY_MATRIX, 1, GL_FALSE, glh::matrix4f::identity().m); + } shader->uniformMatrix4fv(name[MM_PROJECTION], 1, GL_FALSE, mat.m); shader->mMatHash[MM_PROJECTION] = mMatHash[MM_PROJECTION]; diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 6dd5f9601e..9fabeb1d7a 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -339,7 +339,7 @@ public: BF_ONE_MINUS_SOURCE_COLOR, BF_DEST_ALPHA, BF_SOURCE_ALPHA, - BF_ONE_MINUS_DEST_ALPHA, + BF_ONE_MINUS_DEST_ALPHA, BF_ONE_MINUS_SOURCE_ALPHA, BF_UNDEF diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index ac4c610d72..b189e5452c 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -222,6 +222,14 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) } } + if (features->hasScreenSpaceReflections) + { + if (!shader->attachFragmentObject("deferred/screenSpaceReflUtil.glsl")) + { + return FALSE; + } + } + if (features->hasShadows) { if (!shader->attachFragmentObject("deferred/shadowUtil.glsl")) @@ -1170,6 +1178,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("inv_proj"); mReservedUniforms.push_back("modelview_projection_matrix"); mReservedUniforms.push_back("inv_modelview"); + mReservedUniforms.push_back("identity_matrix"); mReservedUniforms.push_back("normal_matrix"); mReservedUniforms.push_back("texture_matrix0"); mReservedUniforms.push_back("texture_matrix1"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index e1fb60eccf..90a8c2853c 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -44,6 +44,7 @@ public: INVERSE_PROJECTION_MATRIX, // "inv_proj" MODELVIEW_PROJECTION_MATRIX, // "modelview_projection_matrix" INVERSE_MODELVIEW_MATRIX, // "inv_modelview" + IDENTITY_MATRIX, // "identity_matrix" NORMAL_MATRIX, // "normal_matrix" TEXTURE_MATRIX0, // "texture_matrix0" TEXTURE_MATRIX1, // "texture_matrix1" |