From 99a50b2bb51f542cb31fee4656580a165f95a57d Mon Sep 17 00:00:00 2001 From: Nicky Date: Mon, 27 Apr 2020 13:32:14 +0200 Subject: [PATCH] Linux; FIRE-29492: completely disable cacheOptimize again. --- indra/llmath/llvolume.cpp | 44 ++++----------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index c9b3f1d1b5..77f142659b 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -5295,21 +5295,14 @@ bool LLVolumeFace::cacheOptimize() llassert(!mOptimized); mOptimized = TRUE; - // FIRE-23370/BUG-8801/MAIN-5060 + // FIRE-23370/BUG-8801/MAIN-5060/FIRE-29492 // cacheOptimize will destroy triangles. This is due to LLVCacheVertexData pointing to vertices in the vector vertex_data. // Once vertex_data is sorted (std::sort(triangle_data.begin(), triangle_data.end()) ) this will invalidate those pointers and // LLVCacheVertexData suddenly does point to unrelated vertices. It is an interesting fact that this is no problem for the // windows version. // - // To solve the issue with the pointer invalidation it use a std::vector< U16 > for triangle indices, sort this using - // std::sort( v.begin(), v.end(), [&triangle_data](U16 rhs, U16 lhs ){ return triangle_data[rhs].mScore > triangle_data[lhs].mScore; } - // Then access all LLVCacheTriangleData> via triangle_data[ v[ idx ] ]. - // - // Unfortunately this is a bit of a messy interwoven change all of this method, alternative is to copy a Linux specific version. Which - // won't be that great either - // NB The change really should be safe for Winows too, in fact it is surprising Windows does not suffer fro the sae bug. Just cannot test - // the windows versions right now. +#ifndef LL_LINUX LLVCacheLRU cache; if (mNumVertices < 3 || mNumIndices < 3) @@ -5344,13 +5337,6 @@ bool LLVolumeFace::cacheOptimize() triangle_data[tri_idx].mVertex[i%3] = &(vertex_data[idx]); } -// FIRE-23370/BUG-8801/MAIN-5060 -#ifdef LL_LINUX - std::vector< U32 > v; - for (U32 j = 0; j < triangle_data.size(); ++j) - v.push_back( j ); -#endif - /*F32 pre_acmr = 1.f; //measure cache misses from before rebuild { @@ -5382,27 +5368,14 @@ bool LLVolumeFace::cacheOptimize() } //sort triangle data by score -// FIRE-23370/BUG-8801/MAIN-5060 -#ifndef LL_LINUX std::sort(triangle_data.begin(), triangle_data.end()); -#else - std::sort( v.begin(), v.end(), - [&triangle_data](U16 rhs, U16 lhs ) - { return triangle_data[rhs].mScore > triangle_data[lhs].mScore; } - ); -#endif std::vector new_indices; LLVCacheTriangleData* tri; //prime pump by adding first triangle to cache; -// FIRE-23370/BUG-8801/MAIN-5060 -#ifndef LL_LINUX tri = &(triangle_data[0]); -#else - tri = &(triangle_data[v[0]]); -#endif cache.addTriangle(tri); new_indices.push_back(tri->mVertex[0]->mIdx); @@ -5420,21 +5393,11 @@ bool LLVolumeFace::cacheOptimize() breaks++; for (U32 j = 0; j < triangle_data.size(); ++j) { -// FIRE-23370/BUG-8801/MAIN-5060 -#ifndef LL_LINUX if (triangle_data[j].mActive) { tri = &(triangle_data[j]); break; } -#else - if (triangle_data[v[j]].mActive) - { - tri = &(triangle_data[v[j]]); - break; - } -#endif - } } @@ -5565,7 +5528,8 @@ bool LLVolumeFace::cacheOptimize() //std::string result = llformat("ACMR pre/post: %.3f/%.3f -- %d triangles %d breaks", pre_acmr, post_acmr, mNumIndices/3, breaks); //LL_INFOS() << result << LL_ENDL; - +#endif + return true; }