diff --git a/indra/newview/llvoclouds.cpp b/indra/newview/llvoclouds.cpp index 0947e6025..24f64a70e 100644 --- a/indra/newview/llvoclouds.cpp +++ b/indra/newview/llvoclouds.cpp @@ -142,7 +142,6 @@ BOOL LLVOClouds::updateGeometry(LLDrawable *drawable) group->setState(LLSpatialGroup::GEOM_DIRTY); } drawable->setNumFaces(0, NULL, getTEImage(0)); - LLPipeline::sCompiles++; return TRUE; } @@ -195,7 +194,6 @@ BOOL LLVOClouds::updateGeometry(LLDrawable *drawable) } mDrawable->movePartition(); - LLPipeline::sCompiles++; return TRUE; } diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 9d802740f..5988ece29 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -492,7 +492,6 @@ void LLVOGrass::plantBlades() mDepth = (face->mCenterLocal - LLViewerCamera::getInstance()->getOrigin())*LLViewerCamera::getInstance()->getAtAxis(); mDrawable->setPosition(face->mCenterLocal); mDrawable->movePartition(); - LLPipeline::sCompiles++; } void LLVOGrass::getGeometry(S32 idx, @@ -620,7 +619,6 @@ void LLVOGrass::getGeometry(S32 idx, index_offset += 8; } - LLPipeline::sCompiles++; } U32 LLVOGrass::getPartitionType() const diff --git a/indra/newview/llvoground.cpp b/indra/newview/llvoground.cpp index 97b7418b4..6ffb580cd 100644 --- a/indra/newview/llvoground.cpp +++ b/indra/newview/llvoground.cpp @@ -156,6 +156,5 @@ BOOL LLVOGround::updateGeometry(LLDrawable *drawable) *(texCoordsp++) = LLVector2(0.5f, 0.5f); face->getVertexBuffer()->flush(); - LLPipeline::sCompiles++; return TRUE; } diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 0e17c77ef..7b4077798 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -339,7 +339,6 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) group->setState(LLSpatialGroup::GEOM_DIRTY); } drawable->setNumFaces(0, NULL, getTEImage(0)); - LLPipeline::sCompiles++; return TRUE; } @@ -482,7 +481,6 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) mScale.set(max_scale, max_scale, max_scale); mDrawable->movePartition(); - LLPipeline::sCompiles++; return TRUE; } diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index a1b22fec8..83f8d9388 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -1410,8 +1410,6 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) { setDrawRefl(-1); } - - LLPipeline::sCompiles++; return TRUE; } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index cadae6ab6..c56156b24 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1686,11 +1686,6 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) // Update face flags updateFaceFlags(); - if(compiled) - { - LLPipeline::sCompiles++; - } - mVolumeChanged = FALSE; mLODChanged = FALSE; mSculptChanged = FALSE; @@ -4515,8 +4510,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) vobj->isMesh() && gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj); - //bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic(); - bool is_rigged = false; static const LLCachedControl alt_batching("SHAltBatching",true); @@ -5534,8 +5527,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac LLViewerTexture* tex = facep->getTexture(); LLMaterialPtr mat = facep->getTextureEntry()->getMaterialParams(); - //bool bake_sunlight = LLPipeline::sBakeSunlight && facep->getDrawable()->isStatic(); - static const LLCachedControl alt_batching("SHAltBatching",true); if (!alt_batching && distance_sort) { diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp index b4ab34d36..516429f22 100644 --- a/indra/newview/llvowater.cpp +++ b/indra/newview/llvowater.cpp @@ -247,7 +247,6 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable) buff->flush(); mDrawable->movePartition(); - LLPipeline::sCompiles++; return TRUE; } diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp index a0c303bf9..96239a22b 100644 --- a/indra/newview/llvowlsky.cpp +++ b/indra/newview/llvowlsky.cpp @@ -484,8 +484,6 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) updateStarColors(); updateStarGeometry(drawable); - LLPipeline::sCompiles++; - return TRUE; } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3107696ec..7e050cde8 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -292,8 +292,6 @@ void glh_set_last_projection(const LLMatrix4a& mat) void display_update_camera(bool tiling=false); //---------------------------------------- -S32 LLPipeline::sCompiles = 0; - BOOL LLPipeline::sPickAvatar = TRUE; BOOL LLPipeline::sDynamicLOD = TRUE; BOOL LLPipeline::sShowHUDAttachments = TRUE; @@ -313,7 +311,6 @@ BOOL LLPipeline::sAutoMaskAlphaDeferred = TRUE; BOOL LLPipeline::sAutoMaskAlphaNonDeferred = FALSE; BOOL LLPipeline::sDisableShaders = FALSE; BOOL LLPipeline::sRenderBump = TRUE; -BOOL LLPipeline::sBakeSunlight = FALSE; BOOL LLPipeline::sNoAlpha = FALSE; BOOL LLPipeline::sUseFarClip = TRUE; BOOL LLPipeline::sShadowRender = FALSE; @@ -332,7 +329,7 @@ BOOL LLPipeline::sRenderDeferred = FALSE; BOOL LLPipeline::sMemAllocationThrottled = FALSE; S32 LLPipeline::sVisibleLightCount = 0; F32 LLPipeline::sMinRenderSize = 0.f; -BOOL LLPipeline::sRenderingHUDs; +BOOL LLPipeline::sRenderingHUDs = FALSE; static LLCullResult* sCull = NULL; @@ -367,10 +364,6 @@ LLPipeline::LLPipeline() : mMeanBatchSize(0), mTrianglesDrawn(0), mNumVisibleNodes(0), - mVerticesRelit(0), - mLightingChanges(0), - mGeometryChanges(0), - mNumVisibleFaces(0), mInitialized(FALSE), mVertexShadersEnabled(FALSE), @@ -1821,11 +1814,6 @@ void LLPipeline::resetFrameStats() mMeanBatchSize = gPipeline.mTrianglesDrawn/gPipeline.mBatchCount; } mTrianglesDrawn = 0; - sCompiles = 0; - mVerticesRelit = 0; - mLightingChanges = 0; - mGeometryChanges = 0; - mNumVisibleFaces = 0; if (mOldRenderDebugMask != mRenderDebugMask) { @@ -2668,7 +2656,6 @@ BOOL LLPipeline::updateDrawableGeom(LLDrawable* drawablep, BOOL priority) if (update_complete && assertInitialized()) { drawablep->setState(LLDrawable::BUILT); - mGeometryChanges++; } return update_complete; } @@ -3458,9 +3445,6 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) } } } - - - mNumVisibleFaces += drawablep->getNumFaces(); } @@ -6826,7 +6810,6 @@ void LLPipeline::doResetVertexBuffers() LLVertexBuffer::sPreferStreamDraw = gSavedSettings.getBOOL("RenderPreferStreamDraw"); LLVertexBuffer::sEnableVBOs = gSavedSettings.getBOOL("RenderVBOEnable"); LLVertexBuffer::sDisableVBOMapping = LLVertexBuffer::sEnableVBOs;// && gSavedSettings.getBOOL("RenderVBOMappingDisable") ; //Temporary workaround for vbo mapping being straight up broken - sBakeSunlight = gSavedSettings.getBOOL("RenderBakeSunlight"); sNoAlpha = gSavedSettings.getBOOL("RenderNoAlpha"); LLPipeline::sTextureBindTest = gSavedSettings.getBOOL("RenderDebugTextureBind"); @@ -8032,42 +8015,6 @@ void LLPipeline::renderDeferredLighting() mDeferredLight.clear(GL_COLOR_BUFFER_BIT); glClearColor(0,0,0,0); - /*glh::matrix4f inv_trans = glh_get_current_modelview().inverse().transpose(); - - const U32 slice = 32; - F32 offset[slice*3]; - for (U32 i = 0; i < 4; i++) - { - for (U32 j = 0; j < 8; j++) - { - glh::vec3f v; - v.set_value(sinf(6.284f/8*j), cosf(6.284f/8*j), -(F32) i); -#if 0 - // Singu note: the call to mult_matrix_vec can crash, because it attempts to divide by zero. - v.normalize(); - inv_trans.mult_matrix_vec(v); -#else - // However, because afterwards we normalize the vector anyway, there is an alternative - // way to calculate the same thing without the division (which happens to be faster, too). - glh::vec4f src(v, v.length()); // Make a copy of the source and extent it with its length. - glh::vec4f dst; - inv_trans.mult_matrix_vec(src, dst); // Do a normal 4D multiplication. - dst.get_value(v[0], v[1], v[2], dst[3]); // Copy the first 3 coordinates to v. - // At this point v is equal to what it used to be, except for a constant factor (v.length() * dst[3]), - // but that doesn't matter because the next step is normalizaton. The old computation would crash - // if v.length() is zero in the commented out v.normalize(), and in inv_trans.mult_matrix_vec(v) - // if dst[3] is zero (which some times happens). Now we will only crash if v.length() is zero - // and well in the next line (but this never happens). --Aleric -#endif - v.normalize(); - offset[(i*8+j)*3+0] = v.v[0]; - offset[(i*8+j)*3+1] = v.v[2]; - offset[(i*8+j)*3+2] = v.v[1]; - } - } - - gDeferredSunProgram.uniform3fv(sOffset, slice, offset);*/ - gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredLight.getWidth(), mDeferredLight.getHeight()); //Enable bilinear filtering, as the screen tex resolution may not match current framebuffer resolution. Eg, half-res SSAO @@ -8700,26 +8647,6 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) mDeferredLight.clear(GL_COLOR_BUFFER_BIT); glClearColor(0,0,0,0); - /*glh::matrix4f inv_trans = glh_get_current_modelview().inverse().transpose(); - - const U32 slice = 32; - F32 offset[slice*3]; - for (U32 i = 0; i < 4; i++) - { - for (U32 j = 0; j < 8; j++) - { - glh::vec3f v; - v.set_value(sinf(6.284f/8*j), cosf(6.284f/8*j), -(F32) i); - v.normalize(); - inv_trans.mult_matrix_vec(v); - v.normalize(); - offset[(i*8+j)*3+0] = v.v[0]; - offset[(i*8+j)*3+1] = v.v[2]; - offset[(i*8+j)*3+2] = v.v[1]; - } - } - - gDeferredSunProgram.uniform3fv(LLShaderMgr::DEFERRED_SHADOW_OFFSET, slice, offset);*/ gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredLight.getWidth(), mDeferredLight.getHeight()); //Enable bilinear filtering, as the screen tex resolution may not match current framebuffer resolution. Eg, half-res SSAO @@ -10109,9 +10036,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) //far clip on last split is minimum of camera view distance and 128 mSunClipPlanes = LLVector4(clip, clip.mV[2] * clip.mV[2]/clip.mV[1]); - clip = RenderShadowOrthoClipPlanes; - mSunOrthoClipPlanes = LLVector4(clip, clip.mV[2]*clip.mV[2]/clip.mV[1]); - //currently used for amount to extrude frusta corners for constructing shadow frusta //LLVector3 n = RenderShadowNearDist; //F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] }; @@ -10127,8 +10051,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLVector3 lightDir = -mSunDir; lightDir.normVec(); - glh::vec3f light_dir(lightDir.mV); - //create light space camera matrix LLVector3 at = lightDir; @@ -10310,9 +10232,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) } mShadow[j].flush(); - mShadowError.mV[j] = 0.f; - mShadowFOV.mV[j] = 0.f; - continue; } @@ -10422,20 +10341,19 @@ void LLPipeline::generateSunShadow(LLCamera& camera) bfb = lp.mV[1]-bfm*lp.mV[0]; //calculate error - mShadowError.mV[j] = 0.f; + F32 shadow_error = 0.f; for (U32 i = 0; i < wpf.size(); ++i) { F32 lx = (wpf[i].mV[1]-bfb)/bfm; - mShadowError.mV[j] += fabsf(wpf[i].mV[0]-lx); + shadow_error += fabsf(wpf[i].mV[0]-lx); } - mShadowError.mV[j] /= wpf.size(); - mShadowError.mV[j] /= size.mV[0]; + shadow_error /= wpf.size(); + shadow_error /= size.mV[0]; - if (mShadowError.mV[j] > RenderShadowErrorCutoff) + if (shadow_error > RenderShadowErrorCutoff) { //just use ortho projection - mShadowFOV.mV[j] = -1.f; origin.clearVec(); proj[j] = gGL.genOrtho(min.mV[0], max.mV[0], min.mV[1], max.mV[1], -max.mV[2], -min.mV[2]); } @@ -10476,8 +10394,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) F32 cutoff = llmin((F32) RenderShadowFOVCutoff, 1.4f); - mShadowFOV.mV[j] = fovx; - if (fovx < cutoff && fovz > cutoff) { //x is a good fit, but z is too big, move away from zp enough so that fovz matches cutoff @@ -10505,7 +10421,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) fovx = acos(fovx); fovz = acos(fovz); - mShadowFOV.mV[j] = cutoff; } @@ -10525,7 +10440,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) if (fovx > cutoff) { //just use ortho projection origin.clearVec(); - mShadowError.mV[j] = -1.f; proj[j] = gGL.genOrtho(min.mV[0], max.mV[0], min.mV[1], max.mV[1], -max.mV[2], -min.mV[2]); } else @@ -10540,11 +10454,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) eye = LLVector3(origin_agent.getF32ptr()); - if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) - { - mShadowFrustOrigin[j] = eye; - } - view[j] = gGL.genLook(LLVector3(origin_agent.getF32ptr()), lightDir, -up); F32 fx = 1.f/tanf(fovx); @@ -10580,7 +10489,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) mShadowModelview[j] = view[j]; mShadowProjection[j] = proj[j]; - LLMatrix4a sunshadowi; + mSunShadowMatrix[j].setMul(gGL.genNDCtoWC(),proj[j]); mSunShadowMatrix[j].mul_affine(view[j]); mSunShadowMatrix[j].mul_affine(inv_view); @@ -10713,7 +10622,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) mShadowModelview[i+4] = view[i+4]; mShadowProjection[i+4] = proj[i+4]; - LLMatrix4a sunshadowi; mSunShadowMatrix[i+4].setMul(gGL.genNDCtoWC(),proj[i+4]); mSunShadowMatrix[i+4].mul_affine(view[i+4]); mSunShadowMatrix[i+4].mul_affine(inv_view); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index c19746ee9..d9d6a36d6 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -549,11 +549,6 @@ public: LLSpatialPartition* getSpatialPartition(LLViewerObject* vobj); - void updateCamera(BOOL reset = FALSE); - - LLVector3 mFlyCamPosition; - LLQuaternion mFlyCamRotation; - BOOL mBackfaceCull; S32 mBatchCount; S32 mMatrixOpCount; @@ -563,18 +558,6 @@ public: S32 mMeanBatchSize; S32 mTrianglesDrawn; S32 mNumVisibleNodes; - S32 mVerticesRelit; - - S32 mDebugTextureUploadCost; - S32 mDebugSculptUploadCost; - S32 mDebugMeshUploadCost; - - S32 mLightingChanges; - S32 mGeometryChanges; - - S32 mNumVisibleFaces; - - static S32 sCompiles; static BOOL sShowHUDAttachments; static BOOL sForceOldBakedUpload; // If true will not use capabilities to upload baked textures. @@ -584,7 +567,6 @@ public: static BOOL sAutoMaskAlphaNonDeferred; static BOOL sDisableShaders; // if TRUE, rendering will be done without shaders static BOOL sRenderBump; - static BOOL sBakeSunlight; static BOOL sNoAlpha; static BOOL sUseFarClip; static BOOL sShadowRender; @@ -607,33 +589,39 @@ public: static F32 sMinRenderSize; static BOOL sRenderingHUDs; - //screen texture +public: + //screen texture LLRenderTarget mScreen; LLRenderTarget mDeferredScreen; +private: LLRenderTarget mFXAABuffer; - LLRenderTarget mEdgeMap; +public: LLRenderTarget mDeferredDepth; +private: LLRenderTarget mDeferredDownsampledDepth; LLRenderTarget mOcclusionDepth; LLRenderTarget mDeferredLight; +public: LLMultisampleBuffer mSampleBuffer; +private: LLRenderTarget mPhysicsDisplay; //utility buffer for rendering post effects, gets abused by renderDeferredLighting LLPointer mDeferredVB; +public: //utility buffer for rendering cubes, 8 vertices are corners of a cube [-1, 1] LLPointer mCubeVB; +private: //sun shadow map LLRenderTarget mShadow[6]; LLRenderTarget mShadowOcclusion[6]; std::vector mShadowFrustPoints[4]; - LLVector4 mShadowError; - LLVector4 mShadowFOV; - LLVector3 mShadowFrustOrigin[4]; +public: LLCamera mShadowCamera[8]; +private: LLVector3 mShadowExtents[4][2]; LLMatrix4a mSunShadowMatrix[6]; LLMatrix4a mShadowModelview[6]; @@ -644,16 +632,14 @@ public: LLPointer mTargetShadowSpotLight[2]; LLVector4 mSunClipPlanes; - LLVector4 mSunOrthoClipPlanes; - - LLVector2 mScreenScale; - +public: //water reflection texture LLRenderTarget mWaterRef; //water distortion texture (refraction) LLRenderTarget mWaterDis; +private: //texture for making the glow LLRenderTarget mGlow[2]; @@ -666,12 +652,13 @@ public: LLVector3 mSunDir; LL_ALIGN_16(LLVector4a mTransformedSunDir); +public: BOOL mInitialized; BOOL mVertexShadersEnabled; S32 mVertexShadersLoaded; // 0 = no, 1 = yes, -1 = failed U32 mTransformFeedbackPrimitives; //number of primitives expected to be generated by transform feedback -protected: +private: BOOL mRenderTypeEnabled[NUM_RENDER_TYPES]; std::stack mRenderTypeEnableStack;