diff options
author | Graham Linden <graham@lindenlab.com> | 2019-05-02 13:49:35 -0700 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-05-02 13:49:35 -0700 |
commit | c4032528aff8ef1938e897ec583bbf25a3e713e1 (patch) | |
tree | 4addd3b6619e6e911898d09ef446d0d40ef8a73e /indra/llrender | |
parent | 1ff876a961dc00b7f162054ea1a9fed79240bffc (diff) |
Roll back sRGB decode changes from contrib for now.
Fix direct light matching across alpha/blended-material/deferred.
Get diffuse lighting to match from Low to Ultra.
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llcubemap.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llglslshader.cpp | 7 | ||||
-rw-r--r-- | indra/llrender/llglslshader.h | 4 | ||||
-rw-r--r-- | indra/llrender/llimagegl.cpp | 10 | ||||
-rw-r--r-- | indra/llrender/llrender.cpp | 6 | ||||
-rw-r--r-- | indra/llrender/llrendertarget.cpp | 19 | ||||
-rw-r--r-- | indra/llrender/llrendertarget.h | 2 |
7 files changed, 41 insertions, 9 deletions
diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index d425b8fa2d..5947bca670 100644 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -79,9 +79,11 @@ void LLCubeMap::initGL() for (int i = 0; i < 6; i++) { mImages[i] = new LLImageGL(RESOLUTION, RESOLUTION, 4, FALSE); + #if USE_SRGB_DECODE if (mIssRGB) { mImages[i]->setExplicitFormat(GL_SRGB8_ALPHA8, GL_RGBA); } + #endif mImages[i]->setTarget(mTargets[i], LLTexUnit::TT_CUBE_MAP); mRawImages[i] = new LLImageRaw(RESOLUTION, RESOLUTION, 4); mImages[i]->createGLTexture(0, mRawImages[i], texname); diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index babf649ece..902c08b6ba 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -937,15 +937,15 @@ void LLGLSLShader::bindNoShader(void) } } -S32 LLGLSLShader::bindTexture(const std::string &uniform, LLTexture *texture, LLTexUnit::eTextureType mode) +S32 LLGLSLShader::bindTexture(const std::string &uniform, LLTexture *texture, LLTexUnit::eTextureType mode, LLTexUnit::eTextureColorSpace colorspace) { S32 channel = 0; channel = getUniformLocation(uniform); - return bindTexture(channel, texture, mode); + return bindTexture(channel, texture, mode, colorspace); } -S32 LLGLSLShader::bindTexture(S32 uniform, LLTexture *texture, LLTexUnit::eTextureType mode) +S32 LLGLSLShader::bindTexture(S32 uniform, LLTexture *texture, LLTexUnit::eTextureType mode, LLTexUnit::eTextureColorSpace colorspace) { if (uniform < 0 || uniform >= (S32)mTexture.size()) { @@ -958,6 +958,7 @@ S32 LLGLSLShader::bindTexture(S32 uniform, LLTexture *texture, LLTexUnit::eTextu if (uniform > -1) { gGL.getTexUnit(uniform)->bind(texture, mode); + gGL.getTexUnit(uniform)->setTextureColorSpace(colorspace); } return uniform; diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 38dc980a97..7cf6d3c941 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -159,8 +159,8 @@ public: // bindTexture returns the texture unit we've bound the texture to. // You can reuse the return value to unbind a texture when required. - S32 bindTexture(const std::string& uniform, LLTexture *texture, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); - S32 bindTexture(S32 uniform, LLTexture *texture, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); + S32 bindTexture(const std::string& uniform, LLTexture *texture, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE, LLTexUnit::eTextureColorSpace space = LLTexUnit::TCS_LINEAR); + S32 bindTexture(S32 uniform, LLTexture *texture, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE, LLTexUnit::eTextureColorSpace space = LLTexUnit::TCS_LINEAR); S32 unbindTexture(const std::string& uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); S32 unbindTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE); diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 2f1f702d2c..790ba25112 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1385,22 +1385,28 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S mFormatType = GL_UNSIGNED_BYTE; break; case 3: + #if USE_SRGB_DECODE if (gGLManager.mHasTexturesRGBDecode) { mFormatInternal = GL_SRGB8; } - else { + else + #endif + { mFormatInternal = GL_RGB8; } mFormatPrimary = GL_RGB; mFormatType = GL_UNSIGNED_BYTE; break; case 4: + #if USE_SRGB_DECODE if (gGLManager.mHasTexturesRGBDecode) { mFormatInternal = GL_SRGB8_ALPHA8; } - else { + else + #endif + { mFormatInternal = GL_RGBA8; } mFormatPrimary = GL_RGBA; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 5dc61d0e8f..f3771f3bf2 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -193,6 +193,7 @@ void LLTexUnit::enable(eTextureType type) stop_glerror(); } mCurrTexType = type; + gGL.flush(); if (!LLGLSLShader::sNoFixedFunction && type != LLTexUnit::TT_MULTISAMPLE_TEXTURE && @@ -850,6 +851,8 @@ void LLTexUnit::debugTextureUnit(void) void LLTexUnit::setTextureColorSpace(eTextureColorSpace space) { mTexColorSpace = space; + +#if USE_SRGB_DECODE if (gGLManager.mHasTexturesRGBDecode) { if (space == TCS_SRGB) { @@ -863,6 +866,9 @@ void LLTexUnit::setTextureColorSpace(eTextureColorSpace space) { assert_glerror(); } } +#endif + glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT); + } LLLightState::LLLightState(S32 index) diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index cd484b4fe9..9fb4f7f2b0 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -502,9 +502,26 @@ U32 LLRenderTarget::getNumTextures() const } -void LLRenderTarget::bindTexture(U32 index, S32 channel) +void LLRenderTarget::bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options) { gGL.getTexUnit(channel)->bindManual(mUsage, getTexture(index)); + + bool isSRGB = false; + llassert(mInternalFormat.size() > index); + switch (mInternalFormat[index]) + { + case GL_SRGB_ALPHA: + case GL_SRGB: + case GL_SRGB8_ALPHA8: + isSRGB = true; + break; + + default: + break; + } + + gGL.getTexUnit(channel)->setTextureFilteringOption(filter_options); + gGL.getTexUnit(channel)->setTextureColorSpace(isSRGB ? LLTexUnit::TCS_SRGB : LLTexUnit::TCS_LINEAR); } void LLRenderTarget::flush(bool fetch_depth) diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index 6dc84d978d..6c07ac5b1c 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -120,7 +120,7 @@ public: U32 getDepth(void) const { return mDepth; } bool hasStencil() const { return mStencil; } - void bindTexture(U32 index, S32 channel); + void bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options = LLTexUnit::TFO_BILINEAR); //flush rendering operations //must be called when rendering is complete |