diff options
-rw-r--r-- | autobuild.xml | 12 | ||||
-rw-r--r-- | indra/llrender/llrender.h | 9 | ||||
-rw-r--r-- | indra/llrender/llrendertarget.cpp | 12 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl | 31 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/environment/srgbF.glsl | 5 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 37 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.h | 2 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 4 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 33 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_adjust_environment.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 33 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml | 2 |
13 files changed, 131 insertions, 62 deletions
diff --git a/autobuild.xml b/autobuild.xml index 53d5ee795f..7ae7f86932 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1,5 +1,6 @@ <?xml version="1.0" ?> -<llsd><map> +<llsd> +<map> <key>installables</key> <map> <key>SDL</key> @@ -773,9 +774,11 @@ <key>archive</key> <map> <key>hash</key> - <string>4f8dc85863fec36e8d872c31f4abcd05</string> + <string>7cc58b3acb230a7e65ea5f0ff800be393eb4aa1b</string> + <key>hash_algorithm</key> + <string>sha1</string> <key>url</key> - <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/101480/892402/glext-68-common-572829.tar.bz2</string> + <string>https://github.com/secondlife/3p-glext/releases/download/v69/glext-68-common-685b36e.tar.zst</string> </map> <key>name</key> <string>common</string> @@ -3511,4 +3514,5 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string> <string>autobuild</string> <key>version</key> <string>1.3</string> - </map></llsd> + </map> +</llsd> diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 909a1de2b3..98141d71f5 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -545,12 +545,7 @@ glh::matrix4f gl_ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, glh::matrix4f gl_perspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar); glh::matrix4f gl_lookat(LLVector3 eye, LLVector3 center, LLVector3 up); -#if LL_RELEASE_FOR_DOWNLOAD - #define LL_SHADER_LOADING_WARNS(...) LL_WARNS_ONCE("ShaderLoading") - #define LL_SHADER_UNIFORM_ERRS(...) LL_WARNS_ONCE("Shader") -#else - #define LL_SHADER_LOADING_WARNS(...) LL_WARNS() - #define LL_SHADER_UNIFORM_ERRS(...) LL_ERRS("Shader") -#endif +#define LL_SHADER_LOADING_WARNS(...) LL_WARNS() +#define LL_SHADER_UNIFORM_ERRS(...) LL_ERRS("Shader") #endif diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 629664b76d..88c48e5166 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -388,14 +388,14 @@ void LLRenderTarget::release() glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); } - if (mFBO == sCurFBO) - { - sCurFBO = 0; - glBindFramebuffer(GL_FRAMEBUFFER, 0); - } - if (mFBO) { + if (mFBO == sCurFBO) + { + sCurFBO = 0; + glBindFramebuffer(GL_FRAMEBUFFER, 0); + } + glDeleteFramebuffers(1, (GLuint *) &mFBO); mFBO = 0; } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index cda71dd9b0..97f07e5952 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9230,6 +9230,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>RenderDisablePostProcessing</key> + <map> + <key>Comment</key> + <string>Disable tone mapping and exposure correction when build floater is open (for artists developing materials)</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>RenderMaxOpenGLVersion</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl index 82d7bb9835..80816912da 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -104,20 +104,20 @@ vec3 toneMapACES_Hill(vec3 color) uniform float exposure; uniform float gamma; -vec3 legacy_adjust_post(vec3 c); - -vec3 toneMap(vec3 color, float gs) +vec3 toneMap(vec3 color) { +#ifndef NO_POST float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r; - color *= exposure * exp_scale * gs; + color *= exposure * exp_scale; color = toneMapACES_Hill(color); +#else + color *= 0.6; +#endif color = linear_to_srgb(color); - color = legacy_adjust_post(color); - return color; } @@ -170,22 +170,19 @@ vec3 legacyGamma(vec3 color) return color; } -float legacyGammaApprox() -{ - //TODO -- figure out how to plumb this in as a uniform - float c = 0.5; - float gc = 1.0-pow(c, gamma); - - return gc/c * gamma; -} - void main() { //this is the one of the rare spots where diffuseRect contains linear color values (not sRGB) vec4 diff = texture2D(diffuseRect, vary_fragcoord); - diff.rgb = toneMap(diff.rgb, legacyGammaApprox()); - + diff.rgb = toneMap(diff.rgb); + +#ifdef LEGACY_GAMMA +#ifndef NO_POST + diff.rgb = legacyGamma(diff.rgb); +#endif +#endif + vec2 tc = vary_fragcoord.xy*screen_res*4.0; vec3 seed = (diff.rgb+vec3(1.0))*vec3(tc.xy, tc.x+tc.y); vec3 nz = vec3(noise(seed.rg), noise(seed.gb), noise(seed.rb)); diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl index 35f2395ef1..3817633df0 100644 --- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl @@ -128,8 +128,3 @@ vec3 legacy_adjust_fullbright(vec3 c) return c / exp_scale * 1.34; } - -vec3 legacy_adjust_post(vec3 c) -{ - return c; -} diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 63cc7ba623..8925cc2f9b 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -188,6 +188,8 @@ LLGLSLShader gDeferredPostProgram; LLGLSLShader gDeferredCoFProgram; LLGLSLShader gDeferredDoFCombineProgram; LLGLSLShader gDeferredPostGammaCorrectProgram; +LLGLSLShader gNoPostGammaCorrectProgram; +LLGLSLShader gLegacyPostGammaCorrectProgram; LLGLSLShader gExposureProgram; LLGLSLShader gLuminanceProgram; LLGLSLShader gFXAAProgram; @@ -295,6 +297,8 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gHUDPBRAlphaProgram); mShaderList.push_back(&gDeferredSkinnedPBRAlphaProgram); mShaderList.push_back(&gDeferredPostGammaCorrectProgram); // for gamma + mShaderList.push_back(&gNoPostGammaCorrectProgram); + mShaderList.push_back(&gLegacyPostGammaCorrectProgram); } @@ -1010,6 +1014,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gExposureProgram.unload(); gLuminanceProgram.unload(); gDeferredPostGammaCorrectProgram.unload(); + gNoPostGammaCorrectProgram.unload(); + gLegacyPostGammaCorrectProgram.unload(); gFXAAProgram.unload(); gDeferredWLSkyProgram.unload(); gDeferredWLCloudProgram.unload(); @@ -2537,6 +2543,37 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() success = gDeferredPostGammaCorrectProgram.createShader(NULL, NULL); llassert(success); } + + if (success) + { + gNoPostGammaCorrectProgram.mName = "No Post Gamma Correction Post Process"; + gNoPostGammaCorrectProgram.mFeatures.hasSrgb = true; + gNoPostGammaCorrectProgram.mFeatures.isDeferred = true; + gNoPostGammaCorrectProgram.mShaderFiles.clear(); + gNoPostGammaCorrectProgram.clearPermutations(); + gNoPostGammaCorrectProgram.addPermutation("NO_POST", "1"); + gNoPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); + gNoPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER)); + gNoPostGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gNoPostGammaCorrectProgram.createShader(NULL, NULL); + llassert(success); + } + + if (success) + { + gLegacyPostGammaCorrectProgram.mName = "Legacy Gamma Correction Post Process"; + gLegacyPostGammaCorrectProgram.mFeatures.hasSrgb = true; + gLegacyPostGammaCorrectProgram.mFeatures.isDeferred = true; + gLegacyPostGammaCorrectProgram.mShaderFiles.clear(); + gLegacyPostGammaCorrectProgram.clearPermutations(); + gLegacyPostGammaCorrectProgram.addPermutation("LEGACY_GAMMA", "1"); + gLegacyPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); + gLegacyPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER)); + gLegacyPostGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; + success = gLegacyPostGammaCorrectProgram.createShader(NULL, NULL); + llassert(success); + } + if (success && gGLManager.mGLVersion > 3.9f) { diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 129802aca5..492e60b840 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -235,6 +235,8 @@ extern LLGLSLShader gDeferredDoFCombineProgram; extern LLGLSLShader gFXAAProgram; extern LLGLSLShader gDeferredPostNoDoFProgram; extern LLGLSLShader gDeferredPostGammaCorrectProgram; +extern LLGLSLShader gNoPostGammaCorrectProgram; +extern LLGLSLShader gLegacyPostGammaCorrectProgram; extern LLGLSLShader gExposureProgram; extern LLGLSLShader gLuminanceProgram; extern LLGLSLShader gDeferredAvatarShadowProgram; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 3061b07259..12ceb86e52 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5833,7 +5833,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) const LLTextureEntry* te = facep->getTextureEntry(); LLViewerTexture* tex = facep->getTexture(); - if (te->getGlow() >= 1.f/255.f) + if (te->getGlow() > 0.f) { emissive = true; } @@ -5917,7 +5917,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) { LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial(); - if (gltf_mat != nullptr || (te->getMaterialParams().notNull() && !te->getMaterialID().isNull())) + if (gltf_mat != nullptr || (te->getMaterialParams().notNull())) { if (gltf_mat != nullptr) { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index adfac1f934..c482256309 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -963,7 +963,7 @@ void LLPipeline::refreshCachedSettings() WindLightUseAtmosShaders = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("WindLightUseAtmosShaders"); RenderDeferred = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("RenderDeferred"); RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash"); - RenderFSAASamples = gSavedSettings.getU32("RenderFSAASamples"); + RenderFSAASamples = LLFeatureManager::getInstance()->isFeatureAvailable("RenderFSAASamples") ? gSavedSettings.getU32("RenderFSAASamples") : 0; RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor"); RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer"); RenderShadowDetail = gSavedSettings.getS32("RenderShadowDetail"); @@ -7010,9 +7010,19 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst) { static LLCachedControl<F32> dynamic_exposure_min(gSavedSettings, "RenderDynamicExposureMin", 0.125f); static LLCachedControl<F32> dynamic_exposure_max(gSavedSettings, "RenderDynamicExposureMax", 1.3f); + F32 exposure_max = dynamic_exposure_max; + LLSettingsSky::ptr_t sky = LLEnvironment::instance().getCurrentSky(); + + if (sky->getReflectionProbeAmbiance() > 0.f) + { //not a legacy sky, use gamma as a boost to max exposure + exposure_max = llmax(exposure_max - 1.f, 0.f); + exposure_max *= sky->getGamma(); + exposure_max += 1.f; + } + gExposureProgram.uniform1f(dt, gFrameIntervalSeconds); gExposureProgram.uniform2f(noiseVec, ll_frand() * 2.0 - 1.0, ll_frand() * 2.0 - 1.0); - gExposureProgram.uniform3f(dynamic_exposure_params, dynamic_exposure_coefficient, dynamic_exposure_min, dynamic_exposure_max); + gExposureProgram.uniform3f(dynamic_exposure_params, dynamic_exposure_coefficient, dynamic_exposure_min, exposure_max); mScreenTriangleVB->setBuffer(); mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); @@ -7029,18 +7039,25 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) { { LL_PROFILE_GPU_ZONE("gamma correct"); + static LLCachedControl<bool> no_post(gSavedSettings, "RenderDisablePostProcessing", false); + LLGLDepthTest depth(GL_FALSE, GL_FALSE); // Apply gamma correction to the frame here. - gDeferredPostGammaCorrectProgram.bind(); + + LLGLSLShader& shader = no_post && gFloaterTools->isAvailable() ? gNoPostGammaCorrectProgram : // no post (no gamma, no exposure, no tonemapping) + LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance() == 0.f ? gLegacyPostGammaCorrectProgram : + gDeferredPostGammaCorrectProgram; + + shader.bind(); S32 channel = 0; - gDeferredPostGammaCorrectProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, false, LLTexUnit::TFO_POINT); + shader.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, false, LLTexUnit::TFO_POINT); - gDeferredPostGammaCorrectProgram.bindTexture(LLShaderMgr::EXPOSURE_MAP, &mExposureMap); + shader.bindTexture(LLShaderMgr::EXPOSURE_MAP, &mExposureMap); - gDeferredPostGammaCorrectProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, src->getWidth(), src->getHeight()); + shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, src->getWidth(), src->getHeight()); static LLCachedControl<F32> exposure(gSavedSettings, "RenderExposure", 1.f); @@ -7048,13 +7065,13 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) { static LLStaticHashedString s_exposure("exposure"); - gDeferredPostGammaCorrectProgram.uniform1f(s_exposure, e); + shader.uniform1f(s_exposure, e); mScreenTriangleVB->setBuffer(); mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); gGL.getTexUnit(channel)->unbind(src->getUsage()); - gDeferredPostGammaCorrectProgram.unbind(); + shader.unbind(); } dst->flush(); } diff --git a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml index ca5c7fe264..aef923feb2 100644 --- a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml +++ b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml @@ -239,7 +239,7 @@ layout="topleft" left_delta="-5" top_pad="15" - width="80">Scene Gamma:</text> + width="80">Brightness:</text> <slider decimal_digits="2" follows="left|top" height="16" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 255797a733..df067d2b88 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1501,7 +1501,28 @@ function="World.EnvPreset" function="ToggleControl" parameter="ShowSelectionBeam" /> </menu_item_check> - + <menu_item_check + label="Highlight Transparent" + name="Highlight Transparent" + shortcut="control|alt|T" + use_mac_ctrl="true"> + <menu_item_check.on_check + function="View.CheckHighlightTransparent" /> + <menu_item_check.on_click + function="View.HighlightTransparent" /> + </menu_item_check> + <menu_item_separator/> + + <menu_item_check + label="No Post" + name="No Post"> + <menu_item_check.on_check + control="RenderDisablePostProcessing" /> + <menu_item_check.on_click + function="ToggleControl" + parameter="RenderDisablePostProcessing" /> + </menu_item_check> + <menu_item_separator/> <menu_item_check @@ -1911,16 +1932,6 @@ function="World.EnvPreset" parameter="HideSelectedObjects" /> </menu_item_check> <menu_item_check - label="Highlight Transparent" - name="Highlight Transparent" - shortcut="control|alt|T" - use_mac_ctrl="true"> - <menu_item_check.on_check - function="View.CheckHighlightTransparent" /> - <menu_item_check.on_click - function="View.HighlightTransparent" /> - </menu_item_check> - <menu_item_check label="Show Mouselook Crosshairs" name="ShowCrosshairs"> <menu_item_check.on_check diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml index 622c999254..e90e6caf84 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml @@ -223,7 +223,7 @@ left_delta="-5" top_delta="25" width="80"> - Scene Gamma: + Brightness: </text> <slider decimal_digits="2" |