diff options
author | Cosmic Linden <cosmic@lindenlab.com> | 2023-10-13 10:38:54 -0700 |
---|---|---|
committer | Cosmic Linden <cosmic@lindenlab.com> | 2023-10-13 10:38:54 -0700 |
commit | d6aced7abf0c54ec94033534124025c87fb9aeb2 (patch) | |
tree | f4e4a9690b4b4244693d02e2fe5aaa3fc823d41d | |
parent | 35d889f7af9686b79fe0e5255121a444a044beab (diff) |
DRTVWR-592: Remove WIP separate code path for terrain geometry rebuilds for PBR as that is not needed at the moment
-rw-r--r-- | indra/newview/lldrawpoolterrain.cpp | 4 | ||||
-rw-r--r-- | indra/newview/lldrawpoolterrain.h | 1 | ||||
-rw-r--r-- | indra/newview/llsurfacepatch.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llsurfacepatch.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewercontrol.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llvlcomposition.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llvlcomposition.h | 2 | ||||
-rw-r--r-- | indra/newview/llvosurfacepatch.cpp | 56 | ||||
-rw-r--r-- | indra/newview/llvosurfacepatch.h | 12 |
9 files changed, 30 insertions, 67 deletions
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 85b4bb3dca..fb27729b57 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -56,7 +56,6 @@ int DebugDetailMap = 0; const S32 PBR_DETAIL_EMISSIVE = 0; -S32 LLDrawPoolTerrain::sDetailMode = 1; S32 LLDrawPoolTerrain::sPBRDetailMode = 0; F32 LLDrawPoolTerrain::sDetailScale = DETAIL_SCALE; F32 LLDrawPoolTerrain::sPBRDetailScale = DETAIL_SCALE; @@ -71,8 +70,6 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : // Hack! sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale"); sPBRDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainPBRScale"); - // TODO: This is unused. Remove? - sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); sPBRDetailMode = gSavedSettings.getS32("RenderTerrainPBRDetail"); mAlphaRampImagep = LLViewerTextureManager::getFetchedTexture(IMG_ALPHA_GRAD); @@ -112,7 +109,6 @@ U32 LLDrawPoolTerrain::getVertexDataMask() void LLDrawPoolTerrain::prerender() { - sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); sPBRDetailMode = gSavedSettings.getS32("RenderTerrainPBRDetail"); } diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h index 99d192da86..13f031c8e7 100644 --- a/indra/newview/lldrawpoolterrain.h +++ b/indra/newview/lldrawpoolterrain.h @@ -66,7 +66,6 @@ public: LLPointer<LLViewerTexture> m2DAlphaRampImagep; LLPointer<LLViewerTexture> mAlphaNoiseImagep; - static S32 sDetailMode; static S32 sPBRDetailMode; static F32 sDetailScale; // textures per meter static F32 sPBRDetailScale; // textures per meter diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp index 5bc220fcbd..b4daf71ce2 100644 --- a/indra/newview/llsurfacepatch.cpp +++ b/indra/newview/llsurfacepatch.cpp @@ -201,7 +201,7 @@ LLVector2 LLSurfacePatch::getTexCoords(const U32 x, const U32 y) const void LLSurfacePatch::eval(const U32 x, const U32 y, const U32 stride, LLVector3 *vertex, LLVector3 *normal, - LLVector2 *tex0, LLVector2 *tex1, bool pbr) + LLVector2 *tex0, LLVector2 *tex1) { if (!mSurfacep || !mSurfacep->getRegion() || !mSurfacep->getGridsPerEdge() || !mVObjp) { diff --git a/indra/newview/llsurfacepatch.h b/indra/newview/llsurfacepatch.h index 0e6c045145..8c8f501dce 100644 --- a/indra/newview/llsurfacepatch.h +++ b/indra/newview/llsurfacepatch.h @@ -106,7 +106,7 @@ public: const LLVector3 &getNormal(const U32 x, const U32 y) const; void eval(const U32 x, const U32 y, const U32 stride, - LLVector3 *vertex, LLVector3 *normal, LLVector2 *tex0, LLVector2 *tex1, bool pbr); + LLVector3 *vertex, LLVector3 *normal, LLVector2 *tex0, LLVector2 *tex1); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 8ee675820c..ea821004a3 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -118,12 +118,6 @@ static bool handleRenderFarClipChanged(const LLSD& newvalue) return false; } -static bool handleTerrainDetailChanged(const LLSD& newvalue) -{ - LLDrawPoolTerrain::sDetailMode = newvalue.asInteger(); - return true; -} - static bool handleTerrainScaleChanged(const LLSD& newvalue) { F64 scale = newvalue.asReal(); @@ -720,7 +714,6 @@ void settings_setup_listeners() { setting_setup_signal_listener(gSavedSettings, "FirstPersonAvatarVisible", handleRenderAvatarMouselookChanged); setting_setup_signal_listener(gSavedSettings, "RenderFarClip", handleRenderFarClipChanged); - setting_setup_signal_listener(gSavedSettings, "RenderTerrainDetail", handleTerrainDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderTerrainScale", handleTerrainScaleChanged); setting_setup_signal_listener(gSavedSettings, "RenderTerrainPBRScale", handlePBRTerrainScaleChanged); setting_setup_signal_listener(gSavedSettings, "RenderTerrainPBRDetail", handleSetShaderChanged); diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index 130d74b286..fa19bcae87 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -121,15 +121,10 @@ void LLTerrainMaterials::setDetailAssetID(S32 asset, const LLUUID& id) LLTerrainMaterials::Type LLTerrainMaterials::getMaterialType() { - return mMaterialType; -} - -void LLTerrainMaterials::updateMaterialType() -{ LL_PROFILE_ZONE_SCOPED; const BOOL use_textures = texturesReady() || !materialsReady(); - mMaterialType = use_textures ? Type::TEXTURE : Type::PBR; + return use_textures ? Type::TEXTURE : Type::PBR; } BOOL LLTerrainMaterials::texturesReady(BOOL boost) @@ -386,7 +381,7 @@ BOOL LLVLComposition::generateComposition() return LLTerrainMaterials::generateMaterials(); } -// TODO: Re-evaluate usefulness of this function in the PBR case. There is currently a hack here to treat the material base color like a legacy terrain texture, but I'm not sure if that's useful. +// *TODO: Re-evaluate usefulness of this function in the PBR case. There is currently a hack here to treat the material base color like a legacy terrain texture, but I'm not sure if that's useful. BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, const F32 width, const F32 height) { @@ -423,7 +418,7 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, { tex = mDetailMaterials[i]->mBaseColorTexture; } - // TODO: Why are terrain textures (not terrain materials) not loading? (that is why there is a getComponents() check here) + // *TODO: Why are terrain textures (not terrain materials) not loading? (that is why there is a getComponents() check here) if (!tex || tex->getComponents() == 0) { tex = LLViewerFetchedTexture::sWhiteImagep; } S32 min_dim = llmin(tex->getFullWidth(), tex->getFullHeight()); diff --git a/indra/newview/llvlcomposition.h b/indra/newview/llvlcomposition.h index a62302292f..882c3d89b2 100644 --- a/indra/newview/llvlcomposition.h +++ b/indra/newview/llvlcomposition.h @@ -61,7 +61,6 @@ public: LLUUID getDetailAssetID(S32 asset); virtual void setDetailAssetID(S32 asset, const LLUUID& id); Type getMaterialType(); - void updateMaterialType(); BOOL texturesReady(BOOL boost = FALSE); BOOL materialsReady(BOOL boost = FALSE); @@ -71,7 +70,6 @@ protected: LLPointer<LLViewerFetchedTexture> mDetailTextures[ASSET_COUNT]; LLPointer<LLFetchedGLTFMaterial> mDetailMaterials[ASSET_COUNT]; bool mMaterialTexturesSet[ASSET_COUNT]; - Type mMaterialType = Type::TEXTURE; }; // Local materials to override all regions diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index a672777914..6318361d8d 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -246,8 +246,7 @@ void LLVOSurfacePatch::getTerrainGeometry(LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, - LLStrider<U16> &indicesp, - bool pbr) + LLStrider<U16> &indicesp) { LLFace* facep = mDrawable->getFace(0); if (!facep) @@ -263,24 +262,21 @@ void LLVOSurfacePatch::getTerrainGeometry(LLStrider<LLVector3> &verticesp, texCoords0p, texCoords1p, indicesp, - index_offset, - pbr); + index_offset); updateNorthGeometry(facep, verticesp, normalsp, texCoords0p, texCoords1p, indicesp, - index_offset, - pbr); + index_offset); updateEastGeometry(facep, verticesp, normalsp, texCoords0p, texCoords1p, indicesp, - index_offset, - pbr); + index_offset); } void LLVOSurfacePatch::updateMainGeometry(LLFace *facep, @@ -289,8 +285,7 @@ void LLVOSurfacePatch::updateMainGeometry(LLFace *facep, LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, - U32 &index_offset, - bool pbr) + U32 &index_offset) { S32 i, j, x, y; @@ -326,7 +321,7 @@ void LLVOSurfacePatch::updateMainGeometry(LLFace *facep, { x = i * render_stride; y = j * render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -394,8 +389,7 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, - U32 &index_offset, - bool pbr) + U32 &index_offset) { S32 vertex_count = 0; S32 i, x, y; @@ -427,7 +421,7 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, x = i * render_stride; y = 16 - render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -440,7 +434,7 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, { x = i * render_stride; y = 16; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -477,7 +471,7 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, x = i * render_stride; y = 16 - render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -491,7 +485,7 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, x = i * render_stride; y = 16; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -535,7 +529,7 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, x = i * north_stride; y = 16 - render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -549,7 +543,7 @@ void LLVOSurfacePatch::updateNorthGeometry(LLFace *facep, x = i * north_stride; y = 16; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -592,8 +586,7 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, - U32 &index_offset, - bool pbr) + U32 &index_offset) { S32 i, x, y; @@ -619,7 +612,7 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, x = 16 - render_stride; y = i * render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -631,7 +624,7 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, { x = 16; y = i * render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -667,7 +660,7 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, x = 16 - render_stride; y = i * render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -679,7 +672,7 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, x = 16; y = i * render_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -721,7 +714,7 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, x = 16 - render_stride; y = i * east_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -733,7 +726,7 @@ void LLVOSurfacePatch::updateEastGeometry(LLFace *facep, x = 16; y = i * east_stride; - mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get(), pbr); + mPatchp->eval(x, y, render_stride, verticesp.get(), normalsp.get(), texCoords0p.get(), texCoords1p.get()); verticesp++; normalsp++; texCoords0p++; @@ -1044,13 +1037,6 @@ void LLTerrainPartition::getGeometry(LLSpatialGroup* group) { LL_PROFILE_ZONE_SCOPED; - const LLFace* region_facep = *mFaceList.begin(); - const LLViewerObject* region_patchp = region_facep->getViewerObject(); - LLVLComposition* composition = region_patchp->getRegion()->getComposition(); - // TODO: This is not good; it will result in wrong texture repeats in cases where the assets have not loaded. Need to rebuild terrain on asset load event if it changes the composition type. Probably best to have a flag to bookkeep that, to know if the composition type has actually changed. Make sure the draw pool is boosting the textures so they load in a timely fashion. - composition->updateMaterialType(); - const bool pbr = composition->getMaterialType() == LLTerrainMaterials::Type::PBR; - LLVertexBuffer* buffer = group->mVertexBuffer; //get vertex buffer striders @@ -1087,7 +1073,7 @@ void LLTerrainPartition::getGeometry(LLSpatialGroup* group) facep->setVertexBuffer(buffer); LLVOSurfacePatch* patchp = (LLVOSurfacePatch*) facep->getViewerObject(); - patchp->getTerrainGeometry(vertices, normals, texcoords, texcoords2, indices, pbr); + patchp->getTerrainGeometry(vertices, normals, texcoords, texcoords2, indices); indices_index += facep->getIndicesCount(); index_offset += facep->getGeomCount(); diff --git a/indra/newview/llvosurfacepatch.h b/indra/newview/llvosurfacepatch.h index 06bb373578..a3dcb945d1 100644 --- a/indra/newview/llvosurfacepatch.h +++ b/indra/newview/llvosurfacepatch.h @@ -67,8 +67,7 @@ public: LLStrider<LLVector3> &normalsp, LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, - LLStrider<U16> &indicesp, - bool pbr); + LLStrider<U16> &indicesp); /*virtual*/ void updateTextures(); /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area @@ -122,24 +121,21 @@ protected: LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, - U32 &index_offset, - bool pbr); + U32 &index_offset); void updateNorthGeometry(LLFace *facep, LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, - U32 &index_offset, - bool pbr); + U32 &index_offset); void updateEastGeometry(LLFace *facep, LLStrider<LLVector3> &verticesp, LLStrider<LLVector3> &normalsp, LLStrider<LLVector2> &texCoords0p, LLStrider<LLVector2> &texCoords1p, LLStrider<U16> &indicesp, - U32 &index_offset, - bool pbr); + U32 &index_offset); }; #endif // LL_VOSURFACEPATCH_H |