diff options
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r-- | indra/newview/pipeline.cpp | 109 |
1 files changed, 46 insertions, 63 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index e441e189ad..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; @@ -526,6 +527,7 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("RenderResolutionDivisor"); connectRefreshCachedSettingsSafe("RenderUIBuffer"); connectRefreshCachedSettingsSafe("RenderShadowDetail"); + connectRefreshCachedSettingsSafe("MPRenderShadowOpti"); connectRefreshCachedSettingsSafe("RenderShadowSplits"); connectRefreshCachedSettingsSafe("RenderDeferredSSAO"); connectRefreshCachedSettingsSafe("RenderShadowResolutionScale"); @@ -599,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()) @@ -729,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; } @@ -946,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); @@ -1058,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"); @@ -1286,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) @@ -1412,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) @@ -1439,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; @@ -1486,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); } @@ -3957,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 @@ -4082,12 +4098,10 @@ 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. @@ -4097,12 +4111,10 @@ 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; @@ -4230,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) @@ -4328,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); @@ -4346,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) @@ -4371,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(); @@ -4456,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 @@ -4488,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(); } @@ -4547,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); @@ -4574,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"); @@ -4597,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 } } @@ -4621,9 +4614,7 @@ void LLPipeline::renderDebug() glLineWidth(1.f); } -#if GL_VERSION_1_1 glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); -#endif } } } @@ -4634,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"); @@ -4653,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 { @@ -4700,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); @@ -4727,9 +4710,7 @@ void LLPipeline::renderDebug() } gGL.end(); gGL.flush(); -#if GL_VERSION_1_1 glPointSize(1.f); -#endif } // Debug stuff. @@ -4933,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; @@ -4949,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; @@ -7239,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(); @@ -7573,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) @@ -7691,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) @@ -9314,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); @@ -9351,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); @@ -9517,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 { @@ -9559,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"); @@ -9889,7 +9868,7 @@ public: void LLPipeline::generateSunShadow(LLCamera& camera) { - if (!sRenderDeferred || RenderShadowDetail <= 0) + if (!sRenderDeferred || RenderShadowDetail <= 0 || (MPRenderShadowOpti > 0 && gCubeSnapshot)) { return; } @@ -10171,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) |