summaryrefslogtreecommitdiff
path: root/indra/llrender/llimagegl.cpp
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2019-04-02 18:06:37 +0000
committerRider Linden <rider@lindenlab.com>2019-04-02 18:06:37 +0000
commitd7b47bf71f84e4d7311a532b4bfa4a3795f19ab9 (patch)
tree7bbe7116f4a6e53127286d8cb8dcf090f64915b2 /indra/llrender/llimagegl.cpp
parent1199d139810f49de6052ceb90b4359042eb9a639 (diff)
parent3a42d2b94a0f2d27b4baef63abaf49e64139ff01 (diff)
Merged in Geenz/viewer-eep (pull request #321)
[WIP] Use EXT_texture_sRGB_decode in order to selectively sample textures consumed by the deferred renderer as sRGB Approved-by: Graham Madarasz <graham@lindenlab.com>
Diffstat (limited to 'indra/llrender/llimagegl.cpp')
-rw-r--r--indra/llrender/llimagegl.cpp66
1 files changed, 39 insertions, 27 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 2d526a2113..2f1f702d2c 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1370,33 +1370,45 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
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;
- }
+ 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 (gGLManager.mHasTexturesRGBDecode)
+ {
+ mFormatInternal = GL_SRGB8;
+ }
+ else {
+ mFormatInternal = GL_RGB8;
+ }
+ mFormatPrimary = GL_RGB;
+ mFormatType = GL_UNSIGNED_BYTE;
+ break;
+ case 4:
+ if (gGLManager.mHasTexturesRGBDecode)
+ {
+ mFormatInternal = GL_SRGB8_ALPHA8;
+ }
+ else {
+ mFormatInternal = GL_RGBA8;
+ }
+ mFormatPrimary = GL_RGBA;
+ mFormatType = GL_UNSIGNED_BYTE;
+ break;
+ default:
+ LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL;
+ }
calcAlphaChannelOffsetAndStride() ;
}