From 7f0c81918575d3f05e4eadc160b600eaa8b383d1 Mon Sep 17 00:00:00 2001 From: mobserveur Date: Sat, 30 Aug 2025 01:59:43 +0200 Subject: Performance Optimisations, Bloom effect, Visuals Panel This commit contains performance optimisations in the the pipeline, framebuffer, vertexbuffer, reflection probes, shadows. It also fixes many opengl errors, modifies the opengl debugging, and adds a visuals effects panel. --- indra/newview/llviewershadermgr.cpp | 67 ++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 8 deletions(-) (limited to 'indra/newview/llviewershadermgr.cpp') diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 7ef13c3a35..4d62adf3e2 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -137,6 +137,10 @@ LLGLSLShader gGlowProgram; LLGLSLShader gGlowExtractProgram; LLGLSLShader gPostScreenSpaceReflectionProgram; +LLGLSLShader gBloomExtractProgram; +LLGLSLShader gBloomBlurProgram; +LLGLSLShader gBloomCombineProgram; + // Deferred rendering shaders LLGLSLShader gDeferredImpostorProgram; LLGLSLShader gDeferredDiffuseProgram; @@ -802,7 +806,7 @@ std::string LLViewerShaderMgr::loadBasicShaders() if (shadow_detail >= 1) { - attribs["SUN_SHADOW"] = "1"; + attribs["SUN_SHADOW"] = "1"; if (shadow_detail >= 2) { @@ -902,8 +906,9 @@ bool LLViewerShaderMgr::loadShadersWater() bool success = true; bool terrainWaterSuccess = true; + S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail"); bool use_sun_shadow = mShaderLevel[SHADER_DEFERRED] > 1 && - gSavedSettings.getS32("RenderShadowDetail") > 0; + shadow_detail > 0; if (mShaderLevel[SHADER_WATER] == 0) { @@ -1001,6 +1006,52 @@ bool LLViewerShaderMgr::loadShadersEffects() return true; } + if (success) + { + gBloomExtractProgram.mName = "Bloom Extract Shader"; + gBloomExtractProgram.mShaderFiles.clear(); + gBloomExtractProgram.mShaderFiles.push_back(make_pair("effects/bloomExtractV.glsl", GL_VERTEX_SHADER)); + gBloomExtractProgram.mShaderFiles.push_back(make_pair("effects/bloomExtractF.glsl", GL_FRAGMENT_SHADER)); + gBloomExtractProgram.mShaderLevel = mShaderLevel[SHADER_EFFECT]; + + success = gBloomExtractProgram.createShader(); + if (!success) + { + LL_WARNS() << "gBloomExtractProgram creation ERROR" << LL_ENDL; + //LLPipeline::sRenderGlow = false; + } + } + + if (success) + { + gBloomBlurProgram.mName = "Bloom Blur Shader"; + gBloomBlurProgram.mShaderFiles.clear(); + gBloomBlurProgram.mShaderFiles.push_back(make_pair("effects/bloomBlurV.glsl", GL_VERTEX_SHADER)); + gBloomBlurProgram.mShaderFiles.push_back(make_pair("effects/bloomBlurF.glsl", GL_FRAGMENT_SHADER)); + gBloomBlurProgram.mShaderLevel = mShaderLevel[SHADER_EFFECT]; + + success = gBloomBlurProgram.createShader(); + if(!success) + { + LL_WARNS() << "gBloomBlurProgram creation ERROR" << LL_ENDL; + } + } + + if (success) + { + gBloomCombineProgram.mName = "Bloom Combine Shader"; + gBloomCombineProgram.mShaderFiles.clear(); + gBloomCombineProgram.mShaderFiles.push_back(make_pair("effects/bloomCombineV.glsl", GL_VERTEX_SHADER)); + gBloomCombineProgram.mShaderFiles.push_back(make_pair("effects/bloomCombineF.glsl", GL_FRAGMENT_SHADER)); + gBloomCombineProgram.mShaderLevel = mShaderLevel[SHADER_EFFECT]; + + success = gBloomCombineProgram.createShader(); + if(!success) + { + LL_WARNS() << "gBloomCombineProgram creation ERROR" << LL_ENDL; + } + } + if (success) { gGlowProgram.mName = "Glow Shader (Post)"; @@ -2482,9 +2533,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() if (success && gGLManager.mGLVersion > 3.9f) { std::vector> quality_levels = { {"12", "Low"}, - {"23", "Medium"}, - {"28", "High"}, - {"39", "Ultra"} }; + {"23", "Medium"}, + {"28", "High"}, + {"39", "Ultra"} }; int i = 0; bool failed = false; for (const auto& quality_pair : quality_levels) @@ -2535,9 +2586,9 @@ bool LLViewerShaderMgr::loadShadersDeferred() if (gGLManager.mGLVersion > 3.15f && success) { std::vector> quality_levels = { {"SMAA_PRESET_LOW", "Low"}, - {"SMAA_PRESET_MEDIUM", "Medium"}, - {"SMAA_PRESET_HIGH", "High"}, - {"SMAA_PRESET_ULTRA", "Ultra"} }; + {"SMAA_PRESET_MEDIUM", "Medium"}, + {"SMAA_PRESET_HIGH", "High"}, + {"SMAA_PRESET_ULTRA", "Ultra"} }; int i = 0; bool failed = false; for (const auto& smaa_pair : quality_levels) -- cgit v1.2.3 From ccf0114f36968d6cf6dfb11e1c5a035406314924 Mon Sep 17 00:00:00 2001 From: mobserveur Date: Mon, 8 Sep 2025 17:26:53 +0200 Subject: Optimisations and experimental HDR display support on mac This commit completes the previous ones for performance optimisations, and adds HDR display support on mac --- indra/newview/llviewershadermgr.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewershadermgr.cpp') diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 4d62adf3e2..18407b5b43 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -202,6 +202,7 @@ LLGLSLShader gDeferredPostTonemapProgram; LLGLSLShader gNoPostTonemapProgram; LLGLSLShader gDeferredPostGammaCorrectProgram; LLGLSLShader gLegacyPostGammaCorrectProgram; +LLGLSLShader gHDRGammaCorrectProgram; LLGLSLShader gExposureProgram; LLGLSLShader gExposureProgramNoFade; LLGLSLShader gLuminanceProgram; @@ -449,6 +450,7 @@ void LLViewerShaderMgr::finalizeShaderList() mShaderList.push_back(&gNoPostTonemapProgram); mShaderList.push_back(&gDeferredPostGammaCorrectProgram); // for gamma mShaderList.push_back(&gLegacyPostGammaCorrectProgram); + mShaderList.push_back(&gHDRGammaCorrectProgram); mShaderList.push_back(&gDeferredDiffuseProgram); mShaderList.push_back(&gDeferredBumpProgram); mShaderList.push_back(&gDeferredPBROpaqueProgram); @@ -802,13 +804,16 @@ std::string LLViewerShaderMgr::loadBasicShaders() S32 probe_level = llclamp(gSavedSettings.getS32("RenderReflectionProbeLevel"), 0, 3); - S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail"); + S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail"); if (shadow_detail >= 1) { - attribs["SUN_SHADOW"] = "1"; + if(shadow_detail < 3) + { + attribs["SUN_SHADOW"] = "1"; + } - if (shadow_detail >= 2) + if (shadow_detail > 1) { attribs["SPOT_SHADOW"] = "1"; } @@ -908,7 +913,7 @@ bool LLViewerShaderMgr::loadShadersWater() S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail"); bool use_sun_shadow = mShaderLevel[SHADER_DEFERRED] > 1 && - shadow_detail > 0; + shadow_detail > 0 && shadow_detail < 3; if (mShaderLevel[SHADER_WATER] == 0) { @@ -1158,6 +1163,7 @@ bool LLViewerShaderMgr::loadShadersDeferred() gLuminanceProgram.unload(); gDeferredPostGammaCorrectProgram.unload(); gLegacyPostGammaCorrectProgram.unload(); + gHDRGammaCorrectProgram.unload(); gDeferredPostTonemapProgram.unload(); gNoPostTonemapProgram.unload(); for (auto i = 0; i < 4; ++i) @@ -2499,6 +2505,21 @@ bool LLViewerShaderMgr::loadShadersDeferred() llassert(success); } + if (success) + { + gHDRGammaCorrectProgram.mName = "HDR Gamma Correction Post Process"; + gHDRGammaCorrectProgram.mFeatures.hasSrgb = true; + gHDRGammaCorrectProgram.mFeatures.isDeferred = true; + gHDRGammaCorrectProgram.mShaderFiles.clear(); + gHDRGammaCorrectProgram.clearPermutations(); + //gHDRGammaCorrectProgram.addPermutation("HDR_GAMMA", "1"); + gHDRGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); + gHDRGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/MPHDRDisplayGammaF.glsl", GL_FRAGMENT_SHADER)); + gHDRGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gHDRGammaCorrectProgram.createShader(); + llassert(success); + } + if (success) { gDeferredPostTonemapProgram.mName = "Deferred Tonemap Post Process"; -- cgit v1.2.3 From 317dcdea1ca8d1f540187af47fc23a36ad8232aa Mon Sep 17 00:00:00 2001 From: mobserveur Date: Sat, 30 Aug 2025 01:59:43 +0200 Subject: Performance Optimisations, Bloom effect, Visuals Panel This commit contains performance optimisations in the the pipeline, framebuffer, vertexbuffer, reflection probes, shadows. It also fixes many opengl errors, modifies the opengl debugging, and adds a visuals effects panel. --- indra/newview/llviewershadermgr.cpp | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'indra/newview/llviewershadermgr.cpp') diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 7ef13c3a35..753652f168 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -137,6 +137,10 @@ LLGLSLShader gGlowProgram; LLGLSLShader gGlowExtractProgram; LLGLSLShader gPostScreenSpaceReflectionProgram; +LLGLSLShader gBloomExtractProgram; +LLGLSLShader gBloomBlurProgram; +LLGLSLShader gBloomCombineProgram; + // Deferred rendering shaders LLGLSLShader gDeferredImpostorProgram; LLGLSLShader gDeferredDiffuseProgram; @@ -1001,6 +1005,52 @@ bool LLViewerShaderMgr::loadShadersEffects() return true; } + if (success) + { + gBloomExtractProgram.mName = "Bloom Extract Shader"; + gBloomExtractProgram.mShaderFiles.clear(); + gBloomExtractProgram.mShaderFiles.push_back(make_pair("effects/bloomExtractV.glsl", GL_VERTEX_SHADER)); + gBloomExtractProgram.mShaderFiles.push_back(make_pair("effects/bloomExtractF.glsl", GL_FRAGMENT_SHADER)); + gBloomExtractProgram.mShaderLevel = mShaderLevel[SHADER_EFFECT]; + + success = gBloomExtractProgram.createShader(); + if (!success) + { + LL_WARNS() << "gBloomExtractProgram creation ERROR" << LL_ENDL; + //LLPipeline::sRenderGlow = false; + } + } + + if (success) + { + gBloomBlurProgram.mName = "Bloom Blur Shader"; + gBloomBlurProgram.mShaderFiles.clear(); + gBloomBlurProgram.mShaderFiles.push_back(make_pair("effects/bloomBlurV.glsl", GL_VERTEX_SHADER)); + gBloomBlurProgram.mShaderFiles.push_back(make_pair("effects/bloomBlurF.glsl", GL_FRAGMENT_SHADER)); + gBloomBlurProgram.mShaderLevel = mShaderLevel[SHADER_EFFECT]; + + success = gBloomBlurProgram.createShader(); + if(!success) + { + LL_WARNS() << "gBloomBlurProgram creation ERROR" << LL_ENDL; + } + } + + if (success) + { + gBloomCombineProgram.mName = "Bloom Combine Shader"; + gBloomCombineProgram.mShaderFiles.clear(); + gBloomCombineProgram.mShaderFiles.push_back(make_pair("effects/bloomCombineV.glsl", GL_VERTEX_SHADER)); + gBloomCombineProgram.mShaderFiles.push_back(make_pair("effects/bloomCombineF.glsl", GL_FRAGMENT_SHADER)); + gBloomCombineProgram.mShaderLevel = mShaderLevel[SHADER_EFFECT]; + + success = gBloomCombineProgram.createShader(); + if(!success) + { + LL_WARNS() << "gBloomCombineProgram creation ERROR" << LL_ENDL; + } + } + if (success) { gGlowProgram.mName = "Glow Shader (Post)"; -- cgit v1.2.3