diff options
author | Erik Kundiman <erik@megapahit.org> | 2025-09-12 07:29:26 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2025-09-12 07:57:30 +0800 |
commit | f87fa59b1e490d7a752bf8937bc67b7b18a62ad5 (patch) | |
tree | 1794ca14a7da95fbaa621661c2096a4b39142fb2 /indra/newview/pipeline.cpp | |
parent | 7279245b5fee11bf0683a068639d42f3bacd5e6b (diff) | |
parent | 067d83b640d3fae45098ef8bc71e913c1eb65a44 (diff) |
Merge remote-tracking branch 'mobserveur/experimental2'
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r-- | indra/newview/pipeline.cpp | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 800ed79d8a..84b83357b2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -356,14 +356,12 @@ bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false) static LLCachedControl<bool> has_emissive(gSavedSettings, "RenderEnableEmissiveBuffer", false); static LLCachedControl<bool> has_hdr(gSavedSettings, "RenderHDREnabled", true); static LLCachedControl<U32> MPColorPrecision(gSavedSettings, "MPColorPrecision", 0); + static LLCachedControl<bool> MPHDRDisplay(gSavedSettings, "MPHDRDisplay", false); bool hdr = has_hdr() && gGLManager.mGLVersion > 4.05f; - if (!hdr || MPColorPrecision < 2) - { - norm = GL_RGB10_A2; - emissive = GL_RGB8; - } + if (!hdr || MPColorPrecision != 2) norm = GL_RGB10_A2; + if (!hdr || (!MPHDRDisplay && MPColorPrecision == 1)) emissive = GL_RGB8; bool valid = true; valid = valid && target.addColorAttachment(orm); // frag-data[1] specular OR PBR ORM @@ -874,15 +872,15 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY, U32 type_) //allocate deferred rendering color buffers GLuint deferredScreenFormat = GL_RGBA8; - if((hdr || mHDRDisplay) && MPColorPrecision == 2) deferredScreenFormat = GL_RGBA16F; + if((hdr && MPColorPrecision == 2)) deferredScreenFormat = GL_RGBA16F; if (!mRT->deferredScreen.allocate(resX, resY, deferredScreenFormat, true)) return false; if (!addDeferredAttachments(mRT->deferredScreen)) return false; - GLuint screenFormat = GL_RGBA8; - if(hdr || mHDRDisplay) screenFormat = GL_RGBA16F; + GLuint screenFormat = GL_RGBA16F; + if(!hdr && !mHDRDisplay && MPColorPrecision == 1) screenFormat = GL_RGB8; - if (!mRT->screen.allocate(resX, resY, GL_RGBA16F)) return false; + if (!mRT->screen.allocate(resX, resY, screenFormat)) return false; mRT->deferredScreen.shareDepthBuffer(mRT->screen); @@ -901,7 +899,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY, U32 type_) if (!gCubeSnapshot) // hack to not re-allocate various targets for cube snapshots { GLuint UIFormat = GL_RGBA8; - if(mHDRDisplay && MPColorPrecision == 2) UIFormat = GL_RGBA16F; + //if(mHDRDisplay && MPColorPrecision == 2) UIFormat = GL_RGBA16F; if (RenderUIBuffer) { @@ -914,7 +912,15 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY, U32 type_) if (RenderFSAAType > 0) { GLuint AAFormat = GL_RGBA8; - if(mHDRDisplay && MPColorPrecision == 2) AAFormat = GL_RGBA16F; + if(mHDRDisplay && MPColorPrecision == 2) + { + LL_WARNS() << "AA SET TO GL_RGBA16F" << LL_ENDL; + AAFormat = GL_RGBA16F; + } + else + { + LL_WARNS() << "AA SET TO GL_RGBA8" << LL_ENDL; + } if (!mFXAAMap.allocate(resX, resY, AAFormat)) return false; if (RenderFSAAType == 2) @@ -3891,10 +3897,6 @@ void render_hud_elements() gGL.color4f(1, 1, 1, 1); LLGLDepthTest depth(GL_TRUE, GL_FALSE); - static LLCachedControl<bool> HDRDisplay(gSavedSettings, "MPHDRDisplay"); - static LLCachedControl<F32> hdrUIBoost(gSavedSettings, "MPHDRUIBoost"); - if(HDRDisplay) gUIProgram.uniform1f(LLShaderMgr::MP_HDR_BOOST, (GLfloat)hdrUIBoost); - if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { gViewerWindow->renderSelections(false, false, false); // For HUD version in render_ui_3d() @@ -7362,7 +7364,7 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) if(mHDRDisplay) { shader.uniform1f(LLShaderMgr::GAMMA, (GLfloat)mp_hdr_gamma); - shader.uniform1f(LLShaderMgr::MP_HDR_BOOST, (GLfloat)mp_hdr_boost); + shader.uniform1f(LLShaderMgr::MP_HDR_BOOST, 1.0); } renderTriangle(); @@ -7686,14 +7688,14 @@ void LLPipeline::generateSMAABuffers(LLRenderTarget* src) edge_shader.bind(); edge_shader.uniform4fv(sSmaaRTMetrics, 1, rt_metrics); - S32 channel = edge_shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, src->getUsage()); + S32 channel = edge_shader.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE); + if (channel > -1) { if (!use_sample) { - //src->bindTexture(0, channel, LLTexUnit::TFO_POINT); - //gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); src->bindTexture(0, channel, LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); } else { @@ -8101,7 +8103,7 @@ bool LLPipeline::renderBloom(LLRenderTarget* src, LLRenderTarget* dst) gBloomExtractProgram.bind(); gBloomExtractProgram.bindTexture(LLShaderMgr::DIFFUSE_MAP, &mRT->screen); gBloomExtractProgram.bindTexture(LLShaderMgr::BLOOM_EXTRACT_ORM, &mRT->deferredScreen, false, LLTexUnit::TFO_POINT, 1); - gBloomExtractProgram.bindTexture(LLShaderMgr::BLOOM_EXTRACT_EMISSIVE, &mGlow[1], false, LLTexUnit::TFO_POINT, 0); + //gBloomExtractProgram.bindTexture(LLShaderMgr::BLOOM_EXTRACT_EMISSIVE, &mGlow[1], false, LLTexUnit::TFO_POINT, 0); gBloomExtractProgram.bindTexture(LLShaderMgr::BLOOM_EXTRACT_EMISSIVE2, &mRT->deferredScreen, false, LLTexUnit::TFO_POINT, 3); gBloomExtractProgram.uniform1f(LLShaderMgr::BLOOM_EXTRACT_BRIGHTNESS, 1.0 - mp_bloom_extract_brightness); @@ -8224,6 +8226,8 @@ void LLPipeline::renderFinalize() LLRenderTarget* postHDRBuffer = &mRT->screen; + generateSMAABuffers(&mRT->screen); + if (hdr) { copyScreenSpaceReflections(&mRT->screen, &mSceneMap); @@ -10400,6 +10404,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLVector3 split_exp = RenderShadowSplitExponent; F32 da = 1.f-llmax( fabsf(lightDir*up), fabsf(lightDir*camera.getLeftAxis()) ); da = powf(da, split_exp.mV[2]); + F32 sxp = split_exp.mV[1] + (split_exp.mV[0]-split_exp.mV[1])*da; for (U32 i = 0; i < splits; ++i) |