summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2020-06-08 15:47:41 -0600
committerAndrey Lihatskiy <alihatskiy@productengine.com>2020-06-11 23:33:14 +0300
commit84d30655967fa29cc800783db2cd43df6f28d35e (patch)
treea1a97ffa5648a60fe19920e8e5f83f9f2673b539 /indra
parente1ea8eb7738c2f9a6762dd8c6c22de00607e8ba2 (diff)
SL-13281, add missing srgb->linear conversion for specular
Diffstat (limited to 'indra')
-rw-r--r--indra/llrender/llimagegl.cpp80
-rw-r--r--indra/llrender/llrender.cpp22
-rw-r--r--indra/llrender/llrendertarget.cpp10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl1
4 files changed, 69 insertions, 44 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index ff74380217..3b6a49735e 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -985,38 +985,56 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image)
return FALSE;
}
- if( !mHasExplicitFormat )
- {
- switch (mComponents)
- {
- case 1:
- // Use luminance alpha (for fonts)
- mFormatInternal = GL_LUMINANCE8;
- mFormatPrimary = GL_LUMINANCE;
- mFormatType = GL_UNSIGNED_BYTE;
- break;
- case 2:
- // Use luminance alpha (for fonts)
- mFormatInternal = GL_LUMINANCE8_ALPHA8;
- mFormatPrimary = GL_LUMINANCE_ALPHA;
- mFormatType = GL_UNSIGNED_BYTE;
- break;
- case 3:
- mFormatInternal = GL_RGB8;
- mFormatPrimary = GL_RGB;
- mFormatType = GL_UNSIGNED_BYTE;
- break;
- case 4:
- mFormatInternal = GL_RGBA8;
- mFormatPrimary = GL_RGBA;
- mFormatType = GL_UNSIGNED_BYTE;
- break;
- default:
- LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL;
- }
- }
+ if (!mHasExplicitFormat)
+ {
+ switch (mComponents)
+ {
+ case 1:
+ // Use luminance alpha (for fonts)
+ mFormatInternal = GL_LUMINANCE8;
+ mFormatPrimary = GL_LUMINANCE;
+ mFormatType = GL_UNSIGNED_BYTE;
+ break;
+ case 2:
+ // Use luminance alpha (for fonts)
+ mFormatInternal = GL_LUMINANCE8_ALPHA8;
+ mFormatPrimary = GL_LUMINANCE_ALPHA;
+ mFormatType = GL_UNSIGNED_BYTE;
+ break;
+ case 3:
+#if USE_SRGB_DECODE
+ if (gGLManager.mHasTexturesRGBDecode)
+ {
+ mFormatInternal = GL_SRGB8;
+ }
+ 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
+#endif
+ {
+ mFormatInternal = GL_RGBA8;
+ }
+ mFormatPrimary = GL_RGBA;
+ mFormatType = GL_UNSIGNED_BYTE;
+ break;
+ default:
+ LL_ERRS() << "Bad number of components for texture: " << (U32) getComponents() << LL_ENDL;
+ }
+ }
- mCurrentDiscardLevel = discard_level;
+ mCurrentDiscardLevel = discard_level;
mDiscardLevelInAtlas = discard_level;
mTexelsInAtlas = raw_image->getWidth() * raw_image->getHeight() ;
mLastBindTime = sLastFrameTime;
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 9b5231ad06..cabf0528f0 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -849,26 +849,32 @@ void LLTexUnit::debugTextureUnit(void)
}
}
-void LLTexUnit::setTextureColorSpace(eTextureColorSpace space) {
+void LLTexUnit::setTextureColorSpace(eTextureColorSpace space)
+{
mTexColorSpace = space;
#if USE_SRGB_DECODE
- if (gGLManager.mHasTexturesRGBDecode) {
-
- if (space == TCS_SRGB) {
+ if (gGLManager.mHasTexturesRGBDecode)
+ {
+ if (space == TCS_SRGB)
+ {
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
}
- else {
+ else
+ {
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
}
- if (gDebugGL) {
+ if (gDebugGL)
+ {
assert_glerror();
}
}
+ else
#endif
- glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
-
+ {
+ 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 9fb4f7f2b0..e3c0255290 100644
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -501,23 +501,23 @@ U32 LLRenderTarget::getNumTextures() const
return mTex.size();
}
-
void LLRenderTarget::bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options)
{
- gGL.getTexUnit(channel)->bindManual(mUsage, getTexture(index));
+ 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:
+ case GL_SRGB_ALPHA:
case GL_SRGB8_ALPHA8:
isSRGB = true;
- break;
+ break;
default:
- break;
+ break;
}
gGL.getTexUnit(channel)->setTextureFilteringOption(filter_options);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
index 0d1cc81786..c6afda375c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
@@ -77,6 +77,7 @@ void main()
vec3 norm = getNorm(frag.xy);
vec4 spec = texture2DRect(specularRect, frag.xy);
+ spec.rgb = srgb_to_linear(spec.rgb);
vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb;
diff.rgb = srgb_to_linear(diff.rgb);