summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r--indra/newview/pipeline.cpp220
1 files changed, 132 insertions, 88 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 3240e2a663..6b3a5b1892 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -121,7 +121,7 @@
#include "SMAAAreaTex.h"
#include "SMAASearchTex.h"
-
+#include "llerror.h"
#ifndef LL_WINDOWS
#define A_GCC 1
#pragma GCC diagnostic ignored "-Wunused-function"
@@ -144,6 +144,7 @@ U32 LLPipeline::RenderFSAAType;
U32 LLPipeline::RenderResolutionDivisor;
bool LLPipeline::RenderUIBuffer;
S32 LLPipeline::RenderShadowDetail;
+S32 LLPipeline::MPRenderShadowOpti;
S32 LLPipeline::RenderShadowSplits;
bool LLPipeline::RenderDeferredSSAO;
F32 LLPipeline::RenderShadowResolutionScale;
@@ -431,6 +432,7 @@ void LLPipeline::init()
stop_glerror();
//create render pass pools
+ getPool(LLDrawPool::POOL_WATEREXCLUSION);
getPool(LLDrawPool::POOL_ALPHA_PRE_WATER);
getPool(LLDrawPool::POOL_ALPHA_POST_WATER);
getPool(LLDrawPool::POOL_SIMPLE);
@@ -525,6 +527,7 @@ void LLPipeline::init()
connectRefreshCachedSettingsSafe("RenderResolutionDivisor");
connectRefreshCachedSettingsSafe("RenderUIBuffer");
connectRefreshCachedSettingsSafe("RenderShadowDetail");
+ connectRefreshCachedSettingsSafe("MPRenderShadowOpti");
connectRefreshCachedSettingsSafe("RenderShadowSplits");
connectRefreshCachedSettingsSafe("RenderDeferredSSAO");
connectRefreshCachedSettingsSafe("RenderShadowResolutionScale");
@@ -598,7 +601,6 @@ void LLPipeline::init()
connectRefreshCachedSettingsSafe("RenderMirrors");
connectRefreshCachedSettingsSafe("RenderHeroProbeUpdateRate");
connectRefreshCachedSettingsSafe("RenderHeroProbeConservativeUpdateMultiplier");
- connectRefreshCachedSettingsSafe("RenderAutoHideSurfaceAreaLimit");
LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl("CollectFontVertexBuffers");
if (cntrl_ptr.notNull())
@@ -673,6 +675,8 @@ void LLPipeline::cleanup()
// don't delete wl sky pool it was handled above in the for loop
//delete mWLSkyPool;
mWLSkyPool = NULL;
+ delete mWaterExclusionPool;
+ mWaterExclusionPool = nullptr;
releaseGLBuffers();
@@ -726,7 +730,9 @@ void LLPipeline::resizeShadowTexture()
{
releaseSunShadowTargets();
releaseSpotShadowTargets();
- allocateShadowBuffer(mRT->width, mRT->height);
+ GLuint resX = gViewerWindow->getWorldViewWidthRaw();
+ GLuint resY = gViewerWindow->getWorldViewHeightRaw();
+ allocateShadowBuffer(resX, resY);
gResizeShadowTexture = false;
}
@@ -907,6 +913,15 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
mPostMap.allocate(resX, resY, screenFormat);
+ // The water exclusion mask needs its own depth buffer so we can take care of the problem of multiple water planes.
+ // Should we ever make water not just a plane, it also aids with that as well as the water planes will be rendered into the mask.
+ // Why do we do this? Because it saves us some janky logic in the exclusion shader when we generate the mask.
+ // Regardless, this should always only be an R8 texture unless we choose to start having multiple kinds of exclusion that 8 bits can't handle.
+ // - Geenz 2025-02-06
+ bool success = mWaterExclusionMask.allocate(resX, resY, GL_R8, true);
+
+ assert(success);
+
// used to scale down textures
// See LLViwerTextureList::updateImagesCreateTextures and LLImageGL::scaleDown
mDownResMap.allocate(1024, 1024, GL_RGBA);
@@ -934,7 +949,7 @@ bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY)
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
S32 shadow_detail = RenderShadowDetail;
- F32 scale = gCubeSnapshot ? 1.0f : llmax(0.f, RenderShadowResolutionScale); // Don't scale probe shadow maps
+ F32 scale = gCubeSnapshot ? 1.0f : llmax(0.5f, RenderShadowResolutionScale); // Don't scale probe shadow maps
U32 sun_shadow_map_width = BlurHappySize(resX, scale);
U32 sun_shadow_map_height = BlurHappySize(resY, scale);
@@ -1046,6 +1061,7 @@ void LLPipeline::refreshCachedSettings()
RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor");
RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer");
RenderShadowDetail = gSavedSettings.getS32("RenderShadowDetail");
+ MPRenderShadowOpti = gSavedSettings.getS32("MPRenderShadowOpti");
RenderShadowSplits = gSavedSettings.getS32("RenderShadowSplits");
RenderDeferredSSAO = gSavedSettings.getBOOL("RenderDeferredSSAO");
RenderShadowResolutionScale = gSavedSettings.getF32("RenderShadowResolutionScale");
@@ -1166,6 +1182,8 @@ void LLPipeline::releaseGLBuffers()
mSceneMap.release();
+ mWaterExclusionMask.release();
+
mPostMap.release();
mFXAAMap.release();
@@ -1272,8 +1290,11 @@ void LLPipeline::createGLBuffers()
}
allocateScreenBuffer(resX, resY);
- mRT->width = 0;
- mRT->height = 0;
+ // Do not zero out mRT dimensions here. allocateScreenBuffer() above
+ // already sets the correct dimensions. Zeroing them caused resizeShadowTexture()
+ // to fail if called immediately after createGLBuffers (e.g., post graphics change).
+ // mRT->width = 0;
+ // mRT->height = 0;
if (!mNoiseMap)
@@ -1398,7 +1419,18 @@ void LLPipeline::createLUTBuffers()
{
U32 lightResX = gSavedSettings.getU32("RenderSpecularResX");
U32 lightResY = gSavedSettings.getU32("RenderSpecularResY");
- F32* ls = new F32[lightResX*lightResY];
+ F32* ls = nullptr;
+ try
+ {
+ ls = new F32[lightResX*lightResY];
+ }
+ catch (std::bad_alloc&)
+ {
+ LLError::LLUserWarningMsg::showOutOfMemory();
+ // might be better to set the error into mFatalMessage and rethrow
+ LL_ERRS() << "Bad memory allocation in createLUTBuffers! lightResX: "
+ << lightResX << " lightResY: " << lightResY << LL_ENDL;
+ }
F32 specExp = gSavedSettings.getF32("RenderSpecularExponent");
// Calculate the (normalized) blinn-phong specular lookup texture. (with a few tweaks)
for (U32 y = 0; y < lightResY; ++y)
@@ -1425,7 +1457,7 @@ void LLPipeline::createLUTBuffers()
}
U32 pix_format = GL_R16F;
-#if LL_DARWIN
+#if 0 && LL_DARWIN
// Need to work around limited precision with 10.6.8 and older drivers
//
pix_format = GL_R32F;
@@ -1472,7 +1504,7 @@ void LLPipeline::createLUTBuffers()
glClearColor(0, 0, 0, 0);
mExposureMap.flush();
- mLuminanceMap.allocate(256, 256, GL_R16F, false, LLTexUnit::TT_TEXTURE, LLTexUnit::TMG_AUTO);
+ mLuminanceMap.allocate(256, 256, GL_R16F, false, LLTexUnit::TT_TEXTURE);
mLastExposure.allocate(1, 1, GL_R16F);
}
@@ -1676,6 +1708,10 @@ LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerTexture *tex0)
poolp = mPBRAlphaMaskPool;
break;
+ case LLDrawPool::POOL_WATEREXCLUSION:
+ poolp = mWaterExclusionPool;
+ break;
+
default:
llassert(0);
LL_ERRS() << "Invalid Pool Type in LLPipeline::findPool() type=" << type << LL_ENDL;
@@ -3855,7 +3891,12 @@ void LLPipeline::renderSelectedFaces(const LLColor4& color)
for (auto facep : mSelectedFaces)
{
- if (!facep || facep->getDrawable()->isDead())
+ if (!facep || !facep->getViewerObject())
+ {
+ LLSelectMgr::getInstance()->clearSelections();
+ return;
+ }
+ if (!facep->getDrawable() || facep->getDrawable()->isDead())
{
LL_ERRS() << "Bad face on selection" << LL_ENDL;
return;
@@ -3934,12 +3975,10 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
llassert(!sRenderingHUDs);
-#if GL_VERSION_1_1
if (gUseWireframe)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
-#endif
if (&camera == LLViewerCamera::getInstance())
{ // a bit hacky, this is the start of the main render frame, figure out delta between last modelview matrix and
@@ -4059,25 +4098,23 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
} // Tracy ZoneScoped
-#if GL_VERSION_1_1
if (gUseWireframe)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
-#endif
}
+// Render all of our geometry that's required after our deferred pass.
+// This is gonna be stuff like alpha, water, etc.
void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LL_PROFILE_GPU_ZONE("renderGeomPostDeferred");
-#if GL_VERSION_1_1
if (gUseWireframe)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
-#endif
U32 cur_type = 0;
@@ -4085,6 +4122,10 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
bool done_atmospherics = LLPipeline::sRenderingHUDs; //skip atmospherics on huds
bool done_water_haze = done_atmospherics;
+ bool done_water_exclusion = false;
+
+ // do water exclusion just before water pass.
+ U32 water_exclusion_pass = LLDrawPool::POOL_WATEREXCLUSION;
// do atmospheric haze just before post water alpha
U32 atmospherics_pass = LLDrawPool::POOL_ALPHA_POST_WATER;
@@ -4123,6 +4164,12 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
cur_type = poolp->getType();
+ if (cur_type >= water_exclusion_pass && !done_water_exclusion)
+ { // do water exclusion against depth buffer before rendering alpha
+ doWaterExclusionMask();
+ done_water_exclusion = true;
+ }
+
if (cur_type >= atmospherics_pass && !done_atmospherics)
{ // do atmospherics against depth buffer before rendering alpha
doAtmospherics();
@@ -4195,12 +4242,10 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
renderDebug();
}
-#if GL_VERSION_1_1
if (gUseWireframe)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
-#endif
}
void LLPipeline::renderGeomShadow(LLCamera& camera)
@@ -4293,9 +4338,7 @@ void LLPipeline::renderPhysicsDisplay()
gGL.flush();
gDebugProgram.bind();
-#if GL_VERSION_1_1
LLGLEnable(GL_POLYGON_OFFSET_LINE);
-#endif
glPolygonOffset(3.f, 3.f);
glLineWidth(3.f);
LLGLEnable blend(GL_BLEND);
@@ -4311,12 +4354,10 @@ void LLPipeline::renderPhysicsDisplay()
bool wireframe = (pass == 2);
-#if GL_VERSION_1_1
if (wireframe)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
-#endif
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
@@ -4336,12 +4377,10 @@ void LLPipeline::renderPhysicsDisplay()
}
gGL.flush();
-#if GL_VERSION_1_1
if (wireframe)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
-#endif
}
glLineWidth(1.f);
gDebugProgram.unbind();
@@ -4421,9 +4460,7 @@ void LLPipeline::renderDebug()
glClearColor(clearColor.mV[0],clearColor.mV[1],clearColor.mV[2],0);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // no stencil -- deprecated | GL_STENCIL_BUFFER_BIT);
gGL.setColorMask(true, false);
-#if GL_VERSION_1_1
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-#endif
}
//NavMesh
@@ -4453,9 +4490,7 @@ void LLPipeline::renderDebug()
gPathfindingProgram.bind();
gGL.flush();
-#if GL_VERSION_1_1
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-#endif
glLineWidth(1.0f);
gGL.flush();
}
@@ -4512,9 +4547,8 @@ void LLPipeline::renderDebug()
LLGLDisable cull(i >= 2 ? GL_CULL_FACE : 0);
gGL.flush();
-#if GL_VERSION_1_1
+
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-#endif
//get rid of some z-fighting
LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
@@ -4539,10 +4573,8 @@ void LLPipeline::renderDebug()
gGL.flush();
}
-#if GL_VERSION_1_1
LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE);
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
-#endif
F32 offset = gSavedSettings.getF32("PathfindingLineOffset");
@@ -4562,14 +4594,10 @@ void LLPipeline::renderDebug()
}
else
{
-#if GL_VERSION_1_1
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-#endif
gPathfindingProgram.uniform1f(sAmbiance, ambiance);
llPathingLibInstance->renderNavMeshShapesVBO( render_order[i] );
-#if GL_VERSION_1_1
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-#endif
}
}
@@ -4586,9 +4614,7 @@ void LLPipeline::renderDebug()
glLineWidth(1.f);
}
-#if GL_VERSION_1_1
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-#endif
}
}
}
@@ -4599,9 +4625,7 @@ void LLPipeline::renderDebug()
{ //render navmesh xray
F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance");
-#if GL_VERSION_1_1
LLGLEnable lineOffset(GL_POLYGON_OFFSET_LINE);
-#endif
LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
F32 offset = gSavedSettings.getF32("PathfindingLineOffset");
@@ -4618,14 +4642,10 @@ void LLPipeline::renderDebug()
if (gSavedSettings.getBOOL("PathfindingXRayWireframe"))
{ //draw hidden wireframe as darker and less opaque
-#if GL_VERSION_1_1
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
-#endif
gPathfindingProgram.uniform1f(sAmbiance, 1.f);
llPathingLibInstance->renderNavMesh();
-#if GL_VERSION_1_1
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-#endif
}
else
{
@@ -4665,9 +4685,7 @@ void LLPipeline::renderDebug()
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep, true);
-#if GL_VERSION_1_1
glPointSize(8.f);
-#endif
LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
gGL.begin(LLRender::POINTS);
@@ -4692,9 +4710,7 @@ void LLPipeline::renderDebug()
}
gGL.end();
gGL.flush();
-#if GL_VERSION_1_1
glPointSize(1.f);
-#endif
}
// Debug stuff.
@@ -4898,9 +4914,7 @@ void LLPipeline::renderDebug()
{
//render visible point cloud
gGL.flush();
-#if GL_VERSION_1_1
glPointSize(8.f);
-#endif
gGL.begin(LLRender::POINTS);
F32* c = col+i*4;
@@ -4914,9 +4928,7 @@ void LLPipeline::renderDebug()
gGL.end();
gGL.flush();
-#if GL_VERSION_1_1
glPointSize(1.f);
-#endif
LLVector3* ext = mShadowExtents[i];
LLVector3 pos = (ext[0]+ext[1])*0.5f;
@@ -5238,6 +5250,17 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp )
}
break;
+ case LLDrawPool::POOL_WATEREXCLUSION:
+ if (mWaterExclusionPool)
+ {
+ llassert(0);
+ LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Water Exclusion Pool" << LL_ENDL;
+ }
+ else
+ {
+ mWaterExclusionPool = new_poolp;
+ }
+ break;
default:
llassert(0);
@@ -5360,6 +5383,11 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp )
mPBRAlphaMaskPool = NULL;
break;
+ case LLDrawPool::POOL_WATEREXCLUSION:
+ llassert(poolp == mWaterExclusionPool);
+ mWaterExclusionPool = nullptr;
+ break;
+
default:
llassert(0);
LL_WARNS() << "Invalid Pool Type in LLPipeline::removeFromQuickLookup() type=" << poolp->getType() << LL_ENDL;
@@ -7118,7 +7146,7 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool
LLSettingsSky::ptr_t sky = LLEnvironment::instance().getCurrentSky();
- F32 probe_ambiance = LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance(should_auto_adjust);
+ F32 probe_ambiance = LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance(should_auto_adjust());
F32 exp_min = 1.f;
F32 exp_max = 1.f;
@@ -7129,13 +7157,13 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool
{
if (dynamic_exposure_enabled)
{
- exp_min = sky->getHDROffset() - sky->getHDRMin();
- exp_max = sky->getHDROffset() + sky->getHDRMax();
+ exp_min = sky->getHDROffset(should_auto_adjust()) - sky->getHDRMin(should_auto_adjust());
+ exp_max = sky->getHDROffset(should_auto_adjust()) + sky->getHDRMax(should_auto_adjust());
}
else
{
- exp_min = sky->getHDROffset();
- exp_max = sky->getHDROffset();
+ exp_min = sky->getHDROffset(should_auto_adjust());
+ exp_max = sky->getHDROffset(should_auto_adjust());
}
}
else if (dynamic_exposure_enabled)
@@ -7155,7 +7183,7 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst, bool
shader->uniform1f(dt, gFrameIntervalSeconds);
shader->uniform2f(noiseVec, ll_frand() * 2.0f - 1.0f, ll_frand() * 2.0f - 1.0f);
shader->uniform4f(dynamic_exposure_params, dynamic_exposure_coefficient, exp_min, exp_max, dynamic_exposure_speed_error);
- shader->uniform4f(dynamic_exposure_params2, sky->getHDROffset(), exp_min, exp_max, dynamic_exposure_speed_target);
+ shader->uniform4f(dynamic_exposure_params2, sky->getHDROffset(should_auto_adjust()), exp_min, exp_max, dynamic_exposure_speed_target);
mScreenTriangleVB->setBuffer();
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
@@ -7188,7 +7216,7 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst)
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- bool no_post = gSnapshotNoPost || psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f || (buildNoPost && gFloaterTools->isAvailable());
+ bool no_post = gSnapshotNoPost || psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f || (buildNoPost && gFloaterTools && gFloaterTools->isAvailable());
LLGLSLShader& shader = no_post ? gNoPostTonemapProgram : gDeferredPostTonemapProgram;
shader.bind();
@@ -7213,7 +7241,7 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst)
static LLCachedControl<U32> tonemap_type_setting(gSavedSettings, "RenderTonemapType", 0U);
shader.uniform1i(tonemap_type, tonemap_type_setting);
- shader.uniform1f(tonemap_mix, psky->getTonemapMix());
+ shader.uniform1f(tonemap_mix, psky->getTonemapMix(should_auto_adjust()));
mScreenTriangleVB->setBuffer();
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
@@ -7522,7 +7550,8 @@ void LLPipeline::applyFXAA(LLRenderTarget* src, LLRenderTarget* dst)
void LLPipeline::generateSMAABuffers(LLRenderTarget* src)
{
llassert(!gCubeSnapshot);
- bool multisample = RenderFSAAType == 2 && gSMAAEdgeDetectProgram[0].isComplete() && mFXAAMap.isComplete() && mSMAABlendBuffer.isComplete();
+ if(RenderFSAAType < 2) return;
+ bool multisample = gSMAAEdgeDetectProgram[0].isComplete() && mFXAAMap.isComplete() && mSMAABlendBuffer.isComplete();
// Present everything.
if (multisample)
@@ -7640,7 +7669,13 @@ void LLPipeline::generateSMAABuffers(LLRenderTarget* src)
void LLPipeline::applySMAA(LLRenderTarget* src, LLRenderTarget* dst)
{
llassert(!gCubeSnapshot);
- bool multisample = RenderFSAAType == 2 && gSMAAEdgeDetectProgram[0].isComplete() && mFXAAMap.isComplete() && mSMAABlendBuffer.isComplete();
+
+ bool multisample = false;
+
+ if(RenderFSAAType > 1)
+ {
+ multisample = gSMAAEdgeDetectProgram[0].isComplete() && mFXAAMap.isComplete() && mSMAABlendBuffer.isComplete();
+ }
// Present everything.
if (multisample)
@@ -8433,13 +8468,13 @@ void LLPipeline::renderDeferredLighting()
setupHWLights(); // to set mSun/MoonDir;
- glm::vec4 tc(glm::make_vec4(mSunDir.mV));
+ glm::vec4 tc(mSunDir);
tc = mat * tc;
- mTransformedSunDir.set(glm::value_ptr(tc));
+ mTransformedSunDir.set(tc);
- glm::vec4 tc_moon(glm::make_vec4(mMoonDir.mV));
+ glm::vec4 tc_moon(mMoonDir);
tc_moon = mat * tc_moon;
- mTransformedMoonDir.set(glm::value_ptr(tc_moon));
+ mTransformedMoonDir.set(tc_moon);
if ((RenderDeferredSSAO && !gCubeSnapshot) || RenderShadowDetail > 0)
{
@@ -8692,7 +8727,7 @@ void LLPipeline::renderDeferredLighting()
continue;
}
- glm::vec3 tc(glm::make_vec3(c));
+ glm::vec3 tc(center);
tc = mul_mat4_vec3(mat, tc);
fullscreen_lights.push_back(LLVector4(tc.x, tc.y, tc.z, s));
@@ -8799,13 +8834,12 @@ void LLPipeline::renderDeferredLighting()
LLDrawable* drawablep = *iter;
LLVOVolume* volume = drawablep->getVOVolume();
LLVector3 center = drawablep->getPositionAgent();
- F32* c = center.mV;
F32 light_size_final = volume->getLightRadius() * 1.5f;
F32 light_falloff_final = volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF);
sVisibleLightCount++;
- glm::vec3 tc(glm::make_vec3(c));
+ glm::vec3 tc(center);
tc = mul_mat4_vec3(mat, tc);
setupSpotLight(gDeferredMultiSpotLightProgram, drawablep);
@@ -8862,6 +8896,7 @@ void LLPipeline::renderDeferredLighting()
LLPipeline::RENDER_TYPE_FULLBRIGHT_ALPHA_MASK,
LLPipeline::RENDER_TYPE_TERRAIN,
LLPipeline::RENDER_TYPE_WATER,
+ LLPipeline::RENDER_TYPE_WATEREXCLUSION,
END_RENDER_TYPES);
renderGeomPostDeferred(*LLViewerCamera::getInstance());
@@ -9000,6 +9035,8 @@ void LLPipeline::doWaterHaze()
static LLStaticHashedString above_water_str("above_water");
haze_shader.uniform1i(above_water_str, sUnderWaterRender ? -1 : 1);
+ haze_shader.bindTexture(LLShaderMgr::WATER_EXCLUSIONTEX, &mWaterExclusionMask);
+
if (LLPipeline::sUnderWaterRender)
{
LLGLDepthTest depth(GL_FALSE);
@@ -9030,6 +9067,17 @@ void LLPipeline::doWaterHaze()
}
}
+void LLPipeline::doWaterExclusionMask()
+{
+ mWaterExclusionMask.bindTarget();
+ glClearColor(1, 1, 1, 1);
+ mWaterExclusionMask.clear();
+ mWaterExclusionPool->render();
+
+ mWaterExclusionMask.flush();
+ glClearColor(0, 0, 0, 0);
+}
+
void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep)
{
//construct frustum
@@ -9250,13 +9298,9 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)
return;
}
-#if GL_VERSION_4_0
S32 channel = shader.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);
-#else
- S32 channel;
-#endif
bool bound = false;
-#if GL_VERSION_4_0
+
if (channel > -1 && mReflectionMapManager.mTexture.notNull())
{
mReflectionMapManager.mTexture->bind(channel);
@@ -9287,7 +9331,6 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)
setEnvMat(shader);
}
-#endif
// reflection probe shaders generally sample the scene map as well for SSR
channel = shader.enableTexture(LLShaderMgr::SCENE_MAP);
@@ -9453,7 +9496,6 @@ void LLPipeline::renderShadow(const glm::mat4& view, const glm::mat4& proj, LLCa
}
};
-
LLVertexBuffer::unbind();
for (int j = 0; j < 2; ++j) // 0 -- static, 1 -- rigged
{
@@ -9495,6 +9537,7 @@ void LLPipeline::renderShadow(const glm::mat4& view, const glm::mat4& proj, LLCa
renderGeomShadow(shadow_cam);
}
+ if(MPRenderShadowOpti < 3)
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("shadow alpha");
LL_PROFILE_GPU_ZONE("shadow alpha");
@@ -9825,7 +9868,7 @@ public:
void LLPipeline::generateSunShadow(LLCamera& camera)
{
- if (!sRenderDeferred || RenderShadowDetail <= 0)
+ if (!sRenderDeferred || RenderShadowDetail <= 0 || (MPRenderShadowOpti > 0 && gCubeSnapshot))
{
return;
}
@@ -9946,10 +9989,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
LLVector3 lightDir = -caster_dir;
lightDir.normVec();
- glm::vec3 light_dir(glm::make_vec3(lightDir.mV));
-
//create light space camera matrix
-
LLVector3 at = lightDir;
LLVector3 up = camera.getAtAxis();
@@ -10001,9 +10041,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
//get good split distances for frustum
for (U32 i = 0; i < fp.size(); ++i)
{
- glm::vec3 v(glm::make_vec3(fp[i].mV));
+ glm::vec3 v(fp[i]);
v = mul_mat4_vec3(saved_view, v);
- fp[i].setVec(glm::value_ptr(v));
+ fp[i] = LLVector3(v);
}
min = fp[0];
@@ -10110,8 +10150,12 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
std::vector<LLVector3> fp;
+ U32 splits = 3;
+ if(MPRenderShadowOpti == 1) splits = 2;
+ else if(MPRenderShadowOpti >= 2) splits = 1;
+
if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir)
- || j > RenderShadowSplits)
+ || j > splits)
{
//no possible shadow receivers
if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
@@ -10152,9 +10196,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
for (U32 i = 0; i < fp.size(); i++)
{
- glm::vec3 p = glm::make_vec3(fp[i].mV);
+ glm::vec3 p(fp[i]);
p = mul_mat4_vec3(view[j], p);
- wpf.push_back(LLVector3(glm::value_ptr(p)));
+ wpf.push_back(LLVector3(p));
}
min = wpf[0];
@@ -10355,19 +10399,19 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
view[j] = glm::inverse(view[j]);
//llassert(origin.isFinite());
- glm::vec3 origin_agent(glm::make_vec3(origin.mV));
+ glm::vec3 origin_agent(origin);
//translate view to origin
origin_agent = mul_mat4_vec3(view[j], origin_agent);
- eye = LLVector3(glm::value_ptr(origin_agent));
+ eye = LLVector3(origin_agent);
//llassert(eye.isFinite());
if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA) && !gCubeSnapshot)
{
mShadowFrustOrigin[j] = eye;
}
- view[j] = look(LLVector3(glm::value_ptr(origin_agent)), lightDir, -up);
+ view[j] = look(LLVector3(origin_agent), lightDir, -up);
F32 fx = 1.f/tanf(fovx);
F32 fz = 1.f/tanf(fovz);