From 2513aa0ed1331ca022fb8bbd7442b1ba750ead4d Mon Sep 17 00:00:00 2001 From: Geenz Date: Sat, 30 Mar 2019 03:18:02 -0700 Subject: Additional gamma correction work: start moving over to EXT_texture_sRGB_decode. --- indra/llrender/llimagegl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llrender/llimagegl.cpp') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 2d526a2113..8b51bf4b9f 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1385,12 +1385,12 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S mFormatType = GL_UNSIGNED_BYTE; break; case 3: - mFormatInternal = GL_RGB8; + mFormatInternal = GL_SRGB8; mFormatPrimary = GL_RGB; mFormatType = GL_UNSIGNED_BYTE; break; case 4: - mFormatInternal = GL_RGBA8; + mFormatInternal = GL_SRGB8_ALPHA8; mFormatPrimary = GL_RGBA; mFormatType = GL_UNSIGNED_BYTE; break; -- cgit v1.2.3 From 0e47ca896d701eeb3c38a3bcb188bcceacaba80b Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 1 Apr 2019 18:34:56 -0700 Subject: Make LLImageGL's loading of assets as sRGB or linear conditional based upon sRGB decode support. --- indra/llrender/llimagegl.cpp | 65 ++++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 27 deletions(-) (limited to 'indra/llrender/llimagegl.cpp') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 8b51bf4b9f..16fd6ffe8a 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1370,33 +1370,44 @@ 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_SRGB8; - mFormatPrimary = GL_RGB; - mFormatType = GL_UNSIGNED_BYTE; - break; - case 4: - mFormatInternal = GL_SRGB8_ALPHA8; - 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; + } + mFormatType = GL_UNSIGNED_BYTE; + break; + default: + LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL; + } calcAlphaChannelOffsetAndStride() ; } -- cgit v1.2.3 From 3a42d2b94a0f2d27b4baef63abaf49e64139ff01 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 1 Apr 2019 18:51:28 -0700 Subject: Whoops! Always make sure that our primary format is assigned. --- indra/llrender/llimagegl.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llrender/llimagegl.cpp') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 16fd6ffe8a..2f1f702d2c 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1403,6 +1403,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S else { mFormatInternal = GL_RGBA8; } + mFormatPrimary = GL_RGBA; mFormatType = GL_UNSIGNED_BYTE; break; default: -- cgit v1.2.3