diff options
| author | Geenz <geenz@geenzo.com> | 2019-04-01 18:34:56 -0700 | 
|---|---|---|
| committer | Geenz <geenz@geenzo.com> | 2019-04-01 18:34:56 -0700 | 
| commit | 0e47ca896d701eeb3c38a3bcb188bcceacaba80b (patch) | |
| tree | 20b6acab6a0b26be9a9fb4a1f5da05a8d3f42477 | |
| parent | 233f3310aaf790b4cf12bcb9f42dd193467d25f3 (diff) | |
Make LLImageGL's loading of assets as sRGB or linear conditional based upon sRGB decode support.
| -rw-r--r-- | indra/llrender/llimagegl.cpp | 65 | 
1 files changed, 38 insertions, 27 deletions
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() ;  	}  | 
