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/newview/pipeline.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f84cd594c9..b9a917cfb4 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8779,7 +8779,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target) mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX); - gDeferredSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION); + gDeferredSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION, LLTexUnit::TT_TEXTURE, LLTexUnit::TCS_SRGB); for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter) { @@ -8807,7 +8807,8 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target) mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center)); } - gDeferredSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION); + gDeferredSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION, LLTexUnit::TT_TEXTURE, LLTexUnit::TCS_SRGB); + unbindDeferredShader(gDeferredSpotLightProgram); } @@ -8863,7 +8864,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target) bindDeferredShader(gDeferredMultiSpotLightProgram); - gDeferredMultiSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION); + gDeferredMultiSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION, LLTexUnit::TT_TEXTURE, LLTexUnit::TCS_SRGB); mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); @@ -8894,7 +8895,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target) mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); } - gDeferredMultiSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION); + gDeferredMultiSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION, LLTexUnit::TT_TEXTURE, LLTexUnit::TCS_SRGB); unbindDeferredShader(gDeferredMultiSpotLightProgram); gGL.popMatrix(); @@ -9139,7 +9140,7 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) img = LLViewerFetchedTexture::sWhiteImagep; } - S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_PROJECTION); + S32 channel = shader.enableTexture(LLShaderMgr::DEFERRED_PROJECTION, LLTexUnit::TT_TEXTURE, LLTexUnit::TCS_SRGB); if (channel > -1) { -- cgit v1.2.3 From a158c879578822a116e3f6a8c5dbbd1a14bb8c83 Mon Sep 17 00:00:00 2001 From: Geenz Date: Sat, 30 Mar 2019 17:22:54 -0700 Subject: Hide sRGB decode behind a flag, and make sure that sRGB decodes is strictly opt-in. --- indra/newview/pipeline.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index b9a917cfb4..df6383e88b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8281,7 +8281,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ stop_glerror(); - channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); + channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP, LLTexUnit::TCS_SRGB); if (channel > -1) { LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; @@ -8808,7 +8808,6 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target) mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center)); } gDeferredSpotLightProgram.disableTexture(LLShaderMgr::DEFERRED_PROJECTION, LLTexUnit::TT_TEXTURE, LLTexUnit::TCS_SRGB); - unbindDeferredShader(gDeferredSpotLightProgram); } @@ -9192,7 +9191,7 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) shader.disableTexture(LLShaderMgr::DEFERRED_NOISE); shader.disableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC); - S32 channel = shader.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); + S32 channel = shader.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP, LLTexUnit::TCS_SRGB); if (channel > -1) { LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; -- cgit v1.2.3 From 9d03722479a282592f3c339bdc267bfb84c78137 Mon Sep 17 00:00:00 2001 From: Geenz Date: Sat, 30 Mar 2019 17:47:08 -0700 Subject: Make sure the specular and diffuse buffers are being sampled in sRGB space. --- indra/newview/pipeline.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index df6383e88b..313edca345 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8145,6 +8145,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ { deferred_target->bindTexture(0,channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + gGL.getTexUnit(channel)->setTextureColorSpace(LLTexUnit::TCS_SRGB); } channel = shader.enableTexture(LLShaderMgr::DEFERRED_SPECULAR, deferred_target->getUsage()); @@ -8152,6 +8153,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ { deferred_target->bindTexture(1, channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + gGL.getTexUnit(channel)->setTextureColorSpace(LLTexUnit::TCS_SRGB); } channel = shader.enableTexture(LLShaderMgr::DEFERRED_NORMAL, deferred_target->getUsage()); @@ -8159,6 +8161,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ { deferred_target->bindTexture(2, channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + gGL.getTexUnit(channel)->setTextureColorSpace(LLTexUnit::TCS_LINEAR); } channel = shader.enableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_depth_target->getUsage()); -- cgit v1.2.3