Merge branch 'Firestorm_6.3.9' of https://vcs.firestormviewer.org/phoenix-firestorm into Firestorm_6.3.9
commit
18dec72cb0
|
|
@ -5295,21 +5295,14 @@ bool LLVolumeFace::cacheOptimize()
|
|||
llassert(!mOptimized);
|
||||
mOptimized = TRUE;
|
||||
|
||||
// <FS:ND> FIRE-23370/BUG-8801/MAIN-5060
|
||||
// <FS:ND> 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]);
|
||||
}
|
||||
|
||||
// <FS:ND> 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
|
||||
// <FS:ND> 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<U16> new_indices;
|
||||
|
||||
LLVCacheTriangleData* tri;
|
||||
|
||||
//prime pump by adding first triangle to cache;
|
||||
// <FS:ND> 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)
|
||||
{
|
||||
// <FS:ND> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue