diff options
author | Graham Madarasz <graham@lindenlab.com> | 2013-06-17 12:56:08 -0700 |
---|---|---|
committer | Graham Madarasz <graham@lindenlab.com> | 2013-06-17 12:56:08 -0700 |
commit | c1b7c8cacb6f6bcb8f6b9c7f73e059a41fee8c33 (patch) | |
tree | 833e947755cb1f1c23fb0aa347c3c5d3debeea48 /indra | |
parent | c603eb5ece7ca2f2faa870bfd89f5f4e71e2b8f0 (diff) |
NORSPEC-246 Force light func to use GL_R32F format for more precision on older nV mobile cards with single FP hardware
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/pipeline.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8942092221..4a1b182fd2 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1190,7 +1190,14 @@ void LLPipeline::releaseLUTBuffers() { if (mLightFunc) { - LLImageGL::deleteTextures(LLTexUnit::TT_TEXTURE, GL_R16F, 0, 1, &mLightFunc); + U32 pix_format = GL_R16F; +#if LL_DARWIN + if (gGLManager.mIsMobileGF) + { + pix_format = GL_R32F; + } +#endif + LLImageGL::deleteTextures(LLTexUnit::TT_TEXTURE, pix_format, 0, 1, &mLightFunc); mLightFunc = 0; } } @@ -1367,7 +1374,7 @@ void LLPipeline::createLUTBuffers() // This is fine, given we only need to create our LUT once per buffer initialization. spec *= (((n + 2) * (n + 4)) / (8 * F_PI * (powf(2, -n/2) + n))); - // Since we use R16F, we no longer have a dynamic range issue we need to work around here. + // Since we use R16/32F, we no longer have a dynamic range issue we need to work around here. // Though some older drivers may not like this, newer drivers shouldn't have this problem. ls[y*lightResX+x] = spec; @@ -1390,9 +1397,16 @@ void LLPipeline::createLUTBuffers() } } - LLImageGL::generateTextures(LLTexUnit::TT_TEXTURE, GL_R16F, 1, &mLightFunc); + U32 pix_format = GL_R16F; +#if LL_DARWIN + if (gGLManager.mIsMobileGF) + { + pix_format = GL_R32F; + } +#endif + LLImageGL::generateTextures(LLTexUnit::TT_TEXTURE, pix_format, 1, &mLightFunc); gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc); - LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_R16F, lightResX, lightResY, GL_RED, GL_FLOAT, ls, false); + LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, pix_format, lightResX, lightResY, GL_RED, GL_FLOAT, ls, false); //LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_UNSIGNED_BYTE, lightResX, lightResY, GL_RED, GL_UNSIGNED_BYTE, ls, false); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); |